Java EE 5 SDK

com.sun.appserv.management.helper
Class LBConfigHelper

java.lang.Object
  extended by com.sun.appserv.management.helper.LBConfigHelper

public final class LBConfigHelper
extends Object

Helper class for simplifying load balancer administration.

Since:
AppServer 9.0

Field Summary
static String CONFIG
           
static String HEALTH_CHECKER_INTERVAL
           
static String HEALTH_CHECKER_TIMEOUT
           
static String HEALTH_CHECKER_URL
           
static String HTTPS_ROUTING
           
static String LB_POLICY
           
static String LB_POLICY_MODULE
           
static String MONITOR
           
static String RELOAD_INTERVAL
           
static String RESPONSE_TIMEOUT
           
static String ROUTE_COOKIE
           
static String TARGET
           
 
Constructor Summary
LBConfigHelper(DomainRoot domainRoot)
          Public constructor
 
Method Summary
 String configureHTTPLBConfig(String configName, String target, Map<String,String> options, String filePath)
          This method supports the configure-http-lb-config CLI command.
 void configureLBWeight(String clusterName, Map instanceVsWeights)
          Configures the lb-weight attribute of each instance with the corresponding weight.
 LoadBalancerConfig createLoadbalancer(String loadbalancerName, boolean autoApplyEnabled, String[] targets, Map<String,String> params)
          Creates a load balancer element ( and the necessary config)
 void disableApplication(String target, String appName, int timeout)
          Disables load balancing for a particular application in a server instance with a quiescing period specififed by the timeout .
 void disableServer(String target, int timeout)
          Disables load balancing for a server with a quiescing period specififed by the timeout .
 void enableAllApplications(String target)
          Enables all user applications in the given target
 void enableApplication(String target, String appName)
          Enables load balancing for a particular application in a server instance
 void enableServer(String target)
          Enables a server for load balancing.
 Map<String,ClusterRefConfig> getClustersInLBConfig(String lbConfigName)
          Returns a filtered list of cluster references given the name of the load balancer config.
 Map<String,LoadBalancerServerMonitor> getInstanceAggregateStats(String serverName)
          Returns the stats for an instance.
 Map<String,LoadBalancerServerMonitor> getInstanceMonitors(String targetLoadBalancer, String target, boolean allTargets)
          Gets the Maps of LoadBalancerServerMonitor for specified load balancer and specified target(s).
 Map<String,LoadBalancerServerStats> getInstanceStats(String targetLoadBalancer, String target, boolean allTargets)
          This is a convenience method to fetch the stats for server instance(s) which are either standalone or clustered or both
 Map<String,LoadBalancerContextRootStats> getInstanceStats(String targetLoadBalancer, String contextRoot, String target, boolean allTargets)
          This is a convenience method to fetch the stats for context roots for an application.
 List<LBConfig> getLBConfigsForCluster(String clusterName)
          Returns a filtered LBConfig list given the name of the cluster reference
 List<LBConfig> getLBConfigsForServer(String serverName)
          Returns a filtered LBConfig list given the name of the server reference
 Map<String,LoadBalancerConfig> getLoadBalancers(String targetName, boolean isCluster)
          Returns the load balancers loadbalancing a target : standalone instance, clustered instance or a cluster
 Map<String,ServerRefConfig> getServersInLBConfig(String lbConfigName)
          Returns a filtered list of server references given the name of the load balancer config.
 String[] listTargets()
          Lists all the standalone server instances and clusters in the domain.
 String[] listTargets(String lbName)
          Lists all the standalone server instances and clusters in the load balancer.
 void removeLoadbalancer(String loadbalancerName)
          Deletes a load balancer element ( and the necessary config, if nobody else is using this config)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESPONSE_TIMEOUT

public static final String RESPONSE_TIMEOUT
See Also:
Constant Field Values

HTTPS_ROUTING

public static final String HTTPS_ROUTING
See Also:
Constant Field Values

RELOAD_INTERVAL

