|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.applications.dove.AbstractDove
org.mmbase.applications.dove.Dove
public class Dove
This class handles Remote Procedure Calls described using a DOM model.
The original data is received in xml, likely through a specialized servlet such
as the DoveServlet (but this is not required. it may, for instance, be
possible to use this class in conjunction with SOAP or even outside a servlet
context).
The call should result in a new DOM tree (see the EditWizard API for details).
XXX: Currently, this class performs some type of validation on the xml received.
If errors occur, they are included in the response, at the place where they
occur. This means that the <error > tag can occur anywhere in the
response, which is not very neat.
Errors have three types:
parser : the xml given is invalid or does not follow the grammar.
This likely means there is a bug in the client code.
server : the code invoked is either not yet implemented or another,
server-related, error occurred (such as no memory, bad configuration,
etc.).
Server errors entirely fail a request.
client : The data requested could not be retrieved or values specified
were invalid. I.e. a requested node does not exist (any more), or a
put failed due to locking or invalid data.
This is ONLY for debugging purposes!
XML validation should occur at the parser and be captured early.
If we reach consensus that we must always validate, the xml-checking can be left
out, as we can then assumes a correct model. This will optimize processing.
| Field Summary |
|---|
| Fields inherited from class org.mmbase.applications.dove.AbstractDove |
|---|
DESCENDANT, DESCENDANTS, DESCRIPTION, doc, DOCTYPE_REQUEST, DOCTYPE_RESPONSE, ELM_CONTEXT, ELM_CREATEDIR, ELM_DESTINATION, ELM_DESTINATIONTYPE, ELM_DIRECTIONS, ELM_ENCODING, ELM_HREF, ELM_ID, ELM_LANG, ELM_MAYDELETE, ELM_MAYWRITE, ELM_NAME, ELM_NUMBER, ELM_OLDNUMBER, ELM_ORDERBY, ELM_ROLE, ELM_SEARCHDIR, ELM_SEARCHTYPE, ELM_SIZE, ELM_SOURCE, ELM_SOURCETYPE, ELM_STATUS, ELM_TYPE, ELM_WHERE, ELM_XPATH, ERROR, FIELD, FIELDS, GETCONSTRAINTS, GETDATA, GETLIST, GETNEW, GETNEWRELATION, GETRELATIONS, GUINAME, GUITYPE, IS_CLIENT, IS_FALSE, IS_PARSER, IS_SERVER, IS_TRUE, MAXLENGTH, NEW, OBJECT, ORIGINAL, PARENT, PLURALNAME, PUT, QUERY, RELATION, RELATIONS, REQUEST, REQUIRED, RESPONSE, SECURITY, SECURITY_CLOUD, SECURITY_METHOD, SECURITY_NAME, SECURITY_PASSWORD, SINGULARNAME, TYPE_DESCRIPTIONS |
| Constructor Summary | |
|---|---|
Dove(Document doc)
Constructor |
|
| Method Summary | |
|---|---|
protected Element |
addField(Element out,
NodeManager nm,
Field f,
Node node)
|
protected void |
addRelationNodes(Element relation,
Element out,
Node nd)
Retrieves the relations of a node and adds its content to a DOM element. |
void |
doRequest(Element in,
Element out,
Cloud cloud,
Map<String,byte[]> repository)
Handles a request running one or more RPCs. |
protected boolean |
fillFields(String alias,
Node node,
Element objectelement,
Map<String,Object> values)
Fills the fields of the specified node with the supplied values. |
protected boolean |
fillFields(String alias,
Node node,
Element out,
Map<String,Object> values,
Map<String,Object> originalValues)
Fills the fields of the specified node with the supplied values. |
void |
getConstraints(Element in,
Element out,
Cloud cloud)
Handles a getconstraints call. |
void |
getData(Element in,
Element out,
Cloud cloud)
Handles a getdata call, by obtaining data for each node specified. |
void |
getDataNode(Element in,
Element out,
Cloud cloud)
Handles a node by retrieving its data and storing its content in a DOM element. |
void |
getDataNode(Element in,
Element out,
Node node)
Handles a node storing its content in a DOM element. |
void |
getList(Element in,
Element out,
Cloud cloud)
Handles a getlist call. |
void |
getNew(Element in,
Element out,
Cloud cloud)
Handles a getnew call, by obtaining data for the new node of a specified type. |
void |
getNewRelation(Element in,
Element out,
Cloud cloud)
Handles a getnewrelation call, by obtaining data for the new node of a specified type. |
protected String |
getNodeReferenceFromValue(String name,
Map<String,Object> values,
Map<String,Integer> aliases)
Converts the value of a field to a node reference (either a temporary id or an object alias or number). |
void |
getRelations(Element in,
Element out,
Cloud cloud)
Handles a getrelations call, by obtaining relations for each node specified. |
void |
getRelationsNodes(Element in,
Element out,
Cloud cloud)
Handles a node by retrieving its relations and storing its content in a DOM element. |
protected boolean |
mergeClouds(Map<String,Map<String,Object>> originalNodes,
Map<String,Map<String,Object>> newNodes,
Map<String,Map<String,Object>> originalRelations,
Map<String,Map<String,Object>> newRelations,
Map<Node,Element> addedNodes,
Map<Relation,Element> addedRelations,
Element out,
Cloud cloud)
Performs the put within a transaction. |
void |
put(Element in,
Element out,
Cloud cloud,
Map<String,byte[]> repository)
Handles a put call. |
protected boolean |
putChangeNode(String alias,
Map<String,Object> values,
Map<String,Object> originalValues,
Map<String,Integer> aliases,
Element out,
Cloud cloud)
Changes a node. |
protected boolean |
putChangeRelation(String alias,
Map values,
Map originalValues,
Map aliases,
Element out,
Cloud cloud)
Changes a relation |
protected boolean |
putDeleteNode(String alias,
Map<String,Object> originalValues,
Element out,
Cloud cloud)
Deletes a node. |
protected boolean |
putDeleteRelation(String alias,
Map<String,Object> originalValues,
Element out,
Cloud cloud)
Deletes a relation. |
protected boolean |
putNewNode(String alias,
Map<String,Object> values,
Map<String,Integer> aliases,
Map<Node,Element> addedNodes,
Element out,
Cloud cloud)
Creates a new node. |
protected boolean |
putNewRelation(String alias,
Map<String,Object> values,
Map<String,Integer> aliases,
Map<Relation,Element> addedRelations,
Element out,
Cloud cloud)
Creates a new relation. |
| Methods inherited from class org.mmbase.applications.dove.AbstractDove |
|---|
addContentElement, doRequest, executeRequest, executeRequest, getFirstElement, getFirstElement, getNextElement, getNextElement, getTypeDescription |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Dove(Document doc)
doc - the Document that is constructed. This should only be used to
construct new DOM elements. New (child) nodes should not be added
to this document, but to the out element.| Method Detail |
|---|
protected Element addField(Element out,
NodeManager nm,
Field f,
Node node)
public void getDataNode(Element in,
Element out,
Node node)
in - the element that described the getdata call.
The childnodes should describe the nodes to retrieve.out - the element that described the getdata result.
Retrieved nodes should be added as childs to this element.node - The node to store in out.
public void getDataNode(Element in,
Element out,
Cloud cloud)
in - the element that described the getdata call.
The childnodes should describe the nodes to retrieve.out - the element that described the getdata result.
Retrieved nodes should be added as childs to this element.cloud - the cloud to work on
protected void addRelationNodes(Element relation,
Element out,
Node nd)
relation - the element that described the relation
The childnodes (if present) should describe the fields to retrieve, and possibly
a description of the related object.out - the element that describes the source node.
Retrieved relations should be added as childs to this element.nd - the MMBase node that shoudl eb sued to query the relations
public void getRelationsNodes(Element in,
Element out,
Cloud cloud)
in - the element that described the getdata call.
The childnodes should describe the nodes to retrieve.out - the element that described the getdata result.
Retrieved nodes should be added as childs to this element.cloud - the cloud to work on
public void getData(Element in,
Element out,
Cloud cloud)
in - the element that described the getdata call.
The childnodes should describe the nodes to retrieve.out - the element that described the getdata result.
Retrieved nodes should be added as childs to this element.cloud - the cloud to work on
public void getNew(Element in,
Element out,
Cloud cloud)
in - the element that described the getnew call.out - the element that described the getnew result.
The new node should be added as a child to this element.cloud - the cloud to work on
public void getNewRelation(Element in,
Element out,
Cloud cloud)
in - the element that described the getnew call.out - the element that described the getnew result.
The new node should be added as a child to this element.cloud - the cloud to work on
public void getRelations(Element in,
Element out,
Cloud cloud)
in - the element that described the getrelations call.
The childnodes should describe the nodes to retrieve the relations from.out - the element that described the getrelations result.
Retrieved nodes and their relations should be added as childs to this element.cloud - the cloud to work on
public void getConstraints(Element in,
Element out,
Cloud cloud)
in - the element that described the getconstraints call.
The childnodes should describe the node types to retrieve the constraints of.out - the element that described the getconstraints result.
Retrieved constraints should be added as childs to this element.cloud - the cloud to work on
public void getList(Element in,
Element out,
Cloud cloud)
in - the element that described the getlist call.
The childnodes should describe the queries to run.out - the element that described the getlist result.
Retrieved nodes should be added as childs to this element.cloud - the cloud to work on
public void put(Element in,
Element out,
Cloud cloud,
Map<String,byte[]> repository)
in - the element that described the put call.
The childnodes should describe the old and the new cloud.out - the element that described the put result.
The result of the put (an error or the resulting cloud) should be added
as childs to this element.cloud - the cloud to work onrepository - Repository that contains the blobs
protected String getNodeReferenceFromValue(String name,
Map<String,Object> values,
Map<String,Integer> aliases)
name - the name of the fieldvalues - a Map with field valuesaliases - a Map with mappings from XML aliases to node reference values
protected boolean fillFields(String alias,
Node node,
Element objectelement,
Map<String,Object> values)
alias - the node alias in the put treenode - the node to fillobjectelement - the XML element to fill with the changed data for feedbackvalues - a Map with new node values
protected boolean fillFields(String alias,
Node node,
Element out,
Map<String,Object> values,
Map<String,Object> originalValues)
alias - the node alias in the put treenode - the node to fillout - the XML element to fill with the changed data for feedbackvalues - a Map with new node valuesoriginalValues - a Map with the original values of the node, needed for checking.
if null, no checking takes place
protected boolean putNewNode(String alias,
Map<String,Object> values,
Map<String,Integer> aliases,
Map<Node,Element> addedNodes,
Element out,
Cloud cloud)
alias - the node alias in the put treevalues - a Map with new node valuesaliases - a Map with mappings from XML aliases to node reference valuesaddedNodes - a Map used to keep associations between xml elements and newly created nodes,
needed for resolving new node numbersout - the element that describes 'new' cloud.
The result of the put (an error or the resulting cloud) should be added
as childs to this element.cloud - the cloud to work on
protected boolean putNewRelation(String alias,
Map<String,Object> values,
Map<String,Integer> aliases,
Map<Relation,Element> addedRelations,
Element out,
Cloud cloud)
alias - the node alias in the put treevalues - a Map with new node valuesaliases - a Map with mappings from XML aliases to node reference valuesaddedRelations - a Map used to keep associations between xml elements and newly created relations,
needed for resolving new node numbers and referencesout - the element that describes 'new' cloud.
The result of the put (an error or the resulting cloud) should be added
as childs to this element.cloud - the cloud to work on
protected boolean putDeleteNode(String alias,
Map<String,Object> originalValues,
Element out,
Cloud cloud)
alias - the node alias in the put treeoriginalValues - a Map with the original values of the nodeout - the element that describes 'new' cloud.
The result of the put (an error or the resulting cloud) should be added
as childs to this element.cloud - the cloud to work on
protected boolean putDeleteRelation(String alias,
Map<String,Object> originalValues,
Element out,
Cloud cloud)
alias - the node alias in the put treeoriginalValues - a Map with the original values of the relationout - the element that describes 'new' cloud.
The result of the put (an error or the resulting cloud) should be added
as childs to this element.cloud - the cloud to work on
protected boolean putChangeRelation(String alias,
Map values,
Map originalValues,
Map aliases,
Element out,
Cloud cloud)
alias - the node alias in the put treevalues - a Map with new node valuesoriginalValues - a Map with original node values, used for validationaliases - a Map with mappings from XML aliases to node reference valuesout - the element that describes 'new' cloud.
The result of the put (an error or the resulting cloud) should be added
as childs to this element.cloud - the cloud to work on
protected boolean putChangeNode(String alias,
Map<String,Object> values,
Map<String,Object> originalValues,
Map<String,Integer> aliases,
Element out,
Cloud cloud)
alias - the node alias in the put treevalues - a Map with new node valuesoriginalValues - a Map with original node values, used for validationaliases - a Map with mappings from XML aliases to node reference valuesout - the element that describes 'new' cloud.
The result of the put (an error or the resulting cloud) should be added
as childs to this element.cloud - the cloud to work on
protected boolean mergeClouds(Map<String,Map<String,Object>> originalNodes,
Map<String,Map<String,Object>> newNodes,
Map<String,Map<String,Object>> originalRelations,
Map<String,Map<String,Object>> newRelations,
Map<Node,Element> addedNodes,
Map<Relation,Element> addedRelations,
Element out,
Cloud cloud)
originalNodes - the nodes in the original cloud, used in validationnewNodes - the nodes in the new cloudoriginalRelations - the relations in the original cloud, used in validationnewRelations - the relations in the new cloudaddedNodes - a Map used to keep associations between xml elements and newly created nodes,
needed for resolving new node numbers and referencesaddedRelations - a Map used to keep associations between xml elements and newly created relations,
needed for resolving new node numbers and referencesout - the element that described the put result.
The result of the put (an error or the resulting cloud) should be added
as childs to this element.cloud - the cloud to work on
public void doRequest(Element in,
Element out,
Cloud cloud,
Map<String,byte[]> repository)
doRequest in class AbstractDovein - the element that described the request (or input).
The childnodes should describe the calls to perform.out - the element that described the response (or return value).
Results of calls should be added as childs to this element.cloud - the cloud to work on - if null, a cloud will be created by the Dove classrepository - Repository that contains the blobs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||