FileDocCategorySizeDatePackage
JavaConfig.javaAPI DocGlassfish v2 API13745Tue Aug 21 11:55:32 BST 2007com.sun.enterprise.tools.upgrade.transform.elements

JavaConfig

public class JavaConfig extends BaseElement
author
prakash

Fields Summary
private List
exludedJarList
Constructors Summary
public JavaConfig()
Creates a new instance of Element


           
      
    
Methods Summary
public voidappendSuffixToClasspath(org.w3c.dom.Element source, org.w3c.dom.Element javaConf)
This method appends the classpath for montoring framework for AS 8.2

        String serverCP = javaConf.getAttribute("server-classpath");
        if(serverCP != null && !serverCP.trim().equals("")) {
            String modServerCP = serverCP+
                    "${path.separator}${com.sun.aas.mfwkHome}/lib/mfwk_instrum_tk.jar";
            javaConf.setAttribute("server-classpath", modServerCP);

        }
    
public voidappendSystemClasspath(org.w3c.dom.Element source, org.w3c.dom.Element javaConf)

        String systemCP = javaConf.getAttribute("system-classpath");
        if(systemCP != null && !systemCP.trim().equals("")) {
	        String modSystemCP = systemCP +
				"${path.separator}${com.sun.aas.installRoot}/lib/appserv-launch.jar";
			javaConf.setAttribute("system-classpath", modSystemCP);
	    } else {
            //Create and add
			javaConf.setAttribute("system-classpath",
                "${com.sun.aas.installRoot}/lib/appserv-launch.jar");
        }
    
private voidbuildExcludedJarList()

        if(this.exludedJarList !=null)
            return;
        this.exludedJarList = new java.util.ArrayList();
        this.exludedJarList.add("pbclient42RE.jar");
        this.exludedJarList.add("sax.jar");
        this.exludedJarList.add("xalan.jar");
        //this.exludedJarList.add("dom.jar");
        this.exludedJarList.add("dom4j.jar");
        this.exludedJarList.add("xercesImpl.jar");
        this.exludedJarList.add("jaxp-api.jar");
        this.exludedJarList.add("jaxrpc-api.jar");
        this.exludedJarList.add("xmlsec.jar");
        this.exludedJarList.add("saaj-api.jar");
        this.exludedJarList.add("jaxrpc-impl.jar");
        this.exludedJarList.add("jaxrpc-spi.jar");
        this.exludedJarList.add("common-logging.jar");
        this.exludedJarList.add("saaj-impl.jar");
        this.exludedJarList.add("mail.jar");
        this.exludedJarList.add("activation.jar");
        this.exludedJarList.add("jaas.jar");
        this.exludedJarList.add("jdk_logging.jar");
        this.exludedJarList.add("servlet.jar");
        this.exludedJarList.add("xsltc.jar");
        this.exludedJarList.add("relaxngDatatype.jar");
        this.exludedJarList.add("xsdlib.jar");
        this.exludedJarList.add("jakarta-log4j.jar");
        this.exludedJarList.add("namespace.jar");
        this.exludedJarList.add("appserv-rt.jar");
        this.exludedJarList.add("jmxremote_optional.jar");
        this.exludedJarList.add("rmissl.jar");
        this.exludedJarList.add("appserv-tags.jar");
        this.exludedJarList.add("jsf-api.jar");
        this.exludedJarList.add("activation.jar");
        this.exludedJarList.add("appserv-upgrade.jar");
        this.exludedJarList.add("jsf-impl.jar");
        this.exludedJarList.add("admin-cli.jar");
        this.exludedJarList.add("appservLauncher.jar");
        this.exludedJarList.add("j2ee-svc.jar");
        this.exludedJarList.add("j2ee.jar");
        this.exludedJarList.add("sun-appserv-ant.jar");
        this.exludedJarList.add("jaxr-api.jar");
        this.exludedJarList.add("appserv-admin.jar");
        this.exludedJarList.add("jaxr-impl.jar");
        this.exludedJarList.add("appserv-assemblytool.jar");
        this.exludedJarList.add("jaxrpc-api.jar");
        this.exludedJarList.add("appserv-cmp.jar");
        this.exludedJarList.add("commons-launcher.jar");
        this.exludedJarList.add("appserv-ext.jar");
        this.exludedJarList.add("commons-logging.jar");
        this.exludedJarList.add("jhall.jar");
        this.exludedJarList.add("appserv-jstl.jar");
        this.exludedJarList.add("deployhelp.jar");
        this.exludedJarList.add("jmxremote.jar");
        this.exludedJarList.add("relaxngDatatype.jar");
        this.exludedJarList.add("jaxb-api.jar");
        this.exludedJarList.add("jaxb-impl.jar");
        this.exludedJarList.add("jaxb-libs.jar");
        this.exludedJarList.add("jaxb-xjc.jar");
        this.exludedJarList.add("jax-qname.jar");
        this.exludedJarList.add("namespace.jar");
        //this.exludedJarList.add("pbclient42RE.jar");
        //this.exludedJarList.add("pbclient42RE.jar");
        //this.exludedJarList.add("pbclient42RE.jar");
        //this.exludedJarList.add("pbclient42RE.jar");
        //this.exludedJarList.add("pbclient42RE.jar");
        //this.exludedJarList.add("pbclient42RE.jar");

    
