Revision 799

View differences:

org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2
    <modelVersion>4.0.0</modelVersion>
3
    <artifactId>org.gvsig.wfs.app</artifactId>
4
    <packaging>pom</packaging>
5

  
6
    <name>${project.artifactId}</name>
7
    <description>Web Feature Service support</description>
8
    <version>2.0.138</version>
9

  
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>org.gvsig.desktop</artifactId>
13
        <version>2.0.325</version>
14
    </parent>
15

  
16
    <url>https://devel.gvsig.org/redmine/projects/gvsig-wfs</url>
17

  
18
    <repositories>
19
        <repository>
20
            <id>gvsig-public-http-repository</id>
21
            <name>gvSIG maven public HTTP repository</name>
22
            <url>http://devel.gvsig.org/m2repo/j2se</url>
23
            <releases>
24
                <enabled>true</enabled>
25
                <updatePolicy>daily</updatePolicy>
26
                <checksumPolicy>warn</checksumPolicy>
27
            </releases>
28
            <snapshots>
29
                <enabled>true</enabled>
30
                <updatePolicy>daily</updatePolicy>
31
                <checksumPolicy>warn</checksumPolicy>
32
            </snapshots>
33
        </repository>
34
    </repositories>
35

  
36
    <scm>
37
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138</connection>
38
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138</developerConnection>
39
        <url>scm:svn:https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138</url>
40
    </scm>
41

  
42
    <build>
43
        <plugins>
44
            <plugin>
45
                <groupId>org.apache.maven.plugins</groupId>
46
                <artifactId>maven-release-plugin</artifactId>
47
                <configuration>
48
                    <tagBase>https://devel.gvsig.org/svn/gvsig-wfs/org.gvsig.wfs.app/tags</tagBase>
49
                </configuration>
50
            </plugin>
51
        </plugins>
52
    </build>
53
   
54
    <properties>
55
        <org.gvsig.gpe.version>2.1.144</org.gvsig.gpe.version>
56
        <org.gvsig.xmlschema.version>2.0.43</org.gvsig.xmlschema.version>
57
    </properties>  
58
    
59
    <dependencyManagement>
60
        <dependencies>
61
            <!-- Childs -->
62
            <dependency>
63
                <groupId>org.gvsig</groupId>
64
                <artifactId>org.gvsig.wfs.app.mainplugin</artifactId>
65
                <version>2.0.138</version>
66
            </dependency>
67
                                 
68
            <!-- Extern libraries -->
69
            
70
            <!-- gvSIG extern libraries -->
71
            <dependency>
72
                <groupId>org.gvsig</groupId>
73
                <artifactId>org.gvsig.gpe</artifactId>
74
                <version>${org.gvsig.gpe.version}</version>
75
                <type>pom</type>
76
                <scope>import</scope>
77
                <exclusions>
78
                    <exclusion> 
79
                        <groupId>org.gvsig</groupId>
80
                        <artifactId>org.gvsig.tools.*</artifactId>
81
                    </exclusion>
82
                </exclusions> 
83
            </dependency>
84
            <dependency>
85
                <!-- Para proximas versiones de GPE, >2.1.80, quitar esta dependencia -->
86
                <groupId>org.gvsig</groupId>
87
                <artifactId>org.gvsig.gpe.app.mainplugin</artifactId>
88
                <version>${org.gvsig.gpe.version}</version>
89
            </dependency>
90
            <dependency>
91
                <groupId>org.gvsig</groupId>
92
                <artifactId>org.gvsig.xmlschema</artifactId>
93
                <version>${org.gvsig.xmlschema.version}</version>
94
                <type>pom</type>
95
                <scope>import</scope>
96
                <exclusions>
97
                    <exclusion> 
98
                        <groupId>org.gvsig</groupId>
99
                        <artifactId>org.gvsig.tools.*</artifactId>
100
                    </exclusion>
101
                </exclusions> 
102
            </dependency>
103
            
104
        </dependencies>
105
    </dependencyManagement>
106

  
107
    <modules>
108
        <module>org.gvsig.wfs.app.mainplugin</module>
109
    </modules>
110

  
111
</project>
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/exception/ConnectionServerException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.fmap.dal.exception;
29
/**
30
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
31
 */
32
public class ConnectionServerException extends DataException {
33
	private static final long serialVersionUID = 7685079808065728354L;
34
	private final static String MESSAGE_FORMAT = "Exception connecting to the server '%(url)'.";
35
	private final static String MESSAGE_KEY = "_ConnectionServerException";
36

  
37
	public ConnectionServerException(String url, Throwable cause) {
38
		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
39
		setValue("url", url);
40
	}
41

  
42
}
43

  
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/wfs/WFSServerExplorer.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.serverexplorer.wfs;
29

  
30
import java.io.File;
31
import java.io.FileNotFoundException;
32
import java.io.IOException;
33
import java.net.ConnectException;
34
import java.util.ArrayList;
35
import java.util.Hashtable;
36
import java.util.Iterator;
37
import java.util.List;
38

  
39
import org.gvsig.fmap.dal.DALLocator;
40
import org.gvsig.fmap.dal.DataManager;
41
import org.gvsig.fmap.dal.DataServerExplorerParameters;
42
import org.gvsig.fmap.dal.DataStoreParameters;
43
import org.gvsig.fmap.dal.NewDataStoreParameters;
44
import org.gvsig.fmap.dal.exception.DataException;
45
import org.gvsig.fmap.dal.exception.InitializeException;
46
import org.gvsig.fmap.dal.spi.AbstractDataServerExplorer;
47
import org.gvsig.fmap.dal.spi.DataServerExplorerProvider;
48
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
49
import org.gvsig.fmap.dal.store.wfs.WFSFeatureFiller;
50
import org.gvsig.fmap.dal.store.wfs.WFSOpenStoreParameters;
51
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider;
52
import org.gvsig.remoteclient.wfs.WFSClient;
53
import org.gvsig.remoteclient.wfs.WFSFeature;
54
import org.gvsig.remoteclient.wfs.WFSStatus;
55
import org.gvsig.remoteclient.wfs.exceptions.WFSException;
56
import org.gvsig.tools.exception.BaseException;
57
import org.gvsig.xmlschema.lib.api.exceptions.SchemaCreationException;
58

  
59
/**
60
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
61
 */
