Package com.sun.enterprise.config.serverbeans

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


        }
          
        try {
                  
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
            if (config == null) {
                return;
            }
           
            webContainer.updateAccessLog(config.getHttpService());

        } catch (Exception e) {
           throw new AdminEventListenerException(e);
        }
    }
View Full Code Here


            return;      
        }

        try {            
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
           
            if ( config == null) return;
           
            ConfigAdd configAdd = null;
            ArrayList configChangeList = event.getConfigChangeList();
            HttpListener httpBean = null;
            String xpath = null;
            Object object;
            Object configObject;
           
            for (int i=0; i < configChangeList.size(); i++){
                configObject = configChangeList.get(i);

                if ( configObject instanceof ConfigAdd) {
                    configAdd = (ConfigAdd)configObject;
                    xpath = configAdd.getXPath();
                    if( xpath != null){
                        object = configContext.exactLookup(xpath);
                        if ( object instanceof HttpListener){
                            httpBean = (HttpListener)object;
                            webContainer.createConnector(httpBean,
                                                         config.getHttpService());
                        }
                    }
                }
            }
        } catch (Exception ex) {
View Full Code Here

        //command.addJvmOption("-XX:+LogVMOutput");
        //command.addJvmOption("-XX:LogFile=" + logFile);
        //command.addJvmOption("-XX:LogFile=/tmp/threadDump.txt");
       
        // get server's config
        Config config=ServerHelper.getConfigForServer(configCtxt, serverName);
       
        // configure log service and print redirect message
        String logFile=configureLogService(config);
        if (bDebug) System.out.println("LOGFILE = " + logFile);
       
        // make sure log is writable, if not a message will be logged to the screen if in verbose mode
        createFileStructure(logFile);
        command.setLogFile(logFile);
       
        // should NOT need to addLogFileToLogger(logFile), logManager should already do this for us
        // may need to enable if log is movable ???
        //addLogFileToLogger(logFile);
       
        // add log to properties so PEMAIN will redirect is applicable
        command.addSystemVariable("-D" + LOGFILE_SYSTEM_PROPERTY + "=" + logFile);
       
        getLogger().log(Level.FINE,"Retrieved domain.xml from " + domainXMLLocation);
        getLogger().log(Level.FINE,"Start building the command the to execute.");
       
        //Set system properties that correspond directly to asenv.conf/bat. This
        //keeps us from having to pass them all from -D on the command line.
        ASenvPropertyReader reader = new ASenvPropertyReader(System.getProperty(SystemPropertyConstants.CONFIG_ROOT_PROPERTY));
        reader.setSystemProperties();
       
        // verbose set, flag used in ServerLogManager to send logs to stderr
        if (isVerboseEnabled()) {
            command.addSystemVariable("-D" + VERBOSE_SYSTEM_PROPERTY + "=true");
            // add to System.properties for config conditional adds (could be set about if not native launcher)
            System.setProperty(VERBOSE_SYSTEM_PROPERTY, "true");
        }
       
        // read in ProcessLauncherConfig
        String launcherConfigFile=System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY)
        + File.separator + "lib" + File.separator + "processLauncher.xml";
       
        String processName=System.getProperty(LAUNCHER_PROFILE_NAME, INTERNAL_SERVER_PROFILE);
        getLogger().log(Level.FINE,"Loading ProcessLauncher config from: " + launcherConfigFile
        + " - for the process named: " + processName);
       
        ProcessLauncherConfig plConfig=new ProcessLauncherConfig(launcherConfigFile, processName);
       
        // take plConfig properties as the base for the system jvm args for the new process
        Properties systemProperties=plConfig.getSystemProperties();

        // add domain.xml property elements to the jvm args in reverse order of precedence.
        // First add the domain properties
        addSystemProperties(domain.getSystemProperty(), systemProperties);

        // 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("-D" + 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,
View Full Code Here

            return;
        }
                                    
        try {                       
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
           
            if ( config == null) return;
           
            ConfigChange configChange = null;
            ArrayList<ConfigChange> configChangeList =
                event.getConfigChangeList();
            HttpListener httpBean = null;
            String xpath = null;
            String parentXpath = null;
            Object object;
            ElementProperty elementProperty = null;

            for (int i=0; i < configChangeList.size(); i++){
                configChange = configChangeList.get(i);
                xpath = configChange.getXPath();
                if (xpath != null) {
                    object = configContext.exactLookup(xpath);
                    if (object != null) {
                        if (object instanceof HttpListener) {
                           
                            if ( ((HttpListener)object).getDefaultVirtualServer()
                                    .equals(com.sun.enterprise.web.VirtualServer.ADMIN_VS)){
                               
                                if (configChangeList.size() == 1){
                                    throw new AdminEventListenerException("Restart required");
                                } else {
                                    continue;
                                }                               
                            }
                           
                            webContainer.updateConnector(
                                (HttpListener)object,
                                config.getHttpService(),
                                configContext);
                        } else if (object instanceof ElementProperty) {
                            // Property has been added or updated
                            parentXpath = configChange.getParentXPath();
                            if (parentXpath == null) {
                                parentXpath =
                                    xpath.substring(0, xpath.lastIndexOf("/"));
                            }
                            httpBean = (HttpListener)
                                configContext.exactLookup(parentXpath);
                            webContainer.updateConnector(
                                httpBean,
                                config.getHttpService(),
                                configContext);
                        }
                    } else {
                        // Property has been deleted
                        parentXpath =
                            xpath.substring(0, xpath.lastIndexOf("/"));
                        httpBean = (HttpListener)
                            configContext.exactLookup(parentXpath);
                        webContainer.updateConnector(
                            httpBean,
                            config.getHttpService(),
                            configContext);
                    }
                }
            }
        } catch (Exception ex) {
View Full Code Here

            return;      
        }

        try {
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
               
            if ( config == null) return;
               
            webContainer.deleteConnector(config.getHttpService());

        catch( Exception ex){
           throw new AdminEventListenerException(ex);
        }     
    }    
