|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jbpm.xml.Parser org.jbpm.wire.xml.WireParser
public class WireParser
parses object wiring xml and constructs a WireDefinition.
To learn the full XML syntax, check out the Bindings:
<object .../>
: see ObjectBinding
<boolean .../>
, <true />
and <false/>
: see BooleanBinding
<byte .../>
: see ByteBinding
<char .../>
: see CharBinding
<double .../>
: see DoubleBinding
<float .../>
: see FloatBinding
<int .../>
: see IntBinding
<string .../>
: see StringBinding
<map .../>
: see MapBinding
<set .../>
: see SetBinding
<list .../>
: see ListBinding
<class .../>
: see ClassBinding
<ref .../>
: see RefBinding
<null .../>
: see NullBinding
<environment .../>
: see EnvironmentBinding
<environment-factory .../>
: see EnvironmentFactoryBinding
<hibernate-persistence .../>
: see HibernateSessionFactoryBinding
<persistence-session .../>
: see PersistenceSessionBinding
The defaults bindings for the Wiring XML are divided in two categories:
CATEGORY_DESCRIPTOR
categoryCATEGORY_OPERATION
categoryOnce a parser is created, bindings can be added, overwritten and removed to customize that parser instance.
An ArgDescriptor is defined by a <arg>
xml element.
This element can have an attribute "type", which specifies name of the argument's type.
This element contains one child element that defines a Descriptor
. This descriptor specifies the value to give to the argument.
public class Hello { public static String sayHello(String name) { return "Hello " + name + " !"; } }The following Xml declaration will create an object 's' of class 'String' (see
ObjectDescriptor
).
This object is created by invoking Hello.sayHello
with the value world
as a parameter.
<objects> <object name="s" class='Hello' method='sayHello'> <arg> <string value='world' /> </arg> </object> </objects>The created object 's' will be a String, containing "Hello world !".
The initialization method can be defined with the init
attribute.
For more details on how initialization works, see section 'Initialization' of WireContext
.
init
attribute can have these values:
lazy
: for lazy creation and delayed initializationrequired
: for lazy creation and immediate initializationeager
: for eager creation and delayed initializationimmediate
: for eager creation and immediate initialization
Field Summary | |
---|---|
static java.lang.String |
CATEGORY_DESCRIPTOR
|
static java.lang.String |
CATEGORY_INTERCEPTOR
|
static java.lang.String |
CATEGORY_OPERATION
|
static java.lang.String |
PVM_WIRE_BINDINGS_RESOURCES
|
Fields inherited from class org.jbpm.xml.Parser |
---|
bindings, classLoader, documentBuilderFactory, entities |
Constructor Summary | |
---|---|
WireParser()
Constructs a new WireParser with the default bindings. |
Method Summary | |
---|---|
static WireParser |
getInstance()
Default method to get an instance of the WireParser |
java.util.List<ArgDescriptor> |
parseArgs(java.util.List<org.w3c.dom.Element> argElements,
Parse parse)
Parses the list of arguments of a method. |
java.lang.Object |
parseDocumentElement(org.w3c.dom.Element documentElement,
Parse parse)
This method builds the WireDefinition from the DOM tree. |
java.lang.Object |
parseElement(org.w3c.dom.Element element,
Parse parse,
java.lang.String category)
This method parses an arbitrary element in the document based on the bindings in the given category. |
static WireDefinition |
parseXmlString(java.lang.String xmlString)
Convenience method to parse a wiring xml. |
Methods inherited from class org.jbpm.xml.Parser |
---|
addEntity, buildDom, checkProblems, createDocumentBuilder, createParse, execute, getBinding, getBinding, getBindings, getDocumentBuilderFactory, getInputSource, importStream, newDocumentBuilderFactory, parseDocument, parseElement, resolveEntity, setBindings, setDocumentBuilderFactory, useParseEntityResolver |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PVM_WIRE_BINDINGS_RESOURCES
public static final java.lang.String CATEGORY_DESCRIPTOR
public static final java.lang.String CATEGORY_OPERATION
public static final java.lang.String CATEGORY_INTERCEPTOR
Constructor Detail |
---|
public WireParser()
Method Detail |
---|
public static WireParser getInstance()
public static WireDefinition parseXmlString(java.lang.String xmlString)
xmlString
- the xml string to parse
parseXmlString(String)
public java.lang.Object parseDocumentElement(org.w3c.dom.Element documentElement, Parse parse)
parseDocumentElement
in class Parser
documentElement
- the root element of the documentparse
- Parse object that contains all information for the current parse operation.
Parser.parseDocumentElement(Element, Parse)
public java.lang.Object parseElement(org.w3c.dom.Element element, Parse parse, java.lang.String category)
Parser.parseElement(Element, Parse, String)
method to build the resulting object.
If the resulting object is a subclass of AbstractDescriptor
, the related fields are initialized.
parseElement
in class Parser
element
- the element to parseparse
- Parse object that contains all information for the current parse operation.category
- is the category in which the tagName should be resolved to an ElementHandler.
If category is null, all the categories will be scanned for an appropriate binding in random order.
public java.util.List<ArgDescriptor> parseArgs(java.util.List<org.w3c.dom.Element> argElements, Parse parse)
ArgDescriptor
from the given list of DOM elements
argElements
- the list of argument DOM elementsparse
- Parse object that contains all information for the current parse operation.
ArgDescriptor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |