Revision 31593

View differences:

tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>extPublishMapserver</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
	</buildSpec>
14
	<natures>
15
		<nature>org.eclipse.jdt.core.javanature</nature>
16
	</natures>
17
</projectDescription>
0 18

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/model/AllModelTests.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.model;
42

  
43
import junit.framework.Test;
44
import junit.framework.TestSuite;
45

  
46
import org.gvsig.publish.mapserver.model.wcs.MapserverWCSLayerTest;
47
import org.gvsig.publish.mapserver.model.wcs.MapserverWCSTest;
48
import org.gvsig.publish.mapserver.model.wfs.MapserverWFSLayerTest;
49
import org.gvsig.publish.mapserver.model.wfs.MapserverWFSTest;
50
import org.gvsig.publish.mapserver.model.wms.MapserverWMSLayerTest;
51
import org.gvsig.publish.mapserver.model.wms.MapserverWMSTest;
52

  
53
public class AllModelTests {
54

  
55
	public static Test suite() {
56
		TestSuite suite = new TestSuite(
57
				"Test for org.gvsig.publish.mapserver.model");
58
		//$JUnit-BEGIN$
59
		suite.addTestSuite(MapserverTest.class);
60
		suite.addTestSuite(MapserverWMSTest.class);
61
		suite.addTestSuite(MapserverWMSLayerTest.class);
62
		suite.addTestSuite(MapserverWFSTest.class);
63
		suite.addTestSuite(MapserverWFSLayerTest.class);
64
		suite.addTestSuite(MapserverWCSTest.class);
65
		suite.addTestSuite(MapserverWCSLayerTest.class);
66
		//$JUnit-END$
67
		return suite;
68
	}
69

  
70
}
0 71

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/model/wcs/MapserverWCSLayerTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.model.wcs;
42

  
43
import org.gvsig.publish.exceptions.InvalidRemoteResourceException;
44
import org.gvsig.publish.mapserver.model.Mapserver;
45
import org.gvsig.publish.serversmodel.RemoteResourceTest;
46

  
47
public class MapserverWCSLayerTest extends RemoteResourceTest {
48

  
49
	public MapserverWCSLayerTest() throws InvalidRemoteResourceException {
50
		super();
51
		// TODO Auto-generated constructor stub
52
	}
53

  
54
	/*
55
	 * (non-Javadoc)
56
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getRemoteResourceClass()
57
	 */
58
	public Class getRemoteResourceClass() {
59
		// TODO Auto-generated method stub
60
		return MapserverWCSLayer.class;
61
	}
62

  
63
	/*
64
	 * (non-Javadoc)
65
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getRemoteResourceRegisterTag()
66
	 */
67
	public String getRemoteResourceRegisterTag() {
68
		// TODO Auto-generated method stub
69
		return MapserverWCSLayer.REGISTER_TAG;
70
	}
71

  
72
	/*
73
	 * (non-Javadoc)
74
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getServerClass()
75
	 */
76
	public Class getServerClass() {
77
		// TODO Auto-generated method stub
78
		return Mapserver.class;
79
	}
80

  
81
	/*
82
	 * (non-Javadoc)
83
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getServerRegisterTag()
84
	 */
85
	public String getServerRegisterTag() {
86
		// TODO Auto-generated method stub
87
		return Mapserver.REGISTER_TAG;
88
	}
89

  
90
	/*
91
	 * (non-Javadoc)
92
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getServiceClass()
93
	 */
94
	public Class getServiceClass() {
95
		// TODO Auto-generated method stub
96
		return MapserverWCS.class;
97
	}
98

  
99
	/*
100
	 * (non-Javadoc)
101
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getServiceRegisterTag()
102
	 */
103
	public String getServiceRegisterTag() {
104
		// TODO Auto-generated method stub
105
		return MapserverWCS.REGISTER_TAG;
106
	}
107

  
108

  
109
}
0 110

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/model/wcs/MapserverWCSTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.model.wcs;
42

  
43
import org.gvsig.publish.mapserver.model.Mapserver;
44
import org.gvsig.publish.serversmodel.ServiceTest;
45

  
46
public class MapserverWCSTest extends ServiceTest {
47

  
48
	/*
49
	 * (non-Javadoc)
50
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getRemoteResourceClass()
51
	 */
52
	public Class getRemoteResourceClass() {
53
		
54
		return MapserverWCSLayer.class;
55
	}
56

  
57
	/*
58
	 * (non-Javadoc)
59
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getRemoteResourceRegisterTag()
60
	 */
61
	public String getRemoteResourceRegisterTag() {
62
		
63
		return MapserverWCS.REGISTER_TAG;
64
	}
65

  
66
	/*
67
	 * (non-Javadoc)
68
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServerClass()
69
	 */
70
	public Class getServerClass() {
71
		
72
		return Mapserver.class;
73
	}
74

  
75
	/*
76
	 * (non-Javadoc)
77
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServerRegisterTag()
78
	 */
79
	public String getServerRegisterTag() {
80
		
81
		return Mapserver.REGISTER_TAG;
82
	}
83

  
84
	/*
85
	 * (non-Javadoc)
86
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServiceClass()
87
	 */
88
	public Class getServiceClass() {
89
		
90
		return MapserverWCS.class;
91
	}
92

  
93
	/*
94
	 * (non-Javadoc)
95
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServiceRegisterTag()
96
	 */
97
	public String getServiceRegisterTag() {
98
		
99
		return MapserverWCS.REGISTER_TAG;
100
	}
101

  
102
}
0 103

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/model/wfs/MapserverWFSLayerTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.model.wfs;
42

  
43
import org.gvsig.publish.exceptions.InvalidRemoteResourceException;
44
import org.gvsig.publish.mapserver.model.Mapserver;
45
import org.gvsig.publish.serversmodel.RemoteResourceTest;
46

  
47
public class MapserverWFSLayerTest extends RemoteResourceTest {
48

  
49

  
50
	public MapserverWFSLayerTest() throws InvalidRemoteResourceException {
51
		super();
52
		// TODO Auto-generated constructor stub
53
	}
54

  
55
	/*
56
	 * (non-Javadoc)
57
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getRemoteResourceClass()
58
	 */
59
	public Class getRemoteResourceClass() {
60
		
61
		return MapserverWFSLayer.class;
62
	}
63

  
64
	/*
65
	 * (non-Javadoc)
66
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getRemoteResourceRegisterTag()
67
	 */
68
	public String getRemoteResourceRegisterTag() {
69

  
70
		return MapserverWFSLayer.REGISTER_TAG;
71
	}
72

  
73
	/*
74
	 * (non-Javadoc)
75
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServerClass()
76
	 */
77
	public Class getServerClass() {
78

  
79
		return Mapserver.class;
80
	}
81

  
82
	/*
83
	 * (non-Javadoc)
84
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServerRegisterTag()
85
	 */
86
	public String getServerRegisterTag() {
87

  
88
		return Mapserver.REGISTER_TAG;
89
	}
90

  
91
	/*
92
	 * (non-Javadoc)
93
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServiceClass()
94
	 */
95
	public Class getServiceClass() {
96
	
97
		return MapserverWFS.class;
98
	}
99

  
100
	/*
101
	 * (non-Javadoc)
102
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServiceRegisterTag()
103
	 */
104
	public String getServiceRegisterTag() {	
105
		return MapserverWFS.REGISTER_TAG;
106
	}
107

  
108

  
109
}
0 110

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/model/wfs/MapserverWFSTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.model.wfs;
42

  
43
import org.gvsig.publish.mapserver.model.Mapserver;
44
import org.gvsig.publish.serversmodel.ServiceTest;
45

  
46
public class MapserverWFSTest extends ServiceTest {
47

  
48
	/*
49
	 * (non-Javadoc)
50
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getRemoteResourceClass()
51
	 */
52
	public Class getRemoteResourceClass() {
53
		
54
		return MapserverWFSLayer.class;
55
	}
56

  
57
	/*
58
	 * (non-Javadoc)
59
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getRemoteResourceRegisterTag()
60
	 */
61
	public String getRemoteResourceRegisterTag() {
62

  
63
		return MapserverWFSLayer.REGISTER_TAG;
64
	}
65

  
66
	/*
67
	 * (non-Javadoc)
68
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServerClass()
69
	 */
70
	public Class getServerClass() {
71

  
72
		return Mapserver.class;
73
	}
74

  
75
	/*
76
	 * (non-Javadoc)
77
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServerRegisterTag()
78
	 */
79
	public String getServerRegisterTag() {
80

  
81
		return Mapserver.REGISTER_TAG;
82
	}
83

  
84
	/*
85
	 * (non-Javadoc)
86
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServiceClass()
87
	 */
88
	public Class getServiceClass() {
89
	
90
		return MapserverWFS.class;
91
	}
92

  
93
	/*
94
	 * (non-Javadoc)
95
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServiceRegisterTag()
96
	 */
97
	public String getServiceRegisterTag() {	
98
		return MapserverWFS.REGISTER_TAG;
99
	}
100

  
101
}
0 102

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/model/MapserverTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.model;
42

  
43
import java.io.File;
44
import java.net.URL;
45

  
46
import org.gvsig.publish.infoproject.IProjectInfo;
47
import org.gvsig.publish.infoproject.factory.ProjectInfoFactory;
48

  
49
import org.gvsig.publish.mapserver.model.wms.MapserverWMS;
50
import org.gvsig.publish.serversmodel.ServerTest;
51
import org.gvsig.publish.util.LocalResourcesTestUtilities;
52

  
53
public class MapserverTest extends ServerTest {
54

  
55
	/*
56
	 * (non-Javadoc)
57
	 * @see org.gvsig.publish.serversmodel.ServerTest#getServerClass()
58
	 */
59
	public Class getServerClass() {
60
		
61
		return Mapserver.class;
62
	}
63

  
64
	/*
65
	 * (non-Javadoc)
66
	 * @see org.gvsig.publish.serversmodel.ServerTest#getServerRegisterTag()
67
	 */
68
	public String getServerRegisterTag() {
69
		
70
		return Mapserver.REGISTER_TAG;
71
	}
72

  
73
	/*
74
	 * (non-Javadoc)
75
	 * @see org.gvsig.publish.serversmodel.ServerTest#getServiceClass()
76
	 */
77
	public Class getServiceClass() {
78
	
79
		return MapserverWMS.class;
80
	}
81

  
82
	/*
83
	 * (non-Javadoc)
84
	 * @see org.gvsig.publish.serversmodel.ServerTest#getServiceRegisterTag()
85
	 */
86
	public String getServiceRegisterTag() {
87

  
88
		return MapserverWMS.REGISTER_TAG;
89
	}
90

  
91
	/* (non-Javadoc)
92
	 * @see org.gvsig.publish.serversmodel.ServerTest#testPublish()
93
	 */
94
	
95
	public void testPublish() throws Exception {
96
		server.setServerURL( new URL("http://localhost/cgi-bin/mapserv"));
97
		LocalResourcesTestUtilities util = new LocalResourcesTestUtilities();
98
		IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete());
99
		server.addInfo(proj.getViewsInfo()[0]);
100
		server.addService(service);
101
		((Mapserver)server).setMapfileFile(new File("test.map"));	
102
		super.testPublish();
103
	}
