Revision 49

View differences:

org.gvsig.catalog/tags/org.gvsig.catalog-2.0.3/org.gvsig.catalog.extension/buildNumber.properties
1
#Thu Apr 02 09:51:00 CEST 2015
2
buildNumber=2060
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.3/org.gvsig.catalog.extension/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
  <dependencySets>
26
    <dependencySet>
27
      <useProjectArtifact>false</useProjectArtifact>
28
      <useTransitiveDependencies>false</useTransitiveDependencies>
29
      <outputDirectory>lib</outputDirectory>
30
      <includes>
31
      
32
           		<include>org.gvsig:org.gvsig.catalog.lib</include>
33
           		<!--
34
        		<include>org.gvsig:org.gvsig.remoteclient</include>
35
        		-->
36
        		<include>org.jzkit:a2j-runtime</include>
37
        		<include>org.jzkit:a2j</include>
38
        		<include>commons-beanutils:commons-beanutils</include>
39
        		<include>commons-httpclient:commons-httpclient</include>
40
        		<include>commons-logging:commons-logging</include>
41
        		<include>org.dspace:cql-java</include>
42
        		<include>jdom:jdom</include>
43
        		<include>org.jzkit:jzkit2-core</include>
44
        		<include>org.jzkit:jzkit2-z3950</include>
45
        		<include>org.jzkit:jzkit2-origin</include>
46
        		<include>soap:soap</include>
47
        		<include>net.swing:amic-util</include>
48
        		<include>org.springframework:spring</include> 
49

  
50
      </includes>
51
    </dependencySet>
52
  </dependencySets>
53

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

  
43
import java.util.Calendar;
44
import java.util.Date;
45
import java.util.GregorianCalendar;
46

  
47
import org.slf4j.Logger;
48
import org.slf4j.LoggerFactory;
49

  
50
import org.gvsig.andami.IconThemeHelper;
51
import org.gvsig.andami.PluginServices;
52
import org.gvsig.andami.persistence.serverData.ServerDataPersistence;
53
import org.gvsig.andami.plugins.Extension;
54
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
55
import org.gvsig.catalog.gui.ConnectDialog;
56
import org.gvsig.catalog.loaders.ARCIMSLayerLoader;
57
import org.gvsig.catalog.loaders.LinkLoader;
58
import org.gvsig.catalog.loaders.PostgisLayerLoader;
59
import org.gvsig.catalog.loaders.WCSLayerLoader;
60
import org.gvsig.catalog.loaders.WFSLayerLoader;
61
import org.gvsig.catalog.loaders.WMSLayerLoader;
62
import org.gvsig.catalog.schemas.Resource;
63
import org.gvsig.tools.ToolsLocator;
64
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
65
import org.gvsig.utils.swing.jcomboServer.ServerData;
66

  
67

  
68

  
69

  
70
/**
71
 * DOCUMENT ME!
72
 *
73
 * @author Luis W. Sevilla
74
 */
