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);