Source Code Cross Referenced for JMXConnectionFactory.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:         * @(#)JMXConnectionFactory.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.JBIResultXmlBuilder;
032:        import com.sun.jbi.ui.common.JMXConnectionException;
033:        import com.sun.jbi.ui.common.I18NBundle;
034:
035:        import java.util.Properties;
036:
037:        /**
038:         * Abstract facoty implementation.
039:         *
040:         * @author Sun Microsystems, Inc.
041:         */
042:        public abstract class JMXConnectionFactory {
043:            /**
044:             * property name for class to load.
045:             */
046:            public static final String FACTORY_IMPL_CLASS_PROP = "com.sun.jbi.tools.jmx.connection.factory";
047:
048:            /**
049:             * if no property set, try load this impl class.
050:             */
051:            public static final String FACTORY_IMPL_CLASS = "com.sun.jbi.ui.client.jmxremote.RemoteJMXConnectionFactory";
052:            /** i18n */
053:            private static I18NBundle sI18NBundle = null;
054:
055:            /**
056:             * The full path/name of the property file.
057:             */
058:            private static String sFullPropertyFileName = null;
059:
060:            /** gives the I18N bundle.
061:             *@return I18NBundle object
062:             */
063:            protected static I18NBundle getI18NBundle() {
064:                // lazzy initialize the JBI Client
065:                if (sI18NBundle == null) {
066:                    sI18NBundle = new I18NBundle("com.sun.jbi.ui.client");
067:                }
068:                return sI18NBundle;
069:            }
070:
071:            /**
072:             *
073:             *
074:             * @param conprops
075:             *
076:             * @return
077:             */
078:            public abstract JMXConnection getConnection(Properties conprops)
079:                    throws JMXConnectionException;
080:
081:            /**
082:             * creates jmx connection.
083:             *
084:             * @param provprops
085:             * @param host host name
086:             * @param port port number
087:             * @param username username
088:             * @param password password
089:             *
090:             * @return jmx connection
091:             */
092:            public static Properties getConnectionProperties(
093:                    Properties provprops, String host, String port,
094:                    String username, String password) {
095:                Properties props = JMXConnectionProperties
096:                        .getJMXConnectionPropertyMap(provprops, null, host,
097:                                port, username, password);
098:
099:                return props;
100:            }
101:
102:            /**
103:             *
104:             *
105:             * @param factoryImplName
106:             *
107:             * @return
108:             */
109:            public static JMXConnectionFactory newInstance(
110:                    String factoryImplName) throws JMXConnectionException {
111:                if ((factoryImplName == null)
112:                        || (factoryImplName.trim().equals(""))) {
113:                    return newInstance();
114:                }
115:
116:                try {
117:                    Class cl = Class.forName(factoryImplName);
118:
119:                    return (JMXConnectionFactory) cl.newInstance();
120:                } catch (Exception ex) {
121:                    // pass null to the cause as you have already serialized the cause to jbi mgmt xml
122:                    throw new JMXConnectionException(JBIResultXmlBuilder
123:                            .createJbiResultXml(getI18NBundle(),
124:                                    "jbi.ui.client.connection.factory.error",
125:                                    new Object[] { factoryImplName }, ex), null);
126:                }
127:            }
128:
129:            /**
130:             *
131:             *
132:             * @param factoryImplName
133:             *
134:             * @return
135:             */
136:            public static JMXConnectionFactory newInstance(Properties props)
137:                    throws JMXConnectionException {
138:                String facImplname = null;
139:
140:                if (props != null) {
141:                    facImplname = (String) props
142:                            .getProperty(FACTORY_IMPL_CLASS_PROP);
143:                }
144:
145:                return newInstance(facImplname);
146:            }
147:
148:            /**
149:             *
150:             *
151:             * @return
152:             */
153:            public static JMXConnectionFactory newInstance()
154:                    throws JMXConnectionException {
155:                String factoryImplClass = JMXConnectionProperties.getInstance()
156:                        .getDefaultConnectionFactory();
157:
158:                if (factoryImplClass == null) {
159:                    factoryImplClass = FACTORY_IMPL_CLASS;
160:                }
161:
162:                JMXConnectionFactory impl = null;
163:
164:                try {
165:                    impl = (JMXConnectionFactory) Class.forName(
166:                            factoryImplClass).newInstance();
167:                } catch (Exception ex) {
168:                    // any exception, just load the default class?
169:                    // pass null to the cause as you have already serialized the cause to jbi mgmt xml
170:                    throw new JMXConnectionException(JBIResultXmlBuilder
171:                            .createJbiResultXml(getI18NBundle(),
172:                                    "jbi.ui.client.connection.factory.error",
173:                                    new Object[] { factoryImplClass }, ex),
174:                            null);
175:
176:                }
177:
178:                return impl;
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.