Source Code Cross Referenced for MissingConfig.java in  » ESB » open-esb » deploytest » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ESB » open esb » deploytest 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)CustomConfig.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package deploytest;
030:
031:        import javax.management.MBeanException;
032:        import javax.management.openmbean.CompositeData;
033:        import javax.management.openmbean.CompositeDataSupport;
034:        import javax.management.openmbean.CompositeType;
035:        import javax.management.openmbean.TabularData;
036:        import javax.management.openmbean.TabularDataSupport;
037:        import javax.management.openmbean.TabularType;
038:        import javax.management.openmbean.OpenType;
039:        import javax.management.openmbean.SimpleType;
040:        import javax.management.openmbean.ArrayType;
041:
042:        public class MissingConfig implements  MissingConfigMBean {
043:            private String mInfo;
044:
045:            private int mPort;
046:            private String mHostName;
047:            private String mProxyPwd;
048:
049:            /** The application variables TabularData */
050:            private TabularDataSupport mAppVars;
051:
052:            /** Application Variable Composite Type */
053:            private static CompositeType sAppVarComposite;
054:
055:            /** Application Variable Tabular Type */
056:            private static TabularType sAppVarTable;
057:
058:            /** Application Variable Composite Item Names */
059:            private static String[] sAppVarItemNames;
060:
061:            /** The index of the Application Variables **/
062:            private static String[] sappVarRowIndex;
063:
064:            /** The application configuration TabularData */
065:            private TabularDataSupport mAppConfigs;
066:
067:            /** Application Configuration Composite Type */
068:            private static CompositeType sAppConfigComposite;
069:
070:            /** Application Configuration Tabular Type */
071:            private static TabularType sAppConfigTable;
072:
073:            /** Application Configuration Composite Item Names */
074:            private static String[] sAppConfigItemNames;
075:
076:            /** The index of the Application Configurations **/
077:            private static String[] sAppConfigRowIndex;
078:
079:            private static final String CONFIG_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
080:                    + "<componentConfig:Configuration name=\"sun-http-binding\" "
081:                    + "xmlns:componentConfig=\"http://com.sun.jbi.component/schema/configuration\"> "
082:                    + "<componentConfig:OutboundThreads displayName=\"Number of outbound threads\" "
083:                    + "displayDescription=\"Number of threads to concurrently process outbound HTTP/SOAP requests\" "
084:                    + "isPasswordField=\"false\">10</componentConfig:OutboundThreads> "
085:                    +
086:
087:                    "<componentConfig:HttpDefaultPort displayName=\"Default HTTP port number\" "
088:                    + "displayDescription=\"Default HTTP port number for inbound HTTP/SOAP requests\" "
089:                    + "isPasswordField=\"false\">1111</componentConfig:HttpDefaultPort> "
090:                    +
091:
092:                    "<componentConfig:HttpsDefaultPort displayName=\"Default HTTPS port number\" "
093:                    + "displayDescription=\"Default HTTPS port number for inbound HTTP/SOAP requests\" "
094:                    + "isPasswordField=\"false\">2222</componentConfig:HttpsDefaultPort> "
095:                    +
096:
097:                    "<componentConfig:UseJVMProxySettings displayName=\"Use default JVM proxy settings\" "
098:                    + "displayDescription=\"Determines whether or not to use the default JVM system properties for proxy settings\" "
099:                    + "isPasswordField=\"false\">true</componentConfig:UseJVMProxySettings> "
100:                    +
101:
102:                    "<componentConfig:ProxyType displayName=\"Proxy type\" "
103:                    + "displayDescription=\"Specifies a valid proxy type\" "
104:                    + "isPasswordField=\"false\">SOCKS</componentConfig:ProxyType>"
105:                    +
106:
107:                    "<componentConfig:ProxyHost displayName=\"Proxy host\" "
108:                    + "displayDescription=\"Specifies a valid proxy host name\" "
109:                    + "isPasswordField=\"false\">dummy</componentConfig:ProxyHost>"
110:                    +
111:
112:                    "<componentConfig:ProxyPort displayName=\"Proxy port\" "
113:                    + "displayDescription=\"Specifies a valid proxy port\" "
114:                    + "isPasswordField=\"false\">3333</componentConfig:ProxyPort>"
115:                    +
116:
117:                    "<componentConfig:NonProxyHosts displayName=\"Non proxy hosts\" "
118:                    + "displayDescription=\"Specifies a list of server hosts whose connections do not require a proxy server.\" "
119:                    + "isPasswordField=\"false\">dummy</componentConfig:NonProxyHosts>"
120:                    +
121:
122:                    "<componentConfig:ProxyUserName displayName=\"Proxy user name\" "
123:                    + "displayDescription=\"Specifies a valid proxy user name\" "
124:                    + "isPasswordField=\"false\">dummy</componentConfig:ProxyUserName>"
125:                    +
126:
127:                    "<componentConfig:ProxyPassword displayName=\"Proxy user password\" "
128:                    + "displayDescription=\"Specifies a valid proxy user password.\" "
129:                    + "isPasswordField=\"true\">dummy</componentConfig:ProxyPassword>"
130:                    +
131:
132:                    "<componentConfig:ApplicationConfiguration>"
133:                    +
134:
135:                    "<componentConfig:configurationName displayName=\"Application Configuration Name\" "
136:                    + "displayDescription=\"Specifies the name of the application configuration.\" "
137:                    + "isPasswordField=\"false\" isRequiredField=\"true\">dummy</componentConfig:configurationName >"
138:                    +
139:
140:                    "<componentConfig:connectionURL displayName=\"HTTP URL Location\" "
141:                    + "displayDescription=\"Specifies the HTTP URL location.\" "
142:                    + "isPasswordField=\"false\" isRequiredField=\"true\">http://</componentConfig:connectionURL>"
143:                    +
144:
145:                    "<componentConfig:securityPrincipal displayName=\"HTTP URL Location\" "
146:                    + "displayDescription=\"Specifies the HTTP URL location.\" "
147:                    + "isPasswordField=\"false\" isRequiredField=\"true\">http://</componentConfig:securityPrincipal>"
148:                    +
149:
150:                    "<componentConfig:securityCredential displayName=\"User Password\" "
151:                    + "displayDescription=\"Specifies the user password.\" "
152:                    + "isPasswordField=\"true\" isRequiredField=\"true\">secret</componentConfig:securityCredential>"
153:                    +
154:
155:                    "<componentConfig:jndienv displayName=\"HTTP URL Location\" "
156:                    + "displayDescription=\"Specifies the HTTP URL location.\" "
157:                    + "isPasswordField=\"false\" isRequiredField=\"true\">http://</componentConfig:jndienv>"
158:                    +
159:
160:                    "</componentConfig:ApplicationConfiguration>"
161:                    + "</componentConfig:Configuration>";
162:
163:            private void initOpenTypes()
164:                    throws javax.management.openmbean.OpenDataException {
165:                // Define the Application Variables CompositeType
166:                sAppVarItemNames = new String[] { "name", "value", "type" };
167:
168:                String[] appVarItemDesc = { "Application variable name",
169:                        "Application variable value",
170:                        "Application variable type" };
171:
172:                OpenType[] appVarRowAttrTypes = { SimpleType.STRING,
173:                        SimpleType.STRING, SimpleType.STRING };
174:
175:                sappVarRowIndex = new String[] { "name" };
176:
177:                sAppVarComposite = new CompositeType(
178:                        "ApplicationVariableComposite",
179:                        "Application variable name and value pair",
180:                        sAppVarItemNames, appVarItemDesc, appVarRowAttrTypes);
181:
182:                sAppVarTable = new TabularType("ApplicationVariableList",
183:                        "List of application variables", sAppVarComposite,
184:                        sappVarRowIndex);
185:
186:                // Define the Application Configuration OpenType
187:                sAppConfigItemNames = new String[] { "configurationName",
188:                        "connectionURL", "securityPrincipal",
189:                        "securityCredential", "jndienv" };
190:
191:                String[] appConfigItemDesc = {
192:                        "Application configuration name", "Connection URL",
193:                        "Security Principal", "Security Credential",
194:                        "JNDI Properties" };
195:
196:                ArrayType jndiEnvArrayType = new ArrayType(1, SimpleType.STRING);
197:                OpenType[] appConfigRowAttrTypes = { SimpleType.STRING,
198:                        SimpleType.STRING, SimpleType.STRING,
199:                        SimpleType.STRING, jndiEnvArrayType };
200:
201:                sAppConfigRowIndex = new String[] { "configurationName" };
202:
203:                sAppConfigComposite = new CompositeType(
204:                        "ApplicationConfigurationComposite",
205:                        "Application Configuration Composite",
206:                        sAppConfigItemNames, appConfigItemDesc,
207:                        appConfigRowAttrTypes);
208:
209:                sAppConfigTable = new TabularType(
210:                        "ApplicationConfigurationList",
211:                        "List of application configurations",
212:                        sAppConfigComposite, sAppConfigRowIndex);
213:            }
214:
215:            /**
216:             * HostName gettter/setter
217:             */
218:            public void setHostName(String hostName) {
219:                mHostName = hostName;
220:            }
221:
222:            public String getHostName() {
223:                return mHostName;
224:            }
225:
226:            /**
227:             * Port get/set
228:             */
229:            public void setPort(int port) {
230:                mPort = port;
231:            }
232:
233:            public int getPort() {
234:                return mPort;
235:            }
236:
237:            /**
238:             * ProxyPassword - secure field
239:             */
240:            public void setProxyPassword(String proxyPassword) {
241:                mProxyPwd = proxyPassword;
242:            }
243:
244:            public String getProxyPassword() {
245:                return mProxyPwd;
246:            }
247:
248:            public MissingConfig(String info) {
249:                mInfo = info;
250:                try {
251:                    initOpenTypes();
252:                    mAppVars = new TabularDataSupport(sAppVarTable);
253:                    mAppConfigs = new TabularDataSupport(sAppConfigTable);
254:
255:                    // Add a default app var
256:                    CompositeDataSupport cd = new CompositeDataSupport(
257:                            sAppVarComposite, sAppVarItemNames, new String[] {
258:                                    "default", "defValue", "STRING" });
259:                    mAppVars.put(cd);
260:
261:                    // Add a default app config
262:                    CompositeDataSupport appCfgCD = new CompositeDataSupport(
263:                            sAppConfigComposite,
264:                            sAppConfigItemNames,
265:                            new Object[] {
266:                                    "defaultConfig",
267:                                    "http://www.sun.com",
268:                                    "administrator",
269:                                    "abc",
270:                                    new String[] { "env1=value1", "env2=value2" } });
271:                    mAppConfigs.put(appCfgCD);
272:                } catch (Exception ex) {
273:                    System.out
274:                            .println("Error in populating the Application Variables");
275:                    System.out.println(ex.getMessage());
276:                }
277:            }
278:
279:            /**
280:             * Test method.
281:             */
282:            public String getComponentCustomInfo() {
283:                return mInfo;
284:            }
285:
286:            /**
287:             * Get the CompositeType definition for the components application configuration 
288:             *
289:             * @return the CompositeType for the components application configuration.
290:             */
291:            public CompositeType queryApplicationConfigurationType() {
292:                return sAppConfigComposite;
293:            }
294:
295:            /**
296:             * Add an application configuration. The configuration name is a part of the CompositeData.
297:             * The itemName for the configuration name is "configurationName" and the type is SimpleType.STRING
298:             *
299:             * @param name - configuration name, must match the value of the field "name" in the namedConfig
300:             * @param appConfig - application configuration composite 
301:             * @throws MBeanException if the application configuration cannot be added.
302:             * @return management message string which gives the status of the operation. For 
303:             *         target=cluster, instance specific details are included. 
304:             */
305:            public void addApplicationConfiguration(String name,
306:                    CompositeData appConfig) throws MBeanException {
307:                mAppConfigs.put(appConfig);
308:            }
309:
310:            /**
311:             * Delete an application configuration. 
312:             *
313:             * @param name - identification of the application configuration to be deleted
314:             * @throws MBeanException if the configuration cannot be deleted.
315:             * @return management message string which gives the status of the operation. For 
316:             *         target=cluster, instance specific details are included. 
317:             */
318:            public void deleteApplicationConfiguration(String name)
319:                    throws MBeanException {
320:                CompositeData cd = (CompositeData) mAppConfigs
321:                        .get(new String[] { name });
322:
323:                if (cd != null) {
324:                    mAppConfigs.remove(new String[] { name });
325:                }
326:            }
327:
328:            /**
329:             * Get a Map of all application configurations for the component.
330:             *
331:             * @return a TabularData of all the application configurations for a 
332:             *         component keyed by the configuration name. 
333:             */
334:            public TabularData getApplicationConfigurations() {
335:                return mAppConfigs;
336:            }
337:
338:            /**
339:             * This operation sets an application variable. If a variable does not exist with 
340:             * the same name, its an error.
341:             * 
342:             * @param name - name of the application variable
343:             * @param appVar - this is the application variable compoiste to be updated.
344:             * @throws MBeanException if one or more application variables cannot be deleted
345:             * @return management message string which gives the status of the operation. For 
346:             *         target=cluster, instance specific details are included. 
347:             */
348:            public void setApplicationVariable(String name, CompositeData appVar)
349:                    throws MBeanException {
350:                CompositeData cd = (CompositeData) mAppVars
351:                        .get(new String[] { name });
352:
353:                if (cd != null) {
354:                    mAppVars.remove(new String[] { name });
355:                    mAppVars.put(appVar);
356:                }
357:            }
358:
359:            /**
360:             * This operation deletes an application variable, if a variable with the specified name does
361:             * not exist, it's an error.
362:             *
363:             * @param name - name of the application variable
364:             * @throws MBeanException on errors.
365:             * @return management message string which gives the status of the operation. For 
366:             *         target=cluster, instance specific details are included. 
367:             */
368:            public void deleteApplicationVariable(String name)
369:                    throws MBeanException {
370:                mAppVars.remove(new String[] { name });
371:            }
372:
373:            /**
374:             * Get the Application Variable set for a component.
375:             *
376:             * @return  a TabularData which has all the applicationvariables set on the component. 
377:             */
378:            public TabularData getApplicationVariables() {
379:                return mAppVars;
380:            }
381:
382:            /** 
383:             * Retrieves the component specific configuration schema.
384:             *
385:             * @return a String containing the configuration schema.
386:             */
387:            public String retrieveConfigurationDisplaySchema() {
388:                return CONFIG_XML;
389:            }
390:
391:            /** 
392:             * Retrieves the component configuration metadata.
393:             * The XML data conforms to the component 
394:             * configuration schema.
395:             *
396:             * @return a String containing the configuration metadata.
397:             */
398:            public String retrieveConfigurationDisplayData() {
399:                return CONFIG_XML;
400:            }
401:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.