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