private static SPInterface getWSAG4JSPI() { // get the library classloaders for discovery ClassLoaders loaders = ClassLoaders.getLibLoaders( WSAG4JConfigurationEnvironment.class, DiscoverClass.class, true ); // load the properties file via the classloaders Properties properties = ResourceUtils.loadProperties( WSAG4JConfigurationEnvironment.class, WSAG4JEnvironment.DEFAULT_CONFIGURATION_FILE, loaders ); if ( properties == null ) { properties = new Properties(); } // find the path of the application configuration String cPath = properties.getProperty( WSAG4JEnvironment.DEFAULT_CONFIGURATION_PATH_KEY, WSAG4JEnvironment.DEFAULT_CONFIGURATION_PATH ); // instantiate new SPI with the configuration path // the configuration path is passed to the MSSConfigurationEnvironment // class on instantiation of the class by the discovery framework SPInterface mssConfigSP = new SPInterface( WSAG4JConfigurationEnvironment.class, new Class[] { String.class }, new Object[] { cPath } ); return mssConfigSP; }
Resource resource = getResource(spi, propertiesFileName, classLoaders); if (resource != null) { InputStream stream = resource.getResourceAsStream();
resourceName = getPackageName(spi).replace('.','/') + "/" + resourceName; resources = explorer.findResources(resourceName);
/** * Returns the {@code Properties} instance, loaded if necessary from {@code propertiesFileName}. * * @param spi Optional SPI (may be null). * If provided, an attempt is made to load the * property file as-per Class.getResource(). * * @param loaders Used only if properties need to be loaded. * * @return The {@code Properties}, loaded if necessary. */ public Properties getProperties(SPInterface<?> spi, ClassLoaders loaders) { if (properties == null) { properties = ResourceUtils.loadProperties(spi.getSPClass(), getPropertiesFileName(), loaders); } return properties; }