Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.sdo.helper
Class SDOHelperContext

java.lang.Object
  extended by org.eclipse.persistence.sdo.helper.SDOHelperContext

Direct Known Subclasses:
JAXBHelperContext

public class SDOHelperContext
extends java.lang.Object

Purpose:

Responsibilities:

Since:
Oracle TopLink 11.1.1.0.0

Nested Class Summary
private static class SDOHelperContext.ApplicationAccessWLS
           
static class SDOHelperContext.MyNotificationFilter
          INTERNAL: This class will be handed in as a parameter when adding a JBoss notification listener.
private static class SDOHelperContext.MyNotificationListener
          INTERNAL: Inner class used to catch application re-deployment.

 

Field Summary
private static java.util.concurrent.ConcurrentHashMap<java.lang.Object,java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.String>> aliasMap
           
private static SDOHelperContext.ApplicationAccessWLS applicationAccessWLS
           
private static java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.ClassLoader> appNameToClassLoaderMap
           
private static ApplicationResolver appResolver
           
protected  CopyHelper copyHelper
           
private static int COUNTER_LIMIT
           
protected  DataFactory dataFactory
           
protected  DataHelper dataHelper
           
protected  EqualityHelper equalityHelper
           
private static java.lang.String GLOBAL_HELPER_IDENTIFIER
           
private static java.util.concurrent.ConcurrentHashMap<java.lang.Object,java.util.concurrent.ConcurrentHashMap<java.lang.String,HelperContext>> helperContexts
           
private  java.lang.String identifier
           
private static boolean isAppResolverSet
           
private static java.lang.String JBOSS_CLASSLOADER_NAME
           
private static java.lang.String JBOSS_DEFAULT_DOMAIN_NAME
           
private static java.lang.String JBOSS_EAR
           
private static int JBOSS_EAR_OFFSET
           
private static java.lang.String JBOSS_ID_KEY
           
private static int JBOSS_IDENTIFIER
           
private static java.lang.String JBOSS_JAR
           
private static java.lang.String JBOSS_SERVICE_CONTROLLER
           
private static int JBOSS_TRIM_COUNT
           
private static java.lang.String JBOSS_TYPE_STOP
           
private static java.lang.String JBOSS_VFSFILE
           
private static int JBOSS_VFSFILE_OFFSET
           
private static java.lang.String JBOSS_VFSZIP
           
private static int JBOSS_VFSZIP_OFFSET
           
private static java.lang.String JBOSS_WAR
           
private static javax.management.MBeanServer jbossMBeanServer
           
private static java.lang.String OC4J_CLASSLOADER_NAME
           
private  java.util.Map<java.lang.String,java.lang.Object> properties
           
protected  TypeHelper typeHelper
           
private static java.util.WeakHashMap<java.lang.ClassLoader,java.util.WeakHashMap<java.lang.String,java.lang.ref.WeakReference<HelperContext>>> userSetHelperContexts
           
private static java.lang.String WAS_APP_COLON
           
private static java.lang.String WAS_CLASSLOADER_NAME
           
private static java.lang.String WAS_CLOSE_BRACKET
           
private static java.lang.String WAS_NEWLINE
           
private static java.lang.String WLS_ACTIVE_VERSION_STATE
           
private static java.lang.String WLS_APP_RUNTIMES
           
private static java.lang.String WLS_APPLICATION_NAME
           
private static java.lang.String WLS_APPLICATION_NAME_GET_METHOD_NAME
           
private static java.lang.String WLS_CLASSLOADER_NAME
           
private static java.lang.String WLS_CONTEXT_LOOKUP
           
private static java.lang.String WLS_ENV_CONTEXT_LOOKUP
           
private static java.lang.String WLS_EXECUTE_THREAD
           
private static java.lang.String WLS_EXECUTE_THREAD_GET_METHOD_NAME
           
private static int WLS_IDENTIFIER
           
private static java.lang.String WLS_MBEAN_SERVER
           
private static java.lang.Class[] WLS_PARAMETER_TYPES
           
private static java.lang.String WLS_RUNTIME_SERVICE
           
