Source Code Cross Referenced for NamingRules.java in  » Database-ORM » Speedo_1.4.5 » org » objectweb » speedo » generation » lib » 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 » Database ORM » Speedo_1.4.5 » org.objectweb.speedo.generation.lib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Speedo: an implementation of JDO compliant personality on top of JORM generic
003:         * I/O sub-system.
004:         * Copyright (C) 2001-2004 France Telecom R&D
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 of the License, or (at your option) 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  USA
019:         *
020:         *
021:         *
022:         * Contact: speedo@objectweb.org
023:         *
024:         * Authors: S.Chassande-Barrioz.
025:         *
026:         */package org.objectweb.speedo.generation.lib;
027:
028:        import org.objectweb.speedo.metadata.SpeedoClass;
029:        import org.objectweb.speedo.metadata.SpeedoField;
030:        import org.objectweb.jorm.api.PMapper;
031:
032:        import java.util.StringTokenizer;
033:
034:        /**
035:         * Normalises names given to PO infrastructure's files created during
036:         * generation.
037:         * @author	S.Chassande-Barrioz
038:         */
039:        public abstract class NamingRules {
040:
041:            /**
042:             * Suffix added to the class name to create the field manager class name.
043:             */
044:            public final static String FIELDS = "Fields";
045:
046:            /**
047:             * Suffix added to the class name to create the field manager class name.
048:             */
049:            public final static String HOME = "Home";
050:
051:            /**
052:             * Suffix added to the object idclass name
053:             */
054:            public final static String OBJECT_ID = "_Id";
055:
056:            /**
057:             * Gives the home name.
058:             *
059:             * @param className class name.
060:             * @return home name.
061:             */
062:            public final static String homeName(String className) {
063:                return className + HOME;
064:            }
065:
066:            public final static String generatedObjectIdName(String className) {
067:                return className + OBJECT_ID;
068:            }
069:
070:            /**
071:             * Gives the name of the persistent fields holder.
072:             *
073:             * @param className className.
074:             * @return name for persistent fields holder.
075:             */
076:            public final static String fieldsName(String className) {
077:                return className + FIELDS;
078:            }
079:
080:            /**
081:             * Gives the name for the JORM class which manages binding between memory
082:             * instances and database instances.
083:             *
084:             * @param className class name.
085:             * @return binder name.
086:             */
087:            public final static String fqBindingName(String className,
088:                    String mapperName) {
089:                String p = packageName(className);
090:                if (p == null || p.length() == 0) {
091:                    return mapperName + "." + className + "Binding";
092:                } else {
093:                    return p + "." + mapperName + "." + className(className)
094:                            + "Binding";
095:                }
096:            }
097:
098:            /**
099:             * Gives the name for the JORM class which manages mapping.
100:             *
101:             * @param className class name.
102:             * @return mapping name.
103:             */
104:            public final static String mappingName(String className) {
105:                return className + "Mapping";
106:            }
107:
108:            /**
109:             * Gives the name for the JORM class which manages mapping.
110:             *
111:             * @param compositeNameName composite name.
112:             * @return mapping name.
113:             */
114:            public final static String binderName(String compositeNameName) {
115:                return compositeNameName + "Binder";
116:            }
117:
118:            public final static String fpncName(String className) {
119:                return className + "FPNC";
120:            }
121:
122:            public final static String kfpncName(String className) {
123:                return className + "KFPNC";
124:            }
125:
126:            /**
127:             * Gives the name for the JORM class which manages mapping.
128:             *
129:             * @param compositeNameName composite name.
130:             * @return mapping name.
131:             */
132:            public final static String pnameName(String compositeNameName) {
133:                return compositeNameName + "PName";
134:            }
135:
136:            /**
137:             * Gives the name for the JORM class which manages mapping.
138:             *
139:             * @param compositeNameName composite name.
140:             * @return mapping name.
141:             */
142:            public final static String pngName(String compositeNameName) {
143:                return compositeNameName + "PNG";
144:            }
145:
146:            /**
147:             * Gives the name for the JORM class which manages mapping.
148:             *
149:             * @param className class name.
150:             * @return mapping name.
151:             */
152:            public final static String fqMappingName(String className) {
153:                return className + PMapper.PCLASSMAPPINGAPPENDER;
154:            }
155:
156:            /**
157:             * Gives the name for the object which implements the interface PAccessor.
158:             *
159:             * @param className class name.
160:             * @return manager name.
161:             */
162:            public final static String accessorName(String className) {
163:                return className + "Accessor";
164:            }
165:
166:            /**
167:             * Gives the name for key objects.
168:             *
169:             * @param className class name.
170:             * @return key class name.
171:             */
172:            public final static String keyName(String className) {
173:                return className + "Key";
174:            }
175:
176:            /**
177:             * Gives the name of an accessor for a field (a get method).
178:             *
179:             * @param fieldName field name
180:             * @return the name of the accessor method.
181:             */
182:            public final static String getterName(SpeedoClass sc,
183:                    String fieldName) {
184:                return "jdoGet" + fieldName;
185:            }
186:
187:            public final static String getterName(SpeedoField sf) {
188:                return "jdoGet" + sf.name;
189:            }
190:
191:            /**
192:             * Gives the name of a mutator for a field (a set method).
193:             *
194:             * @param fieldName field name
195:             * @return the name of the mutator method.
196:             */
197:            public final static String setterName(SpeedoClass sc,
198:                    String fieldName) {
199:                return "jdoSet" + fieldName;
200:            }
201:
202:            /**
203:             * Gives the name of a coherent mutator for a reference field in a relation.
204:             *
205:             * @param fieldName field name
206:             * @return the name of the mutator method.
207:             */
208:            public final static String coherentSetterName(SpeedoClass sc,
209:                    String fieldName) {
210:                return "jdoCoherentSet" + fieldName;
211:            }
212:
213:            /**
214:             * Gives the name of a mutator for a field (a set method).
215:             *
216:             * @param field field
217:             * @return the name of the mutator method.
218:             */
219:            public final static String setterName(SpeedoField field) {
220:                if (field.relationType == SpeedoField.NO_BI_RELATION) {
221:                    return setterName(field.moClass, field.name);
222:                } else {
223:                    return coherentSetterName(field.moClass, field.name);
224:                }
225:            }
226:
227:            /**
228:             * Gets the name of a class
229:             *
230:             * @param completeClassName the complete name of the class including its package name
231:             * @return the name of the class without its package
232:             */
233:            public static String className(String completeClassName) {
234:                StringTokenizer tok = new StringTokenizer(completeClassName,
235:                        ".");
236:                String res = "";
237:                while (tok.hasMoreTokens())
238:                    res = tok.nextToken();
239:                return res;
240:            }
241:
242:            /**
243:             * Gets the package of a class
244:             *
245:             * @param completeClassName the complete name of the class including its package name
246:             * @return the package of the class without its class name
247:             */
248:            public static String packageName(String completeClassName) {
249:                StringTokenizer tok = new StringTokenizer(completeClassName,
250:                        ".");
251:                String res = "";
252:                String resold = "";
253:                while (tok.hasMoreTokens()) {
254:                    resold = (res == "") ? "" : ((resold == "") ? res : resold
255:                            + "." + res);
256:                    res = tok.nextToken();
257:                }
258:                return resold;
259:            }
260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.