ServletNodepublic class ServletNode extends com.sun.enterprise.deployment.node.DisplayableComponentNode This node is responsible for handling the servlet xml sub tree |
Fields Summary |
---|
private static final com.sun.enterprise.deployment.node.XMLElement | tag | private com.sun.enterprise.deployment.WebComponentDescriptor | descriptor |
Constructors Summary |
---|
public ServletNode()Creates new ServletNode
super();
registerElementHandler(new XMLElement(WebTagNames.ROLE_REFERENCE), SecurityRoleRefNode.class);
registerElementHandler(new XMLElement(WebTagNames.INIT_PARAM), InitParamNode.class);
registerElementHandler(new XMLElement(WebTagNames.RUNAS_SPECIFIED_IDENTITY),
RunAsNode.class, "setRunAsIdentity");
|
Methods Summary |
---|
public void | addDescriptor(java.lang.Object newDescriptor)Adds a new DOL descriptor instance to the descriptor instance associated with
this XMLNode
if (newDescriptor instanceof RoleReference) {
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
DOLUtils.getDefaultLogger().fine("Adding security role ref " + newDescriptor);
}
descriptor.addSecurityRoleReference(
(RoleReference) newDescriptor);
} else if (newDescriptor instanceof EnvironmentEntry) {
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINE)) {
DOLUtils.getDefaultLogger().fine("Adding init-param " + newDescriptor);
}
descriptor.addInitializationParameter(
(InitializationParameter) newDescriptor);
} else super.addDescriptor(newDescriptor);
| public java.lang.Object | getDescriptor()
if (descriptor==null) {
descriptor = (WebComponentDescriptor) DescriptorFactory.getDescriptor(getXMLPath());
}
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(WebTagNames.NAME, "setName");
table.put(WebTagNames.SERVLET_NAME, "setCanonicalName");
table.put(WebTagNames.LOAD_ON_STARTUP, "setLoadOnStartUp");
return table;
| protected com.sun.enterprise.deployment.node.XMLElement | getXMLRootTag()
return tag;
| public void | setElementValue(com.sun.enterprise.deployment.node.XMLElement element, java.lang.String value)receives notiification of the value for a particular tag
if (WebTagNames.SERVLET_CLASS.equals(element.getQName())) {
descriptor.setServlet(true);
descriptor.setWebComponentImplementation(value);
} else if (WebTagNames.JSP_FILENAME.equals(element.getQName())) {
descriptor.setServlet(false);
descriptor.setWebComponentImplementation(value);
} else {
super.setElementValue(element, value);
}
| public org.w3c.dom.Node | writeDescriptor(org.w3c.dom.Node parent, com.sun.enterprise.deployment.WebComponentDescriptor descriptor)write the descriptor class to a DOM tree and return it
Node myNode = super.writeDescriptor(parent, descriptor);
appendTextChild(myNode, WebTagNames.SERVLET_NAME, descriptor.getCanonicalName());
if (descriptor.isServlet()) {
appendTextChild(myNode, WebTagNames.SERVLET_CLASS, descriptor.getWebComponentImplementation());
} else {
appendTextChild(myNode, WebTagNames.JSP_FILENAME, descriptor.getWebComponentImplementation());
}
// init-param*
WebBundleNode.addInitParam(myNode, WebTagNames.INIT_PARAM, descriptor.getInitializationParameters());
if (descriptor.getLoadOnStartUp()!=-1) {
appendTextChild(myNode, WebTagNames.LOAD_ON_STARTUP, String.valueOf(descriptor.getLoadOnStartUp()));
}
// run-as
RunAsIdentityDescriptor runAs = descriptor.getRunAsIdentity();
if (runAs!=null) {
RunAsNode runAsNode = new RunAsNode();
runAsNode.writeDescriptor(myNode, WebTagNames.RUNAS_SPECIFIED_IDENTITY, runAs);
}
// sercurity-role-ref*
Enumeration roleRefs = descriptor.getSecurityRoleReferences();
SecurityRoleRefNode roleRefNode = new SecurityRoleRefNode();
while (roleRefs.hasMoreElements()) {
roleRefNode.writeDescriptor(myNode, WebTagNames.ROLE_REFERENCE,
(RoleReference) roleRefs.nextElement());
}
return myNode;
|
|