IBM Integration Bus, Version 10.0.0.17 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS


Creating a connector factory

Use the connector factory to create input, output, and request connectors.

About this task

You do not need to create all types of connector for a connector provider. For example, if you want systems to send status messages to users, you might create an input connector and an output connector, which uses an instant messaging application to send messages.

Procedure

  1. Create a Java™ project.

    For example, to create a Java project in the IBM® Integration Toolkit, click File > New > Project and select Java Project.

    Your Java project is shown in the Package Explorer view of the Java perspective. Right-click the project to add new classes and interfaces.
  2. Add the Connector API JAR file to the class path of your Java project.

    You can find the Connector API JAR file at install_dir/server/classes/cmnCon.jar (for example, on Windows, C:\Program Files\IBM\IIB\version\server\classes\cmnCon.jar).

  3. Create a connector factory with the Connector Framework API by extending the AbstractConnectorFactory class.

    Javadoc documentation for the Connector Framework API is available at Connector API.

    The AbstractConnectorFactory class implements a ConnectorFactory interface. The cardinality of ConnectorFactory to connector provider is one-to-one. For example, if you want to connect to a particular resource, and you are creating a request connector and an input connector, one ConnectorFactory is required for all types of interaction.
    The following example of a connector factory Java file demonstrates how to create a connector factory that has an input, output, and request connector:
    package connector.database;
    
    import com.ibm.connectors.AbstractConnectorFactory;
    import com.ibm.connectors.ConnectorException;
    import com.ibm.connectors.InputConnector;
    import com.ibm.connectors.OutputConnector;
    import com.ibm.connectors.RequestConnector;
    
    public class myConnectorFactory extends AbstractConnectorFactory {
    
    	public myConnectorFactory() {
    		// TODO You can create shared resources that are used by all connectors
    		// for this provider. If the resources depend on properties that are provided
    		// on initialisation, create those resources in the onInitialise() method,
    		// when the properties are available.
    	}
    	
    	@Override
    	protected void onInitialise() throws Exception {
    		// TODO This method is called after the factory has been initialised with its properties,
    		// the provider name, and connector services, which are all available via getters on 
    		// this class. A standard Java logger is created under the provider name, 
    		// and it is available by using getLogger().
    		
    	}
    
    	@Override
    	public String getInfo() {
    		// TODO This method returns a human-readable descriptive string for this provider,
    		// such as name, version number, and organisation.
    		return null;
    	}
    
    	@Override
    	public InputConnector createInputConnector(String name)
    			throws ConnectorException {
    		// TODO This method creates and returns an input connector for this provider
    		return null;
    	}
    
    	@Override
    	public OutputConnector createOutputConnector(String name)
    			throws ConnectorException {
    		// TODO This method creates and returns an output connector for this provider
    		return null;
    	}
    
    	@Override
    	public RequestConnector createRequestConnector(String name)
    			throws ConnectorException {
    		// TODO This method creates and returns a request connector for this provider
    		return null;
    	}
    
    }

What to do next

After you create the connector factory, create one or more connectors by following the instructions in the appropriate topic:

cb23133_.htm | Last updated 2019-07-13 08:14:09