Revision 2991

View differences:

trunk/libraries/libRemoteServices/.classpath
2 2
<classpath>
3 3
	<classpathentry kind="src" path="src"/>
4 4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
	<classpathentry combineaccessrules="false" kind="src" path="/FMap 03"/>
5 6
	<classpathentry kind="output" path="bin"/>
6 7
</classpath>
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/ArcImsClient.java
1
package org.gvsig.remoteClient;
2

  
3
public class ArcImsClient implements ServiceClient{
4

  
5
}
0 6

  
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/WFSClient.java
1
package org.gvsig.remoteClient;
2

  
3
public class WFSClient implements ServiceClient {
4

  
5
}
0 6

  
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/descriptor/Layer.java
1
package org.gvsig.remoteClient.descriptor;
2
import java.awt.geom.Rectangle2D;
3

  
4
import java.util.TreeMap;
5
import java.util.Vector;
6

  
7
public class Layer 
8
{
9
		private TreeMap props = new TreeMap();
10
		private Rectangle2D boundingBox;
11
		private Layer parent = null;
12
		private TreeMap layers = new TreeMap();
13
		private Vector layerVector = new Vector();
14

  
15
		/**
16
		 * Crea una capa sin par?metros
17
		 */
18
		public Layer() {		
19
			setProperty("name", "");
20
		}
21
		/**
22
		 * Crea una capa con los par?metros b?sicos.
23
		 * @param name
24
		 * @param title
25
		 * @param boundingBox
26
		 */
27
		public Layer(String name, String title, Rectangle2D boundingBox) {
28
			super();
29
			setProperty("name", name);
30
			setProperty("title", title);
31
			setLatLonBoundingBox(boundingBox);
32
		}
33
		
34
		/**
35
		 * @return Returns the name.
36
		 */
37
		public String getName() {
38
			return (String) getProperty("name");
39
		}
40
		/**
41
		 * @param name The name to set.
42
		 */
43
		public void setName(String name) {
44
			setProperty("name", name);
45
		}
46
		/**
47
		 * @return Returns the title.
48
		 */
49
		public String getTitle() {
50
			return (String) getProperty("title");
51
		}
52
		/**
53
		 * @param title The title to set.
54
		 */
55
		public void setTitle(String title) {
56
			setProperty("title", title);
57
		}
58
		/**
59
		 * @return Returns the boundingBox.
60
		 */
61
		public Rectangle2D getLatLonBoundingBox() {
62
			return boundingBox;
63
		}
64
		/**
65
		 * @param boundingBox The boundingBox to set.
66
		 */
67
		public void setLatLonBoundingBox(Rectangle2D boundingBox) {
68
			this.boundingBox = boundingBox;
69
		}
70
		
71
		public void setProperty(String propName, Object value) {
72
			props.put(propName, value);
73
		}
74
		
75
		public Object getProperty(String propName) {
76
			return props.get(propName);
77
		}
78
		/**
79
		 * @return Returns the layerTable.
80
		 */
81
		public TreeMap getLayerMap() {
82
			return layers;
83
		}
84
		
85
		public Vector getLayerVector() {
86
			return layerVector;
87
		}
88
		
89
		public boolean hasLayers() {
90
			return layers.size() > 0;
91
		}
92
		
93
		public void addLayer(Layer layer) {
94
			layerVector.add(layer);
95
			if (layer.getName().length()>0)
96
				layers.put(layer.getName(), layer);
97
		}
98
		
99
		public Layer getLayer(String layerName) {
100
			return (Layer) layers.get(layerName);
101
		}
102
		/**
103
		 * @return Returns the parent.
104
		 */
105
		public Layer getParent() {
106
			return parent;
107
		}
108
		/**
109
		 * @param parent The parent to set.
110
		 */
111
		public void setParent(Layer parent) {
112
			this.parent = parent;
113
		}
114
	}