private static java.lang.String WLS_SERVER_RUNTIME
           
private static java.lang.String WLS_SERVICE_KEY
           
private static java.lang.String WLS_THREADPOOL_RUNTIME
           
private static javax.management.MBeanServer wlsMBeanServer
           
private static javax.management.ObjectName wlsThreadPoolRuntime
           
protected  XMLHelper xmlHelper
           
protected  XSDHelper xsdHelper
           

 

Constructor Summary
SDOHelperContext()
          Create a local HelperContext.
SDOHelperContext(java.lang.ClassLoader aClassLoader)
          Create a local HelperContext.
SDOHelperContext(java.lang.String identifier)
          Create a local HelperContext with the given identifier.
SDOHelperContext(java.lang.String identifier, java.lang.ClassLoader aClassLoader)
          Create a local HelperContext with the given identifier.

 

Method Summary
static void addAlias(java.lang.String identifier, java.lang.String alias)
          Add an alias to identifier pair to the alias Map for the current application.
private static void addJBossNotificationListener()
          INTERNAL: The listener will handle application re-deployment.
private static void addWLSNotificationListener(java.lang.String applicationName)
          INTERNAL: Adds a notification listener to the ApplicationRuntimeMBean instance with "ApplicationName" attribute equals to 'mapKey.applicationName'.
 ExternalizableDelegator.Resolvable createResolvable()
          Create and return a new ExternalizableDelegator.Resolvable instance based on this helper context.
 ExternalizableDelegator.Resolvable createResolvable(java.lang.Object target)
          Create and return a new ExternalizableDelegator.Resolvable instance based on this helper context and a given target.
private static java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> getAliasMap()
          INTERNAL: Returns the map of alias' to identifiers for the current application.
private static java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> getAliasMap(java.lang.Object mapKey)
          INTERNAL: Returns the map of alias' to identifiers for the current application.
private static java.lang.String getApplicationNameFromJBossClassLoader(java.lang.String loaderToString)
          Attempt to get the application name (archive file name) based on a given JBoss classloader.
private static java.lang.String getApplicationNameFromWASClassLoader(java.lang.ClassLoader loader)
          Attempt to return the WAS application name based on a given class loader.
(package private) static java.util.concurrent.ConcurrentMap<java.lang.String,HelperContext> getContextMap()
          Returns the map of helper contexts, keyed on Identifier, for the current application
private static MapKeyLookupResult getContextMapKey(java.lang.ClassLoader classLoader, java.lang.String classLoaderName)
          INTERNAL: This method will return the MapKeyLookupResult instance to be used to store/retrieve the global helper context for a given application.
private static MapKeyLookupResult getContextMapKeyForJBoss(java.lang.ClassLoader loader)
          Attempt to return a MapKeyLookupResult instance wrapping the archive file name and application loader based on a given JBoss classloader.
private static MapKeyLookupResult getContextMapKeyForWAS(java.lang.ClassLoader loader)
          Attempt to return a MapKeyLookupResult instance wrapping the application name and application loader based on a given WAS classloader.
 CopyHelper getCopyHelper()
          Return the CopyHelper instance for this helper context.
 DataFactory getDataFactory()
          Return the DataFactory instance for this helper context.
 DataHelper getDataHelper()
          Return the DataHelper instance for this helper context.
 EqualityHelper getEqualityHelper()
          Return the EqualityHelper instance for this helper context.
private static java.lang.Object getExecuteThread()
          INTERNAL: This convenience method will look up a WebLogic execute thread from the runtime MBean tree.
static HelperContext getHelperContext()
          INTERNAL: Return the helper context for a given key.
static HelperContext getHelperContext(java.lang.String identifier)
          Return the local helper context associated with the given identifier, or create one if it does not already exist.
static HelperContext getHelperContext(java.lang.String identifier, java.lang.ClassLoader classLoader)
          Return the local helper context with the given identifier, or create one if it does not already exist.
 java.lang.String getIdentifier()
          Return the unique label for this HelperContext.
private static java.lang.Object getMapKey()
          INTERNAL: Return the key to be used for Map lookups based in the current thread's context loader.