62
public class WFSServerExplorer extends AbstractDataServerExplorer implements
63
DataServerExplorerProvider {
64
    public static final String NAME = "WFSServerExplorer";
65
//    private WFSServerExplorerParameters parameters = null;
66
    private DataManager dataManager = DALLocator.getDataManager();
67
    private String url = null;
68

  
69
    //WFS Parameters
70
    private WFSStatus status = null;
71
    private WFSClient wfsClient = null;
72

  
73
    /**
74
     * @param parameters
75
     */
76
    public WFSServerExplorer(WFSServerExplorerParameters parameters, DataServerExplorerProviderServices services) throws InitializeException{
77
        super(parameters, services);
78
//        this.parameters = parameters;
79
        this.url = parameters.getUrl();
80
        if (wfsClient == null){
81
            try {
82
                wfsClient = new WFSClient(url, parameters.getIgnoreChace());
83
                if (status == null){
84
                    status = new WFSStatus(null);
85
                }
86

  
87
                wfsClient.getCapabilities(status, parameters.getIgnoreChace(), null);
88
            } catch (ConnectException e) {
89
                throw new InitializeException("Not possible to connect with " + url, e);
90
            } catch (IOException e) {
91
                throw new InitializeException("Not possible to connect with " + url, e);
92
            } catch (WFSException e) {
93
                throw new InitializeException("Not possible to connect with " + url, e);
94
            }
95
        }
96
    }
97

  
98
    /**
99
     * Returns all the feature information retrieved using a
100
     * describeFeatureTypeOpearion
101
     * @param nameSpace
102
     * @param layerName
103
     * Feature name
104
     * @return
105
     * @throws WFSException
106
     */
107
    public WFSFeature getFeatureInfo(String nameSpace, String layerName) throws WFSException{
108
        status = new WFSStatus(layerName, nameSpace);
109
        WFSFeature feature = (WFSFeature) wfsClient.getFeature(nameSpace, layerName);
110
        if (!feature.isCompleted()){
111
            File describeFeatureTypeFile = wfsClient.describeFeatureType(status, getParameters().getIgnoreChace(), null);
112

  
113
            WFSFeatureFiller featureFiller = new WFSFeatureFiller(feature);
114
            try {
115
                featureFiller.fill(describeFeatureTypeFile);
116
            } catch (SchemaCreationException e) {
117
                throw new WFSException(e);
118
            } catch (FileNotFoundException e) {
119
                throw new WFSException(e);
120
            }
121
        }
122

  
123
        return 	feature;
124
    }
125

  
126

  
127

  
128
    /**
129
     * Returns an array of WFSLayerNode's with the descriptors of
130
     * all features (retrieved using the getCapabilities operation)
131
     * @return WFSLayerNode[]
132
     */
133
    public Hashtable getFeatures(){
134
        return wfsClient.getFeatures();
135
    }
136

  
137
    /* (non-Javadoc)
138
     * @see org.gvsig.fmap.dal.DataServerExplorer#add(org.gvsig.fmap.dal.NewDataStoreParameters, boolean)
139
     */
140
    public boolean add(String providerName, NewDataStoreParameters parameters, boolean overwrite)
141
    throws DataException {
142
        // TODO Auto-generated method stub
143
        return false;
144
    }
145

  
146
    /* (non-Javadoc)
147
     * @see org.gvsig.fmap.dal.DataServerExplorer#canAdd()
148
     */
149
    public boolean canAdd() {
150
        // TODO Auto-generated method stub
151
        return false;
152
    }
153

  
154
    /* (non-Javadoc)
155
     * @see org.gvsig.fmap.dal.DataServerExplorer#canAdd(java.lang.String)
156
     */
157
    public boolean canAdd(String storeName) throws DataException {
158
        // TODO Auto-generated method stub
159
        return false;
160
    }
161

  
162
    @Override
163
    protected void doDispose() throws BaseException {
164
        // Nothing to do
165
    }
166

  
167
    /* (non-Javadoc)
168
     * @see org.gvsig.fmap.dal.DataServerExplorer#getAddParameters(java.lang.String)
169
     */
170
    public NewDataStoreParameters getAddParameters(String storeName)
171
    throws DataException {
172
        // TODO Auto-generated method stub
173
        return null;
174
    }
175

  
176
    /* (non-Javadoc)
177
     * @see org.gvsig.fmap.dal.DataServerExplorer#getName()
178
     */
179
    public String getProviderName() {
180
        return NAME;
181
    }
182

  
183
    /* (non-Javadoc)
184
     * @see org.gvsig.fmap.dal.DataServerExplorer#getParameters()
185
     */
186
    @Override
187
    public WFSServerExplorerParameters getParameters() {
188
        return (WFSServerExplorerParameters) super.getParameters();
189
    }
190

  
191
    /* (non-Javadoc)
192
     * @see org.gvsig.fmap.dal.DataServerExplorer#list()
193
     */
194
    public List list() throws DataException {
195
        ArrayList list = new ArrayList();
196
        Hashtable features = wfsClient.getFeatures();
197
        Iterator it = features.keySet().iterator();
198
        DataStoreParameters dsp = null;
199
        while (it.hasNext()){
200
            String key = (String)it.next();
201
            WFSFeature feature = (WFSFeature)features.get(key);
202
            list.add(getParametersFor(feature));
203
        }
204
        return list;
205
    }
206

  
207
    public DataStoreParameters getParametersFor(WFSFeature feature)
208
    throws DataException {
209
        WFSOpenStoreParameters params = (WFSOpenStoreParameters)dataManager
210
        .createStoreParameters(WFSStoreProvider.NAME);
211
        params.setUrl(url);
212
        params.setFeatureType(feature.getNamespace().getPrefix(),
213
            feature.getNamespace().getLocation(),
214
            feature.getName());
215
        return params;
216
    }
217

  
218
    /* (non-Javadoc)
219
     * @see org.gvsig.fmap.dal.DataServerExplorer#list(int)
220
     */
221
    public List list(int mode) throws DataException {
222
        return list();
223
    }
224

  
225
    /* (non-Javadoc)
226
     * @see org.gvsig.fmap.dal.DataServerExplorer#remove(org.gvsig.fmap.dal.DataStoreParameters)
227
     */
228
    public void remove(DataStoreParameters parameters) throws DataException {
229
        // TODO Auto-generated method stub
230

  
231
    }
232

  
233
    /* (non-Javadoc)
234
     * @see org.gvsig.fmap.dal.spi.DataServerExplorerProvider#getServerExplorerProviderServices()
235
     */
236
    public DataServerExplorerProviderServices getServerExplorerProviderServices() {
237
        // TODO Auto-generated method stub
238
        return null;
239
    }
240

  
241
    /* (non-Javadoc)
242
     * @see org.gvsig.fmap.dal.spi.DataServerExplorerProvider#initialize(org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices)
243
     */
244
    public void initialize(
245
        DataServerExplorerProviderServices dataServerExplorerProviderServices) {
246
        // TODO Auto-generated method stub
247

  
248
    }
249

  
250
    /**
251
     * @return
252
     */
253
    public String getTitle() {
254
        String title = wfsClient.getServiceInformation().title;
255
        if (title == null){
256
            return "None";
257
        }
258
        return title;
259
    }
260

  
261
    /**
262
     * @return
263
     */
264
    public String getAbstract() {
265
        String _abstract = wfsClient.getServiceInformation().abstr;
266
        if (_abstract == null){
267
            return "None";
268
        }
269
        return _abstract;
270
    }
271

  
272
    /**
273
     * @return
274
     */
275
    public String getServerType() {
276
        String serverVersion = wfsClient.getVersion();
277
        if (serverVersion == null) {
278
            return "WFS";
279
        }
280
        return "WFS "+ serverVersion;
281
    }
282

  
283
    /**
284
     * @return
285
     */
286
    public String getUrl() {
287
        return wfsClient.getHost();
288
    }
289

  
290
    /**
291
     * @return
292
     */
293
    public int getMaxFeatures() {
294
        return status.getMaxFeatures();
295
    }
296

  
297
    /**
298
     * @return
299
     */
300
    public int getTimeOut() {
301
        return status.getTimeout();
302
    }
303

  
304
    /**
305
     * @param userName
306
     */
307
    public void setUserName(String userName) {
308
        status.setUserName(userName);
309
    }
310

  
311
    /**
312
     * @param buffer
313
     */
314
    public void setMaxFeatures(int buffer) {
315
        status.setMaxFeatures(buffer);
316
    }
317

  
318
    /**
319
     * @param timeout
320
     */
321
    public void setTimeOut(int timeout) {
322
        status.setTimeout(timeout);
323
    }
324

  
325
    /**
326
     * @return
327
     */
328
    public String getVersion() {
329
        return wfsClient.getVersion();
330
    }
331

  
332
    public List getDataStoreProviderNames() {
333
        List x = new ArrayList();
334
        x.add(WFSStoreProvider.NAME);
335
        return x;
336
    }
337
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/wfs/WFSServerExplorerParameters.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27
package org.gvsig.fmap.dal.serverexplorer.wfs;
28

  
29
import org.apache.commons.lang3.BooleanUtils;
30
import org.gvsig.fmap.dal.DataServerExplorerParameters;
31
import org.gvsig.fmap.dal.DataTypes;
32
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.dynobject.DelegatedDynObject;
35
import org.gvsig.tools.dynobject.DynClass;
36
import org.gvsig.tools.dynobject.DynField;
37
import org.gvsig.tools.dynobject.DynObjectManager;
38

  
39
/**
40
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
41
 */
42
public class WFSServerExplorerParameters extends AbstractDataParameters
43
        implements DataServerExplorerParameters {
44

  
45
    public static final String DYNCLASS_NAME = "WFSServerExplorerParameters";
46
    public static final String DYNFIELDNAME_URL = "url";
47
    public static final String DYNFIELDNAME_VERSION = "version";
48
    public static final String DYNFIELDNAME_IGNORE_CACHE = "ignoreCache";
49
    private DelegatedDynObject delegatedDynObject;
50

  
51
    public WFSServerExplorerParameters() {
52
        super();
53
        this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
54
                .getDynObjectManager()
55
                .createDynObject(this.registerDynClass());
56
    }
57

  
58
    @Override
59
    protected DelegatedDynObject getDelegatedDynObject() {
60
        return delegatedDynObject;
61
    }
62

  
63
    private DynClass registerDynClass() {
64
        DynObjectManager dynman = ToolsLocator.getDynObjectManager();
65
        DynClass dynClass = dynman.get(DYNCLASS_NAME);
66
        DynField field;
67
        if (dynClass == null) {
68
            dynClass = dynman.add(DYNCLASS_NAME);
69

  
70
            field = dynClass.addDynFieldString(DYNFIELDNAME_URL);
71
            field.setDescription("Path of the remote service");
72
            field.setMandatory(true);
73

  
74
            field = dynClass.addDynFieldString(DYNFIELDNAME_VERSION);
75
            field.setDescription("Version of the remote service");
76
            field.setMandatory(false);
77

  
78
            field = dynClass.addDynFieldBoolean(DYNFIELDNAME_IGNORE_CACHE);
79
            field.setDescription("If this is true download al files in the next access.");
80
            field.setMandatory(false);
81
            field.setDefaultFieldValue(Boolean.FALSE);
82
        }
83
        return dynClass;
84
    }
85

  
86
    /* (non-Javadoc)
87
     * @see org.gvsig.fmap.dal.DataServerExplorerParameters#getExplorerName()
88
     */
89
    public String getExplorerName() {
90
        return WFSServerExplorer.NAME;
91
    }
92

  
93
    public String getUrl() {
94
        return (String) this.getDynValue(DYNFIELDNAME_URL);
95
    }
96

  
97
    public void setUrl(String url) {
98
        this.setDynValue(DYNFIELDNAME_URL, url);
99
    }
100

  
101
    public String getVersion() {
102
        return (String) this.getDynValue(DYNFIELDNAME_VERSION);
103
    }
104

  
105
    public void setVersion(String version) {
106
        this.setDynValue(DYNFIELDNAME_VERSION, version);
107
    }
108

  
109
    public boolean getIgnoreChace() {
110
        return BooleanUtils.isTrue((Boolean) this.getDynValue(DYNFIELDNAME_IGNORE_CACHE));
111
    }
112

  
113
    public void setIgnoreCache(Boolean ignoreCache) {
114
        this.setDynValue(DYNFIELDNAME_IGNORE_CACHE, new Boolean(ignoreCache));
115
    }
116

  
117
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/wfs/WFSServerExplorerFactory.java
1

  
2
package org.gvsig.fmap.dal.serverexplorer.wfs;
3

  
4
import org.gvsig.fmap.dal.DataServerExplorer;
5
import org.gvsig.fmap.dal.DataServerExplorerParameters;
6
import org.gvsig.fmap.dal.exception.InitializeException;
7
import org.gvsig.fmap.dal.spi.AbstractDataServerExplorerFactory;
8
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
9
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider;
10
import org.gvsig.tools.dynobject.DynObject;
11

  
12
public class WFSServerExplorerFactory extends AbstractDataServerExplorerFactory {
13

  
14
    public WFSServerExplorerFactory() {
15
        super(WFSServerExplorer.NAME, WFSStoreProvider.DESCRIPTION);
16
    }
17
    
18
    @Override
19
    public DynObject createParameters() {
20
        return new WFSServerExplorerParameters();
21
    }
22

  
23
    @Override
24
    public DataServerExplorer create(DataServerExplorerParameters parameters, DataServerExplorerProviderServices explorer) throws InitializeException {
25
        return new WFSServerExplorer((WFSServerExplorerParameters) parameters, explorer);
26
    }
27
    
28
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSTTRansactionException.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.dal.store.wfs;
23

  
24
import org.gvsig.fmap.dal.exception.DataException;
25

  
26

  
27
/**
28
 * @author gvSIG Team
29
 * @version $Id$
30
 *
31
 */
32
public class WFSTTRansactionException extends DataException {
33
   private static final long serialVersionUID = -5529148262961765052L;
34

  
35
   private final static String MESSAGE_FORMAT = "Can't write the feature.";
36
   private final static String MESSAGE_KEY = "_WFSTTranscationException";
37

  
38
   public WFSTTRansactionException(Throwable cause) {
39
       super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);  
40
   }
41
   
42
   public WFSTTRansactionException(String message) {
43
       super(message, MESSAGE_KEY, serialVersionUID);  
44
   }
45
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSFeatureFiller.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.dal.store.wfs;
23

  
24
import java.io.File;
25
import java.io.FileInputStream;
26
import java.io.FileNotFoundException;
27
import java.util.Iterator;
28

  
29
import org.gvsig.remoteclient.wfs.WFSFeature;
30
import org.gvsig.tools.dataTypes.DataType;
31
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator;
32
import org.gvsig.xmlschema.lib.api.XMLSchemaManager;
33
import org.gvsig.xmlschema.lib.api.exceptions.SchemaCreationException;
34
import org.gvsig.xmlschema.lib.api.som.IXSComplexContent;
35
import org.gvsig.xmlschema.lib.api.som.IXSComplexTypeDefinition;
36
import org.gvsig.xmlschema.lib.api.som.IXSContentType;
37
import org.gvsig.xmlschema.lib.api.som.IXSElementDeclaration;
38
import org.gvsig.xmlschema.lib.api.som.IXSExtension;
39
import org.gvsig.xmlschema.lib.api.som.IXSGroup;
40
import org.gvsig.xmlschema.lib.api.som.IXSRestriction;
41
import org.gvsig.xmlschema.lib.api.som.IXSSchema;
42
import org.gvsig.xmlschema.lib.api.som.IXSSimpleContent;
43
import org.gvsig.xmlschema.lib.api.som.IXSSimpleTypeDefinition;
44
import org.gvsig.xmlschema.lib.api.som.IXSTypeDefinition;
45
import org.slf4j.Logger;
46
import org.slf4j.LoggerFactory;
47

  
48

  
49
/**
50
 * @author gvSIG Team
51
 * @version $Id$
52
 *
53
 */
54
public class WFSFeatureFiller {
55
   private static final Logger LOG = LoggerFactory.getLogger(WFSFeatureFiller.class);
56
    private XMLSchemaManager xmlSchemaManager = null;
57
    private static final String XMLSCHEMA_PARSER_PROVIDER_NAME = "xmlschema.providers.kxml";
58
    private WFSFeature feature;
59
    
60
    public WFSFeatureFiller(WFSFeature feature) {
61
        super();
62
        xmlSchemaManager =  XMLSchemaLocator.getXMLSchemaManager();
63
        this.feature = feature;
64
    }
65

  
66
    /**
67
     * @param describeFeatureTypeFile
68
     * @param feature
69
     * @throws FileNotFoundException 
70
     * @throws SchemaCreationException 
71
     */
72
    public void fill(File describeFeatureTypeFile) throws SchemaCreationException, FileNotFoundException {
73
        IXSSchema schema = xmlSchemaManager.parse(XMLSCHEMA_PARSER_PROVIDER_NAME, new FileInputStream(describeFeatureTypeFile));
74
        IXSElementDeclaration elementDeclaration = null;
75
        if (feature.getNamespace() == null){
76
            elementDeclaration = schema.getElementDeclarationByName(null, feature.getName()); 
77
        }else{
78
            elementDeclaration = schema.getElementDeclarationByName(feature.getNamespace().getLocation(), feature.getLocalName());
79
        }
80
        if (elementDeclaration == null){
81
            return;
82
        }
83
        IXSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
84
        if (typeDefinition == null){
85
            return;
86
        }
87
        if (typeDefinition instanceof IXSSimpleTypeDefinition){
88
            
89
        }else if (typeDefinition instanceof IXSComplexTypeDefinition){ 
90
            fill((IXSComplexTypeDefinition)typeDefinition);
91
        }
92
        feature.setCompleted(true);
93
    }
94

  
95
    /**
96
     * @param typeDefinition
97
     */
98
    private void fill(IXSComplexTypeDefinition complexTypeDefinition) {
99
        IXSContentType contentType = complexTypeDefinition.getContentType();
100
        if (contentType != null){
101
            fill((IXSContentType)contentType);
102
        }
103
        IXSGroup group = complexTypeDefinition.getGroup();
104
        if (group != null){
105
            fill((IXSGroup)contentType);
106
        }        
107
    }
108

  
109
    /**
110
     * @param complexTypeDefinition
111
     */
112
    private void fill(IXSGroup group) {
113
        Iterator it = group.getItems().iterator();
114
        while (it.hasNext()){
115
            Object item = it.next();
116
            if (item instanceof IXSElementDeclaration){
117
                IXSElementDeclaration elementDeclaration = (IXSElementDeclaration)item;       
118
                DataType dataType = null;
119
                if (elementDeclaration.getTypeDefinition() != null){
120
                    dataType = elementDeclaration.getTypeDefinition().getDataType();
121
                }
122
                
123
                if (dataType == null || elementDeclaration.getNodeName() == null) {
124
                    LOG.info("Feature attribute type not recognized: "
125
                        + elementDeclaration.toString(),
126
                        new Exception("Feature attribute type not recognized: "
127
                        + elementDeclaration.toString()));
128
                } else {
129
                    feature.addField(elementDeclaration.getNodeName(), elementDeclaration.getTypeName(), dataType);
130
                }
131
                       
132
            }else {
133
                LOG.info("Feature attribute not recognized: "
134
                    + (item == null ? "NULL" : item.getClass().getName()),
135
                        new Exception("Feature attribute not recognized"));
136
            }               
137
        }      
138
    }
139

  
140
    /**
141
     * @param complexTypeDefinition
142
     */
143
    private void fill(IXSContentType contentType) {
144
        if (contentType instanceof IXSSimpleContent){
145
           fill((IXSSimpleContent)contentType);
146
        }else if (contentType instanceof IXSComplexContent){
147
            fill((IXSComplexContent)contentType);
148
        }else if (contentType instanceof IXSGroup){
149
           fill((IXSGroup)contentType);
150
        }        
151
    }
152
    
153
    private void fill(IXSSimpleContent simpleContent) {
154
        IXSRestriction restriction = simpleContent.getRestriction();
155
        if (restriction != null){
156
            fill(restriction);
157
        }
158
        IXSExtension extension = simpleContent.getExtension();
159
        if (extension != null){
160
            fill(extension);
161
        }
162
    }
163
    
164
    private void fill(IXSComplexContent complexContent) {
165
        IXSRestriction restriction = complexContent.getRestriction();
166
        if (restriction != null){
167
            fill(restriction);
168
        }
169
        IXSExtension extension = complexContent.getExtension();
170
        if (extension != null){
171
            fill(extension);
172
        }
173
    }
174

  
175
    /**
176
     * @param extension
177
     */
178
    private void fill(IXSExtension extension) {
179
        IXSGroup group = extension.getGroup();
180
        if (group != null){
181
            fill(group);
182
        }        
183
    }
184

  
185
    /**
186
     * @param restriction
187
     */
188
    private void fill(IXSRestriction restriction) {
189
        IXSGroup group = restriction.getGroup();
190
        if (group != null){
191
            fill(group);
192
        }            
193
    }
194
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSNewStoreParameters.java
1
package org.gvsig.fmap.dal.store.wfs;
2

  
3
import org.gvsig.fmap.dal.DataParameters;
4
import org.gvsig.fmap.dal.exception.InitializeException;
5
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
6
import org.gvsig.fmap.dal.feature.OpenFeatureStoreParameters;
7

  
8

  
9
public class WFSNewStoreParameters 
10
    extends WFSBaseStoreParameters
11
    implements OpenFeatureStoreParameters
12
    {
13

  
14
    private static String PARAMETERS_NAME = "WFSNewStoreParameters";
15
    
16
    public WFSNewStoreParameters() {
17
        super();
18
    }
19
    
20
	public WFSNewStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{
21
		super(dataParameters);
22
    }
23

  
24
    @Override
25
    protected String getStoreParametersName() {
26
        return PARAMETERS_NAME;
27
    }
28
    
29
    public static void registerParameterClass() {
30
        WFSBaseStoreParameters.registerParameterClass(WFSOpenStoreParameters.class, PARAMETERS_NAME);
31
    }
32
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSBaseStoreParameters.java
1

  
2
package org.gvsig.fmap.dal.store.wfs;
3

  
4
import org.apache.commons.lang3.BooleanUtils;
5
import org.cresques.cts.IProjection;
6
import org.gvsig.fmap.dal.DataParameters;
7
import org.gvsig.fmap.dal.DataStoreParameters;
8
import org.gvsig.fmap.dal.DataTypes;
9
import org.gvsig.fmap.dal.exception.InitializeException;
10
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
11
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
12
import org.gvsig.fmap.geom.Geometry;
13
import org.gvsig.fmap.geom.primitive.Envelope;
14
import org.gvsig.tools.ToolsLocator;
15
import org.gvsig.tools.dynobject.DelegatedDynObject;
16
import org.gvsig.tools.dynobject.DynClass;
17
import org.gvsig.tools.dynobject.DynStruct;
18
import org.gvsig.tools.persistence.PersistenceManager;
19

  
20

  
21
public abstract class WFSBaseStoreParameters 
22
    extends AbstractDataParameters 
23
    implements DataStoreParameters
24
    {
25
	protected static DynClass DYNCLASS = null;
26

  
27
	public static final String FIELD_URL = "url";
28
	public static final String FIELD_VERSION = "version";
29
	public static final String FIELD_TYPENAME = "typeName";
30
	public static final String FIELD_NAMESPACE = "namespace";
31
	public static final String DYNFIELDNAME_NAMESPACEPREFIX = "namespacePrefix";
32
	public static final String DYNFIELDNAME_FIELDS = "fields";
33
	public static final String FIELD_FILTER_ENCODING_BY_ATTRIBUTE = "filterEncodingByAttribute";
34
	public static final String DYNFIELDNAME_MAXFEATURES = "maxFeatures";
35
	public static final String DYNFIELDNAME_TIMEOUT = "timeOut";
36
	public static final String DYNFIELDNAME_USER = "user";
37
	public static final String DYNFIELDNAME_PASSWORD = "password";
38
	public static final String DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY = "filterByAreaGeometry";
39
	public static final String DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE = "filterByAreaEnvelope";
40
	public static final String DYNFIELDNAME_FILTER_BY_AREA_OPERATION = "filterByAreaOperation";
41
	public static final String DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE = "filterByAreaAttribute";
42
	public static final String DYNFIELDNAME_FILTER_BY_AREA_CRS = "filterByAreaCrs";
43
	public static final String DYNFIELDNAME_CRS = "Crs";
44

  
45
	private DelegatedDynObject delegatedDynObject;
46

  
47
	public WFSBaseStoreParameters() {
48
		super();
49
		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
50
            .getDynObjectManager().createDynObject(DYNCLASS);
51
	}
52

  
53
	@Override
54
	protected DelegatedDynObject getDelegatedDynObject() {
55
		return delegatedDynObject;
56
	}
57
    
58
    protected abstract String getStoreParametersName();
59

  
60
	public WFSBaseStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{
61
		this();
62
		setUrl((String)dataParameters.getDynValue(FIELD_URL));
63
		String namespace = null;
64
		String namespacePrefix = null;
65
		if (dataParameters.hasDynValue(FIELD_NAMESPACE)){
66
			namespace = (String)dataParameters.getDynValue(FIELD_NAMESPACE);
67
		}
68
		if (dataParameters.hasDynValue(DYNFIELDNAME_NAMESPACEPREFIX)){
69
			namespacePrefix = (String)dataParameters.getDynValue(DYNFIELDNAME_NAMESPACEPREFIX);
70
		}
71
		setFeatureType(namespacePrefix, namespace,
72
				(String)dataParameters.getDynValue(FIELD_TYPENAME));
73
		if (dataParameters.hasDynValue(DYNFIELDNAME_MAXFEATURES)){
74
			setMaxFeatures((Integer)dataParameters.getDynValue(DYNFIELDNAME_MAXFEATURES));
75
		}else{
76
			setMaxFeatures(1000);
77
		}
78
		if (dataParameters.hasDynValue(DYNFIELDNAME_TIMEOUT)){
79
			setTimeOut((Integer)dataParameters.getDynValue(DYNFIELDNAME_TIMEOUT));
80
		}else{
81
			setTimeOut(10000);
82
		}
83
		if (dataParameters.hasDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY)){
84
			setFilterByAreaGeometry((Geometry)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY));
85
			setFilterByAreaAttribute((String)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE));
86
			setFilterByAreaCrs((IProjection)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS));
87
			setFilterByAreaOperation((Integer)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION));
88
		}
89
		if (dataParameters.hasDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE)){
90
			setFilterByAreaEnvelope((Envelope)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE));
91
			setFilterByAreaAttribute((String)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE));
