Package com.sun.enterprise.config.serverbeans

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


        return gmsMap;
    }

    public static String getClusterName(String instanceName) {
        try {
            Domain domain = (Domain) ctx.getRootConfigBean();
            Clusters clusters = domain.getClusters();
            Cluster[] cl = clusters.getCluster();
            for (int i=0; i < cl.length; i++) {
                ServerRef[] sRefs = cl[i].getServerRef();
                for (int j=0; j < sRefs.length; j++) {
                    if (sRefs[j].getRef().equals(instanceName))
View Full Code Here



    private static void invokeGMS(ConfigContext configContext, String nodeAgentName) {
        Properties props = new Properties();
        try {
            Domain domain = (Domain) configContext.getRootConfigBean();
            Clusters clusters = domain.getClusters();
            Cluster[] cl = clusters.getCluster();
            Server[] servers = ServerHelper.getServersOfANodeAgent(configContext, nodeAgentName);
            Server aServerContextOfNodeAgent = null;
            if (servers != null && servers.length >=1) {
                aServerContextOfNodeAgent = servers[0];
View Full Code Here

   
    private com.sun.enterprise.config.serverbeans.NodeAgent
        getNodeAgentConfigBean(ConfigContext configCtxt)
        throws ConfigException {                       
        // get the servers that currently exist in domain xml
        Domain domain = ConfigAPIHelper.getDomainConfigBean(configCtxt)
        // get node controller config bean       
        return domain.getNodeAgents().getNodeAgentByName(getNodeAgentName());
    }
View Full Code Here

                        "Reconciling existing Node Configuration with " +
                        "configuration that is in domain.xml");
        Vector createdInstances=new Vector();
        try {           
            // get the servers that currently exist in domain xml
            Domain domain = ConfigAPIHelper.getDomainConfigBean(
                                getConfigContext())
            Server[] servers=domain.getServers().getServer();
           
            // get EEInstancesManager and get instances that currently
            // physically exist in repository
            InstanceConfig instanceConfig = new InstanceConfig(
                                            InstanceDirs.getInstanceRoot());
            EEInstancesManager eeInstancesManager = new EEInstancesManager(
                                                    instanceConfig);
            HashMap hmInstances = getInstancesAndStatus(
                                  instanceConfig, eeInstancesManager);
            // loop through for creatation of instances boolean match = false;
            Iterator serverIt = null;
            String instanceName = null;
            int status = 0;
           
            // get node controller config bean from domain
            com.sun.enterprise.config.serverbeans.NodeAgent nodeController
        = getNodeAgentConfigBean(getConfigContext());

            if (nodeController != null) {
                Properties props = null;
                ElementProperty elementProperty = null;
                Cluster cluster = null;
                // need a default, can't have %%%DOMAIN_NAME%%% go into
                // running server
                String domainName="DomainPropertyNotFound";
                // set default to "" because this string will actual be placed
                // in the startserv's java command for starting the instance
                // via the ProcessLauncher. This is the easiest way to have the
                // com.sun.aas.clusterName set to null for a standalone Instance
                String clusterArg = "";
               
                for (int ii = 0; ii < servers.length; ii++) {
                    // check to see if the server belongs to this
                    // node agent (repository)
                    if (instanceConfig.getRepositoryName().equals(
                            servers[ii].getNodeAgentRef())) {
                        // check if instance already exists or
                        // needs to be created.
                        if (instanceExists(servers[ii].getName())) {
                            getLogger().log(Level.INFO,
                            "nodeagent.instance.exists", servers[ii].getName());
                        } else {
                            // instance does not exist so create it
                            getLogger().log(Level.INFO,
                            "nodeagent.create.instance", servers[ii].getName());
                            instanceConfig.setInstanceName(servers[ii].getName());
                            // set properties for token replacing startserv scripts
                            props = new Properties();
                            // add proper domain
                            elementProperty = domain.getElementPropertyByName(
                                           DOMAIN_XML_DOMAIN_NAME_PROPERTY_NAME);
                            if (elementProperty != null)
                               domainName=elementProperty.getValue();
                           
                            getLogger().log(Level.INFO,
View Full Code Here

       
        // derive domain.xml location and create config to be used by config api
        String domainXMLLocation=System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY)
        + RELATIVE_LOCATION_DOMAIN_XML;
        ConfigContext configCtxt=ConfigFactory.createConfigContext(domainXMLLocation);
        Domain domain=ConfigAPIHelper.getDomainConfigBean(configCtxt);
        // get the server's config by name, need it as soon as possible for logging
        String serverName=System.getProperty(SystemPropertyConstants.SERVER_NAME);
        Server server=ServerHelper.getServerByName(configCtxt, serverName);
        String configRef=server.getConfigRef();
       
        // create the command to execute
        Command command=new Command();
       
        // set jvmargs for thread dump to go to child process log, workaround for bug #4957071
        //command.addJvmOption("-XX:+UnlockDiagnosticVMOptions");
        //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
View Full Code Here

            try {
                // derive domain.xml location and create config to be used by config api
                String domainXMLLocation=System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY)
                + RELATIVE_LOCATION_DOMAIN_XML;
                ConfigContext configCtxt=ConfigFactory.createConfigContext(domainXMLLocation);
                Domain domain=ConfigAPIHelper.getDomainConfigBean(configCtxt);

                // get the nodeagent by name, need it as soon as possible for logging
                String nodeAgentName=System.getProperty(SystemPropertyConstants.SERVER_NAME);
                NodeAgent nodeAgent=NodeAgentHelper.getNodeAgentByName(configCtxt, nodeAgentName);
                LogService logService=nodeAgent.getLogService();
View Full Code Here

    * Get the applications element from domain.xml.
    * return null if not found
    */    
    private Applications getApplicationsBean() {
        Applications applicationsBean = null;
        Domain domainBean = null;
        /*
        ServerContext serverCtx = ApplicationServer.getServerContext();
        ConfigContext configCtx = serverCtx.getConfigContext();
         */
        ConfigContext configCtx = this.getConfigContext();
        try {
            domainBean = ServerBeansFactory.getDomainBean(configCtx);
            if(domainBean != null) {
                applicationsBean = domainBean.getApplications();
            }
        } catch (ConfigException ex) {}

        return applicationsBean;
    }
View Full Code Here

    * Get the applications element from domain.xml.
    * return null if not found
    */    
    private Applications getApplicationsBeanDynamic() {
        Applications applicationsBean = null;
        Domain domainBean = null;
        ConfigContext configCtx = this.getConfigContextDynamic();
        try {
            domainBean = ServerBeansFactory.getDomainBean(configCtx);
            if(domainBean != null) {
                applicationsBean = domainBean.getApplications();
            }
        } catch (ConfigException ex) {}

        return applicationsBean;
    }   
View Full Code Here

        }
       
        try {
            if (actionMBeanName != null) {
           
                Domain domain = ServerBeansFactory.getDomainBean(configCtx);
                ApplicationRef appRef = verifyActionMBean(actionMBeanName, domain,
                                                          ctxToUse);
      
      
                if (appRef != null) {
                    Applications apps = domain.getApplications();
                    Mbean definedMBean = apps.getMbeanByName(actionMBeanName);   
               
                  
                    if (appRef.isEnabled() && definedMBean.isEnabled() ) {
                        if ((definedMBean.getObjectType()).equals(USER_DEFINED_TYPE)) {
View Full Code Here

      Event ruleEvent = ruleInstance.getEvent();
      ObjectName actionObjName = null;
      Object alertAction = null;   

      try {
          Domain domain = ServerBeansFactory.getDomainBean(ctxToUse);
          ApplicationRef appRef = verifyActionMBean(actionMBeanName, domain, ctxToUse);


          if (appRef != null) {
              Applications apps = domain.getApplications();
              Mbean definedMBean = apps.getMbeanByName(actionMBeanName);


              if (appRef.isEnabled() && definedMBean.isEnabled() ) {
                  if ((definedMBean.getObjectType()).equals(USER_DEFINED_TYPE)) {
View Full Code Here

TOP

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

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.