Package com.sun.enterprise.config.serverbeans

Examples of com.sun.enterprise.config.serverbeans.JavaConfig


    }

    private static String getJavaHome(Server server, ConfigContext ctx)
        throws ConfigException
    {
        final JavaConfig javaConfig = getConfig(server, ctx).getJavaConfig();
        return javaConfig.getJavaHome();
    }
View Full Code Here


        // set config name (which is retrieved from domain.xml) into System properties to be used for path resolution
        System.setProperty(SystemPropertyConstants.CONFIG_NAME_PROPERTY, configRef);
        systemProperties.put(SystemPropertyConstants.CONFIG_NAME_PROPERTY, configRef);
       
        // get javaconfig for server that is being started
        JavaConfig javaConfig=config.getJavaConfig();
       
        // derive and add java command to Command
        String jvmCmd=javaConfig.getJavaHome() + File.separator + "bin"
                + File.separator + "java";
       
        command.setJavaCommand(jvmCmd);
       
       
        // fix for bug# 6323645
        // Do not add options which are not applicable for stop action.
        // For ex. debug options and profiler options.
        // In other words add the following options ony when the action
        // is other than stop.
       
        Profiler profiler=javaConfig.getProfiler();
        String profilerClasspath=null;
       
        if (!action.equals(LAUNCHER_STOP_ACTION))
        {
           
            // The debug options including the debug port would be added
            // to the command  when the action is start.
            // If the action is stop adding the same port to the java command
            // would stack up the ports and block until the port assigned for
            // start action is released. To avoid this we check for stop action.
           
            // If the stop action needs to be debugged then one work around is to
            // copy the java command from server.log, change the debug settings and
            // run the command.
           
            // debug options
            if ((javaConfig.isDebugEnabled() || isDebugEnabled()))
            {
                // add debug statements
                addDebugOptions(command, javaConfig.getDebugOptions());
            }
           
            // add profiler properties & jvm args
            if (profiler != null && profiler.isEnabled())
            {
                // add config properties
                addElementProperties(profiler.getElementProperty(), systemProperties);
                String [] jvmOptions=profiler.getJvmOptions();
                addJvmOptions(command, jvmOptions, action);
                profilerClasspath=profiler.getClasspath();
            }
        }
       
        // set the default locale specified in domain.xml config file
        String locale=domain.getLocale();
        if (locale == null || locale.equals(""))
        {
            // if not specified in domain try system
            locale=System.getProperty(SystemPropertyConstants.DEFAULT_LOCALE_PROPERTY);
        }
        // make sure locale is specified before setting it
        if (locale != null && !locale.equals(""))
        {
            command.addSystemVariable(SystemPropertyConstants.DEFAULT_LOCALE_PROPERTY, locale);
        }
        //
        // add jvm args, look for combined jvm options
        String[] jvmOptions=javaConfig.getJvmOptions();
        addJvmOptions(command, jvmOptions, action);
       
        //
        // add config system properties
        addSystemProperties(config.getSystemProperty(), systemProperties);
       
        //
        // add cluster system properties if the server instance is clustered
        if (ServerHelper.isServerClustered(configCtxt, server))
        {
            Cluster cluster = ClusterHelper.getClusterForInstance(configCtxt,
                    server.getName());
            addSystemProperties(cluster.getSystemProperty(), systemProperties);
        }
       
        //
        // add server system properties
        addSystemProperties(server.getSystemProperty(), systemProperties);
       
        //
        // add classpath
        // check to see if jvmCmd starts with same as processLauncher jvm.
        // if so, use the system property java-version to determine jvm version
        if(OS.isWindows())
        {
            // make sure all delimeters are the same
            jvmCmd=jvmCmd.replace('/', '\\');
        }
       
        if (jvmCmd.startsWith(System.getProperty(SystemPropertyConstants.JAVA_ROOT_PROPERTY)))
        {
            // jvm command are the same, so use processLauncher jvm version
            jvmCmd=null;
        }
        String classpath=deriveClasspath(plConfig, jvmCmd, javaConfig, profilerClasspath);
        getLogger().log(FINE_LEVEL, "Complete process classpath = " + classpath);
        command.setClasspath(classpath);
       
        //
        //add main class
        command.setMainClass(plConfig.getMainClass());
       
        //
        // native library path to java path and system properties
        deriveNativeClasspath(command, javaConfig, profiler, systemProperties);
       
        //
        // add all system properties to command as jvm args
        Iterator it=systemProperties.keySet().iterator();
        String key=null;
        String property=null, value=null;;
        while(it.hasNext())
        {
            key=(String)it.next();
            value=systemProperties.getProperty(key);
           
            // take care of vm arg that are sent in via the processlauncher.xml file
            if (key.startsWith("-"))
            {
                property = key;
                if (value != null && !value.equals(""))
                {
                    property += "=" + value;
                }
                command.addJvmOption(property);
                getLogger().log(FINE_LEVEL, "JVM Option: " + property);
            }
            else
            {
                // regular system property
                property = "-D" + key + "=" + value;
                command.addSystemVariable(key, value);
                getLogger().log(FINE_LEVEL, "System Property: " + property);
            }
        }
       
        //Add prefix and suffix for AS9Profile
        if (getProcessLauncherProfile().equals(AS9_INTERNAL_SERVER_PROFILE))
        {
            String classpathPrefix=javaConfig.getClasspathPrefix();

            // WBN Oct 2007 -- possibly add the uer's CP to suffix...
            String classpathSuffix=getClasspathSuffix(javaConfig);          

            String serverClasspath=javaConfig.getServerClasspath();
            getLogger().log(FINE_LEVEL, " prefix :: " + classpathPrefix
                    + " suffix :: " + classpathSuffix);
            if (classpathPrefix == null) classpathPrefix = "";
            command.addSystemVariable(CLASSPATH_PREFIX_PROPERTY, classpathPrefix);
            if (classpathSuffix == null) classpathSuffix = "";
View Full Code Here

    private final boolean isDebug()
    {
        boolean isDebug = false;
        try
        {
            JavaConfig jvmConfig = getJavaConfigBean();
            String value = jvmConfig.getAttributeValue(
                                ServerTags.DEBUG_ENABLED);
            if (value != null)
            {
                isDebug = Boolean.valueOf(value).booleanValue();
            }
View Full Code Here

    /**
     * Sets the debug-enabled attribute of the java-config element.
     */
    private final void setDebug(boolean debug) throws Exception
    {
        JavaConfig  jvmConfig   = getJavaConfigBean();
        String      value       = String.valueOf(debug);
        jvmConfig.setAttributeValue(ServerTags.DEBUG_ENABLED, value);
    }
View Full Code Here

    /**
     * Sets the debug-options attribute of the java-config element.
     */
    private final void setDebugOptions(String options) throws Exception
    {
        JavaConfig jvmConfig = getJavaConfigBean();
        jvmConfig.setAttributeValue(ServerTags.DEBUG_OPTIONS, options);
    }
View Full Code Here

    /**
     * Gets the debug-options attribute of the java-config element.
     */
    private final String getDebugOptions() throws Exception
    {
        JavaConfig jvmConfig = getJavaConfigBean();
        return jvmConfig.getAttributeValue(ServerTags.DEBUG_OPTIONS);
    }
View Full Code Here

    private final JavaConfig getJavaConfigBean() throws Exception
    {
//ms1        Server server = (Server) super.getBaseConfigBean();
//ms1        assert server != null;
        Config          config  = (Config) super.getConfigBeanByXPath(ServerXPathHelper.XPATH_CONFIG);
        JavaConfig jvmConfig = config.getJavaConfig();
        jvmConfig.setConfigContext(super.getConfigContext());
        return jvmConfig;
    }
View Full Code Here

            jmsService = (JmsService)ConfigBeansFactory.getConfigBeanByXPath(
                configContext, ServerXPathHelper.XPATH_JMS_SERVICE);
       
            if ((jmsService != null) && (jmsService.isEnabled()))  {
                JMSAdmin  jmsAdmin = null;
                JavaConfig  javaConfig;
                    String    java_home = null,
                    domainName = null,
                        mqInstanceName = null,
                        mqBin = null,
                    argArray[] = new String [ 4 ];

                javaConfig = (JavaConfig)ConfigBeansFactory.getConfigBeanByXPath(
                configContext, ServerXPathHelper.XPATH_JAVACONFIG);
                java_home = javaConfig.getJavaHome();

                mqBin = System.getProperty("com.sun.aas.imqBin");
                domainName = ServerManager.instance().getDomainName();

                jmsAdmin = IASJmsUtil.getJMSAdminFactory().getJMSAdmin();
View Full Code Here

            element.setClasspath(classpath);
        if(nativeLibraryPath!=null)
            element.setNativeLibraryPath(nativeLibraryPath);
        if(enabled!=null)
            element.setEnabled(enabled.booleanValue());
        JavaConfig  javaConfig  = (JavaConfig)getBaseConfigBean();
        javaConfig.setProfiler(element);
       
        getConfigContext().flush();
    }
View Full Code Here

    This operation deletes Profiler according to id if it connected to current HTTP Service.
    @throws ConfigException in case of failure.
     */
    public void deleteProfiler() throws ConfigException
    {
        JavaConfig  javaConfig  = (JavaConfig)getBaseConfigBean();
        javaConfig.setProfiler(null);
        getConfigContext().flush();
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.JavaConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.