com.sun.enterprise.connectors.jms.system
Class ActiveJmsResourceAdapter

java.lang.Object
  extended by com.sun.enterprise.connectors.ActiveResourceAdapterImpl
      extended by com.sun.enterprise.connectors.ActiveOutboundResourceAdapter
          extended by com.sun.enterprise.connectors.inbound.ActiveInboundResourceAdapterImpl
              extended by com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter
All Implemented Interfaces:
ActiveResourceAdapter, ActiveInboundResourceAdapter, LazyServiceInitializer, org.jvnet.hk2.component.PostConstruct

@Service
@Scoped(value=org.jvnet.hk2.component.Singleton.class)
public class ActiveJmsResourceAdapter
extends ActiveInboundResourceAdapterImpl
implements LazyServiceInitializer, org.jvnet.hk2.component.PostConstruct

Represents an active JMS resource adapter. This does additional configuration to ManagedConnectionFactory and ResourceAdapter java beans. XXX: For code management reasons, think about splitting this to a preHawk and postHawk RA (with postHawk RA extending preHawk RA).

Author:
Satish Kumar

Field Summary
static java.lang.String ADDRESSLIST
           
static java.lang.String ADMINPASSWORD
           
static java.lang.String ADMINUSERNAME
           
static java.lang.String BROKERTYPE
           
static java.lang.String CONNECTION_URL
           
static java.lang.String DESTINATION
           
static java.lang.String DESTINATION_TYPE
           
static java.lang.String DIRECT
           
static java.lang.String EMBEDDED
           
static java.lang.String LOCAL
           
static java.lang.String MQ_DIR_NAME
           
static java.lang.String PHYSICAL_DESTINATION
           
static java.lang.String REMOTE
           
 
Fields inherited from class com.sun.enterprise.connectors.ActiveOutboundResourceAdapter
bootStrapContextImpl, resourceadapter_
 
Fields inherited from class com.sun.enterprise.connectors.ActiveResourceAdapterImpl
connectionDefs_, connectorRuntime_, desc_, jcl_, moduleName_
 
Constructor Summary
ActiveJmsResourceAdapter()
          Constructor for an active Jms Adapter.
 
Method Summary
 void addJmsHost(JmsHost host)
          Adds the JmsHost to the MQAddressList of the resource adapter.
 ManagedConnectionFactory[] createManagedConnectionFactories(ConnectorConnectionPool cpr, java.lang.ClassLoader loader)
          This is a temporay solution for obtaining all the MCFs corresponding to a JMS RA pool, this is to facilitate the recovery process where the XA resources of all RMs in the broker cluster are required.
 ManagedConnectionFactory createManagedConnectionFactory(ConnectorConnectionPool cpr, java.lang.ClassLoader loader)
          Creates ManagedConnection Factory instance.
 void deleteJmsHost(JmsHost host)
          Removes the JmsHost from the MQAddressList of the resource adapter.
 int getAddressListCount()
           
static java.lang.String getBrokerInstanceName(JmsService js)
           
protected  JmsHost getJmsHost()
           
 java.lang.String getServiceName()
           
 void handleRequest(java.nio.channels.SelectableChannel selectableChannel)
           
 boolean handles(ConnectorDescriptor cd, java.lang.String moduleName)
           
 boolean initializeService()
           
protected  ManagedConnectionFactory instantiateMCF(java.lang.String mcfClass, java.lang.ClassLoader loader)
           
protected  void loadRAConfiguration()
          Loads RA configuration for MQ Resource adapter.
protected  java.util.Set mergeRAConfiguration(ResourceAdapterConfig raConfig, java.util.List<org.jvnet.hk2.config.types.Property> raConfigProps)
          This is a HACK to remove the connection URL in the case of PE LOCAL/EMBEDDED before setting the properties to the RA.
 void postConstruct()
           
protected  void postRAConfiguration()
          Method to perform any post RA configuration action by derivative subclasses.
 void reloadRA(JmsService js)
          Recreates the ResourceAdapter using new values from JmsSerice.
protected  void setClusterBrokerList(java.lang.String brokerList)
           
 void setMasterBroker(java.lang.String newMasterBroker)
           
 void setup()
           
protected  void startResourceAdapter(BootstrapContext bootstrapContext)
           
 void updateJmsHost(JmsHost host)
          Updates the JmsHost information in the MQAddressList of the resource adapter.
 void updateMDBRuntimeInfo(EjbMessageBeanDescriptor descriptor_, BeanPoolDescriptor poolDescriptor)
          This is the most appropriate time (??) to update the runtime info of a 1.3 MDB into 1.4 MDB.
 void validateActivationSpec(ActivationSpec spec)
           
 
