Source Code Cross Referenced for ApplicationEventEJB.java in  » Workflow-Engines » obe-1.0 » org » obe » server » j2ee » ejb » 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 » obe 1.0 » org.obe.server.j2ee.ejb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.obe.server.j2ee.ejb;
002:
003:        import java.util.ArrayList;
004:        import java.util.Collection;
005:        import java.util.Date;
006:        import java.util.Iterator;
007:        import javax.ejb.*;
008:        import org.apache.commons.logging.Log;
009:        import org.obe.OBERuntimeException;
010:        import org.obe.engine.util.Comparators;
011:        import org.obe.server.util.ObjectUtil;
012:        import org.obe.spi.event.ApplicationEvent;
013:        import org.obe.spi.service.ServerConfig;
014:
015:        /**
016:         * Stores an application event for subsequent consumption by an anticipated but
017:         * as-yet unregistered subscription.
018:         *
019:         * @author Adrian Price
020:         * @ejb:bean
021:         *      type="CMP"
022:         *      cmp-version="2.x"
023:         *      name="ApplicationEvent"
024:         *      display-name="OBE Application Event"
025:         *      local-jndi-name="org/obe/ejb/ApplicationEventLocal"
026:         *      primkey-field="eventId"
027:         *      reentrant="False"
028:         *      schema="APPLICATIONEVENT"
029:         *      transaction-type="Container"
030:         *      view-type="local"
031:         * @ejb:home
032:         *      local-class="org.obe.server.j2ee.ejb.ApplicationEventLocalHome"
033:         *      local-extends="javax.ejb.EJBLocalHome"
034:         * @ejb:interface
035:         *      local-class="org.obe.server.j2ee.ejb.ApplicationEventLocal"
036:         *      local-extends="javax.ejb.EJBLocalObject"
037:         * @ejb:persistence
038:         *      table-name="OBEAPPLICATIONEVENT"
039:         * @ejb:pk
040:         *      class="java.lang.Long"
041:         *      unchecked="true"
042:         * @ejb:permission
043:         *      unchecked="true"
044:         * @ejb:transaction
045:         *      type="Supports"
046:         * @weblogic:transaction-isolation ${transaction.isolation}
047:         * @ejb:finder
048:         *      signature="java.util.Collection findByEventHash(java.lang.String eventType, int eventKeyHashcode)"
049:         *      query="SELECT OBJECT(e) FROM APPLICATIONEVENT AS e WHERE e.eventType=?1 AND e.eventKeyHashcode=?2 ORDER BY e.eventId"
050:         *      result-type-mapping="Local"
051:         *      unchecked="true"
052:         * @ejb:resource-ref
053:         *      res-name="jdbc/TxDataSource"
054:         *      res-type="javax.sql.DataSource"
055:         *      res-auth="Container"
056:         * @jboss:resource-manager
057:         *      res-man-class="javax.sql.DataSource"
058:         *      res-man-name="jdbc/TxDataSource"
059:         *      res-man-jndi-name="java:/${xdoclet.DataSource}"
060:         * @weblogic:resource-description
061:         *      res-ref-name="jdbc/TxDataSource"
062:         *      jndi-name="${xdoclet.DataSource}"
063:         * @weblogic:data-source-name
064:         *      java:comp/env/jdbc/TxDataSource
065:         * @jboss:create-table false
066:         * @weblogic:pool
067:         *      max-beans-in-free-pool="225"
068:         *      initial-beans-in-free-pool="0"
069:         * @weblogic:cache
070:         *      max-beans-in-cache="225"
071:         *      idle-timeout-seconds="0"
072:         *      concurrency-strategy="Database"
073:         * @weblogic:persistence
074:         *      delay-updates-until-end-of-tx="True"
075:         * @jboss:tuned-updates
076:         *      tune="true"
077:         * @jboss:container-configuration
078:         *      name="${xdoclet.jboss.container-configuration}"
079:         */
080:        public abstract class ApplicationEventEJB extends AbstractEntityEJB
081:                implements  TimedObject {
082:
083:            private static final Log _logger = getLogger(ApplicationEventEJB.class);
084:
085:            /**
086:             * @ejb:persistence column-name="EVENTID"
087:             */
088:            public abstract Long getEventId();
089:
090:            /**
091:             * @ejb:persistence column-name="EVENTID"
092:             */
093:            public abstract void setEventId(Long eventId);
094:
095:            /**
096:             * @ejb:persistence column-name="EVENTTYPE"
097:             */
098:            public abstract String getEventType();
099:
100:            /**
101:             * @ejb:persistence column-name="EVENTTYPE"
102:             */
103:            public abstract void setEventType(String eventType);
104:
105:            /**
106:             * @ejb:persistence column-name="EVENTKEYHASHCODE"
107:             */
108:            public abstract int getEventKeyHashcode();
109:
110:            /**
111:             * @ejb:persistence column-name="EVENTKEYHASHCODE"
112:             */
113:            public abstract void setEventKeyHashcode(int hashcode);
114:
115:            /**
116:             * @ejb:interface-method
117:             * @ejb:persistence column-name="EVENT"
118:             */
119:            public abstract ApplicationEvent getEvent();
120:
121:            /**
122:             * @ejb:persistence column-name="EVENT"
123:             */
124:            public abstract void setEvent(ApplicationEvent event);
125:
126:            /**
127:             * Retrieves events matching the specified subscription.
128:             *
129:             * @param eventType The event type.
130:             * @param subscriptionKeys The event keys supplied by the subscription.
131:             * @return A collection of matching subscriptions.
132:             * @ejb:home-method
133:             */
134:            public Collection ejbHomeXfindByEvent(String eventType,
135:                    Object[] subscriptionKeys) throws FinderException {
136:
137:                // Look up potential matches by event type and event key hash.
138:                ApplicationEventLocalHome home = (ApplicationEventLocalHome) _ctx
139:                        .getEJBLocalHome();
140:                Collection candidates = home.findByEventHash(eventType,
141:                        ObjectUtil.hashcode(subscriptionKeys));
142:
143:                // Select those events which actually match on each key.
144:                Collection events = new ArrayList(candidates.size());
145:                for (Iterator i = events.iterator(); i.hasNext();) {
146:                    ApplicationEventLocal wrapper = (ApplicationEventLocal) i
147:                            .next();
148:                    ApplicationEvent event = wrapper.getEvent();
149:                    if (Comparators.match(subscriptionKeys, event.getKeys(),
150:                            false))
151:                        events.add(event);
152:                }
153:                return events;
154:            }
155:
156:            /**
157:             * @ejb:create-method
158:             */
159:            public Long ejbCreate(ApplicationEvent event, int inputKeysHashcode)
160:                    throws CreateException {
161:
162:                if (event == null)
163:                    throw new IllegalArgumentException("event cannot be null");
164:
165:                if (_logger.isDebugEnabled() && ServerConfig.isVerbose())
166:                    _logger.debug("ejbCreate(" + event + ", "
167:                            + inputKeysHashcode + ')');
168:
169:                clear();
170:
171:                setEventId(new Long(ApplicationEventDAO.getInstance()
172:                        .getNewId()));
173:                setEventType(event.getEventType());
174:                setEventKeyHashcode(inputKeysHashcode);
175:                setEvent(event);
176:
177:                return null;
178:            }
179:
180:            public void ejbPostCreate(ApplicationEvent event,
181:                    int eventKeyHashcode) throws CreateException {
182:
183:                if (_logger.isDebugEnabled() && ServerConfig.isVerbose()) {
184:                    _logger.debug("ejbPostCreate(" + event + ", "
185:                            + eventKeyHashcode + ')');
186:                }
187:
188:                // If an expiration date is set, schedule a timer so we can delete it.
189:                Date expiry = event.getExpiry();
190:                if (expiry != null)
191:                    _ctx.getTimerService().createTimer(expiry, null);
192:            }
193:
194:            public void ejbTimeout(Timer timer) {
195:                try {
196:                    _ctx.getEJBLocalObject().remove();
197:                } catch (RemoveException e) {
198:                    throw new OBERuntimeException(e);
199:                }
200:            }
201:
202:            protected Log getLogger() {
203:                return _logger;
204:            }
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.