private EnvironmentConfigurationSource(EnvironmentConfiguration configuration, int priority) { if (configuration == null) { throw new NullPointerException("configuration: null"); } if (priority < 0) { throw new IllegalArgumentException("priority of a configuration cannot be negative"); } this.configuration = configuration; this.priority = priority; }
/** * The main method. * * @param args * the arguments */ public static void main(String[] args) { System.out.println(getFiles(".", "z:\\dev\\yajsw\\..\\yajsw\\*.jar") .size()); try { // String // fileName=FilenameUtils.separatorsToSystem("C:\\init\\MOBILEguard\\yajsw/lib/jvmstat/*.jar"); // System.out.println("FileName: "+fileName); CompositeConfiguration compConfig = new CompositeConfiguration(); AbstractConfiguration configuraton = new BaseConfiguration(); compConfig.addConfiguration(new EnvironmentConfiguration()); configuraton.setProperty("wrapper.java.classpath.1", "${VERSANT_ROOT}/lib/jvi.*jar"); configuraton.setProperty("wrapper.java.classpath.2", "${GROOVY_HOME}/lib/*.jar"); compConfig.addConfiguration(configuraton); System.out.println("Configuration: " + ConfigurationConverter.getProperties(compConfig)); System.out.println("subset: " + ConfigurationConverter.getProperties(compConfig .subset("wrapper.java"))); // Collection files=FileUtils.getFiles("../..", // "C:/versant/7_0_1/lib/jvi*.jar"); // Collection collection= // org.apache.commons.io.FileUtils.listFiles(new File("C:/"), // new WildcardFileFilter("jvi*.jar"), new // WildcardFileFilter("*jar")); // File[] files= new // File("C:").listFiles((FilenameFilter)FileFilterUtils.nameFileFilter("C:/versant/7_0_1/lib/jvi*.jar")); // // FileUtils.getFiles("C:/versant/7_0_1/lib/", "jvi*.jar"); // System.out.println("FileList="+ // FileUtils.getFiles("C:/versant/7_0_1/lib/", "jvi*.jar")); // java.util.Arrays.asList(files)); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Creates an instance of {@link EnvironmentConfigurationSource}. * * @param priority priority at which this {@link ConfigurationSource} to be loaded among other * Configuration sources */ public static EnvironmentConfigurationSource create(int priority) { return new EnvironmentConfigurationSource(new EnvironmentConfiguration(), priority); }
/** * Creates an instance of {@link EnvironmentConfigurationSource}. * * @param configuration the system configuration to delegate to * @param priority priority at which this {@link ConfigurationSource} to be loaded among other * Configuration sources */ public static EnvironmentConfigurationSource create( EnvironmentConfiguration configuration, int priority) { return new EnvironmentConfigurationSource(configuration, priority); }