Revision 423
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.72/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.72/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.72/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.72/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.72/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.72/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/LaitsGmuEbRIMRecord.java | ||
---|---|---|
1 |
package org.gvsig.catalog.schemas; |
|
2 |
|
|
3 |
import java.net.URI; |
|
4 |
|
|
5 |
import org.gvsig.catalog.metadataxml.XMLNode; |
|
6 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
7 |
import org.gvsig.catalog.querys.Coordinates; |
|
8 |
|
|
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$ |
|
52 |
* $Log$ |
|
53 |
* |
|
54 |
*/ |
|
55 |
/** |
|
56 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
57 |
*/ |
|
58 |
public class LaitsGmuEbRIMRecord extends Record{ |
|
59 |
private static final String ROOT = "laitscsw:DataGranule"; |
|
60 |
|
|
61 |
public LaitsGmuEbRIMRecord() { |
|
62 |
|
|
63 |
} |
|
64 |
|
|
65 |
public LaitsGmuEbRIMRecord(URI uri, XMLNode node) { |
|
66 |
super(uri,node); |
|
67 |
setTitle(node.searchNodeValue("name")); |
|
68 |
setAbstract_(node.searchNodeValue("description")); |
|
69 |
setPurpose(null); |
|
70 |
setKeyWords(null); |
|
71 |
setResources(getResources("OnlineAccessURLs->OnlineAccessURL")); |
|
72 |
setFileID(node.getAttribute("id")); |
|
73 |
setImageURL(node.searchNodeValue("previewURL")); |
|
74 |
} |
|
75 |
|
|
76 |
private Resource[] getResources(String label) { |
|
77 |
XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label); |
|
78 |
|
|
79 |
if (nodes == null) { |
|
80 |
return null; |
|
81 |
} |
|
82 |
|
|
83 |
Coordinates coordinates = null; |
|
84 |
String srs = XMLTree.searchNodeValue(getNode(),"ogc:BBOX->referenceSystemNameCode"); |
|
85 |
coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"ogc:BBOX->westBoundingCoordinate"), |
|
86 |
XMLTree.searchNodeValue(getNode(),"ogc:BBOX->northBoundingCoordinate"), |
|
87 |
XMLTree.searchNodeValue(getNode(),"ogc:BBOX->eastBoundingCoordinate"), |
|
88 |
XMLTree.searchNodeValue(getNode(),"ogc:BBOX->southBoundingCoordinate")); |
|
89 |
|
|
90 |
Resource[] resources = new Resource[nodes.length]; |
|
91 |
|
|
92 |
for (int i = 0; i < resources.length; i++){ |
|
93 |
resources[i] = new Resource(nodes[i].searchNodeValue("URL"), |
|
94 |
Resource.DOWNLOAD, |
|
95 |
null, |
|
96 |
null, |
|
97 |
null, |
|
98 |
srs, |
|
99 |
coordinates); |
|
100 |
if (resources[i].getLinkage() == null){ |
|
101 |
resources[i].setLinkage(""); |
|
102 |
} |
|
103 |
|
|
104 |
} |
|
105 |
return resources; |
|
106 |
} |
|
107 |
|
|
108 |
|
|
109 |
/* |
|
110 |
* (non-Javadoc) |
|
111 |
* @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode) |
|
112 |
*/ |
|
113 |
public boolean accept(URI uri, XMLNode node) { |
|
114 |
System.out.println(node.getName()); |
|
115 |
if (node.getName().equals(ROOT)){ |
|
116 |
return true; |
|
117 |
} |
|
118 |
return false; |
|
119 |
} |
|
120 |
} |
|
0 | 121 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.72/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/DublinCoreRecord.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.schemas; |
|
43 |
import java.net.URI; |
|
44 |
|
|
45 |
import org.gvsig.catalog.metadataxml.XMLNode; |
|
46 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
47 |
import org.gvsig.catalog.querys.Coordinates; |
|
48 |
|
|
49 |
/** |
|
50 |
* This class parses a XMLNode that contains a DublinCore tree |
|
51 |
* |
|
52 |
* |
|
53 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
54 |
*/ |
|
55 |
public class DublinCoreRecord extends Record { |
|
56 |
|
|
57 |
public DublinCoreRecord() { |
|
58 |
|
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* @param node |
|
63 |
*/ |
|
64 |
public DublinCoreRecord(URI uri,XMLNode node) { |
|
65 |
super(uri,node); |
|
66 |
setTitle(XMLTree.searchNodeValue(node,"dc:title")); |
|
67 |
setAbstract_(XMLTree.searchNodeValue(node, "dc:subject")); |
|
68 |
setPurpose(XMLTree.searchNodeValue(node, "dc:description")); |
|
69 |
setResources(getResources(node)); |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* It parses the resource tags |
|
74 |
* |
|
75 |
* |
|
76 |
* @return |
|
77 |
* @param node |
|
78 |
*/ |
|
79 |
public Resource[] getResources(XMLNode node) { |
|
80 |
String format = XMLTree.searchNodeValue(node, "dc:format"); |
|
81 |
String source = XMLTree.searchNodeValue(node, "dc:source"); |
|
82 |
Coordinates coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:westlimit"), |
|
83 |
XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:northlimit"), |
|
84 |
XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:eastlimit"), |
|
85 |
XMLTree.searchNodeValue(getNode(),"dc:spatial->dcmiBox:Box->dcmiBox:southlimit")); |
|
86 |
|
|
87 |
if ((source == null) || (format == null)){ |
|
88 |
return null; |
|
89 |
} |
|
90 |
|
|
91 |
if (format.toLowerCase().equals("shapefile")) |
|
92 |
format = Resource.DOWNLOAD; |
|
93 |
|
|
94 |
if (format.toLowerCase().trim().equals("web page")) |
|
95 |
format = Resource.WEBSITE; |
|
96 |
|
|
97 |
Resource[] resources = new Resource[1]; |
|
98 |
resources[0] = new Resource(source,format,"","","","",coordinates); |
|
99 |
|
|
100 |
return resources; |
|
101 |
} |
|
102 |
|
|
103 |
/* |
|
104 |
* (non-Javadoc) |
|
105 |
* @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode) |
|
106 |
*/ |
|
107 |
public boolean accept(URI uri, XMLNode node) { |
|
108 |
if ((node.getName().equals("dc:metadata")) || |
|
109 |
(node.getName().equals("simpledc")) || |
|
110 |
(node.getName().equals("csw:SummaryRecord")) || |
|
111 |
(node.getName().equals("csw:Record"))){ |
|
112 |
return true; |
|
113 |
} |
|
114 |
return false; |
|
115 |
} |
|
116 |
} |
|
0 | 117 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.72/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/RecordFactory.java | ||
---|---|---|
1 |
package org.gvsig.catalog.schemas; |
|
2 |
|
|
3 |
import java.net.URI; |
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import org.gvsig.catalog.metadataxml.XMLNode; |
|
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: RecordFactory.java 600 2007-09-19 11:30:05 +0000 (Wed, 19 Sep 2007) jpiera $ |
|
51 |
* $Log$ |
|
52 |
* Revision 1.1.2.1 2007/07/23 07:14:24 jorpiell |
|
53 |
* Catalog refactoring |
|
54 |
* |
|
55 |
* |
|
56 |
*/ |
|
57 |
/** |
|
58 |
* This class creates a parsed record from a uri and a |
|
59 |
* XMLNode. |
|
60 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
61 |
*/ |
|
62 |
public class RecordFactory { |
|
63 |
private static ArrayList records = null; |
|
64 |
|
|
65 |
static{ |
|
66 |
records = new ArrayList(); |
|
67 |
records.add(new GeonetworkISO19115Record()); |
|
68 |
records.add(new DeegreeISO19115Record()); |
|
69 |
records.add(new DublinCoreRecord()); |
|
70 |
records.add(new IdecISO19115Record()); |
|
71 |
records.add(new IdeeISO19115Record()); |
|
72 |
records.add(new Iso19139Record()); |
|
73 |
records.add(new Iso19139_119Record()); |
|
74 |
records.add(new LaitsGmuISO19115Record()); |
|
75 |
records.add(new LaitsGmuServicesRecord()); |
|
76 |
records.add(new LaitsGmuEbRIMRecord()); |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Adds a new record |
|
81 |
* @param record |
|
82 |
* New record to add |
|
83 |
*/ |
|
84 |
public static void addRecord(Record record){ |
|
85 |
records.add(record); |
|
86 |
} |
|
87 |
|
|
88 |
|
|
89 |
/** |
|
90 |
* Try to identify the XML format and return a record |
|
91 |
* @param uri |
|
92 |
* Server URI (used to retrieve the images) |
|
93 |
* @param node |
|
94 |
* XML node |
|
95 |
* @return |
|
96 |
*/ |
|
97 |
public static Record createRecord(URI uri, XMLNode node){ |
|
98 |
for (int i=0 ; i<records.size() ; i++){ |
|
99 |
Record record = (Record)records.get(i); |
|
100 |
if (node != null){ |
|
101 |
if (record.accept(uri, node)){ |
|
102 |
Object[] values = {uri, node}; |
|
103 |
Class[] types = {URI.class, XMLNode.class}; |
|
104 |
try { |
|
105 |
return (Record)record.getClass().getConstructor(types).newInstance(values); |
|
106 |
} catch (Exception e) { |
|
107 |
//It the instance can be created the |
|
108 |
//default record has to be returned |
|
109 |
} |
|
110 |
} |
|
111 |
} |
|
112 |
} |
|
113 |
return new UnknownRecord(uri,node); |
|
114 |
} |
|
115 |
} |
|
0 | 116 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.72/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/Resource.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.schemas; |
|
43 |
import org.gvsig.catalog.querys.Coordinates; |
|
44 |
|
|
45 |
/** |
|
46 |
* This class implements a geodata linked by a metadata |
|
47 |
* |
|
48 |
* |
|
49 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
50 |
*/ |
|
51 |
public class Resource { |
|
52 |
|
|
53 |
/** |
|
54 |
* |
|
55 |
* |
|
56 |
*/ |
|
57 |
public static final String WMS = "OGC:WMS"; |
|
58 |
public static final String WMS_SERVICE = "OGC:WMS_SERVICE"; |
|
59 |
/** |
|
60 |
* |
|
61 |
* |
|
62 |
*/ |
|
63 |
public static final String WFS = "OGC:WFS"; |
|
64 |
|
|
65 |
/** |
|
66 |
* |
|
67 |
* |
|
68 |
*/ |
|
69 |
public static final String WCS = "OGC:WCS"; |
|
70 |
|
|
71 |
/** |
|
72 |
* |
|
73 |
* |
|
74 |
*/ |
|
75 |
public static final String POSTGIS = "POSTGIS"; |
|
76 |
|
|
77 |
/** |
|
78 |
* |
|
79 |
* |
|
80 |
*/ |
|
81 |
public static final String ARCIMS_IMAGE = "ESRI:AIMS--HTTP-GET-IMAGE"; |
|
82 |
|
|
83 |
/** |
|
84 |
* |
|
85 |
* |
|
86 |
*/ |
|
87 |
public static final String ARCIMS_VECTORIAL = "ESRI:AIMS--HTTP-GET-FEATURE"; |
|
88 |
|
|
89 |
/** |
|
90 |
* |
|
91 |
* |
|
92 |
*/ |
|
93 |
public static final String WEBSITE = "WWW:LINK"; |
|
94 |
|
|
95 |
/** |
|
96 |
* |
|
97 |
* |
|
98 |
*/ |
|
99 |
public static final String DOWNLOAD = "WWW:DOWNLOAD"; |
|
100 |
/** |
|
101 |
* |
|
102 |
* |
|
103 |
*/ |
|
104 |
public static final String UNKNOWN = "UNKNOWN"; |
|
105 |
|
|
106 |
/** |
|
107 |
* |
|
108 |
* |
|
109 |
*/ |
|
110 |
private String linkage = null; |
|
111 |
|
|
112 |
/** |
|
113 |
* |
|
114 |
* |
|
115 |
*/ |
|
116 |
private String protocol = null; |
|
117 |
|
|
118 |
/** |
|
119 |
* |
|
120 |
* |
|
121 |
*/ |
|
122 |
private String name = null; |
|
123 |
|
|
124 |
/** |
|
125 |
* |
|
126 |
* |
|
127 |
*/ |
|
128 |
private String description = null; |
|
129 |
|
|
130 |
/** |
|
131 |
* |
|
132 |
* |
|
133 |
*/ |
|
134 |
private String function = null; |
|
135 |
|
|
136 |
/** |
|
137 |
* |
|
138 |
* |
|
139 |
*/ |
|
140 |
private String srs = null; |
|
141 |
/** |
|
142 |
* |
|
143 |
* |
|
144 |
*/ |
|
145 |
private Coordinates coordinates = null; |
|
146 |
/** |
|
147 |
* |
|
148 |
* |
|
149 |
*/ |
|
150 |
private String Type = null; |
|
151 |
|
|
152 |
/** |
|
153 |
* |
|
154 |
* |
|
155 |
* |
|
156 |
* @param linkage |
|
157 |
* @param protocol |
|
158 |
* @param name |
|
159 |
* @param description |
|
160 |
* @param function |
|
161 |
* @param srs |
|
162 |
* @param coordinates |
|
163 |
*/ |
|
164 |
public Resource(String linkage, String protocol, String name, String description, String function, String srs, Coordinates coordinates) { |
|
165 |
super(); |
|
166 |
this.linkage = linkage; |
|
167 |
this.protocol = protocol; |
|
168 |
this.name = name; |
|
169 |
this.description = description; |
|
170 |
this.function = function; |
|
171 |
this.srs = srs; |
|
172 |
this.coordinates = coordinates; |
|
173 |
setResourceType(); |
|
174 |
} |
|
175 |
|
|
176 |
/** |
|
177 |
* |
|
178 |
* |
|
179 |
* |
|
180 |
* @return Returns the description. |
|
181 |
*/ |
|
182 |
public String getDescription() { |
|
183 |
return description; |
|
184 |
} |
|
185 |
|
|
186 |
/** |
|
187 |
* |
|
188 |
* |
|
189 |
* |
|
190 |
* @param description The description to set. |
|
191 |
*/ |
|
192 |
public void setDescription(String description) { |
|
193 |
this.description = description; |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
197 |
* |
|
198 |
* |
|
199 |
* |
|
200 |
* @return Returns the function. |
|
201 |
*/ |
|
202 |
public String getFunction() { |
|
203 |
return function; |
|
204 |
} |
|
205 |
|
|
206 |
/** |
|
207 |
* |
|
208 |
* |
|
209 |
* |
|
210 |
* @param function The function to set. |
|
211 |
*/ |
|
212 |
public void setFunction(String function) { |
|
213 |
this.function = function; |
|
214 |
} |
|
215 |
|
|
216 |
/** |
|
217 |
* |
|
218 |
* |
|
219 |
* |
|
220 |
* @return Returns the linkage. |
|
221 |
*/ |
|
222 |
public String getLinkage() { |
|
223 |
return linkage; |
|
224 |
} |
|
225 |
|
|
226 |
/** |
|
227 |
* |
|
228 |
* |
|
229 |
* |
|
230 |
* @param linkage The linkage to set. |
|
231 |
*/ |
|
232 |
public void setLinkage(String linkage) { |
|
233 |
this.linkage = linkage; |
|
234 |
} |
|
235 |
|
|
236 |
/** |
|
237 |
* |
|
238 |
* |
|
239 |
* |
|
240 |
* @return Returns the name. |
|
241 |
*/ |
|
242 |
public String getName() { |
|
243 |
return name; |
|
244 |
} |
|
245 |
|
|
246 |
/** |
|
247 |
* |
|
248 |
* |
|
249 |
* |
|
250 |
* @param name The name to set. |
|
251 |
*/ |
|
252 |
public void setName(String name) { |
|
253 |
this.name = name; |
|
254 |
} |
|
255 |
|
|
256 |
/** |
|
257 |
* |
|
258 |
* |
|
259 |
* |
|
260 |
* @return Returns the protocol. |
|
261 |
*/ |
|
262 |
public String getProtocol() { |
|
263 |
return protocol; |
|
264 |
} |
|
265 |
|
|
266 |
/** |
|
267 |
* |
|
268 |
* |
|
269 |
* |
|
270 |
* @param protocol The protocol to set. |
|
271 |
*/ |
|
272 |
public void setProtocol(String protocol) { |
|
273 |
this.protocol = protocol; |
|
274 |
} |
|
275 |
|
|
276 |
/** |
|
277 |
* |
|
278 |
* |
|
279 |
* |
|
280 |
* @return Returns the srs. |
|
281 |
*/ |
|
282 |
public String getSrs() { |
|
283 |
return srs; |
|
284 |
} |
|
285 |
|
|
286 |
/** |
|
287 |
* |
|
288 |
* |
|
289 |
* |
|
290 |
* @param srs The srs to set. |
|
291 |
*/ |
|
292 |
public void setSrs(String srs) { |
|
293 |
this.srs = srs; |
|
294 |
} |
|
295 |
|
|
296 |
/** |
|
297 |
* |
|
298 |
* |
|
299 |
* |
|
300 |
* @return Returns the coordinates. |
|
301 |
*/ |
|
302 |
public Coordinates getCoordinates() { |
|
303 |
return coordinates; |
|
304 |
} |
|
305 |
|
|
306 |
/** |
|
307 |
* |
|
308 |
* |
|
309 |
* |
|
310 |
* @param coordinates The coordinates to set. |
|
311 |
*/ |
|
312 |
public void setCoordinates(Coordinates coordinates) { |
|
313 |
this.coordinates = coordinates; |
|
314 |
} |
|
315 |
/** |
|
316 |
* |
|
317 |
* |
|
318 |
* |
|
319 |
* @return Returns the typr. |
|
320 |
*/ |
|
321 |
public String getType() { |
|
322 |
return Type; |
|
323 |
} |
|
324 |
/** |
|
325 |
* |
|
326 |
* |
|
327 |
* |
|
328 |
* @return Returns the type |
|
329 |
*/ |
|
330 |
public void setType(String type) { |
|
331 |
Type = type; |
|
332 |
} |
|
333 |
|
|
334 |
public void setResourceType(){ |
|
335 |
try{ |
|
336 |
if (getProtocol().toUpperCase().indexOf(Resource.WCS) >= 0){ |
|
337 |
setType(Resource.WCS); |
|
338 |
}else if (getProtocol().toUpperCase().indexOf(Resource.WMS) >= 0){ |
|
339 |
setType(Resource.WMS); |
|
340 |
}else if (getProtocol().toUpperCase().indexOf(Resource.WFS) >= 0){ |
|
341 |
setType(Resource.WFS); |
|
342 |
}else if (getProtocol().toUpperCase().indexOf(Resource.POSTGIS) >= 0){ |
|
343 |
setType(Resource.POSTGIS); |
|
344 |
}else if (getProtocol().toUpperCase().indexOf(Resource.WEBSITE) >= 0){ |
|
345 |
setType(Resource.WEBSITE); |
|
346 |
}else if (getProtocol().toUpperCase().indexOf(Resource.DOWNLOAD) >= 0){ |
|
347 |
setType(Resource.DOWNLOAD); |
|
348 |
}else if (getProtocol().toUpperCase().indexOf(Resource.ARCIMS_IMAGE) >= 0){ |
|
349 |
setType(Resource.ARCIMS_IMAGE); |
|
350 |
}else if (getProtocol().toUpperCase().indexOf(Resource.ARCIMS_VECTORIAL) >= 0){ |
|
351 |
setType(Resource.ARCIMS_VECTORIAL); |
|
352 |
}else{ |
|
353 |
setType(Resource.UNKNOWN); |
|
354 |
} |
|
355 |
}catch(NullPointerException e){ |
|
356 |
setType(Resource.UNKNOWN); |
|
357 |
} |
|
358 |
} |
|
359 |
} |
|
0 | 360 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.72/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/LaitsGmuServicesRecord.java | ||
---|---|---|
1 |
package org.gvsig.catalog.schemas; |
|
2 |
|
|
3 |
import java.net.URI; |
|
4 |
|
|
5 |
import org.gvsig.catalog.metadataxml.XMLNode; |
|
6 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
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: LaitsGmuServicesRecord.java 600 2007-09-19 11:30:05 +0000 (Wed, 19 Sep 2007) jpiera $ |
|
51 |
* $Log$ |
|
52 |
* Revision 1.1.2.1 2007/07/23 07:14:24 jorpiell |
|
53 |
* Catalog refactoring |
|
54 |
* |
|
55 |
* Revision 1.1.2.2.4.2 2007/07/11 13:01:51 jorpiell |
|
56 |
* Catalog UI updated |
|
57 |
* |
|
58 |
* Revision 1.1.2.2.4.1 2007/07/10 11:18:04 jorpiell |
|
59 |
* Added the registers |
|
60 |
* |
|
61 |
* Revision 1.1.2.2 2006/11/15 00:08:08 jjdelcerro |
|
62 |
* *** empty log message *** |
|
63 |
* |
|
64 |
* Revision 1.2 2006/11/13 10:01:01 jorpiell |
|
65 |
* Nuevos parsers para el servidor de GMU |
|
66 |
* |
|
67 |
* Revision 1.1.2.1 2006/11/08 12:57:12 jorpiell |
|
68 |
* Se han hecho numerosos cambios para que pueda funcionar el nomenclator de Simon y el cat?logo de GMU |
|
69 |
* |
|
70 |
* |
|
71 |
*/ |
|
72 |
/** |
|
73 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
74 |
*/ |
|
75 |
public class LaitsGmuServicesRecord extends Record { |
|
76 |
|
|
77 |
public LaitsGmuServicesRecord() { |
|
78 |
|
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* Constructor |
|
83 |
* |
|
84 |
* |
|
85 |
* @param node Node with the answer |
|
86 |
* @param serverURI Server URL. Necessary to load the image (just Geonetwork) |
|
87 |
*/ |
|
88 |
public LaitsGmuServicesRecord(URI uri,XMLNode node) { |
|
89 |
super(uri,node); |
|
90 |
setTitle(XMLTree.searchNodeValue(node,"name")); |
|
91 |
setAbstract_(XMLTree.searchNodeValue(node, "description")); |
|
92 |
setPurpose(null); |
|
93 |
setKeyWords(null); |
|
94 |
setResources(getResources(node)); |
|
95 |
setFileID(null); |
|
96 |
//Caution: getImageUrl uses serverURL and FileID!!! |
|
97 |
setImage(null); |
|
98 |
|
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* |
|
103 |
* |
|
104 |
* |
|
105 |
* @return |
|
106 |
* @param label |
|
107 |
*/ |
|
108 |
private Resource[] getResources(XMLNode node) { |
|
109 |
XMLNode[] slots = XMLTree.searchMultipleNode(node, "rim:Slot"); |
|
110 |
if (slots != null){ |
|
111 |
Resource[] resources = new Resource[1]; |
|
112 |
String resource = null; |
|
113 |
String serviceType = null; |
|
114 |
for (int i=0 ; i<slots.length ; i++){ |
|
115 |
XMLNode slot = slots[i]; |
|
116 |
String attType = slot.getAttribute("name"); |
|
117 |
if (attType.equals("connectPointLinkage")){ |
|
118 |
resource = XMLTree.searchNodeValue(slot,"rim:ValueList->rim:Value"); |
|
119 |
}else if(attType.equals("serviceType")){ |
|
120 |
serviceType = XMLTree.searchNodeValue(slot,"rim:ValueList->rim:Value"); |
|
121 |
} |
|
122 |
} |
|
123 |
resources[0] = new Resource(resource,getProtocol(serviceType),null,null,null,null,null); |
|
124 |
return resources; |
|
125 |
}else{ |
|
126 |
return new Resource[0]; |
|
127 |
} |
|
128 |
|
|
129 |
// for (int i = 0; i < resources.length; i++){ |
|
130 |
// resources[i] = new Resource(XMLTree.searchNodeValue(nodes[i], |
|
131 |
// "URL"), |
|
132 |
// Resource.DOWNLOAD, |
|
133 |
// XMLTree.searchNodeValue(nodes[i], "orName"), |
|
134 |
// XMLTree.searchNodeValue(nodes[i], "URLDescription"), |
|
135 |
// XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd", |
|
136 |
// "value"), |
|
137 |
// srs, |
|
138 |
// coordinates); |
|
139 |
// if (resources[i].getLinkage() == null){ |
|
140 |
// resources[i].setLinkage(""); |
|
141 |
// } |
|
142 |
|
|
143 |
// } |
|
144 |
|
|
145 |
|
|
146 |
// return resources; |
|
147 |
} |
|
148 |
|
|
149 |
private String getProtocol(String serviceType) { |
|
150 |
if (serviceType == null){ |
|
151 |
return Resource.UNKNOWN; |
|
152 |
} |
|
153 |
if (serviceType.compareTo("WMS")==0){ |
|
154 |
return Resource.WMS; |
|
155 |
}else if (serviceType.compareTo("WCS")==0){ |
|
156 |
return Resource.WCS; |
|
157 |
}else if (serviceType.compareTo("WFS")==0){ |
|
158 |
return Resource.WFS; |
|
159 |
}else if (serviceType.compareTo("urn:uuid:677F6003-E6E0-4B5C-B930-09B36EF6E0FB")==0){ |
|
160 |
return Resource.WMS; |
|
161 |
} |
|
162 |
return Resource.UNKNOWN; |
|
163 |
} |
|
164 |
|
|
165 |
/* |
|
166 |
* (non-Javadoc) |
|
167 |
* @see es.gva.cit.catalogClient.schemas.discoverer.Record#accept(java.net.URI, es.gva.cit.catalogClient.metadataxml.XMLNode) |
|
168 |
*/ |
|
169 |
public boolean accept(URI uri, XMLNode node) { |
|
170 |
if (node.getName().equals("rim:Service")){ |
|
171 |
return true; |
|
172 |
} |
|
173 |
return false; |
|
174 |
} |
|
175 |
} |
|
176 |
|
|
0 | 177 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.72/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/schemas/Iso19139_119Record.java | ||
---|---|---|
1 |
package org.gvsig.catalog.schemas; |
|
2 |
|
|
3 |
import java.net.URI; |
|
4 |
|
|
5 |
import org.gvsig.catalog.metadataxml.XMLNode; |
|
6 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
7 |
import org.gvsig.catalog.querys.Coordinates; |
|
8 |
/** |
|
9 |
* ISO 19139/119 catalog record |
|
10 |
* It creates resources(layers) from MD_Distribution and resources(services) from SV_ServiceIdentification |
|
11 |
* |
|
12 |
* @author jvhigon |
|
13 |
* |
|
14 |
*/ |
|
15 |
public class Iso19139_119Record extends Record{ |
|
16 |
|
|
17 |
public Iso19139_119Record() { |
|
18 |
|
|
19 |
} |
|
20 |
|
|
21 |
/** |
|
22 |
* Constructor |
|
23 |
* @param node Node with the answer |
|
24 |
* @param serverURI Server URL. Necessary to load the image (just Geonetwork) |
|
25 |
*/ |
|
26 |
public Iso19139_119Record(URI uri, XMLNode node) { |
|
27 |
super(uri,node); |
|
28 |
setTitle(node.searchNodeValue( |
|
29 |
"identificationInfo->SV_ServiceIdentification->citation->CI_Citation->title->CharacterString")); |
|
30 |
setAbstract_(node.searchNodeValue("identificationInfo->SV_ServiceIdentification->abstract->gco:CharacterString")); |
|
31 |
setPurpose(node.searchNodeValue("dataIdInfo->idPurp")); |
|
32 |
setKeyWords(node.searchMultipleNodeValue( |
|
33 |
"identificationInfo->SV_ServiceIdentification->descriptiveKeywords->MD_Keywords->keyword->gco:CharacterString")); |
|
34 |
setResources(getResources("distributionInfo->MD_Distribution->transferOptions->MD_DigitalTransferOptions->onLine->CI_OnlineResource", |
|
35 |
"identificationInfo->SV_ServiceIdentification")); |
|
36 |
setFileID(node.searchNodeValue("mdFileID")); |
|
37 |
setImageURL(node.searchNodeValue("dataIdInfo->graphOver")); |
|
38 |
|
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* |
|
43 |
* |
|
44 |
* |
|
45 |
* @return |
|
46 |
* @param label |
|
47 |
*/ |
|
48 |
private Resource[] getResources(String label_layers, String label_services) { |
|
49 |
//compute onlineresources |
|
50 |
XMLNode[] nodes = XMLTree.searchMultipleNode(getNode(), label_layers); |
|
51 |
Coordinates coordinates = null; |
|
52 |
String srs = null; |
|
53 |
|
|
54 |
if (nodes == null) { |
|
55 |
return null; |
|
56 |
} |
|
57 |
//size of resources = all onlineresources + one service |
|
58 |
Resource[] resources = new Resource[nodes.length + 1]; |
|
59 |
if (nodes.length > 0){ |
|
60 |
srs = XMLTree.searchNodeValue(getNode(),"refSysInfo->MdCoRefSys->refSysID->identCode"); |
|
61 |
coordinates = new Coordinates(XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->westBL"), |
|
62 |
XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->northBL"), |
|
63 |
XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->eastBL"), |
|
64 |
XMLTree.searchNodeValue(getNode(),"dataIdInfo->geoBox->southBL")); |
|
65 |
} |
|
66 |
|
|
67 |
|
|
68 |
for (int i = 0; i < resources.length -1; i++){ |
|
69 |
String linkage=XMLTree.searchNodeValue(nodes[i], "linkage->URL"); |
|
70 |
String protocol=XMLTree.searchNodeValue(nodes[i], "protocol->gco:CharacterString"); |
|
71 |
String name=XMLTree.searchNodeValue(nodes[i], "name->gco:CharacterString"); |
|
72 |
//String description=XMLTree.searchNodeValue(nodes[i], "orDesc"); |
|
73 |
String description=XMLTree.searchNodeValue(nodes[i], "description->gco:CharacterString"); |
|
74 |
String function=XMLTree.searchNodeAtribute(nodes[i], "orFunct->OnFunctCd","value"); |
|
75 |
|
|
76 |
if (linkage==null){ |
|
77 |
linkage=""; |
|
78 |
} |
|
79 |
if (protocol==null){ |
|
80 |
protocol=""; |
|
81 |
} |
|
82 |
if (name==null){ |
|
83 |
name=""; |
|
84 |
} |
|
85 |
if (description==null){ |
|
86 |
description=""; |
|
87 |
} |
|
88 |
if (function==null){ |
|
89 |
function=""; |
|
90 |
} |
|
91 |
|
|
92 |
resources[i] = new Resource(linkage, |
|
93 |
protocol, |
|
94 |
name, |
|
95 |
description, |
|
96 |
function, |
|
97 |
srs, |
|
98 |
coordinates); |
|
99 |
|
|
100 |
} |
|
101 |
//compute service |
|
102 |
XMLNode node = XMLTree.searchNode(getNode(), label_services); |
|
103 |
if (node == null){ |
|
104 |
return null; |
|
105 |
} |
|
106 |
String service_name = XMLTree.searchNodeValue(node, "srv:serviceType->gco:LocalName"); |
|
107 |
Object operations = XMLTree.searchMultipleNodeValue(node, "srv:containsOperations->srv:SV_OperationMetadata->srv:operationName->gco:CharacterString"); |
|
108 |
XMLNode[] operations_nodes= XMLTree.searchMultipleNode(node, "srv:containsOperations->srv:SV_OperationMetadata"); |
|
109 |
String capabilities_url=""; |
|
110 |
for (int i = 0; i < operations_nodes.length; i++){ |
|
111 |
String operation_name= XMLTree.searchNodeValue(operations_nodes[i], "srv:operationName->gco:CharacterString"); |
|
112 |
if (operation_name.toUpperCase().equals("GETCAPABILITIES")){ |
|
113 |
capabilities_url=XMLTree.searchNodeValue(operations_nodes[i], "srv:connectPoint->gmd:CI_OnlineResource->gmd:linkage->gmd:URL"); |
|
114 |
break; |
|
115 |
} |
|
116 |
} |
|
117 |
//service_name = XMLTree.searchNode(node, "serviceType->gco:LocalName").getText(); |
Also available in: Unified diff