private  java.util.Map<java.lang.String,java.lang.Object> getProperties()
          Lazily initialize the Map of user properties.
 java.lang.Object getProperty(java.lang.String name)
          Return the value stored in the properties Map for a given name, or null if an entry for name does not exist.
 TypeHelper getTypeHelper()
          Return the TypeHelper instance for this helper context.
private static HelperContext getUserSetHelperContext(java.lang.String identifier, java.lang.ClassLoader key)
          INTERNAL: Retrieve the HelperContext for a given ClassLoader from the Thread HelperContext map.
private static javax.management.MBeanServer getWLSMBeanServer()
          Lazy load the WebLogic MBeanServer instance.
 XMLHelper getXMLHelper()
          Return the XMLHelper instance for this helper context.
 XSDHelper getXSDHelper()
          Return the XSDHelper instance for this helper context.
static boolean hasHelperContext(java.lang.String identifier)
          Return true if a HelperContext corresponding to this identifier or alias already exists, else false.
protected  void initialize(java.lang.ClassLoader aClassLoader)
          The underlying helpers for this instance will be instantiated in this method.
static boolean isApplicationResolverSet()
          Indicates if a call to setApplicationResolver has been made.
private static boolean jBossClassLoaderHasArchiveFileInfo(java.lang.ClassLoader loader)
          Indicates if a given JBoss class loader contains an archive file name; i.e. is an application loader.
 void makeDefaultContext()
          ADVANCED Promote this helper context to be the default or global one.
static void putHelperContext(java.lang.ClassLoader key, HelperContext value)
          INTERNAL: Put a ClassLoader/HelperContext key/value pair in the Thread HelperContext map.
static void putHelperContext(HelperContext ctx)
          Replaces the provided helper context in the map of identifiers to helper contexts for this application. ctx.getIdentifier() will be used to obtain the identifier value.
static void removeHelperContext(java.lang.ClassLoader key)
          INTERNAL: Remove a ClassLoader/HelperContext key/value pair from the Thread HelperContext map.
static void removeHelperContext(java.lang.String identifier, java.lang.ClassLoader key)
          INTERNAL
 void reset()
          Reset the Type,XML and XSD helper instances.
private static void resetHelperContext(java.lang.String key)
          ADVANCED: Remove the HelperContext for the application associated with a given key, if it exists in the map.
static void setApplicationResolver(ApplicationResolver aResolver)
          ADVANCED: Used to set an ApplicationResolver instance that will be used to retrieve info pertaining to a given application, such as the application name, in the case where our logic fails.
 void setProperty(java.lang.String name, java.lang.Object value)
          Add a name/value pair to the properties Map.
private static boolean wasClassLoaderHasApplicationName(java.lang.ClassLoader loader)
          Indicates if a given WAS class loader contains a application name.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

copyHelper

protected CopyHelper copyHelper

dataFactory

protected DataFactory dataFactory

dataHelper

protected DataHelper dataHelper

equalityHelper

protected EqualityHelper equalityHelper

xmlHelper

protected XMLHelper xmlHelper

typeHelper

protected TypeHelper typeHelper

xsdHelper

protected XSDHelper xsdHelper

identifier

private java.lang.String identifier

properties

private java.util.Map<java.lang.String,java.lang.Object> properties

helperContexts

private static java.util.concurrent.ConcurrentHashMap<java.lang.Object,java.util.concurrent.ConcurrentHashMap<java.lang.String,HelperContext>> helperContexts

aliasMap

private static java.util.concurrent.ConcurrentHashMap<java.lang.Object,java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.String>> aliasMap

userSetHelperContexts

private static java.util.WeakHashMap<java.lang.ClassLoader,java.util.WeakHashMap<java.lang.String,java.lang.ref.WeakReference<HelperContext>>> userSetHelperContexts

appNameToClassLoaderMap

private static java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.ClassLoader> appNameToClassLoaderMap

OC4J_CLASSLOADER_NAME

private static java.lang.String OC4J_CLASSLOADER_NAME

WLS_CLASSLOADER_NAME

