com.webify.wsf.engine.context
Class Context

java.lang.Object
  extended by com.webify.wsf.engine.context.Context

public abstract class Context
extends java.lang.Object

Maintains the state associated with a business activity. Similar to a Web session or transactional context.

Version:
$Revision: $
Author:
msanchez

Field Summary
protected  boolean _reference
           
static java.lang.String DEBUG
          Boolean property that is used to signal debugging mode.
static java.lang.String PRISM_BEGIN
          The context identifer for pass-by-value context headers.
static java.lang.String WARNINGS
          String property for specifying warning messages for the activity.
 
Constructor Summary
Context()
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
 boolean getBooleanProperty(java.lang.String propKey)
          Get the value for the specified property.
abstract  Context getChildContextAt(int index)
          Get the context at the specified index.
abstract  int getChildContextCount()
          Get the number of contexts that are children of this context.
abstract  java.lang.String getContextIdentifier()
          Gets the unique identifier for the context instance.
 java.lang.Long getLongProperty(java.lang.String propKey)
          Get the value for the specified property.
 TypedValue getObjectAsTypedValue(java.lang.String propKey)
          Returns the property specified by propKey as a TypedValue.
abstract  java.lang.Object getObjectProperty(java.lang.String propKey)
          Get the value for the specified property.
abstract  Context getParentContext()
          Get's the parent context associated with this context instance.
abstract  java.util.Set getPropertyNameSet()
          Get the set of properties associated with this context.
 java.lang.String getStringProperty(java.lang.String propKey)
          Get the value for the specified property.
abstract  long getTimeout()
          Gets the timeout in milliseconds.
abstract  long getTimestamp()
          Gets the context creation time.
 int hashCode()
           
 boolean isExpired()
           
 boolean isReference()
           
 void setBooleanProperty(java.lang.String propKey, boolean propValue)
           
abstract  void setObjectProperty(java.lang.String propKey, java.lang.Object propValue)
           
 void setStringProperty(java.lang.String propKey, java.lang.String propValue)
           
 void setTypedValueProperty(java.lang.String propKey, TypedValue typedValue)
          Delegates to setObjectProperty(java.lang.String, java.lang.Object).
abstract  ContextDocument toContextDocument()
          Convert this context to XML.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PRISM_BEGIN

public static final java.lang.String PRISM_BEGIN
The context identifer for pass-by-value context headers.

See Also:
Constant Field Values

DEBUG

public static final java.lang.String DEBUG
Boolean property that is used to signal debugging mode.

See Also:
Constant Field Values

WARNINGS

public static final java.lang.String WARNINGS
String property for specifying warning messages for the activity.

See Also:
Constant Field Values

_reference

protected transient boolean _reference
Constructor Detail

Context

public Context()
Method Detail

getContextIdentifier

public abstract java.lang.String getContextIdentifier()
Gets the unique identifier for the context instance.

Returns:
a unique identifier for the context

getTimestamp

public abstract long getTimestamp()
Gets the context creation time.

Returns:
creation time in milliseconds
See Also:
System.currentTimeMillis()

getTimeout

public abstract long getTimeout()
Gets the timeout in milliseconds. A value of 0 indicates no timeout. The number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.

A context is considered 'active' if it has no timeout or it's timeout value is greater than the current time in milliseconds.

Returns:
the timeout value in milliseconds

getParentContext

public abstract Context getParentContext()
Get's the parent context associated with this context instance.

As the method signature suggests, the parent context may not be of the same concrete type as this; back-end implementations should not rely on a homogeneous hierarchy. This is particularly important when in-memory contexts have persistent contexts as parents.

Returns:
possibly null context instance.

getChildContextCount

public abstract int getChildContextCount()
Get the number of contexts that are children of this context.

Returns:
an integer representing the number of children of this context.

getChildContextAt

public abstract Context getChildContextAt(int index)
Get the context at the specified index. Index can be in range 0 <= index < getChildContextCount().

Parameters:
index - the index of the child context to be returned
Returns:
non-null context instance at the location specified by index.

getPropertyNameSet

public abstract java.util.Set getPropertyNameSet()
Get the set of properties associated with this context. Includes properties of ancestors in a context's direct lineage.

Returns:
set of property names

getBooleanProperty

public final boolean getBooleanProperty(java.lang.String propKey)
Get the value for the specified property. Traverses ancestry starting with this context and working up the parent chain until a non-null value is found.

Parameters:
propKey - String identifying the property to return value for.
Returns:
boolean value associated with this property.

getLongProperty

public final java.lang.Long getLongProperty(java.lang.String propKey)
Get the value for the specified property. Traverses ancestry starting with this context and working up the parent chain until a non-null value is found.

Parameters:
propKey - String identifying the property to return value for.
Returns:
numeric value associated with this property.

getStringProperty

public final java.lang.String getStringProperty(java.lang.String propKey)
Get the value for the specified property. Traverses ancestry starting with this context and working up the parent chain until a non-null value is found.

Parameters:
propKey - String identifying the property to return value for.
Returns:
lexical value associated with this property.

getObjectAsTypedValue

public TypedValue getObjectAsTypedValue(java.lang.String propKey)
Returns the property specified by propKey as a TypedValue. Legacy Engine Context's do not have XSD types other than boolean. Overriding classes may provide support for other XSD types as needed.

Parameters:
propKey - non-null key for the desired property
Returns:
non-null TypedValue

getObjectProperty

public abstract java.lang.Object getObjectProperty(java.lang.String propKey)
Get the value for the specified property. Traverses ancestry starting with this context and working up the parent chain until a non-null value is found.

Parameters:
propKey - String identifying the property to return value for.
Returns:
object associated with this property.

setBooleanProperty

public final void setBooleanProperty(java.lang.String propKey,
                                     boolean propValue)

setStringProperty

public final void setStringProperty(java.lang.String propKey,
                                    java.lang.String propValue)

setObjectProperty

public abstract void setObjectProperty(java.lang.String propKey,
                                       java.lang.Object propValue)

setTypedValueProperty

public void setTypedValueProperty(java.lang.String propKey,
                                  TypedValue typedValue)
Delegates to setObjectProperty(java.lang.String, java.lang.Object). Overriding classes may choose to handle TypedValue properties in a special manner.

Parameters:
propKey - non-null property key
typedValue - non-null TypedValue property value

toContextDocument

public abstract ContextDocument toContextDocument()
Convert this context to XML. Does not fill in wsctx properties.

Returns:
ContextDocument containing all of the properties including properties of ancestors in a context's direct lineage. Resolves parent-child property conflict by favoring value specified in child.

isReference

public boolean isReference()
Returns:
true if this context is persistent, false otherwise.

isExpired

public boolean isExpired()
Returns:
true if instant specified by this context's timeout property is in the past, false otherwise.

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2009 IBM. All Rights Reserved.