FileDocCategorySizeDatePackage
Property.javaAPI DocGlassfish v2 API5540Wed Jul 11 10:00:58 BST 2007com.sun.enterprise.tools.upgrade.transform.elements

Property

public class Property extends BaseElement
author
prakash

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

    
Methods Summary
private booleancanTransferAttributes(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)

        /*if(parentSource.getTagName().equals("virtual-server")){
            if(this.commonInfoModel.getSourceVersion().equals(UpgradeConstants.VERSION_7X)){
                if(element.getAttribute("name").equals("docroot") || element.getAttribute("name").equals("accesslog")){
                    return false;
                }
            }
        }*/
        //Added for CR 6455396 EE->EE upgrade
        if(commonInfoModel.checkUpgradefrom8xeeto9x()) {
            if(parentSource.getTagName().equals("jmx-connector")) {
                if(element.getAttribute("name").equals("client-hostname")) {
                    return false;
                }
            }
        }
        return true;
    
private voidhandleSpecialCases(org.w3c.dom.Element source, org.w3c.dom.Element target, org.w3c.dom.Element parentSource, org.w3c.dom.Element targetParent)

        if(parentSource.getTagName().equals("jms-resource") && targetParent.getTagName().equals("admin-object-resource")){
            if(source.getAttribute("name").equals("imqDestinationName")){
                target.setAttribute("name", "Name");
            }
        }
    
public voidtransform(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)
element - Property parentSource - parent of Property parentResult - result element that need to be updated.

		logger.log(Level.FINE, stringManager.getString("upgrade.transform.transformingMSG", this.getClass().getName(), element.getTagName()));
        // Property has name and value. and possible description element.
        logger.log(Level.FINE, this.getClass().getName() +  ":: canTransferAttributes ", canTransferAttributes(element, parentSource, parentResult));
        if(!canTransferAttributes(element, parentSource, parentResult))
            return;
        NodeList resultProperties = parentResult.getElementsByTagName("property");
        Element resultProperty = null;
        if(resultProperties != null){
            for(int index=0; index < resultProperties.getLength(); index++){
                if(element.getAttribute("name").equals(((Element)resultProperties.item(index)).getAttribute("name"))){
                    resultProperty = (Element)resultProperties.item(index);
                    resultProperty.getAttributeNode("value").setValue(element.getAttributeNode("value").getValue());
                    this.handleSpecialCases(element, resultProperty, parentSource, parentResult);
                    break;
                }
            }
        }
        if(resultProperty == null){
            resultProperty = parentResult.getOwnerDocument().createElement("property");
            this.transferAttributes(element, resultProperty, null);
            this.handleSpecialCases(element, resultProperty, parentSource, parentResult);
            parentResult.appendChild(resultProperty);
        }
        super.transform(element, parentSource, resultProperty);