com.ibm.cics.core.connections
Class AbstractConnectionProvider

java.lang.Object
  extended by com.ibm.cics.core.connections.AbstractConnectionProvider
All Implemented Interfaces:
IConnectionProvider

public abstract class AbstractConnectionProvider
extends java.lang.Object
implements IConnectionProvider

Abstract IConnectionProvider implementation


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ibm.cics.core.connections.IConnectionProvider
IConnectionProvider.ConnectionParametersAddedEvent, IConnectionProvider.ConnectionParametersRemovedEvent, IConnectionProvider.ConnectionParametersUpdatedEvent, IConnectionProvider.ConnectionProviderConnectionParametersEvent, IConnectionProvider.ConnectionProviderEvent, IConnectionProvider.ConnectionProviderListener, IConnectionProvider.ConnectionProviderStaleEvent, IConnectionProvider.ConnectionProviderStatusChangedEvent
 
Constructor Summary
  AbstractConnectionProvider(java.lang.String id)
           
protected AbstractConnectionProvider(java.lang.String id, ConnectionRegistry registry)
          Allows injection of a custom ConnectionRegistry, mostly for testing.
 
Method Summary
 void addListener(IConnectionProvider.ConnectionProviderListener listener)
          Adds a IConnectionProvider.ConnectionProviderListener to this service which is notified of any changes to the collection of ConnectionParameters provided by this IConnectionProvider
protected  void clear()
           
protected  ConnectionParameters createNewConnectionParameters(java.lang.String internalId, java.lang.String name, java.lang.String connectionTypeId, java.util.Map<java.lang.String,java.lang.String> attributes)
           
 ConnectionParameters getConnection(java.lang.String configurationId)
          Retrieves a set of ConnectionParameters identified by the supplied ID.
 java.util.Collection<ConnectionParameters> getConnections()
          Gets all ConnectionParameters provided by this IConnectionProvider or an empty collection if there are none.
 java.lang.String getId()
           
protected static java.lang.String getInternalId(java.lang.String externalId)
          Returns the internal ID for a specified external ID.
protected abstract  IStatus getStatus()
           
protected  java.lang.String getUnusedLocalId()
           
protected abstract  java.util.List<ConnectionParameters> getUpdatedConfigurations(IProgressMonitor monitor)
          This method is called when a connection provider is refreshed, and should return the Collection of configurations available from this IConnectionProvider
protected  void notifyStale()
          This method can be called to notify implementors that the connection provider is stale and should be refreshed.
protected  ConnectionParameters putConnectionParameters(ConnectionParameters newParameters)
          Adds the supplied parameters to the cache
 IStatus refresh(IProgressMonitor monitor)
          Called by the connections framework when this IConnectionProvider should check for any updates.
protected  void removeConnectionParameters(java.lang.String id)
          Remove the parameters with the supplied ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.cics.core.connections.IConnectionProvider
getDescription
 

Constructor Detail

AbstractConnectionProvider

public AbstractConnectionProvider(java.lang.String id)
Parameters:
id - the ID of the connection provider

AbstractConnectionProvider

protected AbstractConnectionProvider(java.lang.String id,
                                     ConnectionRegistry registry)
Allows injection of a custom ConnectionRegistry, mostly for testing.

Parameters:
id - the ID of the connection provider
registry - ConnectionRegistry to use to look up connection metadata
Method Detail

clear

protected void clear()

getId

public java.lang.String getId()
Specified by:
getId in interface IConnectionProvider
Returns:
the ID of this IConnectionProvider

getConnections

public java.util.Collection<ConnectionParameters> getConnections()
Description copied from interface: IConnectionProvider
Gets all ConnectionParameters provided by this IConnectionProvider or an empty collection if there are none.

Specified by:
getConnections in interface IConnectionProvider
Returns:
a Collection of ConnectionParameters or an empty collection.

getConnection

public ConnectionParameters getConnection(java.lang.String configurationId)
Description copied from interface: IConnectionProvider
Retrieves a set of ConnectionParameters identified by the supplied ID.

Specified by:
getConnection in interface IConnectionProvider
Parameters:
configurationId - the id to use.
Returns:
some ConnectionParameters or null if no such connection parameters exist.

refresh

public IStatus refresh(IProgressMonitor monitor)
Description copied from interface: IConnectionProvider
Called by the connections framework when this IConnectionProvider should check for any updates. This is the appropriate time to perform any network or disk I/O necessary to check that the set of known ConnectionParameters is up to date. An IStatus object should be returned which describes the result of the refresh. This can be used to report any problems.

Specified by:
refresh in interface IConnectionProvider
Parameters:
monitor - an IProgressMonitor to report progress to.
Returns:
an IStatus describing the result of the refresh.

getUpdatedConfigurations

protected abstract java.util.List<ConnectionParameters> getUpdatedConfigurations(IProgressMonitor monitor)
This method is called when a connection provider is refreshed, and should return the Collection of configurations available from this IConnectionProvider

Parameters:
monitor -
Returns:

getStatus

protected abstract IStatus getStatus()
Returns:
the current IStatus of this IConnectionProvider

notifyStale

protected void notifyStale()
This method can be called to notify implementors that the connection provider is stale and should be refreshed.


addListener

public void addListener(IConnectionProvider.ConnectionProviderListener listener)
Description copied from interface: IConnectionProvider
Adds a IConnectionProvider.ConnectionProviderListener to this service which is notified of any changes to the collection of ConnectionParameters provided by this IConnectionProvider

Specified by:
addListener in interface IConnectionProvider
Parameters:
listener - the IConnectionProvider.ConnectionProviderListener to add.

getUnusedLocalId

protected java.lang.String getUnusedLocalId()
Returns:
an available local ID

getInternalId

protected static java.lang.String getInternalId(java.lang.String externalId)
Returns the internal ID for a specified external ID.

Parameters:
externalId -
Returns:
the internal ID

putConnectionParameters

protected ConnectionParameters putConnectionParameters(ConnectionParameters newParameters)
Adds the supplied parameters to the cache

Parameters:
newParameters -
Returns:

createNewConnectionParameters

protected ConnectionParameters createNewConnectionParameters(java.lang.String internalId,
                                                             java.lang.String name,
                                                             java.lang.String connectionTypeId,
                                                             java.util.Map<java.lang.String,java.lang.String> attributes)

removeConnectionParameters

protected void removeConnectionParameters(java.lang.String id)
Remove the parameters with the supplied ID.

Parameters:
id - the ID of the parameters to remove


Copyright © 2013 IBM Corp. All Rights Reserved.