commonj.connector.metadata.discovery.connection
Interface ConnectionPersistence


public interface ConnectionPersistence

Interface describing how to persist and retrieve connection configuration information. The MetadataDiscovery service may implement this interface and return it from ConnectionType.getConnectionPersistence(). It is strongly recommended that tool environments provide the implementation of this interface as well.

If the MetadataDiscovery service provides the non-null ConnectionPersistence instance, the hosting tool must use this instance when performing persistence operations for this type of connection. In addition, if the tool provides its own persistence implementation, it can it may also choose to also use its own implementation.

The instance of the ConnectionPersistence not necessarily have the scope of Connection Type, it may be appropriate for other connection types and is only guaranteed to be appropriate for the ConnectionType by which it was created.

Since:
1.0

Nested Class Summary
static interface ConnectionPersistence.ConnectionSummary
          Summary information for a persisted connection configuration.
 
Method Summary
 void addConnectionConfiguration(ConnectionConfiguration connection, boolean overwrite)
          Add a new connection configuration to the repository represented by this ConnectionPersistence instance.
 boolean exists(ConnectionConfiguration configuration)
          Check whether a ConnectionConfiguration matching the argument configuration already exists in the persistent storage.
 ConnectionPersistence.ConnectionSummary[] getConnectionSummaries(ConnectionType connectionType)
          Summarize all connections configurations stored in this repository for the given connection type.
 InboundConnectionConfiguration getInboundConnectionConfiguration(ConnectionPersistence.ConnectionSummary summary)
          Get an InboundConnectionConfiguration instance holding the persisted connection information for the connection with the given summary.
 OutboundConnectionConfiguration getOutboundConnectionConfiguration(ConnectionPersistence.ConnectionSummary summary)
          Get an OutboundConnectionConfiguration instance holding the persisted connection information for the connection with the given summary.
 ConnectionConfiguration removeConnectionConfiguration(ConnectionPersistence.ConnectionSummary summary)
          Remove an existing ConnectionConfiguration from the repository.
 

Method Detail

addConnectionConfiguration

void addConnectionConfiguration(ConnectionConfiguration connection,
                                boolean overwrite)
                                throws MetadataException
Add a new connection configuration to the repository represented by this ConnectionPersistence instance. This new entry is uniquely identified by the following, the AdapterType, ConnectionType and the name property of the ConnectionConfiguration instance.

Implementations should ensure they don't store two entries of the same name for any given ConnectionType as returned by ConnectionAdvancedConfiguration.getConnectionType().

Parameters:
connection - A ConnectionConfiguration to be persisted. The name field of the configuration must be set to the non-null value for the configuration to be persisted. The connection parameter must not be null.
overwrite - Specifes whether to overwrite ConnectionConfiguration if it already exists in the persitence. Can be used for concurrent access detection
Throws:
MetadataException - if an error occured during execution

exists

boolean exists(ConnectionConfiguration configuration)
Check whether a ConnectionConfiguration matching the argument configuration already exists in the persistent storage. The comparison is based on complete key that is adapter and connection type IDs and the name of the ConnectionConfiguration. The name field of the configuration must not be null.

Parameters:
configuration - A ConnectionConfiguration which existence in thje persistent storage is being verified. The configuration argument must not be null
Returns:
true if the configuration is present in the persistent storage, false otherwise.

getConnectionSummaries

ConnectionPersistence.ConnectionSummary[] getConnectionSummaries(ConnectionType connectionType)
                                                                 throws MetadataException
Summarize all connections configurations stored in this repository for the given connection type. The ConnectionType passed as argument must not be null

Parameters:
connectionType - The type of the connection for which the configuration summaries are requested. The connectionType must not be null.
Returns:
An array of ConnectionSummary instances, one per connection configuration stored for the given connection type. The return value must not be null.
Throws:
MetadataException - if an error occured during execution

getInboundConnectionConfiguration

InboundConnectionConfiguration getInboundConnectionConfiguration(ConnectionPersistence.ConnectionSummary summary)
                                                                 throws MetadataException
Get an InboundConnectionConfiguration instance holding the persisted connection information for the connection with the given summary.

Parameters:
summary - The ConnectionSummary describing the connection to retrieve. The argument must not be null.
Returns:
The InboundConnectionConfiguration for the connection with the given summary (adapter type, connection type, and name). This method should never return null. If the connection doesn't exist, an exception should be thrown for the summary should have been selected from the array returned by the getConnectionSummaries.
Throws:
MetadataException - if an error occured during execution

getOutboundConnectionConfiguration

OutboundConnectionConfiguration getOutboundConnectionConfiguration(ConnectionPersistence.ConnectionSummary summary)
                                                                   throws MetadataException
Get an OutboundConnectionConfiguration instance holding the persisted connection information for the connection with the given summary.

Parameters:
summary - The ConnectionSummary describing the connection to retrieve. The argument must not be null.
Returns:
The OutboundConnectionConfiguration for the connection with the given summary (adapter type, connection type, and name). This method should never return null. If the connection doesn't exist, an exception should be thrown for the summary should have been selected from the array returned by the getConnectionSummaries.
Throws:
MetadataException - if an error occured during execution

removeConnectionConfiguration

ConnectionConfiguration removeConnectionConfiguration(ConnectionPersistence.ConnectionSummary summary)
                                                      throws MetadataException
Remove an existing ConnectionConfiguration from the repository. The existing instance is removed from the repository and returned. The argument must not be null.

Parameters:
summary - The information summary about connection to be removed, must not be null.
Returns:
The existing instance or null if it doesn't exist.
Throws:
MetadataException - if an error occured during execution