0 115

  
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/descriptor/WMSCapabilities.java
1
package org.gvsig.remoteClient.descriptor;
2

  
3
/**
4
 * Class that stores a WMS Capabilities description:
5
 *  - Layer list
6
 *  - General service information.
7
 * @author Laura Diaz
8
*/
9
public class WMSCapabilities 
10
{
11
	private MapComposition mapComposition;
12
	private ServiceInformation serviceInfo;	
13
	
14
	
15
	public MapComposition getMapComposition()
16
	{
17
		return mapComposition;
18
	}
19
	
20
	public ServiceInformation getServiceInformation()
21
	{
22
		return serviceInfo;
23
	}
24

  
25
}
0 26

  
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/descriptor/MapComposition.java
1
package org.gvsig.remoteClient.descriptor;
2

  
3
import java.util.TreeMap;
4

  
5
/**
6
 * class for storing all the metadata asociated to a map composition (LayerList)
7
 * @author Laura Diaz
8
*/
9
public class MapComposition
10
{
11
  protected int     m_ID; 
12
  private TreeMap layers = new TreeMap();
13

  
14
  /**
15
   * Instance creation. Creates a nameless map composition.
16
   */ 
17
  public MapComposition()
18
  {
19
  }
20

  
21
  /**
22
   * returns the unique identifier from this mapComposition
23
   */
24
  public int getID()
25
  {
26
    return m_ID;
27
  }
28

  
29
  /**
30
   * Sets the unique identifier from this mapComposition
31
   */
32
  public void setID(int id)
33
  {
34
    m_ID = id;
35
  }
36

  
37
  /**
38
   * Adds a Layer object to the vector of layers of this mapComposition
39
   */
40
  public void addLayer(Layer layer)
41
  {
42
    String layerName = layer.getName();
43

  
44
    if (layerName == null)
45
    {
46
      throw new RuntimeException("Error: attempt to add a nameless layer");
47
    }
48

  
49
    // We use the lower case version of the name as a key for the hash map.
50
    layerName = layerName.toLowerCase();    
51
    layers.put(layerName, layer);
52
  }
53
  
54
  /**
55
   * removes the vector of layers of this mapComposition
56
   */
57
  public void removeAllLayers()
58
  {
59
    layers.clear();    
60
  }
61
  
62
  /**
63
   * checks if there are layers in this mapComposition
64
   * @return true if there are layers in the mapComposition
65
   */
66
  public boolean hasLayers()
67
  {
68
    return ( layers.size() > 0 );
69
  }
70
  
71
  /**
72
   * returns the number of layers the mapComposition
73
   */
74
  public int numberOfLayers()
75
  {
76
    return layers.size();
77
  }
78

  
79
 /**
80
  * returns the layer with this layerName in the mapComposition
81
  * @param String layerName the name of the required layer
82
  * @return Layer. the "first" Layer in this mapComposition with this layerName
83
  */
84
  public Layer getLayer(String layerName)
85
  {
86
  	Layer layer;
87
  	
88
  	if (layers.get(layerName) != null)
89
  	{
90
      layers.get(layerName);
91
  	}
92

  
93
    return null;
94
  }
95

  
96

  
97
  /**
98
   * checks if there is a layer in the mapComposition with this name
99
   * @param layerName, name of the layer to be searched
100
   * @return true if a layer with this name exists in the mapComposition
101
   */
102
  public boolean containsLayer(String layerName)
103
  {
104
    return (getLayer(layerName) != null);
105
  }
106

  
107
}
0 108

  
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/descriptor/ServiceInformation.java
1
package org.gvsig.remoteClient.descriptor;
2

  
3
/**
4
  * Class for storing all the general information of this Service
5
  * @author Laura Diaz
6
*/
7
public class ServiceInformation 
8
{
9
  static private String  m_name;
10
  static private String  m_scope;
11
  static private String  m_title;
12
  static private String  m_abstract;
13
  static private String  m_keywords;
14
  static private String  m_fees;
15
  static private String  m_operationsInfo;
16

  
17
  //all the contact person information
18
  static String m_personname = new String();
19
  static String m_organization = new String();
20
  static String m_function = new String();
21
  static String m_addresstype = new String();
22
  static String m_address = new String();
23
  static String m_place = new String();
24
  static String m_province = new String();
25
  static String m_postcode = new String();
26
  static String m_country = new String();
27
  static String m_phone = new String();
28
  static String m_fax =  new String();
29
  static String m_email = new String();
30

  
31
  
32
  // TODO: Add all the supported formats...
33
 /**
34
  * returns the name of this server
35
  */
36
  public static String getName()
37
  {
38
    if(m_name == null)
39
    {
40
      return "";
41
    }
42
    else
43
    {
44
      return m_name;
45
    }
46
  }
47

  
48
 /**
49
  * Sets the name of this service
50
  */
51
  public static void setName(String name)
52
  {
53
    m_name = name;
54
  }
55

  
56

  
57
 /**
58
  * returns the scope of this service
59
  */
60
  public static String getScope()
61
  {
62
    if(m_scope == null)
63
    {
64
      return "";
65
    }
66
    else
67
    {
68
      return m_scope;
69
    }
70
  }
71

  
72
 /**
73
  * Sets the scope of this service
74
  */
75
  public static void setScope(String scope)
76
  {
77
    m_scope = scope;
78
  }
79

  
80
 /**
81
  * returns the title of this service
82
  */
83
  public static String getTitle()
84
  {
85
    if(m_title == null)
86
    {
87
      return "";
88
    }
89
    else
90
    {
91
      return m_title;
92
    }
93
  }
94

  
95
 /**
96
  * Sets the title of this service
97
  */
98
  public static void setTitle(String title)
99
  {
100
    m_title = title;
101
  }
102

  
103
 /**
104
  * returns the abstract of this service
105
  */
106
  public static String getAbstract()
107
  {
108
    if(m_abstract == null)
109
    {
110
      return "";
111
    }
112
    else
113
    {
114
      return m_abstract;
115
    }
116
  }
117

  
118
 /**
119
  * Sets the abstract of this service
120
  */
121
  public static void setAbstract(String abstrac)
122
  {
123
    m_abstract = abstrac;
124
  }
125

  
126
 /**
127
  * returns the keywords of this service
128
  */
129
  public static String getKeywords()
130
  {
131
    if(m_keywords == null)
132
    {
133
      return "";
134
    }
135
    else
136
    {
137
      return m_keywords;
138
    }
139
  }
140

  
141
 /**
142
  * Sets the keywords of this service
143
  */
144
  public static void setKeywords(String keywords)
145
  {
146
    m_keywords = keywords;
147
  }
148

  
149
 /**
150
  * returns the fees of this service
151
  */
152
  public static String getFees()
153
  {
154
    if(m_fees == null)
155
    {
156
      return "";
157
    }
158
    else
159
    {
160
      return m_fees;
161
    }
162
  }
163

  
164
 /**
165
  * Sets the fees of this service
166
  */
167
  public static void setFees(String fees)
168
  {
169
    m_fees = fees;
170
  }
171

  
172

  
173
 /**
174
  * returns the operationsInfo of this service
175
  */
176
  public static String getOperationsInfo()
177
  {
178
    if(m_operationsInfo == null)
179
    {
180
      return "";
181
    }
182
    else
183
    {
184
      return m_operationsInfo;
185
    }
186
  }
187

  
188
 /**
189
  * Sets the operationsInfo of this service
190
  */
191
  public static void setOperationsInfo(String operationsInfo)
192
  {
193
    m_operationsInfo = operationsInfo;
194
  }
195

  
196
  //All the methods for the Service contact Information
197

  
198
 /**
199
  * Sets the Contact person in this service
200
  */
201
   public static void setContactPerson (String name)
202
  {
203
    m_personname = name;
204
  }
205
 /**
206
  * Returns the Contact person in this service
207
  */
208
  public static String getContactPerson ()
209
  {
210
    if(m_personname == null)
211
    {
212
      return "";
213
    }
214
    else
215
    {
216
      return m_personname;
217
    }
218
  }
219
/**
220
  * Sets the Contact person function in this service
221
  */
222
  public static void setContactPersonFunction(String function)
223
  {
224
    m_function = function;
225
  }
226
 /**
227
  * Returns the Contact person function in this service
228
  */
229
  public static String getContactPersonFunction ()
230
  {
231
    if(m_function == null)
232
    {
233
      return "";
234
    }
235
    else
236
    {
237
      return m_function;
238
    }
239
  }
240
 /**
241
  * Sets the Contact person phone in this service
242
  */
243
  public static void setContactPersonPhone(String phone)
244
  {
245
    m_phone = phone;
246
  }
247
 /**
248
  * Returns the Contact person phone in this service
249
  */
250
  public static String getContactPersonPhone ()
251
  {
252
    if(m_phone == null)
253
    {
254
      return "";
255
    }
256
    else
257
    {
258
      return m_phone;
259
    }
260
  }
261
 /**
262
  * Sets the Contact person fax in this service
263
  */
264
  public static void setContactPersonFax(String fax)
265
  {
266
    m_fax = fax;
267
  }
268
 /**
269
  * Returns the Contact person fax in this service
270
  */
271
  public static String getContactPersonFax ()
272
  {
273
    if(m_fax == null)
274
    {
275
      return "";
276
    }
277
    else
278
    {
279
      return m_fax;
280
    }
281
  }
282
 /**
283
  * Sets the Contact person email in this service
284
  */
285
  public static void setContactPersonEmail(String email)
286
  {
287
    m_email = email;
288
  }
289
 /**
290
  * Returns the Contact person email in this service
291
  */
292
  public static String getContactPersonEmail ()
293
  {
294
    if(m_email == null)
295
    {
296
      return "";
297
    }
298
    else
299
    {
300
      return m_email;
301
    }
302
  }
303
 /**
304
  * Sets the Contact Organization in this service
305
  */
306
  public static void setContactOrganization(String organization)
307
  {
308
    m_organization = organization;
309
  }
310
 /**
311
  * Returns the Contact Organization in this service
312
  */
313
  public static String getContactOrganization ()
314
  {
315
    if(m_organization == null)
316
    {
317
      return "";
318
    }
319
    else
320
    {
321
      return m_organization;
322
    }
323
  }
324
 /**
325
  * Sets the Contact address type in this service
326
  */
327
  public static void setContactAddressType(String type)
328
  {
329
    m_addresstype = type;
330
  }
331
 /**
332
  * Returns the Contact address type in this service
333
  */
334
  public static String getContactAddressType()
335
  {
336
    if(m_addresstype ==null)
337
    {
338
      return "";
339
    }
340
    else
341
    {
342
      return m_addresstype;
343
    }
344
  }
345
 /**
346
  * Sets the Contact address in this service
347
  */
348
  public static void setContactAddress(String address)
349
  {
350
    m_address = address;
351
  }
352
 /**
353
  * Returns the Contact address in this service
354
  */
355
  public static String getContactAddress()
356
  {
357
    if(m_address == null)
358
    {
359
      return "";
360
    }
361
    else
362
    {
363
      return m_address;
364
    }
365
  }
366
 /**
367
  * Sets the Contact place in this service
368
  */
369
  public static void setContactPlace(String place)
370
  {
371
    m_place = place;
372
  }
373
 /**
374
  * Returns the Contact place in this service
375
  */
376
  public static String getContactPlace()
377
  {
378
    if(m_place == null)
379
    {
380
      return "";
381
    }
382
    else
383
    {
384
      return m_place;
385
    }
386
  }
387
 /**
388
  * Sets the Contact province in this service
389
  */
390
  public static void setContactProvince(String province)
391
  {
392
    m_province = province;
393
  }
394
 /**
395
  * Returns the Contact province in this service
396
  */
397
  public static String getContactProvince()
398
  {
399
    if(m_province == null)
400
    {
401
      return "";
402
    }
403
    else
404
    {
405
      return m_province;
406
    }
407
  }
408
 /**
409
  * Sets the Contact postCode in this service
410
  */
411
  public static void setContactPostCode(String code)
412
  {
413
    m_postcode = code;
414
  }
415
/**
416
  * Returns the Contact postcode in this service
417
  */
418
  public static String getContactPostCode()
419
  {
420
    if(m_postcode == null)
421
    {
422
      return "";
423
    }
424
    else
425
    {
426
      return m_postcode;
427
    }
428
  }
429
 /**
430
  * Sets the Contact country in this service
431
  */
432
  public static void setContactCountry(String country)
433
  {
434
    m_country = country;
435
  }
436
 /**
437
  * returns the Contact country in this service
438
  */
439
  public static String getContactCountry()
440
  {
441
    if(m_country == null)
442
    {
443
      return "";
444
    }
445
    else
446
    {
447
      return m_country;
448
    }
449
  }
450
}
0 451

  
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/ServiceClient.java
1
package org.gvsig.remoteClient;
2

  
3
/**
4
 * Interface with the methods that give support to remote Service?s clients
5
 * @author Laura Diaz
6
*/
7
public interface ServiceClient {
8

  
9
}
0 10

  
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/WMSClient.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package org.gvsig.remoteClient;
42

  
43
import java.io.IOException;
44
import java.util.ArrayList;
45

  
46
import org.gvsig.remoteClient.driver.RemoteServiceDriver;
47
import org.gvsig.remoteClient.driver.wms.WMSDriver;
48
import org.gvsig.remoteClient.exception.ServerOutOfOrderException;
49
import org.gvsig.remoteClient.exception.UnsupportedVersionException;
50
import org.gvsig.remoteClient.exception.WMSException;
51
import com.iver.cit.gvsig.fmap.DriverException;
52

  
53
/**
54
 * Class that describes a Client interface to a OGC Web Mapping Service
55
 * @author Jaume 
56
 * @author Laura Diaz
57
*/
58
public class WMSClient extends RemoteServiceDriver implements ServiceClient
59
{	
60
	WMSDriver wms;
61
	
62
	public String getName() { return "WMSDriver"; }
63
	
64
	/**
65
	 * Sets the server that we want to connect to.
66
	 * Establece el servidor al que se quiere conectar.
67
	 * @param host
68
	 */
69
	public void setHost(String host){
70
		super.setHost(host);
71
		setServiceName("WMS"); 
72
	}
73
	
74
	/**
75
	 * Sends the GetCapabilities operation to the server.
76
	 * Env?a la operaci?n GetCapabilities al servidor.
77
	 * @throws ServerOutOfOrderException 
78
	 */
79
	public void getCapabilities() 
80
		throws ServerOutOfOrderException, IOException, UnsupportedVersionException {
81
		wms.getCapabilities(); 
82
	}
83

  
84
	public void getMap() 
85
	throws IOException, NoSuchFieldException, WMSException {
86
		wms.getMap(); 
87
	}
88
	
89
	public void getFeatureInfo() 
90
	throws IOException, NoSuchFieldException, WMSException {
91
		wms.getFeatureInfo(); 
92
	}
93
	
94
	/**
95
	 * Returns the server's name. The string is extracted from the GetCapabilities
96
	 * response.
97
	 * Devuelve el nombre del servidor indicado por ?ste.
98
	 * @return String
99
	 */
100
	public String getServerName(){
101
		return "";
102
	}
103
		
104
	/**
105
	 * Returns a string containing the server's WMS version number.
106
	 * Devuelve el n?mero de versi?n WMS del servidor
107
	 * @return String
108
	 */
109
	public String getVersion(){
110
		return ""; //wms.getCapabilities().getVersion;
111
	}
112
	
113
	/**
114
	 * Returns name and description of the server. It is supposed to be used
115
	 * as the source of the abstract field in your application's interface.
116
	 * Devuelve nombre y descripci?n (abstract) del servidor.
117
	 * @return String
118
	 */
119
	public String getDescription(){
120
		String name="";//wms.getCapabilities().getServiceName();
121
		String description = ""; //wms.getCapabilities().getServiceDescription();
122
		
123
		if ( (name == null) && (description == null) ) return "Sin descripci?n";
124
		else if ( (name != null) && (description == null) ) return name;
125
		else if ( (name == null) && (description != null) ) return description;
126
		else if ( (name != null) && (description != null) ) return name+"\n\n"+description;
127
		else return null;
128
	}
129
	
130
	
131
	/**
132
	 * Returns a list containing the formats supported by the coverage
133
	 * Devuelve una lista de formatos soportados por la cobertura.
134
	 * @param coverage
135
	 * @return ArrayList
136
	 */
137
	public ArrayList getFormats(){
138
		return wms.getFormats();
139
		//return null;//wms.getCapabilities().getFormats();
140
	}
141
	
142
	public String[] getLayerNames(){
143
		return wms.getLayerNames();
144
		//return null;
145
	}
146
	
147
	/**
148
	 * Returns the number of layers at the server.
149
	 * Devuelve el numero de layers en el servidor
150
	 * @return int
151
	 */
152
	public int getNumOfLayers(){
153
		return getLayerNames().length;
154
	}
155

  
156
	public void close()
157
	{}
158
	
159
	public void connect() throws IOException, DriverException {
160
		//wms.getCapabilities();
161
		//wms = new WMSClient(getHost()); //
162
		try {
163
			wms.getCapabilities();			
164
			setConnected(true);
165
		} catch (Exception e) {
166
			throw new DriverException(e);
167
		}
168
	}
169
}
0 170

  
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/driver/wms/wms1_1_1/WMSDriver1_1_1.java
2 2

  
3 3
import java.io.IOException;
4 4

  
5
import org.gvsig.remoteClient.cat.WMSCapabilities;
5
import org.gvsig.remoteClient.descriptor.WMSCapabilities;
6 6
import org.gvsig.remoteClient.driver.wms.WMSDriver;
7 7
import org.gvsig.remoteClient.exception.UnsupportedVersionException;
8 8
import org.gvsig.remoteClient.exception.WMSException;
trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/driver/wms/WMSDriver.java
43 43
import java.io.IOException;
44 44
import java.util.ArrayList;
45 45

  
46
import org.gvsig.remoteClient.cat.WMSCapabilities;
46
import org.gvsig.remoteClient.descriptor.WMSCapabilities;
47 47
import org.gvsig.remoteClient.driver.RemoteServiceDriver;
48 48
import org.gvsig.remoteClient.exception.*;
49 49
import org.gvsig.remoteClient.request.wms.GetCapabilitiesRequest;

Also available in: Unified diff