public class ServiceContext extends Object implements IPluginContext
Constructor and Description |
---|
ServiceContext(IPluginContext upstream) |
Modifier and Type | Method and Description |
---|---|
void |
attachTo(IPluginContext pluginContext)
reattach a service context to a plugin context.
|
<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 |
stop()
Stop clusters that have been started using this service context.
|
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.
|
public ServiceContext(IPluginContext upstream)
public 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.
newCluster
in interface IPluginContext
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.public <T extends org.apache.wicket.util.io.IClusterable> T getService(String name, Class<T> clazz)
getService
in interface IPluginContext
public <T extends org.apache.wicket.util.io.IClusterable> List<T> getServices(String name, Class<T> clazz)
IServiceTracker
.getServices
in interface IPluginContext
public <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.
getReference
in interface IPluginContext
public void registerService(org.apache.wicket.util.io.IClusterable service, String name)
registerService
in interface IPluginContext
public void unregisterService(org.apache.wicket.util.io.IClusterable service, String name)
unregisterService
in interface IPluginContext
public void registerTracker(IServiceTracker<? extends org.apache.wicket.util.io.IClusterable> listener, String name)
registerTracker
in interface IPluginContext
public void unregisterTracker(IServiceTracker<? extends org.apache.wicket.util.io.IClusterable> listener, String name)
unregisterTracker
in interface IPluginContext
public void stop()
public void attachTo(IPluginContext pluginContext)
pluginContext
- the plugin context to attach to.Copyright © 2007–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.