perfsonar-dev - r1406 - trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/existHttp
Subject: perfsonar development work
List archive
r1406 - trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/existHttp
Chronological Thread
- From:
- To:
- Subject: r1406 - trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/existHttp
- Date: Wed, 12 Jul 2006 09:05:28 -0400
Author: roman
Date: 2006-07-12 09:05:27 -0400 (Wed, 12 Jul 2006)
New Revision: 1406
Modified:
trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/existHttp/ExistDbHTTPAccess.java
Log:
small changes to make this class consistent with older implementation of
storage manager for accessing xml db
(...storage.xmldb.exist.ExistDbXmlStorageManager)
Modified:
trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/existHttp/ExistDbHTTPAccess.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/existHttp/ExistDbHTTPAccess.java
2006-07-12 08:10:32 UTC (rev 1405)
+++
trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/existHttp/ExistDbHTTPAccess.java
2006-07-12 13:05:27 UTC (rev 1406)
@@ -87,9 +87,7 @@
* Example of use:
*
* String[] s = (String[])ExistDbHTTPAccess .sendHTTPRequest(
- * "localhost", //server
- * 8080, //port
- * "/ls", //XML collection
+ * "http://localhost:8080/exist/rest/db/rrdmaconfig", //server
* "/*:store", //XQuery expression
* "UsErNaMe", //User name
* "pASs-WorD", //password
@@ -99,9 +97,7 @@
* //return results as
* //String[1] array
*
- * @param address database server address
- * @param port database server port
- * @param collection database collection e.g. /ls
+ * @param url url of eXist database
* @param query query to database (XQuery)
* @param username username (null or empty if no authorization)
* @param password password (may be null or empty)
@@ -113,9 +109,7 @@
* @throws ExistDbErrorException database server responsed with error
(unauthorized or parse error)
*/
public static Object sendHTTPRequest(
- String address,
- int port,
- String collection,
+ String url,
String query,
String username,
String password,
@@ -172,10 +166,10 @@
if (debug) System.out.println("[D] query: " + query);
//connect by HTTP with /exist/rest/db/COLLECTION
- URL url = new
URL("http://"+address+":"+port+"/exist/rest/db"+collection);
+ URL _url = new URL(url);
//create HTTP URL Connection
- HttpURLConnection huc = (HttpURLConnection) url.openConnection();
+ HttpURLConnection huc = (HttpURLConnection) _url.openConnection();
//set HTTP method
huc.setRequestMethod("POST");
@@ -333,7 +327,7 @@
huc.disconnect();
//return results as:
-
+
if (full) {
return new ExistDbResult(result, hits, first, count);
@@ -394,9 +388,7 @@
*
* Exist DB XML will return all results (ALL_RESULTS) beginning from 1
(FIRST)
*
- * @param address database server address
- * @param port database server port
- * @param collection database collection e.g. /ls
+ * @param url url of eXist database
* @param query query to database (XQuery)
* @param username username (null or empty if no authorization)
* @param password password (may be null or empty)
@@ -406,16 +398,14 @@
* @throws ExistDbErrorException database server responsed with error
(unauthorized or parse error)
*/
public static Object sendHTTPRequest(
- String address,
- int port,
- String collection,
+ String url,
String query,
String username,
String password,
int flags) throws IOException, ExistDbErrorException {
return sendHTTPRequest(
- address, port, collection,
+ url,
query, username, password,
FIRST, ALL_RESULTS, flags);
@@ -431,7 +421,7 @@
*/
public static void main(String[] args) throws Exception {
-
+
String query =
"declare namespace " +
"nmwg='http://ggf.org/ns/nmwg/base/2.0/'; " +
@@ -440,9 +430,7 @@
long t0 = System.currentTimeMillis(); //----------------time 0
Object s = ExistDbHTTPAccess .sendHTTPRequest(
- "localhost",
- 8680,
- "/ls",
+ "http://localhost:8680/exist/rest/db/ls",
query,
"lookupservice",
"sonar",
- r1406 - trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/existHttp, svnlog, 07/12/2006
Archive powered by MHonArc 2.6.16.