com.ibm.broker.connector

Class ConnectorFactory

  • java.lang.Object
    • com.ibm.broker.connector.ConnectorFactory


  • public abstract class ConnectorFactory
    extends java.lang.Object
    ConnectorFactory is the base class which must be extended to implement a connector which can run in IBM Integration Bus.

    It is used by IBM Integration Bus to call the connector provider to change its state and request for particular types of connectors to be created. To install the connector factory in an integration node a ConnectorProviders configurable service must be created that references this class.

    The ConnectorFactory is constructed when an integration server is started. The following methods are called by the integration node to interact with the connector factory:

    • initialize is called with details of the connector factory's name and properties provided on the configurable service when the integration server starts.
    • start is called when the first node that uses the connector is deployed.
    • stop is called when the last node using the connector is removed from the integration server.
    • Terminate is called when the integration server is about stop.
    Override these methods to change your own connection factory state. All methods are optional and do not need to be overridden.

    The connection factory is also called to create connectors when nodes are deployed that need to interact with the end system.

    • createOutputConnector is called when the integration node wants to send data to the end system with out receiving any response data. Override this method to create an OutputConnector that can interact with the end system. Leave it unimplemented if you do not which to support this interaction pattern.
    • createRequestConnector is called when the integration node wants to make request call to the end system and receive response data. Override this method to create an RequestConnector that can interact with the end system. Leave it unimplemented if you do not which to support this interaction pattern.
    • createInputConnector is called when the integration node wants to receive data from an end system. Override this method to create an InputConnector that can interact with the end system. Leave it unimplemented if you do not which to support this interaction pattern.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String copyright 
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      EventInputConnector createEventInputConnector(java.lang.String name, java.util.Properties sessionProps)
      Deprecated. 
      use #createInputConnector() instead
      InputConnector createInputConnector(java.lang.String name, java.util.Properties sessionProps)
      Deprecated. 
      InputConnector createInputConnector(java.lang.String name, java.util.Properties sessionProps, SecurityIdentity securityIdentity)
      This is called by the integration node when a connector to receive data from the system is required.
      OutputConnector createOutputConnector(java.lang.String name, java.util.Properties properties)
      Deprecated. 
      OutputConnector createOutputConnector(java.lang.String name, java.util.Properties properties, SecurityIdentity security)
      This is called by the integration node when a connector to send data to the system is required.
      RequestConnector createRequestConnector(java.lang.String name, java.util.Properties properties)
      This is called by the integration node when a connector to send data to the system is required.
      java.lang.String getCatalogName() 
      java.lang.String[] getConnectorStatNames()
      Gets the names of the stats used by a connector
      ContainerServices getContainerServices()
      Returns a ContainerServices object which can be used by a connector writer to obtain function and resources provided by the environment running the connector.
      EventInputConnector[] getEventInputConnectors()
      Returns an array of all EventInputConnectors which have been created by this factory and have not been terminated.
      abstract java.lang.String getInfo()
      This is called by the integration node to get a information about the ConnectorFactory.
      java.lang.String getName()
      Returns a provider name.
      OutputConnector[] getOutputConnectors()
      Returns an array of all OutputConnectors which have been created by this factory and have not been terminated.
      PollingInputConnector[] getPollingInputConnectors()
      Returns an array of all NBPollingInputConnectors which have been created by this factory and have not been terminated.
      java.util.Properties getProperties()
      Returns a properties for this connector factory.
      RequestConnector[] getRequestConnectors()
      Returns an array of all RequestConnectors which have been created by this factory and have not been terminated.
      void initialize(java.lang.String name, java.util.Properties properties)
      This is called by the integration node when an integration server is started up.
      void start()
      This is called by the integration node when the first usage of the provider is about to happen.
      void stop()
      This is called by the integration node when the last connector using the provider is destroyed.
      void terminate()
      This is called by the integration node when the integration server is about to stop.
      void writeActivityLog(java.lang.String messageNumber, java.lang.String[] inserts)
      Writes an entry to activity log using the context that this connector is being run in.
      void writeActivityLog(java.lang.String messageNumber, java.lang.String[] inserts, java.util.Properties extraTags)
      Writes an entry to activity log using the context that this connector is being run in.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInfo

        public abstract java.lang.String getInfo()
                                          throws com.ibm.broker.plugin.MbException
        This is called by the integration node to get a information about the ConnectorFactory. It must return useful information about the Connector factory being used, such as it's branded name and current version.
        Returns:
        Information about this ConnectorFactory.
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will cause empty data to be used for the connector info.
      • initialize

        public void initialize(java.lang.String name,
                               java.util.Properties properties)
                        throws com.ibm.broker.plugin.MbException
        This is called by the integration node when an integration server is started up. Any general messaging provider initialization should be done at this point. It is not recommended to do any connections at this point to external systems, just validate that the properties being used are valid.
        Parameters:
        name - name of the connector factory as defined in the ConnectorProviders section of the server config
        properties - the properties defined on the ConnectorProviders section of the server config
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will stop the ConnectionFactory being available for use.
      • start

        public void start()
                   throws com.ibm.broker.plugin.MbException
        This is called by the integration node when the first usage of the provider is about to happen. Normally, this will occur when the first node is created.
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will fail the creation of the flow causing the start request.
      • createRequestConnector

        public RequestConnector createRequestConnector(java.lang.String name,
                                                       java.util.Properties properties)
                                                throws com.ibm.broker.plugin.MbException
        This is called by the integration node when a connector to send data to the system is required.
        Parameters:
        name - name of the connector based on the flow and node being used
        properties - the properties defined on the node creating the connector
        Returns:
        RequestConnector
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will fail the creation of the flow requesting the connector.
      • createOutputConnector

        public OutputConnector createOutputConnector(java.lang.String name,
                                                     java.util.Properties properties,
                                                     SecurityIdentity security)
                                              throws com.ibm.broker.plugin.MbException
        This is called by the integration node when a connector to send data to the system is required.
        Parameters:
        name - name of the connector based on the flow and node being used
        properties - the properties defined on the node creating the connector
        Returns:
        OutputConnector
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will fail the creation of the flow requesting the connector.
      • createOutputConnector

        @Deprecated
        public OutputConnector createOutputConnector(java.lang.String name,
                                                                  java.util.Properties properties)
                                                           throws com.ibm.broker.plugin.MbException
        Deprecated. 
        Throws:
        com.ibm.broker.plugin.MbException
      • createInputConnector

        public InputConnector createInputConnector(java.lang.String name,
                                                   java.util.Properties sessionProps,
                                                   SecurityIdentity securityIdentity)
                                            throws com.ibm.broker.plugin.MbException
        This is called by the integration node when a connector to receive data from the system is required.
        Parameters:
        name - name of the connector based on the flow and node being used
        sessionProps - the properties defined on the node creating the connector
        when - required to authenticate with the endpoint, this parameter is used to retrieve credentials that have been confiugred for this instance of the connector
        Returns:
        InputConnector.
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will fail the creation of the flow requesting the connector.
      • createInputConnector

        @Deprecated
        public InputConnector createInputConnector(java.lang.String name,
                                                                java.util.Properties sessionProps)
                                                         throws com.ibm.broker.plugin.MbException
        Deprecated. 
        Throws:
        com.ibm.broker.plugin.MbException
      • createEventInputConnector

        @Deprecated
        public EventInputConnector createEventInputConnector(java.lang.String name,
                                                                          java.util.Properties sessionProps)
                                                                   throws com.ibm.broker.plugin.MbException
        Deprecated. use #createInputConnector() instead
        This is called by the integration node when a connector to receive data from the system is required.
        Parameters:
        name - name of the connector based on the flow and node being used
        sessionProps - the properties defined on the node creating the connector
        Returns:
        EventInputConnector.
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will fail the creation of the flow requesting the connector.
      • stop

        public void stop()
                  throws com.ibm.broker.plugin.MbException
        This is called by the integration node when the last connector using the provider is destroyed. It signals that no new connectors will be created until start is called again.
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will not prevent any flows being stopped.
      • terminate

        public void terminate()
                       throws com.ibm.broker.plugin.MbException
        This is called by the integration node when the integration server is about to stop.
        Throws:
        com.ibm.broker.plugin.MbException - Throwing an exception will not prevent any flows being stopped.
      • getCatalogName

        public java.lang.String getCatalogName()
        Returns:
        the message catalog being used by the connectors created by this factory
        Throws:
        com.ibm.broker.plugin.MbException
      • getContainerServices

        public final ContainerServices getContainerServices()
        Returns a ContainerServices object which can be used by a connector writer to obtain function and resources provided by the environment running the connector.
        Throws:
        com.ibm.broker.plugin.MbException
      • getName

        public final java.lang.String getName()
                                       throws com.ibm.broker.plugin.MbException
        Returns a provider name.
        Throws:
        com.ibm.broker.plugin.MbException
      • getProperties

        public final java.util.Properties getProperties()
                                                 throws com.ibm.broker.plugin.MbException
        Returns a properties for this connector factory.
        Throws:
        com.ibm.broker.plugin.MbException
      • getRequestConnectors

        public final RequestConnector[] getRequestConnectors()
                                                      throws com.ibm.broker.plugin.MbException
        Returns an array of all RequestConnectors which have been created by this factory and have not been terminated.
        Throws:
        com.ibm.broker.plugin.MbException
      • getOutputConnectors

        public final OutputConnector[] getOutputConnectors()
                                                    throws com.ibm.broker.plugin.MbException
        Returns an array of all OutputConnectors which have been created by this factory and have not been terminated.
        Throws:
        com.ibm.broker.plugin.MbException
      • getEventInputConnectors

        public final EventInputConnector[] getEventInputConnectors()
                                                            throws com.ibm.broker.plugin.MbException
        Returns an array of all EventInputConnectors which have been created by this factory and have not been terminated.
        Throws:
        com.ibm.broker.plugin.MbException
      • getPollingInputConnectors

        public final PollingInputConnector[] getPollingInputConnectors()
                                                                throws com.ibm.broker.plugin.MbException
        Returns an array of all NBPollingInputConnectors which have been created by this factory and have not been terminated.
        Throws:
        com.ibm.broker.plugin.MbException
      • writeActivityLog

        public final void writeActivityLog(java.lang.String messageNumber,
                                           java.lang.String[] inserts)
                                    throws com.ibm.broker.plugin.MbException
        Writes an entry to activity log using the context that this connector is being run in.
        Parameters:
        messageNumber - message number for the catalog to use.
        inserts - the inserts to include in the message
        Throws:
        com.ibm.broker.plugin.MbException
      • writeActivityLog

        public final void writeActivityLog(java.lang.String messageNumber,
                                           java.lang.String[] inserts,
                                           java.util.Properties extraTags)
                                    throws com.ibm.broker.plugin.MbException
        Writes an entry to activity log using the context that this connector is being run in.
        Parameters:
        messageNumber - message number for the catalog to use.
        inserts - the inserts to include in the message
        extraTags - a map of tags to values which will be used to tag this log message.
        Throws:
        com.ibm.broker.plugin.MbException
      • getConnectorStatNames

        public java.lang.String[] getConnectorStatNames()
        Gets the names of the stats used by a connector
        Returns:
        array of stat names
IBM Integration BusTM
JavaTM Connector API