Source Code Cross Referenced for EntityJdbcCmp2Desc.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: EntityJdbcCmp2Desc.java 5450 2004-09-17 09:44:19Z joaninh $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.deployment.api;
025:
026:        import java.util.Iterator;
027:
028:        import org.objectweb.jonas_ejb.deployment.xml.*;
029:        import org.objectweb.jonas_lib.deployment.api.DeploymentDescException;
030:        import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
031:
032:        /**
033:         * Class to hold meta-information related to an CMP v2 entity bean with jdbc data store.
034:         * @author Christophe Ney [cney@batisseurs.com] : Initial developer
035:         * @author Helene Joanin on May 2003: code cleanup
036:         * @author Helene Joanin on May 2003: complement for legacy first version
037:         */
038:
039:        // TODO : Review this class, many methods are common with EntityJdbcCmp1Desc
040:        public class EntityJdbcCmp2Desc extends EntityCmp2Desc {
041:
042:            protected String dsname;
043:            protected String jdbcTableName = null;
044:
045:            /**
046:             * constructor: called when the DeploymentDescriptor is read.
047:             * Currently, called by both GenIC and createContainer.
048:             */
049:            public EntityJdbcCmp2Desc(ClassLoader classLoader, Entity ent,
050:                    AssemblyDescriptor asd, JonasEntity jEnt,
051:                    DeploymentDescEjb2 dc2d, JLinkedList jMDRList,
052:                    String fileName) throws DeploymentDescException {
053:
054:                super (classLoader, ent, asd, jEnt, dc2d, jMDRList, fileName);
055:
056:                // check for jdbcMapping
057:                JdbcMapping jm = jEnt.getJdbcMapping();
058:                if (jm == null) {
059:                    throw new DeploymentDescException(
060:                            "jdbc-mapping missing for bean " + ent.getEjbName());
061:                }
062:
063:                // jndi name of the datasource
064:                dsname = jm.getJndiName();
065:
066:                // jdbc table name
067:                if (jm.getJdbcTableName() != null) {
068:                    if (jm.getJdbcTableName().length() != 0) {
069:                        jdbcTableName = jm.getJdbcTableName();
070:                    }
071:                }
072:                if (jdbcTableName == null) {
073:                    // Default value
074:                    jdbcTableName = getAbstractSchemaName().toUpperCase() + "_";
075:                }
076:
077:                // Default mapping information for cmp fields
078:                for (Iterator i = fieldDesc.keySet().iterator(); i.hasNext();) {
079:                    String fn = (String) i.next();
080:                    ((FieldJdbcDesc) (fieldDesc.get(fn))).setJdbcFieldName(fn
081:                            + "_");
082:                }
083:
084:                // mapping information for cmp fields from jonas DD
085:                for (Iterator i = jm.getCmpFieldJdbcMappingList().iterator(); i
086:                        .hasNext();) {
087:                    CmpFieldJdbcMapping fm = (CmpFieldJdbcMapping) i.next();
088:                    String fn = fm.getFieldName();
089:                    String cn = fm.getJdbcFieldName();
090:                    String ct = null;
091:                    if (fm.getSqlType() != null) {
092:                        ct = fm.getSqlType();
093:                    }
094:                    FieldJdbcDesc fdesc = (FieldJdbcDesc) fieldDesc.get(fn);
095:                    if (fdesc == null) {
096:                        throw new DeploymentDescException(
097:                                "field-name "
098:                                        + fn
099:                                        + " listed in cmp-field-jdbc-mapping is not of cmp-field of bean "
100:                                        + ent.getEjbName());
101:                    }
102:                    fdesc.setJdbcFieldName(cn);
103:                    if (ct != null) {
104:                        fdesc.setSqlType(ct);
105:                    }
106:                }
107:                // Specific mapping for primary key auto generated (type = java.lang.Object) if tag <automatic-pk-field-name> is specified
108:                if (isUndefinedPK()
109:                        && this .getJdbcAutomaticPkFieldName() != null) {
110:                    ((FieldJdbcDesc) (fieldDesc.get("JONASAUTOPKFIELD")))
111:                            .setJdbcFieldName(this 
112:                                    .getJdbcAutomaticPkFieldName());
113:                }
114:            }
115:
116:            /**
117:             * field descriptor factory method
118:             */
119:            protected FieldDesc newFieldDescInstance() {
120:                return new FieldJdbcDesc();
121:            }
122:
123:            /**
124:             * Get the datasource jndi name
125:             * @return String representation of the jndi name
126:             */
127:            public String getDatasourceJndiName() {
128:                return dsname;
129:            }
130:
131:            /**
132:             * Get the associated DataBase table name.
133:             * @return Name of the database table where entity bean is stored
134:             */
135:            public String getJdbcTableName() {
136:                return jdbcTableName;
137:            }
138:
139:            /**
140:             * String representation of the object for test purpose
141:             * @return String representation of this object
142:             */
143:            public String toString() {
144:                StringBuffer ret = new StringBuffer();
145:                ret.append(super .toString());
146:                ret.append("\ngetDatasourceJndiName()="
147:                        + getDatasourceJndiName());
148:                ret.append("\ngetJdbcTableName()=" + getJdbcTableName());
149:                return ret.toString();
150:            }
151:
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.