Package com.sun.enterprise.connectors
Class ConnectorRegistry
- java.lang.Object
-
- com.sun.enterprise.connectors.ConnectorRegistry
-
public class ConnectorRegistry extends Object
This is an registry class which holds various objects in hashMaps, hash tables, and vectors. These objects are updated and queried during various funtionalities of rar deployment/undeployment, resource creation/destruction Ex. of these objects are ResourcesAdapter instances, security maps for pool managed connection factories. It follows singleton pattern. i.e only one instance at any point of time.- Author:
- Binod P.G and Srikanth P
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,jakarta.validation.Validator>beanValidatorsprotected static ConnectorRegistryconnectorRegistryInstanceprotected Map<PoolInfo,PoolMetaData>factoriesprotected Map<String,Object>locksprotected Map<String,ConnectorApplication>rarModulesprotected Map<String,ResourceAdapterConfig>resourceAdapterConfigprotected Map<String,ActiveResourceAdapter>resourceAdaptersresourceAdapterskeeps track of all active resource adapters in the connector runtime.protected Set<ResourceInfo>resourceInfosprotected ConcurrentMap<ResourceInfo,AtomicLong>resourceInfoVersionprotected Set<PoolInfo>transparentDynamicReconfigPools
-
Constructor Summary
Constructors Modifier Constructor Description protectedConnectorRegistry()Protected constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddActiveResourceAdapter(String rarModuleName, ActiveResourceAdapter rar)Adds the object implementing ActiveResourceAdapter interface to the registry.voidaddBeanValidator(String rarModuleName, jakarta.validation.Validator validator)Adds the bean validator to the registry.voidaddConnectorApplication(ConnectorApplication rarModule)register a connector application (rarModule) with the registryvoidaddManagedConnectionFactory(PoolInfo poolInfo, PoolMetaData pmd)Add MCF instance pertaining to the poolName to the registry.voidaddResourceAdapterConfig(String rarName, ResourceAdapterConfig raConfig)Add the resource adapter config properties object to registry against the rarName.voidaddResourceInfo(ResourceInfo resourceInfo)Add resourceInfo that is deployed for book-keeping purposes.voidaddTransparentDynamicReconfigPool(PoolInfo poolInfo)Add PoolInfo that has transparent-dynamic-reconfiguration enabled .ActiveResourceAdaptergetActiveResourceAdapter(String rarModuleName)Retrieves the object implementing ActiveResourceAdapter interface from the registry.ActiveResourceAdapter[]getAllActiveResourceAdapters()Returns all Active Resource Adapters in the connector runtime.jakarta.validation.ValidatorgetBeanValidator(String rarModuleName)Retrieves the bean validator of a resource-adapter from the registry.ConnectorApplicationgetConnectorApplication(String rarName)retrieve a connector application (rarModule) from the registryList<String>getConnectorsSupportingMessageListener(String messageListener)get the list of resource-adapters that support this message-listener-typeConnectorDescriptorgetDescriptor(String rarModuleName)Gets the connector descriptor pertaining the rarstatic ConnectorRegistrygetInstance()Return the ConnectorRegistry instanceObjectgetLockObject(String rarName)lock object that will be used by ResourceAdapterAdminService to avoid multiple calls to create ActiveRA for same resource-adapterjakarta.resource.spi.ManagedConnectionFactorygetManagedConnectionFactory(PoolInfo poolInfo)Retrieve MCF instance pertaining to the poolName from the registry.PoolMetaDatagetPoolMetaData(PoolInfo poolInfo)ResourceAdapterConfiggetResourceAdapterConfig(String rarName)Get the resource adapter config properties object registered with registry against the rarName.longgetResourceInfoVersion(ResourceInfo resourceInfo)get the version counter of a resource infoRuntimeSecurityMapgetRuntimeSecurityMap(PoolInfo poolInfo)Gets the runtime equivalent of policies enforced by the Security Maps pertaining to a pool from the Pool's Meta Data.booleanisMCFCreated(PoolInfo poolInfo)Checks if the MCF pertaining to the pool is instantiated and present in the registry.booleanisRegistered(String rarModuleName)Checks whether the rar is already deployed i.e registered with connector registrybooleanisResourceDeployed(ResourceInfo resourceInfo)indicates whether the resource is deployed (enabled)booleanisTransparentDynamicReconfigPool(PoolInfo poolInfo)indicates whether the pool has transparent-dynamic-reconfiguration property enabledbooleanremoveActiveResourceAdapter(String rarModuleName)Removes the object implementing ActiveResourceAdapter interface from the registry.booleanremoveBeanValidator(String rarModuleName)Removes the bean validator of a resource-adapter from the registry.voidremoveConnectorApplication(String rarName)remove a connector application (rarModule) from the registryvoidremoveLockObject(String rarName)removes the lock-object used for creating the ActiveRA for a particular RARbooleanremoveManagedConnectionFactory(PoolInfo poolInfo)Remove MCF instance pertaining to the poolName from the registry.booleanremoveResourceAdapterConfig(String rarName)Remove the resource adapter config properties object from registrybooleanremoveResourceFactories(ResourceInfo resourceInfo)remove and invalidate factories (proxy to actual factory) using the resource.booleanremoveResourceInfo(ResourceInfo resourceInfo)Remove ResourceInfo from registry.booleanremoveTransparentDynamicReconfigPool(PoolInfo poolInfo)Remove ResourceInfo from registry.longupdateResourceInfoVersion(ResourceInfo resourceInfo)Update version information for a resource.
-
-
-
Field Detail
-
connectorRegistryInstance
protected static final ConnectorRegistry connectorRegistryInstance
-
resourceAdapters
protected final Map<String,ActiveResourceAdapter> resourceAdapters
resourceAdapterskeeps track of all active resource adapters in the connector runtime. String:resourceadapterName Vs ActiveResourceAdapter
-
factories
protected final Map<PoolInfo,PoolMetaData> factories
-
resourceAdapterConfig
protected final Map<String,ResourceAdapterConfig> resourceAdapterConfig
-
rarModules
protected final Map<String,ConnectorApplication> rarModules
-
resourceInfoVersion
protected final ConcurrentMap<ResourceInfo,AtomicLong> resourceInfoVersion
-
resourceInfos
protected final Set<ResourceInfo> resourceInfos
-
-
Method Detail
-
getInstance
public static ConnectorRegistry getInstance()
Return the ConnectorRegistry instance- Returns:
- ConnectorRegistry instance which is a singleton
-
addActiveResourceAdapter
public void addActiveResourceAdapter(String rarModuleName, ActiveResourceAdapter rar)
Adds the object implementing ActiveResourceAdapter interface to the registry.- Parameters:
rarModuleName- RarName which is the keyrar- ActiveResourceAdapter instance which is the value.
-
getResourceInfoVersion
public long getResourceInfoVersion(ResourceInfo resourceInfo)
get the version counter of a resource info- Parameters:
resourceInfo- resource-name- Returns:
- version counter.
-1Lif the resource is invalid
-
updateResourceInfoVersion
public long updateResourceInfoVersion(ResourceInfo resourceInfo)
Update version information for a resource.- Parameters:
resourceInfo- resource info to be updated.- Returns:
- new version couter
-
removeResourceFactories
public boolean removeResourceFactories(ResourceInfo resourceInfo)
remove and invalidate factories (proxy to actual factory) using the resource.- Parameters:
resourceInfo- resource-name- Returns:
- boolean indicating whether the factories will get invalidated
-
addResourceInfo
public void addResourceInfo(ResourceInfo resourceInfo)
Add resourceInfo that is deployed for book-keeping purposes.- Parameters:
resourceInfo- Resource being deployed.
-
removeResourceInfo
public boolean removeResourceInfo(ResourceInfo resourceInfo)
Remove ResourceInfo from registry. Called when resource is disabled/undeployed.- Parameters:
resourceInfo- ResourceInfo- Returns:
- boolean indicating whether resource exists and removed.
-
isResourceDeployed
public boolean isResourceDeployed(ResourceInfo resourceInfo)
indicates whether the resource is deployed (enabled)- Parameters:
resourceInfo- resource-info- Returns:
- boolean indicating whether the resource is deployed.
-
addTransparentDynamicReconfigPool
public void addTransparentDynamicReconfigPool(PoolInfo poolInfo)
Add PoolInfo that has transparent-dynamic-reconfiguration enabled .- Parameters:
poolInfo- Pool being deployed.
-
removeTransparentDynamicReconfigPool
public boolean removeTransparentDynamicReconfigPool(PoolInfo poolInfo)
Remove ResourceInfo from registry. Called when resource is disabled/undeployed.- Parameters:
poolInfo- poolInfo- Returns:
- boolean indicating whether the pool exists and removed.
-
isTransparentDynamicReconfigPool
public boolean isTransparentDynamicReconfigPool(PoolInfo poolInfo)
indicates whether the pool has transparent-dynamic-reconfiguration property enabled- Parameters:
poolInfo- poolInfo- Returns:
- boolean false if pool is not deployed
-
removeActiveResourceAdapter
public boolean removeActiveResourceAdapter(String rarModuleName)
Removes the object implementing ActiveResourceAdapter interface from the registry. This method is called whenever an active connector module is removed from the Connector runtime. [eg. undeploy/recreate etc]- Parameters:
rarModuleName- RarName which is the key- Returns:
- true if successfully removed false if deletion fails.
-
getActiveResourceAdapter
public ActiveResourceAdapter getActiveResourceAdapter(String rarModuleName)
Retrieves the object implementing ActiveResourceAdapter interface from the registry. Key is the rarName.- Parameters:
rarModuleName- Rar name. It is the key- Returns:
- object implementing ActiveResourceAdapter interface
-
getLockObject
public Object getLockObject(String rarName)
lock object that will be used by ResourceAdapterAdminService to avoid multiple calls to create ActiveRA for same resource-adapter- Parameters:
rarName- resource-adapter name- Returns:
- lock object for the resource-adapter
-
removeLockObject
public void removeLockObject(String rarName)
removes the lock-object used for creating the ActiveRA for a particular RAR- Parameters:
rarName- resource-adapter
-
addBeanValidator
public void addBeanValidator(String rarModuleName, jakarta.validation.Validator validator)
Adds the bean validator to the registry.- Parameters:
rarModuleName- RarName which is the keyvalidator- to be added to registry
-
getBeanValidator
public jakarta.validation.Validator getBeanValidator(String rarModuleName)
Retrieves the bean validator of a resource-adapter from the registry. Key is the rarName.- Parameters:
rarModuleName- Rar name. It is the key- Returns:
- bean validator
-
removeBeanValidator
public boolean removeBeanValidator(String rarModuleName)
Removes the bean validator of a resource-adapter from the registry. This method is called whenever an active connector module is removed from the Connector runtime. [eg. undeploy/recreate etc]- Parameters:
rarModuleName- RarName which is the key- Returns:
- true if successfully removed false if deletion fails.
-
isMCFCreated
public boolean isMCFCreated(PoolInfo poolInfo)
Checks if the MCF pertaining to the pool is instantiated and present in the registry. Each pool has its own MCF instance.- Parameters:
poolInfo- Name of the pool- Returns:
- true if the MCF is found. false if MCF is not found
-
removeManagedConnectionFactory
public boolean removeManagedConnectionFactory(PoolInfo poolInfo)
Remove MCF instance pertaining to the poolName from the registry.- Parameters:
poolInfo- Name of the pool- Returns:
- true if successfully removed. false if removal fails.
-
addManagedConnectionFactory
public void addManagedConnectionFactory(PoolInfo poolInfo, PoolMetaData pmd)
Add MCF instance pertaining to the poolName to the registry.- Parameters:
poolInfo- Name of the poolpmd- MCF instance to be added.
-
getManagedConnectionFactory
public jakarta.resource.spi.ManagedConnectionFactory getManagedConnectionFactory(PoolInfo poolInfo)
Retrieve MCF instance pertaining to the poolName from the registry.- Parameters:
poolInfo- Name of the pool- Returns:
- factory MCF instance retrieved.
-
isRegistered
public boolean isRegistered(String rarModuleName)
Checks whether the rar is already deployed i.e registered with connector registry- Parameters:
rarModuleName- rar Name.- Returns:
- true if rar is registered false if rar is not registered.
-
getDescriptor
public ConnectorDescriptor getDescriptor(String rarModuleName)
Gets the connector descriptor pertaining the rar- Parameters:
rarModuleName- rarName- Returns:
- ConnectorDescriptor which represents the ra.xml
-
getRuntimeSecurityMap
public RuntimeSecurityMap getRuntimeSecurityMap(PoolInfo poolInfo)
Gets the runtime equivalent of policies enforced by the Security Maps pertaining to a pool from the Pool's Meta Data.- Parameters:
poolInfo- pool information- Returns:
- runtimeSecurityMap in the form of HashMap of HashMaps (user and groups).
-
getResourceAdapterConfig
public ResourceAdapterConfig getResourceAdapterConfig(String rarName)
Get the resource adapter config properties object registered with registry against the rarName.- Parameters:
rarName- Name of the rar- Returns:
- ResourceAdapter configuration object
-
addResourceAdapterConfig
public void addResourceAdapterConfig(String rarName, ResourceAdapterConfig raConfig)
Add the resource adapter config properties object to registry against the rarName.- Parameters:
rarName- Name of the rarraConfig- ResourceAdapter configuration object
-
removeResourceAdapterConfig
public boolean removeResourceAdapterConfig(String rarName)
Remove the resource adapter config properties object from registry- Parameters:
rarName- Name of the rar- Returns:
- true if successfully deleted false if deletion fails
-
getAllActiveResourceAdapters
public ActiveResourceAdapter[] getAllActiveResourceAdapters()
Returns all Active Resource Adapters in the connector runtime.- Returns:
- All active resource adapters in the connector runtime
-
getPoolMetaData
public PoolMetaData getPoolMetaData(PoolInfo poolInfo)
-
addConnectorApplication
public void addConnectorApplication(ConnectorApplication rarModule)
register a connector application (rarModule) with the registry- Parameters:
rarModule- resource-adapter module
-
getConnectorApplication
public ConnectorApplication getConnectorApplication(String rarName)
retrieve a connector application (rarModule) from the registry- Parameters:
rarName- resource-adapter name- Returns:
- ConnectorApplication app
-
removeConnectorApplication
public void removeConnectorApplication(String rarName)
remove a connector application (rarModule) from the registry- Parameters:
rarName- resource-adapter module
-
-