Revision 42998

View differences:

tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/RemoteClientStatus.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

  
25
package org.gvsig.remoteclient;
26

  
27
import org.gvsig.remoteclient.ogc.OGCClientOperation;
28

  
29
/**
30
 * This class represents the client status at a certain moment
31
 * it describes the "graphic" situation or the requirements of the data
32
 * to be retrieved.
33
 * 
34
 */
35
public abstract class RemoteClientStatus {
36

  
37
	// width and heigh of the map
38
    private int width;
39
    private int height;
40
    
41
    //format of the image to be retrieved
42
    private String format;
43
    private String infoFormat;
44
    // spatial reference system of the image to be retrieved
45
    private String srs;
46
    // exception format, to be retrieved in case of error
47
    private String exceptionFormat;
48
    
49
    //To set if the client has to use GET or POST
50
	private int protocol = OGCClientOperation.PROTOCOL_UNDEFINED;
51

  
52
	public int getWidth() {        
53
        return width;
54
    }
55
    
56
    public void setWidth(int _width) {        
57
    	width = _width;
58
    } 
59

  
60
    public int getHeight() {                
61
        return height;
62
    } 
63
    public void setHeight(int _height) {        
64
        height = _height;
65
    } 
66

  
67
    public String getFormat() {        
68
        return format;
69
    }
70
    
71
    public void setFormat(String _format) {        
72
        format = _format;
73
    } 
74
    
75
    public String getInfoFormat() {        
76
        return infoFormat;
77
    } 
78
    
79
    public void setInfoFormat(String _format) {        
80
        infoFormat = _format;
81
    } 
82

  
83
    public String getSrs() {        
84
        return srs;
85
    } 
86

  
87
    public void setSrs(String _srs) {        
88
        srs = _srs;
89
    } 
90

  
91
    public void setExceptionFormat(String _format) {        
92
        exceptionFormat = _format;
93
    } 
94
    
95
    public String getExceptionFormat() {        
96
        return exceptionFormat;
97
    }
98
    
99
    /**
100
	 * @return the protocol
101
	 */
102
	public int getProtocol() {
103
		return protocol;
104
	}
105

  
106
	/**
107
	 * @param protocol the protocol to set
108
	 */
109
	public void setProtocol(int protocol) {
110
		this.protocol = protocol;
111
	}
112
 
113
 }
0 114

  
tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/RasterClient.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

  
25
package org.gvsig.remoteclient;
26

  
27
/**
28
 * <p></p>
29
 * 
30
 */
31
public abstract class RasterClient extends org.gvsig.remoteclient.RemoteClient implements org.gvsig.remoteclient.IRasterClient {
32
 }
0 33

  
tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/utils/CapabilitiesTags.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.remoteclient.utils;
25

  
26
/**
27
 * Class containing a description for all the TAGS defined in the Capabilities Object returned from a WMS
28
 * note: this describes the WMT_MS_Capabilitites 1.1.1
29
 * */
