Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2810 - branches/new-structure/trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa

Subject: perfsonar development work

List archive

perfsonar: r2810 - branches/new-structure/trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2810 - branches/new-structure/trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa
  • Date: Wed, 12 Sep 2007 04:55:18 -0400

Author: michael.bischoff
Date: 2007-09-12 04:55:17 -0400 (Wed, 12 Sep 2007)
New Revision: 2810

Modified:

branches/new-structure/trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaGetRequest.java
Log:
timezone fix

Modified:
branches/new-structure/trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaGetRequest.java
===================================================================
---
branches/new-structure/trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaGetRequest.java
2007-09-12 08:44:47 UTC (rev 2809)
+++
branches/new-structure/trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaGetRequest.java
2007-09-12 08:55:17 UTC (rev 2810)
@@ -28,18 +28,18 @@
import
org.perfsonar.service.measurementArchive.flowsa.nfdump.rules.SimpleAggegrationRule;

public class FlowsaGetRequest {
-
+
private static final String ISO8601_PATTERN =
"yyyy-MM-dd'T'HH:mm:ssZ";
private final LoggerComponent logger;
private final Message request;
private EventType eventType;
private Node[] nodes;
- private Map<String, String> parameters = new HashMap<String,String>();
+ private Map<String, String> parameters = new HashMap<String,
String>();
private String eventTypeValue;
private Date startTime;
private Date endTime;
private Integer topN;
-
+
public FlowsaGetRequest(Message request) throws PerfSONARException {
this.request = request;
this.logger = FlowsaGetRequest.getLoggerComponent();
@@ -47,49 +47,51 @@
}

private void processMetadata(Message request) {
- for(Metadata metadata : request.getMetadataArray()) {
- processSubject(metadata.getSubject());
- processParameters(metadata.getParameters());
- processEventType(metadata.getEventType());
- }
+ for (Metadata metadata : request.getMetadataArray()) {
+ processSubject(metadata.getSubject());
+ processParameters(metadata.getParameters());
+ processEventType(metadata.getEventType());
+ }
}

private void processParameters(Parameters parameters) {
- if(parameters==null) {
+ if (parameters == null) {
return;
- }
- for(Parameter parameter : parameters.getParameterArray()) {
+ }
+ for (Parameter parameter : parameters.getParameterArray()) {
String name = parameter.getParameterName();
- if("startTime".equals(name) ||
"endTime".equals(name)) {
+ if ("startTime".equals(name) ||
"endTime".equals(name)) {
processTimeParameter(parameter);
} else {
-
this.parameters.put(name,parameter.getParameterValue());
+ this.parameters.put(name,
parameter.getParameterValue());
}
}
}

private void processTimeParameter(Parameter parameter) {
- for(Element child : parameter.getChildArray()) {
+ for (Element child : parameter.getChildArray()) {
if (child instanceof Time) {
Time time = (Time) child;
parameters.put(parameter.getParameterName(),
time.getValue());
}
- }
+ }
}

private void processEventType(org.ggf.ns.nmwg.base.v2_0.EventType
eventType) {
- if(eventType==null) {
+ if (eventType == null) {
return;
}
this.eventTypeValue = eventType.getEventType();
- logger.debug("FlowsaMAServiceEngine.processGetDataRequest:
Eventype indentified as: " + eventTypeValue);
+ logger
+
.debug("FlowsaMAServiceEngine.processGetDataRequest: Eventype indentified as:
"
+ + eventTypeValue);
this.eventType = EventType.get(eventTypeValue);
}

private void processSubject(org.ggf.ns.nmwg.base.v2_0.Subject
subject) {
if (subject instanceof Subject) {
- Subject flowSubject = (Subject) subject;

- if(flowSubject.getNetwork()!=null) {
+ Subject flowSubject = (Subject) subject;
+ if (flowSubject.getNetwork() != null) {
this.nodes =
flowSubject.getNetwork().getNodeArray();
}
} else {
@@ -107,43 +109,39 @@

/**
* get's the logger component
+ *
* @return
* @throws PerfSONARException
*/
- private static LoggerComponent getLoggerComponent() throws
PerfSONARException {
+ private static LoggerComponent getLoggerComponent()
+ throws PerfSONARException {
try {
- return (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
- } catch (PerfSONARException underlayingException) {
- throw new PerfSONARException(
- "error.common.no_logger",
- "FlowTypeMAServiceEngine.constructor: Cannot get logger
component",
- underlayingException
- );
- }
+ return (LoggerComponent)
AuxiliaryComponentManager.getInstance()
+ .getComponent(ComponentNames.LOGGER);
+ } catch (PerfSONARException underlayingException) {
+ throw new PerfSONARException(
+ "error.common.no_logger",
+ "FlowTypeMAServiceEngine.constructor:
Cannot get logger component",
+ underlayingException);
+ }
}
-
+
public Date getStartTime() {
- if(startTime==null) {
+ if (startTime == null) {
String value = parameters.get("startTime");
- if(value.length()<19) {
- logger.error("Could not parse DateTime.
(startTime)");
- return null;
- }
- String dateTime = value.substring(0, 19);
- //TODO time-zone.
- DateFormat dateFormat = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+ DateFormat dateFormat = new
SimpleDateFormat(ISO8601_PATTERN);
try {
- startTime = dateFormat.parse(dateTime);
+ startTime = dateFormat.parse(value);
} catch (ParseException e) {
logger.error("Could not parse DateTime.
(startTime)");
startTime = null;
}
}
- return startTime;
+ return endTime;
}

public Date getEndTime() {
- if(endTime==null) {
+ if (endTime == null) {
String value = parameters.get("endTime");
DateFormat dateFormat = new
SimpleDateFormat(ISO8601_PATTERN);
try {
@@ -156,27 +154,27 @@
return endTime;
}

- public Filter getFilter() {
+ public Filter getFilter() {
String value = parameters.get("filterRule");
- if(value==null || value.equals("")) {
+ if (value == null || value.equals("")) {
return null;
}
return new SimpleFilter(value);
}

public AggegrationRule getAggegrationRule() {
- String value = parameters.get("aggregationRule");
- if(value==null || value.equals("")) {
+ String value = parameters.get("aggregationRule");
+ if (value == null || value.equals("")) {
return null;
}
- return new SimpleAggegrationRule(value) ;
+ return new SimpleAggegrationRule(value);
}

public Collection<String> getHostNames() {
Collection<String> hostnames = new ArrayList<String>();
- for(Node node : nodes) {
+ for (Node node : nodes) {
HostName hostNameElement = node.getHostNameElement();
- if(hostNameElement!=null) {
+ if (hostNameElement != null) {
hostnames.add(hostNameElement.getHostName());
}
}
@@ -195,12 +193,12 @@
return parameters.get("orderBy");
}

- public boolean isSplittingProtocol() {
+ public boolean isSplittingProtocol() {
return parameters.get("splitProtocol").equals("yes");
}

public int getTopN() {
- if(topN==null) {
+ if (topN == null) {
try {
topN = new Integer(parameters.get("topN"));
} catch (NumberFormatException e) {



  • perfsonar: r2810 - branches/new-structure/trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa, svnlog, 09/12/2007

Archive powered by MHonArc 2.6.16.

Top of Page