Package com.sun.jna.platform.mac

Examples of com.sun.jna.platform.mac.MacFileUtils$FileManager


     * Gets the version used to export the packages. it tries to get it from MANIFEST.MF, or the file name
     */
    protected String getVersion(URL url) {
        if ("jar".equals(url.getProtocol())) {
            try {
                FileManager fileManager = ServletActionContext.getContext().getInstance(FileManagerFactory.class).getFileManager();
                JarFile jarFile = new JarFile(new File(fileManager.normalizeToFileProtocol(url).toURI()));
                Manifest manifest = jarFile.getManifest();
                if (manifest != null) {
                    String version = manifest.getMainAttributes().getValue("Bundle-Version");
                    if (StringUtils.isNotBlank(version)) {
                        return getVersionFromString(version);
View Full Code Here


        return container;
    }

    private void init_CheckConfigurationReloading(Container container) {
        FileManager fileManager = container.getInstance(FileManager.class);
        fileManager.setReloadingConfigs("true".equals(container.getInstance(String.class,
                StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD)));
    }
View Full Code Here

        LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");

        container = dispatcherUtils.getContainer();
        //check for configuration reloading
        if ("true".equalsIgnoreCase(container.getInstance(String.class, StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD))) {
            FileManager fileManager = container.getInstance(FileManager.class);
            fileManager.setReloadingConfigs(true);
        }

        actionMapper = container.getInstance(ActionMapper.class);
    }
View Full Code Here

    /**
     * Reloads the Configuration files if the configuration files indicate that they need to be reloaded.
     * @param container current container used to obtain instance of {@link com.opensymphony.xwork2.util.fs.DefaultFileManager}
     */
    public synchronized void conditionalReload(Container container) {
        FileManager fileManager = container.getInstance(FileManager.class);
        if (fileManager.isReloadingConfigs()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Checking ConfigurationProviders for reload.");
            }
            List<ContainerProvider> providers = getContainerProviders();
            boolean reload = needReloadContainerProviders(providers);
View Full Code Here

        Mock mockContainer = new Mock(Container.class);
        mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
        mockContainer.expectAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), destroyedObjectFactory);
        mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
        mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
        FileManager fileManager = new DefaultFileManager();
        mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManager.class)), fileManager);
        mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManager.class)), fileManager);
        mockConfiguration.expect("destroy");
        mockConfiguration.matchAndReturn("getPackageConfigs", new HashMap<String, PackageConfig>());
       
View Full Code Here

        // TODO: add alias tests
        assertEquals(17, validatorList.size());
    }

    public void testGetValidatorsForGivenMethodNameWithoutReloading() throws ValidationException {
        FileManager fileManager = container.getInstance(FileManager.class);
        List validatorList = annotationActionValidatorManager.getValidators(SimpleAnnotationAction.class, alias, "execute");

        //disable configuration reload/devmode
        fileManager.setReloadingConfigs(false);

        //17 in the class level + 0 in the alias
        assertEquals(12, validatorList.size());
       
        validatorList = annotationActionValidatorManager.getValidators(SimpleAnnotationAction.class, alias, "execute");
View Full Code Here

            LOG.debug("Found following implementations of FileManager interface: #0", names.toString());
        }
        Set<FileManager> internals = new HashSet<FileManager>();
        Set<FileManager> users = new HashSet<FileManager>();
        for (String fmName : names) {
            FileManager fm = container.getInstance(FileManager.class, fmName);
            if (fm.internal()) {
                internals.add(fm);
            } else {
                users.add(fm);
            }
        }
        for (FileManager fm : users) {
            if (fm.support()) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Using FileManager implementation [#0]", fm.getClass().getSimpleName());
                }
                fm.setReloadingConfigs(reloadingConfigs);
                return fm;
            }
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("No user defined FileManager, looking up for internal implementations!");
        }
        for (FileManager fm : internals) {
            if (fm.support()) {
                return fm;
            }
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Using default implementation of FileManager provided under name [system]: #0", fileManager.getClass().getSimpleName());
View Full Code Here

    /**
     * Reloads the Configuration files if the configuration files indicate that they need to be reloaded.
     * @param container current container used to obtain instance of {@link com.opensymphony.xwork2.util.fs.DefaultFileManager}
     */
    public synchronized void conditionalReload(Container container) {
        FileManager fileManager = container.getInstance(FileManagerFactory.class).getFileManager();
        if (fileManager.isReloadingConfigs() || providersChanged) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Checking ConfigurationProviders for reload.");
            }
            List<ContainerProvider> providers = getContainerProviders();
            boolean reload = needReloadContainerProviders(providers);
View Full Code Here

    }

    public void testReloadingConfigs() throws Exception {
        // given
        container.getInstance(FileManagerFactory.class).setReloadingConfigs("false");
        FileManager fm = container.getInstance(FileManagerFactory.class).getFileManager();
        assertFalse(fm.isReloadingConfigs());

        // when
        container.getInstance(FileManagerFactory.class).setReloadingConfigs("true");
        fm = container.getInstance(FileManagerFactory.class).getFileManager();

        // then
        assertTrue(fm.isReloadingConfigs());
    }
View Full Code Here

        DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
        factory.setFileManager(new DefaultFileManager());
        factory.setContainer(new DummyContainer());

        // when
        FileManager fm = factory.getFileManager();

        // then
        assertTrue(fm instanceof DefaultFileManager);
    }
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.mac.MacFileUtils$FileManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.