Implementing Connector
(Mandatory implementation)
The Connector (com.boomi.connector.api.Connector class) is the main entry point for a connector. A connector you build using the Connector SDK must have exactly one Connector implementation, and the class name, including the package, is specified in the connector configuration file.

Connector configuration file sample
<?xml version="1.0" encoding="UTF-8"?><GenericConnector sdkApiVersion="2.28.3">
<connectorClassName>com.boomi.sample.SampleConnector</connectorClassName>
</GenericConnector>
- All
Connectorimplementations must be thread safe. - Use the
Connectorclass to cache non-user-specific, expensive resources that are needed for connector operation. - In a multi-user environment, use the
ConnectorContextinterface (refer to the Javadocs) to get a handle to a user-specific cache that lives for the lifetime of the connector. The user-specific cache contains user-specific information such as login credentials. Resources in this cache must be thread-safe because this cache shares the lifetime of the connector instance. - Log using a static instance of
java.util.logging.Loggerconstructed with the current package name. Messages from this logger are in<atom_installation_directory>/logs/yyyy_mm-dd.container.log.
Implementing the Connector Interface
The com.boomi.connector.api.Connector interface (refer to the Javadocs) acts as the central bootstrapping/factory class to implement a connector, browsing, and operation implementations.
Its primary responsibilities are to create Browser and Operation instances when an action is triggered that requires them.
- A
Browserinstance is required when a user performs an import (Import Wizard) for a connector operation. - An
Operationinstance is required when a process executes a Connector shape.
When either of these actions occur, the Atom invokes the corresponding Create() method on the connector.
The com.boomi.connector.api.Connector interface is instantiated reflectively using the public, no-argument constructor when the Atom loads the connector. This class lives for an extended period of time until the Atom determines that it is no longer needed.
The Connector SDK artifacts available from the public repository contain a connector-sdk-samples-sources JAR file, containing source code for some connector samples you can reference when building a connector. You will find sample JSON Operation classes, sample Listener classes, and more. Refer to the Connector SDK artifacts topic for more information.
Code sample
This code sample illustrates the implementation of a simple connector that supports the Create operation.
Code sample for a basic Connector implementation
package com.boomi.connector.sdk.sampleproject;
import java.util.logging.Logger;
import com.boomi.connector.api.AtomContext;
import com.boomi.connector.api.BrowseContext;
import com.boomi.connector.api.Browser;
import com.boomi.connector.api.Connector;
import com.boomi.connector.api.Operation;
import com.boomi.connector.api.OperationContext;
import com.boomi.util.LogUtil;
public class SampleConnector implements Connector {
private static final Logger LOG = LogUtil.getLogger(SampleConnector.class);
@Override
public void initialize(AtomContext context) {
// do nothing
}
/*
* A Browser instance is required when a user performs an import \(**Import Wizard**\) for a connector operation.
*/
@Override
public Browser createBrowser(BrowseContext context) {
throw new UnsupportedOperationException();
}
/*
* An Operation instance is required when a process executes a Connector shape
*/
@Override
public Operation createOperation(OperationContext context) {
LOG.info("creating operation");
return new SampleExecuteOperation();
}
}
Building SDK authentication interfaces
There are different classes that you can use to build SDK authentication interfaces:
SimpleNetworkAuthenticatorNetworkAuthenticatorNetworkAuthenticatorConnector
For more details, refer to the Implementing authentication for a connector page.
Connector API
Connector API
The Connector API is built around an object/verb hierarchy. The verbs are the various operations (Get, Update, etc.) which can be executed for each object in the service. This is a parallel to the basic Object Oriented Programming paradigm, as well as the web service implementation theory behind REST. If your service follows this pattern, implementing a connector using the Connector API should be fairly simple.
A common alternative service implementation is the flat, procedural style, with only verbs (addAccount, updateAccount, addUser, deleteUser, etc.). While slightly more difficult, it should still be fairly straightforward to implement a connector. The general process is:
- Determine the set of objects represented by the various procedures exposed by the service (
Account,User, etc.) - Segment the procedures based on the object type they use:
- Account —
addAccount,updateAccount - User —
addUser,deleteUser
- Account —
- Assign the procedures available for each object to an operation type:
- Account
addAccount— CreateupdateAccount— Update
- User
addUser— CreatedeleteUser— Delete
- Account