KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > servermgmt > pe > PEDomainXmlTokens


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 package com.sun.enterprise.admin.servermgmt.pe;
25
26 import java.io.File JavaDoc;
27
28 import com.sun.enterprise.util.OS;
29 import com.sun.enterprise.util.io.FileUtils;
30 import com.sun.enterprise.admin.util.TokenValue;
31 import com.sun.enterprise.admin.util.TokenValueSet;
32 import com.sun.enterprise.admin.servermgmt.DomainConfig;
33
34 public final class PEDomainXmlTokens
35 {
36     public static final String JavaDoc CONFIG_MODEL_NAME_TOKEN_NAME = "CONFIG_MODEL_NAME";
37     public static final String JavaDoc CONFIG_MODEL_NAME_TOKEN_VALUE = "server-config";
38
39     public static final String JavaDoc HOST_NAME_TOKEN_NAME = "HOST_NAME";
40     public static final String JavaDoc DOMAIN_NAME_TOKEN_NAME = "DOMAIN_NAME";
41     
42     public static final String JavaDoc HTTP_PORT_TOKEN_NAME = "HTTP_PORT";
43
44     public static final String JavaDoc ORB_LISTENER_PORT_TOKEN_NAME = "ORB_LISTENER_PORT";
45
46     public static final String JavaDoc JMS_PROVIDER_PASSWORD_TOKEN_NAME= "JMS_PROVIDER_PASSWORD";
47     
48     public static final String JavaDoc JMS_PROVIDER_PORT_TOKEN_NAME= "JMS_PROVIDER_PORT";
49     
50     public static final String JavaDoc JMS_PROVIDER_USERID_TOKEN_NAME= "JMS_PROVIDER_USERID";
51     
52     public static final String JavaDoc SERVER_ID_TOKEN_NAME= "SERVER_ID";
53
54     public static final String JavaDoc ADMIN_PORT_TOKEN_NAME= "ADMIN_PORT";
55
56     public static final String JavaDoc HTTP_SSL_PORT_TOKEN_NAME= "HTTP_SSL_PORT";
57
58     public static final String JavaDoc ORB_SSL_PORT_TOKEN_NAME= "ORB_SSL_PORT";
59
60     public static final String JavaDoc ORB_MUTUALAUTH_PORT_TOKEN_NAME= "ORB_MUTUALAUTH_PORT";
61
62     //This token is used for SE/EE only now, but it is likely that we will want to expose it
63
//in PE (i.e. to access the exposed Mbeans). Remember that the http jmx port (used by
64
//asadmin) will not be exposed pubically.
65
public static final String JavaDoc JMX_SYSTEM_CONNECTOR_PORT_TOKEN_NAME="JMX_SYSTEM_CONNECTOR_PORT";
66     
67     public static TokenValueSet getTokenValueSet(DomainConfig domainConfig)
68     {
69         final String JavaDoc installRoot =
70         (String JavaDoc)domainConfig.get(DomainConfig.K_INSTALL_ROOT);
71         final String JavaDoc domainRoot =
72         (String JavaDoc)domainConfig.get(DomainConfig.K_DOMAINS_ROOT);
73
74         final TokenValueSet tokens = new TokenValueSet();
75
76         String JavaDoc instanceName = (String JavaDoc)domainConfig.get(DomainConfig.K_SERVERID);
77         if((instanceName == null) || (instanceName.equals("")))
78             instanceName = PEFileLayout.DEFAULT_INSTANCE_NAME;
79
80         TokenValue tv = new TokenValue(CONFIG_MODEL_NAME_TOKEN_NAME,
81                                     CONFIG_MODEL_NAME_TOKEN_VALUE);
82         tokens.add(tv);
83
84         tv = new TokenValue(HOST_NAME_TOKEN_NAME,
85                 (String JavaDoc)domainConfig.get(DomainConfig.K_HOST_NAME));
86         tokens.add(tv);
87
88         final Integer JavaDoc adminPort =
89             (Integer JavaDoc)domainConfig.get(DomainConfig.K_ADMIN_PORT);
90         tv = new TokenValue(ADMIN_PORT_TOKEN_NAME, adminPort.toString());
91         tokens.add(tv);
92
93         final Integer JavaDoc httpPort =
94             (Integer JavaDoc)domainConfig.get(DomainConfig.K_INSTANCE_PORT);
95         tv = new TokenValue(HTTP_PORT_TOKEN_NAME, httpPort.toString());
96         tokens.add(tv);
97
98         final Integer JavaDoc orbPort =
99             (Integer JavaDoc)domainConfig.get(DomainConfig.K_ORB_LISTENER_PORT);
100         tv = new TokenValue(ORB_LISTENER_PORT_TOKEN_NAME, orbPort.toString());
101         tokens.add(tv);
102
103         tv = new TokenValue(JMS_PROVIDER_PASSWORD_TOKEN_NAME,
104               (String JavaDoc)domainConfig.get(DomainConfig.K_JMS_PASSWORD));
105         tokens.add(tv);
106
107         final Integer JavaDoc jmsPort =
108             (Integer JavaDoc)domainConfig.get(DomainConfig.K_JMS_PORT);
109         tv = new TokenValue(JMS_PROVIDER_PORT_TOKEN_NAME, jmsPort.toString());
110         tokens.add(tv);
111
112         tv = new TokenValue(JMS_PROVIDER_USERID_TOKEN_NAME,
113               (String JavaDoc)domainConfig.get(DomainConfig.K_JMS_USER));
114         tokens.add(tv);
115
116         tv = new TokenValue(SERVER_ID_TOKEN_NAME,
117                                 instanceName);
118         tokens.add(tv);
119  
120         final Integer JavaDoc httpSslPort =
121             (Integer JavaDoc)domainConfig.get(DomainConfig.K_HTTP_SSL_PORT);
122         tv = new TokenValue(HTTP_SSL_PORT_TOKEN_NAME, httpSslPort.toString());
123         tokens.add(tv);
124
125         final Integer JavaDoc orbSslPort =
126             (Integer JavaDoc)domainConfig.get(DomainConfig.K_IIOP_SSL_PORT);
127         tv = new TokenValue(ORB_SSL_PORT_TOKEN_NAME, orbSslPort.toString());
128         tokens.add(tv);
129
130         final Integer JavaDoc orbMutualAuthPort =
131             (Integer JavaDoc)domainConfig.get(DomainConfig.K_IIOP_MUTUALAUTH_PORT);
132         tv = new TokenValue(ORB_MUTUALAUTH_PORT_TOKEN_NAME, orbMutualAuthPort.toString());
133         tokens.add(tv);
134
135         final Integer JavaDoc jmxPort =
136             (Integer JavaDoc)domainConfig.get(DomainConfig.K_JMX_PORT);
137         tv = new TokenValue(JMX_SYSTEM_CONNECTOR_PORT_TOKEN_NAME, jmxPort.toString());
138         tokens.add(tv);
139
140         tv = new TokenValue(DOMAIN_NAME_TOKEN_NAME, domainConfig.getRepositoryName());
141         tokens.add(tv);
142
143         
144         return ( tokens );
145     }
146 }
147
Popular Tags