Source Code Cross Referenced for SequenceGeneratorBean.java in  » Workflow-Engines » bonita-v3.1 » hero » session » 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 » bonita v3.1 » hero.session 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package hero.session;
002:
003:        import hero.interfaces.BnNextNumberLocal;
004:        import hero.interfaces.BnNextNumberLocalHome;
005:        import hero.interfaces.InvalidValueException;
006:        import hero.util.HeroException;
007:
008:        import java.rmi.RemoteException;
009:        import java.sql.Connection;
010:        import java.sql.Statement;
011:        import java.sql.ResultSet;
012:        import java.sql.SQLException;
013:
014:        import javax.ejb.CreateException;
015:        import javax.ejb.EJBException;
016:        import javax.ejb.SessionBean;
017:        import javax.ejb.SessionContext;
018:        import javax.naming.Context;
019:        import javax.naming.InitialContext;
020:        import javax.naming.NamingException;
021:        import javax.naming.ServiceUnavailableException;
022:        import javax.sql.DataSource;
023:
024:        /**
025:         * Encapsulates the retrival of DB data
026:         *
027:         * @author Andreas Schaefer
028:         * @version $Revision: 1.7 $
029:         *
030:         * @ejb:bean name="SequenceGenerator"
031:         *           display-name="Generates unique Identifier for an Entity"
032:         *           type="Stateless"
033:         *           jndi-name="ejb/hero/SequenceGenerator"
034:         *           local-jndi-name="ejb/hero/SequenceGenerator_L"
035:         * @ejb.permission role-name="BONITAUSER,SuperAdmin"
036:         *
037:         * @ejb:transaction type="Supports"
038:         * 
039:         * @jonas.bean
040:         *      ejb-name="SequenceGenerator"
041:         *      jndi-name="ejb/hero/SequenceGenerator"
042:         * 
043:         * 
044:         * @ejb.resource-ref res-ref-name="jdbc/myDS"
045:         *      res-type="javax.sql.DataSource"
046:         *      res-auth="Application"
047:         * @jonas.resource
048:         *      res-ref-name="jdbc/myDS"
049:         *      jndi-name="bonita"
050:         * 
051:         * @jboss.container-configuration name="Standard Stateless SessionBean for Bonita"
052:         */
053:        public class SequenceGeneratorBean implements  SessionBean {
054:
055:            // -------------------------------------------------------------------------
056:            // Static
057:            // -------------------------------------------------------------------------
058:
059:            // -------------------------------------------------------------------------
060:            // Members 
061:            // -------------------------------------------------------------------------
062:
063:            private SessionContext mContext;
064:            // Only for test purposes
065:            private int mNextNumber = 0;
066:
067:            // -------------------------------------------------------------------------
068:            // Methods
069:            // -------------------------------------------------------------------------  
070:
071:            /**
072:             * Delivers the next sequence number from the given Sequence Name
073:             *
074:             * @param pSequenceName Name of the Sequence Generator
075:             *
076:             * @return Next sequence number
077:             *
078:             * @throws RemoteException 
079:             *
080:             * @ejb:interface-method view-type="local"
081:             * @ejb:transaction type="Required"    
082:             **/
083:            public int getNextNumber(String pSequenceName) throws HeroException {
084:                BnNextNumberLocalHome nHome = null;
085:                try {
086:                    nHome = hero.interfaces.BnNextNumberUtil.getLocalHome();
087:                } catch (javax.naming.NamingException be) {
088:                    throw new HeroException(be.getMessage());
089:                }
090:
091:                try {
092:                    BnNextNumberLocal nLocal = nHome.findByName(pSequenceName);
093:                    nLocal.setMax(nLocal.getMax() + 1);
094:                    return (nLocal.getMax());
095:                } catch (javax.ejb.FinderException pe) {
096:                    try {
097:                        BnNextNumberLocal nLocal = nHome.create(pSequenceName);
098:                        return (nLocal.getMax());
099:                    } catch (CreateException ce) {
100:                        throw new HeroException(ce.getMessage());
101:                    } catch (InvalidValueException ie) {
102:                        throw new HeroException(ie.getMessage());
103:                    }
104:                }
105:
106:            }
107:
108:            /**
109:             * Create the Session Bean
110:             *
111:             * @throws CreateException 
112:             *
113:             * @ejb:create-method view-type="remote"
114:             **/
115:            public void ejbCreate() throws CreateException {
116:            }
117:
118:            /**
119:             * Describes the instance and its content for debugging purpose
120:             *
121:             * @return Debugging information about the instance and its content
122:             * @ejb:transaction type="Supports"
123:             **/
124:            public String toString() {
125:                return "SequenceGeneratorBean [ " + " ]";
126:            }
127:
128:            // -------------------------------------------------------------------------
129:            // Framework Callbacks
130:            // -------------------------------------------------------------------------
131:
132:            public void setSessionContext(SessionContext aContext)
133:                    throws EJBException {
134:                mContext = aContext;
135:            }
136:
137:            public void ejbActivate() throws EJBException {
138:            }
139:
140:            public void ejbPassivate() throws EJBException {
141:            }
142:
143:            public void ejbRemove() throws EJBException {
144:            }
145:
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.