Revision 585
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/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.104/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.104/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.104/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.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/HTTPGetProtocol.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.protocols; |
|
43 |
import java.io.File; |
|
44 |
import java.net.URL; |
|
45 |
import java.util.Collection; |
|
46 |
|
|
47 |
import org.apache.commons.httpclient.NameValuePair; |
|
48 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
49 |
import org.gvsig.remoteclient.utils.Utilities; |
|
50 |
|
|
51 |
/** |
|
52 |
* |
|
53 |
* |
|
54 |
* |
|
55 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
56 |
*/ |
|
57 |
public class HTTPGetProtocol implements IProtocols { |
|
58 |
|
|
59 |
/** |
|
60 |
* |
|
61 |
* |
|
62 |
* |
|
63 |
* @return |
|
64 |
* @param url |
|
65 |
* @param object |
|
66 |
* @param firstRecord |
|
67 |
*/ |
|
68 |
public Collection doQuery(URL url, Object object, int firstRecord) { |
|
69 |
NameValuePair[] parameters = (NameValuePair[]) object; |
|
70 |
File file = null; |
|
71 |
|
|
72 |
String sUrl = "http://" + url.getHost() + ":" + |
|
73 |
url.getPort() + url.getPath(); |
|
74 |
sUrl = sUrl + createURLParams(parameters); |
|
75 |
|
|
76 |
try { |
|
77 |
file = Utilities.downloadFile(new URL(sUrl), |
|
78 |
"catalog-", null); |
|
79 |
|
|
80 |
} catch (Exception e) { |
|
81 |
return null; |
|
82 |
} |
|
83 |
|
|
84 |
Collection col = new java.util.ArrayList(); |
|
85 |
col.add(XMLTree.xmlToTree(file)); |
|
86 |
return col; |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Create and string for a list of params |
|
91 |
* @param params |
|
92 |
* @return |
|
93 |
*/ |
|
94 |
private String createURLParams(NameValuePair[] params){ |
|
95 |
StringBuffer buffer = new StringBuffer(); |
|
96 |
for (int i=0 ; i<params.length ; i++){ |
|
97 |
if (i==0){ |
|
98 |
buffer.append("?"); |
|
99 |
}else{ |
|
100 |
buffer.append("&"); |
|
101 |
} |
|
102 |
buffer.append(params[i].getName()); |
|
103 |
buffer.append("="); |
|
104 |
buffer.append(params[i].getValue()); |
|
105 |
} |
|
106 |
return buffer.toString(); |
|
107 |
} |
|
108 |
|
|
109 |
} |
|
0 | 110 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/Z3950ConnectionFactory.java | ||
---|---|---|
1 |
package org.gvsig.catalog.protocols; |
|
2 |
|
|
3 |
import java.net.URI; |
|
4 |
import java.util.Hashtable; |
|
5 |
|
|
6 |
import org.jzkit.search.provider.iface.SearchException; |
|
7 |
import org.jzkit.search.provider.iface.Searchable; |
|
8 |
import org.jzkit.search.provider.z3950.Z3950ServiceFactory; |
|
9 |
import org.springframework.context.ApplicationContext; |
|
10 |
import org.springframework.context.support.FileSystemXmlApplicationContext; |
|
11 |
|
|
12 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
13 |
* |
|
14 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
15 |
* |
|
16 |
* This program is free software; you can redistribute it and/or |
|
17 |
* modify it under the terms of the GNU General Public License |
|
18 |
* as published by the Free Software Foundation; either version 2 |
|
19 |
* of the License, or (at your option) any later version. |
|
20 |
* |
|
21 |
* This program is distributed in the hope that it will be useful, |
|
22 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24 |
* GNU General Public License for more details. |
|
25 |
* |
|
26 |
* You should have received a copy of the GNU General Public License |
|
27 |
* along with this program; if not, write to the Free Software |
|
28 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
29 |
* |
|
30 |
* For more information, contact: |
|
31 |
* |
|
32 |
* Generalitat Valenciana |
|
33 |
* Conselleria d'Infraestructures i Transport |
|
34 |
* Av. Blasco Ib??ez, 50 |
|
35 |
* 46010 VALENCIA |
|
36 |
* SPAIN |
|
37 |
* |
|
38 |
* +34 963862235 |
|
39 |
* gvsig@gva.es |
|
40 |
* www.gvsig.gva.es |
|
41 |
* |
|
42 |
* or |
|
43 |
* |
|
44 |
* IVER T.I. S.A |
|
45 |
* Salamanca 50 |
|
46 |
* 46005 Valencia |
|
47 |
* Spain |
|
48 |
* |
|
49 |
* +34 963163400 |
|
50 |
* dac@iver.es |
|
51 |
*/ |
|
52 |
/* CVS MESSAGES: |
|
53 |
* |
|
54 |
* $Id: Z3950ConnectionFactory.java 568 2007-07-27 07:23:27 +0000 (Fri, 27 Jul 2007) jpiera $ |
|
55 |
* $Log$ |
|
56 |
* Revision 1.1.2.2.4.2 2007/07/13 12:00:35 jorpiell |
|
57 |
* Add the posibility to add a new panel |
|
58 |
* |
|
59 |
* Revision 1.1.2.2.4.1 2007/07/10 11:18:04 jorpiell |
|
60 |
* Added the registers |
|
61 |
* |
|
62 |
* Revision 1.1.2.2 2006/11/15 00:08:08 jjdelcerro |
|
63 |
* *** empty log message *** |
|
64 |
* |
|
65 |
* Revision 1.2 2006/10/02 08:29:07 jorpiell |
|
66 |
* Modificados los cambios del Branch 10 al head |
|
67 |
* |
|
68 |
* Revision 1.1.2.1 2006/09/20 12:01:07 jorpiell |
|
69 |
* Se ha cambiado la versi?n de la jzkit, se ha incorporado la funcionalidad de cargar arcims |
|
70 |
* |
|
71 |
* Revision 1.1 2006/09/20 11:20:17 jorpiell |
|
72 |
* Se ha cambiado la versi?n de la librer?a jzkit de la 1 a la 2.0 |
|
73 |
* |
|
74 |
* |
|
75 |
*/ |
|
76 |
/** |
|
77 |
* This factory creates Z39.50 connections |
|
78 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
79 |
*/ |
|
80 |
public class Z3950ConnectionFactory { |
|
81 |
private static ApplicationContext app_context = null; |
|
82 |
private static boolean appContextInitialized = false; |
|
83 |
private static Z3950ServiceFactory factory = null; |
|
84 |
private static Hashtable connections = new Hashtable(); |
|
85 |
|
|
86 |
public static Z3950Connection getConnection(URI uri){ |
|
87 |
Z3950Connection connection = (Z3950Connection)connections.get(uri); |
|
88 |
if (connection == null){ |
|
89 |
connection = new Z3950Connection(uri); |
|
90 |
connections.put(uri,connection); |
|
91 |
} |
|
92 |
return connection; |
|
93 |
} |
|
94 |
|
|
95 |
public static Searchable getSearchable(URI uri) throws SearchException{ |
|
96 |
if (!(appContextInitialized)){ |
|
97 |
initAppContext(uri); |
|
98 |
factory = new Z3950ServiceFactory(); |
|
99 |
factory.setApplicationContext(app_context); |
|
100 |
factory.setDefaultRecordSyntax("usmarc"); |
|
101 |
factory.setDefaultElementSetName("F"); |
|
102 |
factory.getRecordArchetypes().put("Default","usmarc::F"); |
|
103 |
factory.getRecordArchetypes().put("FullDisplay","usmarc::F"); |
|
104 |
factory.getRecordArchetypes().put("BriefDisplay","usmarc::B"); |
|
105 |
factory.getRecordArchetypes().put("Holdings","usmarc::F"); |
|
106 |
} |
|
107 |
factory.setHost(uri.getHost()); |
|
108 |
factory.setPort(uri.getPort()); |
|
109 |
Searchable s = factory.newSearchable(); |
|
110 |
s.setApplicationContext(app_context); |
|
111 |
return s; |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* Initialize the application context |
|
116 |
* @param url |
|
117 |
*/ |
|
118 |
private static void initAppContext(URI uri){ |
|
119 |
System.setProperty("javax.xml.parsers.DocumentBuilderFactory","org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); |
|
120 |
try{ |
|
121 |
app_context = new FileSystemXmlApplicationContext(new String[]{"config/ApplicationContextAlone.xml"},false); |
|
122 |
((FileSystemXmlApplicationContext)app_context).setClassLoader(Z3950ConnectionFactory.class.getClassLoader()); |
|
123 |
((FileSystemXmlApplicationContext)app_context).refresh(); |
|
124 |
}catch(Exception e){ |
|
125 |
e.printStackTrace(); |
|
126 |
app_context = new FileSystemXmlApplicationContext(new String[]{"gvSIG/extensiones/es.gva.cit.gvsig.catalogClient/config/ApplicationContext.xml"},false); |
|
127 |
((FileSystemXmlApplicationContext)app_context).setClassLoader(Z3950ConnectionFactory.class.getClassLoader()); |
|
128 |
((FileSystemXmlApplicationContext)app_context).refresh(); |
|
129 |
} |
|
130 |
|
|
131 |
if (app_context == null){ |
|
132 |
throw new RuntimeException("Unable to locate TestApplicationContext.xml definition file"); |
|
133 |
} |
|
134 |
appContextInitialized = true; |
|
135 |
} |
|
136 |
|
|
137 |
} |
|
0 | 138 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/GetImageFromWeb.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.protocols; |
|
43 |
import java.awt.image.BufferedImage; |
|
44 |
import java.io.File; |
|
45 |
import java.io.IOException; |
|
46 |
import java.net.MalformedURLException; |
|
47 |
import java.net.URL; |
|
48 |
|
|
49 |
import javax.imageio.ImageIO; |
|
50 |
|
|
51 |
/** |
|
52 |
* This class is used lo load an image from a URL. It saves the image |
|
53 |
* in a file |
|
54 |
* |
|
55 |
* |
|
56 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
57 |
*/ |
|
58 |
public class GetImageFromWeb { |
|
59 |
|
|
60 |
/** |
|
61 |
* It saves an image in a file |
|
62 |
* |
|
63 |
* |
|
64 |
* @return |
|
65 |
* @param sUrl URL that contains the image |
|
66 |
* @param sfile File to save the image |
|
67 |
*/ |
|
68 |
public boolean getImageUrl(String sUrl, String sfile) { |
|
69 |
URL url; |
|
70 |
try { |
|
71 |
url = new URL(sUrl); |
|
72 |
BufferedImage img = ImageIO.read(url); |
|
73 |
|
|
74 |
if (img == null) |
|
75 |
return false; |
|
76 |
|
|
77 |
File outFile = new File(sfile); |
|
78 |
|
|
79 |
//We must to change this value: getCapabalilities request |
|
80 |
//has the supported formats |
|
81 |
return ImageIO.write(img, "jpeg", outFile); |
|
82 |
} catch (MalformedURLException e) { |
|
83 |
// TODO Auto-generated catch block |
|
84 |
System.out.println("La URL de la imagen no es correcta"); |
|
85 |
} catch (IOException e1) { |
|
86 |
// TODO Auto-generated catch block |
|
87 |
System.out.println("No he podido leer la imagen desde la URL"); |
|
88 |
} |
|
89 |
return false; |
|
90 |
} |
|
91 |
} |
|
0 | 92 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/SOAPProtocol.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.protocols; |
|
43 |
import java.io.BufferedReader; |
|
44 |
import java.io.ByteArrayInputStream; |
|
45 |
import java.io.File; |
|
46 |
import java.io.FileWriter; |
|
47 |
import java.io.InputStream; |
|
48 |
import java.net.URL; |
|
49 |
import java.util.Collection; |
|
50 |
|
|
51 |
import javax.xml.parsers.DocumentBuilder; |
|
52 |
|
|
53 |
import org.apache.soap.Constants; |
|
54 |
import org.apache.soap.Envelope; |
|
55 |
import org.apache.soap.SOAPException; |
|
56 |
import org.apache.soap.messaging.Message; |
|
57 |
import org.apache.soap.transport.SOAPTransport; |
|
58 |
import org.apache.soap.util.xml.XMLParserUtils; |
|
59 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
60 |
import org.w3c.dom.Document; |
|
61 |
import org.xml.sax.InputSource; |
|
62 |
|
|
63 |
/** |
|
64 |
* |
|
65 |
* |
|
66 |
* |
|
67 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
68 |
*/ |
|
69 |
public class SOAPProtocol implements IProtocols { |
|
70 |
|
|
71 |
/** |
|
72 |
* |
|
73 |
* |
|
74 |
* |
|
75 |
* @return |
|
76 |
* @param url |
|
77 |
* @param object |
|
78 |
* @param firstRecord |
|
79 |
*/ |
|
80 |
public Collection doQuery(URL url, Object object, int firstRecord) { |
|
81 |
String message = (String) object; |
|
82 |
File fileAnswer = null; |
|
83 |
|
|
84 |
//get the envelope to send |
|
85 |
try { |
|
86 |
InputStream buffer = new ByteArrayInputStream(message.getBytes()); |
|
87 |
DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder(); |
|
88 |
Document doc = xdb.parse(new InputSource(buffer)); |
|
89 |
if (doc == null) { |
|
90 |
throw new SOAPException(Constants.FAULT_CODE_CLIENT, |
|
91 |
"parsing error"); |
|
92 |
} |
|
93 |
Envelope msgEnv = Envelope.unmarshall(doc.getDocumentElement()); |
|
94 |
// send the message |
|
95 |
Message msg = new Message(); |
|
96 |
msg.send(url, "urn:this-is-the-action-uri", msgEnv); |
|
97 |
// receive whatever from the transport and dump it to the screen |
|
98 |
SOAPTransport st = msg.getSOAPTransport(); |
|
99 |
BufferedReader br = st.receive(); |
|
100 |
String line; |
|
101 |
//File to save the answer |
|
102 |
fileAnswer = new File("auxiliar"); |
|
103 |
FileWriter fwAnswer = new FileWriter(fileAnswer); |
|
104 |
fwAnswer.write("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); |
|
105 |
//Process the answer |
|
106 |
while ((line = br.readLine()) != null) { |
|
107 |
System.out.println(line); |
|
108 |
fwAnswer.write(line); |
|
109 |
fwAnswer.flush(); |
|
110 |
} |
|
111 |
fwAnswer.close(); |
|
112 |
|
|
113 |
|
|
114 |
} catch (Exception e) { |
|
115 |
return null; |
|
116 |
} |
|
117 |
Collection col = new java.util.ArrayList(); |
|
118 |
col.add(XMLTree.xmlToTree(fileAnswer)); |
|
119 |
return col; |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* |
|
124 |
* |
|
125 |
* |
|
126 |
* @return |
|
127 |
* @param url |
|
128 |
*/ |
|
129 |
public static boolean isProtocolSupported(URL url) { |
|
130 |
return true; |
|
131 |
} |
|
132 |
|
|
133 |
/** |
|
134 |
* This function returns a SOAP message |
|
135 |
* |
|
136 |
* |
|
137 |
* @return |
|
138 |
* @param message the XML message |
|
139 |
* @param schemas |
|
140 |
*/ |
|
141 |
public static String setSOAPMessage(String message, String[] schemas) { |
|
142 |
String soap = "<SOAP:Envelope xmlns:SOAP=\"http://schemas.xmlsoap.org/soap/envelope/\" " + |
|
143 |
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" ; |
|
144 |
if (schemas != null){ |
|
145 |
for (int i=0 ; i<schemas.length ; i++){ |
|
146 |
soap = soap + " " + schemas[i]; |
|
147 |
} |
|
148 |
} |
|
149 |
soap = soap + ">"; |
|
150 |
soap = soap + "<SOAP:Body>" + message + "</SOAP:Body>" + "</SOAP:Envelope>"; |
|
151 |
return soap; |
|
152 |
|
|
153 |
} |
|
154 |
} |
|
0 | 155 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/context/InternalAttrTypes.properties | ||
---|---|---|
1 |
bib-1.1=AccessPoint |
|
2 |
bib-1.2=Relation |
|
3 |
bib-1.3=Position |
|
4 |
bib-1.4=Structure |
|
5 |
bib-1.5=Truncation |
|
6 |
bib-1.6=Completeness |
|
7 |
gils.1=AccessPoint |
|
8 |
gils.10=SpatialQualifier |
|
0 | 9 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/context/a2j.properties | ||
---|---|---|
1 |
# Default OID Configuration file |
|
2 |
# |
|
3 |
# $Id: a2j.properties 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $ |
|
4 |
# |
|
5 |
|
|
6 |
# Attribute Set OID's |
|
7 |
|
|
8 |
# Bib-1 Attribute Set |
|
9 |
oid.bib-1={1,2,840,10003,3,1} |
|
10 |
|
|
11 |
# Explain Attribute Set |
|
12 |
oid.exp-1={1,2,840,10003,3,2} |
|
13 |
|
|
14 |
oid.ext-1={1,2,840,10003,3,3} |
|
15 |
|
|
16 |
oid.ccl={1,2,840,10003,3,4} |
|
17 |
|
|
18 |
oid.gils_attrset={1,2,840,10003,3,5} |
|
19 |
|
|
20 |
oid.stas={1,2,840,10003,3,6} |
|
21 |
|
|
22 |
oid.collect1={1,2,840,10003,3,7} |
|
23 |
|
|
24 |
oid.cimi={1,2,840,10003,3,8} |
|
25 |
|
|
26 |
oid.geo={1,2,840,10003,3,9} |
|
27 |
|
|
28 |
oid.zbig={1,2,840,10003,3,10} |
|
29 |
|
|
30 |
oid.util={1,2,840,10003,3,11} |
|
31 |
|
|
32 |
oid.xd1={1,2,840,10003,3,12} |
|
33 |
name.xd1=Cross Domain Attribute Set |
|
34 |
|
|
35 |
oid.zthes={1,2,840,10003,3,13} |
|
36 |
name.zthes=Thesaurus Attribute Set |
|
37 |
|
|
38 |
oid.holdings={1,2,840,10003,3,16} |
|
39 |
name.holdings=Holdings Attribute Set |
|
40 |
|
|
41 |
|
|
42 |
# Record Syntax OID's |
|
43 |
|
|
44 |
oid.unimarc={1,2,840,10003,5,1} |
|
45 |
name.unimarc=UNIMarc Record |
|
46 |
|
|
47 |
oid.usmarc={1,2,840,10003,5,10} |
|
48 |
name.usmarc=US Marc Record |
|
49 |
|
|
50 |
oid.marc21={1,2,840,10003,5,10} |
|
51 |
name.marc21=Marc21 Record |
|
52 |
|
|
53 |
oid.ukmarc={1,2,840,10003,5,11} |
|
54 |
name.ukmark=UK Marc Record |
|
55 |
|
|
56 |
oid.normarc={1,2,840,10003,5,12} |
|
57 |
name.normarc=NorMarc Record |
|
58 |
|
|
59 |
oid.librismarc={1,2,840,10003,5,13} |
|
60 |
name.librismarc=LibrisMarc Record |
|
61 |
|
|
62 |
oid.danmarc={1,2,840,10003,5,14} |
|
63 |
|
|
64 |
oid.finmarc={1,2,840,10003,5,15} |
|
65 |
|
|
66 |
oid.canmarc={1,2,840,10003,5,17} |
|
67 |
|
|
68 |
oid.ausmarc={1,2,840,10003,5,20} |
|
69 |
|
|
70 |
oid.ibermarc={1,2,840,10003,5,21} |
|
71 |
name.ibermarc=IberMarc Record |
|
72 |
|
|
73 |
oid.catmarc={1,2,840,10003,5,22} |
|
74 |
name.catmarc=CatMarc Record |
|
75 |
|
|
76 |
oid.explain={1,2,840,10003,5,100} |
|
77 |
name.explain=Explain Record |
|
78 |
codec.explain=org.jzkit.z3950.gen.v3.RecordSyntax_explain.Explain_Record_codec |
|
79 |
|
|
80 |
oid.sutrs={1,2,840,10003,5,101} |
|
81 |
name.sutrs=Simple Unstructured Text Record |
|
82 |
codec.sutrs=org.jzkit.z3950.gen.v3.RecordSyntax_SUTRS.SutrsRecord_codec |
|
83 |
|
|
84 |
oid.opac={1,2,840,10003,5,102} |
|
85 |
name.opac=Opac Record |
|
86 |
codec.opac=org.jzkit.z3950.gen.v3.RecordSyntax_opac.OPACRecord_codec |
|
87 |
|
|
88 |
oid.summary={1,2,840,10003,5,103} |
|
89 |
name.summary=Summary Record |
|
90 |
codec.summary=org.jzkit.z3950.gen.v3.RecordSyntax_summary.BriefBib_codec |
|
91 |
|
|
92 |
oid.grs-1={1,2,840,10003,5,105} |
|
93 |
name.grs-1=Generic Record |
|
94 |
codec.grs-1=org.jzkit.z3950.gen.v3.RecordSyntax_generic.GenericRecord_codec |
|
95 |
|
|
96 |
oid.pdf={1,2,840,10003,5,109,1} |
|
97 |
name.pdf=PDF Document |
|
98 |
|
|
99 |
oid.postscript={1,2,840,10003,5,109,2} |
|
100 |
name.postscript=Postscript Document |
|
101 |
|
|
102 |
oid.html={1,2,840,10003,5,109,3} |
|
103 |
name.html=HTML data |
|
104 |
|
|
105 |
oid.sgml={1,2,840,10003,5,109,9} |
|
106 |
name.sgml=SGML data |
|
107 |
|
|
108 |
oid.xml={1,2,840,10003,5,109,10} |
|
109 |
name.xml=XML data |
|
110 |
|
|
111 |
# Diagnostic Set OID's |
|
112 |
|
|
113 |
oid.diag-bib-1={1,2,840,10003,4,1} |
|
114 |
name.diag-bib-1=Bib1 Diagnostic Set |
|
115 |
|
|
116 |
oid.diag-1={1,2,840,10003,4,2} |
|
117 |
name.diag-1=Diag1 Diagnostic Set |
|
118 |
codec.diag-1=org.jzkit.z3950.gen.v3.DiagnosticFormatDiag1.DiagnosticFormat_codec |
|
119 |
|
|
120 |
# Schema OID's |
|
121 |
|
|
122 |
oid.wais_schema={1,2,840,10003,13,1} |
|
123 |
name.wais_schema=WAIS Record Schema |
|
124 |
|
|
125 |
oid.gils_schema={1,2,840,10003,13,2} |
|
126 |
name.gils_schema=GILS Record Schema |
|
127 |
|
|
128 |
oid.collections_schema={1,2,840,10003,13,3} |
|
129 |
name.collections_schema=GILS Record Schema |
|
130 |
|
|
131 |
oid.geo_schema={1,2,840,10003,13,4} |
|
132 |
name.geo_schema=GEO Record Schema |
|
133 |
|
|
134 |
oid.cimi_schema={1,2,840,10003,13,5} |
|
135 |
name.cimi_schema=CIMI Record Schema |
|
136 |
|
|
137 |
oid.update_schema={1,2,840,10003,13,6} |
|
138 |
name.update_schema=CIMI Record Schema |
|
139 |
|
|
140 |
oid.holdings_schema={1,2,840,10003,13,7} |
|
141 |
name.holdings_schema=Holdings Record Schema |
|
142 |
|
|
143 |
oid.zthes_schema={1,2,840,10003,13,8} |
|
144 |
name.zthes_schema=Zthes Record Schema |
|
145 |
|
|
146 |
oid.z_charset_neg_3={1,2,840,10003,15,3} |
|
147 |
name.z_charset_neg_3=Z39.50-Character-Set-Negotiation-3 |
|
148 |
codec.z_charset_neg_3=org.jzkit.z3950.gen.v3.NegotiationRecordDefinition_charSetandLanguageNegotiation_3.CharSetandLanguageNegotiation_codec |
|
149 |
|
|
150 |
oid.charset_ucs2={1,0,10646,1,0,2} |
|
151 |
name.charset_ucs2=UCS-2 |
|
152 |
|
|
153 |
oid.charset_ucs4={1,0,10646,1,0,4} |
|
154 |
name.charset_ucs4=UCS-4 |
|
155 |
|
|
156 |
oid.charset_utf16={1,0,10646,1,0,5} |
|
157 |
name.charset_utf16=UTF-16 |
|
158 |
|
|
159 |
oid.charset_utf8={1,0,10646,1,0,8} |
|
160 |
name.charset_utf8=UTF-8 |
|
161 |
|
|
162 |
oid.es_persistent_result_set={1,2,840,10003,9,1} |
|
163 |
name.es_persistent_result_set=Persistent Result Set Extended Service |
|
164 |
|
|
165 |
oid.es_persistent_query={1,2,840,10003,9,2} |
|
166 |
name.es_persistent_query=Persistent Query Extended Service |
|
167 |
|
|
168 |
oid.es_periodic_query_schedule={1,2,840,10003,9,3} |
|
169 |
name.es_periodic_query_schedule=Periodic Query Schedule Extended Service |
|
170 |
|
|
171 |
oid.es_item_order={1,2,840,10003,9,4} |
|
172 |
name.es_item_order=Item Order Extended Service |
|
173 |
|
|
174 |
oid.es_database_update={1,2,840,10003,9,5} |
|
175 |
name.es_database_update=Database Update |
|
176 |
codec.es_database_update=org.jzkit.z3950.gen.v3.ESFormat_Update0.Update_codec |
|
177 |
|
|
178 |
oid.es_database_update_r1={1,2,840,10003,9,5,1,1} |
|
179 |
name.es_database_update_r1=Database Update Revision 1 |
|
180 |
codec.es_database_update_r1=org.jzkit.z3950.gen.v3.ESFormat_Update.Update_codec |
|
181 |
|
|
182 |
oid.es_export_specification={1,2,840,10003,9,6} |
|
183 |
name.es_export_specification=Export Specification |
|
184 |
|
|
185 |
oid.es_export_invocation={1,2,840,10003,9,6} |
|
186 |
name.es_export_invocation=Export Invocation |
|
187 |
|
|
188 |
# ISO ILL Externals |
|
189 |
oid.ILL_OCLC_PRISM_Error={1,0,10161,13,1} |
|
190 |
name.ILL_OCLC_PRISM_Error=OCLC Prism Error Extension |
|
191 |
|
|
192 |
oid.ILL_OCLC_Request={1,0,10161,13,2} |
|
193 |
name.ILL_OCLC_Request=OCLC Request Extension |
|
194 |
|
|
195 |
oid.ILL_APDU_Delivery_Info={1,0,10161,13,3} |
|
196 |
name.ILL_APDU_Delivery_Info=ILL APDU Delivery Info |
|
197 |
# codec.ILL_APDU_Delivery_Info=org.jzkit.OpenRequest.isoill.gen.ILL_APDU_Delivery_Info.APDU_Delivery_Info_codec |
|
198 |
|
|
199 |
oid.ILL_Supplemental_Client_Info={1,0,10161,13,4} |
|
200 |
name.ILL_Supplemental_Client_Info=ILL Supplemental Client Info |
|
201 |
|
|
202 |
oid.ILL_Forwarded_Additional_Info={1,0,10161,13,5} |
|
203 |
name.ILL_Forwarded_Additional_Info=ILL Forwarded Additional Info |
|
204 |
|
|
205 |
oid.IPIG_Additional_User_Error_Info={1,0,10161,13,6} |
|
206 |
name.IPIG_Additional_User_Error_Info=IPIG Additional User Error Information |
|
207 |
|
|
208 |
oid.ILL_Suppliers_Reference={1,0,10161,13,7} |
|
209 |
name.ILL_Suppliers_Reference=ILL Suppliers Reference |
|
210 |
|
|
211 |
oid.ILL_Internal_Reference_Number={1,0,10161,13,8} |
|
212 |
name.ILL_Internal_Reference_Number=ILL Internal Reference Number |
|
213 |
|
|
214 |
oid.IPIG_ILL_Request_Extension={1,0,10161,13,9} |
|
215 |
name.IPIG_ILL_Request_Extension=IPIG ILL Request Extension |
|
0 | 216 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/context/InternalToType1Rules.properties | ||
---|---|---|
1 |
DefaultTargetAttrset=bib-1 |
|
2 |
dc.title=bib-1:1:4 |
|
3 |
dc.creator=bib-1:1:4 |
|
4 |
k-int.anywhere=bib-1:1:1016 |
|
0 | 5 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/HTTPPostProtocol.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.protocols; |
|
43 |
import java.io.ByteArrayInputStream; |
|
44 |
import java.io.File; |
|
45 |
import java.io.FileOutputStream; |
|
46 |
import java.io.IOException; |
|
47 |
import java.io.InputStream; |
|
48 |
import java.io.OutputStreamWriter; |
|
49 |
import java.net.HttpURLConnection; |
|
50 |
import java.net.URL; |
|
51 |
import java.util.Collection; |
|
52 |
|
|
53 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
54 |
import org.gvsig.catalog.utils.Strings; |
|
55 |
|
|
56 |
/** |
|
57 |
* This class implement the HTTP Post protocol. |
|
58 |
* |
|
59 |
* |
|
60 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
61 |
*/ |
|
62 |
public class HTTPPostProtocol implements IProtocols { |
|
63 |
|
|
64 |
/** |
|
65 |
* @return |
|
66 |
* @param url |
|
67 |
* @param message |
|
68 |
* @param firstRecord |
|
69 |
*/ |
|
70 |
public Collection doQuery(URL url, Object message, int firstRecord) { |
|
71 |
String body = (String) message; |
|
72 |
ByteArrayInputStream output = null; |
|
73 |
|
|
74 |
try { |
|
75 |
HttpURLConnection c = (HttpURLConnection) url.openConnection(); |
|
76 |
|
|
77 |
c.setRequestProperty("SOAPAction","post"); |
|
78 |
c.setRequestMethod("POST"); |
|
79 |
c.setDoOutput(true); |
|
80 |
c.setRequestProperty("Content-Type", "text/xml; charset=UTF-8"); |
|
81 |
|
|
82 |
// Write the request. |
|
83 |
OutputStreamWriter w = |
|
84 |
new OutputStreamWriter(c.getOutputStream(), "UTF-8"); |
|
85 |
|
|
86 |
w.write(body); |
|
87 |
w.flush(); |
|
88 |
|
|
89 |
InputStream is = c.getInputStream(); |
|
90 |
byte[] buf = new byte[1024]; |
|
91 |
int len; |
|
92 |
String str = ""; |
|
93 |
|
|
94 |
while ((len = is.read(buf)) > 0) { |
|
95 |
str = str + new String(buf, 0, len); |
|
96 |
} |
|
97 |
|
|
98 |
str = Strings.replace(str, |
|
99 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>", |
|
100 |
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); |
|
101 |
System.out.println(str); |
|
102 |
output = new ByteArrayInputStream(str.getBytes()); |
|
103 |
|
|
104 |
} catch (IOException e) { |
|
105 |
// TODO Auto-generated catch block |
|
106 |
//e.printStackTrace(); |
|
107 |
return null; |
|
108 |
} |
|
109 |
|
|
110 |
Collection col = new java.util.ArrayList(); |
|
111 |
col.add(XMLTree.xmlToTree(output)); |
|
112 |
return col; |
|
113 |
} |
|
114 |
|
|
115 |
public void doQuery(URL url, Object message, int firstRecord, String fileName) { |
|
116 |
String body = (String) message; |
|
117 |
FileOutputStream output = null; |
|
118 |
|
|
119 |
try { |
|
120 |
HttpURLConnection c = (HttpURLConnection) url.openConnection(); |
|
121 |
|
|
122 |
c.setRequestProperty("SOAPAction","post"); |
|
123 |
c.setRequestMethod("POST"); |
|
124 |
c.setDoOutput(true); |
|
125 |
c.setRequestProperty("Content-Type", "text/xml; charset=UTF-8"); |
|
126 |
|
|
127 |
// Write the request. |
|
128 |
OutputStreamWriter w = |
|
129 |
new OutputStreamWriter(c.getOutputStream(), "UTF-8"); |
|
130 |
|
|
131 |
w.write(body); |
|
132 |
w.flush(); |
|
133 |
|
|
134 |
InputStream is = c.getInputStream(); |
|
135 |
byte[] buf = new byte[1024]; |
|
136 |
int len; |
|
137 |
String str = ""; |
|
138 |
while ((len = is.read(buf)) > 0) { |
|
139 |
str = str + new String(buf, 0, len); |
|
140 |
} |
|
141 |
|
|
142 |
System.out.println(str); |
|
143 |
output = new FileOutputStream(new File(fileName)); |
|
144 |
output.write(str.getBytes()); |
|
145 |
output.flush(); |
|
146 |
output.close(); |
|
147 |
|
|
148 |
|
|
149 |
} catch (IOException e) { |
|
150 |
e.printStackTrace(); |
|
151 |
} |
|
152 |
|
|
153 |
} |
|
154 |
} |
|
0 | 155 |
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.104/org.gvsig.catalog.lib/src/main/java/org/gvsig/catalog/protocols/Z3950Connection.java | ||
---|---|---|
1 |
package org.gvsig.catalog.protocols; |
|
2 |
|
|
3 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
4 |
* |
|
5 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 2 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
20 |
* |
|
21 |
* For more information, contact: |
|
22 |
* |
|
23 |
* Generalitat Valenciana |
|
24 |
* Conselleria d'Infraestructures i Transport |
|
25 |
* Av. Blasco Ib??ez, 50 |
|
26 |
* 46010 VALENCIA |
|
27 |
* SPAIN |
|
28 |
* |
|
29 |
* +34 963862235 |
|
30 |
* gvsig@gva.es |
|
31 |
* www.gvsig.gva.es |
|
32 |
* |
|
33 |
* or |
|
34 |
* |
|
35 |
* IVER T.I. S.A |
|
36 |
* Salamanca 50 |
|
37 |
* 46005 Valencia |
|
38 |
* Spain |
|
39 |
* |
|
40 |
* +34 963163400 |
|
41 |
* dac@iver.es |
|
42 |
*/ |
|
43 |
/* CVS MESSAGES: |
|
44 |
* |
|
45 |
* $Id: Z3950Connection.java 561 2007-07-27 06:49:30 +0000 (Fri, 27 Jul 2007) jpiera $ |
|
46 |
* $Log$ |
|
47 |
* Revision 1.1.2.6.4.3 2007/07/23 07:14:25 jorpiell |
|
48 |
* Catalog refactoring |
|
49 |
* |
|
50 |
* Revision 1.1.2.6.4.2 2007/07/13 12:00:35 jorpiell |
|
51 |
* Add the posibility to add a new panel |
|
52 |
* |
|
53 |
* Revision 1.1.2.6.4.1 2007/07/10 11:18:04 jorpiell |
|
54 |
* Added the registers |
|
55 |
* |
|
56 |
* Revision 1.1.2.6 2006/11/15 00:08:08 jjdelcerro |
|
57 |
* *** empty log message *** |
|
58 |
* |
|
59 |
* Revision 1.4 2006/11/13 07:52:58 jorpiell |
|
60 |
* Se han incluido los cambios que se hicieron para Chile: cambio de la librer?a jzKit, carga de ArcIms y WCS |
|
61 |
* |
|
62 |
* Revision 1.3 2006/10/02 08:29:07 jorpiell |
|
63 |
* Modificados los cambios del Branch 10 al head |
|
64 |
* |
|
65 |
* Revision 1.1.2.3 2006/10/02 07:13:43 jorpiell |
|
66 |
* Comprobada una NullPointerException que generaba una excepci?n |
|
67 |
* |
|
68 |
* Revision 1.1.2.2 2006/09/25 06:48:38 jorpiell |
|
69 |
* A?adida la funcionalidad de mostrar el documento de texto cuando no es un XML |
|
70 |
* |
|
71 |
* Revision 1.1.2.1 2006/09/20 12:01:07 jorpiell |
|
72 |
* Se ha cambiado la versi?n de la jzkit, se ha incorporado la funcionalidad de cargar arcims |
|
73 |
* |
|
74 |
* Revision 1.1 2006/09/20 11:20:17 jorpiell |
|
75 |
* Se ha cambiado la versi?n de la librer?a jzkit de la 1 a la 2.0 |
|
76 |
* |
|
77 |
* |
|
78 |
*/ |
|
79 |
import java.net.URI; |
|
80 |
import java.util.StringTokenizer; |
|
81 |
import java.util.Vector; |
|
82 |
|
|
83 |
import org.gvsig.catalog.drivers.GetRecordsReply; |
|
84 |
import org.gvsig.catalog.metadataxml.XMLNode; |
|
85 |
import org.gvsig.catalog.metadataxml.XMLTree; |
|
86 |
import org.jzkit.a2j.codec.util.OIDRegister; |
|
87 |
import org.jzkit.search.provider.iface.IRQuery; |
|
88 |
import org.jzkit.search.provider.iface.SearchException; |
|
89 |
import org.jzkit.search.provider.iface.Searchable; |
|
90 |
import org.jzkit.search.util.RecordModel.ExplicitRecordFormatSpecification; |
|
91 |
import org.jzkit.search.util.RecordModel.InformationFragment; |
|
92 |
import org.jzkit.search.util.RecordModel.RecordFormatSpecification; |
|
93 |
import org.jzkit.search.util.RecordModel.SUTRS; |
|
94 |
import org.jzkit.search.util.RecordModel.XMLRecord; |
|
95 |
import org.jzkit.search.util.ResultSet.IRResultSet; |
|
96 |
import org.jzkit.search.util.ResultSet.IRResultSetException; |
|
97 |
import org.jzkit.search.util.ResultSet.IRResultSetStatus; |
|
98 |
import org.jzkit.z3950.client.SynchronousOriginBean; |
|
99 |
import org.jzkit.z3950.gen.v3.Z39_50_APDU_1995.InitializeResponse_type; |
|
100 |
|
|
101 |
public class Z3950Connection extends SynchronousOriginBean |
|
102 |
{ |
|
103 |
public static final char ISO2709_RS = 035; |
|
104 |
public static final char ISO2709_FS = 036; |
|
105 |
public static final char ISO2709_IDFS = 037; |
|
106 |
private static final String PREFIX_QUERY_TYPE = "PREFIX"; |
Also available in: Unified diff