Source Code Cross Referenced for DeploymentRegistry.java in  » Workflow-Engines » Dalma » 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 » Workflow Engines » Dalma » com.sun.jbi.engine.sequencing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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