public final class PluginManager extends java.lang.Object implements IPluginManager, ISemanticManager, ITransceiverManager, IDiscoveryManager, IRoutingManager, IExtension
Modifier and Type | Class and Description |
---|---|
class |
PluginManager.Session
The session implementation used by the plug-in manager.
|
class |
PluginManager.SessionStrategy
The default session strategy that is used in all cases where no
specialized strategy is available.
|
Modifier and Type | Field and Description |
---|---|
static long |
GROUP_RETRY
The timeout between retries for opening group connectors.
|
static int |
PACKET_LENGTH
The packet length of this core.
|
EVENT_PLUGIN_ADDED, EVENT_PLUGIN_REMOVED
EXTENSION_COMPRESSION, EXTENSION_DISCOVERY, EXTENSION_ENCRYPTION, EXTENSION_ROUTING, EXTENSION_SEMANTIC, EXTENSION_SERIALIZATION, EXTENSION_TRANSCEIVER
Modifier and Type | Method and Description |
---|---|
void |
acceptSession(IStreamConnector c)
Called by transceiver plug-ins whenever a new connector is opened by a
remote device.
|
void |
addPlugin(IPlugin plugin)
Adds and starts the specified plug-in.
|
void |
addPluginListener(int type,
IListener listener)
Adds a plug-in listener to the set of registered plug-ins listeners.
|
void |
addPlugins(IPlugin[] newPlugins)
Add a set of plug-ins to this manager.
|
ISession |
createSession(SystemID target,
short ability)
Creates a session to communicate with the specified target.
|
void |
dispatchSynchronous(Invocation invocation,
ISession session)
Called by a semantic plug-in to deliver an incoming invocation to
the broker.
|
DeviceDescription |
getDeviceDescription(SystemID system)
Returns the device description of the local device.
|
SystemID[] |
getDevices()
Returns the devices that are present in the environment.
|
PluginDescription[] |
getPluginDescriptions(SystemID system)
Returns the plug-in descriptions of the specified device.
|
IPlugin[] |
getPlugins()
Returns the plug-ins that are currently installed and managed
by this plug-in manager.
|
IPacketConnector |
openGroup(short group)
Opens a group connector with all transceivers to the specified group.
|
IPacketConnector |
openGroup(short group,
short ability)
Opens a group connector with transceivers that have the specified
ability.
|
IStreamConnector |
openSession(ISession session)
Called by a semantic plug-in whenever a connector is required to
deliver an invocation or to perform some remote communication.
|
void |
performOperation(IOperation operation)
Performs the specified operation using the invocation broker that is
bound to this plug-in manager.
|
void |
performOperation(IOperation operation,
IMonitor monitor)
Performs the specified operation using the specified operation monitor.
|
ISession |
prepareSession(ISession session,
NFCollection requirements)
Called by a semantic plug-in whenever the semantic plug-in tries to
recreate a communication stack, possibly with different properties.
|
void |
registerDevice(DeviceDescription device,
long ttl)
Registers the specified device description of the specified system.
|
void |
registerPlugin(SystemID id,
PluginDescription plugin,
long ttl)
Registers the specified plug-in description of the specified remote device.
|
void |
removePlugin(IPlugin plugin)
Removes the specified plug-in from the set of plug-ins that
are installed and managed by this plug-in manager.
|
boolean |
removePluginListener(int type,
IListener listener)
Removes a previously registered plug-in listener from the set of registered
plug-in listeners.
|
void |
setStrategy(ISessionStrategy newStrategy)
Sets the strategy used by the plug-in manager.
|
public static final int PACKET_LENGTH
public static final long GROUP_RETRY
public void addPlugins(IPlugin[] newPlugins)
newPlugins
- A set of local plug-ins.public void addPlugin(IPlugin plugin)
plugin
- The plug-in to add.public void removePlugin(IPlugin plugin)
plugin
- The plug-in that should be removed.public IPlugin[] getPlugins()
public void setStrategy(ISessionStrategy newStrategy)
newStrategy
- The strategy of the plug-in manager.public ISession createSession(SystemID target, short ability)
createSession
in interface ISemanticManager
target
- The target of the call.ability
- The ability of the calling plug-in.public ISession prepareSession(ISession session, NFCollection requirements)
prepareSession
in interface ISemanticManager
session
- The session that was originally negotiated. This session
is used as blueprint for the new session to create.requirements
- The nf-requirements. They might have changed since
the last negotiation of the provided session.public IStreamConnector openSession(ISession session) throws java.io.IOException
openSession
in interface ISemanticManager
session
- The session information used to create the connector.java.io.IOException
- Thrown if the connector cannot be opened.public void acceptSession(IStreamConnector c)
acceptSession
in interface ITransceiverManager
c
- The connector that has been opened by a remote device.public void dispatchSynchronous(Invocation invocation, ISession session)
dispatchSynchronous
in interface ISemanticManager
invocation
- The invocation that has been received.session
- The session used to receive the invocation.public PluginDescription[] getPluginDescriptions(SystemID system)
getPluginDescriptions
in interface IPluginManager
system
- The system id of the system.public DeviceDescription getDeviceDescription(SystemID system)
getDeviceDescription
in interface IPluginManager
system
- The system to retrieve.public SystemID[] getDevices()
getDevices
in interface IPluginManager
public void addPluginListener(int type, IListener listener)
addPluginListener
in interface IDiscoveryManager
type
- The types of events to register for.listener
- The listener to register.public boolean removePluginListener(int type, IListener listener)
removePluginListener
in interface IDiscoveryManager
type
- The types of events to unregister for.listener
- The listener to unregister.public void registerDevice(DeviceDescription device, long ttl)
registerDevice
in interface IDiscoveryManager
device
- The device description of the remote system.ttl
- The time to live for the device description in milliseconds.public void registerPlugin(SystemID id, PluginDescription plugin, long ttl)
registerPlugin
in interface IDiscoveryManager
id
- The id of the system that hosts the plug-in.plugin
- The plug-in description to register.ttl
- The time to live in milliseconds.public IPacketConnector openGroup(short group)
openGroup
in interface IDiscoveryManager
group
- The group to connect to.public IPacketConnector openGroup(short group, short ability)
openGroup
in interface IDiscoveryManager
group
- The group to connect to.ability
- The ability of the plug-in to use.public void performOperation(IOperation operation)
performOperation
in interface IOperator
operation
- The operation to perform.public void performOperation(IOperation operation, IMonitor monitor)
performOperation
in interface IOperator
monitor
- The monitor used to observe the operation.operation
- The operation to perform.