30
public class CapabilitiesTags
31
{
32
	private CapabilitiesTags () {};
33
	public final static String CAPABILITIES_ROOT1_1_0="WMT_MS_Capabilities";
34
	public final static String CAPABILITIES_ROOT1_1_1="WMT_MS_Capabilities";
35
	public final static String CAPABILITIES_ROOT1_3_0="WMS_Capabilities";
36
	public final static String CAPABILITY="Capability";
37
	public final static String SERVICE ="Service";
38
	public final static String NAME ="Name";
39
	public final static String TITLE ="Title";
40
	public final static String ABSTRACT ="Abstract";
41
	public final static String KEYWORDLIST ="KeywordList";
42
	public final static String KEYWORD ="Keyword";
43
	public final static String ONLINERESOURCE ="OnlineResource";
44

  
45
	public final static String CONTACTINFORMATION ="ContactInformation";
46
	public final static String CONTACTPOSITION ="ContactPosition";
47
	public final static String CONTACTADRESS ="ContactAddress";
48
	public final static String CONTACTVOICETELEPHONE ="ContactVoiceTelephone";
49
	public final static String CONTACTFACSIMILETELEPHONE ="ContactFacsimileTelephone";
50
	public final static String CONTACTPERSONPRIMARY ="ContactPersonPrimary";
51
	public final static String CONTACTPERSON ="ContactPerson";
52
	public final static String CONTACTORGANIZATION ="ContactOrganization";
53
	public final static String CONTACTEMAILADRESS ="ContactElectronicMailAddress";
54
	public final static String FEES ="Fees";
55
	public final static String ACCESSCONSTRAINTS ="AccessConstraints";
56
	public final static String REQUEST ="Request";
57
	public final static String GETCAPABILITIES ="GetCapabilities";
58
	public final static String FORMAT ="Format";
59
	public final static String DCPTYPE ="DCPType";
60
	public final static String XMLNS_XLINK ="xmlns:xlink";
61
	public final static String XLINK_TYPE ="xlink:type";
62
	public final static String XLINK_HREF ="xlink:href";
63
	public final static String HTTP ="HTTP";
64
	public final static String GET ="Get";
65
	public final static String POST ="Post";
66
	public final static String GETMAP ="GetMap";
67
	public final static String GETFEATUREINFO ="GetFeatureInfo";
68
	public final static String DESCRIBELAYER ="DescribeLayer";
69
	public final static String GETLEGENDGRAPHIC ="GetLegendGraphic";
70
	public final static String EXCEPTION ="Exception";
71
	public final static String VENDORSPECIFICCAPABILITIES ="VendorSpecificCapabilities";
72
	public final static String USERDEFINEDSYMBOLIZATION ="UserDefinedSymbolization";
73
	public final static String LAYER ="Layer";
74
	public final static String EXCEPTIONS_1_1_x = "application/vnd.ogc.se_xml";
75
	public final static String EXCEPTIONS_1_3_0 = "XML";
76
//	<!ELEMENT Layer ( Name?, Title, Abstract?, KeywordList?, SRS*,
77
//			LatLonBoundingBox?, BoundingBox*, Dimension*, Extent*,
78
//			Attribution?, AuthorityURL*, Identifier*, MetadataURL*, DataURL*,
79
//			FeatureListURL*, Style*, ScaleHint?, Layer* ) >
80
	public final static String SRS ="SRS";
81
	public final static String CRS ="CRS";
82
	public final static String DEAFAULTSRS ="DefaultSRS";	
83
    public final static String OTHERSRS ="OtherSRS";   
84

  
85
	public final static String BOUNDINGBOX ="BoundingBox";
86
	public final static String WGS84BOUNDINGBOX = "WGS84BoundingBox";
87
	public final static String LOWERCORNER = "LowerCorner";
88
	public final static String UPPERCORNER = "UpperCorner";
89
	// Used in the WMS as "LatLonBoundingBox" don't change it and create your own one
90
	public final static String LATLONBOUNDINGBOX ="LatLonBoundingBox";
91
	public final static String EX_GEOGRAPHICBOUNDINGBOX ="EX_GeographicBoundingBox";
92
	public final static String METADATAURL ="MetadataURL";
93
	public final static String LOGOURL ="LogoURL";
94
	public final static String AUTHORITYURL ="AuthorityURL";
95
	public final static String STYLE ="Style";
96
	public final static String LEGENDURL="LegendURL";
97
	public final static String SCALEHINT ="ScaleHint";
98
	public final static String MINSCALEDENOMINATOR ="MinScaleDenominator";
99
	public final static String DIMENSION ="Dimension";
100
	public final static String TIME ="Time";
101
	public final static String CONSTRAINT = "Constraint";
102

  
103
	// capabilities attributes
104
	public final static String VERSION ="version";
105
	public final static String UPDATESEQUENCE ="updatesequence";
106
	public final static String ENCODING ="encoding";
107
	public final static String STANDALONE ="standalone";
108
	public final static String SUPPORTSLD ="SupportSLD";
109
	public final static String USERLAYER ="UserLayer";
110
	public final static String USERSTYLE ="UserStyle";
111
	public final static String QUERYABLE ="queryable";
112
	public final static String CASCADED ="cascaded";
113
	public final static String NOSUBSETS ="noSubsets";
114
	public final static String OPAQUE ="opaque";
115
	public final static String FIXEDWIDTH ="fixedWidth";
116
	public final static String FIXEDHEIGHT ="fixedHeight";
117
    public static final String ATTRIBUTION = "Attribution";
118
    
119
    //LegendURL attributes
120
    public static final String WIDTH = "width";
121
    public static final String HEIGHT = "height";
122

  
123
	public final static String MINX ="minx";
124
	public final static String MINY ="miny";
125
	public final static String MAXX ="maxx";
126
	public final static String MAXY ="maxy";
127
	public final static String RESX ="resx";
128
	public final static String RESY ="rexy";
129
	public final static String WESTBOUNDLONGITUDE ="westBoundLongitude";
130
	public final static String EASTBOUNDLONGITUDE ="eastBoundLongitude";
131
	public final static String SOUTHBOUNDLATITUDE ="southBoundLatitude";
132
	public final static String NORTHBOUNDLATITUDE ="northBoundLatitude";
133

  
134
	public final static String TYPE ="type";
135
	public final static String MIN ="min";
136
	public final static String MAX ="max";
137
	public final static String DIMENSION_NAME ="name";
138
    public final static String DIMENSION_UNITS ="units";
139
    public final static String DIMENSION_UNIT_SYMBOL ="unitSymbol";
140

  
141
    // WMS Extent specifics
142
    public static final String EXTENT="Extent";
143
    public static final String EXTENT_MULTIPLE_VALUES = "multipleValues";
144
    public static final String EXTENT_NEAREST_VALUE = "nearestValue";
145
    public static final String EXTENT_CURRENT="current";
146

  
147

  
148
    // WCS specific
149
    public static final String WCS_CAPABILITIES_ROOT1_0_0 = "WCS_Capabilities";
150
    public static final String WCS_CONTENTMETADATA = "ContentMetadata";
151
    public static final String WCS_LABEL = "label";
152
    public static final String WCS_KEYWORDS = "keywords";
153
    public static final String WCS_DESCRIPTION = "description";
154
    public static final String DESCRIBECOVERAGE = "DescribeCoverage";
155
    public static final String GETCOVERAGE = "GetCoverage";
156
    public static final String WCS_COVERAGEOFFERING = "CoverageOffering";
157
    public static final String WCS_COVERAGEOFFERINGBRIEF = "CoverageOfferingBrief";
158

  
159
    // Miscelaneous
160
    public final static String DEFAULT ="default";
161

  
162
    public final static String EPSG_4326="EPSG:4326";
163
    public final static String CRS_84 ="CRS:84";
164

  
165
    //WFS specific
166
    public static final String WFS_NAMESPACE_PREFIX = "wfs";
167
    public static final String WFS_CAPABILITIES_ROOT1_0_0 = "WFS_Capabilities";
168
    public static final String WFS_TITLE = "Title";
169
    public static final String WFS_ABSTRACT = "Abstract";
170
	public final static String WFS_ONLINERESOURCE ="OnlineResource";
171
	public final static String WFS_FEATURETYPELIST="FeatureTypeList";
172
	public final static String WFS_FEATURETYPE="FeatureType";
173
	public final static String WFS_SCHEMAROOT="schema";
174
	public final static String WFS_DESCRIBEFEATURETYPE ="DescribeFeatureType";
175
	public final static String WFS_GETFEATURE="GetFeature";
176
	public final static String WFS_TRANSACTION = "Transaction";
177
	public final static String WFS_LOCKFEATURE ="LockFeature";
178
	public final static String WFS_KEYWORDS ="Keywords";
179
	public final static String WFS_FEATURE_COLLECTION ="FeatureCollection";
180
    public final static String WFS_RESULT_COLLECTION ="ResultCollection";
181
	public final static String LATLONGBOUNDINGBOX ="LatLongBoundingBox";
182
	public final static String COMPLEXTYPE="complexType";
183
	public final static String COMPLEXCONTENT = "complexContent";
184
	public final static String EXTENSION = "extension";
185
	public final static String SEQUENCE = "sequence";
186
	public final static String ELEMENT = "element";
187
	public final static String ELEMENT_NAME = "name";
188
	public final static String ELEMENT_TYPE = "type";
189
	public final static String ELEMENT_MINOCCURS = "minOccurs";
190
	public final static String ELEMENT_MAXOCCURS = "maxOccurs";
191
	public final static String ELEMENT_REF = "ref";
192
	public final static String SIMPLETYPE = "simpleType";
193
	public final static String RESTRICTION  = "restriction";
194
	public final static String TOTAL_DIGITS = "totalDigits";
195
	public final static String FRACTION_DIGITS = "fractionDigits";
196
	public final static String VALUE = "value";
197
	public final static String BASE = "base";
198
	public final static String CHOICE = "choice";
199
	public final static String SERVICE_EXCEPTION_REPORT = "ServiceExceptionReport"; 
200
    public final static String EXCEPTION_REPORT = "ExceptionReport"; 
201
	public final static String SERVICE_EXCEPTION = "ServiceException";
202
	public final static String CODE = "code";
203
    public final static String EXCEPTION_CODE = "exceptionCode";
204
    public final static String EXCEPTION_TEXT = "ExceptionText";
205
    public final static String MAXFEATURES = "maxFeatures";
206
    
207
	 //WFS specific (1.1.0)
208
	public final static String SERVICE_IDENTIFICATION = "ServiceIdentification";
209
	public final static String SERVICE_PROVIDER = "ServiceProvider";
210
	public final static String OPERATIONS_METADATA = "OperationsMetadata";
211
	public final static String FEATURE_TYPE_LIST = "FeatureTypeList";
212
	public final static String FILTER_CAPABILITIES = "Filter_Capabilities";
213
	public final static String OPERATION = "Operation";
214
	public final static String DCP = "DCP";
215
	public final static String HREF = "xlink:href";
216
	public final static String OPERATION_NAME = "name";
217
	public final static String DEFAULTMAXFEATURES = "DefaultMaxFeatures";
218
	
219
	
220
	//WFS Code errors
221
	public final static String INVALID_FORMAT = "InvalidFormat";
222
	
223
	//WMTS
224
	public final static String WMTS_GMLTAG = "ows:";
225
	public final static String WMTS_CAPABILITIES = "Capabilities";
226
	public final static String WMTS_SERVICEID = "ServiceIdentification";
227
	public final static String WMTS_SERVICEPROV = "ServiceProvider";
228
	public final static String WMTS_OPMETADATA = "OperationsMetadata";
229
	public final static String WMTS_CONTENTS = "Contents";
230
	//Themes
231
	public final static String WMTS_THEMES = "Themes";
232
	public final static String WMTS_THEME = "Theme";
233
	public final static String WMTS_LAYERREF = "LayerRef";
234
	//Content
235
	public final static String WMTS_LAYER = "Layer";
236
	public final static String WMTS_OTHERSRC = "OtherSource";
237
	public final static String WMTS_TILEMATRIXSET = "TileMatrixSet";
238
	//Style
239
	public final static String WMTS_IDENTIFIER = "Identifier";
240
	public final static String WMTS_TITLE = "Title";
241
	public final static String WMTS_ABSTRACT = "Abstract";
242
	public final static String WMTS_KEYWORDS = "Keywords";
243
	public final static String WMTS_KEYWORD = "Keyword";
244
	public final static String WMTS_LEGENDURL = "LegendURL";
245
	public final static String WMTS_ISDEFAULT = "isDefault";
246
	//Layer
247
	public final static String WMTS_WGS84BOUNDINGBOX = "WGS84BoundingBox";
248
	public final static String WMTS_BOUNDINGBOX = "BoundingBox";
249
	public final static String WMTS_STYLE = "Style";
250
	public final static String WMTS_FORMAT = "Format";
251
	public final static String WMTS_INFOFORMAT = "InfoFormat";
252
	public final static String WMTS_DIMENSION = "Dimension";
253
	public final static String WMTS_METADATA = "Metadata";
254
	public final static String WMTS_RESOURCEURL = "ResourceURL";
255
	public final static String WMTS_TILEMATRIXSETLINK = "TileMatrixSetLink";
256
	public final static String WMTS_TILEMATRIXLIMITS = "TileMatrixLimits";
257
	//LegendURL
258
	public final static String WMTS_MINSCALEDEN = "MinScaleDenominator";
259
	public final static String WMTS_MAXSCALEDEN = "MaxScaleDenominator";
260
	public final static String WMTS_HREF = "href";
261
	public final static String WMTS_WIDTH = "width";
262
	public final static String WMTS_HEIGHT = "height";
263
	//WGS84BoundingBox
264
	public final static String WMTS_LOWERCORNER = "LowerCorner";
265
	public final static String WMTS_UPPERCORNER = "UpperCorner";
266
	public final static String WMTS_CRS = "crs";
267
	public final static String WMTS_DIMENSIONS = "dimensions";
268
	//Tiles
269
	public final static String WMTS_TILEMATRIX = "TileMatrix";
270
	public final static String WMTS_MINTILEROW = "MinTileRow";
271
	public final static String WMTS_MAXTILEROW = "MaxTileRow";
272
	public final static String WMTS_MINTILECOL = "MinTileCol";
273
	public final static String WMTS_MAXTILECOL = "MaxTileCol";
274
	//TileMatrixSet
275
	public final static String WMTS_SUPPORTEDCRS = "SupportedCRS";
276
	public final static String WMTS_WELLKNOWNSCALESET = "WellKnownScaleSet";
277
	//TileMatrix
278
	public final static String WMTS_SCALEDENOMINATOR = "ScaleDenominator";
279
	public final static String WMTS_TOPLEFTCORNER = "TopLeftCorner";
280
	public final static String WMTS_TILEWIDTH = "TileWidth";
281
	public final static String WMTS_TILEHEIGHT = "TileHeight";
282
	public final static String WMTS_MATRIXWIDTH = "MatrixWidth";
283
	public final static String WMTS_MATRIXHEIGHT = "MatrixHeight";
284
	
285
	public final static String WMTS_UNITSYMBOL = "UnitsSymbol";
286
	public final static String WMTS_DEFAULTVALUE = "Default";
287
	public final static String WMTS_CURRENT = "Current";
288
	public final static String WMTS_AVAILABLEVALUE = "Value";
289
	//ServiceIdentification
290
	public final static String WMTS_SERVICETYPE = "ServiceType";
291
	public final static String WMTS_SERVICETYPEVERSION = "ServiceTypeVersion";
292
	public final static String WMTS_PROFILE = "Profile";
293
	public final static String WMTS_FEES = "Fees";
294
	public final static String WMTS_ACCESSCONSTRAINTS = "AccessConstraints";
295
	
296
	//ServiceProvider
297
	public final static String WMTS_PROVIDERNAME = "ProviderName";
298
	public final static String WMTS_PROVIDERSITE = "ProviderSite";
299
	public final static String WMTS_SERVICECONTACT = "ServiceContact";
300

  
301
}
302

  
303

  
0 304

  
tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/utils/DescribeCoverageTags.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.remoteclient.utils;
25

  
26
public class DescribeCoverageTags {
27
	private DescribeCoverageTags() {};
28
    public static final String COVERAGE_DESCRIPTION = "CoverageDescription";
29
    public static final String COVERAGE_OFFERING = "CoverageOffering";
30
    public static final String NAME = "name";
31
    public static final String LABEL = "label";
32
    public static final String LONLAT_ENVELOPE = "lonLatEnvelope";
33
	public static final String WGS84 = "WGS84(DD)"; // Decimal Degree
34
	public static final String GML_ENVELOPE = "gml:Envelope";
35
	public static final String GML_POS = "gml:pos";
36
	public static final String SRSNAME = "srsName";
37

  
38
	public static final String DOMAINSET = "domainSet";
39
	public static final String SPATIALDOMAIN = "spatialDomain";
40
	public static final String GRID = "gml:Grid";
41
	public static final String RECTIFIEDGRID = "gml:RectifiedGrid";
42
	public static final String GML_GRIDENVELOPE = "gml:GridEnvelope";
43
	public static final String GML_LIMITS = "gml:limits";
44
	public static final String GML_AXISNAME = "gml:axisName";
45
	public static final String GML_ORIGIN = "gml:origin";
46
	public static final String DIMENSION = "dimension";
47
	public static final String GML_LOW = "gml:low";
48
	public static final String GML_HIGH = "gml:high";
49
	public static final String OFFSETVECTOR = "gml:offsetVector";
50
	public static final String TEMPORALDOMAIN = "temporalDomain";
51
	public static final String GML_TIMEPOSITION = "gml:timePosition";
52
	public static final String TIMEPERIOD = "timePeriod";
53
	public static final String BEGINPOSITION = "beginPosition";
54
	public static final String ENDPOSITION = "endPosition";
55
	public static final String TIMERESOLUTION = "timeResolution";
56

  
57
	public static final String RANGESET = "RangeSet";
58
	/* TODO this can cause eventually problems if in a future the "rangeSet" (not "RangeSet")
59
	 * has more than one sub RangeSet subelement since I'm assuming it and a "rangeSet" tag is
60
	 * simply ignored since it has no effect if it just contains one, and only one, RangeSet
61
	 * subelement.
62
	 */
63
	public static final String AXISDESCRIPTION = "AxisDescription" ;
64
	public static final String VALUES = "values";
65
	public static final String SINGLEVALUE = "singleValue";
66
	public static final String INTERVAL = "interval";
67
	public static final String DEFAULT = "default";
68
	public static final String NULLVALUES = "NullValues";
69

  
70
	public static final String SUPPORTED_CRSS = "supportedCRSs";
71
	public static final String REQUEST_RESPONSE_CRSS = "requestResponseCRSs";
72
	public static final String NATIVE_CRS = "nativeCRSs";
73
	public static final String REQUEST_CRSS = "requestCRSs";
74
	public static final String RESPONSE_CRSS = "responseCRSs";
75

  
76
	public static final String SUPPORTED_FORMATS = "supportedFormats";
77
	public static final String NATIVE_FORMAT = "nativeFormat";
78
	public static final String FORMATS = "formats";
79
	public static final String SUPPORTED_INTERPOLATIONS = "supportedInterpolations";
80
	public static final String INTERPOLATION_METHOD = "interpolationMethod";
81

  
82

  
83
}
0 84

  
tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/utils/Utilities.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.remoteclient.utils;
25

  
26
import java.io.BufferedOutputStream;
27
import java.io.DataOutputStream;
28
import java.io.File;
29
import java.io.FileNotFoundException;
30
import java.io.FileOutputStream;
31
import java.io.FileReader;
32
import java.io.IOException;
33
import java.io.InputStream;
34
import java.io.OutputStream;
35
import java.net.ConnectException;
36
import java.net.URL;
37
import java.net.UnknownHostException;
38
import java.util.Hashtable;
39
import java.util.StringTokenizer;
40
import java.util.Vector;
41

  
42
import org.gvsig.compat.CompatLocator;
43
import org.gvsig.compat.net.Downloader;
44
import org.gvsig.compat.net.ICancellable;
45

  
46

  
47

  
48

  
49
/**
50
 * Clase con m?todos de utilidad en el protocolo WMS
51
 *
52
 * @authors Laura D?az, jaume dominguez faus
53
 */
