1 23 24 27 28 package com.sun.enterprise.admin.target; 29 30 import java.io.Serializable ; 32 33 import com.sun.enterprise.config.ConfigContext; 35 import com.sun.enterprise.config.ConfigException; 36 37 import com.sun.enterprise.config.serverbeans.ClusterHelper; 38 import com.sun.enterprise.config.serverbeans.ServerHelper; 39 import com.sun.enterprise.config.serverbeans.NodeAgentHelper; 40 import com.sun.enterprise.config.serverbeans.Config; 41 import com.sun.enterprise.config.serverbeans.Server; 42 import com.sun.enterprise.config.serverbeans.Cluster; 43 import com.sun.enterprise.config.serverbeans.ApplicationRef; 44 import com.sun.enterprise.config.serverbeans.ResourceRef; 45 import com.sun.enterprise.config.serverbeans.NodeAgent; 46 47 public class ClusterTarget extends Target 48 { 49 protected ClusterTarget(String name, ConfigContext cc) 50 { 51 super(name, cc); 52 } 53 54 public TargetType getType() 55 { 56 return TargetType.CLUSTER; 57 } 58 59 public String getTargetObjectName(String [] tokens) 60 { 61 checkTokens(tokens, 1); 62 return (tokens[0] + ":type=cluster,category=config,name=" + getName()); 63 } 64 65 public ConfigTarget getConfigTarget() throws Exception 66 { 67 return new ConfigTarget(getConfigRef(), getConfigContext()); 68 } 69 70 public String getConfigRef() throws ConfigException 71 { 72 final Config config = ClusterHelper.getConfigForCluster(getConfigContext(), getName()); 73 return config.getName(); 74 } 75 76 79 public Server[] getServers() throws ConfigException 80 { 81 return ServerHelper.getServersInCluster(getConfigContext(), getName()); 82 } 83 84 87 public Cluster[] getClusters() throws ConfigException 88 { 89 final Cluster[] clusters = new Cluster[1]; 90 clusters[0] = ClusterHelper.getClusterByName(getConfigContext(), getName()); 91 return clusters; 92 } 93 94 97 public Config[] getConfigs() throws ConfigException 98 { 99 final Config[] configs = new Config[1]; 100 configs[0] = ClusterHelper.getConfigForCluster(getConfigContext(), getName()); 101 return configs; 102 } 103 104 107 public NodeAgent[] getNodeAgents() throws ConfigException 108 { 109 return NodeAgentHelper.getNodeAgentsForCluster(getConfigContext(), getName()); 110 } 111 112 115 public ApplicationRef[] getApplicationRefs() throws ConfigException 116 { 117 return ClusterHelper.getApplicationReferences(getConfigContext(), getName()); 118 } 119 120 123 public ResourceRef[] getResourceRefs() throws ConfigException 124 { 125 return ClusterHelper.getResourceReferences(getConfigContext(), getName()); 126 } 127 } 128 | Popular Tags |