Source Code Cross Referenced for SequenceMetaData.java in  » Database-ORM » JPOX » org » jpox » metadata » 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 » JPOX » org.jpox.metadata 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************
002:        Copyright (c) 2004 Andy Jefferson and others. All rights reserved.
003:        Licensed under the Apache License, Version 2.0 (the "License");
004:        you may not use this file except in compliance with the License.
005:        You may obtain a copy of the License at
006:
007:            http://www.apache.org/licenses/LICENSE-2.0
008:
009:        Unless required by applicable law or agreed to in writing, software
010:        distributed under the License is distributed on an "AS IS" BASIS,
011:        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        See the License for the specific language governing permissions and
013:        limitations under the License.
014:
015:        Contributors:
016:            ...
017:         **********************************************************************/package org.jpox.metadata;
018:
019:        import org.jpox.util.StringUtils;
020:
021:        /**
022:         * Representation of the MetaData of a named Sequence (JDO, or JPA).
023:         *
024:         * @since 1.1
025:         * @version $Revision: 1.12 $
026:         */
027:        public class SequenceMetaData extends MetaData {
028:            /** Name under which this sequence generator is known. */
029:            protected final String name;
030:
031:            /** Datastore Sequence name */
032:            protected String datastoreSequence;
033:
034:            /** factory class name (JDO). */
035:            protected String factoryClass;
036:
037:            /** Strategy for this sequence (JDO). */
038:            protected SequenceStrategy strategy;
039:
040:            /** Initial value of the sequence. */
041:            protected long initialValue = -1;
042:
043:            /** Allocation size for the sequence. */
044:            protected long allocationSize = -1;
045:
046:            /**
047:             * Constructor.
048:             * @param parent The parent of this element
049:             * @param name The sequence name
050:             * @param datastoreSequence The datastore sequence
051:             * @param factoryClass The factory class
052:             * @param strategyValue The strategy value
053:             * @param initialValue Initial value
054:             * @param allocationSize Allocation size
055:             */
056:            public SequenceMetaData(final MetaData parent, final String name,
057:                    final String datastoreSequence, final String factoryClass,
058:                    final String strategyValue, final String initialValue,
059:                    final String allocationSize) {
060:                super (parent);
061:
062:                this .name = name;
063:                if (StringUtils.isWhitespace(name)) {
064:                    throw new InvalidMetaDataException(LOCALISER, "044155");
065:                }
066:
067:                this .datastoreSequence = (StringUtils
068:                        .isWhitespace(datastoreSequence) ? null
069:                        : datastoreSequence);
070:                this .factoryClass = factoryClass;
071:
072:                // strategy
073:                this .strategy = SequenceStrategy.getStrategy(strategyValue);
074:
075:                if (!StringUtils.isWhitespace(initialValue)) {
076:                    this .initialValue = new Long(initialValue).longValue();
077:                }
078:                if (!StringUtils.isWhitespace(allocationSize)) {
079:                    this .allocationSize = new Long(allocationSize).longValue();
080:                }
081:            }
082:
083:            /**
084:             * Convenience accessor for the fully-qualified name of the sequence.
085:             * @return Fully qualfiied name of the sequence (including the package name).
086:             */
087:            public String getFullyQualifiedName() {
088:                PackageMetaData pmd = (PackageMetaData) getParent();
089:                return pmd.getName() + "." + name;
090:            }
091:
092:            /**
093:             * Accessor for the class name.
094:             * @return class name
095:             */
096:            public String getName() {
097:                return name;
098:            }
099:
100:            /**
101:             * Accessor for the strategy
102:             * @return strategy tag value
103:             */
104:            public SequenceStrategy getStrategy() {
105:                return strategy;
106:            }
107:
108:            /**
109:             * Accessor for the sequence name
110:             * @return The sequence name
111:             */
112:            public String getDatastoreSequence() {
113:                return datastoreSequence;
114:            }
115:
116:            /**
117:             * Accessor for the factory class
118:             * @return factory class
119:             */
120:            public String getFactoryClass() {
121:                return factoryClass;
122:            }
123:
124:            /**
125:             * Accessor for the initial value of the sequence.
126:             * @return The initial value
127:             */
128:            public long getInitialValue() {
129:                return initialValue;
130:            }
131:
132:            /**
133:             * Accessor for the allocation size of the sequence.
134:             * @return The allocation size
135:             */
136:            public long getAllocationSize() {
137:                return allocationSize;
138:            }
139:
140:            /**
141:             * Returns a string representation of the object.
142:             * @param prefix prefix string
143:             * @param indent indent string
144:             * @return a string representation of the object.
145:             */
146:            public String toString(String prefix, String indent) {
147:                StringBuffer sb = new StringBuffer();
148:                sb.append(prefix).append("<sequence name=\"" + name + "\"\n");
149:                if (datastoreSequence != null) {
150:                    sb.append(prefix).append(
151:                            "       datastore-sequence=\"" + datastoreSequence
152:                                    + "\"\n");
153:                }
154:                if (factoryClass != null) {
155:                    sb.append(prefix).append(
156:                            "       factory-class=\"" + factoryClass + "\"\n");
157:                }
158:                if (strategy != null) {
159:                    sb.append(prefix).append(
160:                            "       strategy=\"" + strategy.toString()
161:                                    + "\">\n");
162:                }
163:
164:                // Add extensions
165:                sb.append(super .toString(prefix + indent, indent));
166:
167:                sb.append(prefix + "</sequence>\n");
168:                return sb.toString();
169:            }
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.