54
public class Utilities {
55
	private static final Downloader downloader = CompatLocator.getDownloader();
56
    private static String characters;
57
	static boolean canceled;
58
	static final long latency = 500;
59
	/**
60
	 * Used to cancel a group of files
61
	 * <b>key</b>: Group id, <b>value</b>: Boolean (true if
62
	 * the group has to be canceled. Otherwise it is
63
	 * false)
64
	 */
65
	static Hashtable canceledGroup = new Hashtable();
66
	/**
67
	 * <b>key</b>: URL, <b>value</b>: path to the downloaded file.
68
	 */
69
	private static Hashtable downloadedFiles;
70
	static Exception downloadException;
71
	private static final String tempDirectoryPath = System.getProperty("java.io.tmpdir")+"/tmp-andami";
72

  
73

  
74
	static {
75
		characters = "";
76
		for (int j = 32; j<=127; j++){
77
			characters += (char) j;
78
		}
79
		characters += "?????????????????????????????????????????????????\n\r\f\t??";
80
	}
81

  
82

  
83
	/**
84
	 * Checks a File and tries to figure if the file is a text or a binary file.<br>
85
	 * Keep in mind that binary files are those that contains at least one
86
	 * non-printable character.
87
	 *
88
	 * @param file
89
	 * @return <b>true</b> when the file is <b>pretty problably</b> text,
90
	 * <b>false</b> if the file <b>is</b> binary.
91
	 */
92
	public static boolean isTextFile(File file){
93
		return isTextFile(file, 1024);
94
	}
95

  
96
	/**
97
	 * Checks a File and tries to figure if the file is a text or a binary file.<br>
98
	 * Keep in mind that binary files are those that contains at least one
99
	 * non-printable character.
100
	 *
101
	 * @param file
102
	 * @param byteAmount, number of bytes to check.
103
	 * @return <b>true</b> when the file is <b>pretty problably</b> text,
104
	 * <b>false</b> if the file <b>is</b> binary.
105
	 */
106
	public static boolean isTextFile(File file, int byteAmount){
107
		int umbral = byteAmount;
108
		try {
109
			FileReader fr = new FileReader(file);
110
			for (int i = 0; i < umbral; i++) {
111
				int c = fr.read();
112
				if (c==-1){
113
					// End of file. If we reach this
114
					// everything before is printable data.
115
					return true;
116
				}
117
				char ch = (char) c;
118
				if (characters.indexOf(ch)==-1){
119
					// We've found a non-printable character.
120
					// Then we'll assume that this file is binary.
121
					return false;
122
				}
123
			}
124
		} catch (FileNotFoundException e) {
125
			e.printStackTrace();
126
		} catch (IOException e) {
127
			e.printStackTrace();
128
		}
129
		return true;
130
	}
131

  
132
	/**
133
	 * Checks a byte array and tells if it contains only text or contains
134
	 * any binary data.
135
	 *
136
	 * @param file
137
	 * @return <b>true</b> when the data is <b>only</b> text, <b>false</b> otherwise.
138
	 * @deprecated
139
	 */
140
	public static boolean isTextData(byte[] data){
141
		char[] charData = new char[data.length];
142
		for (int i = 0; i<data.length; i++){
143
			charData[i] = (char) data[i];
144
		}
145

  
146
		for (int i = 0; i < data.length; i++) {
147
			int c = charData[i];
148

  
149

  
150
			if (c==-1){
151
				// End of file. If we reach this
152
				// everything before is printable data.
153
				return true;
154
			}
155
			char ch = (char) c;
156
			if (characters.indexOf(ch)==-1){
157
				// We've found a non-printable character.
158
				// Then we'll assume that this file is binary.
159

  
160
				//System.out.println(ch+" at "+i);
161
				return false;
162
			}
163
		}
164
		return true;
165
	}
166

  
167

  
168

  
169

  
170
	/**
171
	 * Copia el contenido de un InputStream en un OutputStream
172
	 *
173
	 * @param in InputStream
174
	 * @param out OutputStream
175
	 */
176
	public static void serializar(InputStream in, OutputStream out) {
177
		byte[] buffer = new byte[102400];
178

  
179
		int n;
180

  
181
		try {
182
			while ((n = in.read(buffer)) != -1) {
183
				out.write(buffer, 0, n);
184
			}
185
		} catch (IOException e) {
186
			e.printStackTrace();
187
		}
188
	}
189

  
190
	/**
191
	 * Elimina del xml la declaraci?n del DTD
192
	 *
193
	 * @param bytes bytes del fichero XML de respuesta a getCapabilities
194
	 * @param startTag Tag raiz del xml respuesta a getCapabilities
195
	 *
196
	 * @return bytes del fichero XML sin la declaraci?n del DTD
197
	 */
198
	public static byte[] eliminarDTD(byte[] bytes, String startTag) {
199
		String text = new String(bytes);
200
		int index1 = text.indexOf("?>") + 2;
201
		int index2;
202

  
203
		try {
204
			index2 = findBeginIndex(bytes, startTag);
205
		} catch (Exception e) {
206
			return bytes;
207
		}
208

  
209
		byte[] buffer = new byte[bytes.length - (index2 - index1)];
210
		System.arraycopy(bytes, 0, buffer, 0, index1);
211
		System.arraycopy(bytes, index2, buffer, index1, bytes.length - index2);
212

  
213
		return buffer;
214
	}
215

  
216
	/**
217
	 * Obtiene el ?ndice del comienzo del xml
218
	 *
219
	 * @param bytes bytes del fichero XML en el que se busca
220
	 * @param tagRaiz Tag raiz del xml respuesta a getCapabilities
221
	 *
222
	 * @return ?ndice donde empieza el tag raiz
223
	 *
224
	 * @throws Exception Si no se encuentra el tag
225
	 */
226
	private static int findBeginIndex(byte[] bytes, String tagRaiz)
227
	throws Exception {
228
		try {
229
			int nodo = 0;
230
			int ret = -1;
231

  
232
			int i = 0;
233

  
234
			while (true) {
235
				switch (nodo) {
236
				case 0:
237

  
238
					if (bytes[i] == '<') {
239
						ret = i;
240
						nodo = 1;
241
					}
242

  
243
					break;
244

  
245
				case 1:
246

  
247
					if (bytes[i] == ' ') {
248
					} else if (bytes[i] == tagRaiz.charAt(0)) {
249
						nodo = 2;
250
					} else {
251
						nodo = 0;
252
					}
253

  
254
					break;
255

  
256
				case 2:
257

  
258
					String aux = new String(bytes, i, 18);
259

  
260
					if (aux.equalsIgnoreCase(tagRaiz.substring(1))) {
261
						return ret;
262
					}
263

  
264
					nodo = 0;
265

  
266
					break;
267
				}
268

  
269
				i++;
270
			}
271
		} catch (Exception e) {
272
			throw new Exception("No se pudo parsear el xml", e);
273
		}
274
	}
275

  
276
	/**
277
	 * Converts the contents of a Vector to a comma separated list
278
	 *
279
	 * */
280
	public static String Vector2CS(Vector v)
281
	{
282
		String str = new String();
283
		if (v != null)
284
		{
285
			int i;
286
			for (i=0; i<v.size() ;i++)
287
			{
288
				str = str + v.elementAt(i);
289
				if (i<v.size()-1)
290
					str = str + ",";
291
			}
292
		}
293
		return str;
294
	}
295

  
296
	public static boolean isValidVersion(String version)
297
	{
298
		if(version.trim().length() == 5)
299
		{
300
			if ( (version.charAt(1)=='.') && (version.charAt(3)=='.'))
301
			{
302
				char x = version.charAt(0);
303
				char y = version.charAt(2);
304
				char z = version.charAt(4);
305

  
306
				if ((Character.isDigit(x)) && (Character.isDigit(y)) && (Character.isDigit(z)))
307
				{
308
					return true;
309
				}
310
				else
311
				{
312
					return false;
313
				}
314
			}
315
			else
316
			{
317
				return false;
318
			}
319
		}
320
		else
321
		{
322
			return false;
323
		}
324
	}
325

  
326
	/**
327
	 * Crea un fichero temporal con un nombre concreto y unos datos pasados por
328
	 * par?metro.
329
	 * @param fileName Nombre de fichero
330
	 * @param data datos a guardar en el fichero
331
	 */
332
	public static void createTemp(String fileName, String data)throws IOException{
333
		File f = new File(fileName);
334
		DataOutputStream dos = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(f)) );
