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

VirtualServer

public class VirtualServer extends BaseElement
author
prakash

Fields Summary
private static Logger
log
Constructors Summary
public VirtualServer()
Creates a new instance of Element


           
      
    
Methods Summary
private voidprintAttrs(org.w3c.dom.Element ele)

        log.info(" ____________ print virtual-server attributes");
        org.w3c.dom.NamedNodeMap sourceAttrNodeMap = ele.getAttributes();
        for(int index=0; index < sourceAttrNodeMap.getLength(); index++){
             Node sourceAttrNode = sourceAttrNodeMap.item(index);
             log.info("\n attr name="+sourceAttrNode.getNodeName()+" attrValue="+sourceAttrNode.getNodeValue());
        }
    
public voidtransform(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)
element - virtual server parentSource - parent virtual-server-class of element for as7, virtual-server for as8 parentResult - parent http-service of result

        // In domain.xml http-service is /domain/configs/config/http-service/viertual-server-class/virtual-server
        // in server.xml http-service is /server/http-service/virtual-server-class/virtual-server
        
        // Obtain a list of virtual-server from the result. 
        //If the passed in element is not the one in the list then add it.
        // If its the one existing then update it.
        // There should be either one or zero http-service and zero or more vertual-server-class
                
        NodeList resultVirtualServers = parentResult.getElementsByTagName("virtual-server");
        Element resultVirtualServer = null;
        String serverID = "server1";
        if(this.commonInfoModel.getSourceVersion().equals(
                    com.sun.enterprise.tools.upgrade.common.UpgradeConstants.VERSION_7X)){
            serverID = element.getOwnerDocument().getDocumentElement().getAttribute("name");
        }
        for(int lh =0; lh < resultVirtualServers.getLength(); lh++){
            if(element.getAttribute("id").equals(serverID) &&
                    ((Element)resultVirtualServers.item(lh)).getAttribute("id").equals("server")){
                resultVirtualServer = (Element)resultVirtualServers.item(lh);
                java.util.Vector notToTransferAttrList = new java.util.Vector();
                // http-listeners, its possible that the 7.0 config would have added more http-listeners....
                // FIX, http-listeners to compare and add http-listeners to the list.
                
                // If the source server name is different from server1 then the id should represent the server name.
                //if(serverID.equals("server1"))
                notToTransferAttrList.add("id");
                notToTransferAttrList.add("http-listeners");
                notToTransferAttrList.add("config-file");
                this.transferAttributes(element, resultVirtualServer, notToTransferAttrList);
                break;
            }else if((element.getAttribute("id")).equals(((Element)resultVirtualServers.item(lh)).getAttribute("id"))){
                resultVirtualServer = (Element)resultVirtualServers.item(lh);
                java.util.Vector notToTransferAttrList = new java.util.Vector();
                //Added for CR 6508712
                notToTransferAttrList.add("default-web-module");
                //End - added				
                // http-listeners, its possible that the 7.0 config would have added more http-listeners....
                // FIX, http-listeners to compare and add http-listeners to the list.
                if(commonInfoModel.getSourceVersion().equals(
                            com.sun.enterprise.tools.upgrade.common.UpgradeConstants.VERSION_7X)){
                    notToTransferAttrList.add("http-listeners");
                    notToTransferAttrList.add("config-file");
                }
                this.transferAttributes(element, resultVirtualServer, notToTransferAttrList);
                break;
             }
        }
        if(resultVirtualServer == null){
            // Add element - virtual server to result virtual-server-class.
            resultVirtualServer = parentResult.getOwnerDocument().createElement("virtual-server");
            this.transferAttributes(element, resultVirtualServer, null);
            this.appendElementToParent(parentResult,resultVirtualServer);            
        }
        //this.printAttrs(resultVirtualServer);
        // There are few property elements like docroot, 
        //accesslog those pointing to directory/file in the current intallation.
        //   NEED TO FIX....Should avoid those properties being invoked by 
        //the below method. may be override the super method...
        super.transform(element, parentSource, resultVirtualServer);