104
	
105
}
0 106

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/model/wms/MapserverWMSLayerTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.model.wms;
42

  
43
import java.net.MalformedURLException;
44
import java.net.URL;
45

  
46
import org.gvsig.publish.exceptions.InvalidRemoteResourceException;
47
import org.gvsig.publish.mapserver.model.Mapserver;
48
import org.gvsig.publish.serversmodel.RemoteResourceTest;
49

  
50

  
51

  
52
public class MapserverWMSLayerTest extends RemoteResourceTest {
53

  
54
	public MapserverWMSLayerTest() throws InvalidRemoteResourceException {
55
		super();
56
		// TODO Auto-generated constructor stub
57
	}
58

  
59
	/*
60
	 * (non-Javadoc)
61
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getRemoteResourceClass()
62
	 */
63
	public Class getRemoteResourceClass() {
64
		// TODO Auto-generated method stub
65
		return MapserverWMSLayer.class;
66
	}
67

  
68
	/*
69
	 * (non-Javadoc)
70
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getRemoteResourceRegisterTag()
71
	 */
72
	public String getRemoteResourceRegisterTag() {
73
		// TODO Auto-generated method stub
74
		return MapserverWMSLayer.REGISTER_TAG;
75
	}
76

  
77
	/*
78
	 * (non-Javadoc)
79
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getServerClass()
80
	 */
81
	public Class getServerClass() {
82
		// TODO Auto-generated method stub
83
		return Mapserver.class;
84
	}
85

  
86
	/*
87
	 * (non-Javadoc)
88
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getServerRegisterTag()
89
	 */
90
	public String getServerRegisterTag() {
91
		// TODO Auto-generated method stub
92
		return Mapserver.REGISTER_TAG;
93
	}
94

  
95
	/*
96
	 * (non-Javadoc)
97
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getServiceClass()
98
	 */
99
	public Class getServiceClass() {
100
		// TODO Auto-generated method stub
101
		return MapserverWMS.class;
102
	}
103

  
104
	/*
105
	 * (non-Javadoc)
106
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#getServiceRegisterTag()
107
	 */
108
	public String getServiceRegisterTag() {
109
		// TODO Auto-generated method stub
110
		return MapserverWMS.REGISTER_TAG;
111
	}
112

  
113
	/* (non-Javadoc)
114
	 * @see org.gvsig.publish.serversmodel.RemoteResourceTest#testGetXMLEntity()
115
	 */
116
	public void testGetXMLEntity() {
117
		// TODO Auto-generated method stub
118
		super.testGetXMLEntity();
119
		try {
120
			server.setServerURL(new URL ("http://servidor/servicio"));
121
			System.out.println(server.getXMLEntity().toString());
122
		} catch (MalformedURLException e) {
123
			// TODO Auto-generated catch block
124
			e.printStackTrace();
125
		}
126
		
127
	}
128

  
129
}
0 130

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/model/wms/MapserverWMSTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.model.wms;
42

  
43
import org.gvsig.publish.mapserver.model.Mapserver;
44
import org.gvsig.publish.serversmodel.ServiceTest;
45

  
46
public class MapserverWMSTest extends ServiceTest {
47

  
48
	/*
49
	 * (non-Javadoc)
50
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getRemoteResourceClass()
51
	 */
52
	public Class getRemoteResourceClass() {
53
		
54
		return MapserverWMSLayer.class;
55
	}
56

  
57
	/*
58
	 * (non-Javadoc)
59
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getRemoteResourceRegisterTag()
60
	 */
61
	public String getRemoteResourceRegisterTag() {
62
		
63
		return MapserverWMSLayer.REGISTER_TAG;
64
	}
65

  
66
	/*
67
	 * (non-Javadoc)
68
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServerClass()
69
	 */
70
	public Class getServerClass() {
71
		
72
		return Mapserver.class;
73
	}
74

  
75
	/*
76
	 * (non-Javadoc)
77
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServerRegisterTag()
78
	 */
79
	public String getServerRegisterTag() {
80
		
81
		return Mapserver.REGISTER_TAG;
82
	}
83

  
84
	/*
85
	 * (non-Javadoc)
86
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServiceClass()
87
	 */
88
	public Class getServiceClass() {
89
		
90
		return MapserverWMS.class;
91
	}
92

  
93
	/*
94
	 * (non-Javadoc)
95
	 * @see org.gvsig.publish.serversmodel.ServiceTest#getServiceRegisterTag()
96
	 */
97
	public String getServiceRegisterTag() {
98
		
99
		return MapserverWMS.REGISTER_TAG;
100
	}
101

  
102
}
0 103

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/gui/Test_MapserverGUI.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.gui;
42
import java.net.MalformedURLException;
43
import java.net.URL;
44

  
45
import javax.swing.JFrame;
46

  
47
import org.gvsig.publish.PublishRegister;
48
import org.gvsig.publish.exceptions.InvalidRemoteResourceException;
49
import org.gvsig.publish.gui.publish.PublishController;
50
import org.gvsig.publish.mapserver.gui.browser.MSBrowserController;
51
import org.gvsig.publish.mapserver.model.Mapserver;
52
import org.gvsig.publish.mapserver.model.wms.MapserverWMS;
53
import org.gvsig.publish.mapserver.model.wms.MapserverWMSLayer;
54
import org.gvsig.publish.serversmodel.Publication;
55
import org.gvsig.publish.serversmodel.RemoteResource;
56
import org.gvsig.publish.serversmodel.Server;
57
import org.gvsig.publish.serversmodel.Service;
58
/**
59
 * Tests the Mapserver GUI 
60
 * 
61
 * @author jvhigon
62
 *
63
 */