335
		dos.writeBytes(data);
336
		dos.close();
337
		f.deleteOnExit();
338
	}
339

  
340
	/**
341
	 * Checks if a String is a number or not
342
	 *
343
	 * @param String, s
344
	 * @return boolean, true if s is a number
345
	 */
346
	public static boolean isNumber(String s)
347
	{
348
		try
349
		{
350
			//double d = Double.parseDouble(s);
351
			return true;
352
		}
353
		catch(NumberFormatException e)
354
		{
355
			return false;
356
		}
357

  
358
	}
359

  
360
	/**
361
	 * Parses the String containing different items [character] separated and
362
	 * creates a vector with them.
363
	 * @param str String contains item1[c]item2[c]item3...
364
	 * @param c is the string value for separating the items
365
	 * @return Vector containing all the items
366
	 */
367
	public static Vector createVector(String str, String c)
368
	{
369
		StringTokenizer tokens = new StringTokenizer(str, c);
370
		Vector v = new Vector();
371
		try
372
		{
373
			while (tokens.hasMoreTokens())
374
			{
375
				v.addElement(tokens.nextToken());
376
			}
377
			return v;
378
		}
379
		catch (Exception e)
380
		{
381
			return new Vector();
382
		}
383
	}
384

  
385
	/**
386
	 * @param dimensions
387
	 * @return
388
	 */
