perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r5725 - in trunk/perfsonar-java-xml-ls: . contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/auxiliary packaging packaging/deb packaging/rpm src/main/java/org/perfsonar/service/lookupservice src/main/java/org/perfsonar/service/lookupservice/storage/exist/dao
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r5725 - in trunk/perfsonar-java-xml-ls: . contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/auxiliary packaging packaging/deb packaging/rpm src/main/java/org/perfsonar/service/lookupservice src/main/java/org/perfsonar/service/lookupservice/storage/exist/dao
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r5725 - in trunk/perfsonar-java-xml-ls: . contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/auxiliary packaging packaging/deb packaging/rpm src/main/java/org/perfsonar/service/lookupservice src/main/java/org/perfsonar/service/lookupservice/storage/exist/dao
- Date: Wed, 18 Aug 2010 10:07:13 +0100
Author: psnc.jedrzejewski
Date: 2010-08-18 10:07:13 +0100 (Wed, 18 Aug 2010)
New Revision: 5725
Modified:
trunk/perfsonar-java-xml-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/auxiliary/XMLGenerator.py
trunk/perfsonar-java-xml-ls/packaging/deb/changelog
trunk/perfsonar-java-xml-ls/packaging/deb/control
trunk/perfsonar-java-xml-ls/packaging/package.sh
trunk/perfsonar-java-xml-ls/packaging/rpm/perfsonar-java-xml-ls.specs
trunk/perfsonar-java-xml-ls/pom.xml
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/EchoServiceEngine.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegisterServiceEngine.java
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/dao/SingleFileDAOImpl.java
Log:
perfsonar-base version update
Modified:
trunk/perfsonar-java-xml-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/auxiliary/XMLGenerator.py
===================================================================
---
trunk/perfsonar-java-xml-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/auxiliary/XMLGenerator.py
2010-08-17 17:11:46 UTC (rev 5724)
+++
trunk/perfsonar-java-xml-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/auxiliary/XMLGenerator.py
2010-08-18 09:07:13 UTC (rev 5725)
@@ -15,17 +15,17 @@
Constructor
'''
- def generateInterface(self):
- pass
+ # def generateInterface(self):
+ # pass
- def generateIP(self,prefix):
- dots=prefix.count(".")
+ def generateIP(self, prefix):
+ dots = prefix.count(".")
- result=prefix
- for c in range(0, 3-dots) :
- result=result+"."+str(random.randint(0,255))
+ result = prefix
+ for c in range(0, 3 - dots) :
+ result = result + "." + str(random.randint(0, 255))
return result
@@ -42,8 +42,8 @@
return result
- def generateInterface(self,id,metadataIdRef,ipPrefix,hostPostfix):
- content="""
+ def generateInterface(self, id, metadataIdRef, ipPrefix, hostPostfix):
+ content = """
<nmwg:data id='$DATA$' metadataIdRef='$METATADATA_ID_REF$'>
<nmwg:metadata id='17155427'>
<netutil:subject id='17062918'>
@@ -61,26 +61,26 @@
</nmwg:metadata>
</nmwg:data>
"""
- content=content.replace("$DATA$", id);
- content=content.replace("$METATADATA_ID_REF$", metadataIdRef);
- content=content.replace("$HOST$",
self.generateString()+"."+hostPostfix);
- content=content.replace("$IF$", self.generateString());
- content=content.replace("$DESC$",
self.generateString()+self.generateString());
- content=content.replace("$IP$", self.generateIP(ipPrefix));
- content=content.replace("$REALM$", self.generateString());
- content=content.replace("$CAPACITY$", str(random.randint(1,10000)));
+ content = content.replace("$DATA$", id);
+ content = content.replace("$METATADATA_ID_REF$", metadataIdRef);
+ content = content.replace("$HOST$", self.generateString() + "." +
hostPostfix);
+ content = content.replace("$IF$", self.generateString());
+ content = content.replace("$DESC$", self.generateString() +
self.generateString());
+ content = content.replace("$IP$", self.generateIP(ipPrefix));
+ content = content.replace("$REALM$", self.generateString());
+ content = content.replace("$CAPACITY$", str(random.randint(1,
10000)));
return content
- def
generateMessage(self,rowUrl,metadataId,ipPrefix,hostPostfix,dataCapacity):
+ def generateMessage(self, rowUrl, metadataId, ipPrefix, hostPostfix,
dataCapacity):
- f=open(rowUrl,"r")
- soap_content=f.read()
- content=""
- for c in range(1,dataCapacity):
- content=content+self.generateInterface(str(c), metadataId,
ipPrefix, hostPostfix)
- soap_content=soap_content.replace("$DATA$",content)
+ f = open(rowUrl, "r")
+ soap_content = f.read()
+ content = ""
+ for c in range(1, dataCapacity):
+ content = content + self.generateInterface(str(c), metadataId,
ipPrefix, hostPostfix)
+ soap_content = soap_content.replace("$DATA$", content)
return soap_content
Modified: trunk/perfsonar-java-xml-ls/packaging/deb/changelog
===================================================================
--- trunk/perfsonar-java-xml-ls/packaging/deb/changelog 2010-08-17 17:11:46
UTC (rev 5724)
+++ trunk/perfsonar-java-xml-ls/packaging/deb/changelog 2010-08-18 09:07:13
UTC (rev 5725)
@@ -2,7 +2,7 @@
* Fixes: bugs fixes PSSERVICES-503
* New: old naming policy supported geant2-java-xml-ls - improved
- -- Slawomir Trzaszczka
<>
Thu, 27 May 2010 10:00:00 +0200
+ -- Krzysztof Jedrzejewski
<>
Thu, 27 May 2010 10:00:00 +0200
perfsonar-java-xml-ls (1.5-0rc3) stable; urgency=low
Modified: trunk/perfsonar-java-xml-ls/packaging/deb/control
===================================================================
--- trunk/perfsonar-java-xml-ls/packaging/deb/control 2010-08-17 17:11:46
UTC (rev 5724)
+++ trunk/perfsonar-java-xml-ls/packaging/deb/control 2010-08-18 09:07:13
UTC (rev 5725)
@@ -1,12 +1,12 @@
Source: perfsonar-java-xml-ls
Section: web
Priority: extra
-Maintainer: Slawomir Trzaszczka
<>
+Maintainer: Krzysztof Jedrzejewski
<>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.2
Package: perfsonar-java-xml-ls
Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, exist, java6-runtime
+Depends: ${shlibs:Depends}, ${misc:Depends}, exist, java6-runtime, tomcat5.5
Description: perfSONAR Lookup Service
Modified: trunk/perfsonar-java-xml-ls/packaging/package.sh
===================================================================
--- trunk/perfsonar-java-xml-ls/packaging/package.sh 2010-08-17 17:11:46
UTC (rev 5724)
+++ trunk/perfsonar-java-xml-ls/packaging/package.sh 2010-08-18 09:07:13
UTC (rev 5725)
@@ -140,7 +140,9 @@
echo " CREATE RPM PACKAGE"
cd $CURR_DIR
cd temp/rpm
- rpmbuild -bb rpmbuild/$RPM_SPEC_NAME
+ topdir=`pwd`/rpmbuild
+ echo $topdir
+ rpmbuild -bb --define "_topdir $topdir" rpmbuild/$RPM_SPEC_NAME
echo
echo
Modified:
trunk/perfsonar-java-xml-ls/packaging/rpm/perfsonar-java-xml-ls.specs
===================================================================
--- trunk/perfsonar-java-xml-ls/packaging/rpm/perfsonar-java-xml-ls.specs
2010-08-17 17:11:46 UTC (rev 5724)
+++ trunk/perfsonar-java-xml-ls/packaging/rpm/perfsonar-java-xml-ls.specs
2010-08-18 09:07:13 UTC (rev 5725)
@@ -10,9 +10,11 @@
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
Group: Network/Web service
-packager: Slawomir Trzaszczka
<>
+packager: Krzysztof Jedrzejewski
<>
URL: http://www.perfsonar.org
-Requires: exist, jre >= 1.6
+Requires: exist
+Requires: jre >= 1.6
+Requires: tomcat5
BuildArch: noarch
@@ -134,9 +136,8 @@
-
%changelog
-* Thu May 27 2010 Slawomir Trzaszczka
<>
1.5-rc4
+* Thu May 27 2010 Krzysztof Jedrzejewski
<>
1.5-rc4
- Fixes: bugs fixes PSSERVICES-503
- New: old naming policy supported geant2-java-xml-ls - improved
Modified: trunk/perfsonar-java-xml-ls/pom.xml
===================================================================
--- trunk/perfsonar-java-xml-ls/pom.xml 2010-08-17 17:11:46 UTC (rev 5724)
+++ trunk/perfsonar-java-xml-ls/pom.xml 2010-08-18 09:07:13 UTC (rev 5725)
@@ -217,7 +217,7 @@
<dependency>
<groupId>perfsonar</groupId>
<artifactId>ps-mdm-base2</artifactId>
- <version>1.0.0</version>
+ <version>1.0.4</version>
</dependency>
<dependency>
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/EchoServiceEngine.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/EchoServiceEngine.java
2010-08-17 17:11:46 UTC (rev 5724)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/EchoServiceEngine.java
2010-08-18 09:07:13 UTC (rev 5725)
@@ -18,11 +18,9 @@
* @author Maciej Glowiak,Slawomir Trzaszczka
*
*/
-public class EchoServiceEngine extends GenericLSServiceEngine implements
- ServiceEngine {
+public class EchoServiceEngine extends GenericLSServiceEngine implements
ServiceEngine {
- private static final Logger logger = Logger
- .getLogger(EchoServiceEngine.class.getName());
+ private static final Logger logger =
Logger.getLogger(EchoServiceEngine.class.getName());
private final static String[] SUPPORTED_SELFTEST_EVENT_TYPES = {
"http://schemas.perfsonar.net/tools/admin/echo/ls/2.0",
@@ -83,8 +81,9 @@
return sb.toString();
}
- public void takeAction(ServiceMessage serviceRequest,
- ServiceMessage serviceResponse) throws
PerfSONARException {
+ @Override
+ public void takeAction(ServiceMessage serviceRequest, ServiceMessage
serviceResponse)
+ throws PerfSONARException {
// extract message
Message request = serviceRequest.getMessageElement();
@@ -100,25 +99,20 @@
// check eventtype
EventType eventType = metadata.getFirstEventType();
if (eventType == null) {
-// TODO: url event types
- throw new PerfSONARException(
- "error.ls.no_eventtype",
- "LS EchoRequest error: "
- + "Error while
determining eventType (possibly no eventType at all). "
- + "EventType must be
[" + getEventTypesString()
- + "]. ");
+ // TODO: url event types
+ throw new PerfSONARException("error.ls.no_eventtype",
"LS EchoRequest error: "
+ + "Error while determining eventType
(possibly no eventType at all). "
+ + "EventType must be [" +
getEventTypesString() + "]. ");
} else {
strEventType = eventType.getEventType();
selftest = isSelfTestEventTypeSupported(strEventType);
echo = isEchoEventTypeSupported(strEventType);
if (!selftest && !echo)
-// TODO: url event types
- throw new PerfSONARException(
-
"error.ls.eventtype_not_supported",
- "LS EchoRequest error: " +
"Not supported event type ["
- +
strEventType + "]. " + "Must be: ["
- +
getEventTypesString() + "]");
+ // TODO: url event types
+ throw new
PerfSONARException("error.ls.eventtype_not_supported",
+ "LS EchoRequest error: " +
"Not supported event type [" + strEventType
+ + "]. " +
"Must be: [" + getEventTypesString() + "]");
}
@@ -145,23 +139,21 @@
* @return
* @throws PerfSONARException
*/
- public Message takeSelfTestAction(ServiceMessage serviceRequest)
- throws PerfSONARException {
+ public Message takeSelfTestAction(ServiceMessage serviceRequest)
throws PerfSONARException {
// create request
Message msg = new Message();
msg.setId("EchoResponse");
Metadata meta = new Metadata("result-code-metadata", "nmwg");
- EventType evt = new EventType(
-
"http://schemas.perfsonar.net/tools/admin/selftest/1.0", "nmwg");
+ EventType evt = new
EventType("http://schemas.perfsonar.net/tools/admin/selftest/1.0",
+ "nmwg");
meta.addChild(evt);
Data data = new Data("result-code-data", "result-code",
"nmwg");
data.setMetadataIdRef("result-code-metadata");
- Element datum = new Element("datum", "nmwgr",
- "http://ggf.org/ns/nmwg/result/2.0/");
+ Element datum = new Element("datum", "nmwgr",
"http://ggf.org/ns/nmwg/result/2.0/");
data.addChild(datum);
msg.addChild(meta);
@@ -189,7 +181,7 @@
String messageName = "exist-db-collection-store-control";
String messageDescription = "";
-// TODO: url event types
+ // TODO: url event types
String postfixResult =
".ls.selftest.collection.lsstore-control";
String prefixResult = "success";
@@ -211,8 +203,7 @@
+ ex.getMessage();
}
- addResultCode(data, messageName, prefixResult + postfixResult,
- messageDescription);
+ addResultCode(data, messageName, prefixResult +
postfixResult, messageDescription);
}
/**
@@ -225,7 +216,7 @@
String messageName = "exist-db-collection-store-summary";
String messageDescription = "";
-// TODO: url event types
+ // TODO: url event types
String postfixResult = ".ls.selftest.collection.summary";
String prefixResult = "success";
@@ -245,8 +236,7 @@
+ ex.getMessage();
}
- addResultCode(data, messageName, prefixResult + postfixResult,
- messageDescription);
+ addResultCode(data, messageName, prefixResult +
postfixResult, messageDescription);
}
/**
@@ -258,15 +248,13 @@
private void testDBConnectivity(Data data) {
try {
if (dao.isDBConnectivity()) {
-// TODO: url event types
- addResultCode(data, "exist-db-connectivity",
-
"success.ls.selftest.dbconnectivity",
+ // TODO: url event types
+ addResultCode(data, "exist-db-connectivity",
"success.ls.selftest.dbconnectivity",
"eXist DB connection
established");
}
} catch (PerfSONARException ex) {
-// TODO: url event types
- addResultCode(data, "exist-db-connectivity",
- "error.ls.selftest.dbconnectivity",
+ // TODO: url event types
+ addResultCode(data, "exist-db-connectivity",
"error.ls.selftest.dbconnectivity",
"eXist DB connection not working: " +
ex.getMessage());
}
}
@@ -278,11 +266,10 @@
* @return
* @throws PerfSONARException
*/
- public Message takeEchoAction(ServiceMessage serviceRequest)
- throws PerfSONARException {
-// TODO: url event types
- Message msg = ResultCodesUtil.generateResultMessage(null,
- "success.echo", "Echo - ping succeeded");
+ public Message takeEchoAction(ServiceMessage serviceRequest) throws
PerfSONARException {
+ // TODO: url event types
+ Message msg = ResultCodesUtil.generateResultMessage(null,
"success.echo",
+ "Echo - ping succeeded");
return msg;
}
@@ -294,8 +281,7 @@
* @param code
* @param desc
*/
- private void addResultCode(Data incomingData, String name, String
code,
- String desc) {
+ private void addResultCode(Data incomingData, String name, String
code, String desc) {
Metadata meta = new Metadata();
meta.setId(name);
@@ -309,8 +295,7 @@
data.setId(name + "-data");
data.setMetadataIdRef(name);
- Element datum = new Element("datum", "nmwgr",
- "http://ggf.org/ns/nmwg/result/2.0/");
+ Element datum = new Element("datum", "nmwgr",
"http://ggf.org/ns/nmwg/result/2.0/");
datum.setText(desc);
data.addChild(datum);
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegisterServiceEngine.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegisterServiceEngine.java
2010-08-17 17:11:46 UTC (rev 5724)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegisterServiceEngine.java
2010-08-18 09:07:13 UTC (rev 5725)
@@ -23,8 +23,7 @@
*/
public class LSRegisterServiceEngine extends LSRegisterServiceHelper {
- private final Logger logger = Logger
- .getLogger(LSRegisterServiceEngine.class);
+ private final Logger logger =
Logger.getLogger(LSRegisterServiceEngine.class);
private boolean allowReplaceIfAlreadyRegistered = true;
@@ -32,56 +31,53 @@
super();
}
- public void takeAction(ServiceMessage serviceRequest,
- ServiceMessage serviceResponse) throws
PerfSONARException {
+ public void takeAction(ServiceMessage serviceRequest, ServiceMessage
serviceResponse)
+ throws PerfSONARException {
// extract message
Message request = serviceRequest.getMessageElement();
-
if (getTtlBound() != null) {
// if TTL bounds are defined check if the user send
lsTTL parameter
-
- List<Element> parametersNodes = (List<Element>)
serviceRequest
- .getElement().getChildren("parameters");
+
+ List<Element> parametersNodes = (List<Element>)
serviceRequest.getElement()
+ .getChildren("parameters");
if (parametersNodes != null && parametersNodes.size()
== 1) {
try {
long clientTTL =
getLSTTLFromParametrs(parametersNodes.get(0));
setClientTTL(clientTTL);
if (clientTTL != 0) {
- logger.debug("TTL
parameters are set");
-
logger.debug("suggested TTL param by client :"
- +
clientTTL);
- if
(isBetweenTTLBound(clientTTL)) {
-
setTtlParameterStatus(LsTTLParameterStatus.ACCEPTED);
-
setClientTTL(clientTTL);
-
logger.info("client TTL accepted");
- } else {
-
setTtlParameterStatus(LsTTLParameterStatus.OUT_OF_BOUND);
-
logger.info("client TTL rejected - out of bound");
-
setClientTTL(0);
- }
+ logger.debug("TTL parameters
are set");
+ logger.debug("suggested TTL
param by client :" + clientTTL);
+ if
(isBetweenTTLBound(clientTTL)) {
+
setTtlParameterStatus(LsTTLParameterStatus.ACCEPTED);
+
setClientTTL(clientTTL);
+ logger.info("client
TTL accepted");
+ } else {
+
setTtlParameterStatus(LsTTLParameterStatus.OUT_OF_BOUND);
+ logger.info("client
TTL rejected - out of bound");
+ setClientTTL(0);
+ }
}
} catch (PerfSONARException ex) {
setTtlParameterStatus(LsTTLParameterStatus.NOT_A_NUMBER);
}
}
- }else{
+ } else {
logger.warn("client sent ttl parameter - no ranges
params defined in config file !!");
}
-
+
// Get Metadata from request
Metadata requestMetadata =
getFirstMetadataFromRequest(request);
if (requestMetadata == null) {
String m = "[LS Registration] No metadata in incoming
request";
logger.error(m);
-// TODO: url event types
+ // TODO: url event types
throw new PerfSONARException("error.ls.no_metadata",
m);
}
- logger.debug("Getting metadata from request: ["
- + requestMetadata.getId() + "]");
+ logger.debug("Getting metadata from request: [" +
requestMetadata.getId() + "]");
EventType reqEvT = null;
String reqEventType = null;
@@ -93,8 +89,7 @@
// for backward compatibility
if ((!isGLS()) && (reqEventType == null)) {
reqEventType = SERVICE_EVENT_TYPE;
- logger.debug("Taking default eventType [" +
SERVICE_EVENT_TYPE
- + "]");
+ logger.debug("Taking default eventType [" +
SERVICE_EVENT_TYPE + "]");
}
// check GLS
@@ -105,12 +100,10 @@
logger.debug("eventType accepted [" + reqEventType +
"]");
} else {
String m = "[LS Registration] no service event type
or wrong eventType! Service is "
- + ((isGLS()) ? "[global-LS] and
accepts ["
- + SUMMARY_EVENT_TYPE
+ "]"
- : "[home-LS] and
accepts [" + SERVICE_EVENT_TYPE
- +
"]");
+ + ((isGLS()) ? "[global-LS] and
accepts [" + SUMMARY_EVENT_TYPE + "]"
+ : "[home-LS] and
accepts [" + SERVICE_EVENT_TYPE + "]");
logger.error(m);
-// TODO: url event types
+ // TODO: url event types
throw new
PerfSONARException("error.ls.wrong_eventtype", m);
}
@@ -161,7 +154,7 @@
+ "] not found in the
storage. "
+ "Can't UPDATE such data,
because can't determine what data should be updated";
logger.debug(m);
-// TODO: url event types
+ // TODO: url event types
throw new
PerfSONARException("error.ls.update.key_not_found", m);
} else {
doRemoveOldKey = true; // remove also old key
@@ -179,8 +172,7 @@
// process with register/update
- logger.debug("check whether lookup info [" + metadataId
- + "] exists in DB");
+ logger.debug("check whether lookup info [" + metadataId + "]
exists in DB");
// check if there is metadata with the same key:
// if so, check if you're allowed to update data (to remove
them)
@@ -197,11 +189,11 @@
} else {
String m = "Can't replace data";
logger.error(m);
-// TODO: url event types
+ // TODO: url event types
throw new
PerfSONARException("error.ls.cant_replace_data", m);
}
- }
+ }
// change metadata id
requestMetadata.setId(metadataId);
@@ -225,9 +217,7 @@
// remove old Lookup Info as well - if update and
// there is lookup info with different key
if (doRemoveOldKey && (!keyValue.equals(metadataId))) {
- logger
- .info("Remove old Lookup Info - other
key (" + keyValue
- + ")");
+ logger.info("Remove old Lookup Info - other key (" +
keyValue + ")");
int num = dao.removeLookupInfo(keyValue);
logger.debug("Removed [" + num + "] old entries");
}
@@ -238,8 +228,8 @@
ModificationCounterComponent component =
getModificationCounterComponent();
component.incrementCounter();
- logger.info("Put new Lookup Info (" + metadataId + ")
metadata + "
- + dataElements.length + " data elements");
+ logger.info("Put new Lookup Info (" + metadataId + ")
metadata + " + dataElements.length
+ + " data elements");
// update control time - last modification
updateTime(metadataId);
if
(getTtlParameterStatus().equals(LsTTLParameterStatus.ACCEPTED)) {
@@ -253,8 +243,8 @@
private ModificationCounterComponent getModificationCounterComponent()
throws PerfSONARException {
ConfigurationManager cm = ConfigurationManager.getInstance();
- return (ModificationCounterComponent) cm.getConfiguration()
-
.getAuxiliaryComponent("modificationCounterComponent");
+ return (ModificationCounterComponent)
cm.getConfiguration().getAuxiliaryComponent(
+ "modificationCounterComponent");
}
}
Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/dao/SingleFileDAOImpl.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/dao/SingleFileDAOImpl.java
2010-08-17 17:11:46 UTC (rev 5724)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/dao/SingleFileDAOImpl.java
2010-08-18 09:07:13 UTC (rev 5725)
@@ -21,32 +21,30 @@
* @author Maciej Glowiak
*
*/
-public class SingleFileDAOImpl extends XQueryDAOSupportImpl implements
LookupServiceDAO{
+public class SingleFileDAOImpl extends XQueryDAOSupportImpl implements
LookupServiceDAO {
-
protected static final String UPDATE_LSSTORE = "
/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE + "'] ";
-
@Override
public void putLookupInfo(Metadata m, Data[] d) throws
PerfSONARException {
if (m == null) {
String msg = "No metadata. Cannot put into database";
logger.error(msg);
-// TODO: url event types
+ // TODO: url event types
throw new PerfSONARException("error.ls.no_metadata",
msg);
}
if (d == null) {
String msg = "No data (null). Cannot put into
database";
logger.error(msg);
-// TODO: url event types
+ // TODO: url event types
throw new PerfSONARException("error.ls.no_data", msg);
}
if (d.length < 1) {
String msg = "No data (0). Cannot put into database";
logger.error(msg);
-// TODO: url event types
+ // TODO: url event types
throw new PerfSONARException("error.ls.no_data", msg);
}
@@ -66,25 +64,24 @@
xmls.append(" (\n"); // IMPORTANT - begin Xquery collection
(m, d, d,
// ...)
-
- // add metadata to StringBuffer
- try {
- ser.write(os, m);
- // convert data to Strings
- for (int i = 0; i < d.length; i++) {
- xmls.append(", \n"); // IMPORTANT -
separator for next element
- // of Xquery collection (m, d, d, ...)
- ser.write(os, d[i]);
- }
- } catch (XMLStreamException e) {
-// TODO: url event types
- throw new PerfSONARException("error.parse",
- "Cannot serialize elements in
XQueryExistDAOImpl");
- } catch (IOException e) {
-// TODO: url event types
- throw new PerfSONARException("error.parse",
- "Cannot serialize elements in
XQueryExistDAOImpl");
+ // add metadata to StringBuffer
+ try {
+ ser.write(os, m);
+ // convert data to Strings
+ for (int i = 0; i < d.length; i++) {
+ xmls.append(", \n"); // IMPORTANT - separator
for next element
+ // of Xquery collection (m, d, d, ...)
+ ser.write(os, d[i]);
}
+ } catch (XMLStreamException e) {
+ // TODO: url event types
+ throw new PerfSONARException("error.parse",
+ "Cannot serialize elements in
XQueryExistDAOImpl");
+ } catch (IOException e) {
+ // TODO: url event types
+ throw new PerfSONARException("error.parse",
+ "Cannot serialize elements in
XQueryExistDAOImpl");
+ }
// send XQuery
xmls.append(" )\n"); // IMPORTANT - end of Xquery collection
(m, d, d,
@@ -113,8 +110,7 @@
}
@Override
- public int cleanupLookupInfo(long timestamp, long defaultInterval)
- throws PerfSONARException {
+ public int cleanupLookupInfo(long timestamp, long defaultInterval)
throws PerfSONARException {
String xquery = DECLARE_NMWG_NAMESPACE
+
@@ -162,17 +158,17 @@
"("
+
// metadata from
"+LS_STORE_CONTROL_COLLECTION_TYPE+"
-
"/nmwg:store[@type='"
+ LS_STORE_CONTROL_COLLECTION_TYPE
- +
"']/nmwg:metadata[@id='"
+ metadataId + "']"
+
"/nmwg:store[@type='"
+ LS_STORE_CONTROL_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"
+ + metadataId + "']"
+ ", "
+
// metadata from "+LS_STORE_COLLECTION_TYPE+"
-
"/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE
- +
"']/nmwg:metadata[@id='"
+ metadataId + "']" + ", "
+
"/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE +
"']/nmwg:metadata[@id='"
+ + metadataId + "']" + ", "
+
// data from "+LS_STORE_COLLECTION_TYPE+"
-
"/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE
- +
"']/nmwg:data[@metadataIdRef='"
+ metadataId + "']" + ")";
+
"/nmwg:store[@type='"
+ LS_STORE_COLLECTION_TYPE +
"']/nmwg:data[@metadataIdRef='"
+ + metadataId + "']" + ")";
}
}
- [pS-dev] [GEANT/SA2/ps-java-services] r5725 - in trunk/perfsonar-java-xml-ls: . contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/auxiliary packaging packaging/deb packaging/rpm src/main/java/org/perfsonar/service/lookupservice src/main/java/org/perfsonar/service/lookupservice/storage/exist/dao, svn-noreply, 08/18/2010
Archive powered by MHonArc 2.6.16.