75
public class CatalogClientExtension extends Extension {
76
	private static final Logger LOG = LoggerFactory.getLogger(CatalogClientExtension.class);
77
	private static final String CATALOGLAYERS = "CatalogLayers";
78

  
79
	public void initialize() {
80
		ExtensionPointManager extensionPointManager = ToolsLocator
81
		    .getExtensionPointManager();
82
		extensionPointManager.add(CATALOGLAYERS, "List of possible layers that can be loaded from a catalog");
83
		registerIcons();
84
	}
85

  
86
	private void registerIcons(){
87
        IconThemeHelper.registerIcon("catalog", "catalog-move-down", this);
88
        IconThemeHelper.registerIcon("catalog", "catalog-move-up", this);
89
        IconThemeHelper.registerIcon("catalog", "catalog-server-properties", this);
90
        IconThemeHelper.registerIcon("catalog", "catalog-search", this);
91
	}
92

  
93
	public void postInitialize(){
94
		//Initialazing the layer loaders
95
		CatalogManager catalogManager = CatalogLocator.getCatalogManager();
96
		catalogManager.addLayerLoader(Resource.WMS, WMSLayerLoader.class);
97
		catalogManager.addLayerLoader(Resource.POSTGIS, PostgisLayerLoader.class);
98
		catalogManager.addLayerLoader(Resource.WCS, WCSLayerLoader.class);
99
		catalogManager.addLayerLoader(Resource.WEBSITE, LinkLoader.class);
100
		catalogManager.addLayerLoader(Resource.DOWNLOAD, LinkLoader.class);
101
		catalogManager.addLayerLoader(Resource.WFS, WFSLayerLoader.class);
102
		catalogManager.addLayerLoader(Resource.ARCIMS_IMAGE, ARCIMSLayerLoader.class);
103
		catalogManager.addLayerLoader(Resource.ARCIMS_VECTORIAL, ARCIMSLayerLoader.class);
104
	}
105

  
106
	public void execute(String actionCommand) {
107
		actionConnectDialogStart();
108
	}
109

  
110
	/**
111
	 * DOCUMENT ME!
112
	 */
113
	private void actionConnectDialogStart() {
114
		System.out.println("Bot?n Cliente de metadatos pulsado");
115
		restoreServerList();
116

  
117
		ConnectDialog connectDialog = new ConnectDialog();
118
		PluginServices.getMDIManager().addWindow(connectDialog);
119
	}
120

  
121
	/**
122
	 * It restores a server list. If this list does't exist it create  a server
123
	 * list by default.
124
	 */
125
	private void restoreServerList() {
126
		ServerDataPersistence persistence =
127
				new ServerDataPersistence(ServerData.SERVER_TYPE_CATALOG);
128

  
129
		ServerData[] servers = persistence.getArrayOfServerData();
130

  
131
		boolean found = false;
132
		for (int i=0 ; i<servers.length ; i++){
133
			if (servers[i].getServiceType().equals(ServerData.SERVER_TYPE_CATALOG)){
134
				found = true;
135
			}
136
		}       
137

  
138
		if (!found){
139
			if (servers.length == 0){
140
				servers = getDefaultServers();
141
			}else{
142
				ServerData[] newServers = new ServerData[servers.length + getDefaultServers().length ];
143
				System.arraycopy(servers, 0, newServers, 0, servers.length);
144
				System.arraycopy(getDefaultServers(), 0, newServers, servers.length, getDefaultServers().length);
145
				servers = newServers;
146
			}
147
			persistence.setArrayOfServerData(servers);
148
		}
149

  
150

  
151
		for (int i = 0; i < servers.length; i++) {
152
			if (servers[i].getServiceType().equals(ServerData.SERVER_TYPE_CATALOG)){
153
				ConnectDialog.addServer(servers[i]);
154
			}
155
		}
156

  
157

  
158
	}
159

  
160
	/**
161
	 * It creates a server list by default
162
	 *
163
	 * @return
164
	 */
165
	private ServerData[] getDefaultServers() {
166
		ServerData[] servers = new ServerData[0];
167
		Calendar cal = new GregorianCalendar();
168
		Date date = cal.getTime();
169

  
170
		//servers[0] = new ServerData("http://delta.icc.es/indicio/csw", date, date, ServerData.SERVER_TYPE_CATALOG, ServerData.SERVER_SUBTYPE_CATALOG_CSW);
171
		//servers[1] = new ServerData("mapas.euitto.upm.es:2100", date, date, ServerData.SERVER_TYPE_CATALOG, ServerData.SERVER_SUBTYPE_CATALOG_Z3950);
172
		//servers[2] = new ServerData("193.43.36.137:2100", date, date, ServerData.SERVER_TYPE_CATALOG, ServerData.SERVER_SUBTYPE_CATALOG_Z3950);
173
		//servers[3] = new ServerData("http://idee.unizar.es/SRW/servlet/search/ExplainSOAP",date,date,ServerData.SERVER_TYPE_CATALOG,ServerData.SERVER_SUBTYPE_CATALOG_SRW);
174
		return servers;
175
	}
176

  
177
	public boolean isEnabled() {
178
		return true;
179
	}
180

  
181
	public boolean isVisible() {
182
		org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
183
		.getActiveWindow();
184

  
185
		if (f == null) {
186
			return false;
187
		}
188

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

  
43
import java.util.Map;
44

  
45
import org.gvsig.andami.PluginServices;
46
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
47
import org.gvsig.catalog.schemas.Resource;
48
import org.gvsig.fmap.dal.DALLocator;
49
import org.gvsig.fmap.dal.DataManager;
50
import org.gvsig.fmap.dal.DataStoreParameters;
51
import org.gvsig.fmap.dal.exception.InitializeException;
52
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
53
import org.gvsig.fmap.mapcontext.MapContextLocator;
54
import org.gvsig.fmap.mapcontext.MapContextManager;
55
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
56
import org.gvsig.fmap.mapcontext.layers.FLayer;
57
import org.gvsig.tools.ToolsLocator;
58
import org.gvsig.tools.extensionpoint.ExtensionPoint;
59
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
60

  
61

  
62
/**
63
 * This class has to be inherited by all the classes
64
 * that have to load a layer in the current view
65
 * @author Jorge Piera Llodra (piera_jor@gva.es)
66
 */
67
public abstract class GvSigLayerLoader extends LayerLoader{
68
    private static final MapContextManager MAP_CONTEXT_MANAGER = 
69
        MapContextLocator.getMapContextManager();
70
    protected static final DataManager DATA_MANAGER =
71
        DALLocator.getDataManager();
72
    private static final ExtensionPointManager EXTENSION_POINT_MANAGER =
73
        ToolsLocator.getExtensionPointManager();
74

  
75
    /**
76
     * @param resource
77
     */
78
    public GvSigLayerLoader(Resource resource) {
79
        super(resource);		
80
    }
81

  
82
    public void loadLayer() throws LayerLoaderException {
83
        FLayer layer;
84
        try{
85
            if (hasSpecificLayer()){
86
                layer = createLayerFromExtensionPoint();       
87
            }else{
88
                layer = createLayerFromParameters();                 
89
            }
90
        } catch (Exception e) {
91
            throw new LayerLoaderException(e.getMessage(), e, getWindowMessage());
92
        } 
93
        if (layer != null){
94
            addLayerToView(layer);
95
        }
96
    }	
97

  
98
    private FLayer createLayerFromParameters() throws InitializeException, ProviderNotRegisteredException, LoadLayerException{
99
        DataStoreParameters dataStoreParameters = createDataStoreParameters();    
100
        return MAP_CONTEXT_MANAGER.createLayer(getLayerName(), dataStoreParameters);    
101
    }
102

  
103
    private FLayer createLayerFromExtensionPoint() throws Exception{
104
        DataStoreParameters dataStoreParameters = createDataStoreParameters();            
105
        ExtensionPoint extensionPoint = EXTENSION_POINT_MANAGER.get("CatalogLayers");
106
        return (FLayer)extensionPoint.create(extensionPointName(), new Object[]{dataStoreParameters});
107
    }
108

  
109
    /**
110
     * It adds a new layer to the current view
111
     * @param lyr
112
     * Layer lo load
113
     */
114
    private void addLayerToView(FLayer lyr) {
115
        AbstractViewPanel theView = 
116
            (AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
117
        theView.getMapControl().getMapContext().getLayers().addLayer(lyr);			
118
    }	
119

  
120
    protected abstract boolean hasSpecificLayer();
121

  
122
    protected String extensionPointName(){
123
        return null;
124
    }
125

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

  
43
import org.gvsig.catalog.schemas.Resource;
44
import org.gvsig.fmap.dal.DataStoreParameters;
45
import org.gvsig.fmap.dal.exception.InitializeException;
46
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
47
import org.gvsig.i18n.Messages;
48

  
49

  
50

  
51
/**
52
 * This class is used to load a WFS layer in gvSIG
53
 * 
54
 * @author Jorge Piera Llodra (piera_jor@gva.es)
55
 */
56
public class WFSLayerLoader extends GvSigLayerLoader{
57
	public static final String DYNFIELDNAME_URL = "url";
58
	public static final String DYNFIELDNAME_VERSION = "version";
59
	public static final String DYNFIELDNAME_TYPENAME = "typeName";
60
	public static final String DYNFIELDNAME_NAMESPACE = "namespace";
61
	public static final String DYNFIELDNAME_NAMESPACEPREFIX = "namespacePrefix";
62
	public static final String DYNFIELDNAME_FIELDS = "fields";
63
	public static final String DYNFIELDNAME_FILTERENCODING = "filterEncoding";
64
	public static final String DYNFIELDNAME_MAXFEATURES = "maxFeatures";
65
	public static final String DYNFIELDNAME_TIMEOUT = "timeOut";
66
	public static final String DYNFIELDNAME_USER = "user";
67
	public static final String DYNFIELDNAME_PASSWORD = "password";
68
		
69
	public WFSLayerLoader(Resource resource) {
70
		super(resource);
71
	}	
72

  
73
    protected boolean hasSpecificLayer() {
74
        return false;
75
    }
76

  
77
    protected String getLayerName() {        
78
        return getResource().getName();
79
    }   
80
	
81
	protected DataStoreParameters createDataStoreParameters()
82
        throws InitializeException, ProviderNotRegisteredException {
83
	    String host = getResource().getLinkage();
84
        String featureType = getResource().getName();
85
        
86
	    DataStoreParameters dataStoreParameters = DATA_MANAGER.createStoreParameters("WFSStore");
87
        dataStoreParameters.setDynValue(DYNFIELDNAME_URL, host);
88
        int index = featureType.indexOf(":");
89
        if (index > 0){
90
            dataStoreParameters.setDynValue(DYNFIELDNAME_NAMESPACEPREFIX, featureType.substring(0, index));
91
        }
92
        dataStoreParameters.setDynValue(DYNFIELDNAME_TYPENAME, featureType);
93
        dataStoreParameters.setDynValue(DYNFIELDNAME_USER, "");
94
        dataStoreParameters.setDynValue(DYNFIELDNAME_PASSWORD, "");
95
        return dataStoreParameters;
96
    }
97

  
98
	protected String getErrorMessage() {
99
		return Messages.getText("wfsError") + ".\n" +
100
		Messages.getText("server") + ": " + 
101
		getResource().getLinkage() + "\n" +
102
		Messages.getText("layer") + ": " +
103
		getResource().getName();		
104
	}
105

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

  
43
import java.io.IOException;
44

  
45
import com.Ostermiller.util.Browser;
46

  
47
import org.gvsig.catalog.schemas.Resource;
48
import org.gvsig.i18n.Messages;
49

  
50
public class LinkLoader extends LayerLoader{
51
	
52
	public LinkLoader(Resource resource) {
53
		super(resource);		
54
	}
55

  
56
	/**
57
	 * It loads the resource to the gvSIG view
58
	 * @throws LayerLoaderException 
59
	 */
60
	public void loadLayer() throws LayerLoaderException {
61
		String link = getResource().getLinkage();
62
		Browser.init();
63
		try {
64
			Browser.displayURL(link);
65
		} catch (IOException e) {
66
			throw new LayerLoaderException(e.getMessage(),getWindowMessage());
67
		}			
68
	}
69

  
70
	/*
71
	 *  (non-Javadoc)
72
	 * @see es.gva.cit.gvsig.catalogClient.loaders.LayerLoader#getErrorMessage()
73
	 */
74
	protected String getErrorMessage() {
75
		return Messages.getText("linkError") + ".\n" +
76
				Messages.getText("link") + ": " + 
77
				getResource().getLinkage();						
78
	}
79

  
80
	/*
81
	 *  (non-Javadoc)
82
	 * @see es.gva.cit.gvsig.catalogClient.loaders.LayerLoader#getWindowMessage()
83
	 */
84
	protected String getWindowMessage() {
85
		return Messages.getText("linkLoad");
86
	}
87

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

  
43

  
44
import java.util.HashMap;
45
import java.util.Map;
46

  
47
import org.gvsig.andami.PluginServices;
48
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
49
import org.gvsig.catalog.schemas.Resource;
50
import org.gvsig.fmap.dal.DataStoreParameters;
51
import org.gvsig.fmap.dal.exception.InitializeException;
52
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
53
import org.gvsig.i18n.Messages;
54

  
55

  
56
/**
57
 * This class is used to load a WMS layer in gvSIG
58
 * 
59
 * @author Jorge Piera Llodra (piera_jor@gva.es)
60
 */
61
public class WMSLayerLoader extends GvSigLayerLoader{
62
    private static final String FIELD_NAME = "name";
63
    private static final String FIELD_SRSSTR = "srsstr";
64
    private static final String FIELD_FORMAT = "format";
65
    private static final String FIELD_TRANSPARENCY = "transparency";
66
    private static final String FIELD_LAYERQUERY = "layer_query";
67
    private static final String FIELD_URI = "uri";
68
    private static final String FIELD_ONLINERESOURC = "onlineresources";
69
    
70
    public WMSLayerLoader(Resource resource) {
71
        super(resource);		
72
    }	
73

  
74
    protected boolean hasSpecificLayer() {        
75
        return true;
76
    }
77

  
78
    protected String getLayerName() {      
79
        return getResource().getName();
80
    }    
81

  
82
    protected DataStoreParameters createDataStoreParameters()
83
        throws InitializeException, ProviderNotRegisteredException {
84
        DataStoreParameters dataStoreParameters = DATA_MANAGER.createStoreParameters("Wms Store");        
85
        dataStoreParameters.setDynValue(FIELD_URI, getResource().getLinkage());
86
        dataStoreParameters.setDynValue(FIELD_FORMAT, "image/png");
87
        dataStoreParameters.setDynValue(FIELD_LAYERQUERY, getResource().getName());
88
        AbstractViewPanel activeView = 
89
            (AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
90
        dataStoreParameters.setDynValue(FIELD_SRSSTR, activeView.getProjection().getAbrev());
91
        dataStoreParameters.setDynValue(FIELD_TRANSPARENCY, Boolean.TRUE);
92
        dataStoreParameters.setDynValue(FIELD_NAME, getLayerName());
93
        dataStoreParameters.setDynValue(FIELD_ONLINERESOURC, createOnlineResources());
94
        return dataStoreParameters;
95
    }   
96
    
97
    protected Map createOnlineResources() {
98
        Map args = new HashMap();
99
        args.put("GepMap", getResource().getLinkage());      
100
        return args;
101
    }
102
   
103
    protected String extensionPointName() {
104
        return "OGC:WMS";
105
    }
106

  
107
    protected String getErrorMessage() {
108
        return Messages.getText("wmsError") + ".\n" +
109
        Messages.getText("server") + ": " + 
110
        getResource().getLinkage() + "\n" +
111
        Messages.getText("layer") + ": " +
112
        getResource().getName();		
113
    }
114

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

  
43
import java.util.StringTokenizer;
44
import java.util.TreeMap;
45

  
46
import org.gvsig.catalog.schemas.Resource;
47
import org.gvsig.catalog.utils.Strings;
48
import org.gvsig.fmap.dal.DataStoreParameters;
49
import org.gvsig.fmap.dal.exception.InitializeException;
50
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
51
import org.gvsig.i18n.Messages;
52

  
53

  
54

  
55
/**
56
 * This class is used to load a POSTGIS resource in gvSIG
57
 * 
58
 * @author Jorge Piera Llodra (piera_jor@gva.es)
59
 */
60

  
61
public class PostgisLayerLoader extends GvSigLayerLoader{
62
        
63
    public PostgisLayerLoader(Resource resource) {
64
        super(resource);
65
    }
66

  
67
    protected boolean hasSpecificLayer() {
68
        return false;
69
    }
70

  
71
    protected String getLayerName() {        
72
        return getResource().getName();
73
    }   
74
    
75
    protected DataStoreParameters createDataStoreParameters()
76
    throws InitializeException, ProviderNotRegisteredException {
77
        String jdbcUrl = getResource().getLinkage();
78
        String table = getResource().getName();
79
        
80
        DataStoreParameters dataStoreParameters = DATA_MANAGER.createStoreParameters("PostgreSQL");
81
        parseParams(dataStoreParameters, jdbcUrl, table);
82
        
83
        return dataStoreParameters;
84
    }
85

  
86
    private void parseParams(DataStoreParameters dataStoreParameters, String jdbcUrl, String table){
87
        StringTokenizer sti = new StringTokenizer(jdbcUrl,"?");
88
        String dbURL = sti.nextToken();
89
        String p = sti.nextToken();
90
        TreeMap map = separateParams(p);
91
        String user = (String) map.get((String) "USER");
92
        String pwd = (String) map.get((String) "PASSWORD");
93
        map = Strings.separateParams(table);
94
        dataStoreParameters.setDynValue("USER", user);
95
        dataStoreParameters.setDynValue("PASSWORD",pwd);        
96
        dataStoreParameters.setDynValue("WHERECLAUSE","");
97
        dataStoreParameters.setDynValue("DBURL",dbURL);        
98
    }
99

  
100
    private TreeMap separateParams(String pairValues){
101
        TreeMap map = new TreeMap(); 
102
        String[] params = pairValues.split("&");
103
        for (int i = 0; i < params.length; i++) {
104
            String[] nameValue = params[i].split("=");
105
            map.put(nameValue[0].toUpperCase(), nameValue[1]);
106
        }
107
        return map;
108
    }
109

  
110
    /*
111
     *  (non-Javadoc)
112
     * @see es.gva.cit.gvsig.catalogClient.loaders.LayerLoader#getErrorMessage()
113
     */
114
    protected String getErrorMessage() {
115
        return Messages.getText("postgisError") + ".\n" +
116
        Messages.getText("server") + ": " + 
117
        getResource().getLinkage() + "\n" +
118
        Messages.getText("parameters") + ": " +
119
        getResource().getName();
120
    }
121

  
122
    /*
123
     *  (non-Javadoc)
124
     * @see es.gva.cit.gvsig.catalogClient.loaders.LayerLoader#getWindowMessage()
125
     */
126
    protected String getWindowMessage() {
127
        return Messages.getText("postgisLoad");
128
    }
129

  
130

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

  
43
import java.util.HashMap;
44
import java.util.Map;
45
import java.util.TreeMap;
46

  
47
import org.gvsig.andami.PluginServices;
48
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
49
import org.gvsig.catalog.schemas.Resource;
50
import org.gvsig.fmap.dal.DataStoreParameters;
51
import org.gvsig.fmap.dal.exception.InitializeException;
52
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
53
import org.gvsig.i18n.Messages;
54

  
55

  
56
/**
57
 * This class is used to load a WCS  layer in gvSIG
58
 * 
59
 * @author Jorge Piera Llodra (piera_jor@gva.es)
60
 */
61
public class WCSLayerLoader extends GvSigLayerLoader{
62
    private static final String FIELD_FORMAT = "format";
63
    private static final String FIELD_NAME = "name";
64
    private static final String FIELD_SRSSTR = "srsstr";
65
    private static final String FIELD_URI = "uri";
66
    private static final String FIELD_ONLINERESOURC = "onlineresources";
67
    private static final String FIELD_WIDTH = "width";
68
    private static final String FIELD_HEIGHT = "height";
69
    private static final String FIELD_PARAM = "parameter";
70
    
71
    public WCSLayerLoader(Resource resource) {
72
        super(resource);
73
    }	
74

  
75
    protected boolean hasSpecificLayer() {        
76
        return true;
77
    }
78

  
79
    protected String getLayerName() {      
80
        return getResource().getName();
81
    } 
82

  
83
    protected DataStoreParameters createDataStoreParameters()
84
    throws InitializeException, ProviderNotRegisteredException {
85
        DataStoreParameters dataStoreParameters = DATA_MANAGER.createStoreParameters("Wcs Store");
86
        
87
        parseQuery(dataStoreParameters, getResource().getLinkage());        
88
        dataStoreParameters.setDynValue(FIELD_NAME, getLayerName());
89
        dataStoreParameters.setDynValue(FIELD_ONLINERESOURC, createOnlineResources());
90
        return dataStoreParameters;
91
    }
92
    
93
    protected Map createOnlineResources() {
94
        Map args = new HashMap();
95
        args.put("GepCoverage", getResource().getLinkage());      
96
        return args;
97
    }
98

  
99
    protected String extensionPointName() {
100
        return "OGC:WCS";
101
    }
102

  
103
    /**
104
     * Builds a coverage starting from a full GetCoverage URL.
105
     * (Using this is not a regular function)
106
     */
107
    private void parseQuery(DataStoreParameters dataStoreParameters, String link){
108
                
109
        String host = null;
110
        String queryString = null;
111
        int index = link.indexOf("?");
112
        if (index > 0){        
113
            host = link.substring(0, index);
114
            queryString = link.substring(index+1);
115
        }else{
116
            host = link;
117
            queryString = "";
118
        }
119
        
120
        queryString = link.substring(link.indexOf('?')+1);
121
        dataStoreParameters.setDynValue(FIELD_URI, link.substring(0,link.indexOf('?')));
122
               
123
        String[] params = queryString.split("&");
124
        for (int i = 0; i < params.length; i++) {
125
            if (params[i]!= null){
126
                String[] nameValue = params[i].split("=");
127
                if(nameValue.length == 2){
128
                    String param = nameValue[0].toUpperCase();
129
                    if (param.equals("CRS")){
130
                        dataStoreParameters.setDynValue(FIELD_SRSSTR, nameValue[1]);
131
                    }else if (param.equals("FORMAT")){
132
                        dataStoreParameters.setDynValue(FIELD_FORMAT, nameValue[1]);
133
                    }else if (param.equals("WIDTH")){
134
                        dataStoreParameters.setDynValue(FIELD_WIDTH, nameValue[1]);
135
                    }else if (param.equals("HEIGHT")){
136
                        dataStoreParameters.setDynValue(FIELD_HEIGHT, nameValue[1]);
137
                    }else if (param.equals("BANDS")){
138
                        dataStoreParameters.setDynValue(FIELD_PARAM, nameValue[1]);
139
                    }                   
140
                }
141
            }
142
        }  
143
    }	
144

  
145
    protected String getErrorMessage() {
146
        return Messages.getText("wcsError") + ".\n" +
147
        Messages.getText("link") + ": " + 
148
        getResource().getLinkage();		
149
    }
150

  
151
    protected String getWindowMessage() {
152
        return Messages.getText("wcsLoad");
153
    }	
154
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.3/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/loaders/ARCIMSLayerLoader.java
1
package org.gvsig.catalog.loaders;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.andami.PluginServices;
7
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
8
import org.gvsig.catalog.schemas.Resource;
9
import org.gvsig.fmap.dal.DataStoreParameters;
10
import org.gvsig.fmap.dal.exception.InitializeException;
11
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
12
import org.gvsig.i18n.Messages;
13

  
14

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

  
56
/**
57
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
58
 */
59
public class ARCIMSLayerLoader extends GvSigLayerLoader {
60

  
61
    public ARCIMSLayerLoader(Resource resource) {
62
        super(resource);		
63
    }
64

  
65
    protected boolean hasSpecificLayer() {        
66
        return false;
67
    }
68

  
69
    protected String getLayerName() {      
70
        return getResource().getName();
71
    }      
72

  
73
    protected DataStoreParameters createDataStoreParameters()
74
    throws InitializeException, ProviderNotRegisteredException {
75
        //TODO provider for ArcIMS
76
        return null;
77
    }
78
    
79
    protected Map createArgs() {
80
        String host = getResource().getLinkage();
81
        String sLayer = getResource().getName();
82
        String protocol = getResource().getProtocol();
83
        AbstractViewPanel activeView = 
84
            (AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
85
        String srs = activeView.getProjection().getAbrev();
86
        
87
        Map args = new HashMap();
88
        args.put("host", host);
89
        args.put("service_name", sLayer);
90
        args.put("layer_name", sLayer);
91
        args.put("srs", srs);
92
        return args;
93
    }
94

  
95
    protected String extensionPointName() {
96
        String protocol = getResource().getProtocol();
97
        if (protocol.toUpperCase().indexOf(Resource.ARCIMS_IMAGE) >= 0){
98
           return "arcims_raster";
99
        }else if (protocol.toUpperCase().indexOf(Resource.ARCIMS_VECTORIAL) >= 0){
100
            return "arcims_vectorial";
101
        }
102
        return null;
103
    }
104
    
105
    protected String getErrorMessage() {
106
        return Messages.getText("arcims_server_error") + ".\n" +
107
        Messages.getText("server") + ": " + 
108
        getResource().getLinkage() + "\n" +
109
        Messages.getText("layer") + ": " +
110
        getResource().getName();		
111
    }
112

  
113
    protected String getWindowMessage() {
114
        return Messages.getText("arcims_load");
115
    }	
116
}
117

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

  
43
import java.awt.Frame;
44

  
45
import javax.swing.Icon;
46
import javax.swing.JDialog;
47

  
48
import org.gvsig.andami.IconThemeHelper;
49
import org.gvsig.andami.PluginServices;
50
import org.gvsig.andami.persistence.serverData.ServerDataPersistence;
51
import org.gvsig.andami.ui.mdiManager.IWindow;
52
import org.gvsig.andami.ui.mdiManager.WindowInfo;
53
import org.gvsig.catalog.drivers.ICatalogServiceDriver;
54
import org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel;
55
import org.gvsig.catalog.utils.Frames;
56
import org.gvsig.i18n.Messages;
57
import org.gvsig.utils.swing.jcomboServer.ServerData;
58

  
59

  
60
/**
61
 * Inicia la consulta de cat?logo de metadatos
62
 *
63
 * @author luisw
64
 */
65
public class ConnectDialog extends ServerConnectDialogPanel implements IWindow {
66
	public WindowInfo m_windowInfo = null;
67

  
68
	/**
69
	 * Constructor de la ventana de dialogo.
70
	 */
71
	public ConnectDialog() {
72
		super(null);
73
		init();
74
	}
75

  
76
	/**
77
	 * Inicializa el Dialog
78
	 */
79
	private void init() {
80
		this.setBounds(0, 0, 597, 238);
81
		setName("connectDialog");
82
	}
83

  
84
	/**
85
	 * Add a server
86
	 *
87
	 * @param server
88
	 */
89
	public static void addServer(ServerData server) {
90
		ServerConnectDialogPanel.addTreeMapServer(server);
91
	}
92

  
93
	/**
94
	 * Search Button action
95
	 */
96
	protected void searchButtonActionPerformed() {
97
		addCurrentHost();
98
		closeJDialog();
99

  
100
		JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
101
		Frames.centerFrame(panel,525,165);
102
		panel.setTitle(Messages.getText( "catalog_search")); 
103
		SearchDialog dialog = new SearchDialog(getClient(),this);
104
		dialog.setCurrentServer(getCurrentServer());
105
		dialog.setFrame(panel);
106
		panel.getContentPane().add(dialog);
107
		panel.setVisible(true);   
108
	}
109

  
110
	/**
111
	 * Save the current host (if is neccessary) in a file using the andami
112
	 * persistence
113
	 */
114
	private void addCurrentHost() {
115
		String host = getClient().getSUri();
116
		ServerDataPersistence persistence = new ServerDataPersistence(ServerData.SERVER_TYPE_CATALOG);
117
		ServerData newServerData = new ServerData(host, ServerData.SERVER_TYPE_CATALOG, getClient().getProtocol(),getControlsPanel().getDatabase());
118
		if (client.getServerData() != null){
119
			if ((client.getServerData() .getServerAddress().compareTo(newServerData.getServerAddress()) == 0) &&
120
					(client.getServerData() .getServiceSubType().compareTo(newServerData.getServiceSubType()) == 0)){
121
				newServerData.setProperies(client.getServerData().getProperies());
122
			}
123
		}
124
		persistence.addServerData(newServerData);
125
		// persistence..setPersistent();
126
	}
127

  
128
	/*
129
	 * (non-Javadoc)
130
	 * @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#closeButtonActionPerformed()
131
	 */
132
	protected void closeButtonActionPerformed() {   
133
		closeJDialog();
134
	}
135

  
136
	/*
137
	 * (non-Javadoc)
138
	 * @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#serverPropertiesButtonActionPerformed()
139
	 */
140
	protected void serverPropertiesButtonActionPerformed(){
141
		createClient();
142
		PluginServices.getMDIManager().addWindow(new ServerPropertiesDialog(
143
				getControlsPanel().getServer(),
144
				client,
145
				((ICatalogServiceDriver)getControlsPanel().getDriver()).getProfile(),
146
				null));
147
	}
148

  
149
	/**
150
	 * Close the dialog
151
	 */
152
	public void closeJDialog() {
153
		PluginServices.getMDIManager().closeWindow(ConnectDialog.this);
154
	}
155

  
156
	/* (non-Javadoc)
157
	 * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
158
	 */
159
	public WindowInfo getWindowInfo() {
160
		if (m_windowInfo == null){
161
			m_windowInfo = new WindowInfo(WindowInfo.MODALDIALOG);
162
			m_windowInfo.setTitle(Messages.getText("metadata_catalog"));
163
			m_windowInfo.setHeight(200);
164
			m_windowInfo.setWidth(600);
165
		}
166
		return m_windowInfo;
167
	}
168
	public Object getWindowProfile(){
169
		return WindowInfo.DIALOG_PROFILE;
170
	}
171

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

  
43
import javax.swing.JDialog;
44

  
45
import org.gvsig.andami.PluginServices;
46
import org.gvsig.andami.ui.mdiManager.IWindow;
47
import org.gvsig.andami.ui.mdiManager.WindowInfo;
48
import org.gvsig.catalog.metadataxml.XMLNode;
49
import org.gvsig.catalog.ui.showtree.ShowTreeDialogPanel;
50

  
51

  
52

  
53
/**
54
 * DOCUMENT ME!
55
 *
56
 * @author jorpiell TODO To change the template for this generated type comment
57
 *         go to Window - Preferences - Java - Code Style - Code Templates
58
 */
59
public class ShowTreeDialog extends ShowTreeDialogPanel implements IWindow {
60
	 private JDialog frame = null;
61
	/**
62
     * DOCUMENT ME!
63
     *
64
     * @param node
65
     */
66
    public ShowTreeDialog(JDialog frame,XMLNode node) {
67
        super(node);
68
        this.frame = frame;
69
        //8 --> Modal window
70
        PluginServices.getMDIManager().getWindowInfo(this).setWindowInfo(new WindowInfo(
71
                8));
72
    }
73

  
74
    /**
75
     * DOCUMENT ME!
76
     */
77
    public void closeButtonActionPerformed() {
78
        closeJDialog();
79
    }
80

  
81
    /**
82
     * DOCUMENT ME!
83
     */
84
    public void closeJDialog() {
85
    	frame.setVisible(false);
86
    }
87

  
88
    /**
89
     * DOCUMENT ME!
90
     *
91
     * @return DOCUMENT ME!
92
     */
93
    public WindowInfo getWindowInfo() {
94
        WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
95
        m_viewinfo.setTitle(getName());
96

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

  
43
import java.awt.Frame;
44
import java.util.Collection;
45

  
46
import javax.swing.JDialog;
47
import javax.swing.JOptionPane;
48

  
49
import org.gvsig.andami.PluginServices;
50
import org.gvsig.andami.ui.mdiManager.IWindow;
51
import org.gvsig.andami.ui.mdiManager.WindowInfo;
52
import org.gvsig.catalog.CatalogClient;
53
import org.gvsig.catalog.drivers.GetRecordsReply;
54
import org.gvsig.catalog.metadataxml.XMLNode;
55
import org.gvsig.catalog.schemas.Record;
56
import org.gvsig.catalog.schemas.Resource;
57
import org.gvsig.catalog.ui.showresults.ShowResultsDialogPanel;
58
import org.gvsig.catalog.utils.Frames;
59
import org.gvsig.i18n.Messages;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff