Package com.sun.enterprise.config.serverbeans

Examples of com.sun.enterprise.config.serverbeans.Cluster$DeleteDecorator


        return ( health );
    }
   
    private boolean gmsEnabled(final String cn) throws InstanceException {
        try {
            final Cluster cluster = ClusterHelper.getClusterByName(acc, cn);
            final boolean gms = cluster.isHeartbeatEnabled();
            return ( gms );
        } catch(final Exception e) {
            throw new InstanceException(e);
        }
    }
View Full Code Here


        = 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,
                                        "domain for instance - " + domainName);
                            props.setProperty(EEScriptsTokens.DOMAIN_NAME,
                                              domainName);

                            if (ServerHelper.isServerClustered(
                                  getConfigContext(), servers[ii].getName())) {
                                try {
                                    // see if part of cluster
                                    cluster = ClusterHelper.getClusterForInstance(
                                      getConfigContext(), servers[ii].getName());
                                    if (cluster != null)
                                        clusterArg = "-D" + CLUSTER_NAME + "=\""
                                                   + cluster.getName() + "\"";                                   
                                } catch (ConfigException ce) {
                                    // show at finest, because the server may
                                    // not be part of cluster
                                    getLogger().log(Level.FINEST,
                                        "Server isn't part of cluster", ce);
View Full Code Here

        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);
View Full Code Here

        } catch (ConfigException ex) {}
        if(!isClustered) {
            result = serverName + "_nc";    //non-clustered example: server1_nc
            return result;
        }
        Cluster cluster = null;
        try {
            cluster = ClusterHelper.getClusterForInstance(configCtx, serverName);
        } catch (ConfigException ex) {}
        if(cluster != null) {
            result = cluster.getName();
        }
        return result;
    }   