private static java.lang.String WLS_CLASSLOADER_NAME

WAS_CLASSLOADER_NAME

private static java.lang.String WAS_CLASSLOADER_NAME

JBOSS_CLASSLOADER_NAME

private static java.lang.String JBOSS_CLASSLOADER_NAME

GLOBAL_HELPER_IDENTIFIER

private static java.lang.String GLOBAL_HELPER_IDENTIFIER

WLS_IDENTIFIER

private static final int WLS_IDENTIFIER
See Also:
Constant Field Values

JBOSS_IDENTIFIER

private static final int JBOSS_IDENTIFIER
See Also:
Constant Field Values

COUNTER_LIMIT

private static final int COUNTER_LIMIT
See Also:
Constant Field Values

applicationAccessWLS

private static SDOHelperContext.ApplicationAccessWLS applicationAccessWLS

wlsMBeanServer

private static javax.management.MBeanServer wlsMBeanServer

wlsThreadPoolRuntime

private static javax.management.ObjectName wlsThreadPoolRuntime

WLS_ENV_CONTEXT_LOOKUP

private static final java.lang.String WLS_ENV_CONTEXT_LOOKUP
See Also:
Constant Field Values

WLS_CONTEXT_LOOKUP

private static final java.lang.String WLS_CONTEXT_LOOKUP
See Also:
Constant Field Values

WLS_RUNTIME_SERVICE

private static final java.lang.String WLS_RUNTIME_SERVICE
See Also:
Constant Field Values

WLS_SERVICE_KEY

private static final java.lang.String WLS_SERVICE_KEY
See Also:
Constant Field Values

WLS_APP_RUNTIMES

private static final java.lang.String WLS_APP_RUNTIMES
See Also:
Constant Field Values

WLS_SERVER_RUNTIME

private static final java.lang.String WLS_SERVER_RUNTIME
See Also:
Constant Field Values

WLS_THREADPOOL_RUNTIME

private static final java.lang.String WLS_THREADPOOL_RUNTIME
See Also:
Constant Field Values

WLS_EXECUTE_THREAD

private static final java.lang.String WLS_EXECUTE_THREAD
See Also:
Constant Field Values

WLS_MBEAN_SERVER

private static final java.lang.String WLS_MBEAN_SERVER
See Also:
Constant Field Values

WLS_EXECUTE_THREAD_GET_METHOD_NAME

private static final java.lang.String WLS_EXECUTE_THREAD_GET_METHOD_NAME
See Also:
Constant Field Values

WLS_APPLICATION_NAME

private static final java.lang.String WLS_APPLICATION_NAME
See Also:
Constant Field Values

WLS_APPLICATION_NAME_GET_METHOD_NAME

private static final java.lang.String WLS_APPLICATION_NAME_GET_METHOD_NAME
See Also:
Constant Field Values

WLS_ACTIVE_VERSION_STATE

private static final java.lang.String WLS_ACTIVE_VERSION_STATE
See Also:
Constant Field Values

WLS_PARAMETER_TYPES

private static final java.lang.Class[] WLS_PARAMETER_TYPES

WAS_NEWLINE

private static final java.lang.String WAS_NEWLINE
See Also:
Constant Field Values

WAS_APP_COLON

private static final java.lang.String WAS_APP_COLON
See Also:
Constant Field Values

WAS_CLOSE_BRACKET

private static final java.lang.String WAS_CLOSE_BRACKET
See Also:
Constant Field Values

jbossMBeanServer

private static javax.management.MBeanServer jbossMBeanServer

JBOSS_SERVICE_CONTROLLER

private static java.lang.String JBOSS_SERVICE_CONTROLLER

JBOSS_TYPE_STOP

private static java.lang.String JBOSS_TYPE_STOP

JBOSS_ID_KEY

private static java.lang.String JBOSS_ID_KEY

JBOSS_DEFAULT_DOMAIN_NAME

private static final java.lang.String JBOSS_DEFAULT_DOMAIN_NAME
See Also:
Constant Field Values

JBOSS_VFSZIP

private static final java.lang.String JBOSS_VFSZIP
See Also:
Constant Field Values

