perfsonar-dev - perfsonar: r3338 - in trunk/surfnet_java-flowsa-ma: . conf conf/axis-1.4/WEB-INF src/main/java/org/perfsonar/service/measurementArchive/flowsa src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders
Subject: perfsonar development work
List archive
perfsonar: r3338 - in trunk/surfnet_java-flowsa-ma: . conf conf/axis-1.4/WEB-INF src/main/java/org/perfsonar/service/measurementArchive/flowsa src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3338 - in trunk/surfnet_java-flowsa-ma: . conf conf/axis-1.4/WEB-INF src/main/java/org/perfsonar/service/measurementArchive/flowsa src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders
- Date: Mon, 11 Feb 2008 08:46:18 -0500
Author: michael.bischoff
Date: 2008-02-11 08:46:17 -0500 (Mon, 11 Feb 2008)
New Revision: 3338
Added:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/IllegalFilterSyntaxException.java
Modified:
trunk/surfnet_java-flowsa-ma/.classpath
trunk/surfnet_java-flowsa-ma/.project
trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/web.xml
trunk/surfnet_java-flowsa-ma/conf/service.properties
trunk/surfnet_java-flowsa-ma/pom.xml
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaMAServiceEngine.java
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/NfcapdControll.java
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpControll.java
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpOutputReader.java
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders/Nfdump1_5_5OutputReaderImpl.java
Log:
fixes bugs
Modified: trunk/surfnet_java-flowsa-ma/.classpath
===================================================================
--- trunk/surfnet_java-flowsa-ma/.classpath 2008-02-08 15:30:53 UTC (rev
3337)
+++ trunk/surfnet_java-flowsa-ma/.classpath 2008-02-11 13:46:17 UTC (rev
3338)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-1.5.0-sun-1.5.0.11"/>
- <classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry including="**/*.java" kind="src"
path="src/main/java"/>
+ <classpathentry including="**/*.java" kind="src"
output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="con"
path="org.devzuz.q.maven.jdt.core.mavenClasspathContainer"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/surfnet_java-flowsa-ma/.project
===================================================================
--- trunk/surfnet_java-flowsa-ma/.project 2008-02-08 15:30:53 UTC (rev
3337)
+++ trunk/surfnet_java-flowsa-ma/.project 2008-02-11 13:46:17 UTC (rev
3338)
@@ -15,9 +15,15 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+
<name>org.devzuz.q.maven.jdt.core.mavenIncrementalBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
+ <nature>org.devzuz.q.maven.jdt.core.mavenNature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
Modified: trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/web.xml
===================================================================
--- trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/web.xml 2008-02-08
15:30:53 UTC (rev 3337)
+++ trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/web.xml 2008-02-11
13:46:17 UTC (rev 3338)
@@ -11,7 +11,7 @@
<filter-class>nl.surfnet.web.IpAccessFilter</filter-class>
<init-param>
<param-name>ips</param-name>
- <param-value>127.0.0.1
2001:610:508:109:20b:dbff:fee9:61f3 62.131.17.150</param-value>
+ <param-value>127.0.0.1
2001:610:508:109:20b:dbff:fee9:61f3 62.131.17.150 192.87.109.151
192.87.109.84 192.87.102.208 78.27.8.39 192.87.117.149
192.87.109.186</param-value>
<description>
A space separeted list of ips that are
allowed to access
resources.
Modified: trunk/surfnet_java-flowsa-ma/conf/service.properties
===================================================================
--- trunk/surfnet_java-flowsa-ma/conf/service.properties 2008-02-08
15:30:53 UTC (rev 3337)
+++ trunk/surfnet_java-flowsa-ma/conf/service.properties 2008-02-11
13:46:17 UTC (rev 3338)
@@ -6,8 +6,6 @@
service.r.type=ma
service.r.service_name=Java flowSA MA
-
-
# === Measurement Archive general properties ===
service.ma.class_name=org.perfsonar.service.measurementArchive.flowsa.FlowsaMAServiceEngine
service.ma.message_types=SetupDataRequest
@@ -34,19 +32,19 @@
# --- query properties ---
# query.timeout - timeout/max execution time of a query (value is in seconds)
# query.max-results - if more then <value> results are encountered stop
processing
-service.ma.flowsa.query.timeout=10
+service.ma.flowsa.query.timeout=60
service.ma.flowsa.query.max-results=1000
# --- nfdump properties ---
# nfdump.source - location of nfcapd files
# nfdump.location - the location of the nfdump executable (including nfdump
filename)
# nfdump.outputreader - fully qualified name of the class used for output
reading (expects a class implementing NfdumpOutputReader)
-service.ma.flowsa.nfdump.source=/var/nfdump/flows
+service.ma.flowsa.nfdump.source=/usr/local/var/nfdump/flows
service.ma.flowsa.nfdump.location=/usr/local/bin/nfdump
service.ma.flowsa.nfdump.ouputreader=org.perfsonar.service.measurementArchive.flowsa.nfdump.outputreaders.Nfdump1_5_5OutputReaderFactory
# --- nfcapd properties ---
-# nfcapd.start-processes - if nfcapd should start processes for exporters,
specify false if this is done externally
+# nfcapd.start-processes - if nfcapd should start processes for exporters;
specify false if this is done externally
service.ma.flowsa.nfcapd.start-processes=false
# === Logger properties ===
@@ -57,4 +55,4 @@
#=== LS registrator ===
component.registrator.scheduler_component=ma_scheduler
-component.registrator.interval=30000
+component.registrator.interval=30000
\ No newline at end of file
Modified: trunk/surfnet_java-flowsa-ma/pom.xml
===================================================================
--- trunk/surfnet_java-flowsa-ma/pom.xml 2008-02-08 15:30:53 UTC (rev
3337)
+++ trunk/surfnet_java-flowsa-ma/pom.xml 2008-02-11 13:46:17 UTC (rev
3338)
@@ -183,190 +183,8 @@
<dependency>
<groupId>perfsonar</groupId>
<artifactId>perfsonar-base</artifactId>
- <version>1.0.20070911</version>
+ <version>1.0.20071121</version>
</dependency>
- <dependency>
- <groupId>nmwg</groupId>
- <artifactId>nmwg</artifactId>
- <version>1.0.20070906</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.6.2</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- <version>2.6.2</version>
- </dependency>
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.0b8</version>
- </dependency>
- <dependency>
- <groupId>urbanophile</groupId>
- <artifactId>java-getopt</artifactId>
- <version>1.0.9</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>2.7.0</version>
- </dependency>
- <dependency>
- <groupId>commons-pool</groupId>
- <artifactId>commons-pool</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2</version>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.7.0</version>
- </dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>1.7</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
- </dependency>
- <dependency>
- <groupId>javax.activation</groupId>
- <artifactId>activation</artifactId>
- <version>1.0.2</version>
- </dependency>
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>1.3.2</version>
- </dependency>
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>servlet-api</artifactId>
- <version>5.0.28</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.9</version>
- </dependency>
- <dependency>
- <groupId>exist</groupId>
- <artifactId>exist-xmldb</artifactId>
- <version>1.0rc</version>
- </dependency>
- <dependency>
- <groupId>exist</groupId>
- <artifactId>exist-db</artifactId>
- <version>1.0rc</version>
- </dependency>
- <dependency>
- <groupId>exist</groupId>
- <artifactId>exist-xmlrpc</artifactId>
- <version>1.0rc</version>
- </dependency>
- <dependency>
- <groupId>exist</groupId>
- <artifactId>exist-optional</artifactId>
- <version>1.0rc</version>
- </dependency>
- <dependency>
- <groupId>antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>2.7.7</version>
- </dependency>
- <dependency>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk15</artifactId>
- <version>124</version>
- </dependency>
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>com.ibatis</groupId>
- <artifactId>ibatis-common</artifactId>
- <version>2.1.7.597</version>
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>8.7</version>
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-jdom</artifactId>
- <version>8.7</version>
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-dom</artifactId>
- <version>8.7</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis</groupId>
- <artifactId>axis</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>xml-security</groupId>
- <artifactId>xmlsec</artifactId>
- <version>1.2.1</version>
- </dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>2.0.0</version>
- </dependency>
- <dependency>
- <groupId>wss4j</groupId>
- <artifactId>wss4j</artifactId>
- <version>1.5.1</version>
- </dependency>
- <dependency>
- <groupId>commons-discovery</groupId>
- <artifactId>commons-discovery</artifactId>
- <version>0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis</groupId>
- <artifactId>axis-ant</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis</groupId>
- <artifactId>axis-jaxrpc</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis</groupId>
- <artifactId>axis-saaj</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis-wsdl4j</artifactId>
- <version>1.5.1</version>
- </dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>
Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaMAServiceEngine.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaMAServiceEngine.java
2008-02-08 15:30:53 UTC (rev 3337)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/FlowsaMAServiceEngine.java
2008-02-11 13:46:17 UTC (rev 3338)
@@ -188,8 +188,7 @@
fileData.getStartFile(),
fileData.getEndFile()
);
-
- logger.debug("FlowsaMAServiceEngine.handleRawFlowRequest: Executing
query.");
+ logger.debug("FlowsaMAServiceEngine.handleRawFlowRequest:
Executing query.");
List<Flow> result = nfdump.execute(query);
logger.debug("FlowsaMAServiceEngine.handleRawFlowRequest: Creating
response.");
return new RawFlowsResponse(request.getMetadata(), result,
request.getFieldsToShow());
Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/NfcapdControll.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/NfcapdControll.java
2008-02-08 15:30:53 UTC (rev 3337)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd/NfcapdControll.java
2008-02-11 13:46:17 UTC (rev 3338)
@@ -96,35 +96,27 @@
for(String hostName : hostnames) {
Exporter exporter = getExporterByHostName(hostName);
- if(exporter!=null) {
- if(startFile==null) {
- startFile =
exporter.getClosestFileBefore(startTime);
- endFile =
exporter.getClosestFileAfter(endTime);
- if(startFile!=null) {
-
directories.add(exporter.getDirectory());
- } else {
- throw new
FileNotFoundException(
- "Data not
avail for specified interval"
- );
- }
- } else {
- if(exporter.hasFiles(startFile,
endFile)) {
-
directories.add(exporter.getDirectory());
- } else {
- throw new
FileNotFoundException(
- "Data not
avail for specified interval"
- );
- }
- }
-
- }
- }
-
+ if(exporter==null) break;
+ if(startFile!=null) {
+ // here we presume that files for exporters
are all written at the same interval leading
+ // to the same names among the directories
this might cause problems
+ if(!exporter.hasFiles(startFile, endFile))
throw new FileNotFoundException("Data not avail for specified interval");
+ directories.add(exporter.getDirectory());
+ break;
+ }
+ startFile = exporter.getClosestFileBefore(startTime);
+ endFile = exporter.getClosestFileAfter(endTime);
+ if(startFile==null) {
+ throw new FileNotFoundException("Data not
avail for specified interval");
+ }
+ directories.add(exporter.getDirectory());
+ }
return new FileData(startFile,endFile,directories);
}
/**
- * Minimal support for starting of nfcapd processes, handling of
stopping the deamons in not arranged for.
+ * Minimal support for starting of nfcapd processes, handling of
stopping the deamons is not arranged for.
+ * Moreover: we've decided to drop support for this at all at this
point.
* @author michael.bischoff
*/
protected class NfcapdProcessesControllThread extends Thread {
Added:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/IllegalFilterSyntaxException.java
Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpControll.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpControll.java
2008-02-08 15:30:53 UTC (rev 3337)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpControll.java
2008-02-11 13:46:17 UTC (rev 3338)
@@ -56,6 +56,7 @@
Process process = null;
NfdumpOutputReader reader = null;
try {
+ // TODO remove?
System.out.println(Arrays.toString(commands.toArray()));
process = new ProcessBuilder(commands).start();
reader = readerFactory.create(process.getInputStream());
@@ -239,8 +240,6 @@
commands.add(FORMAT_FLAG);
commands.add(FORMAT_FLAG_VALUE);
commands.add(QUIET_FLAG);
- commands.add(MAX_RACORDS_FLAG);
- commands.add(String.valueOf(maxResults+1));
return commands;
}
/**
@@ -269,8 +268,6 @@
commands.add(FORMAT_FLAG);
commands.add(FORMAT_FLAG_VALUE);
commands.add(QUIET_FLAG);
- commands.add(MAX_RACORDS_FLAG);
- commands.add(String.valueOf(maxResults+1));
return commands;
}
/**
@@ -295,6 +292,7 @@
commands.add(query.getStartFile()+":"+query.getEndFile());
if (query.getAggegrationRule() != null ) {
+ commands.add("-a");
commands.add("-A");
commands.add(query.getAggegrationRule().getExpression());
}
@@ -325,39 +323,40 @@
return commands;
}
/**
- * convenience method for creating a command list for ProcessBuilder this
- * method creates one based upon a TopQuery takes
- *
{@link
#createCommandsForStatisticQuery()} as a base
- *
- * @param query
- * to be converted
- * @return a List of commands(String) that can be passed onto a
- * ProcessBuilder
- * @throws QueryException
- * @see StatisticsQuery
- */
- protected List<String> createCommandsFrom(TopQuery query) throws
QueryException {
- List<String> commands = createCommandsForTopQuery();
- commands.add(TIME_FLAG);
- commands.add(getTimeCommandFrom(query));
- commands.add("-s");
- commands.add(query.getTopStatistic()+"/"+query.getOrderBy());
- commands.add("-M");
- commands.add(getDirectoryCommandFrom(query));
- commands.add("-R");
- commands.add(query.getStartFile()+":"+query.getEndFile());
-
- if (query.getAggegrationRule() != null ) {
- commands.add("-A");
- commands.add(query.getAggegrationRule().getExpression());
- }
- if (query.getFilter() != null) {
- commands.add(query.getFilter().getExpression());
- }
-
- return commands;
- }
-
+ * convenience method for creating a command list for ProcessBuilder
this
+ * method creates one based upon a TopQuery takes
+ *
{@link
#createCommandsForStatisticQuery()} as a base
+ *
+ * @param query
+ * to be converted
+ * @return a List of commands(String) that can be passed onto a
+ * ProcessBuilder
+ * @throws QueryException
+ * @see StatisticsQuery
+ */
+ protected List<String> createCommandsFrom(TopQuery query) throws
QueryException {
+ List<String> commands = createCommandsForTopQuery();
+ commands.add(TIME_FLAG);
+ commands.add(getTimeCommandFrom(query));
+ commands.add("-s");
+ commands.add(query.getTopStatistic()+"/"+query.getOrderBy());
+ commands.add("-M");
+ commands.add(getDirectoryCommandFrom(query));
+ commands.add("-R");
+ commands.add(query.getStartFile()+":"+query.getEndFile());
+ commands.add("-n");
+ commands.add(String.valueOf(query.getTopN()));
+
+ if (query.getAggegrationRule() != null ) {
+ commands.add("-A");
+ commands.add(query.getAggegrationRule().getExpression());
+ }
+ if (query.getFilter() != null) {
+ commands.add(query.getFilter().getExpression());
+ }
+
+ return commands;
+ }
private NfdumpOutputReaderFactory configureOutputFactory(String
className) throws InstantiationException, IllegalAccessException,
ClassNotFoundException {
// default, convention over configuration
if(className == null) {
@@ -377,7 +376,7 @@
for(String directory : query.getDirectories()) {
if(command == null) {
command = directory;
- break;
+ continue;
}
String[] parts = directory.split("/");
if(parts.length==1) {
@@ -385,11 +384,11 @@
}
command += ":" + parts[parts.length-1];
}
- if(command != null) {
- return command;
+ if(command == null) {
+ throw new QueryException("Query didn't contain any
directories to target");
}
- throw new QueryException("Query didn't contain any directories to
target");
- }
+ return command;
+ }
/**
* Mostly unimportant class, it simply ensures that the thread priority
is not
Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpOutputReader.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpOutputReader.java
2008-02-08 15:30:53 UTC (rev 3337)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/NfdumpOutputReader.java
2008-02-11 13:46:17 UTC (rev 3338)
@@ -24,23 +24,26 @@
* @return the record encountered at stream or null if end of stream has
* been reached
* @see
org.perfsonar.service.measurementArchive.flowsa.nfdump.NfdumpOutputReader#readRecord()
+ * @throws IllegalFilterSyntaxException if the filter-syntax used in
the initial command is illegal
* @throws IOException if the reader has input but couldn't parse
*/
- public Flow readRecord() throws IOException;
+ public Flow readRecord() throws IllegalFilterSyntaxException,
IOException;
/**
* @return the statistic encountered at stream or null if end of
stream has
* been reached
+ * @throws IllegalFilterSyntaxException if the filter-syntax used in the
initial command is illegal
* @throws IOException if the reader has input but couldn't parse
*/
- public Statistics readStatistics() throws IOException;
+ public Statistics readStatistics() throws
IllegalFilterSyntaxException, IOException;
/**
* @return the topDatum encountered at stream or null if end of
stream has
* been reached
+ * @throws IllegalFilterSyntaxException if the filter-syntax used in the
initial command is illegal
* @throws IOException if the reader has input but couldn't parse
*/
- public TopDatum readTopDatum() throws IOException;
+ public TopDatum readTopDatum() throws IllegalFilterSyntaxException,
IOException;
/**
* Method to allow the reader to clean up resources such as
Modified:
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders/Nfdump1_5_5OutputReaderImpl.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders/Nfdump1_5_5OutputReaderImpl.java
2008-02-08 15:30:53 UTC (rev 3337)
+++
trunk/surfnet_java-flowsa-ma/src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders/Nfdump1_5_5OutputReaderImpl.java
2008-02-11 13:46:17 UTC (rev 3338)
@@ -6,6 +6,7 @@
import java.io.InputStreamReader;
import org.perfsonar.service.measurementArchive.flowsa.nfdump.Flow;
+import
org.perfsonar.service.measurementArchive.flowsa.nfdump.IllegalFilterSyntaxException;
import
org.perfsonar.service.measurementArchive.flowsa.nfdump.NfdumpOutputReader;
import org.perfsonar.service.measurementArchive.flowsa.nfdump.Statistics;
import org.perfsonar.service.measurementArchive.flowsa.nfdump.TopDatum;
@@ -43,6 +44,7 @@
public Flow readRecord() throws IOException {
String line;
if ((line = myReader.readLine()) != null) {
+ catchOutputError(line);
return parseRecord(line);
}
return null;
@@ -61,6 +63,7 @@
check(parts.length == 2);
switch (lineNumber) {
case 1:
+ catchOutputError(line);
check(parts[0].equals("Ident"));
break;
case 2:
@@ -155,7 +158,8 @@
private void check(boolean testValue) throws IOException {
if (testValue == false) {
throw new IOException(
- "Cannot read nfdump output:
unexpected output");
+ "Cannot read nfdump output:
unexpected output"
+ );
}
}
@@ -176,13 +180,14 @@
}
private TopDatum parseTopDatum(String line) throws IOException {
+ catchOutputError(line);
if("".equals(line)) { // FIX 1.5.5 Topdata ends with a
useless empty line while using the piped format.
return null;
}
if (line.startsWith("Aggregated flows") ||
line.startsWith("Top ")) {
return null;
}
-
+
String[] values = line.split("\\|", 25);
if (values.length != 13 && values.length != 16 &&
values.length != 24) {
// hell.raise()
@@ -203,9 +208,10 @@
} else if (values.length == 16) {
datum.setTopStatistic(intSetToIp(values[6],
values[7], values[8], values[9]));
offset = 9;
- } else if(values.length == 24) {
- datum.setTopStatistic(intSetToIp(values[6],
values[7], values[8], values[9])+":"+values[11] +" -> " +
intSetToIp(values[12], values[13], values[14], values[15])+":"+values[16]);
- offset = 16;
+ } else if(values.length == 24) { //record
+ datum.setTopStatistic(intSetToIp(values[6],
values[7], values[8], values[9])+":"+values[10] +" -> " +
intSetToIp(values[11], values[12], values[13], values[14])+":"+values[15]);
+ offset = 15;
+ offset += 2;
}
datum.setFlows(values[offset+1]);
datum.setPackets(values[offset+2]);
@@ -257,11 +263,14 @@
myReader.close();
}
- private static String intSetToIp(String first, String second, String
third,
- String fourth) {
+ private static String intSetToIp(String first, String second, String
third, String fourth) {
try {
- return intSetToIp(Long.parseLong(first),
Long.parseLong(second),
- Long.parseLong(third),
Long.parseLong(fourth));
+ return intSetToIp(
+ Long.parseLong(first),
+ Long.parseLong(second),
+ Long.parseLong(third),
+ Long.parseLong(fourth)
+ );
} catch (NumberFormatException e) {
return "error";
}
@@ -311,8 +320,6 @@
*
* @param src a byte array representing the IPv6 numeric address
@return a
* String representing an IPv6 address in textual representation
format
- *
- * @since 1.4
*/
private static String numericToTextFormat(byte[] src) {
StringBuffer sb = new StringBuffer(39);
@@ -324,4 +331,21 @@
}
return sb.toString();
}
+
+ /**
+ * Method to catch more typical output errors, like invalid filters
and aggregation rules.
+ * @param line
+ * @throws IllegalFilterSyntaxException
+ * FIXME checking validness could be done in java and this could be
an exception indicating
+ * a bug in the validator. Allowing one to remove
IllegalFilterSyntaxException from the
+ *
{@link
NfdumpOutputReader} because the exception would be raised before it ever
hit's nfdump
+ * -> since reading output of nfdump occurs after hitting nfdump.
+ */
+ protected void catchOutputError(String line) throws
IllegalFilterSyntaxException {
+ if(line.startsWith("line 1: syntax error at '")) {
+ throw new IllegalFilterSyntaxException(
+ line.substring("line 1:".length())
+ );
+ }
+ }
}
- perfsonar: r3338 - in trunk/surfnet_java-flowsa-ma: . conf conf/axis-1.4/WEB-INF src/main/java/org/perfsonar/service/measurementArchive/flowsa src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfcapd src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump src/main/java/org/perfsonar/service/measurementArchive/flowsa/nfdump/outputreaders, svnlog, 02/11/2008
Archive powered by MHonArc 2.6.16.