Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r5226 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/storage/xml/exist

Subject: perfsonar development work

List archive

perfsonar: r5226 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/storage/xml/exist


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r5226 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/storage/xml/exist
  • Date: Tue, 14 Jul 2009 03:04:26 -0400

Author: trzaszcz
Date: 2009-07-14 03:04:24 -0400 (Tue, 14 Jul 2009)
New Revision: 5226

Modified:

branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/storage/xml/exist/ExistHTTPDataStorage.java
Log:
catching incorrect xpath query

Modified:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/storage/xml/exist/ExistHTTPDataStorage.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/storage/xml/exist/ExistHTTPDataStorage.java
2009-07-13 10:39:53 UTC (rev 5225)
+++
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/storage/xml/exist/ExistHTTPDataStorage.java
2009-07-14 07:04:24 UTC (rev 5226)
@@ -7,102 +7,86 @@

public class ExistHTTPDataStorage implements XMLDataStorage {

+ // ----------------------------------------------------- Instance
variables

- // ----------------------------------------------------- Instance
variables
+ protected ExistDbHTTPAccess httpAccess;

+ // ------------------------------------------------------------
Constructor

- protected ExistDbHTTPAccess httpAccess;
+ public ExistHTTPDataStorage() {

+ httpAccess = new ExistDbHTTPAccess();

- // ------------------------------------------------------------
Constructor
+ }

+ // --------------------------------------------------------- Public
methods

- public ExistHTTPDataStorage() {
+ public void put(String xmlDocument, String collection,
+ DataCredential credential) throws PerfSONARException {

- httpAccess = new ExistDbHTTPAccess();
+ try {

- }
+ httpAccess.sendPUTRequest(collection, xmlDocument,
credential
+ .getUsername(),
credential.getPassword());

+ } catch (Exception ex) {
+ throw new
PerfSONARException("error.common.storage.xmldb.open",
+ "PUT HTTP request of resource [" +
collection + "] failed."
+ + "Could not connect
to eXist via pure http, "
+ + " nested exception
was: " + ex.getClass() + " : "
+ + ex.getMessage());
+ }

- // --------------------------------------------------------- Public
methods
+ }

+ public void delete(String collection, DataCredential credential)
+ throws PerfSONARException {

- public void put(
- String xmlDocument,
- String collection,
- DataCredential credential) throws PerfSONARException {
+ try {
+ httpAccess.sendDELETERequest(collection,
credential.getUsername(),
+ credential.getPassword());

- try {
+ } catch (Exception ex) {
+ throw new
PerfSONARException("error.common.storage.xmldb.open",
+ "DELETE HTTP request of resource [" +
collection
+ + "] failed. "
+ + "Could not connect
to eXist via pure http, "
+ + " nested exception
was: " + ex.getClass() + " : "
+ + ex.getMessage());
+ }

- httpAccess.sendPUTRequest(
- collection,
- xmlDocument,
- credential.getUsername(),
- credential.getPassword());
+ }

- } catch (Exception ex) {
- throw new PerfSONARException(
- "error.common.storage.xmldb.open",
- "PUT HTTP request of resource ["+collection+"] failed."
- + "Could not connect to eXist via pure http, "
- + " nested exception was: "+
- ex.getClass()+" : "+ex.getMessage());
- }
+ public XMLDBResult performXQuery(String xquery, String collection,
+ DataCredential credential) throws PerfSONARException {

- }
+ XMLDBResult results = null;

+ try {
+ results =
httpAccess.sendExistXQueryRequest(collection, xquery,
+ credential.getUsername(),
credential.getPassword(),
+ ExistDbHTTPAccess.FIRST,
ExistDbHTTPAccess.ALL_RESULTS);
+ } catch (ExistDbErrorException ex) {
+ if (ex.getHttpCode() == 202) {
+ // incorrect xquery
+ throw new PerfSONARException("error.xpath",
+ "XQuery by HTTP failed.
Incorrect XQuery");
+ } else {
+ throw new
PerfSONARException("error.common.storage.xmldb.open",
+ "XQuery by HTTP failed. Error
code " + ex.getHttpCode()
+ + " nested
exception was: " + ex.getClass()
+ + " : " +
ex.getMessage());
+ }
+ } catch (Exception ex) {
+ throw new
PerfSONARException("error.common.storage.xmldb.open",
+ "XQuery by HTTP failed. "
+ + "Could not connect
to eXist via pure http, "
+ + " nested exception
was: " + ex.getClass() + " : "
+ + ex.getMessage());
+ }

- public void delete(
- String collection,
- DataCredential credential) throws PerfSONARException {
+ return results;

+ }

- try {
- httpAccess.sendDELETERequest(
- collection,
- credential.getUsername(),
- credential.getPassword());
-
- } catch (Exception ex) {
- throw new PerfSONARException(
- "error.common.storage.xmldb.open",
- "DELETE HTTP request of resource ["+collection+"]
failed. "
- + "Could not connect to eXist via pure http, "
- + " nested exception was: "+
- ex.getClass()+" : "+ex.getMessage());
- }
-
- }
-
-
- public XMLDBResult performXQuery(
- String xquery,
- String collection,
- DataCredential credential) throws PerfSONARException {
-
- XMLDBResult results = null;
-
- try {
- results = httpAccess.sendExistXQueryRequest(
- collection,
- xquery,
- credential.getUsername(),
- credential.getPassword(),
- ExistDbHTTPAccess.FIRST,
- ExistDbHTTPAccess.ALL_RESULTS);
-
- } catch (Exception ex) {
- throw new PerfSONARException(
- "error.common.storage.xmldb.open",
- "XQuery by HTTP failed. "
- + "Could not connect to eXist via pure http, "
- + " nested exception was: "+
- ex.getClass()+" : "+ex.getMessage());
- }
-
- return results;
-
- }
-
-
-} //ExistHTTPDataStorage
+} // ExistHTTPDataStorage



  • perfsonar: r5226 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/storage/xml/exist, svnlog, 07/14/2009

Archive powered by MHonArc 2.6.16.

Top of Page