JBOSS_VFSFILE

private static final java.lang.String JBOSS_VFSFILE
See Also:
Constant Field Values

JBOSS_EAR

private static final java.lang.String JBOSS_EAR
See Also:
Constant Field Values

JBOSS_JAR

private static final java.lang.String JBOSS_JAR
See Also:
Constant Field Values

JBOSS_WAR

private static final java.lang.String JBOSS_WAR
See Also:
Constant Field Values

JBOSS_VFSZIP_OFFSET

private static final int JBOSS_VFSZIP_OFFSET

JBOSS_VFSFILE_OFFSET

private static final int JBOSS_VFSFILE_OFFSET

JBOSS_EAR_OFFSET

private static final int JBOSS_EAR_OFFSET

JBOSS_TRIM_COUNT

private static final int JBOSS_TRIM_COUNT
See Also:
Constant Field Values

appResolver

private static ApplicationResolver appResolver

isAppResolverSet

private static boolean isAppResolverSet

Constructor Detail

SDOHelperContext

public SDOHelperContext()
Create a local HelperContext. The current thread's context ClassLoader will be used to find static instance classes. In OSGi environments the construct that takes a ClassLoader parameter should be used instead.

SDOHelperContext

public SDOHelperContext(java.lang.String identifier)
Create a local HelperContext with the given identifier. The current thread's context ClassLoader will be used to find static instance classes. In OSGi environments the construct that takes a ClassLoader parameter should be used instead.
Parameters:
identifier - The unique label for this HelperContext.

SDOHelperContext

public SDOHelperContext(java.lang.ClassLoader aClassLoader)
Create a local HelperContext. This constructor should be used in OSGi environments.
Parameters:
aClassLoader - This class loader will be used to find static instance classes.

SDOHelperContext

public SDOHelperContext(java.lang.String identifier,
                        java.lang.ClassLoader aClassLoader)
Create a local HelperContext with the given identifier. This constructor should be used in OSGi environments.
Parameters:
identifier - The unique label for this HelperContext.
aClassLoader - This class loader will be used to find static instance classes.

Method Detail

setApplicationResolver

public static void setApplicationResolver(ApplicationResolver aResolver)
ADVANCED: Used to set an ApplicationResolver instance that will be used to retrieve info pertaining to a given application, such as the application name, in the case where our logic fails. This method can be called once and only once per active server instance.
Parameters:
aResolver - the ApplicationResolver instance that will be used to retrieve info pertaining to a given application. Note that null is considered a valid set operation.
Throws:
SDOException - if more than one call is made to this method in an active server instance.

isApplicationResolverSet

public static boolean isApplicationResolverSet()
Indicates if a call to setApplicationResolver has been made.
Returns:
true if a prior call to setApplicationResolver has been made, false otherwise

initialize

protected void initialize(java.lang.ClassLoader aClassLoader)
The underlying helpers for this instance will be instantiated in this method.
Parameters:
aClassLoader -

reset

public void reset()
Reset the Type,XML and XSD helper instances.

getCopyHelper

public CopyHelper getCopyHelper()
Return the CopyHelper instance for this helper context.

getDataFactory

public DataFactory getDataFactory()
Return the DataFactory instance for this helper context.

getDataHelper

public DataHelper getDataHelper()
Return the DataHelper instance for this helper context.

getEqualityHelper

public EqualityHelper getEqualityHelper()
Return the EqualityHelper instance for this helper context.

getTypeHelper

public TypeHelper getTypeHelper()
Return the TypeHelper instance for this helper context.

getXMLHelper

public XMLHelper getXMLHelper()
Return the XMLHelper instance for this helper context.

getXSDHelper

public XSDHelper getXSDHelper()
Return the XSDHelper instance for this helper context.

createResolvable

public ExternalizableDelegator.Resolvable createResolvable()
Create and return a new ExternalizableDelegator.Resolvable instance based on this helper context.
Returns:

createResolvable

public ExternalizableDelegator.Resolvable createResolvable(java.lang.Object target)
Create and return a new ExternalizableDelegator.Resolvable instance based on this helper context and a given target.
Parameters:
target -
Returns:

