Class ConnectivityPlugin
- java.lang.Object
-
- com.softwareag.connectivity.ConnectivityPlugin
-
- Direct Known Subclasses:
AbstractCodec
,AbstractTransport
public abstract class ConnectivityPlugin extends java.lang.Object
Base class that all codec and transport plug-ins inherit from.- See Also:
AbstractCodec
,AbstractTransport
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
chainId
The identifier used for the chain this plug-in is part of.java.util.Map<java.lang.String,java.lang.Object>
config
Configuration of this plug-in.static java.lang.String
CONNECTIVITY_API_VERSION
A string constant containing the 4-digit version number for this API.PluginHost
host
Interface to support miscellaneous requests from this plug-in to the host system.org.slf4j.Logger
logger
A slf4j logger to be used by this plug-in instance for anything which needs to be written to the host's log.java.lang.String
pluginName
The name used in the configuration file for this plug-in.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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
hostReady()
Called some time afterstart()
, when the host is ready to start receiving messages.abstract void
shutdown()
Close any resources created by the connectivity plug-in, and terminate and join any background threads.abstract void
start()
Called when an entire chain has been created.
-
-
-
Field Detail
-
CONNECTIVITY_API_VERSION
public static final java.lang.String CONNECTIVITY_API_VERSION
A string constant containing the 4-digit version number for this API.Plug-ins should publish the API version they were compiled against by defining a public static final String constant called CONNECTIVITY_API_VERSION set to the value of this constant, e.g.
public static final String CONNECTIVITY_API_VERSION = com.softwareag.connectivity.ConnectivityPlugin.CONNECTIVITY_API_VERSION;
- Since:
- 10.0.0
- See Also:
- Constant Field Values
-
logger
public final org.slf4j.Logger logger
A slf4j logger to be used by this plug-in instance for anything which needs to be written to the host's log. The host will take care of adding the plug-in and chain name to the messages logged using this object.- Since:
- 9.12.0.1
-
config
public final java.util.Map<java.lang.String,java.lang.Object> config
Configuration of this plug-in. As passed into the constructor.
-
chainId
public final java.lang.String chainId
The identifier used for the chain this plug-in is part of.
-
pluginName
public final java.lang.String pluginName
The name used in the configuration file for this plug-in.- Since:
- 9.12.0.1
-
host
public final PluginHost host
Interface to support miscellaneous requests from this plug-in to the host system.Cannot be used with plug-ins that use the legacy constructor.
- Since:
- 10.0
-
-
Method Detail
-
start
public abstract void start() throws java.lang.Exception
Called when an entire chain has been created. The start method will never be called more than once on this instance.- Throws:
java.lang.Exception
- only if a fatal error occurred during startup.
-
shutdown
public abstract void shutdown() throws java.lang.Exception
Close any resources created by the connectivity plug-in, and terminate and join any background threads.The host will call this during host shutdown or when the chain is being destroyed dynamically for any other reason.
Implementations should also ensure they work correctly even if the start() method was not called (it is especially important to consider this case when implementing transports with an associated chain manager), since if any plug-in in the chain fails to start, shutdown() will be called on all the other plug-ins to ensure an orderly cleanup of any references and/or resources.
This method will never be called more than once on this instance.
This method may be called while messages are still being delivered towards the host or towards the transport. If the plug-in is blocked waiting to send a message it should attempt to cancel the operation when this method is called (any messages should be discarded once shutdown has been called), and if possible should avoid returning from this method until all outstanding operations and threads have completed.
- Throws:
java.lang.Exception
-
hostReady
public abstract void hostReady() throws java.lang.Exception
Called some time afterstart()
, when the host is ready to start receiving messages. The host will not process messages from the plug-in until this occurs. This is advisory: the plug-in is permitted to send messages before this is called, but may opt to queue the messages until it is ready to process messages. Plug-ins may choose to not receive messages from a third party until the host is ready for them.- Throws:
java.lang.Exception
-
getStatusReporter
public StatusReporter getStatusReporter()
Allows reporting status information from this plug-in, such as connected/disconnected status and number of messages sent/received in each direction.Cannot be used with plug-ins that use the legacy constructor.
- Since:
- 10.0
-
-