Package com.sun.enterprise.config.serverbeans

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


            for (int i=0; i<lbConfigs.length; i++) {

                // target is a cluster
                if (ClusterHelper.isACluster(ctx, target)) {
                    ClusterRef  cRef = lbConfigs[i].getClusterRefByRef(target);

                    // this lb config has a reference to the target cluster
                    if (cRef != null) {
                        list.add(lbConfigs[i]);
                    }
View Full Code Here


            if (interval != null)  { hc.setIntervalInSeconds(interval); }
            if (timeout != null)   { hc.setTimeoutInSeconds(timeout);   }

            // target is a cluster
            if (ClusterHelper.isACluster(ctx, target)) {
                ClusterRef  cRef = lbConfig.getClusterRefByRef(target);

                // cluster is not associated to this lb config
                if ((cRef == null) && (ignoreError == false)){
                    String msg = _strMgr.getString("UnassociatedCluster",
                                                    lbConfigName, target);
                    throw new MBeanException (new ConfigException(msg));
                }

                if ( (cRef != null) && (cRef.getHealthChecker() == null) ){
                    cRef.setHealthChecker(hc);
                        _logger.log(Level.INFO,_sMgr.getString(
                            "http_lb_admin.HealthCheckerCreated", target));
                } else {
                    if (ignoreError == false) {
                        String msg = _strMgr.getString("HealthCheckerExists",
                                             cRef.getRef());
                        throw new MBeanException (new ConfigException(msg));
                    }
                }

            // target is a server
View Full Code Here

                                .getAdminConfigContext();

        try {
            // target is a cluster
            if (ClusterHelper.isACluster(ctx, target)) {
                ClusterRef  cRef = lbConfig.getClusterRefByRef(target);

                // cluster is not associated to this lb config
                if ((cRef == null) && (ignoreFailure == false)){
                    String msg = _strMgr.getString("UnassociatedCluster",
                                                    lbConfigName, target);
                    throw new MBeanException (new ConfigException(msg));
                }

                HealthChecker hc = cRef.getHealthChecker();
                if (hc != null) {
                    //cRef.removeHealthCheker(hc);
                    cRef.removeChild(hc, true);
                    _logger.log(Level.INFO,_sMgr.getString(
                            "http_lb_admin.HealthCheckerDeleted", target));
                } else {
                   if (ignoreFailure == false) {
                       String msg = _strMgr.getString("HealthCheckerDoesNotExist",
View Full Code Here

                        if(!ApplicationHelper.isSystemApp(ctx, ref.getRef()))
                            ref.setLbEnabled(enableApps);
                    }
                }
                if(lbPolicy != null) {
                    ClusterRef cRef = lbConfig.getClusterRefByRef(target);
                    cRef.setLbPolicy(lbPolicy);
                }
                if(lbPolicyModule != null){
                    ClusterRef cRef = lbConfig.getClusterRefByRef(target);
                    cRef.setLbPolicyModule(lbPolicyModule);
                }
               
            }
        } catch(ConfigException ce) {
            throw new MBeanException(ce);
View Full Code Here

    private void addClusterToLbConfig(String configName, String clusterName
            throws MBeanException
    {         
        LbConfig lbConfig = getLbConfig(configName);

        ClusterRef cRef = lbConfig.getClusterRefByRef(clusterName);
        if (cRef != null) {
            // already exists
            return;
        }
        cRef = new ClusterRef();
        cRef.setRef(clusterName);
        try {
            lbConfig.addClusterRef(cRef);
        } catch (ConfigException ce) {
            throw new MBeanException (ce);
        }
View Full Code Here

    private void deleteClusterFromLBConfig(String configName,
            String clusterName) throws MBeanException
    {         
        LbConfig lbConfig = getLbConfig(configName);

        ClusterRef cRef = lbConfig.getClusterRefByRef(clusterName);
        if (cRef == null) {
            // does not exist, just return from here
            return;
        }
        Cluster c = null;
View Full Code Here

        if (lbConfigs == null) {
             return ;
         }

        LbConfig lbConfig = lbConfigs.getLbConfigByName(LBNAME);
        ClusterRef cRef = lbConfig.getClusterRefByRef(CLNAME);

        impl = new ClusterReaderImpl(ctx,cRef);

    }
View Full Code Here

    }

    private void addClusterToLbConfig(final LbConfigs lbconfigs, final String configName, final String clusterName) {
        LbConfig lbConfig = lbconfigs.getLbConfig(configName);

        ClusterRef cRef = lbConfig.getRefByRef(ClusterRef.class, clusterName);
        if (cRef != null) {
            String msg = localStrings.getLocalString("LBClusterRefExists",
                   "LB config already contains a cluster-ref for target {0}", target);
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setMessage(msg);
            return;
        }

        try {
            ConfigSupport.apply(new SingleConfigCode<LbConfig>() {
                @Override
                public Object run(LbConfig param) throws PropertyVetoException, TransactionFailure {
                    ClusterRef ref = param.createChild(ClusterRef.class);
                    ref.setRef(clusterName);
                    if(lbpolicy != null) {
                        ref.setLbPolicy(lbpolicy);
                    }
                    if(lbpolicymodule != null) {
                        ref.setLbPolicyModule(lbpolicymodule);
                    }
                    param.getClusterRefOrServerRef().add(ref);
                    return Boolean.TRUE;
                }
            }, lbConfig);
View Full Code Here

    }

    private void deleteClusterFromLBConfig(LbConfigs lbconfigs, String configName, String clusterName) {
        LbConfig lbConfig = lbconfigs.getLbConfig(configName);

        ClusterRef cRef = lbConfig.getRefByRef(ClusterRef.class, clusterName);
        if (cRef == null) {
            // does not exist, just return from here
            String msg = localStrings.getLocalString("ClusterNotDefined",
                        "Cluster {0} cannot be used as target", target);
            logger.finest("Cluster " + clusterName + " does not exist.");
View Full Code Here

            return;
        }

        // target is a cluster
        if (tgt.isCluster(target)) {
            ClusterRef  cRef = lbConfig.getRefByRef(ClusterRef.class, target);

            // cluster is not associated to this lb config
            if (cRef == null){
                String msg = localStrings.getLocalString("UnassociatedCluster",
                        "Load balancer configuration [{0}] does not have a reference to the given cluster [{1}].",
                        lbConfigName, target);
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                report.setMessage(msg);
                return;
            }

            if (cRef.getHealthChecker() == null) {
                try {
                    addHealthChecker(cRef);
                } catch (TransactionFailure ex) {
                    String msg = localStrings.getLocalString("FailedToAddHC", "Failed to add health checker");
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
View Full Code Here

TOP

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

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.