putHelperContext

public static void putHelperContext(java.lang.ClassLoader key,
                                    HelperContext value)
INTERNAL: Put a ClassLoader/HelperContext key/value pair in the Thread HelperContext map. If Thread.currentThread().getContextClassLoader() == key during getHelperContext() call then the HelperContext (value) will be returned. This method will overwrite an existing entry in the map with the same ClassLoader key.
Parameters:
key - class loader
value - helper context

getUserSetHelperContext

private static HelperContext getUserSetHelperContext(java.lang.String identifier,
                                                     java.lang.ClassLoader key)
INTERNAL: Retrieve the HelperContext for a given ClassLoader from the Thread HelperContext map.
Parameters:
key - class loader
Returns:
HelperContext for the given key if key exists in the map, otherwise null

removeHelperContext

public static void removeHelperContext(java.lang.ClassLoader key)
INTERNAL: Remove a ClassLoader/HelperContext key/value pair from the Thread HelperContext map. If there are multiple local helper contexts associated with this ClassLoader, they will all be removed from the map.
Parameters:
key - class loader

removeHelperContext

public static void removeHelperContext(java.lang.String identifier,
                                       java.lang.ClassLoader key)
INTERNAL
Parameters:
identifier - the specific identifier of the HelperContext to be removed. "" for a Global helper
key - the ClassLoader associated with the HelperContext to be removed

getHelperContext

public static HelperContext getHelperContext()
INTERNAL: Return the helper context for a given key. The key will either be a ClassLoader or a String (representing an application name). A new context will be created and put in the map if none exists for the given key. The key is assumed to be non-null - getDelegateKey should always return either a string representing the application name (for WLS, WAS and JBoss if available) or a class loader. This is relevant since 'putIfAbsent' will throw a null pointer exception if the key is null.

getHelperContext

public static HelperContext getHelperContext(java.lang.String identifier)
Return the local helper context associated with the given identifier, or create one if it does not already exist. If identifier is an alias, the value associated with it in the alias Map will be used as the identifier value.
Parameters:
identifier - the identifier or alias to use for lookup/creation
Returns:
HelperContext associated with identifier, or a new HelperContext keyed on identifier if none eixsts

getHelperContext

public static HelperContext getHelperContext(java.lang.String identifier,
                                             java.lang.ClassLoader classLoader)
Return the local helper context with the given identifier, or create one if it does not already exist.

getContextMap

static java.util.concurrent.ConcurrentMap<java.lang.String,HelperContext> getContextMap()
Returns the map of helper contexts, keyed on Identifier, for the current application
Returns:

putHelperContext

public static void putHelperContext(HelperContext ctx)
Replaces the provided helper context in the map of identifiers to helper contexts for this application. ctx.getIdentifier() will be used to obtain the identifier value. If identifier is a key in the the alias Map, i.e. was previously set as alias, the corresponding entry will be removed from the alias Map.
Parameters:
ctx - the HelperContext to be added to the context Map for the current application

resetHelperContext

private static void resetHelperContext(java.lang.String key)
ADVANCED: Remove the HelperContext for the application associated with a given key, if it exists in the map.

getMapKey

private static java.lang.Object getMapKey()
INTERNAL: Return the key to be used for Map lookups based in the current thread's context loader. The returned value will be the application name (if available) or the context loader.

getContextMapKey

private static MapKeyLookupResult getContextMapKey(java.lang.ClassLoader classLoader,
                                                   java.lang.String classLoaderName)
INTERNAL: This method will return the MapKeyLookupResult instance to be used to store/retrieve the global helper context for a given application. OC4J classLoader levels: 0 - APP.web (servlet/jsp) or APP.wrapper (ejb) 1 - APP.root (parent for helperContext) 2 - default.root 3 - system.root 4 - oc4j.10.1.3 (remote EJB) or org.eclipse.persistence:11.1.1.0.0 5 - api:1.4.0 6 - jre.extension:0.0.0 7 - jre.bootstrap:1.5.0_07 (with various J2SE versions)
Returns:
MapKeyLookupResult wrapping the application classloader for OC4J, the application name for WebLogic and WebSphere, the archive file name for JBoss - if available; otherwise a MapKeyLookupResult wrapping Thread.currentThread().getContextClassLoader()