Methods inherited from class com.sun.enterprise.connectors.inbound.ActiveInboundResourceAdapterImpl
addEndpointFactoryInfo, destroy, getAllEndpointFactories, getAllEndpointFactoryInfo, getEndpointFactoryInfo, init, removeEndpointFactoryInfo
 
Methods inherited from class com.sun.enterprise.connectors.ActiveOutboundResourceAdapter
addAdminObject, getBootStrapContext, getResourceAdapter
 
Methods inherited from class com.sun.enterprise.connectors.ActiveResourceAdapterImpl
createAllConnectorResources, createDefaultConnectorConnectionPools, createDefaultConnectorResources, deleteDefaultConnectorConnectionPools, deleteDefaultConnectorResources, destroyAllConnectorResources, getClassLoader, getDescriptor, getModuleName, isServer, isSystemRar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.enterprise.connectors.ActiveResourceAdapter
getClassLoader, getDescriptor, getModuleName, getResourceAdapter
 

Field Detail

CONNECTION_URL

public static final java.lang.String CONNECTION_URL
See Also:
Constant Field Values

BROKERTYPE

public static final java.lang.String BROKERTYPE
See Also:
Constant Field Values

ADMINUSERNAME

public static final java.lang.String ADMINUSERNAME
See Also:
Constant Field Values

ADMINPASSWORD

public static final java.lang.String ADMINPASSWORD
See Also:
Constant Field Values

DESTINATION

public static final java.lang.String DESTINATION
See Also:
Constant Field Values

DESTINATION_TYPE

public static final java.lang.String DESTINATION_TYPE
See Also:
Constant Field Values

PHYSICAL_DESTINATION

public static final java.lang.String PHYSICAL_DESTINATION
See Also:
Constant Field Values

ADDRESSLIST

public static final java.lang.String ADDRESSLIST
See Also:
Constant Field Values

EMBEDDED

public static final java.lang.String EMBEDDED
See Also:
Constant Field Values

LOCAL

public static final java.lang.String LOCAL
See Also:
Constant Field Values

REMOTE

public static final java.lang.String REMOTE
See Also:
Constant Field Values

DIRECT

public static final java.lang.String DIRECT
See Also:
Constant Field Values

MQ_DIR_NAME

public static final java.lang.String MQ_DIR_NAME
See Also:
Constant Field Values
Constructor Detail

ActiveJmsResourceAdapter

public ActiveJmsResourceAdapter()
Constructor for an active Jms Adapter.

Method Detail

postConstruct

public void postConstruct()
Specified by:
postConstruct in interface org.jvnet.hk2.component.PostConstruct

loadRAConfiguration

protected void loadRAConfiguration()
                            throws ConnectorRuntimeException
Loads RA configuration for MQ Resource adapter.

Overrides:
loadRAConfiguration in class ActiveOutboundResourceAdapter
Throws:
ConnectorRuntimeException - in case of an exception.

startResourceAdapter

protected void startResourceAdapter(BootstrapContext bootstrapContext)
                             throws ResourceAdapterInternalException
Overrides:
startResourceAdapter in class ActiveOutboundResourceAdapter
Throws:
ResourceAdapterInternalException

mergeRAConfiguration

protected java.util.Set mergeRAConfiguration(ResourceAdapterConfig raConfig,
                                             java.util.List<org.jvnet.hk2.config.types.Property> raConfigProps)
This is a HACK to remove the connection URL in the case of PE LOCAL/EMBEDDED before setting the properties to the RA. If this was not done, MQ RA incorrectly assumed that the passed in connection URL is one additional URL, apart from the default URL derived from brokerhost:brokerport and reported a PE connection url limitation.

Overrides:
mergeRAConfiguration in class ActiveOutboundResourceAdapter

setup

public void setup()
           throws ConnectorRuntimeException
Specified by:
setup in interface ActiveResourceAdapter
Overrides:
setup in class ActiveOutboundResourceAdapter
Throws:
ConnectorRuntimeException

postRAConfiguration

protected void postRAConfiguration()
                            throws ConnectorRuntimeException
Method to perform any post RA configuration action by derivative subclasses. For example, this method is used by ActiveJMSResourceAdapter to set unsupported javabean property types on its RA JavaBean runtime instance.

Throws:
ConnectorRuntimeException

getBrokerInstanceName

public static java.lang.String getBrokerInstanceName(JmsService js)

handles

public boolean handles(ConnectorDescriptor cd,
                       java.lang.String moduleName)
Specified by:
handles in interface ActiveResourceAdapter
Overrides:
handles in class ActiveInboundResourceAdapterImpl

validateActivationSpec

