KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > target > DomainTarget


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * $Id: DomainTarget.java,v 1.3 2005/12/25 04:14:39 tcfujii Exp $
26  */

27
28 package com.sun.enterprise.admin.target;
29
30 //jdk imports
31
import java.io.Serializable JavaDoc;
32
33 //config imports
34
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.ConfigAPIHelper;
43 import com.sun.enterprise.config.serverbeans.Config;
44 import com.sun.enterprise.config.serverbeans.NodeAgentHelper;
45 import com.sun.enterprise.config.serverbeans.NodeAgent;
46 import com.sun.enterprise.config.serverbeans.ResourceRef;
47 import com.sun.enterprise.config.serverbeans.ApplicationRef;
48
49 public class DomainTarget extends Target
50 {
51     /**
52      * i18n strings manager object
53      */

54     private static final StringManager strMgr =
55         StringManager.getManager(DomainTarget.class);
56
57     protected DomainTarget(String JavaDoc name, ConfigContext cc)
58     {
59         super(name, cc);
60     }
61
62     public TargetType getType()
63     {
64         return TargetType.DOMAIN;
65     }
66
67     public String JavaDoc getTargetObjectName(String JavaDoc[] tokens)
68     {
69         checkTokens(tokens, 1);
70         return (tokens[0] + ":type=domain,category=config");
71     }
72
73     public ConfigTarget getConfigTarget() throws Exception JavaDoc
74     {
75         throw new Exception JavaDoc(strMgr.getString("target.no_config_for_domain"));
76     }
77
78     public String JavaDoc getConfigRef() throws ConfigException
79     {
80         return null;
81     }
82     
83     /**
84      * Get all servers in the domain
85      */

86     public Server[] getServers() throws ConfigException
87     {
88         return ServerHelper.getServersInDomain(getConfigContext());
89     }
90     
91     /**
92      * Return all the clusters in the domain
93      */

94     public Cluster[] getClusters() throws ConfigException
95     {
96         return ClusterHelper.getClustersInDomain(getConfigContext());
97     }
98     
99     /**
100      * Return all the configurations in the domain
101      */

102     public Config[] getConfigs() throws ConfigException
103     {
104         return ConfigAPIHelper.getConfigsInDomain(getConfigContext());
105     }
106     
107     /**
108      * Return all the node agents in the domain
109      */

110     public NodeAgent[] getNodeAgents() throws ConfigException
111     {
112         return NodeAgentHelper.getNodeAgentsInDomain(getConfigContext());
113     }
114     
115     public ApplicationRef[] getApplicationRefs() throws ConfigException
116     {
117         throw new ConfigException(strMgr.getString("target.not_supported",
118             "getApplicationRefs", getType().getName()));
119     }
120     
121     public ResourceRef[] getResourceRefs() throws ConfigException
122     {
123         throw new ConfigException(strMgr.getString("target.not_supported",
124             "getResourceRefs", getType().getName()));
125     }
126 }
127         
128
Popular Tags