Source Code Cross Referenced for TreeSetManagedObjectState.java in  » Net » Terracotta » com » tc » objectserver » managedobject » 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 » Net » Terracotta » com.tc.objectserver.managedobject 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package com.tc.objectserver.managedobject;
006:
007:        import com.tc.object.ObjectID;
008:        import com.tc.object.dna.api.DNACursor;
009:        import com.tc.object.dna.api.DNAWriter;
010:        import com.tc.object.dna.api.LogicalAction;
011:        import com.tc.object.dna.api.PhysicalAction;
012:        import com.tc.objectserver.mgmt.ManagedObjectFacade;
013:        import com.tc.util.Assert;
014:
015:        import java.io.IOException;
016:        import java.io.ObjectInput;
017:        import java.io.ObjectOutput;
018:        import java.util.Iterator;
019:        import java.util.LinkedHashSet;
020:        import java.util.Set;
021:
022:        /**
023:         * ManagedObjectState for sets.
024:         */
025:        public class TreeSetManagedObjectState extends SetManagedObjectState {
026:            private static final String COMPARATOR_FIELDNAME = TreeMapManagedObjectState.COMPARATOR_FIELDNAME;
027:
028:            private ObjectID comparator = null;
029:
030:            public TreeSetManagedObjectState(long classID) {
031:                super (classID);
032:            }
033:
034:            protected TreeSetManagedObjectState(ObjectInput in)
035:                    throws IOException {
036:                super (in);
037:            }
038:
039:            public void apply(ObjectID objectID, DNACursor cursor,
040:                    BackReferences includeIDs) throws IOException {
041:                if (!cursor.next()) {
042:                    return;
043:                }
044:
045:                Object action = cursor.getAction();
046:                if (action instanceof  PhysicalAction) {
047:                    PhysicalAction pa = (PhysicalAction) action;
048:                    Assert
049:                            .assertEquals(COMPARATOR_FIELDNAME, pa
050:                                    .getFieldName());
051:                    this .comparator = (ObjectID) pa.getObject();
052:                    getListener().changed(objectID, null, comparator);
053:                    includeIDs.addBackReference(comparator, objectID);
054:                } else {
055:                    LogicalAction la = (LogicalAction) action;
056:                    int method = la.getMethod();
057:                    Object[] params = la.getParameters();
058:                    super .apply(objectID, method, params, includeIDs);
059:                }
060:
061:                while (cursor.next()) {
062:                    LogicalAction la = cursor.getLogicalAction();
063:                    int method = la.getMethod();
064:                    Object[] params = la.getParameters();
065:                    super .apply(objectID, method, params, includeIDs);
066:                }
067:            }
068:
069:            public void dehydrate(ObjectID objectID, DNAWriter writer) {
070:                if (comparator != null) {
071:                    writer.addPhysicalAction(COMPARATOR_FIELDNAME, comparator);
072:                }
073:                super .dehydrate(objectID, writer);
074:            }
075:
076:            protected void addAllObjectReferencesTo(Set refs) {
077:                super .addAllObjectReferencesTo(refs);
078:                if (comparator != null) {
079:                    refs.add(comparator);
080:                }
081:            }
082:
083:            // TODO This Facade has not included the comparator.
084:            public ManagedObjectFacade createFacade(ObjectID objectID,
085:                    String className, int limit) {
086:                return super .createFacade(objectID, className, limit);
087:            }
088:
089:            protected void basicWriteTo(ObjectOutput out) throws IOException {
090:                if (comparator == null) {
091:                    out.writeBoolean(false);
092:                } else {
093:                    out.writeBoolean(true);
094:                    out.writeLong(comparator.toLong());
095:                }
096:                out.writeInt(references.size());
097:                for (Iterator i = references.iterator(); i.hasNext();) {
098:                    out.writeObject(i.next());
099:                }
100:            }
101:
102:            protected boolean basicEquals(Object other) {
103:                TreeSetManagedObjectState mo = (TreeSetManagedObjectState) other;
104:                return (comparator == mo.comparator || (comparator != null && comparator
105:                        .equals(mo.comparator)))
106:                        && references.equals(mo.references);
107:            }
108:
109:            static SetManagedObjectState readFrom(ObjectInput in)
110:                    throws IOException, ClassNotFoundException {
111:                TreeSetManagedObjectState tsm = new TreeSetManagedObjectState(
112:                        in);
113:                ObjectID comparator;
114:                if (in.readBoolean()) {
115:                    comparator = new ObjectID(in.readLong());
116:                } else {
117:                    comparator = null;
118:                }
119:                int size = in.readInt();
120:                Set set = new LinkedHashSet(size, 0.75f);
121:                for (int i = 0; i < size; i++) {
122:                    set.add(in.readObject());
123:                }
124:                tsm.comparator = comparator;
125:                tsm.references = set;
126:                return tsm;
127:            }
128:
129:            public byte getType() {
130:                return TREE_SET_TYPE;
131:            }
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.