Source Code Cross Referenced for MqObjectNames.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » jonasmqconnect » util » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect.util;
002:
003:        import java.util.Iterator;
004:        import java.util.Set;
005:        import java.util.ArrayList;
006:
007:        import javax.management.MalformedObjectNameException;
008:        import javax.management.ObjectName;
009:
010:        import org.objectweb.jonas.jmx.JonasManagementRepr;
011:
012:        public class MqObjectNames {
013:
014:            /**
015:             * ObjectName of JOnAS MQ connector
016:             * @param domainName domain name
017:             * @param name connector name
018:             * @return ObjectName of JOnAS MQ connector
019:             */
020:            public static ObjectName getConnectorONByName(String domainName,
021:                    String name) {
022:                try {
023:                    return ObjectName.getInstance(domainName
024:                            + ":type=JonasMQConnector,name=" + name);
025:                } catch (Exception ex) {
026:                    ex.printStackTrace();
027:                    return null;
028:                }
029:            }
030:
031:            /**
032:             * ObjectName of all JOnAS MQ connectors deployed in a given JOnAS server
033:             * @param domainName domain name
034:             * @param serverName server name
035:             * @return ObjectName of all JOnAS MQ connectors deployed in a given JOnAS server
036:             */
037:            public static ObjectName[] getConnectorsON(String domainName,
038:                    String serverName) {
039:                try {
040:                    ObjectName on = ObjectName.getInstance(domainName
041:                            + ":type=JonasMQConnector,*");
042:                    Set set = JonasManagementRepr.queryNames(on, serverName);
043:                    ObjectName[] list = new ObjectName[set.size()];
044:                    int j = 0;
045:                    for (Iterator i = set.iterator(); i.hasNext();) {
046:                        list[j++] = (ObjectName) i.next();
047:                    }
048:                    return list;
049:                } catch (Exception ex) {
050:                    ex.printStackTrace(System.err);
051:                    return null;
052:                }
053:            }
054:
055:            /**
056:             * ObjectName of all JOnAS MQ connectors deployed in a given JOnAS server
057:             * @param domainName domain name
058:             * @param serverName server name
059:             * @return ObjectName list of all JOnAS MQ connectors deployed in a given JOnAS server
060:             */
061:            public static ArrayList getConnectorsONList(String domainName,
062:                    String serverName) {
063:                try {
064:                    ObjectName ons = ObjectName.getInstance(domainName
065:                            + ":type=JonasMQConnector,*");
066:                    Set set = JonasManagementRepr.queryNames(ons, serverName);
067:                    ArrayList list = new ArrayList();
068:                    int j = 0;
069:                    for (Iterator i = set.iterator(); i.hasNext();) {
070:                        ObjectName on = (ObjectName) i.next();
071:                        list.add(on.getKeyProperty("name"));
072:                    }
073:                    return list;
074:                } catch (Exception ex) {
075:                    ex.printStackTrace(System.err);
076:                    return null;
077:                }
078:            }
079:
080:            /**
081:             * ObjectName of a MQ destination created by deploying a given MQ connector
082:             * @param connector connector name
083:             * @param jndiName JNDI name of the MQ destination
084:             * @param domainName domain name
085:             * @return ObjectName of the MQ destination
086:             */
087:            public static ObjectName getDestinationON(String domainName,
088:                    String jndiName, String connector) {
089:                try {
090:                    return new ObjectName(domainName
091:                            + ":type=MQDestination,name=" + jndiName
092:                            + ",JonasMQConnector=" + connector);
093:                } catch (Exception ex) {
094:                    ex.printStackTrace(System.err);
095:                }
096:                return null;
097:            }
098:
099:            /**
100:             * ObjectName of all the destination created by deploying a given MQ connector
101:             * @param connector connector name
102:             * @param domainName domain name
103:             * @return ObjectName of the MQ destination
104:             */
105:            public static ObjectName getDestinationsON(String domainName,
106:                    String connector) {
107:                try {
108:                    return new ObjectName(domainName
109:                            + ":type=MQDestination,JonasMQConnector="
110:                            + connector + ",*");
111:                } catch (Exception ex) {
112:                    ex.printStackTrace(System.err);
113:                }
114:                return null;
115:            }
116:
117:            /**
118:             * ObjectName of Mdb
119:             * @param connectorON conector ObjectName
120:             * @param name the name of the requested MDB
121:             * @param serverName JOnAS server name
122:             * @return ObjectName of Mdb
123:             */
124:            public static ObjectName getMdbON(ObjectName connectorON,
125:                    String name, String serverName) {
126:                try {
127:                    Object[] params = {};
128:                    String[] signature = {};
129:                    String[] onMdbs = (String[]) JonasManagementRepr.invoke(
130:                            connectorON, "listConsumerObjectNames", params,
131:                            signature, serverName);
132:                    for (int i = 0; i < onMdbs.length; i++) {
133:                        ObjectName on = new ObjectName(onMdbs[i]);
134:                        String onName = on.getKeyProperty("name");
135:                        if (onName.equals(name)) {
136:                            return on;
137:                        }
138:                    }
139:                } catch (Exception ex) {
140:                    ex.printStackTrace();
141:                }
142:                return null;
143:            }
144:
145:            /**
146:             * ObjectName of parent connector
147:             * @param on ObjectName of ..
148:             * @param domainName domain name
149:             * @return the ObjectName of the parent connector, or null
150:             */
151:            public static ObjectName getParentConnectorON(String domainName,
152:                    ObjectName on) {
153:
154:                /*
155:                 * If on is a connector, simply return it
156:                 */
157:                if ("JonasMQConnector".equals(on.getKeyProperty("type"))) {
158:                    return on;
159:                }
160:
161:                /*
162:                 * Else guess the connector on
163:                 */
164:                ObjectName connectorON = null;
165:                try {
166:                    connectorON = ObjectName.getInstance(domainName
167:                            + ":type=JonasMQConnector,name="
168:                            + on.getKeyProperty("JonasMQConnector"));
169:                } catch (MalformedObjectNameException e) {
170:                    // TODO Auto-generated catch block
171:                    e.printStackTrace(System.err);
172:                }
173:                return connectorON;
174:            }
175:
176:        }
w_ww__._j_a__v___a_2s_.c_o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.