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:at.molindo.wicketutils.openid.OpenIdSession.java

License:Apache License

private ConsumerManager getConsumerManager() {
    Application app = Session.get().getApplication();
    ConsumerManager consumerManager = app.getMetaData(CONSUMER_MANAGER_KEY);
    if (consumerManager == null) {
        // double checked locking
        synchronized (CONSUMER_MANAGER_KEY) {
            consumerManager = app.getMetaData(CONSUMER_MANAGER_KEY);
            if (consumerManager == null) {
                consumerManager = new ConsumerManager();
                consumerManager.setAssociations(new InMemoryConsumerAssociationStore());
                consumerManager.setNonceVerifier(new InMemoryNonceVerifier(10000));
                app.setMetaData(CONSUMER_MANAGER_KEY, consumerManager);
            }/*from w  w  w. j  a va2  s . com*/
        }
    }
    return consumerManager;
}

From source file:com.aplombee.RepeaterUtil.java

License:Apache License

public RepeaterUtil(Application application) {
    this.application = application;
    application.setMetaData(REPEATER_UTIL_KEY, this);
}

From source file:com.mylab.wicket.jpa.ui.pages.select2.ApplicationSettings.java

License:Apache License

/**
 * Retrieves the instance of settings object.
 * /*w  w w  . ja  va2s.  c o  m*/
 * @return settings instance
 */
public static ApplicationSettings get() {
    // FIXME Application should provide setMetadataIfAbsent()
    Application application = Application.get();
    ApplicationSettings settings = application.getMetaData(KEY);
    if (settings == null) {
        synchronized (application) {
            settings = application.getMetaData(KEY);
            if (settings == null) {
                settings = new ApplicationSettings();
                application.setMetaData(KEY, settings);
            }
        }
    }
    return application.getMetaData(KEY);
}

From source file:de.alpharogroup.wicket.base.application.plugins.ApplicationDebugSettingsPlugin.java

License:Apache License

/**
 * Sets the specified {@link ApplicationDebugSettingsPlugin} in the application metadata.
 *
 * @param app// ww  w.  jav a 2  s.c om
 *            the app
 * @param plugin
 *            the plugin
 */
public void set(final Application app, final ApplicationDebugSettingsPlugin plugin) {
    app.setMetaData(DEBUG_SETTINGS_PLUGIN_KEY, plugin);
}

From source file:de.alpharogroup.wicket.base.application.plugins.SecuritySettingsPlugin.java

License:Apache License

/**
 * Sets the specified {@link SecuritySettingsPlugin} in the application metadata.
 *
 * @param app/*  w w  w.  j a v  a  2  s  .  c om*/
 *            the app
 * @param plugin
 *            the plugin
 */
public void set(final Application app, final SecuritySettingsPlugin plugin) {
    app.setMetaData(SECURITY_SETTINGS_PLUGIN_KEY, plugin);
}

From source file:eu.uqasar.auth.strategies.metadata.MetaDataAuthorizationStrategy.java

License:Apache License

/**
 * Authorizes the given roles to create component instances of type
 * componentClass. This authorization is added to any previously authorized
 * roles.//from   w w w.  j a v a  2 s .c  om
 *
 * @param <T>
 *
 * @param componentClass The component type that is subject for the
 * authorization
 * @param roles The roles that are authorized to create component instances
 * of type componentClass
 */
private static <T extends Component> void authorize(final Class<T> componentClass, final Role... roles) {
    final Application application = Application.get();
    InstantiationPermissions permissions = application.getMetaData(INSTANTIATION_PERMISSIONS);
    if (permissions == null) {
        permissions = new InstantiationPermissions();
        application.setMetaData(INSTANTIATION_PERMISSIONS, permissions);
    }
    permissions.authorize(componentClass, roles);
}

From source file:fiftyfive.wicket.js.JavaScriptDependencySettings.java

License:Apache License

/**
 * Returns the JavaScriptDependencySettings associated with the current
 * Wicket Application, creating a new default settings object if one does
 * not yet exist. This method can only be called within a Wicket thread.
 *//*from   w  ww .  j a  va2s .c o  m*/
public static JavaScriptDependencySettings get() {
    Application app = Application.get();
    if (null == app) {
        throw new IllegalStateException("No thread-local Wicket Application object was found. "
                + "JavaScriptDependencySettings.get() can only be called " + "within a Wicket request.");
    }
    JavaScriptDependencySettings settings = app.getMetaData(SETTINGS_KEY);
    if (null == settings) {
        settings = new JavaScriptDependencySettings(app);
        app.setMetaData(SETTINGS_KEY, settings);
    }
    return settings;
}

From source file:fiftyfive.wicket.shiro.ShiroWicketPlugin.java

License:Apache License

/**
 * Register the specified {@code ShiroWicketPlugin} in the application so that
 * {@link #get} will work. You should never need to call this method directly, unless you
 * are subclassing and overriding the {@link #install} method.
 *//* w w  w.  java2s. c  o m*/
public static void set(Application app, ShiroWicketPlugin plugin) {
    app.setMetaData(PLUGIN_KEY, plugin);
}

From source file:jp.comuri.wicket.PicoContainerComponentInjector.java

License:Apache License

public PicoContainerComponentInjector(Application app, PicoContainer container) {
    app.setMetaData(PICO_CONTAINER_KEY, container);
    InjectorHolder.setInjector(new PicoContainerInjector());
}

From source file:name.martingeisse.wicket.component.sprite.ApplicationSpriteSupport.java

License:Open Source License

/**
 * Initializes sprite support for the specified application.
 * @param application the Wicket application
 *///from w ww .ja v  a 2 s.co m
public static void initialize(Application application) {
    application.setMetaData(KEY, new ApplicationSpriteSupport());
}