92
			setFilterByAreaCrs((IProjection)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS));
93
			setFilterByAreaOperation((Integer)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION));
94
		}
95
		if (dataParameters.hasDynValue(FIELD_VERSION)){
96
			setVersion((String)dataParameters.getDynValue(FIELD_VERSION));
97
		}
98
		if (dataParameters.hasDynValue(FIELD_FILTER_ENCODING_BY_ATTRIBUTE)){
99
			setFilterEncodingByAttribute((String)dataParameters.getDynValue(FIELD_FILTER_ENCODING_BY_ATTRIBUTE));
100
		}
101
		if (dataParameters.hasDynValue(DYNFIELDNAME_USER)){
102
			setUser((String)dataParameters.getDynValue(DYNFIELDNAME_USER));
103
		}
104
		if (dataParameters.hasDynValue(DYNFIELDNAME_PASSWORD)){
105
			setPassword((String)dataParameters.getDynValue(DYNFIELDNAME_PASSWORD));
106
		}
107
		if (dataParameters.hasDynValue(DYNFIELDNAME_CRS)){
108
			setCrs((String)dataParameters.getDynValue(DYNFIELDNAME_CRS));
109
		}
110
	}
111

  
112
	protected static void registerParameterClass(Class parametersClass, String parametersName) {
113
		if (DYNCLASS == null) {
114
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
115
			DynStruct definition = manager.addDefinition(
116
					parametersClass,
117
					parametersName,
118
					parametersName + " Persistence definition",
119
					null,
120
					null
121
			);
122
			definition.addDynFieldString(FIELD_URL)
123
				.setDescription("URL of the WFS server")
124
				.setMandatory(true);
125

  
126
			definition.addDynFieldString(FIELD_VERSION)
127
				.setDescription("Version of the WFS server")
128
				.setMandatory(false);
129

  
130
			definition.addDynFieldString(FIELD_TYPENAME)
131
				.setDescription("Feature type to retrieve")
132
				.setMandatory(true);
133

  
134
			definition.addDynFieldString(FIELD_NAMESPACE)
135
				.setDescription("Namespace of the feature type to retrieve")
136
				.setMandatory(false);
137

  
138
			definition.addDynFieldString(DYNFIELDNAME_NAMESPACEPREFIX)
139
				.setDescription("Prefix of the namespace of the feature type to retrieve")
140
				.setMandatory(false);
141

  
142
			definition.addDynFieldString(DYNFIELDNAME_FIELDS)
143
				.setDescription("Fields to retrieve separated by ','")
144
				.setMandatory(false);
145

  
146
			definition.addDynFieldString(FIELD_FILTER_ENCODING_BY_ATTRIBUTE)
147
				.setDescription("Filter encoding request")
148
				.setMandatory(false);
149

  
150
			definition.addDynFieldInt(DYNFIELDNAME_MAXFEATURES)
151
				.setDescription("Number of features to retrieve")
152
				.setMandatory(false);
153

  
154
			definition.addDynFieldInt(DYNFIELDNAME_TIMEOUT)
155
				.setDescription("Timeout")
156
				.setMandatory(false);
157

  
158
			definition.addDynFieldString(DYNFIELDNAME_USER)
159
				.setDescription("User name (not used at this moment)")
160
				.setMandatory(false);
161

  
162
			definition.addDynFieldString(DYNFIELDNAME_PASSWORD)
163
				.setDescription("Password (not used at this moment")
164
				.setMandatory(false);
165

  
166
			definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY)
167
				.setType(DataTypes.GEOMETRY)
168
				.setDescription("Geometry used to do the filter")
169
				.setMandatory(false);
170

  
171
			definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE)
