com.ibm.j2ca.base
Class WBIResourceAdapter

java.lang.Object
  extended bycom.ibm.j2ca.base.WBIResourceAdapter
All Implemented Interfaces:
javax.resource.spi.ResourceAdapter, com.ibm.j2ca.base.WBIPollingTaskListener

public abstract class WBIResourceAdapter
extends java.lang.Object
implements javax.resource.spi.ResourceAdapter, com.ibm.j2ca.base.WBIPollingTaskListener

A ResourceAdapter instance acts as a central authority for the state and instance-specific information about the adapter; in addition, it provides a means for the JCA container to register endpoints for inbound event delivery.

This class provides a foundation implementation that offers:

A subclass should:


Constructor Summary
WBIResourceAdapter()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Registers a listener for general property changes.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Registers a listener for changes in a specific property.
protected  com.ibm.j2ca.extension.eventmanagement.EventManager createEventManager()
          Used by this class to instantiate new event manager instances for inbound event delivery.
 void endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory mef, javax.resource.spi.ActivationSpec aspec)
          Works in concert with endpointDeactivation to allow the resource adapter adapter container to add and remove endpoints from the adapter.
 void endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory mef, javax.resource.spi.ActivationSpec aspec)
          Works in concert with endpointActivation to allow the resource adapter container to add and remove endpoints from the adapter.
 boolean equals(java.lang.Object o)
           
 java.lang.String getAdapterID()
           
 com.ibm.j2ca.base.bidi.WBIBiDiContext getBiDiContext()
           
 java.lang.String getBiDiContextEIS()
           
 java.lang.String getBiDiContextMetadata()
           
 java.lang.String getBiDiContextSkip()
           
 java.lang.String getBiDiContextSpecialFormat()
           
 java.lang.Boolean getBiDiContextTurnBiDiOff()
           
 java.lang.String getLogFilename()
           
 int getLogFileSize()
           
 int getLogNumberOfFiles()
           
 LogUtils getLogUtils()
          Gets the logUtils for this resource adapter.
protected  java.beans.PropertyChangeSupport getPropertyChangeSupport()
          Provides a PropertyChangeSupport instance that can be used to notify any listeners of property changes on the resource adapter.
abstract  WBIResourceAdapterMetadata getResourceAdapterMetadata()
          Returns metadata about the resource adapter implementation.
 java.lang.Boolean getThreadContextPropagationRequired()
           
 java.lang.String getTraceFilename()
           
 int getTraceFileSize()
           
 int getTraceNumberOfFiles()
           
 javax.transaction.xa.XAResource[] getXAResources(javax.resource.spi.ActivationSpec[] activationSpecs)
          Invoked by the JCA container to get XAResource instances for inbound event recovery.
 int hashCode()
           
 void onPollFailure(com.ibm.j2ca.base.WBIPollingTask task, java.lang.Throwable cause)
          Invoked by a WBIPollingTask instance if any errors occur during polling.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Unregisters a listener for general property changes.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Unregisters a listener for changes in a specific property.
 void setAdapterID(java.lang.String newValue)
           
 void setBiDiContextEIS(java.lang.String biDiContextEIS)
           
 void setBiDiContextMetadata(java.lang.String biDiContextMetadata)
           
 void setBiDiContextSkip(java.lang.String biDiContextSkip)
           
 void setBiDiContextSpecialFormat(java.lang.String biDiContextSpecialFormat)
           
 void setBiDiContextTurnBiDiOff(java.lang.Boolean biDiContextTurnBiDiOff)
           
 void setLogFilename(java.lang.String newValue)
           
 void setLogFileSize(int i)
           
 void setLogNumberOfFiles(int i)
           
protected  void setLogUtils(LogUtils logUtils)
          Sets the logUtils for this resource adapter.
 void setThreadContextPropagationRequired(java.lang.Boolean newValue)
           
 void setTraceFilename(java.lang.String newValue)
           
 void setTraceFileSize(int i)
           
 void setTraceNumberOfFiles(int i)
           
 void start(javax.resource.spi.BootstrapContext bootstrapCtx)
          Initializes the internal configuration of this class.
 void stop()
          Releases any resources used by this class.
protected  void validate()
          Validates the configuration properties defined for this resource adapter instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WBIResourceAdapter

public WBIResourceAdapter()
Method Detail

start

public void start(javax.resource.spi.BootstrapContext bootstrapCtx)
           throws javax.resource.spi.ResourceAdapterInternalException
Initializes the internal configuration of this class.

A subclass should override this method if it has its own configuration to intialize. According to Java Connector Architecture standards, this method should execute in a non-blocking fashion . Additionally, any subclasses that override this method should avoid intensive operations (for example, connecting to the EIS) unless these operations are performed in a separate Work instance submitted to the WorkManager.

Specified by:
start in interface javax.resource.spi.ResourceAdapter
Throws:
javax.resource.spi.ResourceAdapterInternalException

stop

public void stop()
Releases any resources used by this class.

A subclasses should override this method to free up any of its own resources, such as physical connections to the EIS.

Specified by:
stop in interface javax.resource.spi.ResourceAdapter

endpointActivation

public void endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory mef,
                               javax.resource.spi.ActivationSpec aspec)
                        throws javax.resource.ResourceException
Works in concert with endpointDeactivation to allow the resource adapter adapter container to add and remove endpoints from the adapter.

A subclass does not need to override this method unless it wants to explicitely track endpoints.