private java.lang.StringgetClassPathStringToAppend(java.lang.String sourceCPString)

        if(sourceCPString == null)
            return null;
        java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(sourceCPString,System.getProperty("path.separator"));
        String cpToAppend = null;
        if(this.exludedJarList == null)
            this.buildExcludedJarList();
        while(tokenizer.hasMoreTokens()){
            String token = tokenizer.nextToken();
            if(this.isValidClassPathElement(token)){
                if(cpToAppend == null){
                    cpToAppend = token;
                }else{
                    cpToAppend = cpToAppend+"${path.separator}"+token;
                }
            }
        }
        return cpToAppend;
    
private booleanisValidClassPathElement(java.lang.String cp)

        // compare the cp with
        for(int i=0; i < this.exludedJarList.size(); i++){
            if(cp.indexOf((String)this.exludedJarList.get(i)) != -1)
                return false;
        }
        return true;
    
public voidtransform(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)
element - java-config parentSource - parent server of element parentResult - domain

        // There is always a security service in result as well as source
       logger.log(Level.FINE, stringManager.getString("upgrade.transform.transformingMSG", this.getClass().getName(), element.getTagName()));
       
	   java.util.Vector notToTransferAttrList = new java.util.Vector();
	   notToTransferAttrList.add("classpath-suffix");
	   notToTransferAttrList.add("classpath-prefix");
	   notToTransferAttrList.add("java-home");
	   notToTransferAttrList.add("server-classpath");
	   
	   NodeList javaConfs = parentResult.getElementsByTagName("java-config");
       Element javaConf = null;
       // If this is a AS8.1EE to AS8.2EE upgrade
       if(commonInfoModel.checkUpgradefrom8xeeto9x() ) {
           // There is only one javaConf element
           javaConf = (Element)javaConfs.item(0);
           appendSuffixToClasspath(element, javaConf);
           appendSystemClasspath(element, javaConf);
		   
		   // Move java-config attributes
		   if(javaConfs.getLength() != 0){
				notToTransferAttrList.add("system-classpath");
				this.transferAttributes(element, javaConf, notToTransferAttrList);
		   }
		   
           updateClassPathAttributes(element, javaConf);
           super.transform(element,  parentSource, javaConf);
           return;
       }
	   logger.log(Level.FINE, stringManager.getString(this.getClass().getName() + ":: javaConfs.getLength() " , javaConfs.getLength()));
       if(javaConfs.getLength() == 0){
            NodeList config = parentResult.getElementsByTagName("config");
            javaConf = parentResult.getOwnerDocument().createElement("java-config");
            // server-classpth should be parsed and should be appended to the target.  FIX IT
            this.transferAttributes(element, javaConf, notToTransferAttrList);
            //Added for CR 6283805
            this.updateClassPathAttributes(element,javaConf);
            this.appendElementToParent((Element)config.item(0),javaConf);
        }else {
            javaConf = (Element)javaConfs.item(0);
            this.transferAttributes(element, javaConf, notToTransferAttrList);
            //Added for CR 6283805
           this.updateClassPathAttributes(element,javaConf);
        }
        super.transform(element,  parentSource, javaConf);
    
