Source Code Cross Referenced for CeltixBus.java in  » ESB » celtix-1.0 » org » objectweb » celtix » bus » busimpl » 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 » celtix 1.0 » org.objectweb.celtix.bus.busimpl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.celtix.bus.busimpl;
002:
003:        import java.util.Map;
004:
005:        import org.objectweb.celtix.Bus;
006:        import org.objectweb.celtix.BusEvent;
007:        import org.objectweb.celtix.BusEventCache;
008:        import org.objectweb.celtix.BusEventFilter;
009:        import org.objectweb.celtix.BusEventListener;
010:        import org.objectweb.celtix.BusException;
011:        import org.objectweb.celtix.bindings.BindingManager;
012:        import org.objectweb.celtix.bus.bindings.BindingManagerImpl;
013:        import org.objectweb.celtix.bus.configuration.ConfigurationEvent;
014:        import org.objectweb.celtix.bus.configuration.ConfigurationEventFilter;
015:        import org.objectweb.celtix.bus.jaxws.EndpointRegistryImpl;
016:        import org.objectweb.celtix.bus.management.InstrumentationManagerImpl;
017:        import org.objectweb.celtix.bus.resource.ResourceManagerImpl;
018:        import org.objectweb.celtix.bus.transports.TransportFactoryManagerImpl;
019:        import org.objectweb.celtix.bus.workqueue.WorkQueueManagerImpl;
020:        import org.objectweb.celtix.bus.wsdl.WSDLManagerImpl;
021:        import org.objectweb.celtix.buslifecycle.BusLifeCycleManager;
022:        import org.objectweb.celtix.configuration.Configuration;
023:        import org.objectweb.celtix.jaxws.EndpointRegistry;
024:        import org.objectweb.celtix.management.InstrumentationManager;
025:        import org.objectweb.celtix.plugins.PluginManager;
026:        import org.objectweb.celtix.resource.ResourceManager;
027:        import org.objectweb.celtix.transports.TransportFactoryManager;
028:        import org.objectweb.celtix.workqueue.WorkQueueManager;
029:        import org.objectweb.celtix.wsdl.WSDLManager;
030:
031:        public class CeltixBus extends Bus implements  BusEventListener {
032:
033:            public static final String CELTIX_WSDLMANAGER = "celtix.WSDLManager";
034:            public static final String CELTIX_TRANSPORTFACTORYMANAGER = "celtix.TRANSPORTFACTORYMANAGER";
035:
036:            private Configuration configuration;
037:            private BindingManager bindingManager;
038:            private Object clientRegistry;
039:            private EndpointRegistryImpl endpointRegistry;
040:            private TransportFactoryManager transportFactoryManager;
041:            private WSDLManager wsdlManager;
042:            private PluginManager pluginManager;
043:            private CeltixBusLifeCycleManager lifeCycleManager;
044:            private WorkQueueManager workQueueManager;
045:            private ResourceManager resourceManager;
046:            private InstrumentationManager instrumentationManager;
047:            private BusEventCache eventCache;
048:            private BusEventProcessor eventProcessor;
049:            private String busID;
050:            private boolean servicesMonitoring;
051:
052:            /**
053:             * Used by the <code>BusFactory</code> to initialize a new bus.
054:             *
055:             * @param args the command line configuration of this <code>Bus</code>.
056:             */
057:            public void initialize(String[] args, Map<String, Object> properties)
058:                    throws BusException {
059:
060:                lifeCycleManager = new CeltixBusLifeCycleManager();
061:
062:                // register a event cache for all bus events
063:                eventCache = new BusEventCacheImpl(this );
064:                //TODO: shall we add BusEventProcessor to a celtix bus registry?
065:                eventProcessor = new BusEventProcessor(this , eventCache);
066:
067:                configuration = new BusConfigurationBuilder().build(args,
068:                        properties);
069:                //Register bus on bus configuration to receive ConfigurationEvent
070:                ConfigurationEventFilter configurationEventFilter = new ConfigurationEventFilter();
071:                addListener((BusEventListener) this , configurationEventFilter);
072:
073:                busID = (String) configuration.getId();
074:                servicesMonitoring = configuration
075:                        .getBoolean("servicesMonitoring");
076:
077:                instrumentationManager = new InstrumentationManagerImpl(this );
078:
079:                if (properties.get(CELTIX_WSDLMANAGER) != null) {
080:                    wsdlManager = (WSDLManager) properties
081:                            .get(CELTIX_WSDLMANAGER);
082:                } else {
083:                    wsdlManager = new WSDLManagerImpl(this );
084:                }
085:
086:                if (properties.get(CELTIX_TRANSPORTFACTORYMANAGER) != null) {
087:                    transportFactoryManager = (TransportFactoryManager) properties
088:                            .get(CELTIX_TRANSPORTFACTORYMANAGER);
089:                } else {
090:                    transportFactoryManager = new TransportFactoryManagerImpl(
091:                            this );
092:                }
093:
094:                bindingManager = new BindingManagerImpl(this );
095:                workQueueManager = new WorkQueueManagerImpl(this );
096:                resourceManager = new ResourceManagerImpl(this );
097:
098:                // create and initialise the remaining objects:
099:                // clientRegistry = new ClientRegistry(this);
100:
101:                endpointRegistry = new EndpointRegistryImpl(this );
102:
103:                Bus.setCurrent(this );
104:
105:                lifeCycleManager.initComplete();
106:                //send bus component created event
107:                this .sendEvent(new ComponentCreatedEvent(this ));
108:            }
109:
110:            /**
111:             * Create and initialize a <code>Bus</code> object.
112:             *
113:             * @param args Any args, such as domain name, configuration scope,
114:             * that may be needed to identify and initialize this <code>Bus</code>.
115:             * @return Bus If a <code>Bus</code> has already been created using the same args,
116:             * it will return the existing <code>Bus</code> object.  Otherwise,
117:             * it creates a new <code>Bus</code>.
118:             * @throws BusException If there is an error initializing <code>Bus</code>.
119:             */
120:            public static synchronized Bus init(String[] args)
121:                    throws BusException {
122:                return null;
123:            }
124:
125:            /**
126:             * Shuts down the <code>Bus</code>.
127:             *
128:             * @param wait If <code>true</code>, waits for the <code>Bus</code>
129:             * to shutdown before returning, otherwise returns immediately.
130:             * @throws BusException
131:             */
132:            public void shutdown(boolean wait) throws BusException {
133:                //System.out.println("===Shutdown the bus===");
134:                lifeCycleManager.preShutdown();
135:
136:                // shutdown in inverse order of construction
137:
138:                endpointRegistry.shutdown();
139:
140:                transportFactoryManager.shutdown();
141:                bindingManager.shutdown();
142:                wsdlManager.shutdown();
143:                this .sendEvent(new ComponentRemovedEvent(this ));
144:                // handlerRegistry.shutdown(wait);
145:                // clientRegistry.shutdown(wait);
146:                // bindingManager.shutdown(wait);
147:                // configuration.shutdown();
148:
149:                workQueueManager.shutdown(wait);
150:                instrumentationManager.shutdown();
151:                lifeCycleManager.postShutdown();
152:                super .removeByID(getBusID());
153:            }
154:
155:            /* (non-Javadoc)
156:             * @see org.objectweb.celtix.Bus#run()
157:             */
158:            @Override
159:            public void run() {
160:                workQueueManager.run();
161:            }
162:
163:            /**
164:             * Returns the <code>Configuration</code> of this <code>Bus</code>.
165:             *
166:             * @return Configuration the configuration of this <code>bus</code>.
167:             */
168:            public Configuration getConfiguration() {
169:                return configuration;
170:            }
171:
172:            /**
173:             * Returns the <code>BindingManager</code> of this <code>Bus</code>.
174:             *
175:             * @return BindingManager of this <code>Bus</code>.
176:             */
177:            public BindingManager getBindingManager() {
178:                return bindingManager;
179:            }
180:
181:            /**
182:             * Returns the <code>TransportFactoryManager</code> of this <code>Bus</code>.
183:             *
184:             * @return TransportFactoryManager the transport factory manager of this <code>Bus</code>.
185:             */
186:            public TransportFactoryManager getTransportFactoryManager() {
187:                return transportFactoryManager;
188:            }
189:
190:            /**
191:             * Returns the <code>ClientRegistry</code> of this <code>Bus</code>.
192:             *
193:             * @return ClientRegistry the client registry of this <code>Bus</code>.
194:             */
195:            public Object getClientRegistry() {
196:                return clientRegistry;
197:            }
198:
199:            public WSDLManager getWSDLManager() {
200:                return wsdlManager;
201:            }
202:
203:            /* (non-Javadoc)
204:             * @see org.objectweb.celtix.Bus#getPluginManager()
205:             */
206:            @Override
207:            public PluginManager getPluginManager() {
208:                return pluginManager;
209:            }
210:
211:            /**
212:             * Returns the <code>EndpointRegistry</code> of this <code>Bus</code>.
213:             *
214:             * @return EndpointRegistry the endpoint registry of this <code>Bus</code>.
215:             */
216:            public EndpointRegistry getEndpointRegistry() {
217:                return endpointRegistry;
218:            }
219:
220:            /* (non-Javadoc)
221:             * @see org.objectweb.celtix.Bus#getLifeCycleManager()
222:             */
223:            @Override
224:            public BusLifeCycleManager getLifeCycleManager() {
225:                return lifeCycleManager;
226:            }
227:
228:            /* (non-Javadoc)
229:             * @see org.objectweb.celtix.Bus#getWorkQueueManager()
230:             */
231:            @Override
232:            public WorkQueueManager getWorkQueueManager() {
233:                return workQueueManager;
234:            }
235:
236:            /* (non-Javadoc)
237:             * @see org.objectweb.celtix.Bus#getResourceManager()
238:             */
239:            @Override
240:            public ResourceManager getResourceManager() {
241:                return resourceManager;
242:            }
243:
244:            @Override
245:            public InstrumentationManager getInstrumentationManager() {
246:                return instrumentationManager;
247:            }
248:
249:            @Override
250:            public void sendEvent(BusEvent event) {
251:                eventProcessor.processEvent(event);
252:            }
253:
254:            @Override
255:            public void addListener(BusEventListener l, BusEventFilter filter)
256:                    throws BusException {
257:                eventProcessor.addListener(l, filter);
258:            }
259:
260:            @Override
261:            public void removeListener(BusEventListener l) throws BusException {
262:                eventProcessor.removeListener(l);
263:            }
264:
265:            @Override
266:            public BusEventCache getEventCache() {
267:                return eventCache;
268:            }
269:
270:            @Override
271:            public String getBusID() {
272:                return busID;
273:            }
274:
275:            public boolean isServicesMonitoring() {
276:                return servicesMonitoring;
277:            }
278:
279:            public void setServicesMonitoring(boolean pServicesMonitoring) {
280:                servicesMonitoring = pServicesMonitoring;
281:            }
282:
283:            // The notification between runtime components and corresponding
284:            // configurations to support dynamic configuration
285:            public void processEvent(BusEvent e) throws BusException {
286:                if (e.getID().equals(ConfigurationEvent.RECONFIGURED)) {
287:                    String configName = (String) e.getSource();
288:                    /*
289:                    if (LOG.isLoggable(Level.INFO)) {
290:                        LOG.info("CeltixBus processEvent " + configName + ": reconfigured.");
291:                    }
292:                     */
293:                    reConfigure(configName);
294:                }
295:            }
296:
297:            private void reConfigure(String configName) {
298:                if ("servicesMonitoring".equals(configName)) {
299:                    servicesMonitoring = configuration
300:                            .getBoolean("servicesMonitoring");
301:                }
302:
303:            }
304:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.