Package com.sun.enterprise.config.serverbeans

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


        ArrayList list = new ArrayList();
        Domain domain = (Domain) ctx.getRootConfigBean();
        Applications applications = domain.getApplications();

        Cluster cluster = domain.getClusters().getClusterByName(clusterName);
        if (cluster != null) {
            ConnectorModule[] connMods = applications.getConnectorModule();
            for (int i=0; i < connMods.length; i++) {
                if (clusterReferencesApplication(ctx, clusterName,
                                                connMods[i].getName()) ) {
View Full Code Here


        throws ConfigException, InstanceException
    {
        //If the instance is clustered, the we must remove the server refs from
        //the cluster.
        final ConfigContext configContext = getConfigContext();
        final Cluster cluster = ClusterHelper.getClusterForInstance(configContext, serverName);
        final ServerRef ref = cluster.getServerRefByRef(serverName);
        if (ref == null) {
            throw new InstanceException(_strMgr.getString("clusterMissingServerRef",
                cluster.getName(), serverName));
        } else {
            cluster.removeServerRef(ref, OVERWRITE);
        }
    }
View Full Code Here

        final ConfigContext configContext = getConfigContext();
        //Add properties
        addServerProperties(server, props);
       
        //Get the configuration specified by configName and ensure that it exists
        Cluster cluster = ClusterHelper.getClusterByName(configContext,
            clusterName);
       
       
        //The clustered server inherits its configuration from the cluster
        server.setConfigRef(cluster.getConfigRef());

        //Now add the new server instance
        // to avoid Validator's complains
        Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);
        domain.getServers().addServer(server, OVERWRITE);                       
       
        //Add the server to the cluster
        ServerRef serverRef = new ServerRef();
        serverRef.setRef(server.getName());
        cluster.addServerRef(serverRef, OVERWRITE);
       
       
        //The clustered server inherits its applications from the cluster
        ApplicationRef[] appRefs = cluster.getApplicationRef();       
        for (int i = 0; i < appRefs.length; i++) {
            addApplicationReference(server, appRefs[i].isEnabled()
                appRefs[i].getRef(), appRefs[i].getVirtualServers());
        }
       
        //The clustered server inherits its resources from the cluster
        ResourceRef[] resRefs = cluster.getResourceRef();
        ResourceRef resRef = null;
        for (int i = 0; i < resRefs.length; i++) {
            addResourceReference(server, resRefs[i].isEnabled(),
                resRefs[i].getRef());
        }
View Full Code Here

        
   assertNotSame(server1, server2);
   final ConfigContext configContext = getConfigContext();
       
 
         Cluster cluster1 =
            ClusterHelper.getClusterForInstance(configContext, server1);
         Cluster cluster2 =
            ClusterHelper.getClusterForInstance(configContext, server2);
        
         if (cluster1 == null || cluster2 == null ||
                !cluster1.getName().equals(cluster2.getName()) ) {
                   
             throw new ConfigException (
                            _strMgr.getString("serversNotSiblings",
                                              server1, server2));
         }
View Full Code Here

         }
     }
    
     private String getOneAliveSiblingServer(String sourceServerName)
        throws ConfigException, InstanceException {
         Cluster cluster1 = getClusterForInstance(sourceServerName);
         String[] servers = getServersInCluster(cluster1.getName());
         
         if (servers!= null && servers.length > 0) {
             for(int i = 0; i < servers.length; i++) {
                 String name = servers[i];
                 if(!name.equals(sourceServerName) &&
                             isServerRunning(name)) {
                     return name;
                 }
             }
         }    
         
          throw new ConfigException (
                            _strMgr.getString("noAliveSibling",
                                              cluster1.getName(),
                                              sourceServerName));        
     }
View Full Code Here

                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

        Cluster[] ca = new Cluster[l.size()];
        final Iterator it = l.iterator();
        for (int i = 0; i < ca.length; i++)
        {
            MockCluster mc = (MockCluster)it.next();
            ca[i] = new Cluster();
            ca[i].setName(mc.getName());
        }
        return ca;
    }
View Full Code Here

                throws MBeanException
    {
        // check if this server is part of cluster, then
        // turn on lb-enable flag in the cluster.

        Cluster c= null;
        try {
            c = ClusterHelper.getClusterForInstance(ctx, target)
        } catch(ConfigException ce){
        }
                   
        if (c== null) {
            String msg = _strMgr.getString("ServerNotDefined", target);
            throw new MBeanException (new RuntimeException(msg));
        } else {
            return c.getServerRefByRef(target);
        }
    }
View Full Code Here

    {         
        if ( timeout < 0 ) {
            String msg = _strMgr.getString("InvalidNumber");
            throw new MBeanException ( new ConfigException(msg));
        }
        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++) {
            sRefs[i].setLbEnabled(false);
            sRefs[i].setDisableTimeoutInMinutes(
                    new Integer(timeout).toString());
        }
View Full Code Here

        }
    }

    private void enableCluster(String clusterName) throws MBeanException
    {         
        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++) {
            sRefs[i].setLbEnabled(true);
        }
    }
View Full Code Here

TOP

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

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.