389
	public static String Vector2URLParamString(Vector v) {
390
		if (v==null) return "";
391
		String s = "";
392
		for (int i = 0; i < v.size(); i++) {
393
			s += v.get(i);
394
			if (i<v.size()-1)
395
				s += "&";
396
		}
397
		return s;
398
	}
399
	
400
	/**
401
	 * Downloads an URL into a temporary file that is removed the next time the
402
	 * tempFileManager class is called, which means the next time gvSIG is launched.
403
	 *
404
	 * @param url
405
	 * @param name
406
	 * @return
407
	 * @throws IOException
408
	 * @throws ServerErrorResponseException
409
	 * @throws ConnectException
410
	 * @throws UnknownHostException
411
	 */
412
	public static synchronized File downloadFile(URL url, String name, ICancellable cancel) throws IOException,ConnectException, UnknownHostException{
413
	    return downloader.downloadFile(url, name, cancel);
414
	}
415
	
416
	private static String calculateFileName(String name){
417
		int index = name.lastIndexOf(".");
418
		if (index > 0){
419
			return tempDirectoryPath + "/" + name.substring(0,index) + System.currentTimeMillis() + 
420
				name.substring(index, name.length());
421
		}
422
		return tempDirectoryPath+"/"+name+System.currentTimeMillis();
423
	}