172
			.setType(DataTypes.ENVELOPE)
173
			.setDescription("Envelope used to do the filter")
174
			.setMandatory(false);
175

  
176
			definition.addDynFieldInt(DYNFIELDNAME_FILTER_BY_AREA_OPERATION)
177
				.setDescription("Geometry operation used to do the filter")
178
				.setMandatory(false);
179

  
180
			definition.addDynFieldString(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE)
181
				.setDescription("Attribute that contains the geometry")
182
				.setMandatory(false);
183

  
184
			definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_CRS)
185
			.setType(DataTypes.CRS)
186
			.setDescription("CRS to do the spatial filter of the query")
187
			.setMandatory(false);
188

  
189
			definition.addDynFieldString(DYNFIELDNAME_CRS)
190
			.setDescription("CRS")
191
			.setMandatory(false);
192

  
193
			definition.addDynFieldBoolean("useAxisOrderYX")
194
                                .setDefaultFieldValue("false")
195
				.setMandatory(false);
196

  
197
			definition.addDynFieldBoolean("ignoreCache")
198
                                .setDefaultFieldValue("false")
199
				.setMandatory(false);
200

  
201
			DYNCLASS = (DynClass) definition;
202
		}
203
	}
204
    
205
    @Override
206
	public String getDataStoreName() {
207
		return WFSStoreProvider.NAME;
208
	}
