|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.inria.ns.reflex.processor.DataSet
public class DataSet
A DataSet is used to store properties used by
the RefleX processor at runtime.
A property is named by a QName
(qualified name), and its value may be any object
or the null value.
Unqualified property names are considered as unqualified attributes in XML, that is to say that such property names are not bound to a namespace URI ; if a property name have to be bound to a namespace URI, it must be prefixed.
Properties from the data set can be used as XPath
variables references , like $myProperty.
Properties that are XML objects or cross-operable objects may be traversed by XPath expressions, like $myProperty/foo/@bar.
A property may be local,global,
or shared:
When a property is expected, it is searched first within the local properties, then within the global properties, and last within the shared properties.
According to its scope, a property may be shadowed by another property with the same name and a higher accessed priority.
*** Once created, the data set must be adopted by the processor
instance that will execute it. When the data set is no longer
in use, it is discarded automatically. To do so, ensure that
there is no strong reference.
To prevent problems (the program won't terminate) :
removeWeakDataSet().or :
getEmbeddedDataSet()), which is
disconnected from its host processor instance.or :
Normal usage is to invoke the DataSet with its
getPropertyValue(QName) methods to retrieve values.
PropertyResolvers plugged in front of the
DataSet would handle resolution for their keys.
It is also possible to access to the local, global, or shared properties directly.
QName| Nested Class Summary | |
|---|---|
class |
DataSet.DataSetContext
A view of this data set as a variable context. |
static class |
DataSet.Embedded
An Embedded data set that can be stored safely (it can be reached with a permanent strong reference). |
| Field Summary | |
|---|---|
boolean |
isLogging
true if the data set is used to log all actions processed
with, false otherwise. |
Level |
logLevel
The level for logging. |
QName |
name
The name of this data set. |
| Constructor Summary | |
|---|---|
DataSet()
Create a default DataSet, which contains no
properties. |
|
DataSet(DataSet dataSet)
Create a new instance of DataSet, which contains no local
properties. |
|
DataSet(DataSet dataSet,
boolean copyLocalProperties)
Create a new instance of DataSet, which contains a copy of the local
properties of the given data set. |
|
DataSet(ProcessorInstance processorInstance)
Create a new instance of DataSet, which contains no local
neither global properties. |
|
| Method Summary | |
|---|---|
void |
addGlobalProperty(QName propertyName,
Object value)
Add a new global property in the data set, or replace those that have the same key. |
void |
addLocalProperty(QName propertyName,
Object value)
Add directly a new local property in the data set, or replace those that have the same key. |
void |
addProperty(QName propertyName,
Object propertyValue,
int scope)
Add the property to the data set, with the appropriate scope. |
void |
addSharedProperty(QName propertyName,
Object value)
Add a new shared property in the data set, or replace those that have the same key. |
XPathContext |
createContext(NamespaceContextFactory namespaceContextFactory)
Create a context based : on the given factory for mapping namespace URIs, on this data set for resolving variables, on its processor instance's module bindings for resolving XPath functions. |
void |
feedContext(Object data)
Store a data inside the current context. |
void |
feedContextWithBubbleMessages(List list)
Feed the current context with all bubble messages in the list. |
Object |
getCurrentObject()
Get the current object for this data set. |
static DataSet |
getDataSet(PatternContext context)
Extract a data set from an XPath context. |
DataSet.Embedded |
getEmbeddedDataSet()
Embeds this data set inside a storable object. |
Object |
getGlobalPropertyValue(QName propertyName)
Return the value of a global property in the data set. |
Object |
getLocalPropertyValue(QName propertyName)
Return directly the value of a local property in the data set. |
MainAction |
getMainAction()
Return the root action that uses this data set. |
ProcessorInstance |
getProcessorInstance()
Return the processor instance. |
Object |
getPropertyValue(QName propertyName)
Return the value of a property based on its QName. |
Object |
getPropertyValue(QName propertyName,
int scope)
Return the value of a property based on its QName. |
Map |
getSharedProperties()
Return the set of shared properties used by this data set. |
Object |
getSharedPropertyValue(QName propertyName)
Return the value of a shared property in the data set. |
Object |
getThreadLocalProperty(QName key)
Get a property in the map of thread-local properties used by this data set. |
XOperator |
getXOperator()
Return the X-operator of this object. |
XPathVariableResolver |
getXPathVariableResolver()
Return the XPathVariableResolver used to resolve variable
bindings within an XPath expression. |
List |
peekContext()
Read the context on the top of the context stack. |
List |
popContext()
Pop the context on the top of the context stack. |
List |
pushContext()
Push a new context on the context stack. |
List |
pushContext(List context)
Push a context on the context stack. |
void |
putThreadLocalProperty(QName key,
Object value)
Put a property in the map of thread-local properties used by this data set. |
Object |
removeGlobalProperty(QName propertyName)
Remove the global property which QName is the same as those
passed in parameter. |
Object |
removeLocalProperty(QName propertyName)
Remove the local property which QName is the same as those
passed in parameter. |
Object |
removeProperty(QName propertyName)
Remove the property which QName is the same as those
passed in parameter. |
Object |
removeProperty(QName propertyName,
int scope)
Remove the property which QName is the same as those
passed in parameter. |
Object |
removeSharedProperty(QName propertyName)
Remove the shared property which QName is the same as those
passed in parameter. |
void |
removeThreadLocalProperty(QName key)
Remove a property in the map of thread-local properties used by this data set. |
void |
removeWeakDataSet()
Removes this data set from its host processor instance, if any. |
void |
setCurrentObject(Object currentObject)
Set the current object for this data set. |
void |
setMainAction(MainAction mainAction)
Set the root action used by this data set. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public QName name
public boolean isLogging
true if the data set is used to log all actions processed
with, false otherwise.
public Level logLevel
| Constructor Detail |
|---|
public DataSet()
DataSet, which contains no
properties. This data set endorsed a default processor instance.
public DataSet(ProcessorInstance processorInstance)
DataSet, which contains no local
neither global properties.
xclController - The controller whose engine class binder is in charge of
property resolutions, and whose attributes are used as the
shared property set.public DataSet(DataSet dataSet)
DataSet, which contains no local
properties.
dataSet - The data set to build from.
public DataSet(DataSet dataSet,
boolean copyLocalProperties)
DataSet, which contains a copy of the local
properties of the given data set.
dataSet - The data set to build from.copyLocalProperties - true if the local properties have to be duplicated,
false if the local propertise have to be left empty.| Method Detail |
|---|
public ProcessorInstance getProcessorInstance()
public MainAction getMainAction()
public void setMainAction(MainAction mainAction)
mainAction - The root action to use by this data set.ProcessorInstance.acquire(DataSet)public Map getSharedProperties()
public void putThreadLocalProperty(QName key,
Object value)
key - The key of the object to store.value - The object to store.removeThreadLocalProperty(QName),
getThreadLocalProperty(QName)public void removeThreadLocalProperty(QName key)
key - The key of the object to remove.putThreadLocalProperty(QName, Object),
getThreadLocalProperty(QName)public Object getThreadLocalProperty(QName key)
key - The key of the object to get.putThreadLocalProperty(QName, Object),
removeThreadLocalProperty(QName)public XPathVariableResolver getXPathVariableResolver()
XPathVariableResolver used to resolve variable
bindings within an XPath expression. The variables of the
XPathVariableResolver are taken from the properties of the
DataSet.XPathVariableResolver is a data
structure used by the Jaxen XPath processor to fix variables. See http://jaxen.sourceforge.net
XPathVariableResolver is simply a view of the data set for
the Jaxen XPath processor.
public void addLocalProperty(QName propertyName,
Object value)
QName.
Property resolvers are not used.
namespaceURI - The namespace URI.propertyName - The QName.value - The value of the property (which can be null).public Object getLocalPropertyValue(QName propertyName)
QName. Property resolvers are not used.
propertyName - The QName.
null).
public void addGlobalProperty(QName propertyName,
Object value)
QName. Property
resolvers are not used.
namespaceURI - The namespace URI.propertyName - The QName.value - The value of the property (which can be null).public Object getGlobalPropertyValue(QName propertyName)
QName. Property resolvers are not used.
propertyName - The QName.
null).
public void addSharedProperty(QName propertyName,
Object value)
QName. Property
resolvers are not used.
namespaceURI - The namespace URI.propertyName - The QName.value - The value of the property (which can be null).public Object getSharedPropertyValue(QName propertyName)
QName. Property resolvers are not used.
propertyName - The QName.
null).
public void addProperty(QName propertyName,
Object propertyValue,
int scope)
throws ExecutionException
propertyName - The QName of the property.propertyValue - The value of the property.scope - The
scope
of the property.
ExecutionException
public Object getPropertyValue(QName propertyName)
throws ExecutionException
QName. If a
property resolver is bound to the QName of the property, it is used to
perform the action. To retrieve the property, the looking up is done on
the local data set first, then on the global data set, last on the shared
data set.
propertyName - The QName of the property.
null)
ExecutionException
public Object getPropertyValue(QName propertyName,
int scope)
throws ExecutionException
QName. If a
property resolver is bound to the QName of the property, it is used to
perform the action. If the QName of the property denotes a path to an
item of a collection, the looking up is started with the scope given, and
goes on with the other shadowed scopes if not found.
propertyName - The QName of the property.scope - The
scope
level to start the research of the property.
null)
ExecutionException
public Object removeProperty(QName propertyName)
throws ExecutionException
QName is the same as those
passed in parameter. If a property resolver is bound to the QName of the
property, it is used to perform the action. To retrieve the property, the
looking up is done on the local data set first, then on the global data
set, last on the shared data set.
propertyName - The QName of the property.
null if the
property was not found.
ExecutionException
public Object removeLocalProperty(QName propertyName)
throws RecoverableException
QName is the same as those
passed in parameter. This method bypass the eventual property resolver;
Use one of the removeProperty() methods instead.
propertyName - The QName of the property.
null if the
property was not found.
RecoverableExceptionremoveProperty(QName),
removeProperty(QName, int),
PropertyResolver
public Object removeGlobalProperty(QName propertyName)
throws RecoverableException
QName is the same as those
passed in parameter. This method bypass the eventual property resolver;
Use one of the removeProperty() methods instead.
propertyName - The QName of the property.
null if the
property was not found.
RecoverableExceptionremoveProperty(QName),
removeProperty(QName, int),
PropertyResolver
public Object removeSharedProperty(QName propertyName)
throws RecoverableException
QName is the same as those
passed in parameter. This method bypass the eventual property resolver;
Use one of the removeProperty() methods instead.
propertyName - The QName of the property.
null if the
property was not found.
RecoverableExceptionremoveProperty(QName),
removeProperty(QName, int),
PropertyResolver
public Object removeProperty(QName propertyName,
int scope)
throws ExecutionException
QName is the same as those
passed in parameter. If a property resolver is bound to the QName of the
property, it is used to perform the action. If the QName of the property
denotes a path to an item of a collection, the looking up is started with
the scope given, and goes on with the other shadowed scopes if not found.
propertyName - The QName of the property.scope - The
scope
level to start the research of the property.
null if the
property was not found.
ExecutionExceptionpublic void setCurrentObject(Object currentObject)
currentObject - The current object to set.public Object getCurrentObject()
public XOperator getXOperator()
getXOperator in interface XOperablepublic List pushContext()
public List pushContext(List context)
context - A user-defined context.
If the context is a simple list,
use pushContext() instead.
public List peekContext()
public List popContext()
public void feedContext(Object data)
null datas are ignored.
data - The data to store.public void feedContextWithBubbleMessages(List list)
list - The list that may contain bubble messages.public static DataSet getDataSet(PatternContext context)
context - An XPath context.
public XPathContext createContext(NamespaceContextFactory namespaceContextFactory)
namespaceContextFactory - The component that can create a namespace context.
Usually, an action.
public void removeWeakDataSet()
ProcessorInstance.removeWeakDataSet(DataSet)public DataSet.Embedded getEmbeddedDataSet()
The storable data set doesn't belong to the processor instance of the original data set. When a data set must be unwrapped, a copy that do belong to the original processor instance is provided.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||