getWLSMBeanServer

private static javax.management.MBeanServer getWLSMBeanServer()
Lazy load the WebLogic MBeanServer instance.
Returns:

getExecuteThread

private static java.lang.Object getExecuteThread()
INTERNAL: This convenience method will look up a WebLogic execute thread from the runtime MBean tree. The execute thread contains application information. This code will use the name of the current thread to lookup the corresponding ExecuteThread. The ExecuteThread will allow us to obtain the application name (and version, etc).
Returns:
application name or null if the name cannot be obtained

addWLSNotificationListener

private static void addWLSNotificationListener(java.lang.String applicationName)
INTERNAL: Adds a notification listener to the ApplicationRuntimeMBean instance with "ApplicationName" attribute equals to 'mapKey.applicationName'. The listener will handle application re-deployment. If any errors occur, we will fail silently, i.e. the listener will not be added. This method should only be called when running in an active WLS instance.
Parameters:
applicationName -

addJBossNotificationListener

private static void addJBossNotificationListener()
INTERNAL: The listener will handle application re-deployment. If any errors occur, we will fail silently, i.e. the listener will not be added. Since we cannot register for notifications for a particular application, and hence recieve notifications for all apps that are redeployed, we only add the listener once - each time we receive notification we will check the map and remove the corresponding entry if it exists. This method should only be called when running in an active JBoss instance.

makeDefaultContext

public void makeDefaultContext()
ADVANCED Promote this helper context to be the default or global one. This will completely replace the existing default context including all types and properties defined.

getApplicationNameFromWASClassLoader

private static java.lang.String getApplicationNameFromWASClassLoader(java.lang.ClassLoader loader)
Attempt to return the WAS application name based on a given class loader. For WAS, the application loader's toString will contain "[app:".
Parameters:
loader -
Returns:
String representing the application name, or null if the loader's toString doesn't contain "[app:".

getContextMapKeyForWAS

private static MapKeyLookupResult getContextMapKeyForWAS(java.lang.ClassLoader loader)
Attempt to return a MapKeyLookupResult instance wrapping the application name and application loader based on a given WAS classloader. Here we will traverse up the loader hierarchy looking for the top-most application loader. For WAS, the application loader's toString (and those of it's children) will contain "[app:".
Parameters:
loader -
Returns:
a MapKeyLookupResult instance wrapping application name/loader if successfully retrieved (i.e. at least one loader exists in the hierarchy with toString containing "[app:"), or a MapKeyLookupResult instance wrapping the given loader if not found

wasClassLoaderHasApplicationName

private static boolean wasClassLoaderHasApplicationName(java.lang.ClassLoader loader)
Indicates if a given WAS class loader contains a application name. Assumptions: 1 - The toString of a WAS application loader will contain "[app:".
Parameters:
loader -
Returns:
true if the WAS class loader's toString contains "[app:"; false otherwise

getApplicationNameFromJBossClassLoader

private static java.lang.String getApplicationNameFromJBossClassLoader(java.lang.String loaderToString)
Attempt to get the application name (archive file name) based on a given JBoss classloader. Here is an example toString result of the classloader which loaded the application in JBoss: BaseClassLoader@1316dd{vfszip:/ade/xidu_j2eev5/oracle/work/utp/resultout/functional/jrf/ jboss-jrfServer/deploy/jrftestapp.jar/} or {vfsfile:/net/stott18.ca.oracle.com/scratch/xidu/view_storage/xidu_j2eev5/work/jboss/ server/default/deploy/testapp.ear/} in exploded deployment war: BaseClassLoader@bfe0e4{vfszip:/ade/xidu_j2eebug/oracle/work/utp/resultout/functional/ jrf/jboss-jrfServer/jrfServer/deploy/jrftestapp.ear/jrftestweb.war/} Assumptions: 1 - A given toString may contain both .ear and .jar, or .ear and .war, i.e. "{vfszip:/.../xxx.ear/.../xxx.war/}". In this case we want to return xxx.ear as the application name. 2 - A given toString will end in '/}'. 3 - A toString containing the application name will have one of "vfszip:" or "vfsfile:".
Parameters:
loaderToString - the toString of the loader being processed
Returns:
application name (archive file name) if successfully retrieved (i.e. loader exists in the hierarchy with toString containing "vfszip:" or "vfsfile:") or null

