public final class RAPPTransaction extends Object
It creates the XML framework and provides methods to add the actions to process for the transaction at both the "client" and the server side.
It can instantiate the complete tree of RAPPnnn classes from an XML document as well as to serialize itself to an XML document.
The RAPPTransaction instance is a list of actions that the "client" wishes the server application to execute. These actions are well specified using the classes:
For a detailed description of the classes above, see the corresponding class.
RemoteTransaction
,
RAPPGlobVar
,
RAPPCallObject
,
RAPPCallHost
,
RAPPCallClass
Modifier and Type | Field and Description |
---|---|
static int |
CURRENT_VERSION
The current version of the document transaction.
|
static boolean |
generateComments
This static variable indicates if XML comment generation
for the transactions should be on or off.
|
Constructor and Description |
---|
RAPPTransaction()
Creates an empty request used to programmatically
add actions for a request transaction.
|
Modifier and Type | Method and Description |
---|---|
void |
addAction(RAPPAction action)
Adds an action to the transaction.
|
void |
addFinalAction(RAPPAction action)
Adds a final action to the transaction.
|
static void |
addNameSpaceItem(RAPPNameSpaceItem nameSpaceItem)
Add namespace to static hashtable.
|
Document |
createDocument(boolean doRequest,
boolean doReply)
Creates the XML document request and/or reply from all
RAPP actions depending on the flags.
|
Document |
createDocumentReply(boolean keepRequest)
Creates the XML document reply from all RAPP actions.
|
Document |
createDocumentRequest()
Creates the XML document request from all RAPP actions.
|
Element |
createElement(String name)
Creates an Element to be used by callClass requests
and replies.
|
void |
createFromDocument(Document doc)
Reinitializes this transaction to create the RAPP
instance structure from an XML document from scratch.
|
static RAPPNameSpaceItem |
createNameSpaceItem(Class<?> owner,
String partURI,
String prefix)
Create namespace item.
|
RAPPAction |
getAction(int index)
Gets an action from an index.
|
int |
getActionCount()
Gets the current action count.
|
RAPPAction |
getFinalAction(int index)
Gets a final action from an index.
|
int |
getFinalActionCount()
Gets the current final action count.
|
String |
toString()
Converts this class into a string for testing purposes.
|
void |
updateDocumentReply(boolean keepRequest)
Updates the document that was used to initialize this class
from the method
createFromXML . |
void |
updateReplyFromDocument(Document doc)
Updates this transaction instance with the reply from
the document.
|
public static final int CURRENT_VERSION
The version has the format YYYYMM when the document structure was finally fixed.
The current version is 200209.
public static boolean generateComments
public RAPPTransaction()
public static RAPPNameSpaceItem createNameSpaceItem(Class<?> owner, String partURI, String prefix)
public static void addNameSpaceItem(RAPPNameSpaceItem nameSpaceItem)
public void addAction(RAPPAction action)
public void addFinalAction(RAPPAction action)
public int getActionCount()
public int getFinalActionCount()
public RAPPAction getAction(int index)
public RAPPAction getFinalAction(int index)
public final Element createElement(String name)
public Document createDocumentRequest()
public Document createDocumentReply(boolean keepRequest)
The flag keepRequest
indicates if the
request data should be kept in the document reply or not.
This flag can be false
to preserve e.g.
the network bandwidth.
public Document createDocument(boolean doRequest, boolean doReply)
This method is public only because of testing purposes.
public void createFromDocument(Document doc) throws SAXException
SAXException
- for errors in the document.public void updateDocumentReply(boolean keepRequest)
createFromXML
. This is used
in the server to send back the same - but updated - document.
The flag keepRequest
is used to keep the
reply elements or if they should be removed. E.g. network
bandwidth might be improved if this flag is false
.
public void updateReplyFromDocument(Document doc) throws SAXException
In other words, do NOT use this method for sessions that are disconnected and the same Java VM is not running the same instance of the original RAPPTransaction.
If this is not the case, an exception is thrown.
This is the most efficient way for a "permanent" connection to a server to retrieve the data.
During processing of this method, the reply values or the extending RAPPAction classes are modified in a thread-unsafe way. Thus, when calling this method, do not access reply data in the action classes.
SAXException
- for errors in the document.Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.