Source Code Cross Referenced for EntityJdbcCmp1Desc.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: EntityJdbcCmp1Desc.java 6407 2005-03-11 12:34:28Z joaninh $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.deployment.api;
025:
026:        import java.lang.reflect.Field;
027:        import java.lang.reflect.Method;
028:        import java.util.Iterator;
029:        import org.objectweb.jonas_ejb.deployment.xml.AssemblyDescriptor;
030:        import org.objectweb.jonas_ejb.deployment.xml.CmpFieldJdbcMapping;
031:        import org.objectweb.jonas_ejb.deployment.xml.Entity;
032:        import org.objectweb.jonas_ejb.deployment.xml.FinderMethodJdbcMapping;
033:        import org.objectweb.jonas_ejb.deployment.xml.JonasEntity;
034:        import org.objectweb.jonas_ejb.deployment.xml.JdbcMapping;
035:        import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
036:        import org.objectweb.jonas_ejb.deployment.xml.JonasMethod;
037:        import org.objectweb.jonas_lib.deployment.api.DeploymentDescException;
038:
039:        /**
040:         * Class to hold meta-information related to an CMP v1 entity bean with jdbc data store.
041:         * @author Christophe Ney [cney@batisseurs.com] : Initial developer
042:         * @author Helene Joanin
043:         */
044:        // TODO : fill mapping information with defaults values (same as CMP 2)
045:        //       to accept to have optional mapping information in the jonas-ejb-jar.xml.
046:        // TODO : Review this class, many methods are common with EntityJdbcCmp2yDesc
047:        public class EntityJdbcCmp1Desc extends EntityCmp1Desc {
048:
049:            String jdbcTableName;
050:            String datasourceJndiName;
051:
052:            /**
053:             * constructor: called when the DeploymentDescriptor is read.
054:             * Currently, called by both GenIC and createContainer.
055:             */
056:            public EntityJdbcCmp1Desc(ClassLoader classLoader, Entity ent,
057:                    AssemblyDescriptor asd, JonasEntity jEnt,
058:                    JLinkedList jMDRList, String fileName)
059:                    throws DeploymentDescException {
060:
061:                super (classLoader, ent, asd, jEnt, jMDRList, fileName);
062:
063:                // check for jdbcMapping
064:                JdbcMapping jm = jEnt.getJdbcMapping();
065:                if (jm == null) {
066:                    throw new DeploymentDescException(
067:                            "jdbc-mapping missing for bean " + ent.getEjbName());
068:                }
069:
070:                // populate field descriptor map with jdbc information
071:                for (Iterator i = jm.getCmpFieldJdbcMappingList().iterator(); i
072:                        .hasNext();) {
073:                    CmpFieldJdbcMapping cmpFieldJdbcMapping = (CmpFieldJdbcMapping) i
074:                            .next();
075:                    String fn = cmpFieldJdbcMapping.getFieldName();
076:                    FieldDesc f = (FieldDesc) fieldDesc.get(fn);
077:                    if (f == null) {
078:                        throw new DeploymentDescException(
079:                                "field-name "
080:                                        + fn
081:                                        + " listed in cmp-field-jdbc-mapping is not of cmp-field of bean "
082:                                        + ent.getEjbName());
083:                    }
084:                    ((FieldJdbcDesc) f).setJdbcFieldName(cmpFieldJdbcMapping
085:                            .getJdbcFieldName());
086:                }
087:                // check that all cmp fields are jdbc
088:                for (Iterator j = fieldDesc.values().iterator(); j.hasNext();) {
089:                    FieldJdbcDesc fd = (FieldJdbcDesc) j.next();
090:                    if (fd.getJdbcFieldName() == null) {
091:                        throw new DeploymentDescException(
092:                                "field-name "
093:                                        + fd.getName()
094:                                        + " is missing in cmp-field-jdbc-mapping for bean "
095:                                        + ent.getEjbName());
096:                    }
097:                }
098:
099:                // populate method descriptor map with jdbc information
100:                for (Iterator i = jm.getFinderMethodJdbcMappingList()
101:                        .iterator(); i.hasNext();) {
102:                    FinderMethodJdbcMapping fmj = ((FinderMethodJdbcMapping) i
103:                            .next());
104:                    JonasMethod m = fmj.getJonasMethod();
105:                    for (Iterator j = getMethodDescIterator(); j.hasNext();) {
106:                        MethodJdbcCmp1Desc md = (MethodJdbcCmp1Desc) j.next();
107:                        int matchStatus = md.matchPattern(null, m
108:                                .getMethodName(), m.getMethodParams());
109:                        md.overwriteJdbcWhereClause(fmj.getJdbcWhereClause(),
110:                                matchStatus);
111:                    }
112:                }
113:
114:                // jndi name of the datasource
115:                datasourceJndiName = jm.getJndiName();
116:
117:                // table name
118:                jdbcTableName = jm.getJdbcTableName();
119:
120:                // optionnal parameter automatic-pk
121:                if (jm.getAutomaticPk() != null) {
122:                    jdbcAutomaticPk = jm.getAutomaticPk().equalsIgnoreCase(
123:                            "true");
124:                }
125:            }
126:
127:            /**
128:             * Get the datasource jndi name
129:             * @return String representation of the jndi name
130:             */
131:            public String getDatasourceJndiName() {
132:                return datasourceJndiName;
133:            }
134:
135:            /**
136:             * Get jdbc specific descriptor for a given field.
137:             * Used by GenIC
138:             * @param field of the bean class
139:             * @return Descriptor for the given field
140:             */
141:            public FieldJdbcDesc getFieldJdbcDesc(Field field) {
142:                return (FieldJdbcDesc) super .getCmpFieldDesc(field);
143:            }
144:
145:            /**
146:             * Get the associated DataBase table name in case of container persistence type.
147:             * Used by GenIC (This information is JOnAS specific).
148:             * @return Name of the database table where entity bean is stored
149:             */
150:            public String getJdbcTableName() {
151:                return jdbcTableName;
152:            }
153:
154:            /**
155:             * factory method for method descriptors
156:             */
157:            protected MethodDesc newMethodDescInstance(Method meth,
158:                    Class classDef, int index) {
159:                return new MethodJdbcCmp1Desc(this , meth, classDef, index);
160:            }
161:
162:            /**
163:             * String representation of the object for test purpose
164:             * @return String representation of this object
165:             */
166:            public String toString() {
167:                StringBuffer ret = new StringBuffer();
168:                ret.append(super .toString());
169:                ret.append("\ngetDatasourceJndiName()="
170:                        + getDatasourceJndiName());
171:                ret.append("\ngetJdbcTableName()=" + getJdbcTableName());
172:                return ret.toString();
173:            }
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.