FileDocCategorySizeDatePackage
AuthRealm.javaAPI DocGlassfish v2 API4881Fri May 04 22:35:10 BST 2007com.sun.enterprise.tools.upgrade.transform.elements

AuthRealm

public class AuthRealm extends BaseElement
author
prakash

Fields Summary
private String
parentName
Constructors Summary
public AuthRealm()
Creates a new instance of Element

    
Methods Summary
private booleancanTransform(java.lang.String name, java.lang.String className)

        // FIX... name of solarisRealm is "solaris" not known. Need to finout
	//start CR 6399167 - security's keyfile location should be transformed.
        //if((name.equals("file") || className.equals("com.iplanet.ias.security.auth.realm.file.FileRealm")) ||
	//end CR 6399167
        if((name.equals("ldap") || className.equals("com.iplanet.ias.security.auth.realm.ldap.LDAPRealm")) ||
            (name.equals("solaris") || className.equals("com.iplanet.ias.security.auth.realm.solaris.SolarisRealm")) ||
            (name.equals("certificate") || className.equals("com.iplanet.ias.security.auth.realm.certificate.CertificateRealm"))){
            return false;
        }
        return true;
    
protected java.util.ListgetInsertElementStructure(org.w3c.dom.Element element, org.w3c.dom.Element parentEle)

        java.util.List list = new java.util.ArrayList();
        if(this.parentName != null){
            if(this.parentName.equals("node-agent")){
                list.add("log-service");
            }
        }
        return list;
    
public voidtransform(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)
element - auth-realm parentSource - parent http-service of element parentResult - parent http-service of result

        if(!this.canTransform(element.getAttribute("name"), element.getAttribute("classname")))
            return;
        NodeList resultAuths = parentResult.getElementsByTagName("auth-realm");
        Element resultAuth = null;
        for(int lh =0; lh < resultAuths.getLength(); lh++){
            // Compare id attribute of auth-realm elements.
            if((element.getAttribute("name")).equals(((Element)resultAuths.item(lh)).getAttribute("name"))){
                resultAuth = (Element)resultAuths.item(lh);
                this.transferAttributes(element, resultAuth, null);
                break;
             }
        }
        if(resultAuth == null){
            // Add element - auth-realm to result security-service.
            resultAuth = parentResult.getOwnerDocument().createElement("auth-realm");
            this.transferAttributes(element, resultAuth, null);
            this.parentName = parentResult.getTagName();
            this.appendElementToParent(parentResult,resultAuth);  
        }
        super.transform(element,  parentSource, resultAuth);