Methods Summary |
---|
protected void | addBundleNodeAttributes(org.w3c.dom.Element bundleNode, com.sun.enterprise.deployment.RootDeploymentDescriptor descriptor)write the necessary attributes for the root node of this DDs document
String schemaLocation;
// the latest connector schema still use j2ee namespace
if (descriptor instanceof ConnectorDescriptor) {
bundleNode.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", TagNames.J2EE_NAMESPACE);
schemaLocation = TagNames.J2EE_NAMESPACE + " " +
getSchemaURL();
} else {
bundleNode.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", TagNames.JAVAEE_NAMESPACE);
schemaLocation = TagNames.JAVAEE_NAMESPACE + " " +
getSchemaURL();
}
bundleNode.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xsi", W3C_XML_SCHEMA_INSTANCE);
// add all custom global namespaces
addNamespaceDeclaration(bundleNode, descriptor);
String clientSchemaLocation = descriptor.getSchemaLocation();
if (clientSchemaLocation!=null) {
schemaLocation = schemaLocation + " " + clientSchemaLocation;
}
bundleNode.setAttributeNS(W3C_XML_SCHEMA_INSTANCE, SCHEMA_LOCATION_TAG, schemaLocation);
bundleNode.setAttribute(TagNames.VERSION, getSpecVersion());
// Write out full attribute for DD which allows annotations.
// The full attribute should always be written out as true since
// when we come here to write it out, the annotation information
// has already been processed and saved in DD, so written out DD
// is always a full DD.
if (descriptor instanceof BundleDescriptor) {
BundleDescriptor bundleDesc = (BundleDescriptor)descriptor;
if (! bundleDesc.isDDWithNoAnnotationAllowed()) {
bundleNode.setAttribute(TagNames.METADATA_COMPLETE, "true");
}
}
|
public void | addPrefixMapping(java.lang.String prefix, java.lang.String uri)notify of a new prefix mapping used in this document
// we don't care about the default ones...
if (uri.equals(TagNames.J2EE_NAMESPACE))
return;
if (uri.equals(TagNames.JAVAEE_NAMESPACE))
return;
if (uri.equals(W3C_XML_SCHEMA_INSTANCE))
return;
super.addPrefixMapping(prefix, uri);
|
public static org.w3c.dom.Element | appendChildNS(org.w3c.dom.Node parent, java.lang.String elementName, java.lang.String nameSpace)
Element child = getOwnerDocument(parent).createElementNS(nameSpace, elementName);
parent.appendChild(child);
return child;
|
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.
Map dispatchTable = super.getDispatchTable();
dispatchTable.put(TagNames.NAME, "setDisplayName");
dispatchTable.put(TagNames.VERSION, "setSpecVersion");
return dispatchTable;
|
protected java.lang.String | getSchemaURL()
// by default, it comes from our web site
return TagNames.JAVAEE_NAMESPACE + "/" + getSystemID();
|
public void | setDocType(java.lang.String docType)set the DOCTYPE as read in the input XML File
this.docType = docType;
setSpecVersion();
|
public void | setElementValue(XMLElement element, java.lang.String value)receives notiification of the value for a particular tag
if (SCHEMA_LOCATION_TAG.equals(element.getCompleteName())) {
// we need to keep all the non j2ee/javaee schemaLocation tags
StringTokenizer st = new StringTokenizer(value);
StringBuffer sb = new StringBuffer();
while (st.hasMoreElements()) {
String namespace = (String) st.nextElement();
String schema;
if (st.hasMoreElements()) {
schema = (String) st.nextElement();
} else {
schema = namespace;
namespace = TagNames.JAVAEE_NAMESPACE;
}
if (namespace.equals(TagNames.J2EE_NAMESPACE))
continue;
if (namespace.equals(TagNames.JAVAEE_NAMESPACE))
continue;
if (namespace.equals(W3C_XML_SCHEMA))
continue;
sb.append(namespace);
sb.append(" ");
sb.append(schema);
}
String clientSchemaLocation = sb.toString();
if (clientSchemaLocation!=null && clientSchemaLocation.length()!=0) {
Object o = getDescriptor();
if (o instanceof RootDeploymentDescriptor) {
((RootDeploymentDescriptor) o).setSchemaLocation(clientSchemaLocation);
}
}
} else if (element.getQName().equals(TagNames.METADATA_COMPLETE)) {
Object o = getDescriptor();
if (o instanceof BundleDescriptor) {
((BundleDescriptor) o).setFullAttribute(value);
}
} else {
super.setElementValue(element, value);
}
|
protected void | setSpecVersion()Sets the specVersion for this descriptor depending on the docType
if (docType==null)
return;
StringTokenizer st = new StringTokenizer(docType, "//");
while (st.hasMoreElements()) {
String tmp = st.nextToken();
if (tmp.startsWith("DTD")) {
// this is the string we are interested in
StringTokenizer versionST = new StringTokenizer(tmp);
while (versionST.hasMoreElements()) {
String versionStr = versionST.nextToken();
try {
Float.valueOf(versionStr);
RootDeploymentDescriptor rdd = (RootDeploymentDescriptor) getDescriptor();
rdd.setSpecVersion(versionStr);
return;
} catch(NumberFormatException nfe) {
// ignore, this is just the other info of the publicID
}
}
}
}
|
public org.w3c.dom.Node | writeDescriptor(org.w3c.dom.Node parent, com.sun.enterprise.deployment.RootDeploymentDescriptor descriptor)write the descriptor class to a DOM tree and return it
Node bundleNode;
if (getDocType()==null) {
// we are using schemas for this DDs
// connector schema still use j2ee name space
if (descriptor instanceof ConnectorDescriptor) {
bundleNode = appendChildNS(parent, getXMLRootTag().getQName(),
TagNames.J2EE_NAMESPACE);
} else {
bundleNode = appendChildNS(parent, getXMLRootTag().getQName(),
TagNames.JAVAEE_NAMESPACE);
}
addBundleNodeAttributes((Element) bundleNode, descriptor);
} else {
bundleNode = appendChild(parent, getXMLRootTag().getQName());
}
// description, display-name, icons...
writeDisplayableComponentInfo(bundleNode, descriptor);
return bundleNode;
|
protected void | writeMessageDestinations(org.w3c.dom.Node parentNode, java.util.Iterator msgDestinations)
if ( (msgDestinations == null) || !msgDestinations.hasNext() )
return;
MessageDestinationNode subNode = new MessageDestinationNode();
for (;msgDestinations.hasNext();) {
MessageDestinationDescriptor next =
(MessageDestinationDescriptor) msgDestinations.next();
subNode.writeDescriptor(parentNode,
TagNames.MESSAGE_DESTINATION, next);
}
|