Source Code Cross Referenced for TupleSerialFactory.java in  » JMX » je » com » sleepycat » collections » 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 » JMX » je » com.sleepycat.collections 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*-
002:         * See the file LICENSE for redistribution information.
003:         *
004:         * Copyright (c) 2000,2008 Oracle.  All rights reserved.
005:         *
006:         * $Id: TupleSerialFactory.java,v 1.39.2.2 2008/01/07 15:14:06 cwl Exp $
007:         */
008:
009:        package com.sleepycat.collections;
010:
011:        import com.sleepycat.bind.EntryBinding;
012:        import com.sleepycat.bind.serial.ClassCatalog;
013:        import com.sleepycat.bind.serial.TupleSerialMarshalledBinding;
014:        import com.sleepycat.bind.serial.TupleSerialMarshalledKeyCreator;
015:        import com.sleepycat.bind.tuple.TupleBinding;
016:        import com.sleepycat.bind.tuple.TupleMarshalledBinding;
017:        import com.sleepycat.je.Database;
018:
019:        /**
020:         * Creates stored collections having tuple keys and serialized entity values.
021:         * The entity classes must implement the java.io.Serializable and
022:         * MarshalledTupleKeyEntity interfaces.  The key classes must either implement
023:         * the MarshalledTupleEntry interface or be one of the Java primitive type
024:         * classes.  Underlying binding objects are created automatically.
025:         *
026:         * @author Mark Hayes
027:         */
028:        public class TupleSerialFactory {
029:
030:            private ClassCatalog catalog;
031:
032:            /**
033:             * Creates a tuple-serial factory for given environment and class catalog.
034:             */
035:            public TupleSerialFactory(ClassCatalog catalog) {
036:
037:                this .catalog = catalog;
038:            }
039:
040:            /**
041:             * Returns the class catalog associated with this factory.
042:             */
043:            public final ClassCatalog getCatalog() {
044:
045:                return catalog;
046:            }
047:
048:            /**
049:             * Creates a map from a previously opened Database object.
050:             *
051:             * @param db the previously opened Database object.
052:             *
053:             * @param keyClass is the class used for map keys.  It must implement the
054:             * {@link com.sleepycat.bind.tuple.MarshalledTupleEntry} interface or be
055:             * one of the Java primitive type classes.
056:             *
057:             * @param valueBaseClass the base class of the entity values for this
058:             * store.  It must implement the  {@link
059:             * com.sleepycat.bind.tuple.MarshalledTupleKeyEntity} interface.
060:             *
061:             * @param writeAllowed is true to create a read-write collection or false
062:             * to create a read-only collection.
063:             */
064:            public StoredMap newMap(Database db, Class keyClass,
065:                    Class valueBaseClass, boolean writeAllowed) {
066:
067:                return new StoredMap(db, getKeyBinding(keyClass),
068:                        getEntityBinding(valueBaseClass), writeAllowed);
069:            }
070:
071:            /**
072:             * Creates a sorted map from a previously opened Database object.
073:             *
074:             * @param db the previously opened Database object.
075:             *
076:             * @param keyClass is the class used for map keys.  It must implement the
077:             * {@link com.sleepycat.bind.tuple.MarshalledTupleEntry} interface or be
078:             * one of the Java primitive type classes.
079:             *
080:             * @param valueBaseClass the base class of the entity values for this
081:             * store.  It must implement the  {@link
082:             * com.sleepycat.bind.tuple.MarshalledTupleKeyEntity} interface.
083:             *
084:             * @param writeAllowed is true to create a read-write collection or false
085:             * to create a read-only collection.
086:             */
087:            public StoredSortedMap newSortedMap(Database db, Class keyClass,
088:                    Class valueBaseClass, boolean writeAllowed) {
089:
090:                return new StoredSortedMap(db, getKeyBinding(keyClass),
091:                        getEntityBinding(valueBaseClass), writeAllowed);
092:            }
093:
094:            /**
095:             * Creates a <code>SecondaryKeyCreator</code> object for use in configuring
096:             * a <code>SecondaryDatabase</code>.  The returned object implements
097:             * the {@link com.sleepycat.je.SecondaryKeyCreator} interface.
098:             *
099:             * @param valueBaseClass the base class of the entity values for this
100:             * store.  It must implement the  {@link
101:             * com.sleepycat.bind.tuple.MarshalledTupleKeyEntity} interface.
102:             *
103:             * @param keyName is the key name passed to the {@link
104:             * com.sleepycat.bind.tuple.MarshalledTupleKeyEntity#marshalSecondaryKey}
105:             * method to identify the secondary key.
106:             */
107:            public TupleSerialMarshalledKeyCreator getKeyCreator(
108:                    Class valueBaseClass, String keyName) {
109:
110:                return new TupleSerialMarshalledKeyCreator(
111:                        getEntityBinding(valueBaseClass), keyName);
112:            }
113:
114:            private TupleSerialMarshalledBinding getEntityBinding(
115:                    Class baseClass) {
116:
117:                return new TupleSerialMarshalledBinding(catalog, baseClass);
118:            }
119:
120:            private EntryBinding getKeyBinding(Class keyClass) {
121:
122:                EntryBinding binding = TupleBinding
123:                        .getPrimitiveBinding(keyClass);
124:                if (binding == null) {
125:                    binding = new TupleMarshalledBinding(keyClass);
126:                }
127:                return binding;
128:            }
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.