Source Code Cross Referenced for UDIGFeatureStore.java in  » GIS » udig-1.1 » net » refractions » udig » project » internal » impl » 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 » udig 1.1 » net.refractions.udig.project.internal.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.refractions.udig.project.internal.impl;
002:
003:        import java.io.IOException;
004:        import java.util.Set;
005:
006:        import net.refractions.udig.project.ILayer;
007:        import net.refractions.udig.project.ProjectBlackboardConstants;
008:        import net.refractions.udig.project.internal.EditManager;
009:        import net.refractions.udig.project.internal.Messages;
010:        import net.refractions.udig.project.internal.ProjectPlugin;
011:
012:        import org.geotools.data.DataStore;
013:        import org.geotools.data.FeatureListener;
014:        import org.geotools.data.FeatureReader;
015:        import org.geotools.data.FeatureSource;
016:        import org.geotools.data.FeatureStore;
017:        import org.geotools.data.Query;
018:        import org.geotools.data.Transaction;
019:        import org.geotools.feature.AttributeType;
020:        import org.geotools.feature.FeatureCollection;
021:        import org.geotools.feature.FeatureType;
022:        import org.geotools.filter.Filter;
023:
024:        import com.vividsolutions.jts.geom.Envelope;
025:
026:        /**
027:         * A FeatureStore decorator that does not allow the transaction to be set more than once. (Only if
028:         * the current transaction is "AUTO_COMMIT" can the transaction be set)
029:         * 
030:         * @author jones
031:         * @since 1.0.0
032:         */
033:        public class UDIGFeatureStore implements  FeatureStore {
034:
035:            FeatureStore wrapped;
036:            ILayer layer;
037:
038:            /**
039:             * Create a new FeatureStore decorator that does not allow the transaction to be set more than
040:             * once. (Only if the current transaction is "AUTO_COMMIT" can the transaction be set)
041:             * 
042:             * @param store the feature store that will be decorated
043:             * @param layer TODO
044:             */
045:            public UDIGFeatureStore(FeatureStore store, ILayer layer) {
046:                wrapped = store;
047:                this .layer = layer;
048:
049:            }
050:
051:            @SuppressWarnings("deprecation")
052:            public Set addFeatures(FeatureReader arg0) throws IOException {
053:                setTransactionInternal();
054:                return wrapped.addFeatures(arg0);
055:            }
056:
057:            public void removeFeatures(Filter arg0) throws IOException {
058:                setTransactionInternal();
059:                wrapped.removeFeatures(arg0);
060:            }
061:
062:            public void modifyFeatures(AttributeType[] arg0, Object[] arg1,
063:                    Filter arg2) throws IOException {
064:                setTransactionInternal();
065:                wrapped.modifyFeatures(arg0, arg1, arg2);
066:            }
067:
068:            public void modifyFeatures(AttributeType arg0, Object arg1,
069:                    Filter arg2) throws IOException {
070:                setTransactionInternal();
071:                wrapped.modifyFeatures(arg0, arg1, arg2);
072:            }
073:
074:            public void setFeatures(FeatureReader arg0) throws IOException {
075:                setTransactionInternal();
076:                wrapped.setFeatures(arg0);
077:            }
078:
079:            public void setTransaction(Transaction arg0) {
080:                throw new IllegalArgumentException(Messages.UDIGFeatureStore_0
081:                        + Messages.UDIGFeatureStore_1);
082:                //        if (wrapped.getTransaction() != Transaction.AUTO_COMMIT
083:                //                || !(arg0 instanceof UDIGTransaction))
084:                //            throw new IllegalArgumentException(Messages.UDIGFeatureStore_0 + 
085:                //                    Messages.UDIGFeatureStore_1); 
086:                //        wrapped.setTransaction(arg0);
087:            }
088:
089:            protected void editComplete() {
090:                wrapped.setTransaction(Transaction.AUTO_COMMIT);
091:            }
092:
093:            private void setTransactionInternal() {
094:                if (!layer
095:                        .isApplicable(ProjectBlackboardConstants.LAYER__EDIT_APPLICABILITY)) {
096:                    ProjectPlugin
097:                            .log(
098:                                    "Attempted to open a transaction on a non-editable layer (Aborted)", //$NON-NLS-1$
099:                                    new Exception());
100:                }
101:                if (wrapped.getTransaction() == Transaction.AUTO_COMMIT) {
102:                    Transaction transaction = ((EditManager) layer.getMap()
103:                            .getEditManager()).getTransaction();
104:                    wrapped.setTransaction(transaction);
105:                }
106:            }
107:
108:            /**
109:             * Vitalus: Think out how to provide for developers the opportunity
110:             * to use its own FeatureStore wrapper, not UDIGFeatureStore. 
111:             */
112:            public void startTransaction() {
113:                if (wrapped.getTransaction() == Transaction.AUTO_COMMIT) {
114:                    Transaction transaction = ((EditManager) layer.getMap()
115:                            .getEditManager()).getTransaction();
116:                    wrapped.setTransaction(transaction);
117:                }
118:            }
119:
120:            public Transaction getTransaction() {
121:                return wrapped.getTransaction();
122:            }
123:
124:            public DataStore getDataStore() {
125:                return wrapped.getDataStore();
126:            }
127:
128:            public void addFeatureListener(FeatureListener arg0) {
129:                wrapped.addFeatureListener(arg0);
130:            }
131:
132:            public void removeFeatureListener(FeatureListener arg0) {
133:                wrapped.removeFeatureListener(arg0);
134:            }
135:
136:            public FeatureCollection getFeatures(Query arg0) throws IOException {
137:                return wrapped.getFeatures(arg0);
138:            }
139:
140:            public FeatureCollection getFeatures(Filter arg0)
141:                    throws IOException {
142:                return wrapped.getFeatures(arg0);
143:            }
144:
145:            public FeatureCollection getFeatures() throws IOException {
146:                return wrapped.getFeatures();
147:            }
148:
149:            public FeatureType getSchema() {
150:                return wrapped.getSchema();
151:            }
152:
153:            public Envelope getBounds() throws IOException {
154:                return wrapped.getBounds();
155:            }
156:
157:            public Envelope getBounds(Query arg0) throws IOException {
158:                return wrapped.getBounds(arg0);
159:            }
160:
161:            public int getCount(Query arg0) throws IOException {
162:                return wrapped.getCount(arg0);
163:            }
164:
165:            public Set addFeatures(FeatureCollection arg0) throws IOException {
166:                setTransactionInternal();
167:                return wrapped.addFeatures(arg0);
168:            }
169:
170:            public boolean sameSource(FeatureSource source) {
171:                return source == wrapped || source == this;
172:            }
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.