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.util.i18n.StringManager; 38 import com.sun.enterprise.config.serverbeans.Server; 39 import com.sun.enterprise.config.serverbeans.ServerHelper; 40 import com.sun.enterprise.config.serverbeans.Cluster; 41 import com.sun.enterprise.config.serverbeans.ClusterHelper; 42 import com.sun.enterprise.config.serverbeans.Config; 43 import com.sun.enterprise.config.serverbeans.NodeAgentHelper; 44 import com.sun.enterprise.config.serverbeans.NodeAgent; 45 import com.sun.enterprise.config.serverbeans.ApplicationRef; 46 import com.sun.enterprise.config.serverbeans.ResourceRef; 47 48 public class NodeAgentTarget extends Target 49 { 50 53 private static final StringManager strMgr = 54 StringManager.getManager(NodeAgentTarget.class); 55 56 protected NodeAgentTarget(String name, ConfigContext cc) 57 { 58 super(name, cc); 59 } 60 61 public TargetType getType() 62 { 63 return TargetType.NODE_AGENT; 64 } 65 66 public String getTargetObjectName(String [] tokens) 67 { 68 checkTokens(tokens, 1); 69 return (tokens[0] + ":type=node-agent,category=config,name=" + getName()); 70 } 71 72 public ConfigTarget getConfigTarget() throws Exception 73 { 74 throw new ConfigException(strMgr.getString( 75 "target.no_config_for_node_agent")); 76 } 77 78 public String getConfigRef() throws ConfigException 79 { 80 return null; 81 } 82 83 86 public Server[] getServers() throws ConfigException 87 { 88 return ServerHelper.getServersOfANodeAgent(getConfigContext(), getName()); 89 } 90 91 94 public Cluster[] getClusters() throws ConfigException 95 { 96 return ClusterHelper.getClustersForNodeAgent(getConfigContext(), getName()); 97 } 98 99 102 public Config[] getConfigs() throws ConfigException 103 { 104 throw new ConfigException(strMgr.getString("target.not_supported", 105 "getConfigs", getType().getName())); 106 } 107 108 public ApplicationRef[] getApplicationRefs() throws ConfigException 109 { 110 throw new ConfigException(strMgr.getString("target.not_supported", 111 "getApplicationRefs", getType().getName())); 112 } 113 114 public ResourceRef[] getResourceRefs() throws ConfigException 115 { 116 throw new ConfigException(strMgr.getString("target.not_supported", 117 "getResourceRefs", getType().getName())); 118 } 119 120 123 public NodeAgent[] getNodeAgents() throws ConfigException 124 { 125 NodeAgent[] agents = new NodeAgent[1]; 126 agents[0] = NodeAgentHelper.getNodeAgentByName(getConfigContext(), getName()); 127 return agents; 128 } 129 } 130 | Popular Tags |