Revision 21390
branches/v10/extensions/extPublish/src-test/org/gvsig/publish/infoproject/FilterProjectInfoTest.java | ||
---|---|---|
57 | 57 |
//creates a project info |
58 | 58 |
ProjectInfo proj = new ProjectInfo(gvProj); |
59 | 59 |
FilterProjectInfo filter = new FilterProjectInfo(); |
60 |
filter.setGroupedLayers(false); |
|
60 |
filter.setGroupedLayersEnabled(false);
|
|
61 | 61 |
proj.setFilter(filter); |
62 | 62 |
print(proj); |
63 | 63 |
//check |
branches/v10/extensions/extPublish/src-test/org/gvsig/publish/serversmodel/ServerTest.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.serversmodel; |
|
42 |
|
|
43 |
import java.net.MalformedURLException; |
|
44 |
import java.net.URL; |
|
45 |
|
|
46 |
import junit.framework.TestCase; |
|
47 |
|
|
48 |
import org.gvsig.publish.PublishRegister; |
|
49 |
import org.gvsig.publish.infoproject.ILayerInfo; |
|
50 |
import org.gvsig.publish.infoproject.IProjectInfo; |
|
51 |
import org.gvsig.publish.infoproject.IViewInfo; |
|
52 |
import org.gvsig.publish.infoproject.ProjectInfoFactory; |
|
53 |
import org.gvsig.publish.util.LocalResourcesTestUtilities; |
|
54 |
|
|
55 |
import com.iver.utiles.XMLEntity; |
|
56 |
/** |
|
57 |
* Tests which any server must check. |
|
58 |
* Any service must be tested extending this class. |
|
59 |
* This class test methods that will be called the publish framework. |
|
60 |
* |
|
61 |
* @author jvhigon |
|
62 |
* |
|
63 |
*/ |
|
64 |
public abstract class ServerTest extends TestCase { |
|
65 |
protected Server server = null; |
|
66 |
protected Service service = null; |
|
67 |
|
|
68 |
public abstract String getServiceRegisterTag(); |
|
69 |
public abstract Class getServiceClass(); |
|
70 |
public abstract String getServerRegisterTag(); |
|
71 |
public abstract Class getServerClass(); |
|
72 |
|
|
73 |
public ServerTest() { |
|
74 |
super(); |
|
75 |
//register server |
|
76 |
PublishRegister.register().addServer(getServerRegisterTag(), getServerClass()); |
|
77 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
|
78 |
try { |
|
79 |
server.setServerURL(new URL("http://server")); |
|
80 |
} catch (MalformedURLException e) { |
|
81 |
fail("I can't set the server URL"); |
|
82 |
} |
|
83 |
assertNotNull(server); |
|
84 |
//register service |
|
85 |
PublishRegister.register().addService(getServerRegisterTag(),getServiceRegisterTag(), getServiceClass()); |
|
86 |
service = PublishRegister.register().getService(server, getServiceRegisterTag()); |
|
87 |
assertNotNull(service); |
|
88 |
} |
|
89 |
public void testGetId() { |
|
90 |
assertNotNull(server.getId()); |
|
91 |
} |
|
92 |
|
|
93 |
public void testGetRegisterTag(){ |
|
94 |
assertNotNull(server.getRegisterTag()); |
|
95 |
} |
|
96 |
|
|
97 |
// public void testServer() { |
|
98 |
// fail("Not yet implemented"); |
|
99 |
// } |
|
100 |
|
|
101 |
public void testSetProjectInfo() throws Exception { |
|
102 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
103 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete()); |
|
104 |
server.setProjectInfo(proj); |
|
105 |
} |
|
106 |
|
|
107 |
public void testGetProjectInfo() throws Exception { |
|
108 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
109 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete()); |
|
110 |
server.setProjectInfo(proj); |
|
111 |
assertNotNull(server.getProjectInfo()); |
|
112 |
} |
|
113 |
|
|
114 |
public void testAddInfoIViewInfo() throws Exception { |
|
115 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
116 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete()); |
|
117 |
IViewInfo[] views = proj.getViewsInfo(); |
|
118 |
for (int i = 0; i < views.length; i++ ){ |
|
119 |
server.addInfo(views[i]); |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
public void testAddInfoILayerInfo() throws Exception { |
|
124 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
125 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete()); |
|
126 |
IViewInfo[] views = proj.getViewsInfo(); |
|
127 |
for (int i = 0; i < views.length; i++ ){ |
|
128 |
ILayerInfo[] layers = views[i].getLayers(); |
|
129 |
for (int j = 0; j < layers.length; j++){ |
|
130 |
server.addInfo(layers[j]); |
|
131 |
} |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
public void testGetServiceString() { |
|
136 |
server.addService(service); |
|
137 |
assertEquals(service,server.getService(service.getId())); |
|
138 |
} |
|
139 |
|
|
140 |
public void testAddService(){ |
|
141 |
int c = server.getServicesCount(); |
|
142 |
server.addService(service); |
|
143 |
assertEquals(c + 1, server.getServicesCount()); |
|
144 |
for (int i = 0; i < server.getServicesCount(); i ++){ |
|
145 |
assertNotNull(server.getService(i)); |
|
146 |
} |
|
147 |
} |
|
148 |
|
|
149 |
public void testPublish() throws Exception { |
|
150 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
151 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete()); |
|
152 |
server.setProjectInfo(proj); |
|
153 |
server.publish(); |
|
154 |
} |
|
155 |
|
|
156 |
// public void testPostInitialize() { |
|
157 |
// fail("Not yet implemented"); |
|
158 |
// } |
|
159 |
|
|
160 |
public void testGetServerURL() throws MalformedURLException { |
|
161 |
URL url = new URL("http://server.com/service"); |
|
162 |
server.setServerURL(url); |
|
163 |
assertNotNull(server.getServerURL()); |
|
164 |
} |
|
165 |
|
|
166 |
public void testSetServerURL() throws MalformedURLException { |
|
167 |
URL url = new URL("http://server.com/service"); |
|
168 |
server.setServerURL(url); |
|
169 |
} |
|
170 |
|
|
171 |
public void testGetXMLEntity() throws MalformedURLException { |
|
172 |
URL url = new URL("http://server.com/service"); |
|
173 |
server.setServerURL(url); |
|
174 |
assertNotNull(server.getXMLEntity()); |
|
175 |
} |
|
176 |
|
|
177 |
public void testSetXMLEntity() throws MalformedURLException { |
|
178 |
URL url = new URL("http://server.com/service"); |
|
179 |
server.setServerURL(url); |
|
180 |
XMLEntity xml = server.getXMLEntity(); |
|
181 |
server.setXMLEntity(xml); |
|
182 |
} |
|
183 |
|
|
184 |
public void testRemoveService() { |
|
185 |
int c = server.getServicesCount(); |
|
186 |
server.addService(service); |
|
187 |
server.removeService(service); |
|
188 |
assertEquals(c, server.getServicesCount()); |
|
189 |
} |
|
190 |
|
|
191 |
} |
branches/v10/extensions/extPublish/src-test/org/gvsig/publish/serversmodel/PublicationTest.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.serversmodel; |
|
42 |
|
|
43 |
import junit.framework.TestCase; |
|
44 |
|
|
45 |
import com.iver.utiles.XMLEntity; |
|
46 |
|
|
47 |
public class PublicationTest extends TestCase { |
|
48 |
private static Publication publication = null; |
|
49 |
public PublicationTest(String name) { |
|
50 |
super(name); |
|
51 |
publication = new Publication(); |
|
52 |
} |
|
53 |
|
|
54 |
public void testSetAccessFileMethod(){ |
|
55 |
publication.setAccessFileMethod(publication.REMOTE_MOUNT_POINT_ACCESS); |
|
56 |
publication.setLocalMountPoint("/home/jvhigon/data"); |
|
57 |
publication.setRemoteMountPoint("/data"); |
|
58 |
} |
|
59 |
|
|
60 |
public void testGetXMLEntity(){ |
|
61 |
assertNotNull(publication.getXMLEntity()); |
|
62 |
} |
|
63 |
|
|
64 |
public void testSetXMLEntity(){ |
|
65 |
XMLEntity xml = publication.getXMLEntity(); |
|
66 |
publication.setXMLEntity(xml); |
|
67 |
} |
|
68 |
} |
branches/v10/extensions/extPublish/config/about.htm | ||
---|---|---|
1 | 1 |
<html> |
2 |
|
|
3 |
<body> |
|
4 |
<p> </p> |
|
2 |
<head> |
|
3 |
<title>Publish extension.</title> |
|
4 |
<meta content=""> |
|
5 |
<style></style> |
|
6 |
</head> |
|
7 |
<body> |
|
5 | 8 |
<table width="60%" border="0"> |
6 | 9 |
<tr> |
10 |
|
|
7 | 11 |
<td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td> |
8 | 12 |
<td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td> |
9 | 13 |
</tr> |
10 | 14 |
<tr> |
11 | 15 |
<td colspan="2"><font face="Arial, Helvetica, sans-serif">© Copyright |
12 |
Generalitat Valenciana, IVER T.I and other contributors 2005.</font></td>
|
|
16 |
Generalitat Valenciana, IVER T.I. 2007.</font></td>
|
|
13 | 17 |
</tr> |
14 |
<tr> |
|
15 |
<td colspan="2"> </td> |
|
16 |
</tr> |
|
17 | 18 |
</table> |
18 |
<p> Extensi?n de publicaci?n</p> |
|
19 |
<br> |
|
20 |
<br> |
|
21 |
<p>Build Number:<b>#build.number#</b></p> |
|
19 |
<h3>Extension for publishing datasources on remote servers.</h3> |
|
22 | 20 |
|
23 |
</body> |
|
21 |
<p><br><br><b> Build Number: #build.number#</b></p> |
|
22 |
</body> |
|
24 | 23 |
</html> |
branches/v10/extensions/extPublish/config/text_en.properties | ||
---|---|---|
16 | 16 |
abstract=Abstract |
17 | 17 |
select_server=Select server |
18 | 18 |
new_server=New server |
19 |
error_publishing=Error publishing |
|
19 |
error_publishing=Error publishing |
|
20 |
#properties |
|
21 |
publication_properties=Publication properties |
|
22 |
file_access=File access |
|
23 |
access_local=Local |
|
24 |
access_remote_mount_point=Remote mount point |
|
25 |
remote_filesystem=Remote file system |
|
26 |
local_mount_point=Local directory |
|
27 |
remote_mount_point=Remote directory |
|
28 |
#wizard |
|
29 |
show_advanced=Advanced Options |
|
30 |
next=Next |
|
31 |
prev=Previous |
|
32 |
#remote mount point |
|
33 |
remote_point_point=Remote mount point |
|
34 |
remote_point=Shapepath |
|
35 |
local_point=Local directory |
|
36 |
#service wms |
|
37 |
service_wms111=Service WMS 1.1.1 |
|
38 |
online_resource=Onlineresource |
|
39 |
#layer wms |
|
40 |
layer_wms111=WMS 1.1.1 Layer properties |
|
41 |
is_queryable=Queryable |
branches/v10/extensions/extPublish/config/text.properties | ||
---|---|---|
16 | 16 |
abstract=Resumen |
17 | 17 |
select_server=Selecciona servidor |
18 | 18 |
new_server=Servidor nuevo |
19 |
error_publishing=Error en la publicaci?n |
|
19 |
error_publishing=Error en la publicaci?n |
|
20 |
#properties |
|
21 |
publication_properties=Propiedades de la publicaci?n |
|
22 |
file_access=Acceso a los ficheros |
|
23 |
access_local=Local |
|
24 |
access_remote_mount_point=Punto de montaje remoto |
|
25 |
remote_filesystem=Sistema de ficheros remoto |
|
26 |
local_mount_point=Directorio local |
|
27 |
remote_mount_point=Directorio remoto |
|
28 |
#wizard |
|
29 |
show_advanced=Opciones avanzadas |
|
30 |
next=Siguiente |
|
31 |
prev=Anterior |
|
32 |
#remote mount point |
|
33 |
remote_point_point=Punto de montaje remoto |
|
34 |
remote_point=Directorio remoto |
|
35 |
local_point=Directorio local |
|
36 |
#service wms |
|
37 |
service_wms111=Servicio WMS 1.1.1 |
|
38 |
online_resource=URL del servicio |
|
39 |
#layer wms |
|
40 |
layer_wms111=Propiedades capa WMS 1.1.1 |
|
41 |
is_queryable=Consultable |
branches/v10/extensions/extPublish/build.number | ||
---|---|---|
1 | 1 |
#Build Number for ANT. Do not edit! |
2 |
#Mon Jan 07 09:39:24 GMT+01:00 2008 |
|
3 |
build.number=7 |
|
2 |
#Tue Apr 08 10:31:27 GMT+01:00 2008 |
|
3 |
build.number=8 |
branches/v10/extensions/extPublish/install/install.xml | ||
---|---|---|
1 | 1 |
<installation version="1.0"> |
2 | 2 |
<info> |
3 | 3 |
<appname>gvSIG_extPublish</appname> |
4 |
<appversion>0.1</appversion>
|
|
4 |
<appversion>1.0</appversion>
|
|
5 | 5 |
<authors> |
6 | 6 |
<author name="Generalitat Valenciana. Conselleria d'Infraestructures i Transport" email="" /> |
7 | 7 |
<author name="Iver Tecnologías de la Información S.A." email="" /> |
... | ... | |
79 | 79 |
<!-- <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/" src="../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.graph-fmap-gvsig.jar" override="true"/>--> |
80 | 80 |
</pack> |
81 | 81 |
|
82 |
<pack name="Plugin Publish Geoserver" required="yes"> |
|
83 |
<description>Plugin Publish Geoserver</description> |
|
84 |
<file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/" src="extensiones/org.gvsig.publish.geoserver" override="true"/> |
|
85 |
<!-- <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/" src="../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.graph-fmap-gvsig.jar" override="true"/>--> |
|
86 |
</pack> |
|
87 |
|
|
82 | 88 |
</packs> |
83 | 89 |
|
84 | 90 |
</installation> |
branches/v10/extensions/extPublish/install/distribucion.properties | ||
---|---|---|
1 | 1 |
MAIN_INSTALL_PLUGIN=org.gvsig.publish |
2 | 2 |
|
3 |
EXTENSIONS=${MAIN_INSTALL_PLUGIN},org.gvsig.publish.mapserver |
|
3 |
EXTENSIONS=${MAIN_INSTALL_PLUGIN},org.gvsig.publish.mapserver,org.gvsig.publish.geoserver
|
|
4 | 4 |
version=1.0 |
5 | 5 |
bversion=01 |
6 | 6 |
APPNAME=gvSIG_ext_publish |
branches/v10/extensions/extPublish/src/org/gvsig/publish/ogcmetadata/OGCServiceMetadata.java | ||
---|---|---|
46 | 46 |
import org.gvsig.publish.IPublishPersistence; |
47 | 47 |
import org.gvsig.publish.PublishLogger; |
48 | 48 |
|
49 |
import com.iver.utiles.NotExistInXMLEntity; |
|
50 | 49 |
import com.iver.utiles.XMLEntity; |
51 | 50 |
|
52 | 51 |
/** |
... | ... | |
79 | 78 |
return; |
80 | 79 |
} |
81 | 80 |
//set properties |
82 |
try{ |
|
83 |
String onlineresource = xml.getStringProperty("onlineresource"); |
|
84 |
URL url=null; |
|
85 |
URL aux=null; |
|
81 |
// try{ |
|
82 |
// String onlineresource = xml.getStringProperty("onlineresource"); |
|
83 |
// URL url=null; |
|
84 |
// URL aux=null; |
|
85 |
// try { |
|
86 |
// url = new URL(onlineresource); |
|
87 |
// //auxiliary well formed url |
|
88 |
// aux = new URL("http://"); |
|
89 |
// } catch (MalformedURLException e1) { |
|
90 |
// PublishLogger.getLog().error("ERROR: ServiceWMS111: malformed url setting the onlineresource from persistence"); |
|
91 |
// setOnlineResource(aux); |
|
92 |
// } |
|
93 |
// setOnlineResource(url); |
|
94 |
// }catch(NotExistInXMLEntity e){ |
|
95 |
// PublishLogger.getLog().warn("WARNING:" + getClassName() + ": missing onlineresource in persistence", e); |
|
96 |
// } |
|
97 |
String online = xml.getStringProperty("onlineresource"); |
|
98 |
if (onlineresource != null){ |
|
99 |
URL url = null; |
|
86 | 100 |
try { |
87 |
url = new URL(onlineresource); |
|
88 |
//auxiliary well formed url |
|
89 |
aux = new URL("http://"); |
|
90 |
} catch (MalformedURLException e1) { |
|
91 |
PublishLogger.getLog().error("ERROR: ServiceWMS111: malformed url setting the onlineresource from persistence"); |
|
92 |
setOnlineResource(aux); |
|
101 |
url = new URL(online); |
|
102 |
setOnlineResource(url); |
|
103 |
} catch (MalformedURLException e) { |
|
104 |
PublishLogger.getLog().error("WARNING " + getClassName() + " :malformed url setting the onlineresource from persistence"); |
|
105 |
setOnlineResource(null); |
|
93 | 106 |
} |
94 |
setOnlineResource(url); |
|
95 |
}catch(NotExistInXMLEntity e){ |
|
96 |
PublishLogger.getLog().warn("WARNING:" + getClassName() + ": missing onlineresource in persistence", e); |
|
97 | 107 |
} |
98 | 108 |
//set associations |
99 | 109 |
common.setXMLEntity(xml.getChild(0)); |
... | ... | |
113 | 123 |
//put properties |
114 | 124 |
if (getOnlineResource() != null){ |
115 | 125 |
xml.putProperty("onlineresource", getOnlineResource().toString()); |
126 |
}else{ |
|
127 |
xml.putProperty("onlineresource",null); |
|
116 | 128 |
} |
117 | 129 |
//put associations |
118 | 130 |
xml.addChild(common.getXMLEntity()); |
branches/v10/extensions/extPublish/src/org/gvsig/publish/serversmodel/Service.java | ||
---|---|---|
46 | 46 |
import java.util.Set; |
47 | 47 |
|
48 | 48 |
import org.gvsig.publish.IPublishPersistence; |
49 |
import org.gvsig.publish.PublishLogger; |
|
49 | 50 |
import org.gvsig.publish.PublishRegister; |
50 | 51 |
import org.gvsig.publish.infoproject.FilterProjectInfo; |
51 | 52 |
import org.gvsig.publish.infoproject.ILayerInfo; |
... | ... | |
190 | 191 |
Set set = PublishRegister.register().getRemoteResourcesNames(getServer().getRegisterTag(),getRegisterTag()); |
191 | 192 |
//if no remote resources registered return |
192 | 193 |
if (set ==null){ |
194 |
PublishLogger.getLog().error("ERROR " + getClassName() + ":I can't add Info"); |
|
193 | 195 |
return; |
194 | 196 |
} |
195 | 197 |
//At the moment only one remote resource by service |
branches/v10/extensions/extPublish/src/org/gvsig/publish/serversmodel/RemoteResource.java | ||
---|---|---|
225 | 225 |
XMLEntity children = xml.firstChild("name", "children"); |
226 | 226 |
for (int i=0; i<children.getChildrenCount(); i++){ |
227 | 227 |
XMLEntity child = children.getChild(i); |
228 |
RemoteResource r = PublishRegister.register().getRemoteResource(getService(), child.getName());
|
|
228 |
RemoteResource r = PublishRegister.register().getRemoteResource(getService(), child.getStringProperty("registertag"));
|
|
229 | 229 |
if (r == null){ |
230 | 230 |
PublishLogger.getLog().error("ERROR RemoteResource: I can't create a child from persistence"); |
231 | 231 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/serversmodel/Server.java | ||
---|---|---|
60 | 60 |
|
61 | 61 |
import com.iver.utiles.XMLEntity; |
62 | 62 |
|
63 |
|
|
63 |
/** |
|
64 |
* Represents a server which implements services |
|
65 |
* |
|
66 |
* @author jvhigon |
|
67 |
* |
|
68 |
*/ |
|
64 | 69 |
public abstract class Server extends Observable implements IPublishPersistence { |
65 | 70 |
|
71 |
//Association to the publication |
|
72 |
private Publication publication = null; |
|
73 |
|
|
66 | 74 |
private URL serverURL = null; |
67 | 75 |
/* |
68 | 76 |
* HashMap with its Services |
... | ... | |
176 | 184 |
public Service getService(int position){ |
177 | 185 |
Collection collection = services.values(); |
178 | 186 |
Object[] objects = collection.toArray(); |
179 |
return (Service) objects[position]; |
|
187 |
if (objects.length == 0 ){ |
|
188 |
return null; |
|
189 |
}else{ |
|
190 |
return (Service) objects[position]; |
|
191 |
} |
|
180 | 192 |
} |
181 | 193 |
/** |
182 | 194 |
* |
... | ... | |
291 | 303 |
public void removeService(Service service) { |
292 | 304 |
services.remove(service.getId()); |
293 | 305 |
|
306 |
} |
|
307 |
/** |
|
308 |
* @return the publication related to the server |
|
309 |
*/ |
|
310 |
public Publication getPublication() { |
|
311 |
return publication; |
|
312 |
} |
|
313 |
/** |
|
314 |
* @param publication, the publication related to the server |
|
315 |
*/ |
|
316 |
public void setPublication(Publication publication) { |
|
317 |
this.publication = publication; |
|
294 | 318 |
} |
295 | 319 |
|
296 | 320 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/serversmodel/Publication.java | ||
---|---|---|
46 | 46 |
import org.gvsig.publish.IPublishPersistence; |
47 | 47 |
import org.gvsig.publish.PublishLogger; |
48 | 48 |
import org.gvsig.publish.PublishRegister; |
49 |
import org.gvsig.publish.infoproject.IDataSourceInfo; |
|
49 | 50 |
import org.gvsig.publish.infoproject.IProjectInfo; |
51 |
import org.gvsig.publish.infoproject.datasources.IFileInfo; |
|
50 | 52 |
|
51 | 53 |
import com.iver.utiles.XMLEntity; |
54 |
/** |
|
55 |
* Represents a publication, that is, a project information that can be accessible through a server |
|
56 |
* |
|
57 |
* @author jvhigon |
|
58 |
* |
|
59 |
*/ |
|
60 |
public class Publication extends Observable implements IPublishPersistence, Observer { |
|
61 |
//Access methods |
|
62 |
public final int LOCAL_ACCESS=0; |
|
63 |
public final int REMOTE_MOUNT_POINT_ACCESS=1; |
|
52 | 64 |
|
53 |
public class Publication extends Observable implements IPublishPersistence, Observer { |
|
54 |
|
|
55 | 65 |
/* |
56 | 66 |
* Associations |
57 | 67 |
*/ |
... | ... | |
59 | 69 |
private IProjectInfo iproject = null; |
60 | 70 |
/* |
61 | 71 |
* Properties |
62 |
*/ |
|
72 |
*/
|
|
63 | 73 |
private String title = null; |
74 |
private int accessFileMethod = LOCAL_ACCESS; |
|
75 |
private String localMountPoint; |
|
76 |
private String remoteMountPoint; |
|
77 |
|
|
64 | 78 |
/** |
65 | 79 |
* Sets the name of the publication |
66 | 80 |
* @param name |
... | ... | |
87 | 101 |
if (server == null){ |
88 | 102 |
s.addObserver(this); |
89 | 103 |
} |
90 |
|
|
104 |
//set associations |
|
105 |
s.setPublication(this); |
|
91 | 106 |
//init variables |
92 | 107 |
this.server = s; |
93 | 108 |
this.server.setProjectInfo(getProjectInfo()); |
94 |
|
|
109 |
|
|
95 | 110 |
//notify publication observers |
96 | 111 |
setChanged(); |
97 | 112 |
notifyObservers(); |
... | ... | |
109 | 124 |
public String toString(){ |
110 | 125 |
return getTitle(); |
111 | 126 |
} |
112 |
|
|
113 |
|
|
127 |
|
|
128 |
/** |
|
129 |
* Sets the information about the project to publish |
|
130 |
* @param projectInfo |
|
131 |
*/ |
|
114 | 132 |
public void setProjectInfo(IProjectInfo projectInfo) { |
115 | 133 |
iproject = projectInfo; |
116 | 134 |
} |
135 |
/** |
|
136 |
* |
|
137 |
* @return information about the project resources to publish |
|
138 |
*/ |
|
117 | 139 |
public IProjectInfo getProjectInfo() { |
118 |
|
|
119 | 140 |
return iproject; |
120 | 141 |
} |
142 |
/* |
|
143 |
* (non-Javadoc) |
|
144 |
* @see java.util.Observer#update(java.util.Observable, java.lang.Object) |
|
145 |
*/ |
|
121 | 146 |
public void update(Observable o, Object arg) { |
122 | 147 |
if (o instanceof Server){ |
123 | 148 |
setServer((Server)o); |
124 | 149 |
}else{ |
125 | 150 |
PublishLogger.getLog().error("ERROR Publication: The observable object must be a server"); |
126 | 151 |
} |
127 |
|
|
152 |
|
|
128 | 153 |
} |
129 |
/** |
|
130 |
* Classid for persitence |
|
154 |
|
|
155 |
/* |
|
156 |
* (non-Javadoc) |
|
157 |
* @see com.iver.utiles.IPersistance#getXMLEntity() |
|
131 | 158 |
*/ |
132 |
public static final String CLASSID_VALUE ="Publication"; |
|
133 |
/** |
|
134 |
* TODO: docu |
|
135 |
*/ |
|
136 | 159 |
public XMLEntity getXMLEntity() { |
137 | 160 |
XMLEntity xml=new XMLEntity(); |
138 | 161 |
//put version and name |
... | ... | |
140 | 163 |
xml.putProperty("version", getVersion()); |
141 | 164 |
//put properties |
142 | 165 |
xml.putProperty("title", getTitle()); |
143 |
//TODO: check if getserver() is null |
|
144 |
xml.addChild(getServer().getXMLEntity()); |
|
166 |
xml.putProperty("accessfilemethod", getAccessFileMethod()); |
|
167 |
xml.putProperty("localmountpoint", getLocalMountPoint()); |
|
168 |
xml.putProperty("remotemountpoint", getRemoteMountPoint()); |
|
169 |
|
|
170 |
if (getServer() != null){ |
|
171 |
xml.addChild(getServer().getXMLEntity()); |
|
172 |
} |
|
145 | 173 |
return xml; |
146 | 174 |
} |
147 |
/**
|
|
148 |
* TODO: Only gets the first server!!
|
|
149 |
* @param xml
|
|
175 |
/* |
|
176 |
* (non-Javadoc)
|
|
177 |
* @see com.iver.utiles.IPersistance#setXMLEntity(com.iver.utiles.XMLEntity)
|
|
150 | 178 |
*/ |
151 | 179 |
public void setXMLEntity(XMLEntity xml) { |
152 | 180 |
//check version |
... | ... | |
154 | 182 |
if (version != getVersion()){ |
155 | 183 |
PublishLogger.getLog().error("ERROR: " + getVersion() + ": the version doesn't match!"); |
156 | 184 |
return; |
157 |
} |
|
158 |
//creates only the first server |
|
159 |
XMLEntity xmlChild=xml.getChild(0); |
|
160 |
String server_type = xmlChild.getStringProperty("registertag"); |
|
161 |
Server s = PublishRegister.register().getServer(server_type); |
|
162 |
if (s==null){ |
|
163 |
PublishLogger.getLog().error("ERROR " + getVersion()+ ": I can't create the server from persistence"); |
|
164 |
}else{ |
|
165 |
s.setProjectInfo(iproject); |
|
166 |
s.setXMLEntity(xmlChild); |
|
167 |
setServer(s); |
|
168 |
} |
|
185 |
} |
|
186 |
//set properties |
|
187 |
setAccessFileMethod(xml.getIntProperty("accessfilemethod")); |
|
188 |
setLocalMountPoint(xml.getStringProperty("localmountpoint")); |
|
189 |
setRemoteMountPoint(xml.getStringProperty("remotemountpoint")); |
|
190 |
//creates only the first server if exists |
|
191 |
if (xml.getChildrenCount() > 0){ |
|
192 |
XMLEntity xmlChild=xml.getChild(0); |
|
193 |
String server_type = xmlChild.getStringProperty("registertag"); |
|
194 |
Server s = PublishRegister.register().getServer(server_type); |
|
195 |
if (s==null){ |
|
196 |
PublishLogger.getLog().error("ERROR " + getVersion()+ ": I can't create the server from persistence"); |
|
197 |
}else{ |
|
198 |
s.setProjectInfo(iproject); |
|
199 |
s.setXMLEntity(xmlChild); |
|
200 |
setServer(s); |
|
201 |
} |
|
202 |
} |
|
203 |
|
|
169 | 204 |
} |
170 | 205 |
/* |
171 | 206 |
* (non-Javadoc) |
172 | 207 |
* @see com.iver.utiles.IPersistance#getClassName() |
173 | 208 |
*/ |
174 | 209 |
public String getClassName() { |
175 |
return "Publication"; |
|
210 |
return "Publication_v1";
|
|
176 | 211 |
} |
177 | 212 |
/* |
178 | 213 |
* (non-Javadoc) |
179 | 214 |
* @see org.gvsig.publish.IPublishPersistence#getVersion() |
180 | 215 |
*/ |
181 | 216 |
public int getVersion() { |
182 |
|
|
183 | 217 |
return 1; |
184 | 218 |
} |
219 |
/** |
|
220 |
* Gets the method in which the publication has been set. |
|
221 |
* It can be Publication.LOCAL_ACCESS or Publication.REMOTE_MOUNT_POINT_ACCESS <p> |
|
222 |
* LOCAL_ACCESS: the files to publish are located in the local filesystem. <br> |
|
223 |
* REMOTE_MOUNT_POINT_ACCESS: the files are located in remote filesystem but are accessible through a remote mount point |
|
224 |
* |
|
225 |
* @return the accessFileMethod |
|
226 |
*/ |
|
227 |
public int getAccessFileMethod() { |
|
228 |
return accessFileMethod; |
|
229 |
} |
|
230 |
/** |
|
231 |
* Sets the method in which the files are been accessed. It can be Publication.LOCAL_ACCESS or Publication.REMOTE_MOUNT_POINT_ACCESS. |
|
232 |
* LOCAL_ACCESS: the files to publish are located in the local filesystem. <br> |
|
233 |
* REMOTE_MOUNT_POINT_ACCESS: the files are located in remote filesystem but are accessible through a remote mount point |
|
234 |
* @param accessFileMethod the accessFileMethod to set |
|
235 |
*/ |
|
236 |
public void setAccessFileMethod(int accessFileMethod) { |
|
237 |
this.accessFileMethod = accessFileMethod; |
|
238 |
// if (accessFileMethod == LOCAL_ACCESS){ |
|
239 |
// setLocalMountPoint(null); |
|
240 |
// setRemoteMountPoint(null); |
|
241 |
// } |
|
242 |
setChanged(); |
|
243 |
} |
|
244 |
|
|
245 |
/** |
|
246 |
* If the publication uses a REMOTE_MOUNT_POINT_ACCESS, this method change the path to a file in order |
|
247 |
* to be accessible by a server. |
|
248 |
* |
|
249 |
* @return |
|
250 |
*/ |
|
251 |
public String getServerSideFilePath(IDataSourceInfo ds){ |
|
252 |
if (getAccessFileMethod() == REMOTE_MOUNT_POINT_ACCESS){ |
|
253 |
String aux = ((IFileInfo)ds).getAbsolutePath(); |
|
254 |
return aux.replace(localMountPoint, remoteMountPoint); |
|
255 |
}else{ |
|
256 |
return ((IFileInfo)ds).getAbsolutePath(); |
|
257 |
} |
|
258 |
} |
|
259 |
/** |
|
260 |
* @param localMountPoint the localMountPoint to set |
|
261 |
*/ |
|
262 |
public void setLocalMountPoint(String localMountPoint) { |
|
263 |
this.localMountPoint = localMountPoint; |
|
264 |
setChanged(); |
|
265 |
} |
|
266 |
/** |
|
267 |
* @param remoteMountPoint the remoteMountPoint to set |
|
268 |
*/ |
|
269 |
public void setRemoteMountPoint(String remoteMountPoint) { |
|
270 |
this.remoteMountPoint = remoteMountPoint; |
|
271 |
setChanged(); |
|
272 |
} |
|
273 |
/** |
|
274 |
* @return the localMountPoint |
|
275 |
*/ |
|
276 |
public String getLocalMountPoint() { |
|
277 |
return localMountPoint; |
|
278 |
} |
|
279 |
/** |
|
280 |
* @return the remoteMountPoint |
|
281 |
*/ |
|
282 |
public String getRemoteMountPoint() { |
|
283 |
return remoteMountPoint; |
|
284 |
} |
|
185 | 285 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/ProjectPublication.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.publish; |
42 | 42 |
|
43 |
import org.gvsig.publish.gui.properties.PublicationPropertiesController; |
|
43 | 44 |
import org.gvsig.publish.gui.publish.PublishController; |
44 | 45 |
import org.gvsig.publish.gui.selectServer.SelectServerController; |
45 | 46 |
import org.gvsig.publish.infoproject.IProjectInfo; |
... | ... | |
70 | 71 |
private PublishController publishCtrl = null; |
71 | 72 |
//private AddResourceController addResourceCtrl = null; |
72 | 73 |
private SelectServerController slcSrvCtrl = null; |
74 |
private PublicationPropertiesController ppc = null; |
|
73 | 75 |
|
74 | 76 |
/** |
75 |
* Creates all the controllers and sets the relations |
|
77 |
* Creates all the controllers and sets the relations. |
|
78 |
* It's invoked when a new publication is created (new button) |
|
76 | 79 |
* @see ProjectDocument#setProject(Project, int) |
77 | 80 |
*/ |
78 | 81 |
public void setProject(Project project, int index) { |
... | ... | |
95 | 98 |
//addResourceCtrl.setPublication(publication); |
96 | 99 |
publishCtrl.setPublication(publication); |
97 | 100 |
slcSrvCtrl.setPublication(publication); |
101 |
|
|
102 |
ppc = new PublicationPropertiesController(getPublication()); |
|
98 | 103 |
|
99 | 104 |
} |
100 | 105 |
/** |
... | ... | |
118 | 123 |
* |
119 | 124 |
* @return the publication of the document |
120 | 125 |
*/ |
121 |
public Publication getPublication(){
|
|
122 |
return publication; |
|
126 |
private Publication getPublication(){
|
|
127 |
return publication;
|
|
123 | 128 |
} |
124 | 129 |
|
125 | 130 |
/** |
... | ... | |
132 | 137 |
//public AddResourceController getAddResourceController(){ |
133 | 138 |
// return addResourceCtrl; |
134 | 139 |
//} |
140 |
|
|
135 | 141 |
/** |
136 |
* When you add a publication you must select a server |
|
137 | 142 |
* @see ProjectDocument#afterAdd() |
138 | 143 |
*/ |
139 | 144 |
public void afterAdd() { |
... | ... | |
173 | 178 |
tableRoot.addChild(this.getXMLEntity()); |
174 | 179 |
} |
175 | 180 |
/** |
181 |
* This method is invoked when the properties button is pressed |
|
176 | 182 |
* |
177 | 183 |
* @return |
178 | 184 |
* @see {@link ProjectDocument#getProperties()} |
179 | 185 |
*/ |
180 |
public IWindow getProperties() { |
|
181 |
|
|
182 |
return createWindow(); |
|
186 |
public IWindow getProperties() { |
|
187 |
return ppc.getWindow(); |
|
183 | 188 |
} |
184 | 189 |
/** |
185 | 190 |
* |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/IDataSourceInfo.java | ||
---|---|---|
67 | 67 |
*/ |
68 | 68 |
abstract String getEPSG(); |
69 | 69 |
/** |
70 |
* Gets the system reference identifier of the layer. |
|
71 |
* @return integer which identifies the layer's CRS. |
|
72 |
* If the layer is a group of layers, it will return -1 |
|
73 |
*/ |
|
74 |
abstract int getSRID(); |
|
75 |
/** |
|
70 | 76 |
* |
71 | 77 |
* @return data type, for vectorial LINE, POINT, POLYGON, MULTI, ... |
72 | 78 |
* <p> |
... | ... | |
86 | 92 |
*/ |
87 | 93 |
abstract Rectangle2D getLatLonBBox(); |
88 | 94 |
/** |
89 |
* @return data source type (SHAPE, POSTGIS, ECW) |
|
95 |
* @return data source type (SHAPE, POSTGIS, RASTER, ..) |
|
96 |
* |
|
90 | 97 |
*/ |
91 | 98 |
abstract String getType(); |
92 | 99 |
/** |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/ViewInfo.java | ||
---|---|---|
44 | 44 |
package org.gvsig.publish.infoproject; |
45 | 45 |
|
46 | 46 |
import java.awt.geom.Rectangle2D; |
47 |
import java.util.ArrayList; |
|
48 | 47 |
|
49 | 48 |
import com.iver.andami.PluginServices; |
50 | 49 |
import com.iver.cit.gvsig.fmap.DriverException; |
51 | 50 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
52 | 51 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
53 |
import com.iver.cit.gvsig.fmap.layers.LayersIterator; |
|
54 | 52 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
55 | 53 |
|
56 | 54 |
|
57 |
|
|
58 | 55 |
/** |
59 | 56 |
* This class represents the information about a gvSIG view |
60 | 57 |
* |
... | ... | |
66 | 63 |
*/ |
67 | 64 |
public class ViewInfo implements IViewInfo { |
68 | 65 |
private ProjectView view = null; |
69 |
private ILayerInfo[] layers = null;
|
|
66 |
private LayerInfo[] layers = null; |
|
70 | 67 |
private IProjectInfo iproject = null; |
68 |
private FilterProjectInfo filter = null; |
|
71 | 69 |
/** |
72 | 70 |
* Default Constructor |
71 |
* |
|
73 | 72 |
*/ |
74 | 73 |
public ViewInfo(ProjectView view, IProjectInfo projectInfo){ |
75 | 74 |
this.iproject = projectInfo; |
... | ... | |
81 | 80 |
LayerInfo lyrinf = new LayerInfo(lyr,view, this, null); |
82 | 81 |
this.layers[i] = lyrinf; |
83 | 82 |
} |
83 |
|
|
84 | 84 |
} |
85 | 85 |
/** |
86 | 86 |
* Constructor with filter |
... | ... | |
90 | 90 |
*/ |
91 | 91 |
public ViewInfo(ProjectView v, ProjectInfo projectInfo, |
92 | 92 |
FilterProjectInfo filter) { |
93 |
this(v,projectInfo); |
|
94 |
if (filter != null){ |
|
95 |
//check filter |
|
96 |
if (filter.isGroupedLayers()==false){ |
|
97 |
LayersIterator it = new LayersIterator(this.view.getMapContext().getLayers()); |
|
98 |
ArrayList aux = new ArrayList(); |
|
99 |
while (it.hasNext()){ |
|
100 |
FLayer l = it.nextLayer(); |
|
101 |
if (l instanceof FLayers == false){ |
|
102 |
aux.add(l); |
|
103 |
//System.err.println("Layer " + l.getName()); |
|
104 |
} |
|
105 |
} |
|
106 |
this.layers = new LayerInfo[aux.size()]; |
|
107 |
for (int i=0; i < aux.size(); i++){ |
|
108 |
FLayer lyr = (FLayer) aux.get(i); |
|
109 |
LayerInfo lyrinf = new LayerInfo(lyr,view, this, null); |
|
110 |
this.layers[i] = lyrinf; |
|
111 |
} |
|
112 |
} |
|
113 |
} |
|
93 |
this(v,projectInfo); |
|
94 |
this.filter = filter; |
|
114 | 95 |
} |
115 | 96 |
/** |
116 | 97 |
* @see ViewInf.getComment() |
117 | 98 |
*/ |
118 | 99 |
public String getComment() { |
119 |
|
|
100 |
|
|
120 | 101 |
return this.view.getComment(); |
121 | 102 |
} |
122 | 103 |
/** |
123 | 104 |
* @see ViewInf.getCreationDate() |
124 | 105 |
*/ |
125 | 106 |
public String getCreationDate() { |
126 |
|
|
107 |
|
|
127 | 108 |
return this.view.getCreationDate(); |
128 | 109 |
} |
129 | 110 |
/** |
... | ... | |
137 | 118 |
PluginServices.getLogger().error("Can't get View MaX", e); |
138 | 119 |
} |
139 | 120 |
return aux; |
140 |
/*String aux = null; |
|
141 |
try { |
|
142 |
aux = Double.toString(this.view.getMapContext().getFullExtent().getMaxX()); |
|
143 |
} catch (DriverException e) { |
|
144 |
PluginServices.getLogger().error("Can't get View MaX", e); |
|
145 |
} |
|
146 |
return aux; |
|
147 |
*/ |
|
148 | 121 |
} |
149 | 122 |
/** |
150 | 123 |
* @see ViewInf.getMaxY() |
... | ... | |
193 | 166 |
* @see ViewInf.getOwner() |
194 | 167 |
*/ |
195 | 168 |
public String getOwner() { |
196 |
|
|
169 |
|
|
197 | 170 |
return this.view.getOwner(); |
198 | 171 |
} |
199 | 172 |
/** |
200 | 173 |
* @see ViewInf.getSRS() |
201 | 174 |
*/ |
202 | 175 |
public String getEPSG() { |
203 |
|
|
176 |
|
|
204 | 177 |
return this.view.getMapContext().getProjection().getAbrev(); |
205 | 178 |
} |
206 | 179 |
/** |
207 | 180 |
* @see ViewInfo.IgetLayers() |
208 | 181 |
*/ |
209 |
public ILayerInfo[] getLayers() { |
|
210 |
/*FLayers layers = this.view.getMapContext().getLayers(); |
|
211 |
LayerInfo[] res = new LayerInfo[layers.getLayersCount()]; |
|
212 |
for (int i=0; i < layers.getLayersCount(); i++){ |
|
213 |
FLayer lyr = layers.getLayer(i); |
|
214 |
LayerInfo lyrinf = new DefaultLayerInfo(lyr); |
|
215 |
res[i] = lyrinf; |
|
216 |
} |
|
217 |
return res;*/ |
|
218 |
return this.layers; |
|
182 |
public ILayerInfo[] getLayers() { |
|
183 |
return ProcessFilterProjectInfo.processor().process(filter, this.layers); |
|
219 | 184 |
} |
220 | 185 |
public String toString(){ |
221 | 186 |
return getName(); |
... | ... | |
243 | 208 |
} |
244 | 209 |
return aux; |
245 | 210 |
} |
246 |
|
|
211 |
|
|
247 | 212 |
public IProjectInfo getProjectInfo() { |
248 |
|
|
213 |
|
|
249 | 214 |
return iproject; |
250 | 215 |
} |
251 |
|
|
216 |
|
|
252 | 217 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/ProcessFilterProjectInfo.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.infoproject; |
|
42 |
|
|
43 |
import java.util.ArrayList; |
|
44 |
/** |
|
45 |
* gvSIG objects filter processor. |
|
46 |
* <p> |
|
47 |
* Pattern used: singleton |
|
48 |
* |
|
49 |
* @author jvhigon |
|
50 |
* |
|
51 |
*/ |
|
52 |
public class ProcessFilterProjectInfo { |
|
53 |
private static ProcessFilterProjectInfo instance = null; |
|
54 |
|
|
55 |
public static ProcessFilterProjectInfo processor(){ |
|
56 |
if (instance == null){ |
|
57 |
instance = new ProcessFilterProjectInfo(); |
|
58 |
} |
|
59 |
return instance; |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Process a filter in this array of LayerInfo. |
|
64 |
* 1st filter groups. |
|
65 |
* 2nd filter data sources allowed. |
|
66 |
* @param filter |
|
67 |
* @param layer |
|
68 |
* @return the LayerInfo processed |
|
69 |
*/ |
|
70 |
public ILayerInfo[] process(FilterProjectInfo filter, ILayerInfo[] layers){ |
|
71 |
if (filter == null){ |
|
72 |
return layers; |
|
73 |
} |
|
74 |
ILayerInfo[] res = (ILayerInfo[])layers; |
|
75 |
if (filter.isGroupedLayersEnabled()==false){ |
|
76 |
res = filterGroups(layers); |
|
77 |
} |
|
78 |
res = filterDatasources(res,filter); |
|
79 |
|
|
80 |
return res; |
|
81 |
} |
|
82 |
/** |
|
83 |
* Convert a tree of LayerInfos in a list of them. Grouped layers are deleted. |
|
84 |
* @param layers |
|
85 |
* @return |
|
86 |
*/ |
|
87 |
private ILayerInfo[] filterGroups(ILayerInfo[] layers){ |
|
88 |
ArrayList list = new ArrayList(); |
|
89 |
for (int i = 0; i < layers.length; i++){ |
|
90 |
ILayerInfo[] childs = layers[i].getChilds(); |
|
91 |
if (childs == null){ |
|
92 |
list.add(layers[i]); |
|
93 |
}else{ |
|
94 |
ILayerInfo[] aux2 = filterGroups(childs); |
|
95 |
for (int j=0; j< aux2.length; j++){ |
|
96 |
list.add(aux2[j]); |
|
97 |
} |
|
98 |
} |
|
99 |
} |
|
100 |
ILayerInfo[] res = new ILayerInfo[list.size()]; |
|
101 |
for (int k = 0; k < list.size(); k++){ |
|
102 |
res[k] = (ILayerInfo)list.get(k); |
|
103 |
} |
|
104 |
return res; |
|
105 |
} |
|
106 |
/** |
|
107 |
* Delete the layers which datasource is not allowed. |
|
108 |
* @param layers |
|
109 |
* @param filter |
|
110 |
* @return |
|
111 |
*/ |
|
112 |
private ILayerInfo[] filterDatasources(ILayerInfo[] layers, FilterProjectInfo filter) { |
|
113 |
ArrayList list = new ArrayList(); |
|
114 |
for(int i = 0; i < layers.length; i++){ |
|
115 |
if (layers[i].getChilds() == null){ //is not a group |
|
116 |
if (filter.isAllowedDatasource(layers[i].getDataSource())){ |
|
117 |
list.add(layers[i]); |
|
118 |
} |
|
119 |
}else{ |
|
120 |
ILayerInfo[] aux = filterDatasources(layers[i].getChilds(),filter); |
|
121 |
if (aux.length !=0){ |
|
122 |
layers[i].setChilds(aux); |
|
123 |
list.add(layers[i]); |
|
124 |
} |
|
125 |
} |
|
126 |
} |
|
127 |
ILayerInfo[] res = new ILayerInfo[list.size()]; |
|
128 |
for (int k = 0; k < list.size(); k++){ |
|
129 |
res[k] = (ILayerInfo)list.get(k); |
|
130 |
} |
|
131 |
return res; |
|
132 |
} |
|
133 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/FilterProjectInfo.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.publish.infoproject; |
42 | 42 |
|
43 |
import java.util.ArrayList; |
|
44 |
import java.util.HashSet; |
|
45 |
import java.util.Iterator; |
|
46 |
import java.util.Set; |
|
43 | 47 |
|
48 |
|
|
44 | 49 |
/** |
45 | 50 |
* This class define a filter in the project information. You can filter layers with |
46 | 51 |
* a specific datasource, avoid grouped layers, ... |
... | ... | |
50 | 55 |
*/ |
51 | 56 |
public class FilterProjectInfo { |
52 | 57 |
private boolean groupedLayers=true; |
58 |
private Set datasources= new HashSet(); |
|
53 | 59 |
/** |
54 | 60 |
* Filter grouped layers. All the layers will be at the same level. |
55 | 61 |
* @param groupedLayers must be false in order to remove all grouped layers |
56 | 62 |
*/ |
57 |
public void setGroupedLayers(boolean groupedLayers) { |
|
63 |
public void setGroupedLayersEnabled(boolean groupedLayers) {
|
|
58 | 64 |
this.groupedLayers = groupedLayers; |
59 | 65 |
} |
60 | 66 |
/** |
61 | 67 |
* @return the groupedLayers |
62 | 68 |
*/ |
63 |
public boolean isGroupedLayers() { |
|
69 |
public boolean isGroupedLayersEnabled() {
|
|
64 | 70 |
return groupedLayers; |
65 | 71 |
} |
72 |
/** |
|
73 |
* |
|
74 |
* @param datasourceType which will be enable like IDataSourceInfo.POSTGIS_TYPE, ... |
|
75 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo |
|
76 |
*/ |
|
77 |
public void addAllowedDatasource(String datasourceType ){ |
|
78 |
datasources.add(datasourceType); |
|
79 |
} |
|
80 |
/** |
|
81 |
* Check if a datasource is in the white list of datasources |
|
82 |
* @param datasourceType |
|
83 |
* @return |
|
84 |
*/ |
|
85 |
public boolean isAllowedDatasource(IDataSourceInfo ds){ |
|
86 |
if (ds == null){ |
|
87 |
return false; |
|
88 |
}else{ |
|
89 |
return datasources.contains(ds.getType()); |
|
90 |
} |
|
91 |
|
|
92 |
} |
|
93 |
/** |
|
94 |
* Utility for convert a tree of LayerInfos in a list of them. It delete the grouped layers. |
|
95 |
* @param layers |
|
96 |
* @return |
|
97 |
*/ |
|
98 |
public ILayerInfo[] toList(ILayerInfo[] layers){ |
|
99 |
ArrayList list = new ArrayList(); |
|
100 |
for (int i = 0; i < layers.length; i++){ |
|
101 |
ILayerInfo[] childs = layers[i].getChilds(); |
|
102 |
if (childs == null){ |
|
103 |
list.add(layers[i]); |
|
104 |
}else{ |
|
105 |
ILayerInfo[] aux2 = toList(childs); |
|
106 |
for (int j=0; j< aux2.length; j++){ |
|
107 |
list.add(aux2[j]); |
|
108 |
} |
|
109 |
} |
|
110 |
} |
|
111 |
ILayerInfo[] res = new ILayerInfo[list.size()]; |
|
112 |
for (int k = 0; k < list.size(); k++){ |
|
113 |
res[k] = (ILayerInfo)list.get(k); |
|
114 |
} |
|
115 |
return res; |
|
116 |
} |
|
66 | 117 |
|
118 |
public boolean isFiltered(ILayerInfo layer){ |
|
119 |
//a group is not filtered |
|
120 |
if(layer.getDataSource() == null){ |
|
121 |
return false; |
|
122 |
}else{ |
|
123 |
boolean aux = false; |
|
124 |
Iterator i = datasources.iterator(); |
|
125 |
while (i.hasNext()){ |
|
126 |
String dstype = i.next().toString(); |
|
127 |
aux = aux || dstype == layer.getDataSource().getDataType(); |
|
128 |
} |
|
129 |
return aux; |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
67 | 133 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/LayerInfo.java | ||
---|---|---|
66 | 66 |
public class LayerInfo implements ILayerInfo { |
67 | 67 |
private FLayer layer = null; |
68 | 68 |
private ILayerInfo parent = null; |
69 |
private LayerInfo[] layers = null; |
|
69 |
private ILayerInfo[] layers = null;
|
|
70 | 70 |
private ProjectView view=null; |
71 | 71 |
private IViewInfo iview = null; |
72 |
|
|
72 | 73 |
/** |
73 | 74 |
* Constructor |
74 | 75 |
* @param flayer from gvSIG |
... | ... | |
145 | 146 |
* @see org.gvsig.publish.infoproject.ILayerInfo#setChilds(org.gvsig.publish.infoproject.ILayerInfo[]) |
146 | 147 |
*/ |
147 | 148 |
public void setChilds(ILayerInfo[] childs){ |
148 |
this.layers = (LayerInfo[])childs; |
|
149 |
if (childs !=null){ |
|
150 |
this.layers = childs; |
|
151 |
for (int i=0; i< this.layers.length; i++){ |
|
152 |
layers[i].setParent(this); |
|
153 |
} |
|
154 |
}else{ |
|
155 |
this.layers = null; |
|
156 |
} |
|
157 |
|
|
149 | 158 |
} |
150 | 159 |
/** |
151 | 160 |
* |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/datasources/PostGISTableInfo.java | ||
---|---|---|
304 | 304 |
} |
305 | 305 |
return aux; |
306 | 306 |
} |
307 |
/* |
|
308 |
* (non-Javadoc) |
|
309 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getSRID() |
|
310 |
*/ |
|
311 |
public int getSRID() { |
|
312 |
int srid=-1; |
|
313 |
String[] components = getEPSG().split(":"); |
|
314 |
srid = new Integer(components[1]).intValue(); |
|
315 |
return srid; |
|
316 |
} |
|
307 | 317 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/datasources/RasterInfo.java | ||
---|---|---|
169 | 169 |
return null; |
170 | 170 |
} |
171 | 171 |
} |
172 |
/* |
|
173 |
* (non-Javadoc) |
|
174 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getSRID() |
|
175 |
*/ |
|
176 |
public int getSRID() { |
|
177 |
int srid=-1; |
|
178 |
String[] components = getEPSG().split(":"); |
|
179 |
srid = new Integer(components[1]).intValue(); |
|
180 |
return srid; |
|
181 |
} |
|
172 | 182 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/datasources/ShapefileInfo.java | ||
---|---|---|
208 | 208 |
int i = aux.lastIndexOf("."); |
209 | 209 |
return aux.substring(0,i); |
210 | 210 |
} |
211 |
|
|
211 |
/* |
|
212 |
* (non-Javadoc) |
|
213 |
* @see org.gvsig.publish.infoproject.IDataSourceInfo#getSRID() |
|
214 |
*/ |
|
215 |
public int getSRID() { |
|
216 |
int srid=-1; |
|
217 |
String[] components = getEPSG().split(":"); |
|
218 |
srid = new Integer(components[1]).intValue(); |
|
219 |
return srid; |
|
220 |
} |
|
212 | 221 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/ILayerInfo.java | ||
---|---|---|
107 | 107 |
*/ |
108 | 108 |
abstract ILayerInfo[] getChilds(); |
109 | 109 |
/** |
110 |
* Set childs |
|
110 |
* Set childs and update the parent of each one.
|
|
111 | 111 |
* @param childs array of layerinfo |
112 | 112 |
*/ |
113 | 113 |
abstract void setChilds(ILayerInfo[] childs); |
... | ... | |
146 | 146 |
abstract ILayerInfo findLayer(String layerName); |
147 | 147 |
/** |
148 | 148 |
* |
149 |
* @return a string which identifies the hierarchy of layers |
|
149 |
* @return a string which identifies the hierarchy of layers. |
|
150 |
* If the layer is on the top the hierarchy, the string "/" is returned |
|
150 | 151 |
*/ |
151 | 152 |
abstract String getPathString(); |
152 | 153 |
} |
branches/v10/extensions/extPublish/src/org/gvsig/publish/PublishExtension.java | ||
---|---|---|
105 | 105 |
boolean isPublication = f instanceof PublishWindow; |
106 | 106 |
return (isPublication); |
107 | 107 |
} |
108 |
/** |
|
109 |
* Initializes the "about" panel |
|
110 |
*/ |
|
108 | 111 |
public void postInitialize() { |
109 | 112 |
super.postInitialize(); |
110 | 113 |
About about=(About)PluginServices.getExtension(About.class); |
111 | 114 |
FPanelAbout panelAbout=about.getAboutPanel(); |
112 | 115 |
java.net.URL aboutURL = this.getClass().getResource("/about.htm"); |
113 |
panelAbout.addAboutUrl(PluginServices.getText(this,"extension_de_publicacion"),aboutURL);
|
|
116 |
panelAbout.addAboutUrl(PluginServices.getText(this,"Publish"),aboutURL);
|
|
114 | 117 |
|
115 | 118 |
} |
116 | 119 |
|
branches/v10/extensions/extPublish/src/org/gvsig/publish/gui/wizard/PublishWizardPanel.java | ||
---|---|---|
53 | 53 |
import org.gvsig.publish.gui.publish.IPublishPluginPanel; |
54 | 54 |
import org.gvsig.publish.serversmodel.Publication; |
55 | 55 |
import org.gvsig.publish.serversmodel.Service; |
56 |
|
|
57 |
import com.iver.andami.PluginServices; |
|
56 | 58 |
/** |
57 | 59 |
* Wizard for showing server properties. Useful when the server has only one service. |
58 | 60 |
* |
... | ... | |
95 | 97 |
* Initialize gui labels for multilanguage |
Also available in: Unified diff