Source Code Cross Referenced for SessionDesc.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_ejb » deployment » api » 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_ejb.deployment.api 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 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: SessionDesc.java 5450 2004-09-17 09:44:19Z joaninh $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.deployment.api;
025:
026:        import org.objectweb.jonas_ejb.container.TraceEjb;
027:        import org.objectweb.jonas_ejb.deployment.xml.Session;
028:        import org.objectweb.jonas_ejb.deployment.xml.AssemblyDescriptor;
029:        import org.objectweb.jonas_ejb.deployment.xml.JonasSession;
030:        import org.objectweb.jonas_lib.deployment.api.DeploymentDescException;
031:        import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
032:        import org.objectweb.util.monolog.api.BasicLevel;
033:
034:        /**
035:         * Base class to hold meta-information related to a session bean.
036:         *
037:         * @author Christophe Ney [cney@batisseurs.com] : Initial developer
038:         * @author Helene Joanin : unsetting transaction attribute set to a default value.
039:         */
040:        public abstract class SessionDesc extends BeanDesc {
041:
042:            protected int transactionType;
043:            int sessionTimeout = 0;
044:
045:            /**
046:             * constructor: called when the DeploymentDescriptor is read. Currently,
047:             * called by both GenIC and createContainer.
048:             */
049:            public SessionDesc(ClassLoader classLoader, Session ses,
050:                    AssemblyDescriptor asd, JonasSession jSes,
051:                    JLinkedList jMDRList, String filename)
052:                    throws DeploymentDescException {
053:
054:                super (classLoader, ses, jSes, asd, jMDRList, filename);
055:
056:                // session timeout
057:                if (jSes.getSessionTimeout() != null) {
058:                    String tstr = jSes.getSessionTimeout();
059:                    Integer tval = new Integer(tstr);
060:                    sessionTimeout = tval.intValue();
061:                }
062:                // min-pool-size
063:                if (jSes.getMinPoolSize() != null) {
064:                    String tstr = jSes.getMinPoolSize();
065:                    Integer tval = new Integer(tstr);
066:                    poolMin = tval.intValue();
067:                }
068:
069:                // max-cache-size
070:                if (jSes.getMaxCacheSize() != null) {
071:                    String tstr = jSes.getMaxCacheSize();
072:                    Integer tval = new Integer(tstr);
073:                    cacheMax = tval.intValue();
074:                }
075:
076:                // bean or container managed transaction
077:                if (ses.getTransactionType().equals("Bean")) {
078:                    transactionType = BEAN_TRANSACTION_TYPE;
079:                } else if (ses.getTransactionType().equals("Container")) {
080:                    transactionType = CONTAINER_TRANSACTION_TYPE;
081:                } else {
082:                    throw new DeploymentDescException(
083:                            "Invalid transaction-type content for ejb-name "
084:                                    + ejbName);
085:                }
086:            }
087:
088:            /**
089:             * check that trans-attribute is valid for bean
090:             */
091:            protected void checkTxAttribute(MethodDesc md)
092:                    throws DeploymentDescException {
093:                java.lang.reflect.Method m = md.getMethod();
094:                if (getTransactionType() == CONTAINER_TRANSACTION_TYPE) {
095:                    // tx-attribute must be set for methods of remote interface
096:                    // excluding the methods of the javax.ejb.EJBObject interface
097:                    if ((md.getTxAttribute() == MethodDesc.TX_NOT_SET)
098:                            && javax.ejb.EJBObject.class.isAssignableFrom(m
099:                                    .getDeclaringClass())
100:                            && !javax.ejb.EJBObject.class.equals(m
101:                                    .getDeclaringClass())) {
102:                        // trace a warning and set the tx-attribute with the default
103:                        // value
104:                        logger
105:                                .log(
106:                                        BasicLevel.WARN,
107:                                        "trans-attribute missing for method "
108:                                                + m.toString()
109:                                                + " in session bean "
110:                                                + getEjbName()
111:                                                + " (set to the default value "
112:                                                + MethodDesc.TX_STR_DEFAULT_VALUE
113:                                                + ")");
114:                        md.setTxAttribute(MethodDesc.TX_STR_DEFAULT_VALUE);
115:                    }
116:                    // tx-attribute must not be set for methods of home interface
117:                    if ((md.getTxAttribute() != MethodDesc.TX_NOT_SET)
118:                            && javax.ejb.EJBHome.class.isAssignableFrom(m
119:                                    .getDeclaringClass())
120:                            && ((md.getTxAttributeStatus() == MethodDesc.APPLY_TO_CLASS)
121:                                    || (md.getTxAttributeStatus() == MethodDesc.APPLY_TO_CLASS_METHOD_NAME) || (md
122:                                    .getTxAttributeStatus() == MethodDesc.APPLY_TO_CLASS_METHOD))) {
123:                        TraceEjb.dd.log(BasicLevel.WARN,
124:                                "trans-attribute must not be specified for home interface's method "
125:                                        + m.toString() + " in session bean "
126:                                        + getEjbName());
127:                    }
128:                } else {
129:                    if (md.getTxAttribute() != MethodDesc.TX_NOT_SET) {
130:                        throw new DeploymentDescException(md
131:                                .getTxAttributeName()
132:                                + " is not a valid trans-attribute for method "
133:                                + m.toString()
134:                                + " in session bean "
135:                                + getEjbName());
136:                    }
137:                }
138:            }
139:
140:            /**
141:             * Get session transaction management type. <BR>
142:             *
143:             * @return transaction type value within
144:             *         BEAN_TRANSACTION_TYPE,CONTAINER_TRANSACTION_TYPE
145:             */
146:            public int getTransactionType() {
147:                return transactionType;
148:            }
149:
150:            /**
151:             * Returns true if bean managed transaction. (used by JOnAS Server)
152:             */
153:            public boolean isBeanManagedTransaction() {
154:                return (transactionType == BEAN_TRANSACTION_TYPE);
155:            }
156:
157:            /**
158:             * Get the session timeout value
159:             */
160:            public int getSessionTimeout() {
161:                return sessionTimeout;
162:            }
163:
164:            /**
165:             * Check that the bean descriptor is valid
166:             *
167:             * @exception DeploymentDescException
168:             *                thrown for non-valid bean
169:             */
170:            public void check() throws DeploymentDescException {
171:                super .check();
172:                // for BEAN_TRANSACTION_TYPE transactions ejbClass should not implement
173:                // javax.ejb.SessionSynchronization
174:                if ((getTransactionType() == BEAN_TRANSACTION_TYPE)
175:                        && (javax.ejb.SessionSynchronization.class
176:                                .isAssignableFrom(ejbClass))) {
177:                    throw new DeploymentDescException(
178:                            ejbClass.getName()
179:                                    + " should NOT manage transactions and implement javax.ejb.SessionSynchronization");
180:                }
181:            }
182:
183:            /**
184:             * String representation of the object for test purpose
185:             *
186:             * @return String representation of this object
187:             */
188:            public String toString() {
189:                StringBuffer ret = new StringBuffer();
190:                ret.append(super .toString());
191:                ret.append("\ngetTransactionType()"
192:                        + TRANS[getTransactionType()]);
193:                ret.append("\nsessionTimeout = " + sessionTimeout);
194:                return ret.toString();
195:            }
196:
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.