209

  
210
    @Override
211
	public String getDescription() {
212
		return WFSStoreProvider.DESCRIPTION;
213
	}
214

  
215
    @Override
216
	public boolean isValid() {
217
		// TODO Auto-generated method stub
218
		return false;
219
	}
220

  
221
	public String getUrl(){
222
		return (String) this.getDynValue(FIELD_URL);
223
	}
224

  
225
	public void setUrl(String url){
226
		this.setDynValue(FIELD_URL, url);
227
	}
228

  
229
	public String getVersion(){
230
		return (String) this.getDynValue(FIELD_VERSION);
231
	}
232

  
233
	public void setVersion(String version){
234
		this.setDynValue(FIELD_VERSION, version);
235
	}
236

  
237
	public String getFeatureType(){
238
		return (String) this.getDynValue(FIELD_TYPENAME);
239
	}
240

  
241
	public void setFeatureType(String featureType){
242
		this.setDynValue(FIELD_TYPENAME, featureType);
243
	}
244

  
245
	public void setFeatureType(String namespace, String featureType){
246
		this.setDynValue(FIELD_NAMESPACE, namespace);
247
		this.setDynValue(FIELD_TYPENAME, featureType);
248
	}
249

  
250
	public void setFeatureType(String prefix, String namespace, String featureType){
251
		this.setDynValue(DYNFIELDNAME_NAMESPACEPREFIX, prefix);
252
		this.setDynValue(FIELD_NAMESPACE, namespace);
253
		this.setDynValue(FIELD_TYPENAME, featureType);
254
	}