If a subclass implements WBIPollableResourceAdapter, this method will track endpoints and activate or deactivate polling as appropriate. If the EIS does not support polling, a subclass can ignore both these methods.

Specified by:
endpointActivation in interface javax.resource.spi.ResourceAdapter
Throws:
javax.resource.ResourceException

endpointDeactivation

public void endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory mef,
                                 javax.resource.spi.ActivationSpec aspec)
Works in concert with endpointActivation to allow the resource adapter container to add and remove endpoints from the adapter.

Specified by:
endpointDeactivation in interface javax.resource.spi.ResourceAdapter

onPollFailure

public void onPollFailure(com.ibm.j2ca.base.WBIPollingTask task,
                          java.lang.Throwable cause)
Invoked by a WBIPollingTask instance if any errors occur during polling.

Specified by:
onPollFailure in interface com.ibm.j2ca.base.WBIPollingTaskListener

createEventManager

protected com.ibm.j2ca.extension.eventmanagement.EventManager createEventManager()
Used by this class to instantiate new event manager instances for inbound event delivery. A subclass can override this method if it has a specific event manager class that it wishes to use instead of the default.


getXAResources

public javax.transaction.xa.XAResource[] getXAResources(javax.resource.spi.ActivationSpec[] activationSpecs)
                                                 throws javax.resource.ResourceException
Invoked by the JCA container to get XAResource instances for inbound event recovery.

Specified by:
getXAResources in interface javax.resource.spi.ResourceAdapter
Throws:
javax.resource.ResourceException
See Also:
XAResource

getPropertyChangeSupport

protected java.beans.PropertyChangeSupport getPropertyChangeSupport()
Provides a PropertyChangeSupport instance that can be used to notify any listeners of property changes on the resource adapter.


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Registers a listener for general property changes. Generally only used by the resource adapter container.


addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Registers a listener for changes in a specific property. Generally only used by the resource adapter container.


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Unregisters a listener for general property changes. Generally only used by the resource adapter container.


removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Unregisters a listener for changes in a specific property. Generally only used by the resource adapter container.


getLogUtils

public LogUtils getLogUtils()
Gets the logUtils for this resource adapter.

Returns:
logUtils
See Also:
LogUtils

setLogUtils

protected void setLogUtils(LogUtils logUtils)
Sets the logUtils for this resource adapter.

Parameters:
logUtils -
See Also:
LogUtils

getBiDiContextMetadata

public java.lang.String getBiDiContextMetadata()

setBiDiContextMetadata

public void setBiDiContextMetadata(java.lang.String biDiContextMetadata)
                            throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

getBiDiContextEIS

public java.lang.String getBiDiContextEIS()

setBiDiContextEIS

public void setBiDiContextEIS(java.lang.String biDiContextEIS)
                       throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

getBiDiContextSpecialFormat

public java.lang.String getBiDiContextSpecialFormat()

setBiDiContextSpecialFormat

public void setBiDiContextSpecialFormat(java.lang.String biDiContextSpecialFormat)

getBiDiContextSkip

public java.lang.String getBiDiContextSkip()

setBiDiContextSkip

public void setBiDiContextSkip(java.lang.String biDiContextSkip)

getBiDiContextTurnBiDiOff

public java.lang.Boolean getBiDiContextTurnBiDiOff()

setBiDiContextTurnBiDiOff

public void setBiDiContextTurnBiDiOff(java.lang.Boolean biDiContextTurnBiDiOff)

getBiDiContext

public com.ibm.j2ca.base.bidi.WBIBiDiContext getBiDiContext()

getAdapterID

public java.lang.String getAdapterID()

getLogFilename

public java.lang.String getLogFilename()

getLogFileSize

public int getLogFileSize()

getLogNumberOfFiles

public int getLogNumberOfFiles()

getTraceFilename

public java.lang.String getTraceFilename()

getTraceFileSize

public int getTraceFileSize()

getTraceNumberOfFiles

public int getTraceNumberOfFiles()

setAdapterID

public void setAdapterID(java.lang.String newValue)
                  throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

setLogFilename

public void setLogFilename(java.lang.String newValue)
                    throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

setLogFileSize

public void setLogFileSize(int i)
                    throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

setLogNumberOfFiles

public void setLogNumberOfFiles(int i)
                         throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

setTraceFilename

public void setTraceFilename(java.lang.String newValue)
                      throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

setTraceFileSize

public void setTraceFileSize(int i)
                      throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

setTraceNumberOfFiles

public void setTraceNumberOfFiles(int i)
                           throws java.beans.PropertyVetoException
Throws:
java.beans.PropertyVetoException

getThreadContextPropagationRequired

public java.lang.Boolean getThreadContextPropagationRequired()

setThreadContextPropagationRequired

public void setThreadContextPropagationRequired(java.lang.Boolean newValue)

getResourceAdapterMetadata

public abstract WBIResourceAdapterMetadata getResourceAdapterMetadata()
                                                               throws javax.resource.ResourceException
Returns metadata about the resource adapter implementation. This method is identical to ConnectionFactory.getMetaData() but makes the same data available to both the inbound and outbound components of the adapter. This is required for logging and tracing implementations.

Throws:
javax.resource.ResourceException

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object o)

validate

protected void validate()
                 throws javax.resource.spi.InvalidPropertyException
Validates the configuration properties defined for this resource adapter instance.

A subclass should override this method and add checks for its custom configuration properties , and it should also call call super.validate.

Throws:
javax.resource.spi.InvalidPropertyException