Package org.glassfish.loadbalancer.config

Examples of org.glassfish.loadbalancer.config.LbConfig$DeleteDecorator


            report.setFailureCause(ex);
        }
    }

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


            return;
        }
    }

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

        ServerRef  sRef = lbConfig.getRefByRef(ServerRef.class, serverName);
        if (sRef == null) {
            // does not exist, just return from here
            String msg = localStrings.getLocalString("ServerNotDefined",
                        "Server {0} cannot be used as target", target);
            if (logger.isLoggable(Level.FINEST)) {
View Full Code Here

        removeServerRef(lbConfig, sRef);
    }

    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);
            if (logger.isLoggable(Level.FINEST)) {
View Full Code Here


            } else {

                // target is a lb config
                LbConfig lbConfig = lbconfigs.getLbConfig(list_target);
               
                if (lbConfig != null) {
                   
                    List<ClusterRef> cRefs = lbConfig.getRefs(ClusterRef.class);
                    for (ClusterRef ref: cRefs) {
                        String s = localStrings.getLocalString("ClusterPrefix", "Cluster:");
                        ActionReport.MessagePart childPart = part.addChild();
                        childPart.setMessage(s + ref.getRef());
                    }

                    List<ServerRef> sRefs = lbConfig.getRefs(ServerRef.class);
                    for (ServerRef ref: sRefs) {
                        String s = localStrings.getLocalString("ServerPrefix", "Server:");
                        ActionReport.MessagePart childPart = part.addChild();
                        childPart.setMessage(s + ref.getRef());
                    }                   
View Full Code Here

            report.setMessage(msg);
            return;
        }
        
        if (config != null) {
            LbConfig lbConfig = lbconfigs.getLbConfig(config);
            createHealthCheckerInternal(url,interval,timeout,lbConfig,
            config ,target);
        } else {
            List<LbConfig> lbConfigs = lbconfigs.getLbConfig();
            if (lbConfigs.size() == 0) {
View Full Code Here

            report.setMessage(msg);
            return;
        }
        
        if (config != null) {
            LbConfig lbConfig = lbconfigs.getLbConfig(config);
            deleteHealthCheckerInternal(lbConfig, target, false);
        } else {
            List<LbConfig> lbConfigs = lbconfigs.getLbConfig();
            if (lbConfigs.isEmpty()) {
                String msg = localStrings.getLocalString("NoLbConfigsElement",
View Full Code Here

        // reads the load balancer related data
        LbConfigs lbConfigs = domain.getExtensionByType(LbConfigs.class);
        if (lbConfigs == null) {
            throw new Exception(LbLogUtil.getStringManager().getString("UnableToGetLbConfig", lbConfigName));
        }
        LbConfig lbConfig = lbConfigs.getLbConfig(lbConfigName);
        if (lbConfig == null) {
            throw new Exception(LbLogUtil.getStringManager().getString("UnableToGetLbConfig", lbConfigName));
        }
        return new LoadbalancerReaderImpl(domain, appRegistry, lbConfig);
    }
View Full Code Here

            return;
        }
    }

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

        ServerRef sRef = lbConfig.getRefByRef(ServerRef.class, serverName);
        if (sRef != null) {
            String msg = localStrings.getLocalString("LBServerRefExists",
                   "LB config already contains a server-ref for target {0}", target);
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setMessage(msg);
View Full Code Here

            report.setFailureCause(ex);
        }
    }

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

                    LbConfigHelper.exportOtdProperties(lbr, fo);
                }
                if (retrieveFile) {
                    retrieveLbConfig(context, lbConfigFile, tmpLbWorkerFile);
                }
                LbConfig lbConfig = lbr.getLbConfig();
    //Check for the case when lbtargets are provided
                //In such a case, lbconfig will be null
    if(lbConfig != null){
                    lbConfig.setLastExported();
    }
                String msg = LbLogUtil.getStringManager().getString(
                        "GeneratedFileLocation", lbConfigFile.toString());
                return msg;
            } finally {
                if (fo != null) {
                    fo.close();
                    fo = null;
                }
            }
        } else {

            File tmpLbXmlFile = null;
            if (retrieveFile) {
                tmpLbXmlFile = File.createTempFile("load-balancer", ".xml");
                tmpLbXmlFile.deleteOnExit();
            } else {
                if (lbConfigFile.exists()) {
                    String msg = LbLogUtil.getStringManager().getString(
                            "FileExists", lbConfigFile.getPath());
                    throw new Exception(msg);
                }

                if (!(lbConfigFile.getParentFile().exists())) {
                    String msg = LbLogUtil.getStringManager().getString(
                            "ParentFileMissing", lbConfigFile.getParent());
                    throw new Exception(msg);
                }
                tmpLbXmlFile = lbConfigFile;
            }

            FileOutputStream fo = null;

            try {
                fo = new FileOutputStream(tmpLbXmlFile);
                LbConfigHelper.exportXml(lbr, fo);
                if (retrieveFile) {
                    retrieveLbConfig(context, lbConfigFile, tmpLbXmlFile);
                }
                LbConfig lbConfig = lbr.getLbConfig();
                //Check for the case when lbtargets are provided
                //In such a case, lbconfig will be null
                if(lbConfig != null){
                    lbConfig.setLastExported();
                }
                String msg = LbLogUtil.getStringManager().getString(
                        "GeneratedFileLocation", lbConfigFile.toString());
                return msg;
            } finally {
View Full Code Here

TOP

Related Classes of org.glassfish.loadbalancer.config.LbConfig$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.