perfsonar-dev - perfsonar: r2703 - branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist
Subject: perfsonar development work
List archive
perfsonar: r2703 - branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist
Chronological Thread
- From:
- To:
- Subject: perfsonar: r2703 - branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist
- Date: Wed, 22 Aug 2007 09:39:08 -0400
Author: mac
Date: 2007-08-22 09:39:08 -0400 (Wed, 22 Aug 2007)
New Revision: 2703
Modified:
branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist/MultipleFilesExistDAOImpl.java
branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist/XQueryExistDAOImpl.java
Log:
LSQuery code for Multiple Files disappeared somehow during moving code to new
SVN structure. :)
Some small changes happen as well.
Modified:
branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist/MultipleFilesExistDAOImpl.java
===================================================================
---
branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist/MultipleFilesExistDAOImpl.java
2007-08-22 12:30:53 UTC (rev 2702)
+++
branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist/MultipleFilesExistDAOImpl.java
2007-08-22 13:39:08 UTC (rev 2703)
@@ -6,6 +6,7 @@
import org.ggf.ns.nmwg.base.v2_0.Metadata;
import org.perfsonar.base.util.XMLUtils;
import org.perfsonar.base.exceptions.PerfSONARException;
+import org.perfsonar.service.base.storage.xmldb.XmlDbResult;
/**
* Implementation of LookupServiceDAO:
@@ -128,15 +129,43 @@
public void removeControlParameter(
String metadataId, String parameter) throws PerfSONARException {
//TODO: now all parameters are removed (whole file), should be
fixed!!!
+ removeAllControlParameters(metadataId);
+ }
+
+ protected void removeAllControlParameters(String metadataId)
+ throws PerfSONARException {
+ //TODO: to be changed - each parameter in separate file
getDataStorage().delete(
getControlFile(metadataId),
getDataCredential());
}
+
public int cleanupLookupInfo(
long timestamp, long defaultInterval) throws PerfSONARException {
- // TODO Auto-generated method stub
- return 0;
+
+ String xquery =
+ DECLARE_NMWG_NAMESPACE +
+
+ "let $now:="+timestamp+"\n" +
+ "let $interval:="+defaultInterval+"\n" +
+ //to be changed - get interval from parameter
+
+ "for $meta in
/nmwg:store[@type='LSStore-control']/nmwg:metadata
\n" +
+ " let $ts :=
data($meta/nmwg:parameters/nmwg:parameter[@name='timestamp']/@value)
cast as xs:integer\n" +
+ " let $metaid := data($meta/@id)\n "+
+ " where $ts + $interval < $now\n" +
+ "return $metaid\n";
+
+ XmlDbResult res = getDataStorage().performXQuery(
+ xquery, getDataCollection(), getDataCredential());
+
+ for (String metadataId : res.getResultAsStringArray()) {
+ removeLookupInfo(metadataId);
+ removeAllControlParameters(metadataId);
+ }
+
+ return -1;
}
// ----------------------------------------------------------------
private
Modified:
branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist/XQueryExistDAOImpl.java
===================================================================
---
branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist/XQueryExistDAOImpl.java
2007-08-22 12:30:53 UTC (rev 2702)
+++
branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist/XQueryExistDAOImpl.java
2007-08-22 13:39:08 UTC (rev 2703)
@@ -96,7 +96,7 @@
" update delete
/nmwg:store[@type='LSStore']/nmwg:data[@metadataIdRef=$metaid]\n"
+
" )\n";
- System.out.println("---\n"+xquery+"\n---\n");
+ //System.out.println("---\n"+xquery+"\n---\n");
/*XmlDbResult res =*/ getDataStorage().performXQuery(xquery,
getDataCollection(), getDataCredential());
- perfsonar: r2703 - branches/new-structure/trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/storage/exist, svnlog, 08/22/2007
Archive powered by MHonArc 2.6.16.