Source Code Cross Referenced for WebSpherePlatformContext.java in  » ESB » open-esb » com » sun » jbi » framework » websphere » 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.framework.websphere 
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:         * @(#)WebSpherePlatformContext.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.framework.websphere;
030:
031:        import com.sun.jbi.JBIProvider;
032:        import com.sun.jbi.security.KeyStoreUtil;
033:        import com.sun.jbi.platform.PlatformEventListener;
034:
035:        import java.io.File;
036:        import java.lang.reflect.Method;
037:        import java.util.Set;
038:        import java.util.HashSet;
039:        import java.util.Map;
040:        import java.util.logging.Logger;
041:        import java.util.Properties;
042:
043:        import javax.management.MBeanServerConnection;
044:        import javax.management.MBeanServer;
045:        import javax.naming.InitialContext;
046:        import javax.transaction.TransactionManager;
047:
048:        /**
049:         * Implementation of PlatformContext for WebSphere Application Server
050:         *
051:         * @author Sun Microsystems, Inc.
052:         */
053:        public class WebSpherePlatformContext implements 
054:                com.sun.jbi.platform.PlatformContext {
055:            private String mInstanceName;
056:            private String mInstanceRoot;
057:            private String mInstallRoot;
058:            private InitialContext mNamingContext;
059:            private Logger mLog = Logger.getLogger(getClass().getPackage()
060:                    .getName());
061:
062:            /**
063:             * Creates a new instance of WebSpherePlatformContext
064:             * @param instanceName the instanceName
065:             * @param installRoot the installRoot
066:             */
067:            public WebSpherePlatformContext(String instanceName,
068:                    String installRoot) {
069:                mInstanceName = instanceName;
070:                mInstallRoot = installRoot;
071:                mInstanceRoot = installRoot + File.separator + instanceName;
072:
073:                try {
074:                    Properties prop = new Properties();
075:                    mNamingContext = new InitialContext(prop);
076:
077:                } catch (javax.naming.NamingException nmEx) {
078:                    mLog.warning(nmEx.toString());
079:                }
080:            }
081:
082:            /**
083:             * Get the TransactionManager for this implementation. The instance
084:             * returned is an implementation of the standard JTS interface. If none
085:             * is available, returns <CODE>null</CODE>.
086:             * @return a <CODE>TransactionManager</CODE> instance.
087:             * @throws Exception if a <CODE>TransactionManager</CODE> cannot be obtained.
088:             */
089:            public javax.transaction.TransactionManager getTransactionManager()
090:                    throws Exception {
091:                try {
092:                    Class transactionManagerFactory = this .getClass().forName(
093:                            "com.ibm.ws.Transaction.TransactionManagerFactory");
094:                    Method getTransactionManagerMethod = transactionManagerFactory
095:                            .getMethod("getTransactionManager", null);
096:                    TransactionManager transactionManager = (TransactionManager) getTransactionManagerMethod
097:                            .invoke(null, null);
098:                } catch (Exception ex) {
099:                    mLog.severe(ex.getMessage());
100:                    ex.printStackTrace();
101:                }
102:
103:                return null;
104:            }
105:
106:            /**
107:             * Get the MBean server connection for a particular instance.
108:             * @return the <CODE>MBeanServerConnection</CODE> for the specified instance.
109:             * @param instanceName the instance name
110:             * @throws Exception if MBeanServerConnection could not be obtained
111:             */
112:            public MBeanServerConnection getMBeanServerConnection(
113:                    String instanceName) throws Exception {
114:                return getMBeanServer();
115:            }
116:
117:            /**
118:             * Get the instance name of the platform's administration server.  If the
119:             * platform does not provide a separate administration server, then this 
120:             * method returns the name of the local instance.
121:             * @return instance name of the administration server
122:             */
123:            public String getAdminServerName() {
124:                return mInstanceName;
125:            }
126:
127:            /**
128:             * Determine whether this instance is the administration server instance.
129:             * @return <CODE>true</CODE> if this instance is the administration server,
130:             * <CODE>false</CODE> if not.
131:             */
132:            public boolean isAdminServer() {
133:                return true;
134:            }
135:
136:            /**
137:             * Get the name of this instance.
138:             * @return the name of this server instance.
139:             */
140:            public String getInstanceName() {
141:                return mInstanceName;
142:            }
143:
144:            /**
145:             * Determine if the specified instance is up.
146:             * @return true if the instance is up and running, false otherwise
147:             * @param instanceName the instance name
148:             */
149:            public boolean isInstanceUp(String instanceName) {
150:                return mInstanceName.equals(instanceName);
151:            }
152:
153:            /**
154:             * Determine whether multiple servers are permitted within this AS
155:             * installation.
156:             * @return true if multiple servers are permitted.
157:             */
158:            public boolean supportsMultipleServers() {
159:                return false;
160:            }
161:
162:            /**
163:             * Get the Target Name. If the instance is not a clustered instance then
164:             * the target name is the instance name. If the instance is part of a
165:             * cluster then the target name is the cluster name.
166:             *
167:             * @return the target name. 
168:             */
169:            public String getTargetName() {
170:                return mInstanceName;
171:            }
172:
173:            /**
174:             * Get the Target Name for a specified instance. If the instance is not
175:             * clustered the instance name is returned. This operation is invoked by
176:             * the JBI instance MBeans only.
177:             * @return the target name.
178:             * @param instanceName the instance name
179:             */
180:            public String getTargetName(String instanceName) {
181:                return instanceName;
182:            }
183:
184:            /**
185:             * Get a set of the names of all the standalone servers in the domain.
186:             * @return a set of names of standalone servers in the domain.
187:             */
188:            public Set<String> getStandaloneServerNames() {
189:                HashSet<String> names = new HashSet<String>();
190:                names.add(mInstanceName);
191:                return names;
192:            }
193:
194:            /**
195:             * Get a set of the names of all the clustered servers in the domain.
196:             * @return a set of names of clustered servers in the domain.
197:             */
198:            public Set<String> getClusteredServerNames() {
199:                return new HashSet<String>();
200:            }
201:
202:            /**
203:             * Get a set of the names of all the clusters in the domain.
204:             * @return a set of names of clusters in the domain.
205:             */
206:            public Set<String> getClusterNames() {
207:                return new HashSet<String>();
208:            }
209:
210:            /**
211:             * Get a set of the names of all the servers in the specified cluster.
212:             * @return a set of names of servers in the cluster.
213:             * @param clusterName the cluster name
214:             */
215:            public Set<String> getServersInCluster(String clusterName) {
216:                return new HashSet<String>();
217:            }
218:
219:            /**
220:             * Determine whether a target is a valid server or cluster name.
221:             * @return <CODE>true</CODE> if <CODE>targetName</CODE> is a valid
222:             * standalone server name or cluster name, <CODE>false</CODE> if not.
223:             * @param targetName the target name
224:             */
225:            public boolean isValidTarget(String targetName) {
226:                return mInstanceName.equals(targetName);
227:            }
228:
229:            /**
230:             * Determine whether a target is a cluster.
231:             * @return <CODE>true</CODE> if <CODE>targetName</CODE> is a cluster,
232:             * <CODE>false</CODE> if not.
233:             * @param targetName the target name
234:             */
235:            public boolean isCluster(String targetName) {
236:                return false;
237:            }
238:
239:            /**
240:             * Determine whether a target is a standalone server.
241:             * @return <CODE>true</CODE> if <CODE>targetName</CODE> is a standalone
242:             * server, <CODE>false</CODE> if not.
243:             * @param targetName the target name
244:             */
245:            public boolean isStandaloneServer(String targetName) {
246:                return mInstanceName.equals(targetName);
247:            }
248:
249:            /**
250:             * Determine whether the target is a clustered server.
251:             * @return <CODE>true</CODE> if <CODE>targetName</CODE> is a clustered
252:             * server, <CODE>false</CODE> if not.
253:             * @param targetName the target Name
254:             */
255:            public boolean isClusteredServer(String targetName) {
256:                return false;
257:            }
258:
259:            /**
260:             * Determine whether or not an instance is clustered.
261:             * @return <CODE>true</CODE> if the instance is clustered,
262:             * <CODE>false</CODE> if not.
263:             * @param instanceName the instance Name
264:             */
265:            public boolean isInstanceClustered(String instanceName) {
266:                return false;
267:            }
268:
269:            /**
270:             * Get a string representation of the DAS JMX RMI connector port.
271:             * @return the JMX RMI connector port as a <CODE>String</CODE>.
272:             */
273:            public String getJmxRmiPort() {
274:                return null;
275:            }
276:
277:            /**
278:             * Provides access to the platform's MBean server.
279:             * @return platform MBean server.
280:             */
281:            public MBeanServer getMBeanServer() {
282:                MBeanServer mbeanServer = null;
283:                try {
284:                    Class adminServiceFactory = this .getClass().forName(
285:                            "com.ibm.websphere.management.AdminServiceFactory");
286:                    Method getMBeanFactoryMethod = adminServiceFactory
287:                            .getMethod("getMBeanFactory", null);
288:                    Object mbeanFactory = getMBeanFactoryMethod.invoke(null,
289:                            null);
290:                    Class mbeanFactoryClass = getMBeanFactoryMethod.invoke(
291:                            null, null).getClass();
292:                    Method getMBeanServerMethod = mbeanFactoryClass.getMethod(
293:                            "getMBeanServer", null);
294:                    mbeanServer = (MBeanServer) getMBeanServerMethod.invoke(
295:                            mbeanFactory, null);
296:                    //return AdminServiceFactory.getMBeanFactory().getMBeanServer();     
297:                } catch (Exception ex) {
298:                    mLog.severe(ex.getMessage());
299:                    ex.printStackTrace();
300:                }
301:                return mbeanServer;
302:            }
303:
304:            /**
305:             * Get the full path to the platform's instance root directory.
306:             * @return platform instance root
307:             */
308:            public String getInstanceRoot() {
309:                return mInstanceRoot;
310:            }
311:
312:            /**
313:             * Get the full path to the platform's instaall root directory.
314:             * @return platform install root
315:             */
316:            public String getInstallRoot() {
317:                return mInstallRoot;
318:            }
319:
320:            /**
321:             * Returns the provider type for this platform.
322:             * @return enum value corresponding to this platform implementation.
323:             */
324:            public JBIProvider getProvider() {
325:                return JBIProvider.WEBSPHERE;
326:            }
327:
328:            /**
329:             * Returns a platform-specific implementation of KeyStoreUtil.
330:             *
331:             * @return  an instance of KeyStoreUtil or null if KeyStoreUtil
332:             * is not supported as part of this platform.
333:             */
334:            public KeyStoreUtil getKeyStoreUtil() {
335:                return null;
336:            }
337:
338:            /**
339:             *  Retrieves the naming context that should be used to locate platform
340:             *  resources (e.g. TransactionManager).
341:             *  @return naming context
342:             */
343:            public InitialContext getNamingContext() {
344:                return mNamingContext;
345:            }
346:
347:            /**
348:             * Get the JBI system class loader for this implementation.
349:             * This is the JBI common classloader and is the parent of the JBI runtime
350:             * classloader that loaded this class.
351:             *
352:             * @return the <CODE>ClassLoader</CODE> that is the "system" class loader
353:             * from a JBI runtime perspective.
354:             * @throws SecurityException if access to the class loader is denied.
355:             */
356:            public ClassLoader getSystemClassLoader() throws SecurityException {
357:                return this .getClass().getClassLoader().getParent();
358:            }
359:
360:            /**
361:             * Register a listener for platform events.
362:             * @param listener listener implementation
363:             */
364:            public void addListener(PlatformEventListener listener) {
365:                // NOP
366:            }
367:
368:            /**
369:             * Remove a listener for platform events.
370:             * @param listener listener implementation
371:             */
372:            public void removeListener(PlatformEventListener listener) {
373:                // NOP
374:            }
375:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.