255

  
256
	public String getFeatureNamespace(){
257
		return (String) this.getDynValue(FIELD_NAMESPACE);
258
	}
259

  
260
	public String getFeaturePrefix(){
261
		return (String) this.getDynValue(DYNFIELDNAME_NAMESPACEPREFIX);
262
	}
263

  
264
	public String getFields(){
265
		return (String) this.getDynValue(DYNFIELDNAME_FIELDS);
266
	}
267

  
268
	public void setFields(String fields){
269
		this.setDynValue(DYNFIELDNAME_FIELDS, fields);
270
	}
271

  
272
	public String getFilterEncodingByAttribute(){
273
		return (String) this.getDynValue(FIELD_FILTER_ENCODING_BY_ATTRIBUTE);
274
	}
275

  
276
	public void setFilterEncodingByAttribute(String filter){
277
		this.setDynValue(FIELD_FILTER_ENCODING_BY_ATTRIBUTE, filter);
278
	}
279

  
280
	public Integer getMaxFeatures(){
281
		return (Integer) this.getDynValue(DYNFIELDNAME_MAXFEATURES);
282
	}
283

  
284
	public void setMaxFeatures(Integer maxFeatures){
285
		this.setDynValue(DYNFIELDNAME_MAXFEATURES, maxFeatures);
286
	}
