本文整理匯總了Java中org.apache.wicket.Application.getMetaData方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getMetaData方法的具體用法?Java Application.getMetaData怎麽用?Java Application.getMetaData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.wicket.Application
的用法示例。
在下文中一共展示了Application.getMetaData方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getConnection
import org.apache.wicket.Application; //導入方法依賴的package包/類
@Override
public IWebSocketConnection getConnection(Application application, String sessionId, IKey key)
{
Args.notNull(application, "application");
Args.notNull(sessionId, "sessionId");
Args.notNull(key, "key");
IWebSocketConnection connection = null;
ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
if (connectionsBySession != null)
{
ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
if (connectionsByPage != null)
{
connection = connectionsByPage.get(key);
}
}
return connection;
}
示例2: getConnections
import org.apache.wicket.Application; //導入方法依賴的package包/類
@Override
public Collection<IWebSocketConnection> getConnections(Application application, String sessionId)
{
Args.notNull(application, "application");
Args.notNull(sessionId, "sessionId");
Collection<IWebSocketConnection> connections = Collections.emptyList();
ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
if (connectionsBySession != null)
{
ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
if (connectionsByPage != null)
{
connections = connectionsByPage.values();
}
}
return connections;
}
示例3: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Retrieves the instance of settings object.
*
* @return settings instance
*/
public static DashboardSettings get() {
Application application = Application.get();
DashboardSettings settings = application.getMetaData(KEY);
if (settings == null) {
synchronized (application) {
settings = application.getMetaData(KEY);
if (settings == null) {
settings = new DashboardSettings();
application.setMetaData(KEY, settings);
}
}
}
return application.getMetaData(KEY);
}
示例4: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Retrieves the instance of settings object.
*
* @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);
}
示例5: getSettings
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* 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
*/
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;
}
示例6: configure
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Configures the specified application
*
* @param application
* @return
*/
public void configure(Application application) {
if (application.getMetaData(CDI_CONFIGURATION_KEY) != null) {
throw new IllegalStateException("Cdi already configured for this application");
}
application.setMetaData(CDI_CONFIGURATION_KEY, this);
RequestCycleListenerCollection listeners = new RequestCycleListenerCollection();
application.getRequestCycleListeners().add(listeners);
// enable conversation propagation
if (getPropagation() != ConversationPropagation.NONE) {
listeners.add(new ConversationPropagator(application, getPropagation()));
application.getComponentPreOnBeforeRenderListeners().add(
new AutoConversationManager(getPropagation()));
application.getComponentPreOnBeforeRenderListeners().add(
new ConversationExpiryChecker());
}
// enable detach event
listeners.add(new DetachEventEmitter());
NonContextual.of(application.getClass()).postConstruct(application);
// enable injection of various framework components
application.getSessionListeners().add(new SessionInjector());
application.getComponentInstantiationListeners().add(new ExtendedComponentInjector());
application.getBehaviorInstantiationListeners().add(new BehaviorInjector());
// enable cleanup
application.getApplicationListeners().add(new CdiShutdownCleaner());
}
示例7: setConnection
import org.apache.wicket.Application; //導入方法依賴的package包/類
@Override
public void setConnection(Application application, String sessionId, IKey key, IWebSocketConnection connection)
{
Args.notNull(application, "application");
Args.notNull(sessionId, "sessionId");
Args.notNull(key, "key");
ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
if (connectionsBySession == null)
{
synchronized (KEY)
{
connectionsBySession = application.getMetaData(KEY);
if (connectionsBySession == null)
{
connectionsBySession = Generics.newConcurrentHashMap();
application.setMetaData(KEY, connectionsBySession);
}
}
}
ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
if (connectionsByPage == null && connection != null)
{
connectionsByPage = connectionsBySession.get(sessionId);
if (connectionsByPage == null)
{
connectionsByPage = Generics.newConcurrentHashMap();
ConcurrentMap<IKey, IWebSocketConnection> old = connectionsBySession.putIfAbsent(sessionId, connectionsByPage);
if (old != null)
{
connectionsByPage = old;
}
}
}
if (connection != null)
{
connectionsByPage.put(key, connection);
}
else if (connectionsByPage != null)
{
connectionsByPage.remove(key);
if (connectionsByPage.isEmpty())
{
connectionsBySession.remove(sessionId);
}
}
}
示例8: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
public static ScriptExecutorHolder get(Application application)
{
return application.getMetaData(SCRIPT_EXECUTOR_HOLDER);
}
示例9: get
import org.apache.wicket.Application; //導入方法依賴的package包/類
public static CdiConfiguration get(Application application) {
return application.getMetaData(CDI_CONFIGURATION_KEY);
}
示例10: authorize
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Authorizes the given roles to create component instances of type
* componentClass. This authorization is added to any previously authorized
* roles.
*
* @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);
}
示例11: authorizeAll
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Grants permission to all roles to create instances of the given component
* class.
*
* @param <T>
*
* @param componentClass The component class
*/
private static <T extends Component> void authorizeAll(final Class<T> componentClass) {
Application application = Application.get();
InstantiationPermissions authorizedLevels = application.getMetaData(INSTANTIATION_PERMISSIONS);
if (authorizedLevels != null) {
authorizedLevels.authorizeAll(componentClass);
}
}
示例12: authorize
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Authorizes the given role to create component instances of type
* componentClass. This authorization is added to any previously authorized
* roles.
*
* @param <T>
*
* @param componentClass
* The component type that is subject for the authorization
* @param roles
* The comma separated roles that are authorized to create
* component instances of type componentClass
*/
public static final <T extends Component> void authorize(final Class<T> componentClass, final String 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, new Roles(roles));
}
示例13: authorizeAll
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* Grants permission to all roles to create instances of the given component
* class.
*
* @param <T>
*
* @param componentClass
* The component class
*/
public static final <T extends Component> void authorizeAll(final Class<T> componentClass) {
Application application = Application.get();
InstantiationPermissions authorizedRoles = application.getMetaData(INSTANTIATION_PERMISSIONS);
if (authorizedRoles != null) {
authorizedRoles.authorizeAll(componentClass);
}
}
示例14: settings
import org.apache.wicket.Application; //導入方法依賴的package包/類
/**
* returns the {@link ClientSideLoggingSettings} which are assigned to given application
*
* @param app The current application
* @return assigned {@link ClientSideLoggingSettings}
*/
public static IClientSideLoggingSettings settings(final Application app) {
return app.getMetaData(METADATA_KEY);
}