public static final String RELOAD_INTERVAL
See Also:
Constant Field Values

MONITOR

public static final String MONITOR
See Also:
Constant Field Values

ROUTE_COOKIE

public static final String ROUTE_COOKIE
See Also:
Constant Field Values

HEALTH_CHECKER_URL

public static final String HEALTH_CHECKER_URL
See Also:
Constant Field Values

HEALTH_CHECKER_TIMEOUT

public static final String HEALTH_CHECKER_TIMEOUT
See Also:
Constant Field Values

HEALTH_CHECKER_INTERVAL

public static final String HEALTH_CHECKER_INTERVAL
See Also:
Constant Field Values

TARGET

public static final String TARGET
See Also:
Constant Field Values

CONFIG

public static final String CONFIG
See Also:
Constant Field Values

LB_POLICY

public static final String LB_POLICY
See Also:
Constant Field Values

LB_POLICY_MODULE

public static final String LB_POLICY_MODULE
See Also:
Constant Field Values
Constructor Detail

LBConfigHelper

public LBConfigHelper(DomainRoot domainRoot)
Public constructor

Method Detail

getLBConfigsForServer

public List<LBConfig> getLBConfigsForServer(String serverName)
Returns a filtered LBConfig list given the name of the server reference

Returns:
Map of items, keyed by name.
See Also:
LBConfig

getLBConfigsForCluster

public List<LBConfig> getLBConfigsForCluster(String clusterName)
Returns a filtered LBConfig list given the name of the cluster reference

Returns:
Map of items, keyed by name.
See Also:
LBConfig

getServersInLBConfig

public Map<String,ServerRefConfig> getServersInLBConfig(String lbConfigName)
Returns a filtered list of server references given the name of the load balancer config.

Returns:
Map of items, keyed by name.
See Also:
LBConfig

getClustersInLBConfig

public Map<String,ClusterRefConfig> getClustersInLBConfig(String lbConfigName)
Returns a filtered list of cluster references given the name of the load balancer config.

Returns:
Map of items, keyed by name.
See Also:
LBConfig

listTargets

public String[] listTargets()
Lists all the standalone server instances and clusters in the domain.

Returns:
all the standalone server instances and clusters in the domain

listTargets

public String[] listTargets(String lbName)
Lists all the standalone server instances and clusters in the load balancer.

Parameters:
lbName - Name of the load balancer
Returns:
all the standalone server instances and clusters in the load balancer

createLoadbalancer

public LoadBalancerConfig createLoadbalancer(String loadbalancerName,
                                             boolean autoApplyEnabled,
                                             String[] targets,
                                             Map<String,String> params)
Creates a load balancer element ( and the necessary config)

Parameters:
loadbalancerName - Name of the load balancer
autoApplyEnabled - Auto apply enabled or not
targets - Standalone server instances or clusters
params - This is optional, loadbalancer configuration elemements. The valid keys are:
Returns:
LoadBalancerConfig

removeLoadbalancer

public void removeLoadbalancer(String loadbalancerName)
Deletes a load balancer element ( and the necessary config, if nobody else is using this config)


disableServer

public void disableServer(String target,
                          int timeout)
Disables load balancing for a server with a quiescing period specififed by the timeout .

Parameters:
target - target server whose load balancing has to be disabled
timeout - quiescing time

enableServer

public void enableServer(String target)
Enables a server for load balancing.

Parameters:
target - target server whose load balancing has to be enabled

disableApplication

public void disableApplication(String target,
                               String appName,
                               int timeout)
Disables load balancing for a particular application in a server instance with a quiescing period specififed by the timeout .

Parameters:
target - target server where the application has been deployed
appName - application name.
timeout - quiescing time

enableApplication

public void enableApplication(String target,
                              String appName)
Enables load balancing for a particular application in a server instance

Parameters:
target - target server where the application has been deployed
appName - application name.

getInstanceStats