287

  
288
	public Integer getTimeOut(){
289
		return (Integer) this.getDynValue(DYNFIELDNAME_TIMEOUT);
290
	}
291

  
292
	public void setTimeOut(Integer timeOut){
293
		this.setDynValue(DYNFIELDNAME_TIMEOUT, timeOut);
294
	}
295

  
296
	public String getUser(){
297
		return (String) this.getDynValue(DYNFIELDNAME_USER);
298
	}
299

  
300
	public void setUser(String user){
301
		this.setDynValue(DYNFIELDNAME_USER, user);
302
	}
303

  
304
	public String getPassword(){
305
		return (String) this.getDynValue(DYNFIELDNAME_PASSWORD);
306
	}
307

  
308
	public void setPassword(String password){
309
		this.setDynValue(DYNFIELDNAME_PASSWORD, password);
310
	}
311

  
312
	public Geometry getFilterByAreaGeometry(){
313
		return (Geometry) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY);
314
	}
315

  
316
	public void setFilterByAreaGeometry(Geometry area){
317
		this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY, area);
318
	}
319

  
320
	public Envelope getFilterByAreaEnvelope(){
321
		return (Envelope) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE);
322
	}
323

  
324
	public void setFilterByAreaEnvelope(Envelope area){
325
		this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE, area);
