Methods Summary |
---|
protected void | Init()Initialize the child handlers
super.Init();
registerElementHandler(new XMLElement(RuntimeTagNames.SECURITY_ROLE_MAPPING),
SecurityRoleMappingNode.class);
|
public void | addDescriptor(java.lang.Object newDescriptor)Adds a new DOL descriptor instance to the descriptor instance associated with
this XMLNode
if (newDescriptor instanceof SecurityRoleMapping) {
SecurityRoleMapping roleMap = (SecurityRoleMapping) newDescriptor;
descriptor.addSecurityRoleMapping(roleMap);
if (descriptor!=null && !descriptor.isVirtual()) {
Role role = new Role(roleMap.getRoleName());
SecurityRoleMapper rm = descriptor.getRoleMapper();
if (rm != null) {
List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames();
for (int i = 0; i < principals.size(); i++) {
rm.assignRole(principals.get(i).getPrincipal(),
role, descriptor);
}
List<String> groups = roleMap.getGroupNames();
for (int i = 0; i < groups.size(); i++) {
rm.assignRole(new Group(groups.get(i)),
role, 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.
Map table = super.getDispatchTable();
table.put(RuntimeTagNames.REALM, "setRealm");
return table;
|
public java.lang.String | getDocType()
return DTDRegistry.SUN_APPLICATION_500_DTD_PUBLIC_ID;
|
public java.lang.String | getSystemID()
return DTDRegistry.SUN_APPLICATION_500_DTD_SYSTEM_ID;
|
public java.util.List | getSystemIDs()
return null;
|
protected com.sun.enterprise.deployment.node.XMLElement | getXMLRootTag()
return new XMLElement(RuntimeTagNames.S1AS_APPLICATION_RUNTIME_TAG);
|
public static java.lang.String | registerBundle(java.util.Map publicIDToDTD)register this node as a root node capable of loading entire DD files
publicIDToDTD.put(DTDRegistry.SUN_APPLICATION_130_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_130_DTD_SYSTEM_ID);
publicIDToDTD.put(DTDRegistry.SUN_APPLICATION_140_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_140_DTD_SYSTEM_ID);
publicIDToDTD.put(DTDRegistry.SUN_APPLICATION_141_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_141_DTD_SYSTEM_ID);
publicIDToDTD.put(DTDRegistry.SUN_APPLICATION_500_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_500_DTD_SYSTEM_ID);
if (!restrictDTDDeclarations()) {
publicIDToDTD.put(DTDRegistry.SUN_APPLICATION_140beta_DTD_PUBLIC_ID, DTDRegistry.SUN_APPLICATION_140beta_DTD_SYSTEM_ID);
}
return RuntimeTagNames.S1AS_APPLICATION_RUNTIME_TAG;
|
public void | setElementValue(com.sun.enterprise.deployment.node.XMLElement element, java.lang.String value)receives notification of the value for a particular tag
if (element.getQName().equals(RuntimeTagNames.PASS_BY_REFERENCE)) {
descriptor.setPassByReference("true".equalsIgnoreCase(value));
} else
if (element.getQName().equals(RuntimeTagNames.UNIQUE_ID)) {
descriptor.setUniqueId(Long.parseLong(value));
} else
if (element.getQName().equals(RuntimeTagNames.WEB_URI)) {
currentWebUri=value;
} else
if (element.getQName().equals(RuntimeTagNames.CONTEXT_ROOT)) {
if (currentWebUri!=null) {
ModuleDescriptor md = descriptor.getModuleDescriptorByUri(currentWebUri);
if (md==null) {
throw new RuntimeException("No bundle in application with uri " + currentWebUri);
}
currentWebUri=null;
if (md.getModuleType().equals(ModuleType.WAR)) {
md.setContextRoot(value);
} else {
throw new RuntimeException(currentWebUri + " uri does not point to a web bundle");
}
} else {
throw new RuntimeException("No uri provided for this context-root " + 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.Descriptor descriptor)write the descriptor class to a DOM tree and return it
if (! (descriptor instanceof Application)) {
throw new IllegalArgumentException(getClass() + " cannot handles descriptors of type " + descriptor.getClass());
}
Application application = (Application) descriptor;
Node appNode = super.writeDescriptor(parent, nodeName, descriptor);
// web*
for (Iterator modules=application.getModules();modules.hasNext();) {
ModuleDescriptor module = (ModuleDescriptor) modules.next();
if (module.getModuleType().equals(ModuleType.WAR)) {
Node web = appendChild(appNode, RuntimeTagNames.WEB);
appendTextChild(web, RuntimeTagNames.WEB_URI, module.getArchiveUri());
appendTextChild(web, RuntimeTagNames.CONTEXT_ROOT, module.getContextRoot());
}
}
// pass-by-reference ?
if (application.isPassByReferenceDefined()) {
appendTextChild(appNode, RuntimeTagNames.PASS_BY_REFERENCE, String.valueOf(application.getPassByReference()));
}
// unique-id
appendTextChild(appNode, RuntimeTagNames.UNIQUE_ID, String.valueOf(application.getUniqueId()));
// security-role-mapping*
List<SecurityRoleMapping> roleMappings = application.getSecurityRoleMappings();
for (int i = 0; i < roleMappings.size(); i++) {
SecurityRoleMappingNode srmn = new SecurityRoleMappingNode();
srmn.writeDescriptor(appNode, RuntimeTagNames.SECURITY_ROLE_MAPPING, roleMappings.get(i));
}
// realm?
appendTextChild(appNode, RuntimeTagNames.REALM, application.getRealm());
return appNode;
|