FileDocCategorySizeDatePackage
GenericElement.javaAPI DocGlassfish v2 API5307Fri Jul 27 12:41:18 BST 2007com.sun.enterprise.tools.upgrade.transform.elements

GenericElement

public class GenericElement extends BaseElement
author
prakash

Fields Summary
Constructors Summary
public GenericElement()
Creates a new instance of Element

    
Methods Summary
protected java.util.ListgetNonTransferList(org.w3c.dom.Element element)

        java.util.Vector doNotTransferList = null;
        if(commonInfoModel.checkUpgradefrom8xeeto9x()) {
            if(element.getTagName().equals("jmx-connector")) {
                doNotTransferList = new java.util.Vector();
                doNotTransferList.add("port");
            }
        }
        return doNotTransferList;
    
public voidtransform(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)
element - any-element parentSource - parent of any-element parentResult - result parent of any-element peer

        
        String elementTagName = element.getTagName();
		if(elementTagName.equals("message-security-config"))
            return;
		
        NodeList resultElements = parentResult.getElementsByTagName(elementTagName);
        Element resultElement = null;
        String key = this.getKeyToCompare(elementTagName);
        if(key != null){
            for(int lh =0; lh < resultElements.getLength(); lh++){

                // Compare one key attribute
                if((element.getAttribute(key)).equals(((Element)resultElements.item(lh)).getAttribute(key))){
                    resultElement = (Element)resultElements.item(lh);
                    break;
                }
            }
        }else{
            // If the key is not defined then there is only one element.
            if(resultElements.getLength() != 0){
                resultElement = (Element)resultElements.item(0);
            }
        }
        //Commented for CR 6480041 - Support not needed anymore since domains are created afresh	
		/*if(resultElement != null) {
			if(resultElement.getTagName().equals("availability-service")) {
		       NodeList jmsAvailabilityElements = resultElement.getElementsByTagName("jms-availability");
		       Element jmsAvailabilityElement = (Element)jmsAvailabilityElements.item(0);
		       if(jmsAvailabilityElement == null) {
			       //Not there. Create one
                   jmsAvailabilityElement  =
                       resultElement.getOwnerDocument().createElement("jms-availability");
                   jmsAvailabilityElement.setAttribute("availability-enabled", "false");
			       resultElement.appendChild(jmsAvailabilityElement);
			    }
		    }
						
		}*/
        //End - comment		
        if(resultElement == null){
            resultElement = parentResult.getOwnerDocument().createElement(elementTagName);
            this.transferAttributes(element, resultElement, this.getNonTransferList(element));
            this.appendElementToParent(parentResult,resultElement);  
        }else {       
            this.transferAttributes(element, resultElement, this.getNonTransferList(element));
        } 
        super.transform(element,  parentSource, resultElement);