public void validateActivationSpec(ActivationSpec spec)
Specified by:
validateActivationSpec in interface ActiveInboundResourceAdapter
Overrides:
validateActivationSpec in class ActiveInboundResourceAdapterImpl

reloadRA

public void reloadRA(JmsService js)
              throws ConnectorRuntimeException
Recreates the ResourceAdapter using new values from JmsSerice.

Parameters:
js - JmsService element of the domain.xml
Throws:
ConnectorRuntimeException - in case of any backend error.

addJmsHost

public void addJmsHost(JmsHost host)
                throws ConnectorRuntimeException
Adds the JmsHost to the MQAddressList of the resource adapter.

Parameters:
host - JmsHost element in the domain.xml
Throws:
ConnectorRuntimeException - in case of any backend error.

deleteJmsHost

public void deleteJmsHost(JmsHost host)
                   throws ConnectorRuntimeException
Removes the JmsHost from the MQAddressList of the resource adapter.

Parameters:
host - JmsHost element in the domain.xml
Throws:
ConnectorRuntimeException - in case of any backend error.

getJmsHost

protected JmsHost getJmsHost()

updateJmsHost

public void updateJmsHost(JmsHost host)
                   throws ConnectorRuntimeException
Updates the JmsHost information in the MQAddressList of the resource adapter.

Parameters:
host - JmsHost element in the domain.xml
Throws:
ConnectorRuntimeException - in case of any backend error.

createManagedConnectionFactories

public ManagedConnectionFactory[] createManagedConnectionFactories(ConnectorConnectionPool cpr,
                                                                   java.lang.ClassLoader loader)
This is a temporay solution for obtaining all the MCFs corresponding to a JMS RA pool, this is to facilitate the recovery process where the XA resources of all RMs in the broker cluster are required. Should be removed when a permanent solutuion is available from the broker.

Specified by:
createManagedConnectionFactories in interface ActiveResourceAdapter
Overrides:
createManagedConnectionFactories in class ActiveResourceAdapterImpl
Parameters:
cpr - ConnectorConnectionPool object
loader - Class Loader.

instantiateMCF

protected ManagedConnectionFactory instantiateMCF(java.lang.String mcfClass,
                                                  java.lang.ClassLoader loader)
                                           throws java.lang.Exception
Overrides:
instantiateMCF in class ActiveResourceAdapterImpl
Throws:
java.lang.Exception

createManagedConnectionFactory

public ManagedConnectionFactory createManagedConnectionFactory(ConnectorConnectionPool cpr,
                                                               java.lang.ClassLoader loader)
Creates ManagedConnection Factory instance. For any property that is for supporting AS7 imq properties, resource adapter has a set method setProperty(String,String). All as7 properties starts with "imq". MQ Adapter supports this only for backward compatibility.

Specified by:
createManagedConnectionFactory in interface ActiveResourceAdapter
Overrides:
createManagedConnectionFactory in class ActiveOutboundResourceAdapter
Parameters:
cpr - ConnectorConnectionPool object
loader - Class Loader.

updateMDBRuntimeInfo

public void updateMDBRuntimeInfo(EjbMessageBeanDescriptor descriptor_,
                                 BeanPoolDescriptor poolDescriptor)
                          throws ConnectorRuntimeException
This is the most appropriate time (??) to update the runtime info of a 1.3 MDB into 1.4 MDB.

Assumptions :

0. Assume it is a 1.3 MDB if no RA mid is specified. 1. Use the default system JMS resource adapter.

2. The ActivationSpec of the default JMS RA will provide the setDestination, setDestinationType, setSubscriptionName methods. 3. The jndi-name of the 1.3 MDB is the value for the Destination property for the ActivationSpec. 4. The ActivationSpec provides setter methods for the properties defined in the CF that corresponds to the mdb-connection-factory JNDI name.

Specified by:
updateMDBRuntimeInfo in interface ActiveInboundResourceAdapter
Overrides:
updateMDBRuntimeInfo in class ActiveInboundResourceAdapterImpl
Throws:
ConnectorRuntimeException

getAddressListCount

public int getAddressListCount()

getServiceName

public java.lang.String getServiceName()
Specified by:
getServiceName in interface LazyServiceInitializer

initializeService

public boolean initializeService()
Specified by:
initializeService in interface LazyServiceInitializer

handleRequest

public void handleRequest(java.nio.channels.SelectableChannel selectableChannel)
Specified by:
handleRequest in interface LazyServiceInitializer

setMasterBroker

public void setMasterBroker(java.lang.String newMasterBroker)

setClusterBrokerList

protected void setClusterBrokerList(java.lang.String brokerList)


Copyright © 2012 GlassFish Community. All Rights Reserved.