1 23 24 27 28 package com.sun.enterprise.admin.target; 29 30 import java.io.Serializable ; 32 import java.util.Set ; 33 34 import com.sun.enterprise.config.ConfigContext; 36 import com.sun.enterprise.config.ConfigException; 37 38 import com.sun.enterprise.util.i18n.StringManager; 39 import com.sun.enterprise.config.serverbeans.Config; 40 import com.sun.enterprise.config.serverbeans.Server; 41 import com.sun.enterprise.config.serverbeans.ServerHelper; 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 import com.sun.enterprise.config.serverbeans.ClusterHelper; 47 import com.sun.enterprise.config.serverbeans.ConfigAPIHelper; 48 49 public class ConfigTarget extends Target 50 { 51 private static final StringManager strMgr = 52 StringManager.getManager(ConfigTarget.class); 53 54 protected ConfigTarget(String name, ConfigContext cc) 55 { 56 super(name, cc); 57 } 58 59 public TargetType getType() 60 { 61 return TargetType.CONFIG; 62 } 63 64 public String getTargetObjectName(String [] tokens) 65 { 66 checkTokens(tokens, 1); 67 return (tokens[0] + ":type=config,category=config,name=" + getName()); 68 } 69 70 public ConfigTarget getConfigTarget() throws Exception 71 { 72 return this; 73 } 74 75 public String getConfigRef() throws ConfigException 76 { 77 return getName(); 78 } 79 80 83 public Server[] getServers() throws ConfigException 84 { 85 return ServerHelper.getServersReferencingConfig(getConfigContext(), getName()); 86 } 87 88 91 public Cluster[] getClusters() throws ConfigException 92 { 93 return ClusterHelper.getClustersReferencingConfig(getConfigContext(), getName()); 94 } 95 96 97 100 public Config[] getConfigs() throws ConfigException 101 { 102 Config[] configs = new Config[1]; 103 configs[0] = ConfigAPIHelper.getConfigByName(getConfigContext(), getName()); 104 return configs; 105 } 106 107 public NodeAgent[] getNodeAgents() throws ConfigException 108 { 109 throw new ConfigException(strMgr.getString("target.not_supported", 110 "getNodeAgents", getType().getName())); 111 } 112 113 public ApplicationRef[] getApplicationRefs() throws ConfigException 114 { 115 throw new ConfigException(strMgr.getString("target.not_supported", 116 "getApplicationRefs", getType().getName())); 117 } 118 119 public ResourceRef[] getResourceRefs() throws ConfigException 120 { 121 throw new ConfigException(strMgr.getString("target.not_supported", 122 "getResourceRefs", getType().getName())); 123 } 124 } 125 | Popular Tags |