getContextMapKeyForJBoss

private static MapKeyLookupResult getContextMapKeyForJBoss(java.lang.ClassLoader loader)
Attempt to return a MapKeyLookupResult instance wrapping the archive file name and application loader based on a given JBoss classloader. Here we will traverse up the loader hierarchy looking for the top-most application loader.
Parameters:
loader -
Returns:
a MapKeyLookupResult instance wrapping archive file name/loader if successfully retrieved (i.e. at least one loader exists in the hierarchy with toString containing containing "vfszip:" or "vfsfile:"), or a MapKeyLookupResult instance wrapping the given loader if not found

jBossClassLoaderHasArchiveFileInfo

private static boolean jBossClassLoaderHasArchiveFileInfo(java.lang.ClassLoader loader)
Indicates if a given JBoss class loader contains an archive file name; i.e. is an application loader. Here is an example toString result of the classloader which loaded the application in JBoss: BaseClassLoader@1316dd{vfszip:/ade/xidu_j2eev5/oracle/work/utp/resultout/functional/jrf/ jboss-jrfServer/deploy/jrftestapp.jar/} or {vfsfile:/net/stott18.ca.oracle.com/scratch/xidu/view_storage/xidu_j2eev5/work/jboss/ server/default/deploy/testapp.ear/} in exploded deployment war: BaseClassLoader@bfe0e4{vfszip:/ade/xidu_j2eebug/oracle/work/utp/resultout/functional/ jrf/jboss-jrfServer/jrfServer/deploy/jrftestapp.ear/jrftestweb.war/} Assumptions: 1 - The toString of an application loader will have one of "vfszip:" or "vfsfile:".
Parameters:
loader -
Returns:
true if the given JBoss loader has a toString containing "vfszip:" or "vfsfile:"); false otherwise

getIdentifier

public java.lang.String getIdentifier()
Return the unique label for this HelperContext.
Returns:
String representing the unique label for this HelperContext

hasHelperContext

public static boolean hasHelperContext(java.lang.String identifier)
Return true if a HelperContext corresponding to this identifier or alias already exists, else false. If identifer is an alias, the corresponding value in the alias Map will be used as the identifier for the lookup.
Parameters:
identifier - the alias or identifier used to lookup a helper context
Returns:
true if an entry exists in the helper context map for identifier (or the associated identifier value if identifier is an alias), false otherwise.

addAlias

public static void addAlias(java.lang.String identifier,
                            java.lang.String alias)
Add an alias to identifier pair to the alias Map for the current application.
Parameters:
identifier - assumed to be a key in the helper context Map
alias - the alias to be associated with identifier

getAliasMap

private static java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> getAliasMap()
INTERNAL: Returns the map of alias' to identifiers for the current application.
Returns:
Map of alias' to identifiers for the current application

getAliasMap

private static java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> getAliasMap(java.lang.Object mapKey)
INTERNAL: Returns the map of alias' to identifiers for the current application.
Parameters:
mapKey - application name or classloader used to lookup the alias map
Returns:
Map of alias' to identifiers for the current application

getProperties

private java.util.Map<java.lang.String,java.lang.Object> getProperties()
Lazily initialize the Map of user properties.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Add a name/value pair to the properties Map. If name is null, nothing will be done. If value is null, the entry in the Map will be removed (if an entry exists for name).
Parameters:
name - the name of the property
value - the value of the property

getProperty

public java.lang.Object getProperty(java.lang.String name)
Return the value stored in the properties Map for a given name, or null if an entry for name does not exist.
Parameters:
name - the name of the property to be returned
Returns:
the value associated with name, or null

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.