Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6071 - in trunk: perfsonar-java-sql-ma/src/main/java/org/perfso nar/service/measurementArchive/sqlType perfsonar_base/sr c/main/java/org/perfsonar/service/base/messages

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/ps-java-services] r6071 - in trunk: perfsonar-java-sql-ma/src/main/java/org/perfso nar/service/measurementArchive/sqlType perfsonar_base/sr c/main/java/org/perfsonar/service/base/messages


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6071 - in trunk: perfsonar-java-sql-ma/src/main/java/org/perfso nar/service/measurementArchive/sqlType perfsonar_base/sr c/main/java/org/perfsonar/service/base/messages
  • Date: Wed, 19 Dec 2012 07:58:15 +0000 (GMT)

Author: nordunet.behrmann
Date: 2012-12-19 07:58:15 +0000 (Wed, 19 Dec 2012)
New Revision: 6071

Modified:

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/BaseChaining.java
Log:
perfsonar_base, perfsonar-java-sql-ma: Minor readability improvements

Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2012-12-17 07:12:53 UTC (rev 6070)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2012-12-19 07:58:15 UTC (rev 6071)
@@ -1,8 +1,6 @@
package org.perfsonar.service.measurementArchive.sqlType;

import java.util.Collection;
-import java.util.Date;
-import java.util.Random;
import java.util.Iterator;
import java.util.Set;

@@ -12,7 +10,6 @@
import org.ggf.ns.nmwg.base.v2_0.Key;
import org.ggf.ns.nmwg.base.v2_0.Message;
import org.ggf.ns.nmwg.base.v2_0.Metadata;
-import org.ggf.ns.nmwg.base.v2_0.Parameter;
import org.ggf.ns.nmwg.base.v2_0.Parameters;

import org.ggf.ns.nmwg.base.v2_0.Subject;
@@ -224,54 +221,34 @@
if (!resp.getDataMap().isEmpty()) {
// metadata already exists in xmldb

- Data d = (resp.getDataArray())[0];
- key = d.getKey();
+ Data data = (resp.getDataArray())[0];
+ key = data.getKey();

if (key.getParameterByName("eventType") == null) {
key.addParameter("eventType", eventType);
}
} else {
// metadata does not exist in xmldb
- Key k = new Key();

- Random rand = new Random((new Date()).getTime());
- String metadataId = "meta" + Long.toString(rand.nextLong());
-
+ Metadata metadata2 = new Metadata();
+ metadata2.addChild(metadata.getSubject());
+ metadata2.setEventType(eventTypeObj);
Parameters params = metadata.getParameters();
- Parameters originalParams = null;
if (params != null) {
- originalParams = copyParameters(params);
+ metadata2.setParameters(params);
}
- if (params == null || !params.getPrefix().equals("nmwg")) {
- params = new Parameters();
- params.addParameter("eventType", eventType);
- }

- k.addChild(params);
- params.addParameter("metadataId", metadataId);
-
- key = k;
+ key = new Key();
+ key.addParameter("metadataId", metadata2.getId());
key.addParameter("eventType", eventType);

- // we need to remove parameters from metadata,
- // so temporary metadata is created with elements from
original metadata
- // except parameters
- Metadata metadata2 = new Metadata();
- metadata2.addChild(metadata.getSubject());
- metadata2.setEventType(eventTypeObj);
+ Data data = new Data();
+ data.addChild(key);
+ data.setMetadataIdRef(metadata2.getId());

- // adding original parameters
- if (originalParams != null) {
- metadata2.setParameters(originalParams);
- }
-
Message configMessage = new Message();
- metadata2.setId(metadataId);
configMessage.addChild(metadata2);
- Data dk = new Data();
- dk.addChild(key);
- dk.setMetadataIdRef(metadata2.getId());
- configMessage.addChild(dk);
+ configMessage.addChild(data);

metadataConfig.store(configMessage);
}
@@ -279,26 +256,9 @@
return key;
}

- private Parameters copyParameters(Parameters parameters)
- {
-
- Parameters newParameters = new Parameters();
- newParameters.setUri(parameters.getUri());
- newParameters.setPrefix(parameters.getPrefix());
- newParameters.setLocalName(parameters.getLocalName());
- newParameters.setQName(parameters.getQName());
- Iterator it = parameters.getParameterIterator();
- while (it.hasNext()) {
- Parameter parameter = (Parameter) it.next();
- newParameters.addParameter(parameter.getParameterName(),
parameter.getParameterValue());
- }
- return newParameters;
- }
-
protected Message replaceMetadataConfiguration(Message request)
throws PerfSONARException
{
-
if (!isFirstRunDone()) {
metadataConfig.removeAll();
}
@@ -575,7 +535,7 @@
}
} else if (key != null || eventType != null) {
if (key != null) {
- getKeyByIdentity(metadata.getKey(), response);
+ getKeyByIdentity(key, response);
}
if (eventType != null) {
getKeyFromConfigurationStore(metadata, response);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/BaseChaining.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/BaseChaining.java
2012-12-17 07:12:53 UTC (rev 6070)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/BaseChaining.java
2012-12-19 07:58:15 UTC (rev 6071)
@@ -62,20 +62,12 @@

// -- metadata

- Metadata newMetadata;
Iterator metaIt = message.getMetadataIterator();
while (metaIt.hasNext()) {
-
- newMetadata = new Metadata();
-
Metadata metadata = (Metadata) metaIt.next();
- String id = metadata.getId();
- newMetadata = processMetadataChaining(metadata, metadataMap,
newMetadata);
- newMetadata.setId(id);
-
+ Metadata newMetadata = processMetadataChaining(metadata,
metadataMap, new Metadata());
+ newMetadata.setId(metadata.getId());
newMessage.setMetadata(newMetadata);
-
-
}

// -- data



  • [pS-dev] [GEANT/SA2/ps-java-services] r6071 - in trunk: perfsonar-java-sql-ma/src/main/java/org/perfso nar/service/measurementArchive/sqlType perfsonar_base/sr c/main/java/org/perfsonar/service/base/messages, svn-noreply, 12/19/2012

Archive powered by MHonArc 2.6.16.

Top of Page