Class ConnectivityPlugin

java.lang.Object
com.softwareag.connectivity.ConnectivityPlugin
Direct Known Subclasses:
AbstractCodec, AbstractTransport

public abstract class ConnectivityPlugin extends Object
Base class that all codec and transport plug-ins inherit from.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    The identifier used for the chain this plug-in is part of.
    Configuration of this plug-in.
    static final String
    A string constant containing the 4-digit version number for this API.
    Interface to support miscellaneous requests from this plug-in to the host system.
    final org.slf4j.Logger
    A slf4j logger to be used by this plug-in instance for anything which needs to be written to the host's log.
    final String
    The name used in the configuration file for this plug-in.
  • Method Summary

    Modifier and Type
    Method
    Description
    Allows reporting status information from this plug-in, such as connected/disconnected status and number of messages sent/received in each direction.
    abstract void
    Called some time after start(), when the host is ready to start receiving messages.
    abstract void
    Close any resources created by the connectivity plug-in, and terminate and join any background threads.
    abstract void
    Called when an entire chain has been created.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CONNECTIVITY_API_VERSION

      public static final 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:
    • 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 Map<String,Object> config
      Configuration of this plug-in. As passed into the constructor.
    • chainId

      public final String chainId
      The identifier used for the chain this plug-in is part of.
    • pluginName

      public final 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 Details

    • start

      public abstract void start() throws Exception
      Called when an entire chain has been created. The start method will never be called more than once on this instance.
      Throws:
      Exception - only if a fatal error occurred during startup.
    • shutdown

      public abstract void shutdown() throws 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:
      Exception
    • hostReady

      public abstract void hostReady() throws Exception
      Called some time after start(), 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:
      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