Example usage for org.apache.wicket Application setMetaData

List of usage examples for org.apache.wicket Application setMetaData

Introduction

In this page you can find the example usage for org.apache.wicket Application setMetaData.

Prototype

public final synchronized <T> Application setMetaData(final MetaDataKey<T> key, final Object object) 

Source Link

Document

Sets the metadata for this application using the given key.

Usage

From source file:org.wicketstuff.jamon.application.JamonInitializer.java

License:Apache License

@Override
public void init(Application application) {
    application.setMetaData(MonitoringRepositoryKey.KEY, new JamonRepository());
    application.getRequestCycleListeners().add(new JamonAwareRequestCycleListener(application, true));
}

From source file:org.wicketstuff.jslibraries.JSLib.java

License:Apache License

/**
 * Not to be used by Component authors. This should be used as an application-wide setting for
 * which providers to use. If set, it will be applied instead of the providers passed
 * /*from ww w.  j  a v a  2s  .c  om*/
 * @param app
 * @param providers
 */
public static void setOverrideProviders(final Application app, final Provider... providers) {
    Assert.parameterNotNull(app, "app");
    Assert.parameterNotNull(providers, "providers");
    app.setMetaData(PROVIDER_KEY, providers);
}

From source file:org.wicketstuff.mergedresources.ResourceMount.java

License:Apache License

/**
 * set {@link ICssCompressor} used by {@link CompressedMergedCssResource}
 * //w ww.  j av  a2s . c  om
 * @param application
 * @param compressor
 */
public static void setCssCompressor(Application application, ICssCompressor compressor) {
    application.setMetaData(CSS_COMPRESSOR_KEY, compressor);
}

From source file:org.wicketstuff.springreference.SpringReferenceSupporter.java

License:Apache License

/**
 * Registers the passed in supporter with the wicket application. This is the more sophisticated
 * variant of registration. Most users could go with {@link #register(WebApplication)}.
 * //from   ww w .j  a v  a2  s  .  c o  m
 * @param application
 *            wicket application, not null
 * @param supporter
 *            spring reference supporter. Null value means removal.
 */
public static void register(Application application, SpringReferenceSupporter supporter) {
    Args.notNull(application, "application");

    application.setMetaData(LOCATOR_KEY, supporter);
}

From source file:ro.fortsoft.wicket.pivot.web.PivotSettings.java

License:Apache License

/**
 * Retrieves the instance of settings object.
 * //from  www  .j  a  v  a  2s.  c o  m
 * @return settings instance
 */
public static PivotSettings get() {
    Application application = Application.get();
    PivotSettings settings = application.getMetaData(KEY);
    if (settings == null) {
        synchronized (application) {
            settings = application.getMetaData(KEY);
            if (settings == null) {
                settings = new PivotSettings();
                application.setMetaData(KEY, settings);
            }
        }
    }

    return application.getMetaData(KEY);
}

From source file:ro.fortsoft.wicket.plugin.PluginManagerInitializer.java

License:Apache License

@Override
public void init(Application application) {
    pluginManager = createPluginManager(application);
    if (pluginManager == null) {
        throw new WicketRuntimeException("Plugin manager cannot be null");
    }/* www .j a  va 2 s  . com*/

    log.debug("Created plugin manager {}", pluginManager);

    // load plugins        
    pluginManager.loadPlugins();

    // init plugins
    List<PluginWrapper> resolvedPlugins = pluginManager.getResolvedPlugins();
    for (PluginWrapper plugin : resolvedPlugins) {
        if (plugin.getPlugin() instanceof WicketPlugin) {
            ((WicketPlugin) plugin.getPlugin()).init(application);
        }
    }

    // start plugins
    pluginManager.startPlugins();

    // set class resolver
    CompoundClassResolver classResolver = new CompoundClassResolver();
    List<PluginWrapper> startedPlugins = pluginManager.getStartedPlugins();
    for (PluginWrapper plugin : startedPlugins) {
        classResolver.add(new PluginClassResolver(plugin));
    }
    application.getApplicationSettings().setClassResolver(classResolver);

    // store plugin manager in application
    application.setMetaData(PLUGIN_MANAGER_KEY, pluginManager);

    // add PluginComponentInjector
    application.getComponentInstantiationListeners().add(new PluginComponentInjector(application));
}