QueryNodepublic class QueryNode extends com.sun.enterprise.deployment.node.DeploymentDescriptorNode This class is responsible for hanlding the query element |
Fields Summary |
---|
private com.sun.enterprise.deployment.QueryDescriptor | descriptor |
Constructors Summary |
---|
public QueryNode()Creates new QueryNode
super();
registerElementHandler(new XMLElement(EjbTagNames.QUERY_METHOD),
MethodNode.class, "setQueryMethodDescriptor");
|
Methods Summary |
---|
public java.lang.Object | getDescriptor()
if (descriptor == null) {
descriptor = (QueryDescriptor) super.getDescriptor();
}
return descriptor;
| protected java.util.Map | getDispatchTable()all sub-implementation of this class can use a dispatch table to map xml element to
method name on the descriptor class for setting the element value.
// no need to be synchronized for now
Map table = super.getDispatchTable();
table.put(EjbTagNames.EJB_QL, "setQuery");
return table;
| public void | setElementValue(com.sun.enterprise.deployment.node.XMLElement element, java.lang.String value)receives notiification of the value for a particular tag
if (EjbTagNames.QUERY_RESULT_TYPE_MAPPING.equals(element.getQName())) {
if (EjbTagNames.QUERY_REMOTE_TYPE_MAPPING.equals(value)) {
descriptor.setHasRemoteReturnTypeMapping();
} else if (EjbTagNames.QUERY_LOCAL_TYPE_MAPPING.equals(value)) {
descriptor.setHasLocalReturnTypeMapping();
} else {
DOLUtils.getDefaultLogger().log(Level.SEVERE, "enterprise.deployment.backend.addDescriptorFailure",
new Object[] {((Descriptor) getParentNode().getDescriptor()).getName() , value});
}
} else {
super.setElementValue(element, value);
}
| public org.w3c.dom.Node | writeDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.QueryDescriptor descriptor)write the descriptor class to a DOM tree and return it
Node queryNode = super.writeDescriptor(parent, nodeName, descriptor);
writeLocalizedDescriptions(queryNode, descriptor);
// query-method
MethodNode methodNode = new MethodNode();
methodNode.writeQueryMethodDescriptor(queryNode, EjbTagNames.QUERY_METHOD,
descriptor.getQueryMethodDescriptor());
if (descriptor.getHasRemoteReturnTypeMapping()) {
appendTextChild(queryNode, EjbTagNames.QUERY_RESULT_TYPE_MAPPING,
EjbTagNames.QUERY_REMOTE_TYPE_MAPPING);
} else {
if (descriptor.getHasLocalReturnTypeMapping()) {
appendTextChild(queryNode, EjbTagNames.QUERY_RESULT_TYPE_MAPPING,
EjbTagNames.QUERY_LOCAL_TYPE_MAPPING);
}
}
// ejbql element is mandatory. If no EJB QL query has been
// specified for the method, the xml element will be empty
String ejbqlText = descriptor.getIsEjbQl() ? descriptor.getQuery() : "";
Node child = appendChild(queryNode, EjbTagNames.EJB_QL);
child.appendChild(getOwnerDocument(child).createTextNode(ejbqlText));
return queryNode;
|
|