Source Code Cross Referenced for PaperEC.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jtests » beans » ffolder » 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 » JOnAS 4.8.6 » org.objectweb.jonas.jtests.beans.ffolder 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.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: PaperEC.java 5996 2004-12-17 15:09:45Z joaninh $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.jtests.beans.ffolder;
027:
028:        import javax.ejb.EJBException;
029:        import javax.ejb.EJBLocalHome;
030:        import javax.ejb.EntityBean;
031:        import javax.ejb.EntityContext;
032:        import javax.ejb.CreateException;
033:        import javax.ejb.RemoveException;
034:        import javax.naming.Context;
035:        import javax.naming.InitialContext;
036:        import javax.naming.NamingException;
037:        import javax.rmi.PortableRemoteObject;
038:
039:        /**
040:         * Implementation for the bean PaperEC.
041:         * @author Philippe Durieux, Philippe Coq
042:         */
043:        public class PaperEC implements  EntityBean {
044:
045:            //    static protected Logger logger = null;
046:            EntityContext ejbContext;
047:            InitialContext ictx;
048:            Context myEnv;
049:
050:            // ------------------------------------------------------------------
051:            // State of the bean. 
052:            // They must be public for Container Managed Persistance.
053:            // ------------------------------------------------------------------
054:            public String name;
055:            public int value;
056:
057:            /**
058:             * Check environment variables
059:             */
060:            void checkEnv(String method) {
061:
062:                // Check directly in my context
063:                // logger.log(BasicLevel.DEBUG, "Check directly in my context");
064:                try {
065:                    String value = (String) myEnv.lookup("myname");
066:                    if (!value.equals("myentity")) {
067:                        //logger.log(BasicLevel.ERROR, ": myEnv.lookup failed: myname=" + value);
068:                        throw new EJBException("FileEC 1: " + method);
069:                    }
070:                } catch (NamingException e) {
071:                    // logger.log(BasicLevel.ERROR, ": myEnv.lookup raised exception:\n" + e);
072:                    throw new EJBException("FileEC 2: " + method);
073:                }
074:                // Check from initial Context
075:                //logger.log(BasicLevel.DEBUG, "Check from initial Context");
076:                try {
077:                    String value = (String) ictx.lookup("java:comp/env/myname");
078:                    if (!value.equals("myentity")) {
079:                        //logger.log(BasicLevel.ERROR, ": ictx.lookup failed: myname=" + value);
080:                        throw new EJBException("FileEC 6: " + method);
081:                    }
082:                } catch (NamingException e) {
083:                    //logger.log(BasicLevel.ERROR, ": ictx.lookup raised exception:\n" + e);
084:                    throw new EJBException("FileEC 7: " + method);
085:                }
086:                //logger.log(BasicLevel.DEBUG, ": checkEnv OK");
087:            }
088:
089:            // ------------------------------------------------------------------
090:            // EntityBean implementation
091:            // ------------------------------------------------------------------
092:
093:            public void setEntityContext(EntityContext ctx) {
094:                // if (logger == null) {
095:                //  logger = Log.getLogger(Log.JONAS_TESTS_PREFIX);
096:                //}
097:                //logger.log(BasicLevel.DEBUG, "");
098:                ejbContext = ctx;
099:                try {
100:                    // Get initial Context
101:                    ictx = new InitialContext();
102:                    myEnv = (Context) ictx.lookup("java:comp/env");
103:                } catch (NamingException e) {
104:                    throw new EJBException("PaperEC: Cannot get filehome:" + e);
105:                }
106:                checkEnv("setEntityContext");
107:
108:                // Check that we can do "getEJBLocalHome"
109:                EJBLocalHome homel = ctx.getEJBLocalHome();
110:                if (homel == null) {
111:                    throw new EJBException(
112:                            "PaperEC: setEntityContext cannot get EJBLocalHome");
113:                }
114:            }
115:
116:            public void unsetEntityContext() {
117:                //logger.log(BasicLevel.DEBUG, "");
118:                ejbContext = null;
119:            }
120:
121:            public void ejbActivate() {
122:                //logger.log(BasicLevel.DEBUG, "");
123:            }
124:
125:            public void ejbPassivate() {
126:                //logger.log(BasicLevel.DEBUG, "");
127:            }
128:
129:            public void ejbLoad() {
130:                //logger.log(BasicLevel.DEBUG, "");
131:            }
132:
133:            public void ejbStore() {
134:                //logger.log(BasicLevel.DEBUG, "");
135:            }
136:
137:            public void ejbRemove() throws RemoveException {
138:                // logger.log(BasicLevel.DEBUG, "");
139:            }
140:
141:            // ------------------------------------------------------------------
142:            // ejbCreate methods
143:            // ------------------------------------------------------------------
144:
145:            public String ejbCreate(String name) throws CreateException {
146:                //logger.log(BasicLevel.DEBUG, "");
147:                this .name = name;
148:                this .value = 0;
149:                return null; // In CMP, should return null.
150:            }
151:
152:            public String ejbPostCreate(String name) throws CreateException {
153:                //logger.log(BasicLevel.DEBUG, "");
154:                return null; // In CMP, should return null.
155:            }
156:
157:            // ------------------------------------------------------------------
158:            // PaperLocal implementation
159:            // ------------------------------------------------------------------
160:
161:            public String getName() {
162:                //logger.log(BasicLevel.DEBUG, "");
163:                return this .name;
164:            }
165:
166:            public int getValue() {
167:                // logger.log(BasicLevel.DEBUG, "");
168:                return this .value;
169:            }
170:
171:            public void setValue(int v) {
172:                // logger.log(BasicLevel.DEBUG, "");
173:                this.value = v;
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.