View Full Code Here

        throws InstanceException
    {              
        try{                     
            final ConfigContext configContext = getConfigContext();
            //validate that the cluster exists
            Cluster cluster = ClusterHelper.getClusterByName(configContext,
                clusterName);
           
            //Ensure that the cluster contains no server instances
            Server[] servers = ServerHelper.getServersInCluster(configContext,
                clusterName);
            if (servers.length > 0) {
                throw new InstanceException(_strMgr.getString("clusterNotEmpty",
                    clusterName, ServerHelper.getServersAsString(servers)));
            }                                              
           
            //Remove the the cluster. This is the last thing we want to do.
            Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);
            Clusters clusters = domain.getClusters();                      
                         
            //If the cluster is stand-alone, we must remove its stand alone
            //configuration. Only non-referenced configurations can be deleted,
            //this is why the configuration is first deleted. Unfortunately, if
            //this fails, we leave an unreferenced standalone configuration.
            if (ClusterHelper.isClusterStandAlone(configContext, clusterName)) {
                //Remove the cluster first
                String configName = cluster.getConfigRef();
                clusters.removeCluster(cluster, OVERWRITE);
                //Remove the standalone configuration                                            
                getConfigsConfigBean().deleteConfiguration(configName);
            } else {
                clusters.removeCluster(cluster, OVERWRITE);
View Full Code Here

            //Ensure that cluster specified by clusterName does not already exist.
            //Given that we've already checked for uniqueness earlier, this should never
            //be the case, but we'll be extra safe here.
            Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);           
            Clusters clusters = domain.getClusters();
            Cluster cluster = clusters.getClusterByName(clusterName);
            if (cluster != null) {
                throw new InstanceException(_strMgr.getString("clusterAlreadyExists",
                    clusterName));
            }
   
            //Create the new cluster instance
            cluster = new Cluster();           
            cluster.setName(clusterName);
   
           
            if (configName != null) {                    
                //A shared cluster has its configuration pre-created.
                //Get the configuration specified by configName and ensure that it exists
                //is valid.
                Config config = validateSharedConfiguration(configContext, configName);
                cluster.setConfigRef(configName);
                //add system properties into cluster element itself
                if (props != null) {           
                    for (Enumeration e = props.propertyNames(); e.hasMoreElements() ;) {
                        String propName = (String)e.nextElement();
                        String propValue = (String)props.getProperty(propName);
                        if (propValue != null) {
                            SystemProperty ep = new SystemProperty();
                            ep.setName(propName);
                            ep.setValue(propValue);                   
                            cluster.addSystemProperty(ep, OVERWRITE);
                        }
                    }
                }
            } else {
                //For a standalone cluster, we need to create a standalone configuration.
                //Create the standalone configuration to be referenced by the server
                //FIXTHIS: Currently properties are passed when creating a standalone configuration
                //to override defaults in the default configuration. We need to be consistent
                //with properties passed during server instance creation and do one of the following:
                //Currently Aspproach #2 is implemented.
                //1) add property support at the cluster level (domain, configuration, cluster, instance)
                //2) use the properties passed at standalone cluster creation in a manner
                //similar to standalone cluster creation.               
                //FIXTHIS: One issue is that the call below will result in a call to flushAll
                //which is also called below. This must be taken into account when we
                //figure out the notification story.
                String stanaloneConfigName = getConfigsConfigBean().createStandAloneConfiguration(
                    clusterName, props);
                cluster.setConfigRef(stanaloneConfigName);
            }
            setHeartbeatAddressAndPort(cluster);
            //Add system applications and resources
            addSystemApplications(cluster);
            addSystemResources(cluster);
View Full Code Here

                addProperties(result, domain.getSystemProperty());
                final Config config = ClusterHelper.getConfigForCluster(configContext,
                    target.getName());
                addProperties(result, config.getSystemProperty());
            }
            final Cluster cluster = ClusterHelper.getClusterByName(configContext,
                target.getName());
            addProperties(result, cluster.getSystemProperty());
        } else if (target.getType() == TargetType.SERVER ||
            target.getType() == TargetType.DAS) {           
            //list server properties
            final Server server = ServerHelper.getServerByName(configContext,
                target.getName());
            if (inherit) {
                final Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);           
                addProperties(result, domain.getSystemProperty());

                final Config config = ConfigAPIHelper.getConfigByName(configContext, server.getConfigRef());
                addProperties(result, config.getSystemProperty());
                if (ServerHelper.isServerClustered(configContext, target.getName()))  {
                    final Cluster cluster = ClusterHelper.getClusterForInstance(configContext,
                        target.getName());
                    addProperties(result, cluster.getSystemProperty());
                }       
            }
            addProperties(result, server.getSystemProperty());
        } else {
            //list node agent properties. Shouldnt happen.
View Full Code Here

                    }
                    config.addSystemProperty(getSystemProperty(props, name),
                        OVERWRITE);
                }                     
            } else if (target.getType() == TargetType.CLUSTER) {
                final Cluster cluster = ClusterHelper.getClusterByName(configContext,
                    target.getName());
                //Add the properties
                for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
                    final String name = (String)e.nextElement();
                    //If the property exists, remove it
                    final SystemProperty sysProp = cluster.getSystemPropertyByName(name);
                    if (sysProp != null) {
                        cluster.removeSystemProperty(sysProp, OVERWRITE);
                    }                                    
                    cluster.addSystemProperty(getSystemProperty(props, name),
                        OVERWRITE);
                }                
            } else if (target.getType() == TargetType.SERVER ||
                target.getType() == TargetType.DAS) {
                    createServerProperties(target, props);               
View Full Code Here

                }
                //Remove the property
                config.removeSystemProperty(sysProp, OVERWRITE);
            } else if (target.getType().equals(TargetType.CLUSTER)) {
                //create instance property                      
                final Cluster cluster = ClusterHelper.getClusterByName(configContext,
                    target.getName());
                final SystemProperty sysProp = cluster.getSystemPropertyByName(propertyName);
                //Ensure that the property specified exists
                if (sysProp == null) {
                    throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
                        propertyName, target.getName()));
                }
                //Remove the property
                cluster.removeSystemProperty(sysProp, OVERWRITE);
            } else if (target.getType().equals(TargetType.SERVER) ||
                target.getType().equals(TargetType.DAS)) {
                //create instance property                      
                final Server server = ServerHelper.getServerByName(configContext, target.getName());
                final SystemProperty sysProp = server.getSystemPropertyByName(propertyName);
View Full Code Here

        ClusterRef cRef = lbConfig.getClusterRefByRef(clusterName);
        if (cRef == null) {
            // does not exist, just return from here
            return;
        }
        Cluster c = null;
        try {
            ConfigContext ctx = AdminService.getAdminService().getAdminContext()
                                    .getAdminConfigContext();
            c = ClusterHelper.getClusterByName(ctx, clusterName);
        } catch (ConfigException ce) {
            throw new MBeanException(ce);
        }
        if ( c == null ) {
            String msg = _strMgr.getString("ClusterNotDefined", clusterName);
            throw new MBeanException (new ConfigException(msg));
        }
        ServerRef[] sRefs = c.getServerRef();
        for (int i=0; i < sRefs.length; i++) {
            if (sRefs[i].isLbEnabled()) {
                String msg = _strMgr.getString("ServerNeedsToBeDisabled", clusterName);
                throw new MBeanException (new ConfigException(msg));
            }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.Cluster$DeleteDecorator

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.