Package com.sun.enterprise.config.serverbeans

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


            Server instanceBean = ServerBeansFactory.getServerBean(configCtx);
            appRef = instanceBean.getApplicationRefByRef(mBeanName);
                                                                                                                                              
            if (appRef == null) {
                //check at cluster level, if this instance is part of cluster
                Clusters clusters = domain.getClusters();
                Cluster[] cluster = clusters.getCluster();
                for (Cluster val : cluster) {
                    if ((val.getServerRefByRef(instanceName)) != null) {
                        appRef = val.getApplicationRefByRef(mBeanName);
                        break;
                    }
View Full Code Here


    }

    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))
                        return cl[i].getName();
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

            Server instanceBean = ServerBeansFactory.getServerBean(configCtx);
            appRef = instanceBean.getApplicationRefByRef(actionMBeanName);
       
            if (appRef == null) {
                //check at cluster level, if this instance is part of cluster
                Clusters clusters = domain.getClusters();
                Cluster[] cluster = clusters.getCluster();
                for (Cluster val : cluster) {
                    if ((val.getServerRefByRef(instanceName)) != null) {
                        appRef = val.getApplicationRefByRef(actionMBeanName);
                        break;
                    }
View Full Code Here

                    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);
            }       
        } catch (Exception ex) {
            throw getExceptionHandler().handleInstanceException(
                ex, "eeadmin.deleteCluster.Exception", clusterName);
        }
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);
       
            //Add the new cluster
            clusters.addCluster(cluster, OVERWRITE);           
           
            //FIXTHIS: We force persistence, clear any notifications, and update the
            //Application server's config context explicitely. Until this is modelled
            //as an event notification (TBD) we need this to happen before notifying or
            //the Node Agent will not synchronize the correct data.
View Full Code Here

    }

    private boolean addrAlreadyAssigned ( final String heartbeatAddress ) throws ConfigException {
        boolean exists = false;
        final Domain domain = ConfigAPIHelper.getDomainConfigBean(getConfigContext());
        final Clusters clusters = domain.getClusters();
        String cHbAddress;
        for(Cluster c : clusters.getCluster()){
            cHbAddress = c.getHeartbeatAddress();
            if(cHbAddress != null && heartbeatAddress.equals( cHbAddress)){
                exists = true;
                break;
            }
View Full Code Here

     */
    public static Cluster[] getClustersInDomain(ConfigContext configContext)
        throws ConfigException
    {
        final Domain domain = getDomainConfigBean(configContext)
        final Clusters clusters = domain.getClusters();
        if (clusters != null) {
            if (clusters.getCluster() != null) {
                return clusters.getCluster();
            }
        }           
        return new Cluster[0];
    }
View Full Code Here

     */
    public static boolean isACluster(ConfigContext configContext, String clusterName)
        throws ConfigException
    {       
        final Domain domain = getDomainConfigBean(configContext);       
        final Clusters clusters = domain.getClusters();
        if (clusters == null) {
            return false;
        }
        final Cluster cluster = clusters.getClusterByName(clusterName);
        return (cluster != null ? true : false);
    }
View Full Code Here

            if (server != null) {
                throw new ConfigException(_strMgr.getString(
                    "configurationNameAlreadyExistsAsServer", newConfigName));
            }

      Clusters clusters = domain.getClusters();
      Cluster cluster = clusters.getClusterByName(newConfigName);
            if (cluster != null) {
                throw new ConfigException(_strMgr.getString(
                    "configurationNameAlreadyExistsAsCluster", newConfigName));
            }
View Full Code Here

TOP

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

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.