Source Code Cross Referenced for MDBMessageEndPoint.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » container » mdb » 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 » ow2 easybeans » org.ow2.easybeans.container.mdb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * EasyBeans
003:         * Copyright (C) 2006-2007 Bull S.A.S.
004:         * Contact: easybeans@ow2.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id:MDBMessageEndPoint.java 1477 2007-06-16 16:50:19Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.container.mdb;
025:
026:        import java.lang.reflect.Method;
027:
028:        import javax.ejb.Timer;
029:        import javax.resource.ResourceException;
030:        import javax.resource.spi.ApplicationServerInternalException;
031:        import javax.resource.spi.UnavailableException;
032:        import javax.resource.spi.endpoint.MessageEndpoint;
033:        import javax.transaction.xa.XAResource;
034:
035:        import org.ow2.easybeans.api.Factory;
036:        import org.ow2.easybeans.api.bean.EasyBeansMDB;
037:
038:        /**
039:         * Implementation of the MessageEndPoint interface.<br/> These methods will be
040:         * called by the Resource Adapter.
041:         * @author Florent Benoit
042:         */
043:        public class MDBMessageEndPoint implements  MessageEndpoint {
044:
045:            /**
046:             * MDB object Wrapped by this message end point.
047:             */
048:            private EasyBeansMDB easyBeansMDB = null;
049:
050:            /**
051:             * Reference to the message end point factory.
052:             */
053:            private MDBMessageEndPointFactory mdbMessageEndPointFactory = null;
054:
055:            /**
056:             * XAResource of this message end point. This resource will be
057:             * enlisted/delisted.
058:             */
059:            private XAResource xaResource = null;
060:
061:            /**
062:             * Constructor : Build an endpoint with a reference to the message end point
063:             * factory.
064:             * @param mdbMessageEndPointFactory the message end point factory.
065:             * @param easyBeansMDB the message driven bean object that is wrapped.
066:             */
067:            public MDBMessageEndPoint(
068:                    final MDBMessageEndPointFactory mdbMessageEndPointFactory,
069:                    final EasyBeansMDB easyBeansMDB) {
070:                this .mdbMessageEndPointFactory = mdbMessageEndPointFactory;
071:                this .easyBeansMDB = easyBeansMDB;
072:            }
073:
074:            /**
075:             * This is called by a resource adapter before a message is delivered.
076:             * @param method description of a target method. This information about the
077:             *        intended target method allows an application server to decide
078:             *        whether to start a transaction during this method call, depending
079:             *        on the transaction preferences of the target method. The
080:             *        processing (by the application server) of the actual message
081:             *        delivery method call on the endpoint must be independent of the
082:             *        class loader associated with this descriptive method object.
083:             * @throws NoSuchMethodException - indicates that the specified method does
084:             *         not exist on the target endpoint.
085:             * @throws ResourceException - generic exception.
086:             * @throws ApplicationServerInternalException - indicates an error condition
087:             *         in the application server.
088:             * @throws IllegalStateException - indicates that the endpoint is in an
089:             *         illegal state for the method invocation. For example, this occurs
090:             *         when beforeDelivery and afterDelivery method calls are not
091:             *         paired.
092:             * @throws UnavailableException - indicates that the endpoint is not
093:             *         available.
094:             */
095:            public void beforeDelivery(final Method method)
096:                    throws ApplicationServerInternalException,
097:                    UnavailableException, NoSuchMethodException,
098:                    IllegalStateException, ResourceException {
099:                // TODO : implement this !
100:                throw new UnsupportedOperationException("Not implemented");
101:            }
102:
103:            /**
104:             * This is called by a resource adapter after a message is delivered.
105:             * @throws ResourceException - generic exception.
106:             * @throws ApplicationServerInternalException - indicates an error condition
107:             *         in the application server.
108:             * @throws IllegalStateException - indicates that the endpoint is in an
109:             *         illegal state for the method invocation. For example, this occurs
110:             *         when beforeDelivery and afterDelivery method calls are not
111:             *         paired.
112:             * @throws UnavailableException - indicates that the endpoint is not
113:             *         available.
114:             */
115:            public void afterDelivery()
116:                    throws ApplicationServerInternalException,
117:                    IllegalStateException, UnavailableException,
118:                    ResourceException {
119:                // TODO : implement this !
120:                throw new UnsupportedOperationException("Not implemented");
121:            }
122:
123:            /**
124:             * This method may be called by the resource adapter to indicate that it no
125:             * longer needs a proxy endpoint instance. This hint may be used by the
126:             * application server for endpoint pooling decisions.
127:             */
128:            public void release() {
129:                mdbMessageEndPointFactory.releaseEndPoint(this );
130:            }
131:
132:            /**
133:             * Gets the factory of the bean.
134:             * @return factory of the bean.
135:             */
136:            public Factory getEasyBeansFactory() {
137:                return mdbMessageEndPointFactory;
138:            }
139:
140:            /**
141:             * Gets the wrapped Message Driven Bean object.
142:             * @return wrapped Message Driven Bean object.
143:             */
144:            public EasyBeansMDB getEasyBeansMDB() {
145:                return easyBeansMDB;
146:            }
147:
148:            /**
149:             * Gets the XAResource of this message end point.
150:             * @return the XAResource of this message end point
151:             */
152:            protected XAResource getXaResource() {
153:                return xaResource;
154:            }
155:
156:            /**
157:             * Sets the XAResource of this message end point.
158:             * @param xaResource the XAResource of this message end point
159:             */
160:            protected void setXaResource(final XAResource xaResource) {
161:                this .xaResource = xaResource;
162:            }
163:
164:            /**
165:             * Invokes the timeout method on the bean.
166:             * @param timer the given EJB timer
167:             */
168:            protected void notifyTimeout(final Timer timer) {
169:                // set classloader to EJB classloader
170:                ClassLoader oldCL = Thread.currentThread()
171:                        .getContextClassLoader();
172:                Thread.currentThread().setContextClassLoader(
173:                        getEasyBeansFactory().getContainer().getClassLoader());
174:                // Call the timeout method
175:                try {
176:                    getEasyBeansMDB().timeoutCallByEasyBeans(timer);
177:                } finally {
178:                    Thread.currentThread().setContextClassLoader(oldCL);
179:                }
180:            }
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.