326
	}
327

  
328
	public Integer getFilterByAreaOperation(){
329
		return (Integer) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION);
330
	}
331

  
332
	public void setFilterByAreaOperation(Integer operation){
333
		this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION, operation);
334
	}
335

  
336
	public IProjection getFilterByAreaCrs(){
337
		return (IProjection) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS);
338
	}
339

  
340
	public void setFilterByAreaCrs(IProjection crs){
341
		this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS, crs);
342
	}
343

  
344
	public String getCrs(){
345
		return (String) this.getDynValue(DYNFIELDNAME_CRS);
346
	}
347

  
348
	public void setCrs(String crs){
349
		this.setDynValue(DYNFIELDNAME_CRS, crs);
350
	}
351

  
352
	public String getFilterByAreaAttribute(){
353
		return (String) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE);
354
	}
355

  
356
	public void setFilterByAreaAttribute(String attribute){
357
		this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE, attribute);
358
	}
359

  
360
	public boolean getUseAxisOrderYX() {
361
            Boolean x = (Boolean) this.getDynValue("useAxisOrderYX");
362
            return BooleanUtils.isTrue(x);
363
	}
364

  
365
	public void setUseAxisOrderYX(boolean useAxisOrderYX){
366
            this.setDynValue("useAxisOrderYX", useAxisOrderYX);
367
	}
368

  
369
        public boolean getIgnoreCache() {
370
            Boolean x = (Boolean) this.getDynValue("ignoreCache");
371
            return BooleanUtils.isTrue(x);
372
	}
373

  
374
	public void setIgnoreCache(boolean ignoreCache){
375
            this.setDynValue("ignoreCache", ignoreCache);
376
	}
377
    
378
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSStoreProviderFactory.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.dal.store.wfs;
25

  
26

  
27
import org.slf4j.Logger;
28
import org.slf4j.LoggerFactory;
29

  
30
import org.gvsig.fmap.dal.DataParameters;
31
import org.gvsig.fmap.dal.DataStoreProvider;
32
import org.gvsig.fmap.dal.exception.InitializeException;
33
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory;
34
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
35
import org.gvsig.tools.dynobject.DynObject;
36

  
37
public class WFSStoreProviderFactory extends AbstractFeatureStoreProviderFactory {
38

  
39
    private static final Logger logger = LoggerFactory.getLogger(WFSStoreProviderFactory.class);
40

  
41
	protected WFSStoreProviderFactory(String name, String description) {
42
		super(name, description);
43
	}
44

  
45
    @Override
46
	public DataStoreProvider createProvider(DataParameters parameters,
47
			DataStoreProviderServices providerServices)
48
			throws InitializeException {
49
		return new WFSStoreProvider((WFSOpenStoreParameters) parameters, providerServices);
50
	}
51

  
52
    @Override
53
	public DynObject createParameters() {
54
		return new WFSOpenStoreParameters();
55
	}
56

  
57
    @Override
58
	public int allowCreate() {
59
		return NO;
60
	}
61

  
62
    @Override
63
	public int allowWrite() {
64
		return NO;
65
	}
66

  
67
    @Override
68
	public int allowRead() {
69
		return YES;
70
	}
71

  
72
    @Override
73
	public int hasRasterSupport() {
74
		return NO;
75
	}
76

  
77
    @Override
78
	public int hasTabularSupport() {
79
		return YES;
80
	}
81

  
82
    @Override
83
	public int hasVectorialSupport() {
84
		return YES;
85
	}
86

  
87
	public int allowMultipleGeometryTypes() {
88
		return YES;
89
	}
90

  
91

  
92
    @Override
93
    public int allowEditableFeatureType() {
94
        return NO;
95
    }
96

  
97
    @Override
98
    public int useLocalIndexesCanImprovePerformance() {
99
        return NO;
100
    }
101

  
102
}
org.gvsig.wfs.app/tags/org.gvsig.wfs.app-2.0.138/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSTTransactionBuilder.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.dal.store.wfs;
23

  
24
import java.io.ByteArrayOutputStream;
25
import java.io.OutputStream;
26

  
27
import org.gvsig.fmap.dal.DataTypes;
28
import org.gvsig.fmap.dal.exception.DataException;
29
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
30
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
31
import org.gvsig.fmap.geom.Geometry;
32
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
33
import org.gvsig.fmap.geom.operation.GeometryOperationException;
34
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
35
import org.gvsig.gpe.lib.api.GPELocator;
36
import org.gvsig.gpe.lib.api.GPEManager;
37
import org.gvsig.gpe.lib.api.exceptions.WriterHandlerCreationException;
38
import org.gvsig.gpe.lib.api.writer.IGPEWriterHandler;
39
import org.gvsig.remoteclient.wfs.WFSClient;
40
import org.gvsig.remoteclient.wfs.WFSStatus;
41
import org.gvsig.remoteclient.wfs.edition.WFSTAttributesOperation;
42
import org.gvsig.remoteclient.wfs.edition.WFSTInsertOperation;
43
import org.gvsig.remoteclient.wfs.edition.WFSTTransaction;
44
import org.gvsig.remoteclient.wfs.edition.WFSTUpdateOperation;
45

  
46

  
47
/**
48
 * @author gvSIG Team
49
 * @version $Id$
50
 *
51
 */
52
public class WFSTTransactionBuilder {
53
    private WFSStatus wfsStatus;
54
    private WFSClient wfsClient;
55
    private static final GPEManager gpeManager = GPELocator.getGPEManager();
56
    private WFSTTransaction transaction = null;
57
    
58
    public WFSTTransactionBuilder(WFSStatus wfsStatus, WFSClient wfsClient) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff