Source Code Cross Referenced for FacadeSessionBean.java in  » EJB-Server-JBoss-4.2.1 » testsuite » org » jboss » test » cmp2 » cmrtree » 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 » EJB Server JBoss 4.2.1 » testsuite » org.jboss.test.cmp2.cmrtree.ejb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source.
003:         * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004:         * as indicated by the @author tags. See the copyright.txt file in the
005:         * distribution for a full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package org.jboss.test.cmp2.cmrtree.ejb;
023:
024:        import java.util.Collection;
025:        import org.apache.log4j.Category;
026:
027:        import javax.ejb.SessionBean;
028:        import javax.ejb.SessionContext;
029:        import javax.ejb.CreateException;
030:
031:        /**
032:         * @ejb:bean type="Stateless"
033:         * name="Facade"
034:         * view-type="remote"
035:         * @ejb.util generate="physical"
036:         * @ejb:transaction type="Required"
037:         * @ejb:transaction-type type="Container"
038:         *
039:         * @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
040:         * @version <tt>$Revision: 57211 $</tt>
041:         */
042:        public class FacadeSessionBean implements  SessionBean {
043:            private static Category log = Category
044:                    .getInstance(FacadeSessionBean.class);
045:
046:            SessionContext ctx;
047:
048:            // Business methods
049:
050:            /**
051:             * @ejb.interface-method
052:             * @ejb.transaction type="RequiresNew"
053:             */
054:            public void setup() throws Exception {
055:                final long startTime = System.currentTimeMillis();
056:                log.debug("SETUP>");
057:
058:                ALocal a = AUtil.getLocalHome().create(1, "A", "1.A");
059:                BLocal b1 = BUtil.getLocalHome().create(1, "B1", "1.B1");
060:                b1.setAMinorId("A");
061:
062:                BLocal b2 = BUtil.getLocalHome().create(1, "B2", "1.B2");
063:                b2.setParent(b1);
064:
065:                log.debug("SETUP> done in "
066:                        + (System.currentTimeMillis() - startTime) + " ms.");
067:            }
068:
069:            /**
070:             * @ejb.interface-method
071:             * @ejb.transaction type="RequiresNew"
072:             */
073:            public void test(long sleep) throws Exception {
074:                final long startTime = System.currentTimeMillis();
075:                log.debug("RUN>");
076:
077:                AUtil.getLocalHome().remove(new APK(1, "A"));
078:
079:                log.debug("RUN> done in "
080:                        + (System.currentTimeMillis() - startTime) + " ms.");
081:            }
082:
083:            /**
084:             * @ejb.interface-method
085:             * @ejb.transaction type="RequiresNew"
086:             */
087:            public void tearDown() throws Exception {
088:                final long startTime = System.currentTimeMillis();
089:                log.debug("TEAR DOWN>");
090:
091:                log.debug("TEAR DOWN> done in "
092:                        + (System.currentTimeMillis() - startTime) + " ms.");
093:            }
094:
095:            /**
096:             * @ejb.interface-method
097:             * @ejb.transaction type="RequiresNew"
098:             */
099:            public void setup2() throws Exception {
100:                final long startTime = System.currentTimeMillis();
101:                log.debug("SETUP2>");
102:
103:                ALocal a = AUtil.getLocalHome().create(1, "A", "1.A");
104:                BLocal b1 = BUtil.getLocalHome().create(1, "B1", "some name");
105:                b1.setA(a);
106:
107:                log.debug("SETUP2> done in "
108:                        + (System.currentTimeMillis() - startTime) + " ms.");
109:            }
110:
111:            /**
112:             * @ejb.interface-method
113:             * @ejb.transaction type="RequiresNew"
114:             */
115:            public void setBNameToNull() throws Exception {
116:                ALocal a = AUtil.getLocalHome().findByPrimaryKey(
117:                        new APK(1, "A"));
118:                Collection bs = a.getB();
119:                if (bs.size() != 1) {
120:                    throw new IllegalStateException(
121:                            "Expected only one B but got " + bs);
122:                }
123:
124:                BLocal b = (BLocal) bs.iterator().next();
125:                b.setName(null);
126:            }
127:
128:            /**
129:             * @ejb.interface-method
130:             * @ejb.transaction type="RequiresNew"
131:             */
132:            public String getBName() throws Exception {
133:                BLocal b = BUtil.getLocalHome().findByPrimaryKey(
134:                        new BPK(1, "B1"));
135:                return b.getName();
136:            }
137:
138:            // SessionBean implementation
139:
140:            /**
141:             * @throws CreateException Description of Exception
142:             * @ejb.create-method
143:             */
144:            public void ejbCreate() throws CreateException {
145:            }
146:
147:            public void ejbActivate() {
148:            }
149:
150:            public void ejbPassivate() {
151:            }
152:
153:            public void ejbRemove() {
154:            }
155:
156:            public void setSessionContext(SessionContext ctx) {
157:                this.ctx = ctx;
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.