Class BaseConnector
- java.lang.Object
-
- com.boomi.connector.util.BaseConnector
-
- All Implemented Interfaces:
Connector
- Direct Known Subclasses:
BaseListenConnector
,ImportableFieldsConnector
,OpenAPIConnector
,RestConnector
,WSConnector
public abstract class BaseConnector extends Object implements Connector
Utility base class for implementing aConnector
. A Connector implementation should not do any significant work in its constructor but should instead defer such work to theinitialize(com.boomi.connector.api.AtomContext)
method. As noted in the sdk documentation, the Connector must be thread-safe, and should not be managing account specific information.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseConnector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Browser
createBrowser(BrowseContext context)
Default implementation throws UnsupportedOperationException.protected Operation
createCreateOperation(OperationContext context)
Creates a new CREATE operation.protected Operation
createDeleteOperation(OperationContext context)
Creates a new DELETE operation.protected Operation
createExecuteOperation(OperationContext context)
Creates a new EXECUTE operation.protected Operation
createGetOperation(OperationContext context)
Creates a new GET operation.Operation
createOperation(OperationContext context)
Returns the actual Operation.protected Operation
createQueryOperation(OperationContext context)
Creates a new QUERY operation.protected Operation
createUpdateOperation(OperationContext context)
Creates a new UPDATE operation.protected Operation
createUpsertOperation(OperationContext context)
Creates a new UPSERT operation.AtomContext
getContext()
Returns the atom context as passed to theinitialize(com.boomi.connector.api.AtomContext)
method.void
initialize(AtomContext context)
Does any startup initialization for this connector.void
setContext(AtomContext newContext)
Sets the atom context, currently only done by theinitialize(com.boomi.connector.api.AtomContext)
method.
-
-
-
Method Detail
-
getContext
public AtomContext getContext()
Returns the atom context as passed to theinitialize(com.boomi.connector.api.AtomContext)
method.
-
setContext
public void setContext(AtomContext newContext)
Sets the atom context, currently only done by theinitialize(com.boomi.connector.api.AtomContext)
method.
-
initialize
public void initialize(AtomContext context)
Does any startup initialization for this connector. This will be called exactly once (within external synchronization) after the Connector is instantiated and before any other methods are called on it.This call may do expensive things like open connections or other resources which will be used throughout the Connector's lifecycle. Connectors are never explicitly closed, so explicit resource cleanup (if necessary) should be managed through garbage-collector hooks (e.g. reference objects or finalize). Note that any resources cached at the Connector level should not be account specific. The preferred resource cache is the one returned by a call to
ConnectorContext.getConnectorCache()
as it is Boomi account specific and therefore may be used to cache account specific information.Base implementation stores given context.
- Specified by:
initialize
in interfaceConnector
- Parameters:
context
- the static atom context
-
createBrowser
public Browser createBrowser(BrowseContext context)
Default implementation throws UnsupportedOperationException.- Specified by:
createBrowser
in interfaceConnector
- Parameters:
context
- the context for this browse operation. this context is considered to be owned by the Browser after this call and may be held by the Browser for use in subsequent method calls.- Returns:
- a Browser for use when browsing this connector
-
createOperation
public Operation createOperation(OperationContext context)
Returns the actual Operation. All connection fields from the connector's descriptor will be provided inConnectorContext.getConnectionProperties()
and operation all fields will be provided inBrowseContext.getOperationProperties()
(where the keys will be the relevant field's "id" and the values will be of the appropriate Java type for the relevant field's "type").This call should be relatively cheap as Operations are only ever created for a single invocation. Any resource caching should be handled at the Connector level or via the
ConnectorContext.getConnectorCache()
.Base implementation delegates creation call to one of the
create*Operation()
methods.- Specified by:
createOperation
in interfaceConnector
- Parameters:
context
- the context for this connector operation. this context is considered to be owned by the Operation after this call and may be held by the Operation for use in subsequent method calls.- Returns:
- an Operation for use when executing operations for this connector
-
createGetOperation
protected Operation createGetOperation(OperationContext context)
Creates a new GET operation.Default implementation throws UnsupportedOperationException.
- Parameters:
context
- the new operation's context- Returns:
- a valid operation
-
createQueryOperation
protected Operation createQueryOperation(OperationContext context)
Creates a new QUERY operation.Default implementation throws UnsupportedOperationException.
- Parameters:
context
- the new operation's context- Returns:
- a valid operation
-
createCreateOperation
protected Operation createCreateOperation(OperationContext context)
Creates a new CREATE operation.Default implementation throws UnsupportedOperationException.
- Parameters:
context
- the new operation's context- Returns:
- a valid operation
-
createUpdateOperation
protected Operation createUpdateOperation(OperationContext context)
Creates a new UPDATE operation.Default implementation throws UnsupportedOperationException.
- Parameters:
context
- the new operation's context- Returns:
- a valid operation
-
createUpsertOperation
protected Operation createUpsertOperation(OperationContext context)
Creates a new UPSERT operation.Default implementation throws UnsupportedOperationException.
- Parameters:
context
- the new operation's context- Returns:
- a valid operation
-
createDeleteOperation
protected Operation createDeleteOperation(OperationContext context)
Creates a new DELETE operation.Default implementation throws UnsupportedOperationException.
- Parameters:
context
- the new operation's context- Returns:
- a valid operation
-
createExecuteOperation
protected Operation createExecuteOperation(OperationContext context)
Creates a new EXECUTE operation.Default implementation throws UnsupportedOperationException.
- Parameters:
context
- the new operation's context- Returns:
- a valid operation
-
-