Source Code Cross Referenced for DefaultResolveDelta.java in  » GIS » GeoTools-2.4.1 » org » geotools » catalog » defaults » 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 » GIS » GeoTools 2.4.1 » org.geotools.catalog.defaults 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2006, GeoTools Project Managment Committee (PMC)
005:         *    (C) 2005, Refractions Research Inc.
006:         *    
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation;
010:         *    version 2.1 of the License.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.catalog.defaults;
018:
019:        import org.geotools.catalog.Resolve;
020:        import org.geotools.catalog.ResolveDelta;
021:        import org.geotools.catalog.ResolveDeltaVisitor;
022:        import java.io.IOException;
023:        import java.util.ArrayList;
024:        import java.util.Collections;
025:        import java.util.Iterator;
026:        import java.util.List;
027:        import java.util.Set;
028:
029:        /**
030:         * Catalog delta.
031:         *
032:         * @since 0.6.0
033:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/catalog/defaults/DefaultResolveDelta.java $
034:         */
035:        public class DefaultResolveDelta implements  ResolveDelta {
036:            private List children;
037:            private Kind kind = Kind.NO_CHANGE;
038:            private Resolve handle = null;
039:            private Resolve newHandle = null;
040:
041:            /**
042:             * Delta for a changed handle, ie handle state refresh.
043:             * 
044:             * <p>
045:             * Used to communicate that new Info is available and labels should be
046:             * refreshed.
047:             * </p>
048:             *
049:             * @param handle DOCUMENT ME!
050:             * @param changes DOCUMENT ME!
051:             *
052:             * @throws IllegalArgumentException DOCUMENT ME!
053:             */
054:            public DefaultResolveDelta(Resolve handle, List changes) {
055:                this .kind = Kind.CHANGED;
056:                this .children = Collections.unmodifiableList(changes);
057:                this .handle = handle;
058:
059:                if (kind == Kind.REPLACED) {
060:                    throw new IllegalArgumentException(
061:                            "New handle required in replace event.");
062:                }
063:
064:                newHandle = null;
065:            }
066:
067:            /**
068:             * Simple change used for Add and Remove with no children
069:             *
070:             * @param handle DOCUMENT ME!
071:             * @param kind DOCUMENT ME!
072:             *
073:             * @throws IllegalArgumentException DOCUMENT ME!
074:             */
075:            public DefaultResolveDelta(Resolve handle, Kind kind) {
076:                this .kind = kind;
077:                this .children = NO_CHILDREN;
078:                this .handle = handle;
079:
080:                if (kind == Kind.REPLACED) {
081:                    throw new IllegalArgumentException(
082:                            "New handle required in replace event.");
083:                }
084:
085:                newHandle = null;
086:            }
087:
088:            /**
089:             * Delta for a specific change
090:             *
091:             * @param handle DOCUMENT ME!
092:             * @param kind DOCUMENT ME!
093:             * @param changes DOCUMENT ME!
094:             *
095:             * @throws IllegalArgumentException DOCUMENT ME!
096:             */
097:            public DefaultResolveDelta(Resolve handle, Kind kind, List changes) {
098:                this .kind = kind;
099:
100:                if (changes == null) {
101:                    changes = new ArrayList();
102:                }
103:
104:                this .children = Collections.unmodifiableList(changes);
105:                this .handle = handle;
106:
107:                if (kind == Kind.REPLACED) {
108:                    throw new IllegalArgumentException(
109:                            "New handle required in replace event.");
110:                }
111:
112:                newHandle = null;
113:            }
114:
115:            /**
116:             * Delta for handle repalcement.
117:             * 
118:             * <p>
119:             * Used to indicate the actual connection used by the handle has been
120:             * replaced. Layers should foget everything they no and latch onto the
121:             * newHandle.
122:             * </p>
123:             *
124:             * @param handle DOCUMENT ME!
125:             * @param newHandle DOCUMENT ME!
126:             * @param changes DOCUMENT ME!
127:             */
128:            public DefaultResolveDelta(Resolve handle, Resolve newHandle,
129:                    List changes) {
130:                this .kind = Kind.REPLACED;
131:
132:                if (changes == null) {
133:                    changes = new ArrayList();
134:                }
135:
136:                this .children = Collections.unmodifiableList(changes);
137:                this .handle = handle;
138:                this .newHandle = newHandle;
139:            }
140:
141:            /*
142:             * @see net.refractions.udig.catalog.ICatalogDelta#accept(net.refractions.udig.catalog.IServiceVisitor)
143:             */
144:            public void accept(ResolveDeltaVisitor visitor) throws IOException {
145:                visitor.visit(this );
146:
147:                for (Iterator itr = children.iterator(); itr.hasNext();) {
148:                    DefaultResolveDelta delta = (DefaultResolveDelta) itr
149:                            .next();
150:
151:                    if ((delta != null) && visitor.visit(delta)) {
152:                        delta.accept(visitor);
153:                    }
154:                }
155:            }
156:
157:            /*
158:             * @see net.refractions.udig.catalog.ICatalogDelta#getAffected()
159:             */
160:            public List getChildren() {
161:                return children;
162:            }
163:
164:            /*
165:             * @see net.refractions.udig.catalog.ICatalogDelta#getAffected(int, int)
166:             */
167:            public List getChildren(Set kindMask) {
168:                List list = new ArrayList();
169:
170:                for (Iterator itr = children.iterator(); itr.hasNext();) {
171:                    DefaultResolveDelta delta = (DefaultResolveDelta) itr
172:                            .next();
173:
174:                    if ((delta != null) && kindMask.contains(delta.getKind())) {
175:                        list.add(delta);
176:                    }
177:                }
178:
179:                return list;
180:            }
181:
182:            /*
183:             * @see net.refractions.udig.catalog.IDelta#getKind()
184:             */
185:            public Kind getKind() {
186:                return kind;
187:            }
188:
189:            public Resolve getResolve() {
190:                return handle;
191:            }
192:
193:            public Resolve getNewResolve() {
194:                return newHandle;
195:            }
196:
197:            public String toString() {
198:                StringBuffer buffer = new StringBuffer();
199:
200:                /*
201:                 * private List<IResolveDelta> children; private Kind kind = Kind.NO_CHANGE; private
202:                 * IResolve handle = null; private IResolve newHandle = null;
203:                 */
204:                buffer.append(" ResolveDelta: ["); //$NON-NLS-1$
205:                buffer.append(kind);
206:
207:                if (handle != null) {
208:                    buffer.append(","); //$NON-NLS-1$
209:                    buffer.append(handle);
210:                }
211:
212:                if (newHandle != null) {
213:                    buffer.append(","); //$NON-NLS-1$
214:                    buffer.append(newHandle);
215:                }
216:
217:                if (children != null) {
218:                    buffer.append("children ["); //$NON-NLS-1$
219:
220:                    for (int i = 0; i < children.size(); i++) {
221:                        DefaultResolveDelta delta = (DefaultResolveDelta) children
222:                                .get(i);
223:                        buffer.append(delta.getKind());
224:                    }
225:
226:                    buffer.append("] "); //$NON-NLS-1$
227:                }
228:
229:                buffer.append("] "); //$NON-NLS-1$
230:
231:                return buffer.toString();
232:            }
233:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.