Class ConnectorsUtil
- java.lang.Object
-
- com.sun.appserv.connectors.internal.api.ConnectorsUtil
-
public class ConnectorsUtil extends Object
Util class for connector related classes
-
-
Constructor Summary
Constructors Constructor Description ConnectorsUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
belongsToJdbcRA(String raName)
determine whether the RAR in question is a System RARstatic boolean
belongsToSystemRA(String raName)
determine whether the RAR in question is a System RARstatic Map<String,String>
convertPropertiesToMap(Properties properties)
static String
deriveJndiName(String name, Hashtable env)
Given the name of the resource and its jndi env, derive the complete jndi name.static String
deriveResourceName(String compId, String name, JavaEEResourceType resType)
static String
escapeResourceNameForMonitoring(String name)
static boolean
extractRar(String fileName, String rarName, String destDir)
GlassFish (Embedded) Uber jar will have .rar bundled in it.static String
getActualModuleName(String moduleName)
static Collection<String>
getAllPoolNames(Collection<ConnectorConnectionPool> connectionPools)
get the list of pool namesstatic Collection<ConnectorConnectionPool>
getAllPoolsOfModule(String moduleName, Resources allResources)
get the pools for a particular resource-adapterstatic Collection<Resource>
getAllResources(Collection<String> poolNames, Resources allResources)
static Collection<Resource>
getAllSystemRAResourcesAndPools(Resources allResources)
Get all System RAR pools and resourcesstatic Collection<WorkSecurityMap>
getAllWorkSecurityMaps(Resources resources, String moduleName)
static String
getApplicationName(Resource resource)
static String
getApplicationName(DeploymentContext context)
static String
getApplicationName(PoolInfo poolInfo)
static String
getApplicationNameOfEmbeddedRar(String embeddedRarName)
static Map<String,String>
getBuiltInCustomResources()
Provides the list of built in custom resources by resource-type and factory-class-name pair.static ResourcePool
getConnectionPoolConfig(PoolInfo poolInfo, Resources allResources)
static String
getEmbeddedRarModuleName(String applicationName, String moduleName)
static List<URI>
getInstalledLibrariesFromManifest(String moduleDirectory, ServerEnvironment env)
static String
getLocation(String moduleName)
static Set
getMergedActivationConfigProperties(EjbMessageBeanDescriptor msgDesc)
Prepares the name/value pairs for ActivationSpec.static String
getModuleName(EjbDescriptor descriptor)
static Collection<String>
getNonJdbcSystemRars()
static boolean
getPingDuringPoolCreation(PoolInfo poolInfo, Resources allResources)
static String
getPMJndiName(String jndiName)
Return the system PM name for the JNDI namestatic ConnectorConnectionPool
getPool(Collection<Resource> configBeanResources, String poolName)
static PoolInfo
getPoolInfo(ResourcePool resource)
static String
getPoolMonitoringSubTreeRoot(PoolInfo poolInfo, boolean escapeSlashes)
static ResourceAdapterConfig
getRAConfig(String raName, Resources allResources)
static String
getRarNameFromApplication(String appName)
static String
getRarNameOfResource(Resource resource, Resources resources)
static String
getReservePrefixedJNDINameForDescriptor(String moduleName)
static String
getReservePrefixedJNDINameForResource(String compId, String resourceName, JavaEEResourceType resType)
static String
getResourceAdapterNameOfPool(String poolName, Resources allResources)
Given the poolname, retrieve the resourceadapter namestatic <T> Resource
getResourceByName(Resources resources, Class<T> type, String name)
static ResourceInfo
getResourceInfo(BindableResource resource)
static Collection<BindableResource>
getResourcesOfPool(Resources resources, String connectionPoolName)
static long
getShutdownTimeout(ConnectorService connectorService)
Gets the shutdown-timeout attribute from domain.xml via the connector server config bean.static String
getSystemModuleLocation(String moduleName)
get the installation directory of System RARsstatic Collection<String>
getSystemRARs()
static String
getTransactionIsolationInt(int tranIsolation)
static String
getValidSuffix(String name)
check whether the jndi Name has connector related suffix and return if any.static List<WorkSecurityMap>
getWorkSecurityMaps(String raName, Resources allResources)
given the ra-name, returns all the configured connector-work-security-maps for the .rarstatic boolean
isApplicationScopedResource(GenericResourceInfo resourceInfo)
static boolean
isDynamicReconfigurationEnabled(ResourcePool pool)
static boolean
isEmbedded(DeploymentContext context)
static ResourceConstants.TriState
isEmbeddedRarResource(Resource configBeanResource, Collection<Resource> configBeanResources)
static boolean
isJMSRA(String moduleName)
static boolean
isModuleScopedResource(GenericResourceInfo resourceInfo)
static boolean
isRARResource(Resource resource)
static boolean
isStandAloneRA(String moduleName)
static boolean
isValidJndiSuffix(String suffix)
If the suffix is one of the valid context return true.static boolean
parseBoolean(String enabled)
static boolean
systemRarExists(String location)
-
-
-
Method Detail
-
belongsToSystemRA
public static boolean belongsToSystemRA(String raName)
determine whether the RAR in question is a System RAR- Parameters:
raName
- RarName- Returns:
- boolean
-
getPingDuringPoolCreation
public static boolean getPingDuringPoolCreation(PoolInfo poolInfo, Resources allResources)
-
belongsToJdbcRA
public static boolean belongsToJdbcRA(String raName)
determine whether the RAR in question is a System RAR- Parameters:
raName
- RarName- Returns:
- boolean
-
getSystemModuleLocation
public static String getSystemModuleLocation(String moduleName)
get the installation directory of System RARs- Parameters:
moduleName
- RARName- Returns:
- directory location
-
getLocation
public static String getLocation(String moduleName) throws ConnectorRuntimeException
- Throws:
ConnectorRuntimeException
-
getPMJndiName
public static String getPMJndiName(String jndiName)
Return the system PM name for the JNDI name- Parameters:
jndiName
- jndi name- Returns:
- String jndi name for PM resource
-
getValidSuffix
public static String getValidSuffix(String name)
check whether the jndi Name has connector related suffix and return if any.- Parameters:
name
- jndi name- Returns:
- suffix, if found
-
isValidJndiSuffix
public static boolean isValidJndiSuffix(String suffix)
If the suffix is one of the valid context return true. Return false, if that is not the case.- Parameters:
suffix
- __nontx / __pm- Returns:
- boolean whether the suffix is valid or not
-
deriveJndiName
public static String deriveJndiName(String name, Hashtable env)
Given the name of the resource and its jndi env, derive the complete jndi name. (eg; with __PM / __nontx)- Parameters:
name
- name of the resourceenv
- env- Returns:
- derived name
-
getConnectionPoolConfig
public static ResourcePool getConnectionPoolConfig(PoolInfo poolInfo, Resources allResources)
-
getAllResources
public static Collection<Resource> getAllResources(Collection<String> poolNames, Resources allResources)
-
getAllPoolNames
public static Collection<String> getAllPoolNames(Collection<ConnectorConnectionPool> connectionPools)
get the list of pool names- Parameters:
connectionPools
- list of pools- Returns:
- list of pol names
-
getAllWorkSecurityMaps
public static Collection<WorkSecurityMap> getAllWorkSecurityMaps(Resources resources, String moduleName)
-
getAllPoolsOfModule
public static Collection<ConnectorConnectionPool> getAllPoolsOfModule(String moduleName, Resources allResources)
get the pools for a particular resource-adapter- Parameters:
moduleName
- resource-adapter name- Returns:
- collection of connectorConnectionPool
-
getAllSystemRAResourcesAndPools
public static Collection<Resource> getAllSystemRAResourcesAndPools(Resources allResources)
Get all System RAR pools and resources- Parameters:
allResources
- all configured resources- Returns:
- Collection of system RAR pools
-
getResourceAdapterNameOfPool
public static String getResourceAdapterNameOfPool(String poolName, Resources allResources)
Given the poolname, retrieve the resourceadapter name- Parameters:
poolName
- connection pool nameallResources
- resources- Returns:
- resource-adapter name
-
getRAConfig
public static ResourceAdapterConfig getRAConfig(String raName, Resources allResources)
-
getWorkSecurityMaps
public static List<WorkSecurityMap> getWorkSecurityMaps(String raName, Resources allResources)
given the ra-name, returns all the configured connector-work-security-maps for the .rar- Parameters:
raName
- resource-adapter nameallResources
- resources- Returns:
- list of work-security-maps
-
isDynamicReconfigurationEnabled
public static boolean isDynamicReconfigurationEnabled(ResourcePool pool)
-
getMergedActivationConfigProperties
public static Set getMergedActivationConfigProperties(EjbMessageBeanDescriptor msgDesc)
Prepares the name/value pairs for ActivationSpec.Rule:
1. The name/value pairs are the union of activation-config on standard DD (message-driven) and runtime DD (mdb-resource-adapter) 2. If there are duplicate property settings, the value in runtime activation-config will overwrite the one in the standard activation-config.
-
isJMSRA
public static boolean isJMSRA(String moduleName)
-
parseBoolean
public static boolean parseBoolean(String enabled)
-
getShutdownTimeout
public static long getShutdownTimeout(ConnectorService connectorService)
Gets the shutdown-timeout attribute from domain.xml via the connector server config bean.- Parameters:
connectorService
- connector-service configuration- Returns:
- long shutdown timeout (in mill-seconds)
-
getBuiltInCustomResources
public static Map<String,String> getBuiltInCustomResources()
Provides the list of built in custom resources by resource-type and factory-class-name pair.- Returns:
- map of resource-type & factory-class-name
-
getTransactionIsolationInt
public static String getTransactionIsolationInt(int tranIsolation)
-
deriveResourceName
public static String deriveResourceName(String compId, String name, JavaEEResourceType resType)
-
getReservePrefixedJNDINameForResource
public static String getReservePrefixedJNDINameForResource(String compId, String resourceName, JavaEEResourceType resType)
-
convertPropertiesToMap
public static Map<String,String> convertPropertiesToMap(Properties properties)
-
getEmbeddedRarModuleName
public static String getEmbeddedRarModuleName(String applicationName, String moduleName)
-
getApplicationNameOfEmbeddedRar
public static String getApplicationNameOfEmbeddedRar(String embeddedRarName)
-
isEmbedded
public static boolean isEmbedded(DeploymentContext context)
-
getApplicationName
public static String getApplicationName(DeploymentContext context)
-
getInstalledLibrariesFromManifest
public static List<URI> getInstalledLibrariesFromManifest(String moduleDirectory, ServerEnvironment env) throws ConnectorRuntimeException
- Throws:
ConnectorRuntimeException
-
getReservePrefixedJNDINameForDescriptor
public static String getReservePrefixedJNDINameForDescriptor(String moduleName)
-
isStandAloneRA
public static boolean isStandAloneRA(String moduleName)
-
getSystemRARs
public static Collection<String> getSystemRARs()
-
getNonJdbcSystemRars
public static Collection<String> getNonJdbcSystemRars()
-
systemRarExists
public static boolean systemRarExists(String location)
-
extractRar
public static boolean extractRar(String fileName, String rarName, String destDir)
GlassFish (Embedded) Uber jar will have .rar bundled in it. This method will extract the .rar from the uber jar into specified directory. As of now, this method is only used in EMBEDDED mode- Parameters:
fileName
- rar-directory-namerarName
- resource-adapter namedestDir
- destination directory- Returns:
- status indicating whether .rar is exploded successfully or not
-
getPoolInfo
public static PoolInfo getPoolInfo(ResourcePool resource)
-
getResourceInfo
public static ResourceInfo getResourceInfo(BindableResource resource)
-
isApplicationScopedResource
public static boolean isApplicationScopedResource(GenericResourceInfo resourceInfo)
-
isModuleScopedResource
public static boolean isModuleScopedResource(GenericResourceInfo resourceInfo)
-
getPoolMonitoringSubTreeRoot
public static String getPoolMonitoringSubTreeRoot(PoolInfo poolInfo, boolean escapeSlashes)
-
getModuleName
public static String getModuleName(EjbDescriptor descriptor)
-
getResourcesOfPool
public static Collection<BindableResource> getResourcesOfPool(Resources resources, String connectionPoolName)
-
getResourceByName
public static <T> Resource getResourceByName(Resources resources, Class<T> type, String name)
-
isEmbeddedRarResource
public static ResourceConstants.TriState isEmbeddedRarResource(Resource configBeanResource, Collection<Resource> configBeanResources)
-
getPool
public static ConnectorConnectionPool getPool(Collection<Resource> configBeanResources, String poolName)
-
isRARResource
public static boolean isRARResource(Resource resource)
-
-