Source Code Cross Referenced for DeploymentRegistry.java in  » ESB » open-esb » com » sun » jbi » engine » sequencing » 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.engine.sequencing 
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:         * @(#)DeploymentRegistry.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.engine.sequencing;
030:
031:        import com.sun.jbi.engine.sequencing.servicelist.ServicelistBean;
032:        import com.sun.jbi.engine.sequencing.util.StringTranslator;
033:
034:        import java.util.ArrayList;
035:        import java.util.Collection;
036:        import java.util.HashMap;
037:        import java.util.Iterator;
038:        import java.util.List;
039:        import java.util.Set;
040:        import java.util.logging.Logger;
041:
042:        /**
043:         * This is a registry which maintains the list of deployed services and  the
044:         * bean object.
045:         *
046:         * @author Sun Microsystems, Inc.
047:         */
048:        public final class DeploymentRegistry implements 
049:                SequencingEngineResources {
050:            /**
051:             * Singleton reference.
052:             */
053:            private static DeploymentRegistry sMe;
054:
055:            /**
056:             * List of all registered channels.
057:             */
058:            private HashMap mDeployments;
059:
060:            /**
061:             * Logger object
062:             */
063:            private Logger mLog;
064:
065:            /**
066:             * Translator object for internationalization.
067:             */
068:            private StringTranslator mTranslator;
069:
070:            /**
071:             * Private constructor.
072:             */
073:            private DeploymentRegistry() {
074:                mDeployments = new HashMap();
075:                mLog = SequencingEngineContext.getInstance().getLogger();
076:                mTranslator = new StringTranslator();
077:            }
078:
079:            /**
080:             * Used to grab a reference of this object.
081:             *
082:             * @return an initialized ChannelRegistry reference
083:             */
084:            public static synchronized DeploymentRegistry getInstance() {
085:                if (sMe == null) {
086:                    sMe = new DeploymentRegistry();
087:                }
088:
089:                return sMe;
090:            }
091:
092:            /**
093:             * Returns all the deployments to SE.
094:             *
095:             * @return Array of deployment Ids.
096:             */
097:            public synchronized String[] getAllDeployments() {
098:                List deps = new ArrayList();
099:                Collection col = mDeployments.values();
100:                Iterator iter = col.iterator();
101:
102:                while (iter.hasNext()) {
103:                    ServicelistBean eb = (ServicelistBean) iter.next();
104:                    String depid = eb.getDeploymentId();
105:                    deps.add(depid);
106:                }
107:
108:                String[] deployments = new String[deps.size()];
109:                Iterator depiter = deps.iterator();
110:                int i = 0;
111:
112:                while (depiter.hasNext()) {
113:                    deployments[i] = (String) depiter.next();
114:                    i++;
115:                }
116:
117:                return deployments;
118:            }
119:
120:            /**
121:             * Util method to find if a service has been deployed.
122:             *
123:             * @param servicename Service name
124:             *
125:             * @return true if deployed, false otherwise.
126:             */
127:            public boolean isDeployed(String servicename) {
128:                if (mDeployments.get(servicename) == null) {
129:                    return false;
130:                }
131:
132:                return true;
133:            }
134:
135:            /**
136:             * Gets the status of the asa id.
137:             *
138:             * @param asId sub-assembly id
139:             *
140:             * @return true if deployed , false otherwise.
141:             */
142:            public boolean getDeploymentStatus(String asId) {
143:                Set keyset = mDeployments.keySet();
144:                Iterator iter = keyset.iterator();
145:
146:                while (iter.hasNext()) {
147:                    String ser = (String) iter.next();
148:                    ServicelistBean eb = (ServicelistBean) mDeployments
149:                            .get(ser);
150:
151:                    if (eb.getDeploymentId().equals(asId)) {
152:                        return true;
153:                    }
154:                }
155:
156:                return false;
157:            }
158:
159:            /**
160:             * Gets the servicelist bean associated with the ASA id.
161:             *
162:             * @param asId ASA ID.
163:             *
164:             * @return list of serviclist bean.
165:             */
166:            public ServicelistBean getService(String asId) {
167:                Set keyset = mDeployments.keySet();
168:                Iterator iter = keyset.iterator();
169:
170:                while (iter.hasNext()) {
171:                    String ser = (String) iter.next();
172:                    ServicelistBean sb = (ServicelistBean) mDeployments
173:                            .get(ser);
174:
175:                    if (sb.getDeploymentId().trim().equals(asId)) {
176:                        return sb;
177:                    }
178:                }
179:
180:                return null;
181:            }
182:
183:            /**
184:             * Removes all the entries from the registry.
185:             */
186:            public void clearRegistry() {
187:                if (mDeployments == null) {
188:                    return;
189:                }
190:
191:                mDeployments = new HashMap();
192:            }
193:
194:            /**
195:             * Removes a service from the registry.
196:             *
197:             * @param service service name
198:             */
199:            public synchronized void deregisterService(String service) {
200:                mLog.info(mTranslator
201:                        .getString(SEQ_DEREGISTER_SERVICE, service));
202:
203:                ServicelistBean eb = (ServicelistBean) mDeployments
204:                        .remove(service);
205:
206:                if (eb == null) {
207:                    mLog.severe(mTranslator.getString(
208:                            SEQ_DEREGISTER_SERVICE_FAILED, service));
209:                }
210:            }
211:
212:            /**
213:             * Gets the Service list associated with the service name .
214:             *
215:             * @param servicename service name
216:             *
217:             * @return servicelist bean
218:             */
219:            public ServicelistBean findService(String servicename) {
220:                ServicelistBean sb;
221:                sb = (ServicelistBean) mDeployments.get(servicename);
222:
223:                return sb;
224:            }
225:
226:            /**
227:             * List all endpoints currently present in the registry.
228:             *
229:             * @return an iterator over all endpoints in the registry.
230:             */
231:            public Iterator listAllServices() {
232:                if (mDeployments == null) {
233:                    return null;
234:                }
235:
236:                Set tmp = mDeployments.keySet();
237:
238:                if (tmp == null) {
239:                    return null;
240:                }
241:
242:                return tmp.iterator();
243:            }
244:
245:            /**
246:             * Registers an endpoint with the registry.  Duplicates are allowed and no
247:             * validation is performed at this point.
248:             *
249:             * @param service the endpoint to register
250:             * @param listbean list bean
251:             */
252:            public synchronized void registerService(String service,
253:                    ServicelistBean listbean) {
254:                mLog.info(mTranslator.getString(SEQ_REGISTER_SERVICE, service));
255:                mDeployments.put(service, listbean);
256:            }
257:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.