Package org.springframework.core.io

Examples of org.springframework.core.io.FileSystemResource


        return Collections.singletonList(classLoaderXmlPreprocessor);
    }
   
    protected List getBeanFactoryPostProcessors(String serviceUnitRootPath) {
        PropertyPlaceholderConfigurer propertyPlaceholder = new PropertyPlaceholderConfigurer();
        FileSystemResource propertiesFile = new FileSystemResource(
                new File(serviceUnitRootPath) + "/" + getXBeanFile()
                        + ".properties");
        if (propertiesFile.getFile().exists()) {               
            propertyPlaceholder.setLocation(propertiesFile);
            return Collections.singletonList(propertyPlaceholder);
        }
        return Collections.EMPTY_LIST;
    }
View Full Code Here


       
        ClassLoader old = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(classLoader);
        try {
            BrokerFactoryBean brokerFactory = new BrokerFactoryBean(
                    new FileSystemResource(new File(amqConfigUri)));
            //TODO There should be a better way to avoid the concurrent broker creations
            synchronized (BrokerServiceGBeanImpl.class) {
                System.setProperty("activemq.brokerName", brokerName);
                System.setProperty("activemq.home", new File(baseDir).toString());
                System.setProperty("activemq.data", new File(dataDir).toString());
View Full Code Here

        LOG.debug("Now attempting to figure out the type of resource: " + uri);

        Resource resource;
        File file = new File(uri);
        if (file.exists()) {
            resource = new FileSystemResource(uri);
        } else if (ResourceUtils.isUrl(uri)) {
            resource = new UrlResource(uri);
        } else {
            resource = new ClassPathResource(uri);
        }
View Full Code Here

        pw.flush();
        pw.close();

        JaasAuthenticationProvider myJaasProvider = new JaasAuthenticationProvider();
        myJaasProvider.setApplicationEventPublisher(context);
        myJaasProvider.setLoginConfig(new FileSystemResource(configFile));
        myJaasProvider.setAuthorityGranters(jaasProvider.getAuthorityGranters());
        myJaasProvider.setCallbackHandlers(jaasProvider.getCallbackHandlers());
        myJaasProvider.setLoginContextName(jaasProvider.getLoginContextName());

        myJaasProvider.afterPropertiesSet();
View Full Code Here

        LOG.debug("Now attempting to figure out the type of resource: " + uri);

        Resource resource;
        File file = new File(uri);
        if (file.exists()) {
            resource = new FileSystemResource(uri);
        } else if (ResourceUtils.isUrl(uri)) {
            resource = new UrlResource(uri);
        } else {
            resource = new ClassPathResource(uri);
        }
View Full Code Here

        String password = null;
        String locationProperty = System.getProperty("javax.net.ssl.keyStore");
        if (StringUtils.hasLength(locationProperty)) {
            File f = new File(locationProperty);
            if (f.exists() && f.isFile() && f.canRead()) {
                location = new FileSystemResource(f);
            }
            String passwordProperty = System.getProperty("javax.net.ssl.keyStorePassword");
            if (StringUtils.hasLength(passwordProperty)) {
                password = passwordProperty;
            }
View Full Code Here

        String password = null;
        String locationProperty = System.getProperty("javax.net.ssl.trustStore");
        if (StringUtils.hasLength(locationProperty)) {
            File f = new File(locationProperty);
            if (f.exists() && f.isFile() && f.canRead()) {
                location = new FileSystemResource(f);
            }
            String passwordProperty = System.getProperty("javax.net.ssl.trustStorePassword");
            if (StringUtils.hasLength(passwordProperty)) {
                password = passwordProperty;
            }
            type = System.getProperty("javax.net.ssl.trustStoreType");
        }
        else {
            String javaHome = System.getProperty("java.home");
            location = new FileSystemResource(javaHome + "/lib/security/jssecacerts");
            if (!location.exists()) {
                location = new FileSystemResource(javaHome + "/lib/security/cacerts");
            }
        }
        // use the factory bean here, easier to setup
        KeyStoreFactoryBean factoryBean = new KeyStoreFactoryBean();
        factoryBean.setLocation(location);
View Full Code Here

  private static synchronized ExclusionFilterFactory getFactory(String
      configPath) {
    if(factory != null) {
      return factory;
    }
    Resource resource = new FileSystemResource(configPath);
    XmlBeanFactory xmlFactory = new XmlBeanFactory(resource);
    factory = (ExclusionFilterFactory) xmlFactory.getBean(CONFIG_ID);
    return factory;
  }
View Full Code Here

    if(configPath == null) {
      throw new ConfigurationException("Missing " + CONFIG_PATH
          + " parameter");
    }
    String resolvedPath = servletContext.getRealPath(configPath);
    Resource resource = new FileSystemResource(resolvedPath);
    factory = new XmlBeanFactory(resource);
    factory.preInstantiateSingletons();
  }
View Full Code Here

       
        Set<Resource> eclipseProjects = new HashSet<Resource>();
       
        // Scan plugins exploded as unpacked JAR directories
        for (File projectFolder : folder.listFiles(m_DirectoryFilter)) {
            eclipseProjects.add(new FileSystemResource(projectFolder));
        }

        for (Resource resource : eclipseProjects) {
            Manifest man = getManifestFromProject(resource);
            if (man != null) {
                addPlugin(plugins, resource, man, true);
            } else {
                // this is not a project folder, so descend to find potential nested modules
                List<String> list = Arrays.asList( ((FileSystemResource)resource).getFile().list() );
                for ( String str : list ) {
                    // do not process eclipse proejcts at the moment
                    if ( str.contains( "drools-eclipse" ) ||  str.contains( "osgi-bundles" ) ) {
                        list = null;
                    }
                }
                if ( list != null && list.contains("pom.xml")) {
                    importPluginFromFolder(((FileSystemResource)resource).getFile(), plugins);
                }
            }
        }

        Set<Resource> packagedBundles = new HashSet<Resource>();

        // Scan plugins provided as JAR files
        for (File jarFile : folder.listFiles(m_JARFileFilter))
            packagedBundles.add(new FileSystemResource(jarFile));

        for (Resource resource : packagedBundles) {
            Manifest man = getManifestFromJAR(resource);
            if (man != null)
                addPlugin(plugins, resource, man, false);
View Full Code Here

TOP

Related Classes of org.springframework.core.io.FileSystemResource

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.