perfsonar-dev - perfsonar: r5210 - in branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice: . registerService registration
Subject: perfsonar development work
List archive
perfsonar: r5210 - in branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice: . registerService registration
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5210 - in branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice: . registerService registration
- Date: Mon, 6 Jul 2009 02:53:37 -0400
Author: trzaszcz
Date: 2009-07-06 02:53:36 -0400 (Mon, 06 Jul 2009)
New Revision: 5210
Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/LsTTLParameterStatus.java
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegisterServiceEngine.java
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registerService/LSRegisterServiceHelper.java
Log:
improved a response message format with lsTTL parameter
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegisterServiceEngine.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegisterServiceEngine.java
2009-07-03 12:13:04 UTC (rev 5209)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/LSRegisterServiceEngine.java
2009-07-06 06:53:36 UTC (rev 5210)
@@ -55,7 +55,6 @@
// extract message
Message request = serviceRequest.getMessageElement();
- long clientTTL = 0;
//lsTTL param processing
@@ -63,20 +62,20 @@
.getElement().getChildren("parameters");
if (parametersNodes != null && parametersNodes.size() == 1) {
try {
- clientTTL =
getLSTTLFromParametrs(parametersNodes.get(0));
- if (clientTTL != 0) {
+
setClientTTL(getLSTTLFromParametrs(parametersNodes.get(0)));
+ if (getClientTTL() != 0) {
if (getTtlBound() != null) {
logger.info("TTL parameters
are set");
logger.info("suggested TTL
param by service :"
- + clientTTL);
- if (clientTTL <=
getTtlBound()[1]
- && clientTTL
>= getTtlBound()[0]) {
+ +
getClientTTL());
+ if (getClientTTL() <=
getTtlBound()[1]
+ &&
getClientTTL() >= getTtlBound()[0]) {
ttlParameterStatus =
LsTTLParameterStatus.ACCEPTED;
logger.info("client
TTL accepted");
} else {
ttlParameterStatus =
LsTTLParameterStatus.OUT_OF_BOUND;
logger.info("client
TTL rejected - out of bound");
- clientTTL = 0;
+ setClientTTL(0);
}
} else {
logger
@@ -298,7 +297,7 @@
updateTime(metadataId);
if (ttlParameterStatus.equals(LsTTLParameterStatus.ACCEPTED))
{
logger.info("ttl parameter set !");
- updateTTL(metadataId, clientTTL);
+ updateTTL(metadataId, getClientTTL());
}
// get response with success code and key
serviceResponse.setElement(getLSRegisterResponse(metadataId));
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registerService/LSRegisterServiceHelper.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registerService/LSRegisterServiceHelper.java
2009-07-03 12:13:04 UTC (rev 5209)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registerService/LSRegisterServiceHelper.java
2009-07-06 06:53:36 UTC (rev 5210)
@@ -38,6 +38,7 @@
protected LsTTLParameterStatus ttlParameterStatus =
LsTTLParameterStatus.NONE;
private final long[] ttlBound;
+ private long clientTTL;
protected LSRegisterServiceHelper() throws PerfSONARException {
super();
@@ -244,9 +245,21 @@
"registration.lsTTL.outOfBound",
params);
}
+ StringBuffer sb=new StringBuffer();
+
+ sb.append("Data has been registered with key [");
+ sb.append(keyValue);
+ sb.append("]");
+
+ if(ttlParameterStatus.equals(LsTTLParameterStatus.ACCEPTED)){
+ sb.append(" and lsTTL parameter [");
+ sb.append(clientTTL);
+ sb.append(" sec.]");
+ }
+
+
Message msg = ResultCodesUtil.generateResultMessage(null,
- "success/ls/register", "Data has been
registered with key ["
- + keyValue + "] ");
+ "success/ls/register", sb.toString());
if
(ttlParameterStatus.equals(LsTTLParameterStatus.NOT_A_NUMBER)
||
ttlParameterStatus.equals(LsTTLParameterStatus.OUT_OF_BOUND)) {
@@ -340,4 +353,12 @@
LookupServiceDAO dao = LookupServiceDAOFactory.getDAO();
dao.setControlParameter(metadataId, "lsTTL",
String.valueOf(lsTTL));
}
+
+ public long getClientTTL() {
+ return clientTTL;
+ }
+
+ public void setClientTTL(long clientTTL) {
+ this.clientTTL = clientTTL;
+ }
}
Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/LsTTLParameterStatus.java
- perfsonar: r5210 - in branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice: . registerService registration, svnlog, 07/06/2009
Archive powered by MHonArc 2.6.16.