SAP NetWeaver '04

com.sap.netweaver.bc.rf.util.context
Class ContextFactoryRegistry

[contained in: com.sap.netweaver.bc.rf.par - bc.rf.util_api.jar]
java.lang.Object
  |
  +--com.sap.netweaver.bc.rf.util.context.ContextFactoryRegistry

public class ContextFactoryRegistry
extends java.lang.Object

Context factory registry holding all registered context factories and providing means to get and set a context. In order to access a context through this class, each context factory needs to register with this registry. This must be done prior to any call trying to access a context for that context factory. Beware of the dangers registering a context factory in the static initializer. No one ensures, that the static initializer is called before a context for the context factory is requested by the type unsafe API of this registry.

See Also:
IContextFactory

Constructor Summary
ContextFactoryRegistry()
           
 
Method Summary
static java.lang.Object getTypeUnsafeContext(java.lang.Class contextFactoryClass)
          Get actual context from stack of contexts.
 java.lang.Object getTypeUnsafeContextOrNullIfUnavailable(java.lang.Class contextFactoryClass)
          Get actual context from stack of contexts.
static java.lang.Object popTypeUnsafeContext(java.lang.Class contextFactoryClass)
          Get and remove actual context from the stack of contexts.
static void pushTypeUnsafeContext(java.lang.Class contextFactoryClass, java.lang.Object context)
          Add new context to the top of the stack of contexts.
static void registerContextFactory(IContextFactory contextFactory)
          Register context factory instance.
static void setTypeUnsafeContext(java.lang.Class contextFactoryClass, java.lang.Object context)
          Replace actual context with new one in stack of contexts.
static void unregisterContextFactory(java.lang.Class contextFactoryClass)
          Unregister context factory by context factory class (name).
static void unregisterContextFactory(IContextFactory contextFactory)
          Unregister context factory by context factory instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextFactoryRegistry

public ContextFactoryRegistry()
Method Detail

registerContextFactory

public static void registerContextFactory(IContextFactory contextFactory)
                                   throws ContextFactoryRegistrationError
Register context factory instance.
Parameters:
contextFactory - context factory instance to be registered
Throws:
ContextFactoryRegistrationError - when the context factory is already registered with the context factory registry

unregisterContextFactory

public static void unregisterContextFactory(java.lang.Class contextFactoryClass)
                                     throws ContextFactoryRegistrationError
Unregister context factory by context factory class (name).
Parameters:
contextFactoryClass - context factory class (name) to be unregistered
Throws:
ContextFactoryRegistrationError - when the context factory isn't registered with the context factory registry

unregisterContextFactory

public static void unregisterContextFactory(IContextFactory contextFactory)
                                     throws ContextFactoryRegistrationError
Unregister context factory by context factory instance.
Parameters:
contextFactory - context factory to be unregistered
Throws:
ContextFactoryRegistrationError - when the context factory isn't registered with the context factory registry

getTypeUnsafeContext

public static java.lang.Object getTypeUnsafeContext(java.lang.Class contextFactoryClass)
                                             throws ContextUnavailableException,
                                                    ContextFactoryRegistrationError
Get actual context from stack of contexts.
Parameters:
contextFactoryClass - context factory class used to look up context factory
Returns:
actual context on the context stack
Throws:
ContextUnavailableException - when no (more) context is available on the context stack
ContextFactoryRegistrationError - when the context factory isn't registered with the context factory registry

getTypeUnsafeContextOrNullIfUnavailable

public java.lang.Object getTypeUnsafeContextOrNullIfUnavailable(java.lang.Class contextFactoryClass)
Get actual context from stack of contexts. Return null if none is availble and don't throw a ContextUnavailableException.
Parameters:
contextFactoryClass - TBD: Description of the incoming method parameter
Returns:
actual context on the context stack

setTypeUnsafeContext

public static void setTypeUnsafeContext(java.lang.Class contextFactoryClass,
                                        java.lang.Object context)
                                 throws ContextFactoryRegistrationError
Replace actual context with new one in stack of contexts. If no context is stored, this one will be added.
Parameters:
context - new actual context replacing the old one on the stack
contextFactoryClass - context factory class used to look up context factory
Throws:
ContextFactoryRegistrationError - when the context factory isn't registered with the context factory registry

popTypeUnsafeContext

public static java.lang.Object popTypeUnsafeContext(java.lang.Class contextFactoryClass)
                                             throws ContextUnavailableException,
                                                    ContextFactoryRegistrationError
Get and remove actual context from the stack of contexts.
Parameters:
contextFactoryClass - context factory class used to look up context factory
Returns:
last actual context on the context stack
Throws:
ContextUnavailableException - when no (more) context is available on the context stack
ContextFactoryRegistrationError - when the context factory isn't registered with the context factory registry

pushTypeUnsafeContext

public static void pushTypeUnsafeContext(java.lang.Class contextFactoryClass,
                                         java.lang.Object context)
                                  throws ContextFactoryRegistrationError
Add new context to the top of the stack of contexts.
Parameters:
context - new actual context
contextFactoryClass - context factory class used to look up context factory
Throws:
ContextFactoryRegistrationError - when the context factory isn't registered with the context factory registry

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.