424

  
425
	/**
426
	 * Downloads a URL using the HTTP Post protocol
427
	 * @param url
428
	 * The server URL
429
	 * @param data
430
	 * The data to send in the request
431
	 * @param name
432
	 * A common name for all the retrieved files
433
	 * @param cancel
434
	 * Used to cancel the downloads
435
	 * @return
436
	 * The retrieved file
437
	 * @throws IOException
438
	 * @throws ConnectException
439
	 * @throws UnknownHostException
440
	 */
441
	public static synchronized File downloadFile(URL url, String data, String name, ICancellable cancel) throws IOException,ConnectException, UnknownHostException{
442
	    return downloader.downloadFile(url, data, name, cancel);
443
	}
444
        
445
	public static synchronized File downloadFile(URL url, String data, String name, ICancellable cancel, int maxbytes) throws IOException,ConnectException, UnknownHostException{
446
	    return downloader.downloadFile(url, data, name, cancel,maxbytes);
447
	}
448

  
449
	/**
450
	 * Cleans every temporal file previously downloaded.
451
	 */
452
	public static void cleanUpTempFiles() {
453
		downloader.cleanUpTempFiles();
454
	}
455

  
456

  
457
	/**
458
	 * Remove an URL from the system cache. The file will remain in the file
459
	 * system for further eventual uses.
460
	 * @param request
461
	 */