public Map<String,LoadBalancerServerStats> getInstanceStats(String targetLoadBalancer,
                                                            String target,
                                                            boolean allTargets)
This is a convenience method to fetch the stats for server instance(s) which are either standalone or clustered or both

Parameters:
targetLoadBalancer - Load Balancer for which stats are to be returned
target - Target cluster name. This is used if allTargets (next param) is false.
allTargets - list Monitors for all targets.
Returns:
Map of LoadBalancerServerStats and the fully qualified names of the servers i.e. clustername.servername or servername

getInstanceStats

public Map<String,LoadBalancerContextRootStats> getInstanceStats(String targetLoadBalancer,
                                                                 String contextRoot,
                                                                 String target,
                                                                 boolean allTargets)
This is a convenience method to fetch the stats for context roots for an application.

Parameters:
targetLoadBalancer - Load Balancer for which stats are to be returned
target - Target cluster name. This is used if allTargets (next param) is false.
allTargets - list Monitors for all targets.
Returns:
Map of LoadBalancerContextRootStats and the fully qualified names of the servers i.e. clustername.servername or servername

configureHTTPLBConfig

public String configureHTTPLBConfig(String configName,
                                    String target,
                                    Map<String,String> options,
                                    String filePath)
                             throws MBeanException
This method supports the configure-http-lb-config CLI command. It creates a lb-config, cluster-ref, health-checker by using the given parameters.

Parameters:
configName - the name for the lb-config element that will be created
target - cluster-ref or server-ref parameter of lb-config
options - Map of option name and option value. The valid options are responsetimeout response-timeout-in-seconds attribute of lb-config httpsrouting https-routing parameter of lb-config reloadinterval reload-poll-interval-in-seconds parameter of lb-config monitor monitoring-enabled parameter of lb-config routecookie route-cookie-enabled parameter of lb-config filepath the path to the file where loadbalancer.xml will be exported healthcheckerurl url attribute of health-checker healthcheckerinterval interval-in-seconds parameter of health-checker healthcheckertimeout timeout-in-seconds parameter of health-checker
filePath - the path to the file where loadbalancer.xml will be exported
Returns:
the path to the newly written file
Throws:
MBeanException - exception indicating the original cause of problm
Since:
AS 9.0

configureLBWeight

public void configureLBWeight(String clusterName,
                              Map instanceVsWeights)
Configures the lb-weight attribute of each instance with the corresponding weight. Corresponds to the CLI command configure-lb-weight

Parameters:
clusterName - name of the cluster
instanceVsWeights - Map of instance name Vs weight

enableAllApplications

public void enableAllApplications(String target)
Enables all user applications in the given target

Parameters:
target - The target for which all the applications have to be enabled

getInstanceMonitors

public Map<String,LoadBalancerServerMonitor> getInstanceMonitors(String targetLoadBalancer,
                                                                 String target,
                                                                 boolean allTargets)
Gets the Maps of LoadBalancerServerMonitor for specified load balancer and specified target(s).

Parameters:
targetLoadBalancer - Load Balancer for which Monitors are to be returned
target - Target cluster name. This is used if allTargets (next param) is false.
allTargets - list Monitors for all targets.
Returns:
Map of LoadBalancerServerMonitors and their names

getInstanceAggregateStats

public Map<String,LoadBalancerServerMonitor> getInstanceAggregateStats(String serverName)
Returns the stats for an instance. If the instance is being load balanced by multiple load balancers the a map of stats keyed by load balancer name is returned

Parameters:
serverName - instance name
Returns:
Map of LoadBalancerServerMonitor keyed by load balancer name

getLoadBalancers

public Map<String,LoadBalancerConfig> getLoadBalancers(String targetName,
                                                       boolean isCluster)
Returns the load balancers loadbalancing a target : standalone instance, clustered instance or a cluster

Parameters:
targetName - standalone instance name or clustered instance name or a cluster name
isCluster - whether the targetName is a cluster or instance name
Returns:
Map of LoadBalancerConfig keyed by load balancer name

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.