Source Code Cross Referenced for CbComponent.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » runtime » ccsl » jbi » messaging » 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 » cbesb 1.2 » com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        /*
019:         * ChainBuilder ESB
020:         * 		Visual Enterprise Integration
021:         * 
022:         * Copyright (C) 2006 Bostech Corporation
023:         * 
024:         * This program is free software; you can redistribute it and/or modify it 
025:         * under the terms of the GNU General Public License as published by the 
026:         * Free Software Foundation; either version 2 of the License, or (at your option) 
027:         * any later version.
028:         *
029:         * This program is distributed in the hope that it will be useful, 
030:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
031:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
032:         * for more details.
033:         * 
034:         * You should have received a copy of the GNU General Public License along with 
035:         * this program; if not, write to the Free Software Foundation, Inc., 
036:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
037:         *
038:         * $Id: CbComponent.java 9975 2007-11-09 03:11:12Z lzheng $
039:         */
040:        package com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging;
041:
042:        import javax.jbi.component.Component;
043:        import javax.jbi.component.ComponentContext;
044:        import javax.jbi.component.ComponentLifeCycle;
045:        import javax.jbi.component.ServiceUnitManager;
046:        import javax.jbi.messaging.MessageExchange;
047:        import javax.jbi.messaging.MessageExchange.Role;
048:        import javax.jbi.servicedesc.ServiceEndpoint;
049:        import javax.resource.spi.work.WorkManager;
050:
051:        import org.apache.commons.logging.Log;
052:        import org.apache.commons.logging.LogFactory;
053:        import org.w3c.dom.Document;
054:        import org.w3c.dom.DocumentFragment;
055:
056:        import com.bostechcorp.cbesb.common.version.Version;
057:
058:        /**
059:         * Base class for a component.
060:         * 
061:         * @author Guillaume Nodet
062:         * @version $Revision: 426415 $
063:         * @since 3.0
064:         */
065:        public abstract class CbComponent implements  Component {
066:
067:            protected final transient Log logger = LogFactory
068:                    .getLog(getClass());
069:
070:            protected CbLifeCycle lifeCycle;
071:            protected ComponentRegistry registry;
072:            protected CbServiceUnitManager serviceUnitManager;
073:            protected Version versionInfo;
074:            protected Version ccslLibVersionInfo;
075:
076:            public CbComponent() {
077:                lifeCycle = createLifeCycle();
078:                registry = createRegistry();
079:                serviceUnitManager = createServiceUnitManager();
080:            }
081:
082:            /* (non-Javadoc)
083:             * @see javax.jbi.component.Component#getLifeCycle()
084:             */
085:            public ComponentLifeCycle getLifeCycle() {
086:                return lifeCycle;
087:            }
088:
089:            /* (non-Javadoc)
090:             * @see javax.jbi.component.Component#getServiceUnitManager()
091:             */
092:            public ServiceUnitManager getServiceUnitManager() {
093:                return serviceUnitManager;
094:            }
095:
096:            /* (non-Javadoc)
097:             * @see javax.jbi.component.Component#getServiceDescription(javax.jbi.servicedesc.ServiceEndpoint)
098:             */
099:            public Document getServiceDescription(ServiceEndpoint endpoint) {
100:                if (logger.isDebugEnabled()) {
101:                    logger
102:                            .debug("Querying service description for "
103:                                    + endpoint);
104:                }
105:                String key = EndpointKeyUtil.getKey(endpoint);
106:                CbEndpoint ep = this .registry.getEndpoint(key);
107:                if (ep != null) {
108:                    Document doc = ep.getDescription();
109:                    if (doc == null) {
110:                        if (logger.isDebugEnabled()) {
111:                            logger.debug("No description found for " + key);
112:                        }
113:                    }
114:                    return doc;
115:                } else {
116:                    if (logger.isDebugEnabled()) {
117:                        logger.debug("No endpoint found for " + key);
118:                    }
119:                    return null;
120:                }
121:            }
122:
123:            /* (non-Javadoc)
124:             * @see javax.jbi.component.Component#isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint, javax.jbi.messaging.MessageExchange)
125:             */
126:            public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint,
127:                    MessageExchange exchange) {
128:                String key = EndpointKeyUtil.getKey(endpoint);
129:                CbEndpoint ep = this .registry.getEndpoint(key);
130:                if (ep != null) {
131:                    if (ep.getRole() != Role.PROVIDER) {
132:                        if (logger.isDebugEnabled()) {
133:                            logger
134:                                    .debug("Endpoint "
135:                                            + key
136:                                            + " is a consumer. Refusing exchange with consumer.");
137:                        }
138:                        return false;
139:                    } else {
140:                        return ep.isExchangeOkay(exchange);
141:                    }
142:                } else {
143:                    if (logger.isDebugEnabled()) {
144:                        logger.debug("No endpoint found for " + key
145:                                + ". Refusing exchange with consumer.");
146:                    }
147:                    return false;
148:                }
149:            }
150:
151:            /* (non-Javadoc)
152:             * @see javax.jbi.component.Component#isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint, javax.jbi.messaging.MessageExchange)
153:             */
154:            public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint,
155:                    MessageExchange exchange) {
156:                // TODO: check if the selected endpoint is good for us
157:                return true;
158:            }
159:
160:            /* (non-Javadoc)
161:             * @see javax.jbi.component.Component#resolveEndpointReference(org.w3c.dom.DocumentFragment)
162:             */
163:            public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
164:                return null;
165:            }
166:
167:            /**
168:             * Create the life cycle object.
169:             * Derived classes should override this method to be able to
170:             * use a custom life cycle implementation.
171:             * 
172:             * @return a life cycle object
173:             */
174:            protected CbLifeCycle createLifeCycle() {
175:                return new CbLifeCycle(this );
176:            }
177:
178:            /**
179:             * Create the service unit manager.
180:             * Derived classes should override this method and return a 
181:             * BaseServiceUnitManager so that the component is able to 
182:             * handle service unit deployment.
183:             * 
184:             * @return a service unit manager
185:             */
186:            protected CbServiceUnitManager createServiceUnitManager() {
187:                return null;
188:            }
189:
190:            protected ComponentRegistry createRegistry() {
191:                return new ComponentRegistry(this );
192:            }
193:
194:            public ComponentContext getComponentContext() {
195:                return lifeCycle.getContext();
196:            }
197:
198:            public String getComponentName() {
199:                if (getComponentContext() == null) {
200:                    return "Component (" + getClass().getName()
201:                            + ") not yet initialized";
202:                }
203:                return getComponentContext().getComponentName();
204:            }
205:
206:            public WorkManager getWorkManager() {
207:                return lifeCycle.workManager;
208:            }
209:
210:            /**
211:             * @return Returns the logger.
212:             */
213:            public Log getLogger() {
214:                return logger;
215:            }
216:
217:            /**
218:             * @return Returns the registry.
219:             */
220:            public ComponentRegistry getRegistry() {
221:                return registry;
222:            }
223:
224:            public Version getVersionInfo() {
225:                return versionInfo;
226:            }
227:
228:            public void setVersionInfo(Version versionInfo) {
229:                this .versionInfo = versionInfo;
230:            }
231:
232:            public Version getCcslLibVersionInfo() {
233:                return ccslLibVersionInfo;
234:            }
235:
236:            public void setCcslLibVersionInfo(Version ccslLibVersionInfo) {
237:                this.ccslLibVersionInfo = ccslLibVersionInfo;
238:            }
239:
240:        }
w_w_w_.___jav_a___2___s.co___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.