462
	public static void removeURL(URL url) {
463
		downloader.removeURL(url);
464
	}
465

  
466
	/**
467
	 * Remove an URL from the system cache. The file will remain in the file
468
	 * system for further eventual uses.
469
	 * @param request
470
	 */
471
	public static void removeURL(Object url) {
472
	    downloader.removeURL(url);
473
	}
474
	
475
        
476
        public static String getAbsolutePathOrEmpty(File f) {
477
            if( f==null ) {
478
                return "";
479
            }
480
            return f.getAbsolutePath();
481
        }
482
        
483
        /**
484
	 * This class has to be deleted when all the classes uses the ICancellable
485
	 * method from libCompat
486
	 * @author gvSIG Team
487
	 * @version $Id: Utilities.java 33983 2010-10-27 12:37:48Z nbrodin $
488
	 * @deprecated You should use always org.gvsig.compat.net.ICancellable
489
	 */
490
	/*private static class CancellableAdapter implements org.gvsig.compat.net.ICancellable {
491
	    private ICancellable cancellable = null;
492

  
493
        public CancellableAdapter(
494
            org.gvsig.remoteclient.wms.ICancellable cancellable) {
495
            super();
496
            this.cancellable = cancellable;
497
        }
498

  
499
        public Object getID() {            
500
            return cancellable.getID();
501
        }
502

  
503
        public boolean isCanceled() {     
504
            return cancellable.isCanceled();
505
        } 	    
506
	}*/
507

  
508
}
0 509

  
tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/utils/BoundaryBox.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

  
25
package org.gvsig.remoteclient.utils;
26

  
27
public class BoundaryBox {
28
    
29
    private double xmin;
30

  
31
    private double xmax;
32
    private double ymin;
33
    private double ymax;
34
    private String srs;
35
    public double getXmin() {        
36
        return xmin;
37
    } 
38
    public void setXmin(double _xmin) {        
39
        xmin = _xmin;
40
    } 
41
    public double getXmax() {        
42
        return xmax;
43
    } 
44
    public void setXmax(double _xmax) {        
45
        xmax = _xmax;
46
    } 
47
    public double getYmin() {        
48
        return ymin;
49
    } 
50
    public void setYmin(double _ymin) {        
51
        ymin = _ymin;
52
    } 
53
    public double getYmax() {        
54
        return ymax;
55
    } 
56
    public void setYmax(double _ymax) {        
57
        ymax = _ymax;
58
    } 
59
    public String getSrs() {        
60
        return srs;
61
    } 
62
    public void setSrs(String _srs) {        
63
        srs = _srs;
64
    }
65
    
66
    public String toString(){
67
        String s = srs + " (" + xmin + ", " + ymin + ", " + xmax + ", " + ymax + ")";
68
        
69
        return s;
70
    }
71
    
72
    public static boolean validLat(double v) {
73
        return v >= -90 && v <= 90;
74
    }
75
    
76
    public static boolean validLon(double v) {
77
        return v >= -180 && v <= 180;
78
    }
79
    
80
    public static BoundaryBox clipGeodeticBBox(BoundaryBox bbox) {
81
        
82
        BoundaryBox resp = new BoundaryBox();
83
        resp.setSrs(bbox.getSrs());
84
        resp.setXmin(bbox.getXmin());
85
        resp.setXmax(bbox.getXmax());
86
        resp.setYmin(bbox.getYmin());
87
        resp.setYmax(bbox.getYmax());
88
        
89
        // ==================================================
90
        // Fix longitude
91
        // ==================================================
92
        if (resp.getXmax() > resp.getXmin()
93
            && validLon(resp.getXmin()) && !validLon(resp.getXmax())) {
94
            // only xmax is wrong:
95
            resp.setXmax(180);
96
        } else {
97
            if (resp.getXmax() > resp.getXmin()
98
                && !validLon(resp.getXmin()) && validLon(resp.getXmax())) {
99
                // only xmin is wrong:
100
                resp.setXmin(-180);
101
            } else {
102
                if (resp.getXmax() > resp.getXmin()
103
                    && validLon(resp.getXmin()) && validLon(resp.getXmax())) {
104
                    // OK, do nothing
105
                } else {
106
                    resp.setXmax(180);
107
                    resp.setXmin(-180);
108
                }
109
            }
110
        }
111
        // ==================================================
112
        // Fix latitude
113
        // ==================================================
114
        if (resp.getYmax() > resp.getYmin()
115
            && validLat(resp.getYmin()) && !validLat(resp.getYmax())) {
116
            // only ymax is wrong:
117
            resp.setYmax(90);
118
        } else {
119
            if (resp.getYmax() > resp.getYmin()
120
                && !validLat(resp.getYmin()) && validLat(resp.getYmax())) {
121
                // only ymin is wrong:
122
                resp.setYmin(-90);
123
            } else {
124
                if (resp.getYmax() > resp.getYmin()
125
                    && validLat(resp.getYmin()) && validLat(resp.getYmax())) {
126
                    // OK, do nothing
127
                } else {
128
                    // box was a mess, let's fix it
129
                    resp.setYmax(90);
130
                    resp.setYmin(-90);
131
                }
132
            }
133
        }
134
        // ===============================================
135
        return resp;
136
        
137
    }
138
 }
