perfsonar-dev - perfsonar: r2435 - in trunk/perfsonar: contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni contrib/mapi-jni/native/src src/org/perfsonar/service/measurementPoint/tracefileCaptureType
Subject: perfsonar development work
List archive
perfsonar: r2435 - in trunk/perfsonar: contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni contrib/mapi-jni/native/src src/org/perfsonar/service/measurementPoint/tracefileCaptureType
Chronological Thread
- From:
- To:
- Subject: perfsonar: r2435 - in trunk/perfsonar: contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni contrib/mapi-jni/native/src src/org/perfsonar/service/measurementPoint/tracefileCaptureType
- Date: Mon, 28 May 2007 10:37:35 -0400
Author: uros
Date: 2007-05-28 10:37:35 -0400 (Mon, 28 May 2007)
New Revision: 2435
Modified:
trunk/perfsonar/contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni/MAPIMonitorRequest.java
trunk/perfsonar/contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni/MonitorRequest.java
trunk/perfsonar/contrib/mapi-jni/native/src/mapijni.c
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeServiceEngine.java
Log:
Optimized scheduled jobs with number of captured packets limit (no more
waiting for endTime)
Modified:
trunk/perfsonar/contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni/MAPIMonitorRequest.java
===================================================================
---
trunk/perfsonar/contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni/MAPIMonitorRequest.java
2007-05-25 15:55:35 UTC (rev 2434)
+++
trunk/perfsonar/contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni/MAPIMonitorRequest.java
2007-05-28 14:37:35 UTC (rev 2435)
@@ -137,24 +137,42 @@
}
/**
- * Wait for MAPI flow until specified Date.
+ * Wait for MAPI flow until specified Date or number of packets
+ * captured superseeds pktLimit (whichever comes first).
*
* @param time wait until this time is reached
- * @param isSizeLimited true if flow is file size limited, false
otherwise
+ * @param fid function id of the PKT_COUNTER function on current flow
+ * (used for checking when the packet count limit is reached)
+ * set to -1 if not in use,
+ * in which case pktLimit is ignored also
+ * @param pktLimit when this number is reached (checked by peeking into
+ * fid PKT_COUNTER function on current flow)
*/
- public void mapiWaitFlow(Date time, boolean isSizeLimited) {
+ public void mapiWaitFlow(Date time, int fid, BigInteger pktLimit) {
// Wait until stop is reached, then call mapiCloseFlow()
long endTime = time.getTime();
long curTime = System.currentTimeMillis();
+
+ BigInteger pktDiff = new BigInteger("-1");
- // TODO:
- // Should be waiting in interval of FLOW_WAIT_SLEEP_TIME mss
- // and check for flow finish, using mapi_get_flow_info function,
- // which does not yet have mapi-jni interface
- while (endTime > curTime) {
+ // Wait as long as both endTime > curTime and pktDiff < 0 hold true.
+ // pktDiff is taken into account only if fid is not -1.
+ while (endTime > curTime && pktDiff.signum() == -1) {
- try { Thread.sleep(endTime - curTime); } catch
(InterruptedException ie) {}
+ try {
+ if (fid != -1) {
+ Thread.sleep(
+ Math.min(endTime - curTime,
FLOW_WAIT_SLEEP_TIME));
+ try {
+ BigInteger capturedPackets =
+ (BigInteger)mapiReadResults(fid);
+ pktDiff = capturedPackets.subtract(pktLimit);
+ } catch (MAPIException me) {}
+ } else {
+ Thread.sleep(endTime - curTime);
+ }
+ } catch (InterruptedException ie) {}
curTime = System.currentTimeMillis();
}
@@ -209,7 +227,7 @@
mmReq.mapiConnect();
System.out.println("Connected to the flow (flowDescr=" + fd +
")");
- mmReq.mapiWaitFlow(new Date(System.currentTimeMillis() + 3000L),
false);
+ mmReq.mapiWaitFlow(new Date(System.currentTimeMillis() + 3000L),
-1, null);
BigInteger pc = (BigInteger)mmReq.mapiReadResults(pcid);
BigInteger bc = (BigInteger)mmReq.mapiReadResults(bcid);
Modified:
trunk/perfsonar/contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni/MonitorRequest.java
===================================================================
---
trunk/perfsonar/contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni/MonitorRequest.java
2007-05-25 15:55:35 UTC (rev 2434)
+++
trunk/perfsonar/contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni/MonitorRequest.java
2007-05-28 14:37:35 UTC (rev 2435)
@@ -6,6 +6,7 @@
package si.arnes.jra1.perfsonar.jni.mapijni;
import java.util.Date;
+import java.math.BigInteger;
/**
* Interface to different implementations of MAPI
@@ -294,10 +295,16 @@
public MAPIPacket mapiGetNextPkt(int fid) throws MAPIException;
/**
- * Wait for MAPI flow until specified Date.
+ * Wait for MAPI flow until specified Date or number of packets
+ * captured superseeds pktLimit (whichever comes first).
*
* @param time wait until this time is reached
- * @param isSizeLimited true if flow is file size limited, false
otherwise
+ * @param fid function id of the PKT_COUNTER function on current flow
+ * (used for checking when the packet count limit is reached)
+ * set to -1 if not in use,
+ * in which case pktLimit is ignored also
+ * @param pktLimit when this number is reached (checked by peeking into
+ * fid PKT_COUNTER function on current flow)
*/
- public void mapiWaitFlow(Date time, boolean isSizeLimited);
+ public void mapiWaitFlow(Date time, int fid, BigInteger pktLimit);
}
Modified: trunk/perfsonar/contrib/mapi-jni/native/src/mapijni.c
===================================================================
--- trunk/perfsonar/contrib/mapi-jni/native/src/mapijni.c 2007-05-25
15:55:35 UTC (rev 2434)
+++ trunk/perfsonar/contrib/mapi-jni/native/src/mapijni.c 2007-05-28
14:37:35 UTC (rev 2435)
@@ -2409,7 +2409,7 @@
jint fd,
jint fid)
{
- void *ret;
+ mapi_results_t* ret;
jobject oret = 0;
char errbuf[512];
mapi_function_info_t mfi;
@@ -2502,14 +2502,14 @@
/* Nothing to return, so return null */
} else if (! strcmp("PKT_COUNTER", mfi.name)) {
/* ret should be a pointer to unsigned long long */
- if (! (oret = jlongToUBigInteger(env, (jlong*)ret))) goto cleanup;
+ if (! (oret = jlongToUBigInteger(env, (jlong*)ret->res))) goto
cleanup;
DEBUG_PRINT("%016llx DEBUG: \tUnsigned long long return value:
%llu\n",
- (unsigned long long)getCurrentJVMThreadID(env), *(unsigned
long long*)ret);
+ (unsigned long long)getCurrentJVMThreadID(env), *(unsigned
long long*)ret->res);
} else if (! strcmp("BYTE_COUNTER", mfi.name)) {
/* ret should be a pointer to unsigned long long */
- if (! (oret = jlongToUBigInteger(env, (jlong*)ret))) goto cleanup;
+ if (! (oret = jlongToUBigInteger(env, (jlong*)ret->res))) goto
cleanup;
DEBUG_PRINT("%016llx DEBUG: \tUnsigned long long return value:
%llu\n",
- (unsigned long long)getCurrentJVMThreadID(env), *(unsigned
long long*)ret);
+ (unsigned long long)getCurrentJVMThreadID(env), *(unsigned
long long*)ret->res);
} else if (! strcmp("STR_SEARCH", mfi.name)) {
/* Nothing to return, so return null */
} else if (! strcmp("TO_BUFFER", mfi.name)) {
@@ -2518,7 +2518,7 @@
/* Nothing to return, so return null */
} else if (! strcmp("HASHSAMP", mfi.name)) {
/* ret should be a pointer to the struct sample */
- smplPtr = (struct sample*)ret;
+ smplPtr = (struct sample*)ret->res;
/* Convert it to MAPISample */
oret = (*env)->NewObject(env, mapiSampleCls, mapiSampleConstr,
(jint)smplPtr->source_ip, (jint)smplPtr->dest_ip,
@@ -2535,15 +2535,16 @@
smplPtr->protocol, smplPtr->timestamp);
} else if (! strcmp("TO_FILE", mfi.name)) {
/* ret should be a pointer to the integer with current status */
- if (! (oret = jintToInteger(env, (jint*)ret))) goto cleanup;
- DEBUG_PRINT("%016llx DEBUG: \tInteger return value: %d\n", (unsigned
long long)getCurrentJVMThreadID(env), *(int*)ret);
+ if (! (oret = jintToInteger(env, (jint*)ret->res))) goto cleanup;
+ DEBUG_PRINT("%016llx DEBUG: \tInteger return value: %d\n",
+ (unsigned long long)getCurrentJVMThreadID(env),
*(int*)ret->res);
} else if (! strcmp("ETHEREAL", mfi.name)) {
/* Nothing to return, so return null */
} else if (! strcmp("COOKING", mfi.name)) {
/* Nothing to return, so return null */
} else if (! strcmp("BUCKET", mfi.name)) {
/* ret should be a pointer to the struct bucket_data */
- buckDataPtr = (struct bucket_data*)ret;
+ buckDataPtr = (struct bucket_data*)ret->res;
/* Convert it to MAPIBucketData */
oret = (*env)->NewObject(env, mapiBucketDataCls,
mapiBucketDataConstr,
(jlong)buckDataPtr->timestamp, (jlong)buckDataPtr->data);
@@ -2555,9 +2556,9 @@
/* Nothing to return, so return null */
} else if (! strcmp("HASH", mfi.name)) {
/* ret should be a pointer to unsigned long long */
- if (! (oret = jlongToUBigInteger(env, (jlong*)ret))) goto cleanup;
+ if (! (oret = jlongToUBigInteger(env, (jlong*)ret->res))) goto
cleanup;
DEBUG_PRINT("%016llx DEBUG: \tUnsigned long long return value:
%llu\n",
- (unsigned long long)getCurrentJVMThreadID(env), *(unsigned
long long*)ret);
+ (unsigned long long)getCurrentJVMThreadID(env), *(unsigned
long long*)ret->res);
} else if (! strcmp("ANONYMIZE", mfi.name)) {
/* Nothing to return, so return null */
} else {
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
2007-05-25 15:55:35 UTC (rev 2434)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
2007-05-28 14:37:35 UTC (rev 2435)
@@ -6,6 +6,7 @@
package org.perfsonar.service.measurementPoint.tracefileCaptureType;
+import java.math.BigInteger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -26,6 +27,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import org.perfsonar.service.commons.exceptions.DataFormatException;
import org.perfsonar.service.commons.exceptions.PerfSONARException;
@@ -36,6 +38,9 @@
import org.perfsonar.commons.auxiliary.components.simplescheduler.Scheduler;
import
org.perfsonar.commons.auxiliary.components.simplescheduler.SchedulerAction;
import
org.perfsonar.commons.auxiliary.components.simplescheduler.SchedulerTask;
+import org.perfsonar.service.commons.exceptions.RequestException;
+import org.perfsonar.service.commons.exceptions.ResourceException;
+import org.perfsonar.service.commons.exceptions.SystemException;
import org.perfsonar.service.commons.measurementExecutor.MeasurementExecutor;
@@ -157,11 +162,13 @@
*
* @param measurementExecutorRequest parameter of type
MeasurementExecutorRequest
* @return MeasurementExecutorResponse
- * @throws PerfSONARException
- * @throws PerfSONARException
+ * @throws SystemException
+ * @throws RequestException
+ * @throws ResourceException
+ * @throws DataFormatException
*/
public Message makeMeasurement(Message request)
- throws PerfSONARException, PerfSONARException {
+ throws SystemException, RequestException, ResourceException,
DataFormatException {
logger =
(LoggerComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
@@ -169,7 +176,7 @@
if (configuration == null) {
- throw new PerfSONARException("error.common.no_configuration",
+ throw new SystemException("error.common.no_configuration",
type + ": "
+ "Could not get an instance of Configuration reader."
+ "Cannot continue with the request");
@@ -178,7 +185,7 @@
if (logger == null) {
- throw new PerfSONARException("error.common.no_logger",
+ throw new SystemException("error.common.no_logger",
type + ": "
+ "Could not get an instance of Configuration reader."
+ "Cannot continue with the request");
@@ -193,7 +200,7 @@
Message response = new Message();
// Verify the incoming request Message
- // Throw either PerfSONARException on PerfSONARException if
validation fails
+ // Throw either RequestException or DataFormatException
TCMPTypeMeasurementRequest req = validateTCMPRequest(request);
// Add table entry(ies) for the given capture(s) to SQL db.
@@ -211,7 +218,7 @@
pstmt.setString(1, req.getCredentials().getUsername());
rst = pstmt.executeQuery();
if (! rst.next())
- throw new PerfSONARException("error.common.sqldb_error",
+ throw new ResourceException("error.common.sqldb_error",
"Unable to retrieve id for user '"
+ req.getCredentials().getUsername() + "'");
int id = rst.getInt(1);
@@ -251,7 +258,7 @@
logger.fatal(type + ".makeMeasurement: Unable to add
tracefile"
+ " entry to SQL db: " + se);
- throw new PerfSONARException("error.common.sqldb_error",
+ throw new ResourceException("error.common.sqldb_error",
"Unable to add tracefile entry to SQL db: " + se);
} finally {
@@ -277,7 +284,7 @@
if (scheduler == null)
- throw new PerfSONARException(
+ throw new SystemException(
"error.common.no_scheduler",
"No scheduler component in TCMPTypeMeasurementExecutor");
@@ -654,18 +661,26 @@
// Retrieve max.trace.packets service configuration variable else
// use unlimited value (0L)
- long maxTracePackets = 0L;
+ BigInteger maxTracePackets = new BigInteger("0");
+ boolean doLimitPackets = false;
try {
String maxTracePacketsStr =
configuration.getProperty("max.trace.packets");
- maxTracePackets = Long.valueOf(maxTracePacketsStr);
+ maxTracePackets = new BigInteger(maxTracePacketsStr);
+ if (maxTracePackets.signum() == 1) doLimitPackets = true;
} catch (Exception e) {}
+ // Apply PKT_COUNTER function to the flow
+ int fid = monReq.mapiApplyFunction("PKT_COUNTER");
+ this.logger.info(type + ".runAction: Applied PKT_COUNTER
function"
+ + " to the flow on " + hostIf
+ + " (tid=" + Thread.currentThread().getId() + ")");
+
// Apply TO_FILE function to the flow
monReq.mapiApplyFunction(
"TO_FILE",
MonitorRequest.CAP_FORMAT_TYPE_MFF_PCAP,
datumFile,
- maxTracePackets);
+ maxTracePackets.longValue());
this.logger.info(type + ".runAction: Applied TO_FILE function ("
+ MonitorRequest.CAP_FORMAT_TYPE_MFF_PCAP
+ ", '" + datumFile + "', " + maxTracePackets
@@ -680,7 +695,8 @@
monReq.mapiWaitFlow(
this.request.getEndTimeParam(),
- maxTracePackets != 0);
+ doLimitPackets ? fid : -1,
+ doLimitPackets ? maxTracePackets : null);
// Close flow
monReq.mapiCloseFlow();
@@ -772,18 +788,19 @@
* service.mp.tcmp.pcap.file.storage.dir.
*
* @param request Message
- * @throws PerfSONARException
- * @throws PerfSONARException
+ * @throws SystemException
+ * @throws RequestException
+ * @throws DataFormatException
*/
private TCMPTypeMeasurementRequest validateTCMPRequest(Message request)
- throws PerfSONARException, PerfSONARException {
+ throws SystemException, RequestException, DataFormatException {
TCMPTypeMeasurementRequest req = new TCMPTypeMeasurementRequest();
String fileSeparator = System.getProperty("file.separator");
if (request == null) {
- throw new
PerfSONARException("error.mp.tcmp.validator.missing_request",
+ throw new
RequestException("error.mp.tcmp.validator.missing_request",
type + ".validateTCMPRequest(): "
+ "Request to the measurement executor cannot be null");
@@ -802,7 +819,7 @@
logger.fatal(
type + ".validateTCMPRequest: No data elements "
+ "found in request. At least one is required in the
message");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_data_elements",
+ throw new
RequestException("error.mp.tcmp.validator.no_data_elements",
type + ".validateTCMPRequest: No data elements "
+ "found in request. At least one is required in the
message");
@@ -813,7 +830,7 @@
logger.fatal(
type + ".validateTCMPRequest: No metadata elements "
+ "found in request. At least one is required in the
message");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_metadata_elements",
+ throw new
RequestException("error.mp.tcmp.validator.no_metadata_elements",
type + ".validateTCMPRequest: No metadata elements "
+ "found in request. At least one is required in the
message");
@@ -834,7 +851,7 @@
logger.fatal(
type + ".validateTCMPRequest: No subject in metadata
element "
+ "of request.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_metadata_subject",
+ throw new
RequestException("error.mp.tcmp.validator.no_metadata_subject",
type + ".validateTCMPRequest: No subject in metadata
element "
+ "of request.");
@@ -855,7 +872,7 @@
logger.fatal(
type + ".validateTCMPRequest: Either hostName or
ipAddress element "
+ "required in interface element.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_interface_hostName_or_ipAddress",
+ throw new
RequestException("error.mp.tcmp.validator.no_interface_hostName_or_ipAddress",
type + ".validateTCMPRequest: Either hostName or
ipAddress element "
+ "required in interface element.");
@@ -874,7 +891,7 @@
logger.fatal(
type + ".validateTCMPRequest: ifName element "
+ "required in interface element.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_interface_ifName",
+ throw new
RequestException("error.mp.tcmp.validator.no_interface_ifName",
type + ".validateTCMPRequest: ifName element "
+ "required in interface element.");
@@ -907,7 +924,7 @@
logger.fatal(
type + ".validateTCMPRequest: The only supported
endPoint "
+ "type is currently 'hostname'");
- throw new
PerfSONARException("error.mp.tcmp.validator.unsupported_endPoint_type",
+ throw new
RequestException("error.mp.tcmp.validator.unsupported_endPoint_type",
type + ".validateTCMPRequest: The only supported
endPoint "
+ "type is currently 'hostname'");
@@ -917,7 +934,7 @@
logger.fatal(
type + ".validateTCMPRequest: endPoint value is
required.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_endPoint_value",
+ throw new
RequestException("error.mp.tcmp.validator.no_endPoint_value",
type + ".validateTCMPRequest: endPoint value is
required.");
}
@@ -927,7 +944,7 @@
logger.fatal(
type + ".validateTCMPRequest: endPoint port is
required.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_endPoint_port",
+ throw new
RequestException("error.mp.tcmp.validator.no_endPoint_port",
type + ".validateTCMPRequest: endPoint port is
required.");
}
@@ -943,7 +960,7 @@
logger.fatal(
type + ".validateTCMPRequest: endPointPair element
requires "
+ "both src and dst elements.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_endPointPair_src_and_dst",
+ throw new
RequestException("error.mp.tcmp.validator.no_endPointPair_src_and_dst",
type + ".validateTCMPRequest: endPointPair element
requires "
+ "both src and dst elements.");
@@ -958,7 +975,7 @@
logger.fatal(
type + ".validateTCMPRequest: The only supported
endPoint "
+ "type is currently 'hostname'");
- throw new
PerfSONARException("error.mp.tcmp.validator.unsupported_endPoint_type",
+ throw new
RequestException("error.mp.tcmp.validator.unsupported_endPoint_type",
type + ".validateTCMPRequest: The only supported
endPoint "
+ "type is currently 'hostname'");
@@ -968,7 +985,7 @@
logger.fatal(
type + ".validateTCMPRequest: src endPoint value is
required.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_src_endPoint_value",
+ throw new
RequestException("error.mp.tcmp.validator.no_src_endPoint_value",
type + ".validateTCMPRequest: src endPoint value is
required.");
}
@@ -978,7 +995,7 @@
logger.fatal(
type + ".validateTCMPRequest: src endPoint port is
required.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_src_endPoint_port",
+ throw new
RequestException("error.mp.tcmp.validator.no_src_endPoint_port",
type + ".validateTCMPRequest: src endPoint port is
required.");
}
@@ -989,7 +1006,7 @@
logger.fatal(
type + ".validateTCMPRequest: The only supported
endPoint "
+ "type is currently 'hostname'");
- throw new
PerfSONARException("error.mp.tcmp.validator.unsupported_endPoint_type",
+ throw new
RequestException("error.mp.tcmp.validator.unsupported_endPoint_type",
type + ".validateTCMPRequest: The only supported
endPoint "
+ "type is currently 'hostname'");
@@ -999,7 +1016,7 @@
logger.fatal(
type + ".validateTCMPRequest: dst endPoint value is
required.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_dst_endPoint_value",
+ throw new
RequestException("error.mp.tcmp.validator.no_dst_endPoint_value",
type + ".validateTCMPRequest: dst endPoint value is
required.");
}
@@ -1009,7 +1026,7 @@
logger.fatal(
type + ".validateTCMPRequest: dst endPoint port is
required.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_dst_endPoint_port",
+ throw new
RequestException("error.mp.tcmp.validator.no_dst_endPoint_port",
type + ".validateTCMPRequest: dst endPoint port is
required.");
}
@@ -1021,7 +1038,7 @@
type + ".validateTCMPRequest: Missing one of
(nmwg:interface, "
+ "nmwg:endPoint, nmwg:endPointPair) elements in subject
element "
+ "of request.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_interface_or_endPoint_or_endPointPair",
+ throw new
RequestException("error.mp.tcmp.validator.no_interface_or_endPoint_or_endPointPair",
type + ".validateTCMPRequest: Missing one of
(nmwg:interface, "
+ "nmwg:endPoint, nmwg:endPointPair) elements in subject
element "
+ "of request.");
@@ -1051,7 +1068,7 @@
logger.fatal(
type + ".validateTCMPRequest: No parameters in metadata
element "
+ "found in request.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_metadata_parameters",
+ throw new
RequestException("error.mp.tcmp.validator.no_metadata_parameters",
type + ".validateTCMPRequest: No parameters in metadata
element "
+ "found in request.");
@@ -1075,7 +1092,7 @@
logger.fatal(
type + ".validateTCMPRequest: Credentials error:"
+ e);
- throw new PerfSONARException(
+ throw new RequestException(
"error.mp.tcmp.validator.credentials_error",
type + ".validateTCMPRequest: Credentials error: "
+ e,
@@ -1104,8 +1121,8 @@
logger.fatal(
type + ".validateTCMPRequest: Authorization error:"
+ e);
- throw new PerfSONARException(
- "error.mp.tcmp.validator._error",
+ throw new RequestException(
+ "error.mp.tcmp.validator.authorization_error",
type + ".validateTCMPRequest: Credentials error: "
+ e,
e);
@@ -1207,7 +1224,7 @@
logger.fatal(
type + ".validateTCMPRequest: Parameter
characteristics ("
+ charact + ") is not positive Integer.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_characteristics_parameter",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_characteristics_parameter",
type + ".validateTCMPRequest: Parameter
characteristics ("
+ charact + ") is not positive Integer.");
@@ -1220,7 +1237,7 @@
logger.fatal(
type + ".validateTCMPRequest: Parameter
characteristics ("
+ charactStr + ") could not be converted to
Integer.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_characteristics_parameter",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_characteristics_parameter",
type + ".validateTCMPRequest: Parameter
characteristics ("
+ charactStr + ") could not be converted to
Integer.");
@@ -1244,7 +1261,7 @@
logger.fatal(
type + ".validateTCMPRequest: Parameter
granularity ("
+ gran + ") is not positive Integer.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_granularity_parameter",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_granularity_parameter",
type + ".validateTCMPRequest: Parameter
granularity ("
+ gran + ") is not positive Integer.");
@@ -1257,7 +1274,7 @@
logger.fatal(
type + ".validateTCMPRequest: Parameter granularity
("
+ granStr + ") could not be converted to Integer.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_granularity_parameter",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_granularity_parameter",
type + ".validateTCMPRequest: Parameter granularity
("
+ granStr + ") could not be converted to Integer.");
@@ -1275,7 +1292,7 @@
logger.fatal(
type + ".validateTCMPRequest: Missing start_time
parameter "
+ "in request.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_start_time_parameter",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_start_time_parameter",
type + ".validateTCMPRequest: Missing start_time
parameter "
+ "in request.");
@@ -1288,7 +1305,7 @@
logger.fatal(
type + ".validateTCMPRequest: Missing start_time(child)
parameter "
+ "in request.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_start_time_parameter",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_start_time_parameter",
type + ".validateTCMPRequest: Missing start_time(child)
parameter "
+ "in request.");
@@ -1310,7 +1327,7 @@
logger.fatal(
type + ".validateTCMPRequest: Parameter start_time ("
+ unixTsStr + ") could not be converted from unix ts
to Date.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_start_time_parameter",
+ throw new
DataFormatException("error.mp.tcmp.validator.invalid_start_time_parameter",
type + ".validateTCMPRequest: Parameter start_time ("
+ unixTsStr + ") could not be converted from unix ts
to Date.");
@@ -1321,7 +1338,7 @@
logger.fatal(
type + ".validateTCMPRequest: Only 'unix' type of
start_time "
+ "is currently supported.");
- throw new
PerfSONARException("error.mp.tcmp.validator.unsupported_start_time_type",
+ throw new
RequestException("error.mp.tcmp.validator.unsupported_start_time_type",
type + ".validateTCMPRequest: Only 'unix' type of
start_time "
+ "is currently supported.");
@@ -1334,7 +1351,7 @@
logger.fatal(
type + ".validateTCMPRequest: Missing end_time parameter
"
+ "in request.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_end_time_parameter",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_end_time_parameter",
type + ".validateTCMPRequest: Missing end_time parameter
"
+ "in request.");
@@ -1347,7 +1364,7 @@
logger.fatal(
type + ".validateTCMPRequest: Missing end_time(child)
parameter "
+ "in request.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_end_time_parameter",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_end_time_parameter",
type + ".validateTCMPRequest: Missing end_time(child)
parameter "
+ "in request.");
@@ -1369,7 +1386,7 @@
logger.fatal(
type + ".validateTCMPRequest: Parameter end_time ("
+ unixTsStr + ") could not be converted from unix ts
to Date.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_end_time_parameter",
+ throw new
DataFormatException("error.mp.tcmp.validator.invalid_end_time_parameter",
type + ".validateTCMPRequest: Parameter end_time ("
+ unixTsStr + ") could not be converted from unix ts
to Date.");
@@ -1380,7 +1397,7 @@
logger.fatal(
type + ".validateTCMPRequest: Only 'unix' type of
end_time "
+ "is currently supported.");
- throw new
PerfSONARException("error.mp.tcmp.validator.unsupported_end_time_type",
+ throw new
RequestException("error.mp.tcmp.validator.unsupported_end_time_type",
type + ".validateTCMPRequest: Only 'unix' type of
end_time "
+ "is currently supported.");
@@ -1396,7 +1413,7 @@
logger.fatal(
type + ".validateTCMPRequest: Missing commonTime element
inside datum element.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_commonTime",
+ throw new
RequestException("error.mp.tcmp.validator.no_commonTime",
type + ".validateTCMPRequest: Missing commonTime element
inside datum element.");
}
@@ -1408,7 +1425,7 @@
logger.fatal(
type + ".validateTCMPRequest: commonTime must contain at
least one datum child.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_datum_in_commonTime",
+ throw new
RequestException("error.mp.tcmp.validator.no_datum_in_commonTime",
type + ".validateTCMPRequest: commonTime must contain at
least one datum child.");
}
@@ -1420,7 +1437,7 @@
logger.fatal(
type + ".validateTCMPRequest: First datum of commonTime
must contain filename attribute.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_first_datum_filename_attribute",
+ throw new
RequestException("error.mp.tcmp.validator.no_first_datum_filename_attribute",
type + ".validateTCMPRequest: First datum of commonTime
must contain filename attribute.");
}
@@ -1431,7 +1448,7 @@
logger.fatal(
type + ".validateTCMPRequest: Filename attribute of
first datum "
+ "contains file separator char.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_first_datum_filename_attribute",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_first_datum_filename_attribute",
type + ".validateTCMPRequest: Filename attribute of
first datum "
+ "contains file separator char.");
@@ -1445,7 +1462,7 @@
logger.fatal(
type + ".validateTCMPRequest: commonTime must
contain two datum childs.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_second_datum_in_commonTime",
+ throw new
RequestException("error.mp.tcmp.validator.no_second_datum_in_commonTime",
type + ".validateTCMPRequest: commonTime must
contain two datum childs.");
}
@@ -1457,7 +1474,7 @@
logger.fatal(
type + ".validateTCMPRequest: Second datum of
commonTime must contain filename attribute.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_second_datum_filename_attribute",
+ throw new
RequestException("error.mp.tcmp.validator.no_second_datum_filename_attribute",
type + ".validateTCMPRequest: Second datum of
commonTime must contain filename attribute.");
}
@@ -1468,7 +1485,7 @@
logger.fatal(
type + ".validateTCMPRequest: Filename attribute of
second datum "
+ "contains file separator char.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_second_datum_filename_attribute",
+ throw new
RequestException("error.mp.tcmp.validator.invalid_second_datum_filename_attribute",
type + ".validateTCMPRequest: Filename attribute of
second datum "
+ "contains file separator char.");
@@ -1480,7 +1497,7 @@
logger.fatal(
type + ".validateTCMPRequest: Filename attributes of
first and second datum "
+ "should not be equal.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_second_datum_filename_attribute",
+ throw new
DataFormatException("error.mp.tcmp.validator.invalid_second_datum_filename_attribute",
type + ".validateTCMPRequest: Filename attributes of
first and second datum "
+ "should not be equal.");
@@ -1495,7 +1512,7 @@
logger.fatal(
type + ".validateTCMPRequest:
service.mp.tcmp.pcap.file.storage.dir "
+ "property missing in service.properties.");
- throw new
PerfSONARException("error.mp.tcmp.validator.no_pcap_storage_dir",
+ throw new
SystemException("error.mp.tcmp.validator.no_pcap_storage_dir",
type + ".validateTCMPRequest:
service.mp.tcmp.pcap.file.storage.dir "
+ "property missing in service.properties.");
@@ -1506,7 +1523,7 @@
logger.fatal(
type + ".validateTCMPRequest:
service.mp.tcmp.pcap.file.storage.dir "
+ "property should point to a directory!");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_pcap_storage_dir",
+ throw new
SystemException("error.mp.tcmp.validator.invalid_pcap_storage_dir",
type + ".validateTCMPRequest:
service.mp.tcmp.pcap.file.storage.dir "
+ "property should point to a directory!");
@@ -1536,7 +1553,7 @@
logger.fatal(
type + ".validateTCMPRequest: First datum filename (" +
req.getFirstFilenameDatum()
+ ") already exists. Use different datum filename.");
- throw new
PerfSONARException("error.mp.tcmp.validator.first_datum_filename_exists",
+ throw new
SystemException("error.mp.tcmp.validator.first_datum_filename_exists",
type + ".validateTCMPRequest: First datum filename (" +
req.getFirstFilenameDatum()
+ ") already exists. Use different datum filename.");
@@ -1549,7 +1566,7 @@
logger.fatal(
type + ".validateTCMPRequest: Second datum filename
(" + req.getSecondFilenameDatum()
+ ") already exists. Use different datum filename.");
- throw new
PerfSONARException("error.mp.tcmp.validator.second_datum_filename_exists",
+ throw new
SystemException("error.mp.tcmp.validator.second_datum_filename_exists",
type + ".validateTCMPRequest: Second datum filename
(" + req.getSecondFilenameDatum()
+ ") already exists. Use different datum filename.");
@@ -1591,7 +1608,7 @@
type + ".validateTCMPRequest:
service.mp.tcmp.remote.interfaces "
+ "property contains host:interface token (" +
hostIf
+ ") without ':' char.");
- throw new
PerfSONARException("error.mp.tcmp.validator.invalid_remote_interfaces_configuration",
+ throw new
SystemException("error.mp.tcmp.validator.invalid_remote_interfaces_configuration",
type + ".validateTCMPRequest:
service.mp.tcmp.remote.interfaces "
+ "property contains host:interface token (" +
hostIf
+ ") without ':' char.");
@@ -1613,7 +1630,7 @@
type + ".validateTCMPRequest: Local Tracefile
capture requested, but interface "
+ req.getFirstEndPointInterface()
+ " is not present in
service.mp.tcmp.local.interfaces property.");
- throw new
PerfSONARException("error.mp.tcmp.validator.denied_trace_on_interface",
+ throw new
SystemException("error.mp.tcmp.validator.denied_trace_on_interface",
type + ".validateTCMPRequest: Local Tracefile
capture requested, but interface "
+ req.getFirstEndPointInterface()
+ " is not present in
service.mp.tcmp.local.interfaces property.");
@@ -1627,7 +1644,7 @@
type + ".validateTCMPRequest: Remote Tracefile capture
requested, but host:interface "
+ req.getFirstEndPointHost().toLowerCase() + ":" +
req.getFirstEndPointInterface()
+ " is not present in service.mp.tcmp.remote.interfaces
property.");
- throw new
PerfSONARException("error.mp.tcmp.validator.remote_host_interface_not_configured",
+ throw new
SystemException("error.mp.tcmp.validator.remote_host_interface_not_configured",
type + ".validateTCMPRequest: Remote Tracefile capture
requested, but host:interface "
+ req.getFirstEndPointHost().toLowerCase() + ":" +
req.getFirstEndPointInterface()
+ " is not present in service.mp.tcmp.remote.interfaces
property.");
@@ -1644,7 +1661,7 @@
type + ".validateTCMPRequest: Local Tracefile
capture requested, but second interface "
+ req.getSecondEndPointInterface()
+ " is not present in
service.mp.tcmp.local.interfaces property.");
- throw new
PerfSONARException("error.mp.tcmp.validator.denied_trace_on_second_interface",
+ throw new
SystemException("error.mp.tcmp.validator.denied_trace_on_second_interface",
type + ".validateTCMPRequest: Local Tracefile
capture requested, but second interface "
+ req.getSecondEndPointInterface()
+ " is not present in
service.mp.tcmp.local.interfaces property.");
@@ -1658,7 +1675,7 @@
type + ".validateTCMPRequest: Remote Tracefile
capture requested, but second host:interface "
+ req.getSecondEndPointHost().toLowerCase() + ":" +
req.getSecondEndPointInterface()
+ " is not present in
service.mp.tcmp.remote.interfaces property.");
- throw new
PerfSONARException("error.mp.tcmp.validator.second_remote_interface_not_configured",
+ throw new
SystemException("error.mp.tcmp.validator.second_remote_interface_not_configured",
type + ".validateTCMPRequest: Remote Tracefile
capture requested, but second host:interface "
+ req.getSecondEndPointHost().toLowerCase() + ":" +
req.getSecondEndPointInterface()
+ " is not present in
service.mp.tcmp.remote.interfaces property.");
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeServiceEngine.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeServiceEngine.java
2007-05-25 15:55:35 UTC (rev 2434)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeServiceEngine.java
2007-05-28 14:37:35 UTC (rev 2435)
@@ -22,6 +22,7 @@
import
org.perfsonar.service.measurementPoint.register.LSRegistrationComponent;
+import org.perfsonar.service.commons.exceptions.ResourceException;
/**
* Object implementing the Measurement Point Service Engine which deals
with Tracefile Capture
@@ -116,13 +117,14 @@
* @return Message object containing the response
*
* @throws SystemException
- * @throws PerfSONARException
+ * @throws ResourceException
+ * @throws RequestException
* @throws DataFormatException
*
* @see org.perfsonar.service.commons.engine.ServiceEngine
*/
public Message takeAction(String actionType, Message request)
- throws PerfSONARException {
+ throws SystemException, ResourceException, DataFormatException,
RequestException {
logger.debug("TCMPTypeServiceEngine.takeAction: " +
"Received a request of type - " + actionType);
@@ -173,11 +175,12 @@
* @return Message object containing the response with measurement data
*
* @throws SystemException
- * @throws PerfSONARException
+ * @throws ResourceException
+ * @throws RequestException
* @throws DataFormatException
*/
protected Message makeMeasurement(Message request)
- throws PerfSONARException {
+ throws SystemException, ResourceException, DataFormatException,
RequestException {
Message response = new Message();
response.setType("SetupDataResponse");
- perfsonar: r2435 - in trunk/perfsonar: contrib/mapi-jni/java/src/si/arnes/jra1/perfsonar/jni/mapijni contrib/mapi-jni/native/src src/org/perfsonar/service/measurementPoint/tracefileCaptureType, svnlog, 05/28/2007
Archive powered by MHonArc 2.6.16.