private voidupdateClassPathAttributes(org.w3c.dom.Element source, org.w3c.dom.Element target)

        // update classpath-suffix
        String cpSuffix = source.getAttribute("classpath-suffix");
        if((cpSuffix != null) && (!cpSuffix.trim().equals(""))){
            String cpToAppend = getClassPathStringToAppend(cpSuffix);
            if(cpToAppend != null){
                String targetCP = target.getAttribute("classpath-suffix");
                if((targetCP == null) || (targetCP.trim().equals(""))){
                    target.setAttribute("classpath-suffix", cpToAppend);
                }else{
                    targetCP = targetCP+"${path.separator}"+cpToAppend;
                    target.setAttribute("classpath-suffix", targetCP);
                }
            }
        }
        //${com.sun.aas.installRoot}/lib/install/applications/jmsra/imqjmsra.jar${path.separator}${com.sun.aas.imqLib}/jaxm-api.jar${path.separator}${com.sun.aas.imqLib}/fscontext.jar${path.separator}${com.sun.aas.antLib}/ant.jar${path.separator}${com.sun.aas.hadbRoot}/lib/hadbjdbc4.jar${path.separator}${com.sun.aas.jdmkHome}/lib/jdmkrt.jar${path.separator}${com.sun.aas.mfwkHome}/lib/mfwk_instrum_tk.jar:C:/Softwares/SunStud/AppServer7/lib/appserv-ideplugin.jar;C:/Softwares/SunStud/MessageQueue3.5/imq/lib/imq.jar;C:/Softwares/SunStud/MessageQueue3.5/imq/lib/jaxm-api.jar;C:/Softwares/SunStud/MessageQueue3.5/imq/lib/imqadmin.jar;C:/Softwares/SunStud/MessageQueue3.5/imq/lib/imqutil.jar;C:/Softwares/SunStud/MessageQueue3.5/imq/lib/fscontext.jar;C:/Softwares/SunStud/MessageQueue3.5/imq/lib/providerutil.jar
        // update classpath-prefix
        String cpPrefix = source.getAttribute("classpath-prefix");
        if((cpPrefix != null) && (!cpPrefix.trim().equals(""))){
            String cpToAppend = getClassPathStringToAppend(cpPrefix);
            if(cpToAppend != null){
                String targetCP = target.getAttribute("classpath-prefix");
                if((targetCP == null) || (targetCP.trim().equals(""))){
                    target.setAttribute("classpath-prefix", cpToAppend);
                }else{
                    targetCP = targetCP+"${path.separator}"+cpToAppend;
                    target.setAttribute("classpath-prefix", targetCP);
                }
            }
        }

        //Added for CR 6363158
        //Should not be transformed in the 9.0 target file
        // update server-classpath
        /*String cpServer = source.getAttribute("server-classpath");
        if((cpServer != null) && (!cpServer.trim().equals(""))){
            String cpToAppend = getClassPathStringToAppend(cpServer);
            if(cpToAppend != null){
                String targetCP = target.getAttribute("server-classpath");
                if((targetCP == null) || (targetCP.trim().equals(""))){
                    target.setAttribute("server-classpath", cpToAppend);
                }else{
                    targetCP = targetCP+"${path.separator}"+cpToAppend;
                    target.setAttribute("server-classpath", targetCP);
                }
            }
        }*/