本文整理匯總了Java中org.apache.wicket.Application.setMetaData方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.setMetaData方法的具體用法?Java Application.setMetaData怎麽用?Java Application.setMetaData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.wicket.Application
的用法示例。
在下文中一共展示了Application.setMetaData方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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);
}
示例3: init
import org.apache.wicket.Application; //導入方法依賴的package包/類
@Override
public void init(Application application) {
// create dashboard context
DashboardContext dashboardContext = new DashboardContext();
// store dashboard context in application
application.setMetaData(DASHBOARD_CONTEXT_KEY, dashboardContext);
// add dashboard context injector
DashboardContextInjector dashboardContextInjector = new DashboardContextInjector(dashboardContext);
application.getComponentInstantiationListeners().add(dashboardContextInjector);
}
示例4: 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());
}
示例5: 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);
}
}
}
示例6: init
import org.apache.wicket.Application; //導入方法依賴的package包/類
public void init(Application application) {
ISessionStore store = application.getSessionStore();
store.registerBindListener(this);
store.registerUnboundListener(this);
application.setMetaData(SCRIPT_EXECUTOR_HOLDER, this);
}
示例7: 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);
}
示例8: 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));
}