Revision 4226
Added by ben leinfelder over 16 years ago
lib/metacat.properties | ||
---|---|---|
103 | 103 |
datamanager.maxconnections=10 |
104 | 104 |
|
105 | 105 |
datamanager.endpoint.query=http://ecogrid.ecoinformatics.org/knb/services/QueryService |
106 |
datamanager.endpoint.authenticatedquery=http://ecogrid.ecoinformatics.org/knb/services/AuthenticatedQueryService |
|
106 | 107 |
datamanager.endpoint.authentication=http://ecogrid.ecoinformatics.org/knb/services/AuthenticationService |
107 | 108 |
datamanager.endpoint.put=http://ecogrid.ecoinformatics.org/knb/services/PutService |
108 | 109 |
datamanager.endpoint.identifier=http://ecogrid.ecoinformatics.org/knb/services/IdentificationService |
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
770 | 770 |
|
771 | 771 |
logMetacat |
772 | 772 |
.debug("******************* DATA QUERY ********************"); |
773 |
handleDataquery(params, response); |
|
773 |
handleDataquery(params, response, sess_id);
|
|
774 | 774 |
} |
775 | 775 |
else if (action.equals("export")) { |
776 | 776 |
|
... | ... | |
944 | 944 |
|
945 | 945 |
private void handleDataquery( |
946 | 946 |
Hashtable<String, String[]> params, |
947 |
HttpServletResponse response) throws PropertyNotFoundException, IOException { |
|
947 |
HttpServletResponse response, |
|
948 |
String sessionId) throws PropertyNotFoundException, IOException { |
|
948 | 949 |
|
949 |
DataQuery dq = new DataQuery(); |
|
950 |
DataQuery dq = null; |
|
951 |
if (sessionId != null) { |
|
952 |
dq = new DataQuery(sessionId); |
|
953 |
} |
|
954 |
else { |
|
955 |
dq = new DataQuery(); |
|
956 |
} |
|
950 | 957 |
|
951 | 958 |
String dataqueryXML = ((String[])params.get("dataquery"))[0]; |
952 | 959 |
|
src/edu/ucsb/nceas/metacat/dataquery/DataQuery.java | ||
---|---|---|
54 | 54 |
* empty constructor to initialize query |
55 | 55 |
*/ |
56 | 56 |
public DataQuery() { |
57 |
// initialize the endpoint, not authenticated |
|
58 |
endPointInfo = new ConfigurableEcogridEndPoint(); |
|
59 |
init(); |
|
60 |
} |
|
61 |
|
|
62 |
public DataQuery(String sessionId) { |
|
57 | 63 |
// initialize the necessary parts |
58 |
endPointInfo = new ConfigurableEcogridEndPoint(); |
|
64 |
endPointInfo = new ConfigurableAuthenticatedEcogridEndPoint(sessionId); |
|
65 |
init(); |
|
66 |
} |
|
67 |
|
|
68 |
private void init() { |
|
59 | 69 |
connectionPool = new PostgresDatabaseConnectionPool(); |
60 | 70 |
dataManager = |
61 | 71 |
DataManager.getInstance(connectionPool, connectionPool.getDBAdapterName()); |
62 |
|
|
63 | 72 |
} |
64 | 73 |
|
65 | 74 |
public ResultSet executeQuery(String xml) throws Exception { |
src/edu/ucsb/nceas/metacat/dataquery/ConfigurableAuthenticatedEcogridEndPoint.java | ||
---|---|---|
1 |
/** |
|
2 |
* '$RCSfile: ConfigurableEcogridEndPoint.java,v $' |
|
3 |
* |
|
4 |
* '$Author: leinfelder $' |
|
5 |
* '$Date: 2008/06/20 17:47:12 $' |
|
6 |
* '$Revision: 1.1 $' |
|
7 |
* |
|
8 |
* For Details: http://ecoinformatics.org |
|
9 |
* |
|
10 |
* Copyright (c) 2007 The Regents of the University of California. |
|
11 |
* All rights reserved. |
|
12 |
* |
|
13 |
* Permission is hereby granted, without written agreement and without |
|
14 |
* license or royalty fees, to use, copy, modify, and distribute this |
|
15 |
* software and its documentation for any purpose, provided that the |
|
16 |
* above copyright notice and the following two paragraphs appear in |
|
17 |
* all copies of this software. |
|
18 |
* |
|
19 |
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY |
|
20 |
* FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
|
21 |
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
|
22 |
* IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY |
|
23 |
* OF SUCH DAMAGE. |
|
24 |
* |
|
25 |
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, |
|
26 |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
27 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE |
|
28 |
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY |
|
29 |
* OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, |
|
30 |
* UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
|
31 |
*/ |
|
32 |
package edu.ucsb.nceas.metacat.dataquery; |
|
33 |
|
|
34 |
import org.ecoinformatics.datamanager.download.AuthenticatedEcogridEndPointInterface; |
|
35 |
|
|
36 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
|
37 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
|
38 |
|
|
39 |
/** |
|
40 |
* This class implements AuthenticatedEcogridEndPointInterface |
|
41 |
* and is configurable using the properties file. |
|
42 |
* Useful for switching to remote endpoints etc. |
|
43 |
* |
|
44 |
* @author leinfelder |
|
45 |
* |
|
46 |
*/ |
|
47 |
public class ConfigurableAuthenticatedEcogridEndPoint |
|
48 |
extends ConfigurableEcogridEndPoint implements AuthenticatedEcogridEndPointInterface { |
|
49 |
|
|
50 |
private String metacatAuthenticatedEcogridEndPoint = null; |
|
51 |
private String sessionId = null; |
|
52 |
|
|
53 |
public ConfigurableAuthenticatedEcogridEndPoint() { |
|
54 |
|
|
55 |
try { |
|
56 |
metacatAuthenticatedEcogridEndPoint = PropertyService.getProperty("datamanager.endpoint.authenticatedquery"); |
|
57 |
} catch (PropertyNotFoundException e) { |
|
58 |
e.printStackTrace(); |
|
59 |
} |
|
60 |
|
|
61 |
} |
|
62 |
|
|
63 |
public ConfigurableAuthenticatedEcogridEndPoint(String sessionId) { |
|
64 |
this(); |
|
65 |
this.sessionId = sessionId; |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* Gets the end point which Metacat implements authenticated ecogrid interface. |
|
70 |
* This end point will be used to handle ecogrid protocol |
|
71 |
* |
|
72 |
* @return end point url string |
|
73 |
*/ |
|
74 |
public String getMetacatAuthenticatedEcogridEndPoint() |
|
75 |
{ |
|
76 |
return metacatAuthenticatedEcogridEndPoint; |
|
77 |
} |
|
78 |
|
|
79 |
public String getSessionId() |
|
80 |
{ |
|
81 |
return sessionId; |
|
82 |
} |
|
83 |
|
|
84 |
public void setSessionId(String id) { |
|
85 |
sessionId = id; |
|
86 |
} |
|
87 |
|
|
88 |
} |
|
89 |
|
Also available in: Unified diff
add ability to access protected data via the datamanager/dataquery feature.
Note: the datamanager features rely on the ecogrid stubs being available in Metacat. When Metacat is installed with ecogrid enabled, the required jars are included in the war...something to keep in mind.