List of usage examples for org.apache.wicket Application getName
public final String getName()
From source file:org.odlabs.wiquery.core.commons.WiQueryInitializer.java
License:Open Source License
/** * Method finding and calling the {@link IWiQueryInitializer} *//*from ww w .ja v a2 s . co m*/ private void retrieveAndCallInitializers(Application application, WiQuerySettings wiQuerySettings) { InputStream in = null; Iterator<URL> resources = null; IWiQueryInitializer wiQueryInitializer; List<IWiQueryInitializer> initializers = new ArrayList<IWiQueryInitializer>(); Properties properties = null; URL url = null; try { resources = application.getApplicationSettings().getClassResolver().getResources("wiquery.properties"); while (resources.hasNext()) { try { url = resources.next(); LOGGER.info("Find the wiQuery initializer:", url.toString()); properties = new Properties(); in = url.openStream(); properties.load(in); wiQueryInitializer = getIWiQueryInitializer(properties.getProperty("initializer")); if (wiQueryInitializer != null) { initializers.add(wiQueryInitializer); } wiQueryInitializer = getIWiQueryInitializer( properties.getProperty(application.getName() + "-initializer")); if (wiQueryInitializer != null) { initializers.add(wiQueryInitializer); } } finally { if (in != null) { in.close(); } } } } catch (Exception e) { LOGGER.error("Unable to load initializers file", e); } if (initializers.size() > 0) { for (IWiQueryInitializer initializer : initializers) { LOGGER.info("[" + application.getName() + "] init: " + initializer); initializer.init(application, wiQuerySettings); } } }
From source file:org.odlabs.wiquery.core.WiQueryInitializer.java
License:Open Source License
/** * @param wiQuerySettings//from w ww . j a v a 2s .c om * @param properties * Properties map with names of any library initializers in it */ private void load(Application application, WiQuerySettings wiQuerySettings, Properties properties) { addInitializer(wiQuerySettings, properties.getProperty("initializer")); addInitializer(wiQuerySettings, properties.getProperty(application.getName() + "-initializer")); }
From source file:org.odlabs.wiquery.core.WiQueryInitializer.java
License:Open Source License
/** * Iterate initializers list, calling any instances found in it. * /*w ww . j a v a 2 s . c o m*/ * @param wiQuerySettings */ private void callInitializers(Application application, WiQuerySettings wiQuerySettings) { for (IWiQueryInitializer initializer : wiQuerySettings.getInitializers()) { LOGGER.info("[" + application.getName() + "] init: " + initializer); initializer.init(application, wiQuerySettings); } }
From source file:sk.drunkenpanda.leaflet.Leaflet.java
License:Apache License
/** * Returns Leaflet settings of given application. * * @param application application, which setting are retrieved * @return leaflet settings of application * @throws IllegalArgumentException if application is {@code null} * @throws IllegalStateException if Leaflet is not installed in application *///from w w w . j a va2 s.c o m public static LeafletSettings getSettings(Application application) { // get settings by MetaKey Args.notNull(application, "application"); LeafletSettings settings = application.getMetaData(LEAFLET_SETTINGS_KEY); if (settings == null) { throw new IllegalStateException( "Leaflets aren't installed in application [" + application.getName() + "]."); } return settings; }