0 139

  
tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/utils/DateTime.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

  
25
package org.gvsig.remoteclient.utils;
26
import java.util.Calendar;
27
import java.util.Date;
28
import java.util.GregorianCalendar;
29
import java.util.Locale;
30

  
31
/**
32
 * This class contains static methods to manage Dates. It was principally 
33
 * created because of some problems doing the "String do DateTime" 
34
 * and the "DateTime to String" conversions.  
35
 * 
36
 * @author Jorge Piera Llodr� (piera_jor@gva.es)
37
 */
38
public class DateTime {
39

  
40
/**
41
 * returns the current date
42
 * 
43
 * 
44
 * @return java.util.Date
45
 */
46
    public static Date getCurrentDate() {        
47
        Calendar cal = new GregorianCalendar();
48
 
49
        return cal.getTime();
50
    } 
51

  
52
/**
53
 * It trnasforms one date in one String
54
 * 
55
 * 
56
 * @return A String
57
 * @param dtK Date
58
 * @param sFormat Date format. Example: "Y-m-d H:i:s.Z";
59
 */
60
    public static String dateToString(Date dtK, String sFormat) {        
61
        String sDate;
62
        int nYear;
63
        int nMonth;
64
        int nDay;
65
        int nHour;
66
        int nMinute;
67
        int nSecond;
68
        int nMS;
69
        Calendar clnK;
70
        String sf;
71
        int jc;
72
        clnK = Calendar.getInstance(Locale.US);
73
        clnK.setTime(dtK);
74
        nYear = clnK.get(Calendar.YEAR);
75
        nMonth = 1 + clnK.get(Calendar.MONTH);
76
        nDay = clnK.get(Calendar.DAY_OF_MONTH);
77
        nHour = clnK.get(Calendar.HOUR_OF_DAY);
78
        nMinute = clnK.get(Calendar.MINUTE);
79
        nSecond = clnK.get(Calendar.SECOND);
80
        nMS = clnK.get(Calendar.MILLISECOND);
81
        sDate = "";
82
        for (jc = 0; jc < sFormat.length(); jc++) {
83
            switch (sFormat.charAt(jc)) {
84
                case 'Y':
85
                    sDate += nYear;
86
                    break;
87
                case 'm':
88
                    sf = "" + nMonth;
89
                    if (nMonth < 10) {
90
                        sf = "0" + sf;
91
                    }
92
                    sDate += sf;
93
                    break;
94
                case 'd':
95
                    sf = "" + nDay;
96
                    if (nDay < 10) {
97
                        sf = "0" + sf;
98
                    }
99
                    sDate += sf;
100
                    break;
101
                case 'H':
102
                    sf = "" + nHour;
103
                    if (nHour < 10) {
104
                        sf = "0" + sf;
105
                    }
106
                    sDate += sf;
107
                    break;
108
                case 'i':
109
                    sf = "" + nMinute;
110
                    if (nMinute < 10) {
111
                        sf = "0" + sf;
112
                    }
113
                    sDate += sf;
114
                    break;
115
                case 's':
116
                    sf = "" + nSecond;
117
                    if (nSecond < 10) {
118
                        sf = "0" + sf;
119
                    }
120
                    sDate += sf;
121
                    break;
122
                case 'Z':
123
                    sf = "" + nMS;
124
                    if (nMS < 10) {
125
                        sf = "0" + sf;
126
                    }
127
                    sDate += sf;
128
                    break;
129
                default:
130
                    sDate += sFormat.substring(jc, jc + 1);
131
            }
132
        }
133
        return sDate;
134
    } 
135
   
136
/**
137
 * It transfoms one String in one Date
138
 * 
139
 * 
140
 * @return Date
141
 * @param sDate String
142
 */
143
    public static Date stringToDate(String sDate) {        
144
        Date dtRes;
145
        Calendar clnK;
146
        int nYear;
147
        int nMonth;
148
        int nDay;
149
        int nHour;
150
        int nMinute;
151
        int nSecond;
152
        int nMS;
153
        String sf;
154
        for (; sDate.length() < 23;)
155
            sDate += "0";
156
        sf = sDate.substring(0, 4);
157
        nYear = Integer.parseInt(sf);
158
        sf = sDate.substring(5, 7);
159
        nMonth = Integer.parseInt(sf) - 1;
160
        sf = sDate.substring(8, 10);
161
        nDay = Integer.parseInt(sf);
162
        sf = sDate.substring(11, 13);
163
        nHour = Integer.parseInt(sf);
164
        sf = sDate.substring(14, 16);
165
        nMinute = Integer.parseInt(sf);
166
        sf = sDate.substring(17, 19);
167
        nSecond = Integer.parseInt(sf);
168
        sf = sDate.substring(20, 23);
169
        nMS = Integer.parseInt(sf);
170
        clnK = Calendar.getInstance(Locale.US);
171
        clnK.set(nYear, nMonth, nDay, nHour, nMinute, nSecond);
172
        clnK.set(Calendar.MILLISECOND, nMS);
173
        dtRes = new Date();
174
        dtRes = clnK.getTime();
175
        //	    sf=dateToString(dtRes,"Y-m-d H:i:s.Z");
176
        return dtRes;
177
    } 
178
 }
0 179

  
tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/utils/ExceptionTags.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.remoteclient.utils;
25

  
26
/**
27
 * @author jaume
28
 *
29
 */
30
public class ExceptionTags {
31
	private ExceptionTags() {};
32
    public final static String EXCEPTION_ROOT="ServiceExceptionReport";
33
    public final static String SERVICE_EXCEPTION="ServiceException";
34
    public final static String CODE="code";
35
}
0 36

  
tags/org.gvsig.desktop-2.0.154/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/utils/PropertyManager.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,
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff