org.iqual.chaplin
Class ContextManager
java.lang.Object
org.iqual.chaplin.ContextManager
public class ContextManager
- extends Object
This class is the main link between the injected code and context handlers. The injected code directly calls
various static methods on this class. For example, this class associates a context with the current thread,
manages multiple contexes and retrieves the current context for a given context id.
- Since:
- Mar 7, 2009 3:21:17 PM
- Author:
- Zbynek Slajchrt
- See Also:
ContextHandler
|
Method Summary |
static void |
addSystemMessageReceiver(MessageReceiver receiver)
|
static Stack |
closeStack(String contextId)
|
static Object |
createBond(Object bondInstance)
|
static void |
enterContext(Object context)
|
static void |
enterContext(Object context,
Class contextIdClass)
|
static void |
enterContext(Object context,
String contextId)
|
static void |
enterContext(String owner,
String method,
String signature,
String contextId,
String contextClassName,
String contextAttribute,
Object instance)
|
static Object |
get(Object instance,
String fieldName,
String fieldType,
String context,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static List<MessageReceiver> |
getAllReceivers(String contextName,
Object instance,
boolean isPrivateMessage)
|
static Object |
getCompositeContextFromInjected(Object component)
|
static Object |
getCompositeContextFromStack()
|
static Object |
getContextForSetting(boolean object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextForSetting(byte object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextForSetting(double object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextForSetting(float object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextForSetting(char object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextForSetting(int object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextForSetting(long object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextForSetting(Object object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextForSetting(short object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
|
static Object |
getContextFromStack(String contextName)
|
static Object |
getContextObject(Object instance,
String context)
|
static Object |
getContextObject(Object instance,
String fieldName,
String fieldType,
String context)
|
static Object |
getContextObjectAsContextHandler(Object instance,
String context)
|
static Stack |
getContextStack(String contextName)
|
static ContextManager.StackFrame |
getFrame()
|
static void |
injectCompositeContext(Object component,
Object compositeContextHandler)
|
static Object |
invoke(Object source,
String methodName,
String methodDesc,
boolean dynaSign,
long minOccurs,
long maxOccurs,
String contextName,
boolean isPrivateMessage,
String fromAnnotContent,
Object... args)
|
static boolean |
isDomainType(Class type)
|
static boolean |
isInContext(Object instance,
String context,
String storageType,
String fieldName)
|
static boolean |
isInStackContext(String contextName)
|
static boolean |
isInStackContext(String contextName,
String implType)
|
static void |
leaveContext(Class contextClass)
|
static void |
leaveContext(String contextId)
|
static void |
leaveContext(Throwable t,
String owner,
String method,
String signature,
String contextId,
Object instance)
|
static void |
outjectCompositeContext(Object component)
|
static void |
recoverStack(String contextId,
Stack stack)
|
static void |
removeSystemMessageReceiver(MessageReceiver receiver)
|
static Object |
runInCompositeContext(Object contextObject,
ContextRunner runner,
Object... arguments)
Attach the contextObject to the current thread and run the runner instance. |
static Object |
runInContext(Object contextObject,
Class contextClass,
ContextRunner runner,
Object... arguments)
|
static Object |
runInContext(Object contextObject,
ContextRunner runner,
Object... arguments)
|
static void |
set(Object instance,
boolean object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static void |
set(Object instance,
byte object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static void |
set(Object instance,
double object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static void |
set(Object instance,
float object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static void |
set(Object instance,
char object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static void |
set(Object instance,
int object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static void |
set(Object instance,
long object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static void |
set(Object instance,
Object object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
static void |
set(Object instance,
short object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContextManager
public ContextManager()
enterContext
public static void enterContext(Object context)
enterContext
public static void enterContext(String owner,
String method,
String signature,
String contextId,
String contextClassName,
String contextAttribute,
Object instance)
throws Exception
- Throws:
Exception
getFrame
public static ContextManager.StackFrame getFrame()
leaveContext
public static void leaveContext(Throwable t,
String owner,
String method,
String signature,
String contextId,
Object instance)
throws Exception
- Throws:
Exception
enterContext
public static void enterContext(Object context,
Class contextIdClass)
enterContext
public static void enterContext(Object context,
String contextId)
leaveContext
public static void leaveContext(Class contextClass)
leaveContext
public static void leaveContext(String contextId)
closeStack
public static Stack closeStack(String contextId)
recoverStack
public static void recoverStack(String contextId,
Stack stack)
getCompositeContextFromStack
public static Object getCompositeContextFromStack()
getContextStack
public static Stack getContextStack(String contextName)
getContextFromStack
public static Object getContextFromStack(String contextName)
isInStackContext
public static boolean isInStackContext(String contextName,
String implType)
isInStackContext
public static boolean isInStackContext(String contextName)
runInCompositeContext
public static Object runInCompositeContext(Object contextObject,
ContextRunner runner,
Object... arguments)
throws Throwable
- Attach the
contextObject to the current thread and run the runner instance. This context
object becomes a temporary component of any composite invoked in the runner.
- Parameters:
contextObject - the object which is attached to the current thread.runner - arguments -
- Returns:
-
- Throws:
Throwable
runInContext
public static Object runInContext(Object contextObject,
ContextRunner runner,
Object... arguments)
throws Throwable
- Throws:
Throwable
runInContext
public static Object runInContext(Object contextObject,
Class contextClass,
ContextRunner runner,
Object... arguments)
throws Throwable
- Throws:
Throwable
getContextObject
public static Object getContextObject(Object instance,
String fieldName,
String fieldType,
String context)
isInContext
public static boolean isInContext(Object instance,
String context,
String storageType,
String fieldName)
getContextObjectAsContextHandler
public static Object getContextObjectAsContextHandler(Object instance,
String context)
getContextObject
public static Object getContextObject(Object instance,
String context)
get
public static Object get(Object instance,
String fieldName,
String fieldType,
String context,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
Object object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
byte object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
short object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
int object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
long object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
float object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
double object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
boolean object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
set
public static void set(Object instance,
char object,
String fieldName,
String fieldType,
String context,
boolean firstAssignment,
boolean isPrivateMessage,
String fromAnnotAsString)
throws Throwable
- Throws:
Throwable
getContextForSetting
public static Object getContextForSetting(Object object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
getContextForSetting
public static Object getContextForSetting(byte object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
getContextForSetting
public static Object getContextForSetting(short object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
getContextForSetting
public static Object getContextForSetting(int object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
getContextForSetting
public static Object getContextForSetting(long object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
getContextForSetting
public static Object getContextForSetting(float object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
getContextForSetting
public static Object getContextForSetting(double object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
getContextForSetting
public static Object getContextForSetting(boolean object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
getContextForSetting
public static Object getContextForSetting(char object,
Object instance,
String fieldName,
String fieldType,
String context,
boolean firstAssignment)
isDomainType
public static boolean isDomainType(Class type)
- Parameters:
type - the type
- Returns:
- true ig the given type belongs to the domain.
injectCompositeContext
public static void injectCompositeContext(Object component,
Object compositeContextHandler)
getCompositeContextFromInjected
public static Object getCompositeContextFromInjected(Object component)
outjectCompositeContext
public static void outjectCompositeContext(Object component)
createBond
public static Object createBond(Object bondInstance)
throws Throwable
- Throws:
Throwable
getAllReceivers
public static List<MessageReceiver> getAllReceivers(String contextName,
Object instance,
boolean isPrivateMessage)
throws Throwable
- Throws:
Throwable
invoke
public static Object invoke(Object source,
String methodName,
String methodDesc,
boolean dynaSign,
long minOccurs,
long maxOccurs,
String contextName,
boolean isPrivateMessage,
String fromAnnotContent,
Object... args)
throws Throwable
- Throws:
Throwable
addSystemMessageReceiver
public static void addSystemMessageReceiver(MessageReceiver receiver)
removeSystemMessageReceiver
public static void removeSystemMessageReceiver(MessageReceiver receiver)
Copyright © 2009 iquality.org. All Rights Reserved.