Revision 1146

View differences:

org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/test/java/org/gvsig/catalog/catalog/utils/URIUtilsTest.java
1
package org.gvsig.catalog.catalog.utils;
2

  
3
import java.net.URI;
4
import java.net.URISyntaxException;
5

  
6
import junit.framework.TestCase;
7

  
8
import org.gvsig.catalog.utils.URIUtils;
9

  
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
 *
12
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
 *
14
 * This program is free software; you can redistribute it and/or
15
 * modify it under the terms of the GNU General Public License
16
 * as published by the Free Software Foundation; either version 2
17
 * of the License, or (at your option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 * GNU General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU General Public License
25
 * along with this program; if not, write to the Free Software
26
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
 *
28
 * For more information, contact:
29
 *
30
 *  Generalitat Valenciana
31
 *   Conselleria d'Infraestructures i Transport
32
 *   Av. Blasco Ib??ez, 50
33
 *   46010 VALENCIA
34
 *   SPAIN
35
 *
36
 *      +34 963862235
37
 *   gvsig@gva.es
38
 *      www.gvsig.gva.es
39
 *
40
 *    or
41
 *
42
 *   IVER T.I. S.A
43
 *   Salamanca 50
44
 *   46005 Valencia
45
 *   Spain
46
 *
47
 *   +34 963163400
48
 *   dac@iver.es
49
 */
50
/* CVS MESSAGES:
51
 *
52
 * $Id: URIUtilsTest.java,v 1.1.2.1 2007/07/10 11:18:04 jorpiell Exp $
53
 * $Log: URIUtilsTest.java,v $
54
 * Revision 1.1.2.1  2007/07/10 11:18:04  jorpiell
55
 * Added the registers
56
 *
57
 *
58
 */
59
/**
60
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
61
 */
62
public class URIUtilsTest extends TestCase {
63
	
64
	public void test1() throws URISyntaxException{
65
		URI uri = URIUtils.createUri("http://www.upv.es", "http", 80);	
66
		assertEquals(uri.getHost(), "www.upv.es");
67
		assertEquals(uri.getScheme(), "http");
68
		assertEquals(uri.getPort(), 80);
69
		assertEquals(uri.getPath(), "");
70
	}
71
	
72
	public void test2() throws URISyntaxException{
73
		URI uri = URIUtils.createUri("www.upv.es", "http", 80);	
74
		assertEquals(uri.getHost(), "www.upv.es");
75
		assertEquals(uri.getScheme(), "http");
76
		assertEquals(uri.getPort(), 80);
77
		assertEquals(uri.getPath(), "");
78
	}
79
	
80
	public void test3() throws URISyntaxException{
81
		URI uri = URIUtils.createUri("www.upv.es", "z3950", 2100);	
82
		assertEquals(uri.getHost(), "www.upv.es");
83
		assertEquals(uri.getScheme(), "z3950");
84
		assertEquals(uri.getPort(), 2100);
85
		assertEquals(uri.getPath(), "");
86
	}
87
	
88
	public void test4() throws URISyntaxException{
89
		URI uri = URIUtils.createUri("http://193.144.250.29/webservices/services/IDEC_GeoServeisPort", "http", 80);	
90
		assertEquals(uri.getHost(), "193.144.250.29");
91
		assertEquals(uri.getScheme(), "http");
92
		assertEquals(uri.getPort(), 80);
93
		assertEquals(uri.getPath(), "/webservices/services/IDEC_GeoServeisPort");
94
	}
95
}
0 96

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/test/java/org/gvsig/catalog/catalog/drivers/ExampleNewDriver.java
1
package org.gvsig.catalog.catalog.drivers;
2

  
3
import java.net.URI;
4

  
5
import org.gvsig.catalog.CatalogLocator;
6
import org.gvsig.catalog.CatalogManager;
7
import org.gvsig.catalog.drivers.AbstractCatalogServiceDriver;
8
import org.gvsig.catalog.drivers.CatalogCapabilities;
9
import org.gvsig.catalog.drivers.DiscoveryServiceCapabilities;
10
import org.gvsig.catalog.drivers.GetRecordsReply;
11
import org.gvsig.catalog.querys.CatalogQuery;
12
import org.gvsig.catalog.schemas.Record;
13
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel;
14

  
15

  
16
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
17
 *
18
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
19
 *
20
 * This program is free software; you can redistribute it and/or
21
 * modify it under the terms of the GNU General Public License
22
 * as published by the Free Software Foundation; either version 2
23
 * of the License, or (at your option) any later version.
24
 *
25
 * This program is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 * GNU General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU General Public License
31
 * along with this program; if not, write to the Free Software
32
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
33
 *
34
 * For more information, contact:
35
 *
36
 *  Generalitat Valenciana
37
 *   Conselleria d'Infraestructures i Transport
38
 *   Av. Blasco Ib??ez, 50
39
 *   46010 VALENCIA
40
 *   SPAIN
41
 *
42
 *      +34 963862235
43
 *   gvsig@gva.es
44
 *      www.gvsig.gva.es
45
 *
46
 *    or
47
 *
48
 *   IVER T.I. S.A
49
 *   Salamanca 50
50
 *   46005 Valencia
51
 *   Spain
52
 *
53
 *   +34 963163400
54
 *   dac@iver.es
55
 */
56
/* CVS MESSAGES:
57
 *
58
 * $Id: ExampleNewDriver.java 537 2007-07-26 11:21:10Z jpiera $
59
 * $Log$
60
 * Revision 1.1.2.1  2007/07/13 12:00:35  jorpiell
61
 * Add the posibility to add a new panel
62
 *
63
 *
64
 */
65
/**
66
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
67
 */
68
public class ExampleNewDriver extends AbstractCatalogServiceDriver {
69
	private static final CatalogManager catalogManager = CatalogLocator.getCatalogManager();
70
	
71
	/*
72
	 * (non-Javadoc)
73
	 * @see es.gva.cit.catalogClient.drivers.IDiscoveryServiceDriver#getCapabilities(java.net.URI)
74
	 */
75
	public DiscoveryServiceCapabilities getCapabilities(URI uri) {
76
		return new CatalogCapabilities();
77
	}
78

  
79
	/*
80
	 * (non-Javadoc)
81
	 * @see es.gva.cit.catalog.drivers.ICatalogServiceDriver#getRecords(java.net.URI, es.gva.cit.catalog.querys.CatalogQuery, int)
82
	 */
83
	public GetRecordsReply getRecords(URI uri, CatalogQuery query,
84
			int firstRecord) {
85
		GetRecordsReply reply = new GetRecordsReply(1);
86
		Record record = catalogManager.createRecord(uri, null);
87
		record.setTitle("Record example");
88
		record.setAbstract_("Just for testing");
89
		reply.addRecord(record);
90
		return reply;
91
	}
92

  
93
	/*
94
	 * (non-Javadoc)
95
	 * @see es.gva.cit.catalog.drivers.IDiscoveryServiceDriver#getServiceName()
96
	 */
97
	public String getServiceName() {
98
		return "My catalog service";
99
	}
100

  
101
	/*
102
	 * (non-Javadoc)
103
	 * @see es.gva.cit.gazetteer.drivers.IGazetteerServiceDriver#getAditionalSearchPanel()
104
	 */
105
	public SearchAditionalPropertiesPanel getAditionalSearchPanel(){
106
		return new ExampleNewPanel();
107
	}
108

  
109

  
110

  
111

  
112
}
0 113

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/test/java/org/gvsig/catalog/catalog/drivers/ExampleNewDriverTest.java
1
package org.gvsig.catalog.catalog.drivers;
2

  
3
import javax.swing.UIManager;
4
import javax.swing.UnsupportedLookAndFeelException;
5

  
6
import org.gvsig.catalog.CatalogLocator;
7
import org.gvsig.catalog.ui.serverconnect.ServerConnectDialog;
8
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer;
9

  
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: ExampleNewDriverTest.java 512 2007-07-24 11:25:43Z jorpiell $
54
 * $Log$
55
 * Revision 1.1.2.2  2007/07/24 11:25:42  jorpiell
56
 * The registers has been refactorized
57
 *
58
 * Revision 1.1.2.1  2007/07/13 12:00:35  jorpiell
59
 * Add the posibility to add a new panel
60
 *
61
 *
62
 */
63
/**
64
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
65
 */
66
public class ExampleNewDriverTest {
67

  
68
	/**
69
	 * @param args
70
	 */
71
	public static void main(String[] args) {
72
		new DefaultLibrariesInitializer().fullInitialize();
73
//		DefaultCatalogLibrary library = new DefaultCatalogLibrary();
74
//		library.initialize();
75
//		library.postInitialize();
76

  
77
		CatalogLocator.getCatalogManager().register("My catalog service", ExampleNewDriver.class);
78
		//Get the currently installed look and feel
79
		UIManager.getLookAndFeel();
80
		// Install a different look and feel; specifically, the Windows look and feel
81
		try {
82
			UIManager.setLookAndFeel(
83
					"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
84
		} catch (InstantiationException e) {
85
		} catch (ClassNotFoundException e) {
86
		} catch (UnsupportedLookAndFeelException e) {
87
		} catch (IllegalAccessException e) {
88
		}
89

  
90
		new ServerConnectDialog();
91
	}
92

  
93
}
0 94

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/test/java/org/gvsig/catalog/catalog/drivers/ExampleNewPanel.java
1
package org.gvsig.catalog.catalog.drivers;
2

  
3
import java.util.Properties;
4

  
5
import javax.swing.JLabel;
6
import javax.swing.JTextField;
7

  
8
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel;
9

  
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: ExampleNewPanel.java 537 2007-07-26 11:21:10Z jpiera $
54
 * $Log$
55
 * Revision 1.1.2.1  2007/07/13 12:00:35  jorpiell
56
 * Add the posibility to add a new panel
57
 *
58
 *
59
 */
60
/**
61
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
62
 */
63
public class ExampleNewPanel extends SearchAditionalPropertiesPanel{
64
	JLabel label = null;
65
	JTextField text = null;
66
	
67
	public ExampleNewPanel(){
68
		label = new JLabel();
69
		text = new JTextField();		
70
		setLayout(new java.awt.BorderLayout());
71
		label.setText("Label");
72
		add(label, java.awt.BorderLayout.WEST);		
73
		add(text, java.awt.BorderLayout.CENTER);
74
	}
75
	
76
	/*
77
	 * (non-Javadoc)
78
	 * @see es.gva.cit.gazetteer.ui.search.SearchAditionalPropertiesPanel#getProperties()
79
	 */
80
	public Properties getProperties() {
81
		Properties properties = new Properties();
82
		properties.put("PROP1", text.getText());
83
		return properties;
84
	}
85

  
86
}
0 87

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.catalog.CatalogLibrary
2
org.gvsig.catalog.impl.DefaultCatalogLibrary
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/drivers/AbstractDiscoveryServiceDriver.java
1
package org.gvsig.catalog.drivers;
2

  
3
import java.net.URI;
4

  
5
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel;
6
import org.gvsig.utils.swing.jcomboServer.ServerData;
7

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

  
60
	/*
61
	 * (non-Javadoc)
62
	 * @see es.gva.cit.catalogClient.drivers.IDiscoveryServiceDriver#getServerAnswerReady()
63
	 */
64
	public String getServerAnswerReady() {        
65
		return serverAnswerReady;
66
	} 
67

  
68
	/*
69
	 * (non-Javadoc)
70
	 * @see es.gva.cit.catalogClient.drivers.IDiscoveryServiceDriver#setServerAnswerReady(java.lang.String)
71
	 */
72
	public void setServerAnswerReady(String serverAnswerReady) {        
73
		this.serverAnswerReady = serverAnswerReady;
74
	} 
75
	
76
	
77
	/*
78
	 * (non-Javadoc)
79
	 * @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#getDefaultPort()
80
	 */
81
	public int getDefaultPort() {
82
		return 80;
83
	}
84
	
85
	/*
86
	 * (non-Javadoc)
87
	 * @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#getDefaultSchema()
88
	 */
89
	public String getDefaultSchema() {
90
		return "http";
91
	}
92
	
93
	/*
94
	 * (non-Javadoc)
95
	 * @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#isProtocolSupported(java.net.URI)
96
	 */
97
	public boolean isProtocolSupported(URI uri) {
98
		return true;
99
	}
100
	
101
	/*
102
	 * (non-Javadoc)
103
	 * @see es.gva.cit.catalogClient.drivers.ICatalogServiceDriver#getAditionalSearchPanel()
104
	 */
105
	public SearchAditionalPropertiesPanel getAditionalSearchPanel(){
106
		return null;
107
	}	
108

  
109
	/*
110
	 * (non-Javadoc)
111
	 * @see java.lang.Object#toString()
112
	 */
113
	public String toString(){
114
		return getServiceName();
115
	}
116
	
117
	/* (non-Javadoc)
118
	 * @see es.gva.cit.catalog.drivers.IDiscoveryServiceDriver#isOneServer()
119
	 */
120
	public ServerData getOneServer() {
121
		return null;
122
	}
123
}
0 124

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/drivers/AbstractCatalogServiceDriver.java
1

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

  
44
import org.gvsig.catalog.drivers.profiles.IProfile;
45
import org.gvsig.catalog.metadataxml.XMLNode;
46
import org.gvsig.catalog.metadataxml.XMLTree;
47
import org.gvsig.catalog.querys.CatalogQuery;
48
import org.gvsig.catalog.querys.DiscoveryServiceQuery;
49
import org.gvsig.utils.swing.jcomboServer.ServerData;
50

  
51
/**
52
 * All classes that implement a new catalog protocol must to inherit to this class.?
53
 * It contains the common atributes for the protocols.
54
 * 
55
 * 
56
 * @author Jorge Piera Llodra (piera_jor@gva.es)
57
 */
58
public abstract class AbstractCatalogServiceDriver extends AbstractDiscoveryServiceDriver implements ICatalogServiceDriver {
59
	private String sortBy = null;
60
	private String startPosition;
61
	private String maxRecords;
62
	private String outputFormat = null;
63
	private String[] outputSchema = null;
64
	private CatalogQuery query = null;
65
	private GetRecordsReply recordsReply = null;
66
	private String serverProfile = null;
67
	private ServerData serverData = null;
68

  
69
	/**
70
	 * Used to set a ServerData that contains the properties
71
	 * that have been fixed by the user
72
	 */
73
	public void setServerData(ServerData serverData){
74
		this.serverData = serverData;
75
	}
76
	
77
	/**
78
	 * Return the server data
79
	 */
80
	public ServerData getServerData(){
81
		return serverData;
82
	}
83
	
84
	/**
85
	 * Gets the profile. It has to be implemented
86
	 * by all the drivers with profile
87
	 * @return
88
	 * The profile
89
	 */
90
	public IProfile getProfile(){
91
		return null;
92
	}
93
	
94
	/**
95
	 * This function returns the number of records that have been retrieved.
96
	 * It Reads a Node value.
97
	 * 
98
	 * 
99
	 * @return The number of records
100
	 * @param node The answer tree
101
	 * @param label Node Name that contains the value
102
	 * @param attribute Attributes wich contain the value
103
	 */
104
	public int getNumberOfRecords(XMLNode node, String label, String attribute) {        
105
		String sNumberOfRecords = null;
106
		int numberOfRecords;
107

  
108
		if (attribute != null)
109
			sNumberOfRecords = XMLTree.searchNodeAtribute(node,
110
					label,
111
					attribute);
112
		else
113
			sNumberOfRecords = XMLTree.searchNodeValue(node,label);
114

  
115
		try {
116
			numberOfRecords = Integer.parseInt(sNumberOfRecords);
117
		} catch (Exception e) {
118
			return -1;
119
		}
120

  
121
		return numberOfRecords;
122
	} 
123
	
124
	/*
125
	 * (non-Javadoc)
126
	 * @see es.gva.cit.catalogClient.drivers.IDiscoveryServiceDriver#createQuery()
127
	 */
128
	public DiscoveryServiceQuery createQuery(){
129
		return new CatalogQuery();
130
	}
131
	
132
	/**
133
	 * @return Returns the query.
134
	 */
135
	public CatalogQuery getQuery() {        
136
		return query;
137
	} 
138

  
139
	/**
140
	 * @param query The query to set.
141
	 */
142
	public void setQuery(CatalogQuery query) {        
143
		if (query != null) {
144
			this.query = query;
145
			recordsReply = new GetRecordsReply(0);
146
		}
147
	} 
148

  
149
	/**
150
	 * @return Returns the maxRecords.
151
	 */
152
	public String getMaxRecords() {        
153
		return maxRecords;
154
	} 
155

  
156
	/**
157
	 * @param maxRecords The maxRecords to set.
158
	 */
159
	public void setMaxRecords(String maxRecords) {        
160
		this.maxRecords = maxRecords;
161
	} 
162

  
163
	/**
164
	 * @return Returns the outputFormat.
165
	 */
166
	public String getOutputFormat() {        
167
		return outputFormat;
168
	} 
169

  
170
	/**
171
	 * @param outputFormat The outputFormat to set.
172
	 */
173
	public void setOutputFormat(String outputFormat) {        
174
		this.outputFormat = outputFormat;
175
	} 
176

  
177
	/**
178
	 * @return Returns the outputSchema.
179
	 */
180
	public String[] getOutputSchema() {        
181
		return outputSchema;
182
	} 
183

  
184
	/**
185
	 * @param outputSchema The outputSchema to set.
186
	 */
187
	public void setOutputSchema(String[] outputSchema) {        
188
		this.outputSchema = outputSchema;
189
	} 
190

  
191
	/**
192
	 * @param outputSchema 
193
	 */
194
	public void setOutputSchema(String outputSchema) {        
195
		String[] s = new String[1];
196
		s[0] = outputSchema;
197
		this.outputSchema = s;
198
	} 
199

  
200
	/**
201
	 * @return Returns the sortBy.
202
	 */
203
	public String getSortBy() {        
204
		return sortBy;
205
	} 
206

  
207
	/**
208
	 * @param sortBy The sortBy to set.
209
	 */
210
	public void setSortBy(String sortBy) {        
211
		this.sortBy = sortBy;
212
	} 
213

  
214
	/**
215
	 * @return Returns the startPosition.
216
	 */
217
	public String getStartPosition() {        
218
		return startPosition;
219
	} 
220

  
221
	/**
222
	 * @param startPosition The startPosition to set.
223
	 */
224
	public void setStartPosition(String startPosition) {        
225
		this.startPosition = startPosition;
226
	} 
227

  
228
	/**
229
	 * @return the recordsReply
230
	 */
231
	public GetRecordsReply getRecordsReply() {
232
		return recordsReply;
233
	}
234

  
235
}
0 236

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/drivers/GetRecordsReply.java
1
package org.gvsig.catalog.drivers;
2

  
3
import java.net.URI;
4
import java.util.ArrayList;
5

  
6
import org.gvsig.catalog.metadataxml.XMLNode;
7
import org.gvsig.catalog.schemas.Record;
8
import org.gvsig.catalog.schemas.RecordFactory;
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id: GetRecordsReply.java 600 2007-09-19 11:30:05 +0000 (Wed, 19 Sep 2007) jpiera $
52
 * $Log$
53
 * Revision 1.1.2.1  2007/07/23 07:14:25  jorpiell
54
 * Catalog refactoring
55
 *
56
 *
57
 */
58
/**
59
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
60
 */
61
public class GetRecordsReply {
62
	private ArrayList records = null;
63
	private int numRecords = 0;
64
	
65
	public GetRecordsReply(int numRecords){
66
		this.numRecords = numRecords;
67
		records = new ArrayList();
68
	}
69
	
70
	/**
71
	 * Add a new record
72
	 * @param record
73
	 * rRecord to add
74
	 */
75
	public void addRecord(Record record){
76
		records.add(record);
77
	}
78
	
79
	/**
80
	 * Add a new record
81
	 * @param uri
82
	 * Server uri
83
	 * @param node
84
	 * XML node
85
	 */
86
	public void addRecord(URI uri, XMLNode node){
87
		Record record = RecordFactory.createRecord(uri, node);
88
		records.add(record);		
89
	}
90
	
91
	/**
92
	 * Gets a record that it is in a concrete position
93
	 * @param index
94
	 * Record position
95
	 * @return
96
	 * A record
97
	 */
98
	public Record getRecordAt(int index){
99
		if (index >= records.size()){
100
			return null;
101
		}
102
		return (Record)records.get(index);
103
	}
104

  
105
	/**
106
	 * @return the numRecords
107
	 */
108
	public int getRecordsNumber() {
109
		return numRecords;
110
	}
111
	
112
	/**
113
	 * @return the numRecords
114
	 */
115
	public int getRetrievedRecordsNumber() {
116
		return records.size();
117
	}
118
	
119
	/**
120
	 * @param numRecords the numRecords to set
121
	 */
122
	public void setNumRecords(int numRecords) {
123
		this.numRecords = numRecords;
124
	}
125
	
126
}
0 127

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/drivers/IDiscoveryServiceDriver.java
1
package org.gvsig.catalog.drivers;
2

  
3
import java.net.URI;
4

  
5
import org.gvsig.catalog.exceptions.NotSupportedProtocolException;
6
import org.gvsig.catalog.exceptions.NotSupportedVersionException;
7
import org.gvsig.catalog.querys.DiscoveryServiceQuery;
8
import org.gvsig.catalog.ui.search.SearchAditionalPropertiesPanel;
9
import org.gvsig.utils.swing.jcomboServer.ServerData;
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id$
54
 * $Log$
55
 *
56
 */
57
/**
58
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
59
 */
60
public interface IDiscoveryServiceDriver {
61
	/**
62
	 * It try to discover the server capabilities.
63
	 * @return Node with the server answer.
64
	 * @param uri Server URI
65
	 */
66
	public DiscoveryServiceCapabilities getCapabilities(URI uri) throws NotSupportedVersionException;
67
	
68
	/**
69
	 * It have to prove if the specified protocol is supported.
70
	 * @return true if is supported, false if it isn't supported
71
	 * @param uri Server URI
72
	 */
73
	public boolean isProtocolSupported(URI uri) throws NotSupportedProtocolException;
74
	
75
	/**
76
	 * It return a message to write in the server connection frame
77
	 * @return It is/isn't the supported protocol
78
	 */
79
	public String getServerAnswerReady();
80
	
81
	/**
82
	 * It sets an error message 
83
	 */
84
	public void setServerAnswerReady(String message);
85

  
86
	/**
87
	 * @return the dafault port for an specific
88
	 * service
89
	 */
90
	public int getDefaultPort();
91
	
92
	/**
93
	 * @return the dafault schema for an specific
94
	 * service
95
	 */
96
	public String getDefaultSchema();
97
	
98
	/**
99
	 * @return the service name that will be showed
100
	 * in the user interface
101
	 */
102
	public String getServiceName();
103
	
104
	/**
105
	 * This message will be showed in the protocols combo
106
	 * @return The message to show
107
	 */
108
	public String toString();
109
	
110
	/**
111
	 * There are protocols that can support other attributes
112
	 * to do the search. They have to provide its own
113
	 * panel to do the search
114
	 * @return
115
	 * JPanel with a list of properties.
116
	 */
117
	public SearchAditionalPropertiesPanel getAditionalSearchPanel();
118

  
119
	/**
120
	 * Create and return an empty query
121
	 * @return
122
	 */
123
	public DiscoveryServiceQuery createQuery();
124
        
125
       /**
126
	 * @return if the protocol always works with the 
127
	 * same server
128
	 */
129
	public ServerData getOneServer();
130
}
131

  
0 132

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/drivers/ICatalogServiceDriver.java
1

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

  
45
import org.gvsig.catalog.drivers.profiles.IProfile;
46
import org.gvsig.catalog.querys.CatalogQuery;
47
/**
48
 * This interface has to be implemented by all the classes that implement
49
 * a catalog protocol. It describes all the common operations.
50
 * 
51
 * 
52
 * @author Jorge Piera Llodra (piera_jor@gva.es)
53
 */
54
public interface ICatalogServiceDriver extends IDiscoveryServiceDriver{
55

  
56
	/**
57
	 * It send a request with a query to retrieve the server records
58
     * @return RecordsAnswer Contains the records and additional info
59
	 * @param uri
60
	 * Server URI
61
	 * @param query
62
	 * It contains the values to do the query (title="XXX",abstract="YYY",...)
63
	 * @param firstRecord
64
	 * Number of the first record to retrieve
65
	 */
66
	public GetRecordsReply getRecords(URI uri, CatalogQuery query, int firstRecord);
67

  
68
	/**
69
	 * @return the server profile. A profile is a list of default
70
	 * values for the properties used to create the queries
71
	 */
72
	public IProfile getProfile();
73

  
74
}
75

  
76

  
0 77

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/drivers/DiscoveryServiceCapabilities.java
1
package org.gvsig.catalog.drivers;
2

  
3
import java.util.Properties;
4

  
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
/* CVS MESSAGES:
46
 *
47
 * $Id: DiscoveryServiceCapabilities.java 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $
48
 * $Log$
49
 * Revision 1.1.2.1  2007/07/23 12:52:47  jorpiell
50
 * Refactoring of the capabilities message
51
 *
52
 *
53
 */
54
/**
55
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
56
 */
57
public class DiscoveryServiceCapabilities {
58
	private boolean isAvailable = true;
59
	private String version = null;
60
	private String serverMessage = null;
61
	private Properties properties = null;
62
	
63
	/**
64
	 * @return the isAvailable
65
	 */
66
	public boolean isAvailable() {
67
		return isAvailable;
68
	}
69
	
70
	/**
71
	 * @param isAvailable the isAvailable to set
72
	 */
73
	public void setAvailable(boolean isAvailable) {
74
		this.isAvailable = isAvailable;
75
	}
76
	
77
	/**
78
	 * @return the version
79
	 */
80
	public String getVersion() {
81
		return version;
82
	}
83
	
84
	/**
85
	 * @param version the version to set
86
	 */
87
	public void setVersion(String version) {
88
		this.version = version;
89
	}
90
	
91
	/**
92
	 * @return the serverMessage
93
	 */
94
	public String getServerMessage() {
95
		return serverMessage;
96
	}
97
	
98
	/**
99
	 * @param serverMessage the serverMessage to set
100
	 */
101
	public void setServerMessage(String serverMessage) {
102
		this.serverMessage = serverMessage;
103
	}
104
	
105
	/**
106
	 * @return the properties
107
	 */
108
	public Properties getProperties() {
109
		return properties;
110
	}
111
	
112
	/**
113
	 * @param properties the properties to set
114
	 */
115
	public void setProperties(Properties properties) {
116
		this.properties = properties;
117
	}
118
	
119
}
0 120

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/drivers/IProtocolMessages.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.catalog.drivers;
43
import org.apache.commons.httpclient.NameValuePair;
44
import org.gvsig.catalog.querys.CatalogQuery;
45
/**
46
 * This interface has one method for each operation and for each
47
 * communication protocol. Each method returns the protocol
48
 * message.
49
 * 
50
 * 
51
 * @author Jorge Piera Llodra (piera_jor@gva.es)
52
 */
53
public interface IProtocolMessages {
54
/**
55
 * operation : getCapabilities
56
 * protocol : HTTP GET
57
 * 
58
 * 
59
 * @return NameValuePair with the request parameters
60
 * @param upper If the 'G' of the getCapabilities must be written in uppercase
61
 */
62
    public NameValuePair[] getHTTPGETCapabilities(boolean upper);
63
/**
64
 * operation : describeRecords
65
 * protocol : HTTP GET
66
 * 
67
 * 
68
 * @return NameValuePair with the request parameters
69
 */
70
    public NameValuePair[] getHTTPGETDescribeRecords();
71
/**
72
 * operation : getRecords
73
 * protocol : HTTP GET
74
 * 
75
 * 
76
 * @return NameValuePair with the request parameters
77
 * @param query 
78
 * @param firstRecord 
79
 */
80
    public NameValuePair[] getHTTPGETRecords(CatalogQuery query, int firstRecord);
81
/**
82
 * operation : getCapabilities
83
 * protocol : HTTP POST
84
 * 
85
 * 
86
 * @return String with the POST message
87
 */
88
    public String getHTTPPOSTCapabilities();
89
/**
90
 * operation : describeRecords
91
 * protocol : HTTP POST
92
 * 
93
 * 
94
 * @return String with the POST message
95
 */
96
    public String getHTTPPOSTDescribeRecords();
97
/**
98
 * operation : getRecords
99
 * protocol : HTTP POST
100
 * 
101
 * 
102
 * @return String with the POST message
103
 * @param query 
104
 * @param firstRecord 
105
 */
106
    public String getHTTPPOSTRecords(CatalogQuery query, int firstRecord);
107
/**
108
 * operation : getCapabilities
109
 * protocol : SOAP
110
 * 
111
 * 
112
 * @return String with the SOAP message
113
 */
114
    public String getSOAPCapabilities();
115
/**
116
 * operation : describeRecords
117
 * protocol : SOAP
118
 * 
119
 * 
120
 * @return String with the SOAP message
121
 */
122
    public String getSOAPDescribeRecords();
123
/**
124
 * operation : getRecords
125
 * protocol : SOAP
126
 * 
127
 * 
128
 * @return String with the SOAP message
129
 * @param query 
130
 * @param firstRecord 
131
 */
132
    public String getSOAPRecords(CatalogQuery query, int firstRecord);
133
}
134

  
135

  
0 136

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.215/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/drivers/profiles/AbstractProfile.java
1
package org.gvsig.catalog.drivers.profiles;
2

  
3
import org.gvsig.utils.swing.jcomboServer.ServerData;
4

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

Also available in: Unified diff