64
public class Test_MapserverGUI{
65
	static public PublishController ctrl = null;
66
	static public Publication publication=null;
67
	static public Server server=null;
68
	static public Service service=null;
69
	static public RemoteResource rr=null;
70
		
71
	public static void main(String[] args) {
72
	    //Schedule a job for the event-dispatching thread:
73
        //creating and showing this application's GUI.		
74
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
75
        		public void run() {
76
				    try {
77
						createModel();
78
					} catch (InvalidRemoteResourceException e) {
79
						// TODO Auto-generated catch block
80
						e.printStackTrace();
81
					}
82
				    createController();
83
				    registerController();
84
				    showGUI();
85
				}
86
      });
87
		
88
    }
89
	
90
    private static void createModel() throws InvalidRemoteResourceException{
91
    	publication = new Publication();
92
    	server = new Mapserver();
93
    	try {
94
			server.setServerURL(new URL("http://localhost/cgi-bin/mapserv"));
95
		} catch (MalformedURLException e) {
96
			e.printStackTrace();
97
		}
98
		publication.setServer(server);
99
		service = new MapserverWMS((Mapserver)server);
100
		server.addService(service);
101
		rr = new MapserverWMSLayer((MapserverWMS)service);		
102
		service.addRemoteResource(rr);		
103
	}
104
    private static  void createController(){
105
    	ctrl = new PublishController();
106
    	ctrl.setPublication(publication);
107
    	
108
    }
109
    private static void registerController(){
110
        //register controller 
111
    	PublishRegister.register().addController(Mapserver.REGISTER_TAG, MSBrowserController.class);
112
    	
113
    }
114
	
115
	private static void showGUI(){
116
        //Create and set up the window.
117
        JFrame frame = new JFrame("Testing Mapserver GUI");
118
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
119
        //Add the publish panel        
120
        frame.getContentPane().add(ctrl.getWindow());
121
        //Display the window.
122
        frame.pack();
123
        frame.setVisible(true);
124
		
125
	}
126

  
127
}
0 128

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src-test/org/gvsig/publish/mapserver/util/MapserverUtilitiesTest.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.util;
42

  
43
import java.io.File;
44

  
45
import junit.framework.TestCase;
46

  
47
public class MapserverUtilitiesTest extends TestCase {
48

  
49
	public void testGetDataPath() {
50
		String shapepath = "/data";
51
		File localPoint = new File("/mnt/simon");
52
		String path1 = "/mnt/simon/mydata/test.shp";
53
		String path2 = "/home/test.shp";
54
		
55
//		DataSourceInfoFactory.getInstance(layer);
56
//		String aux = MapserverUtilities.getDataParameter(ds, shapepath, localMountPoint)(path1, shapepath, localPoint);
57
		System.out.println("Local point:" + localPoint);
58
		System.out.println("Shapepath: " + shapepath);
59
		System.out.println("DATA: " + path1);		
60
		//System.out.println("DATA: " + aux);		
61
	}
62

  
63
}
0 64

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/config/text.properties
1
#mapserver basic
2
publishms_mapserver_url=URL
3
publishms_mapserver_mapfile=Fichero de configuraci?n
4
#mapserver advanced
5
publishms_mapserver_imagepath=Directorio temporal
6
publishms_mapserver_shapepath=Directorio datos
7
publishms_debug=Depuraci?n
8
#preferences page
9
publishms_publish_view=GUI de publicaci?n
10
publishms_change_view_properties=Debe reiniciar la aplicaci?n para que los cambios sean efectivos
11
publishms_restart=Reinicie la aplicaci?n
12
publishms_publish_mapserver=Publicaci?n en Mapserver
13
#mapserver layer
14
publishms_mapserver_layer_properties=Propiedades capa Mapserver
15
publishms_mosaic=Mosaico de im?genes
16
#Model Mapserver
17
publishms_nothing_to_publish=Nada que publicar. A?ada recursos a la publicaci?n.
18
publishms_the_mapfile_is_not_defined=Seleccione un fichero para escribir la configuraci?n.
19
publishms_publish_message=Publicaci?n generada correctamente.\nAseg?rese que las fuentes de datos son accesibles por parte del usuario que ejecuta el CGI de Mapserver.\nCualquier contrase?a aparecer? en los ficheros generados sin encriptar.
20
publishms_no_services_defined=No se ha definido ning?n servicio.
21
publihsms_permission_denied=Imposible generar los ficheros de configuraci?n. Permiso denegado.
22

  
23
#publishms_mapserver_properties=Propiedades Servidor Mapserver
24
#publishms_mapserver_mapname=Nombre del mapa
25
#publishms_name=Nombre 
0 26

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/config/text_en.properties
1
publishms_nothing_to_publish=Nothing to publish. Add a new resource.
2
publishms_the_mapfile_is_not_defined=Select a file to write the configuration.
3
publishms_debug=Debug
4
publishms_mapserver_properties=Mapserver properties
5
publishms_mapserver_mapname=Map name
6
publishms_mapserver_url=URL
7
publishms_mapserver_mapfile=Configuration file
8
publishms_name=Name
9
publishms_mapserver_imagepath=Temp directory
10
publishms_mapserver_shapepath=ShapePath
11
publishms_change_view_message=Restart the application in order to apply changes
12
publishms_restart=Restart application
13
publishms_publish_view=Publication GUI
14
publishms_publish_mapserver=Mapserver publication
15
#mapserver layer properties
16
publishms_mapserver_layer_properties=Mapserver layer properties
17
publishms_mosaic=Image Mosaic
18
#publish message
19
publishms_publish_message=Publication generated successfully.\nData sources must be accessible by the user who executes the Mapserver CGI.\nFurthermore, any password can be read in the mapfile !!
20
publihsms_permission_denied=Cannot generate the configuration files. Permission denied.
0 21

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="com.iver.cit.gvsig" />
4
	<depends plugin-name="org.gvsig.publish" />
5
	<libraries library-dir="."/>
6
	<resourceBundle name="text"/>
7
	<extensions>
8
		<extension class-name="org.gvsig.publish.mapserver.MapserverExtension"
9
			description="MapserverPublish Extension"
10
			active="true"
11
			priority="1">
12
		</extension>		
13
	</extensions>
14
</plugin-config>
0 15

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/config/text_de.properties
1
#mapserver_text_de.properties
2
publishms_change_view_message=Anwendung neustarten, damit die \u00C4nderungen wirksam werden
3
publishms_change_view_properties=Anwendung neustarten, damit die \u00C4nderungen wirksam werden
4
publishms_debug=Fehler beseitigen
5
publishms_mapserver_imagepath=Tempor\u00E4res Verzeichnis
6
publishms_mapserver_layer_properties=Mapserver Layer Eigenschaften
7
publishms_mapserver_mapfile=Konfigurationsdatei
8
publishms_mapserver_mapname=Name der Karte
9
publishms_mapserver_properties=Mapserver Eigenschaften
10
publishms_publish_message=Publikation erfolgreich abgeschlossen.\nDie Originaldateien m\u00FCssen dem Anwender, der die Mapserver CGI aufruft, frei zug\u00E4nglich sein.\nAchtung\: Jedes Passwort kann in den erzeugten Dateien lesbar sein\!\!
11
publishms_mapserver_shapepath=Shape- Pfad
12
publishms_mapserver_url=URL
13
publishms_mosaic=Imagekatalog
14
publishms_name=Name
15
publishms_nothing_to_publish=Nichts zum publizieren. F\u00FCgen sie die entsprechenden Dateien hinzu.
16
publishms_publish_mapserver=Mapserver Publikation
17
publishms_publish_view=GUI Publikation
18
publishms_restart=neu starten
19
publishms_the_mapfile_is_not_defined=Datei ausw\u00E4hlen wohin die Konfigurationsdatei generiert werden soll.
0 20

  
tags/gvsig_redes-1_0_0-1234/extensions/extPublishMapserver/src/org/gvsig/publish/mapserver/util/MapserverUtilities.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 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 Iba?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.publish.mapserver.util;
42

  
43
import org.gvsig.publish.infoproject.IDataSourceInfo;
44
import org.gvsig.publish.infoproject.datasources.IDataBaseInfo;
45
import org.gvsig.publish.infoproject.datasources.IFileInfo;
46
import org.gvsig.publish.infoproject.datasources.IRasterDSInfo;
47

  
48
/**
49
 * Utilities for publishing in Mapserver
50
 * @author jvhigon
51
 *
52
 */
