public abstract class AbstractChainManager
extends java.lang.Object
The connectivity configuration files should specify one or more dynamic chain manager instances for each transport,
each of which will be instantiated with their own configuration. A manager instance can create and destroy
chains, and also provides a method to create a new instance of the associated transport plug-in for each
chain that has been created.
Subclasses must provide a constructor with the same signature as
AbstractChainManager(org.slf4j.Logger, ChainManagerConstructorParameters)
.
See ChainManagerConstructorParameters
for more information.
Modifier and Type | Field and Description |
---|---|
java.util.Collection<ChainDefinition> |
chainDefinitions
The configuration of the dynamic chain definitions that contain the transport associated with this manager.
|
ChainManagerHost |
host
The interface through which the host provides services required by chain managers.
|
org.slf4j.Logger |
logger
A slf4j logger to be used by this manager for anything which needs
to be written to the host's log.
|
java.lang.String |
managerName
The name used in the configuration file for this dynamic chain manager.
|
java.lang.String |
transportPluginName
The name used in the configuration file for the transport plug-in that created this chain manager.
|
Constructor and Description |
---|
AbstractChainManager(org.slf4j.Logger logger,
ChainManagerConstructorParameters params)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract AbstractTransport |
createTransport(org.slf4j.Logger logger,
ManagedTransportConstructorParameters params)
Called by the connectivity framework creation of each chain, to request the manager to create and return a new
instance of its associated transport.
|
ChainDefinition |
getChainDefinition()
Helper method to get the chain definition containing the transport associated with this manager, assuming there is only one.
|
ChainDefinition |
getChainDefinition(java.lang.String chainDefinitionId)
Helper method to get the chain definition matching the specified id, or a singleton chain definition if
no id was specified (null or empty).
|
StatusReporter |
getStatusReporter()
Allows reporting status information from this plug-in, such as connected/disconnected
status and number of messages sent/received in each direction.
|
abstract void |
shutdown()
Called during host shutdown to indicate that the chain manager should stop any background processes
and disconnect any remote connections.
|
abstract void |
start()
Called after the chain manager is created to indicate that it can register a channel lifecycle listener,
make external connections, create threads, and create chains.
|
java.lang.String |
toString() |
public final org.slf4j.Logger logger
public final java.lang.String managerName
public final java.lang.String transportPluginName
public final ChainManagerHost host
public final java.util.Collection<ChainDefinition> chainDefinitions
getChainDefinition()
and getChainDefinition(String)
is recommended for most use cases.
This data structure should usually not be modified after the constructor has returned, but if it
is the caller must provide locking as it is not thread-safe.public AbstractChainManager(org.slf4j.Logger logger, ChainManagerConstructorParameters params) throws java.lang.IllegalArgumentException, java.lang.Exception
The constructor will be called once for each dynamic chain manager instance specified in the configuration.
A typical implementation will check and process any manager configuration that was passed in; creation of
threads, connections etc should not happen until the start()
method is called.
logger
- a slf4j Logger object which can be used to log to the host log file.params
- an extensible interface providing access to the configuration for this manager and other
capabilities.java.lang.IllegalArgumentException
- should be thrown from the constructor if
the configuration is invalid.java.lang.Exception
- can be thrown by subclasses to indicate an internal error.public java.lang.String toString()
toString
in class java.lang.Object
public abstract AbstractTransport createTransport(org.slf4j.Logger logger, ManagedTransportConstructorParameters params) throws java.lang.IllegalArgumentException, java.lang.Exception
This will be called whenever a new chain involving this transport is created, whether that chain is being created by the manager itself or for some other reason such as a static configuration file entry.
A typical implementation will invoke the constructor of the transport class with the same arguments, and in some cases pass additional information to the transport (such as a reference to the manager instance, or a connection needed by the transport instance) and will usually store a reference to the new transport instance in the chain manager to allow operations to be performed on it later.
logger
- a slf4j Logger object which can be used to log to the host log file by the new transport.params
- an extensible interface providing access to the configuration for the transport, and other
capabilities.java.lang.IllegalArgumentException
- should be thrown from if the configuration is invalid.java.lang.Exception
- can be thrown to indicate an internal error.public abstract void start() throws java.lang.Exception
java.lang.Exception
- only if a fatal error occurred during startup.public abstract void shutdown() throws java.lang.Exception
It is recommended that managers should destroy all chains they are managing as part of their implementation of this method.
Any chains that still exist after the manager shutdown() method has returned will be destroyed automatically.ChainManagers must not create new chains or call any other methods on the ChainManagerHost interface after this method has returned.
.java.lang.Exception
public ChainDefinition getChainDefinition() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if there are zero or more than one chain definitions containing this transport.public ChainDefinition getChainDefinition(java.lang.String chainDefinitionId) throws java.lang.IllegalArgumentException
chainDefinitionId
- can be null or empty to indicate that a singleton chain definition should be selected.java.lang.IllegalArgumentException
- if there are no matches, or more than one match and the chainDefinitionId
was not specified.public StatusReporter getStatusReporter()
Submit a bug or feature
Copyright (c) 2013-2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.