View Full Code Here

        }

        try {
                  
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
            if (config == null) {
                return;
            }
           
            webContainer.updateHttpService(config.getHttpService(),
                                           configContext);

        } catch (Exception e) {
           throw new AdminEventListenerException(e);
        }
View Full Code Here

            return;
        }
          
        try {                                                         
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
                                   
            if ( config == null) return;
           
            ConfigAdd configAdd = null;
            ArrayList configChangeList = event.getConfigChangeList();
            VirtualServer vsBean = null;
            String xpath = null;
            Server serverBean = ServerBeansFactory.getServerBean(configContext);
            ElementProperty elementProperty = null;
            Object object;
            Object configObject;
           
            for (int i=0; i < configChangeList.size(); i++){
                configObject = configChangeList.get(i);

                if ( configObject instanceof ConfigAdd) {
                    configAdd = (ConfigAdd)configObject;
                    xpath = configAdd.getXPath();
                    if( xpath != null){
                        object = configContext.exactLookup(xpath);

                        if ( object instanceof VirtualServer){
                            vsBean = (VirtualServer)object;
                            webContainer.createHost(vsBean,configContext,true);
                        } else if (object instanceof ElementProperty) {
                            xpath = xpath.substring(0,xpath.lastIndexOf("/"));
                            vsBean = (VirtualServer)configContext.exactLookup(xpath);                      
                            elementProperty = (ElementProperty)object;
                            webContainer.updateHostProperties(
                                       vsBean,
                                       elementProperty.getName(),
                                       elementProperty.getValue(),
                                       config.getHttpService(),
                                       config.getSecurityService());
                        }
                    }
                }
            }
        } catch (Exception ex) {
View Full Code Here

            return;
        }
          
        try {                                           
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
           
            if ( config == null) return;
           
            ConfigChange configChange = null;
            ArrayList<ConfigChange> configChangeList =
                event.getConfigChangeList();
            VirtualServer vsBean = null;
            String xpath = null;
            String parentXpath = null;
            Server serverBean = ServerBeansFactory.getServerBean(configContext);
            ElementProperty elementProperty = null;
            Object object;          

            for (int i=0; i < configChangeList.size(); i++){
                configChange = configChangeList.get(i);
               
                xpath = configChange.getXPath();
                if (xpath != null) {
                    object = configContext.exactLookup(xpath);
                    if (object != null) {
                        if ( object instanceof VirtualServer){
                            webContainer.updateHost((VirtualServer)object,
                                                    config.getHttpService(),
                                                    serverBean);
                        } else if (object instanceof ElementProperty) {
                            // Property has been added or updated
                            parentXpath = configChange.getParentXPath();
                            if (parentXpath == null) {
                                parentXpath =
                                    xpath.substring(0, xpath.lastIndexOf("/"));
                            }
                            vsBean = (VirtualServer)
                                configContext.exactLookup(parentXpath);
                            elementProperty = (ElementProperty)object;
                            webContainer.updateHostProperties(
                                       vsBean,
                                       elementProperty.getName(),
                                       elementProperty.getValue(),
                                       config.getHttpService(),
                                       config.getSecurityService());
                        }

                    } else {
                        // Property has been deleted.
                        // Determine the property's name
                        int lastSlash = xpath.lastIndexOf("/");
                        parentXpath = xpath.substring(0, lastSlash);
                        String propName = xpath.substring(lastSlash);
                        if (propName != null) {
                            // e.g., /element-property[@name='sso-enabled']
                            int beginQuote = propName.indexOf("'");
                            int endQuote = propName.lastIndexOf("'");
                            if (endQuote > beginQuote) {
                                propName = propName.substring(beginQuote+1,
                                                              endQuote);
                                vsBean = (VirtualServer)
                                    configContext.exactLookup(parentXpath);
                                webContainer.updateHostProperties(
                                       vsBean,
                                       propName,
                                       null,
                                       config.getHttpService(),
                                       config.getSecurityService());
                            }
                        }
                    }
                }
            }
View Full Code Here

            return;      
        }

        try {
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
            if (config != null) {
                webContainer.deleteHost(config.getHttpService());   
            }
        } catch( Exception ex){
           throw new AdminEventListenerException(ex);
        }   
    }
View Full Code Here

            return;
        }

        try {
            ConfigContext configContext = event.getConfigContext();
            Config config = ServerBeansFactory.getConfigBean(configContext);
            if (config == null) {
                return;
            }
            webContainer.updateHttpService(config.getHttpService(),
                                           configContext);
        } catch (Exception e) {
           throw new AdminEventListenerException(e);
        }
    }
View Full Code Here

TOP

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

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.