public interface IPluginContext
extends org.apache.wicket.util.io.IClusterable
In general, services may come and go at any time. It is therefore not allowed to
hold on to references to services, unless a IServiceTracker
is used to
clean up when the service disappears.
There are some exceptions to the above rule; some services are provided by the framework and may therefore be assumed to always exist. These are
IDialogService
with name service.dialog
IObserver
services that register
under the name org.hippoecm.frontend.model.event.IObserver
Modifier and Type | Method and Description |
---|---|
<T extends org.apache.wicket.util.io.IClusterable> |
getReference(T service)
Retrieve a reference that can be stored in a page that is different from the one
that contains the plugin.
|
<T extends org.apache.wicket.util.io.IClusterable> |
getService(String name,
Class<T> clazz)
Retrieve a service.
|
<T extends org.apache.wicket.util.io.IClusterable> |
getServices(String name,
Class<T> clazz)
Retrieve the full list of services that registered under the service name and
that are instances of the class.
|
IClusterControl |
newCluster(IClusterConfig template,
IPluginConfig parameters)
Create a new cluster of plugins.
|
void |
registerService(org.apache.wicket.util.io.IClusterable service,
String name)
Registers a service with the given name.
|
void |
registerTracker(IServiceTracker<? extends org.apache.wicket.util.io.IClusterable> listener,
String name)
Registers a service tracker with the given name.
|
void |
unregisterService(org.apache.wicket.util.io.IClusterable service,
String name)
Unregisters a service from the given name.
|
void |
unregisterTracker(IServiceTracker<? extends org.apache.wicket.util.io.IClusterable> listener,
String name)
Unregisters a service tracker with the given name.
|
IClusterControl newCluster(IClusterConfig template, IPluginConfig parameters)
Note that clusters that are started during the construction phase will not be able to reference services that have been created in the same phase.
template
- A cluster template, i.e. a configuration hierarchy whose
variables have not yet been expanded. The template contains
values such as "${myparam}" that will be expanded.parameters
- The values for the variables in the template.<T extends org.apache.wicket.util.io.IClusterable> T getService(String name, Class<T> clazz)
<T extends org.apache.wicket.util.io.IClusterable> List<T> getServices(String name, Class<T> clazz)
IServiceTracker
.<T extends org.apache.wicket.util.io.IClusterable> IServiceReference<T> getReference(T service)
Since the service reference contains a unique id for the service, it can also be used to construct unique service names.
void registerService(org.apache.wicket.util.io.IClusterable service, String name)
void unregisterService(org.apache.wicket.util.io.IClusterable service, String name)
void registerTracker(IServiceTracker<? extends org.apache.wicket.util.io.IClusterable> listener, String name)
void unregisterTracker(IServiceTracker<? extends org.apache.wicket.util.io.IClusterable> listener, String name)
Copyright © 2007–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.