Source Code Cross Referenced for AbstractJMXClient.java in  » ESB » open-esb » com » sun » jbi » ui » client » 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 » com.sun.jbi.ui.client 
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:         * @(#)AbstractJMXClient.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.ui.client;
030:
031:        import com.sun.jbi.ui.common.I18NBundle;
032:        import com.sun.jbi.ui.common.JBIJMXObjectNames;
033:        import com.sun.jbi.ui.common.JBIRemoteException;
034:        import com.sun.jbi.ui.common.JMXConnectionException;
035:        import javax.management.MalformedObjectNameException;
036:        import javax.management.ObjectName;
037:
038:        /** This class is a abstract base class for jmx client implementations.
039:         *
040:         * @author Sun Microsystems, Inc.
041:         */
042:
043:        public abstract class AbstractJMXClient {
044:            /** i18n */
045:            private static I18NBundle sI18NBundle = null;
046:
047:            /** JMX Client interface*/
048:            protected JMXConnection mJmxConnection;
049:
050:            /**
051:             * constructor
052:             */
053:            protected AbstractJMXClient() {
054:            }
055:
056:            /** gives the I18N bundle
057:             *@return I18NBundle object
058:             */
059:            protected static I18NBundle getI18NBundle() {
060:                // lazzy initialize the JBI Client
061:                if (sI18NBundle == null) {
062:                    sI18NBundle = new I18NBundle("com.sun.jbi.ui.client");
063:                }
064:                return sI18NBundle;
065:            }
066:
067:            /**
068:             * returns jmx connection object.
069:             * @return jmx connection object.
070:             */
071:            protected JMXConnection getJMXConnection() {
072:                return this .mJmxConnection;
073:            }
074:
075:            /**
076:             * sets the jmx connection object.
077:             * @param jmxConn jmx connection object.
078:             */
079:            protected void setJMXConnection(JMXConnection jmxConn) {
080:                this .mJmxConnection = jmxConn;
081:            }
082:
083:            /**
084:             * opens the jmx connection
085:             * @throws JBIRemoteException on error
086:             */
087:            protected void openJmxConnection() throws JBIRemoteException {
088:                try {
089:                    this .mJmxConnection.openConnection();
090:                } catch (JMXConnectionException jmxEx) {
091:                    // JMXConnectionException now carries jbi mgmt msg xml with serialized root casuse info
092:                    // so just pass the exception 
093:                    throw new JBIRemoteException(jmxEx);
094:                }
095:            }
096:
097:            /**
098:             * closes the jmx connection
099:             * @throws JBIRemoteException on error
100:             */
101:            protected void closeJmxConnection() throws JBIRemoteException {
102:                try {
103:                    this .mJmxConnection.closeConnection();
104:                } catch (JMXConnectionException jmxEx) {
105:                    throw new JBIRemoteException(jmxEx);
106:                }
107:            }
108:
109:            /**
110:             * open connection, invokes the operation on mbean and closes connection.
111:             * This should not be used if the connection is already opened or not to be close
112:             * after the invoke operation.
113:             * @return result object
114:             * @param objectName object name
115:             * @param operationName operation name
116:             * @param params parameters
117:             * @param signature signature of the parameters
118:             * @throws JBIRemoteException on error
119:             */
120:            public Object invokeMBeanOperation(ObjectName objectName,
121:                    String operationName, Object[] params, String[] signature)
122:                    throws JBIRemoteException {
123:
124:                Object result = null;
125:                openJmxConnection();
126:                try {
127:                    result = this .mJmxConnection.invokeMBeanOperation(
128:                            objectName, operationName, params, signature);
129:                } catch (JMXConnectionException jmxEx) {
130:                    throw new JBIRemoteException(jmxEx);
131:                } catch (JBIRemoteException jbiREx) {
132:                    throw jbiREx;
133:                } finally {
134:                    try {
135:                        closeJmxConnection();
136:                    } catch (Exception ex) {
137:                        // this is clean up. so ignore.
138:                        // log it.
139:                    }
140:                }
141:
142:                return result;
143:
144:            }
145:
146:            /**
147:             * single param opeartion invocation.
148:             * This should not be used if the connection is already opened or not to be close
149:             * after the invoke operation.
150:             * @return result object
151:             * @param objectName object name
152:             * @param operationName operation name
153:             * @param param String parameter
154:             * @throws JBIRemoteException on error
155:             */
156:            public Object invokeMBeanOperation(ObjectName objectName,
157:                    String operationName, String param)
158:                    throws JBIRemoteException {
159:
160:                Object result = null;
161:                Object[] params = new Object[1];
162:                params[0] = param;
163:
164:                String[] signature = new String[1];
165:                signature[0] = "java.lang.String";
166:
167:                return invokeMBeanOperation(objectName, operationName, params,
168:                        signature);
169:
170:            }
171:
172:            /**
173:             * single param opeartion invocation.
174:             * This should not be used if the connection is already opened or not to be close
175:             * after the invoke operation.
176:             * @return result object
177:             * @param objectName object name
178:             * @param operationName operation name
179:             * @param param1 String parameter
180:             * @param param2 String parameter
181:             * @throws JBIRemoteException on error
182:             */
183:            public Object invokeMBeanOperation(ObjectName objectName,
184:                    String operationName, String param1, String param2)
185:                    throws JBIRemoteException {
186:
187:                Object result = null;
188:                Object[] params = new Object[2];
189:                params[0] = param1;
190:                params[1] = param2;
191:
192:                String[] signature = new String[2];
193:                signature[0] = "java.lang.String";
194:                signature[1] = "java.lang.String";
195:
196:                return invokeMBeanOperation(objectName, operationName, params,
197:                        signature);
198:
199:            }
200:
201:            /**
202:             * single param opeartion invocation.
203:             * This should not be used if the connection is already opened or not to be close
204:             * after the invoke operation.
205:             * @return result object
206:             * @param objectName object name
207:             * @param operationName operation name
208:             * @param param1 String parameter
209:             * @param param2 String parameter
210:             * @param param3 String parameter
211:             * @throws JBIRemoteException on error
212:             */
213:            public Object invokeMBeanOperation(ObjectName objectName,
214:                    String operationName, String param1, String param2,
215:                    String param3) throws JBIRemoteException {
216:
217:                Object result = null;
218:                Object[] params = new Object[3];
219:                params[0] = param1;
220:                params[1] = param2;
221:                params[2] = param3;
222:
223:                String[] signature = new String[3];
224:                signature[0] = "java.lang.String";
225:                signature[1] = "java.lang.String";
226:                signature[2] = "java.lang.String";
227:
228:                return invokeMBeanOperation(objectName, operationName, params,
229:                        signature);
230:
231:            }
232:
233:            /**
234:             * single param opeartion invocation.
235:             * This should not be used if the connection is already opened or not to be close
236:             * after the invoke operation.
237:             * @return result object
238:             * @param param4 String parameter.
239:             * @param objectName object name
240:             * @param operationName operation name
241:             * @param param1 String parameter
242:             * @param param2 String parameter
243:             * @param param3 String parameter
244:             * @throws JBIRemoteException on error
245:             */
246:            public Object invokeMBeanOperation(ObjectName objectName,
247:                    String operationName, String param1, String param2,
248:                    String param3, String param4) throws JBIRemoteException {
249:
250:                Object result = null;
251:                Object[] params = new Object[4];
252:                params[0] = param1;
253:                params[1] = param2;
254:                params[2] = param3;
255:                params[3] = param4;
256:
257:                String[] signature = new String[4];
258:                signature[0] = "java.lang.String";
259:                signature[1] = "java.lang.String";
260:                signature[2] = "java.lang.String";
261:                signature[3] = "java.lang.String";
262:
263:                return invokeMBeanOperation(objectName, operationName, params,
264:                        signature);
265:
266:            }
267:
268:            /**
269:             * open connection, invokes the operation on mbean and closes connection.
270:             * This should not be used if the connection is already opened or not to be close
271:             * after the invoke operation.
272:             * @return result object
273:             * @param objectName object name
274:             * @param attributeName attribute name
275:             * @throws JBIRemoteException on error
276:             */
277:            public Object getMBeanAttribute(ObjectName objectName,
278:                    String attributeName) throws JBIRemoteException {
279:
280:                Object result = null;
281:                openJmxConnection();
282:                try {
283:                    result = this .mJmxConnection.getMBeanAttribute(objectName,
284:                            attributeName);
285:                } catch (JMXConnectionException jmxEx) {
286:                    throw new JBIRemoteException(jmxEx);
287:                } catch (JBIRemoteException jbiREx) {
288:                    throw jbiREx;
289:                } finally {
290:                    try {
291:                        closeJmxConnection();
292:                    } catch (Exception ex) {
293:                        // this is clean up. so ignore.
294:                        // log it.
295:                    }
296:                }
297:
298:                return result;
299:
300:            }
301:
302:            /**
303:             * returns admin service mbean object name
304:             * @throws JBIRemoteException on error
305:             * @return object name
306:             */
307:            public ObjectName getAdminServiceMBeanObjectName()
308:                    throws JBIRemoteException {
309:                try {
310:                    ObjectName mbeanName = JBIJMXObjectNames
311:                            .getAdminServiceMBeanObjectName();
312:                    return mbeanName;
313:                } catch (MalformedObjectNameException objEx) {
314:                    throw new JBIRemoteException(objEx.getMessage(), objEx);
315:                }
316:            }
317:
318:            /**
319:             * returns ui mbean jmx object name.
320:             * @throws JBIRemoteException on error
321:             * @return object jmx object name
322:             */
323:            public ObjectName getJbiAdminUiMBeanObjectName()
324:                    throws JBIRemoteException {
325:                try {
326:                    ObjectName mbeanName = JBIJMXObjectNames
327:                            .getJbiAdminUiMBeanObjectName();
328:                    return mbeanName;
329:                } catch (MalformedObjectNameException objEx) {
330:                    throw new JBIRemoteException(objEx.getMessage(), objEx);
331:                }
332:            }
333:
334:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.