53
public class MapserverUtilities {
54
	/**
55
	 * 
56
	 * @param datasource
57
	 * @return outputformat name in format "extensionfile_datatype". It returns null If imagemode is null   
58
	 */
59
	public static String getOutputformatName(IRasterDSInfo datasource){
60
		IFileInfo file = (IFileInfo)datasource;
61
		//String aux = file.getExtension().toUpperCase() + "_" + datasource.getDataType();
62
		String aux = null;
63
		if (getOutputformatImageMode(datasource) !=null)
64
			aux = file.getExtension().toUpperCase() + "_" + getOutputformatImageMode(datasource);
65
		return aux;
66
	}
67
	/**
68
	 * 
69
	 * @param datasource
70
	 * @return Gets a valid DRIVER value for Mapserver outputformat (GDAL/Gtiff, GDAL/ECW, GDAL/HFA)
71
	 * <p>
72
	 * It can be null if the driver is not Gtiff, ECW or HFA
73
	 * TODO: add other drivers 
74
	 */
75
	public static String getOutputformatDriver(IDataSourceInfo ds){
76
		IFileInfo file = (IFileInfo)ds;		
77
		String extension = file.getExtension().toLowerCase();
78
		if (extension.equals("tif")||extension.equals("tiff")){
79
			return "GDAL/Gtiff";
80
		}
81
		if (extension.equals("ecw")){
82
			return "GDAL/ECW";
83
		}
84
		if (extension.equals("img")){
85
			return "GDAL/HFA";
86
		}
87
		if (extension.equals("jpg") || extension.equals("jpeg")){
88
			return "GD/JPEG";
89
		}
90
		return null;
91
	}
92
	/**
93
	 * 
94
	 * @param datasource
95
	 * @return Gets a valid MIMETYPE value for Mapserver outputformats
96
	 */
97
	public static String getOutputformatMimetype(IDataSourceInfo datasource){
98
		IFileInfo file = (IFileInfo)datasource;		
99
		String aux = file.getExtension().toLowerCase();
100
		aux ="image/" + aux; 
101
		return  aux;
102
	}	
103
	/**
104
	 * @see http://mapserver.org/mapfile/outputformat.html
105
	 * @param datasource
106
	 * @return Gets a valid IMAGEMODE value for Mapserver outputformats. The values can be PC256/RGB/RGBA/INT16/FLOAT32
107
	 * <p>
108
	 * It can be null if the datatype is not supported by mapserver. 
109
	 * We query the first band of the datasource
110
	 * TODO: Review the mapping between raster data type - Mapserver data type 
111
	 */
112
	public static String getOutputformatImageMode(IRasterDSInfo datasource){			
113
		int aux = datasource.getDataType(0);
114
		switch(aux){
115
			case IRasterDSInfo.TYPE_BYTE:
116
				return "BYTE";
117
			case IRasterDSInfo.TYPE_DOUBLE:
118
				return "FLOAT64";
119
			case IRasterDSInfo.TYPE_FLOAT:
120
				return "FLOAT32";
121
			case IRasterDSInfo.TYPE_INT:
122
				return "INT16";
123
			case IRasterDSInfo.TYPE_SHORT:
124
				return "RGB";
125
			case IRasterDSInfo.TYPE_USHORT:
126
				return "PC256";
127
			case IRasterDSInfo.TYPE_UNDEFINED:
128
				return "RGBA";
129
		}
130
		return null;
131
	}
132
	/**
133
	 * 
134
	 * @param datasource
135
	 * @return Gets a valid EXTENSION value for Mapserver outputformats.
136
	 */
137
	public static String getOuputformatExtension(IDataSourceInfo datasource) {
138
		IFileInfo file = (IFileInfo)datasource;		
139
		String aux = file.getExtension().toLowerCase();
140
		return aux;
141
	}
142
	/**
143
	 * Utility for calculating the parameter DATA in the Mapfile. When the data source is a file it calculates
144
	 * the absolute path to the file or the relative path if the shapepath is defined. On the other hand, if the datasource is a 
145
	 * database connection, it calculates the data clause. 
146
	 *  
147
	 * 
148
	 * @param ds data source
149
	 * @param shapepath
150
	 * @param localMountPoint
151
	 * @return the data section in the mapfile. It can be null.
152
	 *
153
	public static String getDataParameter(IDataSourceInfo ds, String shapepath, File localMountPoint){
154
		String res = null;
155
		if (ds.getType() == IDataSourceInfo.SHAPE_TYPE || ds.getType() == IDataSourceInfo.RASTER_TYPE){
156
			String path = ((IFileInfo)ds).getAbsolutePath();
157
			if (shapepath == null){
158
				res = path;
159
			}else{
160
				if (localMountPoint == null){
161
					res = ((IFileInfo)ds).getFileName();
162
				}else{
163
					res = path.substring(localMountPoint.getAbsolutePath().length());
164
					if (res.startsWith(File.separator)){
165
						res = res.substring(1);
166
					}
167
				}
168
			}
169
		}
170
		if (ds.getType() == IDataSourceInfo.POSTGIS_TYPE){
171
			IDataBaseInfo db = (IDataBaseInfo)ds;
172
			String table = db.getTableName();
173
			res = "the_geom from "  + table + " using unique " + db.getGID() + " using srid=" + ds.getSRID();
174
		}
175
		return res;
176
	}
177
	*/
178
	
179
	/**
180
	 * Utility for calculate the CONNECTIONTYPE parameter in the Mapfile. If the datasource is a shapefile or a raster file it will return null
181
	 * @param ds data source 
182
	 * @return "POSTGIS" or null
183
	 */
184
	public static String getConnectionTypeParameter(IDataSourceInfo ds){
185
		String res = null;
186
		if (ds.getType() == IDataSourceInfo.POSTGIS_TYPE){
187
			res = "POSTGIS";
188
		}
189
		return res;
190
	}
191
	/**
192
	 * Utility for calculate the CONNECTION parameter in the Mapfile. If the datasource is a shapefile or a raster file it will return null
193
	 * @param ds data source 
194
	 * @return a string which identifies a connection or null
195
	 */
196
	public static String getConnectionParameter(IDataSourceInfo ds){
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff