Table of Contents |
---|
Introduction
Warning |
---|
The embedded SOAP PI service is being phased out. Since 2022.02 the embedded REST service is used instead. |
The embedded Fews PI service data exchange service is a SOAP service hosted by a FEWS client instance (SA/OC/headless) ande uses XFire, a java SOAP framework. This framework allows a client application to obtain a proxy instance to the FewsPiService API hosted by a FEWS client. With this API the client can retrieve data from an OC or write data to an OCa FEWS client instance. Before a client application can access the FEWS system there is some configuration work that needs to be done.
User's looking to use XFire on a new project, should use CXF instead. CXF is a continuation of the XFire project and is considered XFire 2.0. It has many new features, a ton of bug fixes, and is now JAX-WS compliant! XFire will continue to be maintained through bug fix releases, but most development will occur on CXF now. For more information see the XFire/Celtix merge FAQ and the CXF website.
To use the Fews PI service from other programming languages, see Using the Fews PI service from C, which also contains an example of using Tcl.
You can run the FEWS system in the background, if this is needed or desirable (see below).
Embedded Fews PI Service API
Description of the methods provided by the Embedded Fews PI Service API.
...
Note |
---|
Code Block |
---|
String getLocations(String clientId);
|
...
| ||
Note! Please note that the argument names generated by XFire for the embedded FewsPiService are not descriptive. So in the section below we added descriptive identifiers to make the documentation more clear. When writing a client application always use the argument names provided in the fewsPiServiceWSDL.xml. |
Getter methods
...
Anchor | ||||
---|---|---|---|---|
|
System info
Code Block |
---|
String getClientConfigFile(String clientIdin0, String fileExtensionin1); |
Retrieves a client configuration file.
- in0 - clientId: File name of client configuration file located in the OC configuration directory 'PiClientConfigFiles'. This file is free format and content is only read only read by client application. Only requirement is that content is text based.
- in1 - fileExtension: Extension of client file.
- returns: Text file containing client configuration.
Code Block |
---|
Date getSystemTime(String clientIdin0); |
Get current OC system time.
- in0 - clientId: <id not required>
- returns: Date field containing OC system time.
Code Block |
---|
Stringlong getTimeZoneIdgetLastUpdateTime(String clientId); |
...
Get last time that OC is updated.
- returns: String Long representation of time zone(modified Julian date).
Code Block |
---|
String[] getColdStateIdsgetDisplayUnit(String clientId, String idin0); |
- clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- id: Reference to the ID of a ModuleState element in the service configuration file.
- returns: List of ColdStateGroup ids.
...
Retrieves display unit for a specific parameter
- in0 - parameterId
- returns: String holding the unit
Identifiers
Code Block |
---|
String getTimeZoneId(String in0);
|
Get OC timeZone id.
- in0 - clientId: <id not required>
- returns: String representation of time zone.
Code Block |
---|
String[] getSelectedFilterIds();
|
Retrieves filter identifiers selected in the FEWS Explorer
- returns: String array holding the identifiers of the selected filters
Code Block |
---|
String[] getSelectedLocationIds();
|
Retrieves location identifiers selected in the FEWS Explorer
- returns: String array holding the identifiers of the selected locations
Code Block |
---|
String[] getSelectedParameters();
|
Retrieves parameter identifiers selected in the FEWS Explorer
- returns: String array holding the identifiers of the selected parameters
Code Block |
---|
String getActiveSegmentId();
|
Retrieves active (selected) segment/node id in the FEWS Explorer Topology panel
- returns: String identifier to active segement node
Code Block |
---|
String[] getColdStateIds(String in0, String in1);
|
Get list of available ColdState ids.
- in0 -
...
Code Block |
---|
Date[] getAvailableStateTimes(String clientId, String id);
|
- clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- id: Reference to the ID of a ModuleState element in the service configuration file.
- returns: Available warmstate times for requested ModuleState.
Code Block |
---|
int[] getEnsembleMemberIndices(String clientId, String ensembleId);
|
- clientId: <id not required>
- ensembleId: Id of requested ensemble.
- returns: Available member indices of requested ensemble.
Code Block |
---|
String getLogMessages(String clientId, String taskId)
|
- clientId: <id not required but can not be null>
- taskId: Task ID for which to retrieve log messages. Only messages for the last run are returned.
- returns: String containing the log messages in the format defined by the PI Diag XSD
Code Block |
---|
byte[] getModuleDataSet(String clientId, String id, String ensembleId, int ensembleMemberIndex)
|
- clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Reference to the ID of a ModuleDataSet ModuleState element in the service configuration file.
- ensembleId: <currently not supported>
- ensembleMemberIndex: <currently not supported>
- returns: Binary content of the ModuleDataSet file for requested ModuleState.List of ColdStateGroup ids.
Anchor | ||||
---|---|---|---|---|
|
Code Block |
---|
byteDate[] getModuleParameterSetgetAvailableStateTimes(String clientIdin0, String id, String ensembleId, int ensembleMemberIndex) in1); |
Get available warm state times.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Reference to the ID of a ModuleParameterSet ModuleState element in the service configuration file.ensembleId: <currently not supported>
- ensembleMemberIndex: <currently not supported>
- returns: String content of the ModuleParameterSet file returns: Available warm state times for requested ModuleState.
Code Block |
---|
byteint[] getModuleStateBinarygetEnsembleMemberIndices(String clientIdin0, String id, Date stateTime, String ensembleId, int ensembleMemberIndexin1); |
Get available ensemble member ids.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- id: Reference to the ID of a ModuleState element in the service configuration file.
- stateTime: Time for which to retrieve warm state file. Time values can be obtained from method #getAvailableStateTimes
- ensembleId: <currently not supported>
- ensembleMemberIndex: <currently not supported>
Code Block |
---|
String getTimeSeriesHeaders(String clientId, String id, String taskId, Date startTime,
Date timeZero, Date endTime, String[] parameterIds, String[] locationIds, String ensembleId, int ensembleMemberIndex);
|
- : <id not required>
- in1 - ensembleId: Id of requested ensemble.
- returns: Available member indices of requested ensemble.
Content
Code Block |
---|
String getFilters(String in0);
|
Get the configured filter ids from the FEWS system.
- in0 - piVersion: (Optional) Pi Version for the return file. Defaults to the latest PI version.
- returns: String content of a Pi_Filters XML file containing Fews Filters.
Code Block |
---|
String getLocations(String in0, String in1, String in2);
|
Get location information available for the passed 'filterId' argument.
- in0 - clientId: (Optional) clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD. If not
provided then no id : Reference to the ID of a TimeSeries element in the service configuration file. - taskId: <id not required however can not be null>
- startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- timeZero: Forecast time zero.
- endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- parameterIds: Subset of parmater IDs for which to retrieve timeseries.
- locationIds: Subset of location IDs for which to retrieve timeseries.
- ensembleId: Id of the ensemble, can be null.
- ensembleMemberIndex Ensemble member index for this time series. (Only if configured)
- returns: String content of a PiTimeseries XML file only containing header information.
Code Block |
---|
String getTimeSeries(String clientId, String id, String taskId, Date startTime,
Date timeZero, Date endTime, String[] parameterIds, String[] locationIds, String ensembleId, int ensembleMemberIndex);
|
- mapping will be done.
- in1 - filterId: Filter Id. Can be retrieved using the String getFilters(String piVersion) method.
- in2 - piVersion: (Optional) Pi Version for the return file. Defaults to the latest PI version.
- returns: String content of a Pi_Locations XML file containing the locations available for passed filter id.
Code Block |
---|
String getParameters(String in0, String in1, String in2);
|
Get timeseries parameter information available for the passed 'filterId' argument.
- in0 - clientId: (Optional) clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD. If not provided then no id mapping will be done.
- id: Reference to the ID of a TimeSeries element in the service configuration file.
- taskId: <id not required however can not be null>
- startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- timeZero: Forecast time zero.
- endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- parameterIds: Subset of parmater IDs for which to retrieve timeseries.
- locationIds: Subset of location IDs for which to retrieve timeseries.
- ensembleId: Id of the ensemble, can be null.
- ensembleMemberIndex Ensemble member index for this time series. (Only if configured)
- returns: String content of a PiTimeseries XML file.
Code Block |
---|
byte[] getTimeSeriesBytes(String clientId, String id, String taskId, Date startTime,
Date timeZero, Date endTime, String[] parameterIds, String[] locationIds,
String ensembleId, int ensembleMemberIndex);
|
- in1 - filterId: Filter Id. Can be retrieved using the String getFilters(String piVersion) method.
- in2 - piVersion: (Optional) Pi Version for the return file. Defaults to the latest PI version.
- returns: String content of a Pi_TimeSeriesParameters XML file containing the parameters available for passed filter id.
Code Block |
---|
String getRatingCurves(String[] in0);
|
Retrieves rating curves content in PI-rating curve format for selecetd rating curve identifiers
- in0 - ratingCurveIds: String array with lcoation identifiers of the ratings
- returns: Xml string in Pi_ratyingcurves format holding rating curves
Code Block |
---|
String getLogMessages(String in0, String in1)
|
Get log messages produces by the last run of given task id.
- in0 - clientId: <id not required but can not be null>
- in1 - taskId: Task ID for which to retrieve log messages. Only messages for the last run are returned.
- returns: String containing the log messages in the format defined by the PI Diag XSD
Code Block |
---|
byte[] getModuleDataSet(String in0, String in1, String in2, int in3)
|
Get a module data set.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Reference to the ID of a TimeSeries ModuleDataSet element in the service configuration file.
- taskIdin2 - ensembleId: <id not required however can not be null>
- startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- timeZero: Forecast time zero.
- endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- parameterIds: Subset of parmater IDs for which to retrieve timeseries.
- locationIds: Subset of location IDs for which to retrieve timeseries.
- ensembleId: Id of the ensemble, can be null.
- ensembleMemberIndex Ensemble member index for this time series. (Only if configured)
- returns: Content of the binary file that can be exported together with the PITimeseries XML files.
Setter methods
Code Block |
---|
void putLogMessage(String clientId, String piDiagnosticsXmlContent);
|
- clientId: <id only used as description>
- piDiagnosticsXmlContent: String containing the log messages in the format defined by the PI Diag XSD
Code Block |
---|
void putModuleDataSet(String clientId, String taskId, String id, byte[] byteModuleDataSetContent,
Date validityStartTime, Date validityEndTime, String ensembleId, int ensembleMemberIndex);
|
- <not implemented>
Code Block |
---|
void putModuleParameterSet(String clientId, String id, String taskId, String piParameterSetXmlContent,
Date validityStartTime, Date validityEndTime, String ensembleId, int ensembleMemberIndex);
|
- <not implemented>
Code Block |
---|
void putState(String clientId, String taskId, String piStateXmlContent, String byteStateFileName,
byte[] byteStateContent, String ensembleId, int ensembleMemberIndex);
|
- <not implemented>
Code Block |
---|
void putTimeSeries(String clientId, String taskId, String id, String piTimeSeriesXmlContent,
String ensembleId, int ensembleMemberIndex);
|
- currently not supported>
- in3 - ensembleMemberIndex: <currently not supported>
- returns: Binary content of the ModuleDataSet file for requested ModuleState.
Code Block |
---|
byte[] getModuleParameterSet(String in0, String in1, String in2, int in3)
|
Get a module parameter set.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Reference to the ID of a ModuleParameterSet element in the service configuration file.
- in2 - ensembleId: <currently not supported>
- in3 - ensembleMemberIndex: <currently not supported>
- returns: String content of the ModuleParameterSet file for requested ModuleState.
Code Block |
---|
byte[] getModuleStateBinary(String in0, String in1, Date in2, String in3, int in4);
|
Get a cold state file.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Reference to the ID of a ModuleState element in the service configuration file.
- in2 - stateTime: Time for which to retrieve warm state file. Time values can be obtained from method #getAvailableStateTimes
- in3 - ensembleId: <currently not supported>
- in4 - ensembleMemberIndex: <currently not supported>
Timeseries
Code Block |
---|
String getTimeSeriesHeaders(String in0, String in1, String in2, Date in3,
Date in4, Date in5, String[] in6, String[] in7, String in8, int in9,
boolean in10);
|
Get the header information for requested timeseries.
- in0 - clientId: File name of service configuration clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- taskId: <id not required>
- in1 - id: Reference to the ID of a TimeSeries element in the service configuration file.
- piTimeSeriesXmlContent: Time Series content in the form of a Pi timeseries xml file.
- ensembleId: Id of the ensemble
- ensembleMemberIndex: Ensemble member index for this time series. NULL if this is not an ensemble.
Code Block |
---|
void putTimeSeriesBinary(String clientId, String taskId, String id, String piTimeSeriesXmlContent,
byte[] byteTimeSeriesContent, String ensembleId, int ensembleMemberIndex);
|
- in2 - taskId: <id not required however can not be null>
- in3 - startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- in4 - timeZero: Forecast time zero.
- in5 - endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- in6 - parameterIds: Subset of parameter IDs for which to retrieve timeseries.
- in7 - locationIds: Subset of location IDs for which to retrieve timeseries.
- in8 - ensembleId: Id of the ensemble, can be null.
- in9 - ensembleMemberIndex
- clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- taskId: <id not required>
- id: Reference to the ID of a TimeSeries element in the service configuration file.
- piTimeSeriesXmlContent: Time Series content in the form of a Pi timeseries xml file.
- byteTimeSeriesContent: TimeSeries data content in the form of a byte array.
- ensembleId: Id of the ensemble
- ensembleMemberIndex: Ensemble member index for this time series. NULL if this is not an ensemble.
Run methods
...
- (Only if configured)
- in10 - thresholdsVisible: (Optional) Option to add threshold values in the header if set to TRUE. Default is FALSE
- returns: String content of a PiTimeseries XML file only containing header information.
Code Block |
---|
String getTimeSeries(String in0, String in1, String in2, Date in3,
Date in4, Date in5, String[] in6, String[] in7, String in8, int in9,
boolean in10);
|
Get header and data for requested timeseries.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Reference to the ID of a TimeSeries element in the service configuration file.
- in2 - taskId: <id not required however can not be null>
- in3 - startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- in4 - timeZero: Forecast time zero.
- in5 - endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- in6 - parameterIds: Subset of parmater IDs for which to retrieve timeseries.
- in7 - locationIds: Subset of location IDs for which to retrieve timeseries.
- in8 - ensembleId: Id of the ensemble, can be null.
- in9 - ensembleMemberIndex Ensemble member index for this time series. (Only if configured)
- in10 - thresholdsVisible: (Optional) Option to add threshold values in the header if set to TRUE. Default is FALSE
- returns: String content of a PiTimeseries XML file.
Code Block |
---|
byte[] getTimeSeriesBytes(String in0, String in1, String in2, Date in3,
Date in4, Date in5, String[] in6, String[] in7, String in8, int in9);
|
Get binary data for requested timeseries.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Reference to the ID of a TimeSeries element in the service configuration file.
- in2 - taskId: <id not required however can not be null>
- in3 - startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- in4 - timeZero: Forecast time zero.
- in5 - endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- in6 - parameterIds: Subset of parameter IDs for which to retrieve timeseries.
- in7 - locationIds: Subset of location IDs for which to retrieve timeseries.
- in8 - ensembleId: Id of the ensemble, can be null.
- in9 - ensembleMemberIndex Ensemble member index for this time series. (Only if configured)
- returns: Content of the binary file that can be exported together with the PITimeseries XML files.
Code Block |
---|
String getTimeSeriesHeadersForFilter(String in0, Date in1, Date in2, Date in3, String in4, String[] in5, String[] in6, boolean in7, String in8);
|
Get the header information for requested timeseries using a filter id.
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD. If not
provided then no id mapping will be done. - in1 - startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- in2 - timeZero: Forecast time zero.
- in3 - endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- in4 - filterId: Filter Id. Can be retrieved using the String getFilters(String piVersion) method.
- in5 - locationIds: Subset of location IDs for which to retrieve timeseries.
- in6 - parameterIds: Subset of parameter IDs for which to retrieve timeseries.
- in7 - useDisplayUnits: (Optional) Option to export values using display units (TRUE) instead of database units (FALSE).
- in8 - piVersion: (Optional) Pi Version for the return file. Defaults to the latest PI version.
- returns: String content of a Pi_Timeseries XML file only containing header information.
Code Block |
---|
String getTimeSeriesForFilter(String in0, Date in1, Date in2, Date in3, String in4, String[] in5, String[] in6, boolean in7, boolean in8, String in9);
|
Get the timeseries data for requested timeseries using a filter id.
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD. If not
provided then no id mapping will be done. - in1 - startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- in2 - timeZero: Forecast time zero.
- in3 - endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- in4 - filterId: Filter Id. Can be retrieved using the String getFilters(String piVersion) method.
- in5 - locationIds: Subset of location IDs for which to retrieve timeseries.
- in6 - parameterIds: Subset of parameter IDs for which to retrieve timeseries.
- in7 - convertDatum: Option to convert values from relative to location height to absolute values (TRUE). If FALSE values remain relative.
- in8 - useDisplayUnits: Option to export values using display units (TRUE) instead of database units (FALSE).
- in9 - piVersion: (Optional) Pi Version for the return file. Defaults to the latest PI version.
- returns: String content of a Pi_Timeseries XML file only containing header information.
Code Block |
---|
String getTimeSeriesForSegment(String in0, String in1, Date in2, Date in3, Date in4, boolean in5);
|
Get the timeseries data for requested timeseries using a filter id.
- in0 - segmentId: identifier of the segment node
- in1 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD. If not provided then no id mapping will be done.
- in2 - timeZero: Forecast time zero.
- in3 - startTime: Start date/time of run - Long.MAXVALUE if the configured default is to be used
- in4 - endTime: End date/time of run - Long.MAXVALUE if the configured default is to be used
- in5 - threhsoldsVisisble: Option to include (TRUE) or exclude (FALSE) thresholds in the time series headers. Default is FALSE
- returns: String content of a Pi_Timeseries XML file containing all timeseries including headers for this segemnt
Client datasets
Code Block |
---|
String[] getAllNodesWithDataset();
|
Retrieves all identifiers of sgement nodes holding one or more client datasets
- returns: Array of string identifiers of nodes
Code Block |
---|
String[] getAllDataSetsIdsForNode(String in0, String in1);
|
Retrieves all identifiers to client datasets available for this segement node
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - nodeId: Segment node identifier
- returns: Array of string identifiers referring to client datasets
Code Block |
---|
String getDescription(String in0, String in1)
|
Retrieves description of a specific client dataset from the local datastore
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Identifier of client dataset
- returns: String description of dataset content
Code Block |
---|
byte[] getDataSet(String in0, String in1)
|
Retrieves client dataset from the local datastore
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Identifier of client dataset
- returns: Byte content of the requested client dataset
Code Block |
---|
long getLastModificationTimeDataSets();
|
Retrieves latest time when a client dataset has been modified
- returns: Modifcation Time as Long (modified Julian date)
Setter methods
Code Block |
---|
void setSystemTime(Date in0);
|
Sets system time (Time zero)
- in0 - systemTime: new SystemTime
Code Block |
---|
void putLogMessage(String in0, String in1);
|
Insert log messages
- in0 - clientId: <id only used as description>
- in1 - piDiagnosticsXmlContent: String containing the log messages in the format defined by the PI Diag XSD
Code Block |
---|
void putModuleDataSet(String in0, String in1, String in2, byte[] in3,
Date in4, Date in5, String in6, int in7);
|
Insert a module data set.
- <not implemented>
Code Block |
---|
void putModuleParameterSet(String in0, String in1, String in2, String in3,
Date in4, Date in5, String in6, int in7);
|
Insert a module parameter set.
- <not implemented>
Code Block |
---|
void putState(String in0, String in1, String in2, String in3,
byte[] in4, String in5, int in6);
|
- <not implemented>
Code Block |
---|
void putTimeSeries(String in0, String in1, String in2, String in3,
String in4, int in5);
|
Insert a timeseries.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - taskId: <id not required>
- in2 - id: Reference to the ID of a TimeSeries element in the service configuration file.
- in3 - piTimeSeriesXmlContent: Time Series content in the form of a Pi timeseries xml file.
- in4 - ensembleId: Id of the ensemble
- in5 - ensembleMemberIndex: Ensemble member index for this time series. NULL if this is not an ensemble.
Code Block |
---|
void putTimeSeriesBinary(String in0, String in1, String in2, String in3,
byte[] in4, String in5, int in6);
|
Insert a timeseries using the binary format.
- in0 - clientId: File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - taskId: <id not required>
- in2 - id: Reference to the ID of a TimeSeries element in the service configuration file.
- in3 - piTimeSeriesXmlContent: Time Series content in the form of a Pi timeseries xml file.
- in4 - byteTimeSeriesContent: TimeSeries data content in the form of a byte array.
- in5 - ensembleId: Id of the ensemble
- in6 - ensembleMemberIndex: Ensemble member index for this time series. NULL if this is not an ensemble.
Code Block |
---|
void putTimeSeriesForFilters(String in0, String in1, byte[] in2, boolean in3);
|
Insert a timeseries using the Filters configuration.
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD. If not
provided then no id mapping will be done. - in1 - piTimeSeriesXmlContent: Time Series content in the form of a Pi timeseries xml file. Timeseries must be
available in the FEWS Filters configuration file. - in2 - byteTimeSeriesContent: (Optional) TimeSeries data content in the form of a byte array.
- in3 - convertDatum Option to convert the values to values that are relative to location height (TRUE). If FALSE then no conversion is performed.
Run methods
Anchor | ||||
---|---|---|---|---|
|
Code Block |
---|
String createTask(String in0);
|
Create a new task.
- in0 - clientId: <not required>
- returns: Unique task id.
Anchor | ||||
---|---|---|---|---|
|
Code Block |
---|
String runTask(String in0, String in1, String in2, Date in3, Date in4,
Date in4, String in5, String in6, String in7, String in8);
|
Run a newly created task.
- in0 - clientId: <not required>
- in1 - taskId: Id obtained by calling method #createTask
- in2 - workflowId: Id of workflow to run by task.
- in3 - startTime: <not required>
- in4 - timeZero: <not required>
- in5 - endTime: <not required>
- in6 - coldStateId: <not implemented>
- in7 - userId: Id of user running task.
- in8 - scenarioId: Id of what-if scenario.
- in9 - description: Description
- returns: TaskRun id
Code Block |
---|
void cancelTask(String in0, String in1);
|
Cancel a running task.
- <not implemented>
Code Block |
---|
boolean waitForTask(String in0, String in1, int in2);
|
Wait for a running task to finish.
- in0 - clientId: <not required>
- in1 - taskId: Id of task run. Returned by callingmethod #runTask.
- in2 - waitMillis: Wait time in milli seconds.
- returns: TRUE if task run completes successfully, else FALSE
When running tasks via the embedded FewsPiService they will run in the same way as they would run via the Manual Forecast Dialog. In some cases it might be required that tasks run via the service are run as IFD run. In this case it is possible to configure an option in the global.properties files:
PiServiceRunIfdTasks=true
Conversion methods
Code Block |
---|
float[] convertToDisplayUnitValue(String in0, float[] in1);
|
Converts parameter values from base unit to display unit
- in0 - parameterId: Parameter identifier, used to trace down the associated base unit as well as the display unit
- in1- value: array of values to be converted
- returns: Array of converted values (floats)
Code Block |
---|
float []inverseConvertToDisplayUnitValue(String in0, float[] in1);
|
Converts parameter values from display unit to base unit
- in0 - parameterId: Parameter identifier, used to trace down the associated base unit as well as the display unit
- in1 - value: array of values to be converted
- returns: Array of converted values (floats)
Code Block |
---|
float[] convertStageToDischarge(float[] in0, String in1, long in2);
|
Converts stage value to discharge using a rating curve at a specific location valid for a particular moment in time
- in0 - locationId: Identifier of the rating cruve location
- in1 - time: time for which the rating curve should be valid
- in2 - stages: array of stages to be converted to discharge
- returns: array of values respresenting discharges
Code Block |
---|
float[] convertDischargeToStage(float[] in0, String in1, long in2);
|
Converts discharge value to stage using a rating curve at a specific location valid for a particular moment in time
- in0 - locationId: Identifier of the rating cruve location
- in1 - time: time for which the rating curve should be valid
- in2 - discharge: array of discharges to be converted to stage
- returns: array of values respresenting stage
Data management methods for client data sets
Code Block |
---|
void saveDataSet(String in0, String in1, byte[] in2, String in3, String in4);
|
Saves client data set to local datastore
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Identifier of client data set
- in2 - description: (Optional) description of the client dataset content
- in3 - dataSet: Byte object holding the client dataset
- in4 - nodeId: Segment/nodeId which is associated to this client dataset
Code Block |
---|
void updateDataSet(String in0, String in1, byte[] in2, String in3, String in4);
|
Updates existing client data set in local datastore
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1 - id: Identifier of client data set
- in2 - description: (Optional) description of the client dataset content
- in3 - dataSet: Byte object holding the client dataset
- in4 - nodeId: Segment/nodeId which is associated to this client dataset
Code Block |
---|
void deleteDataSet(String in0, String in1);
|
Removes existing client data set from local datastore
- in0 - clientId: (Optional) File name of service configuration file located in the OC configuration directory 'PiServiceConfigFiles'. This file is an instance of the FewsPiServiceConfig XSD.
- in1- id: Identifier of client data set
Code Block |
---|
void uploadDataSets();
|
Initiates a database synchronization to upload the client data set to the Master Controller
Installing a PI Service Client
Setting up a PI Service Client requires the following actions:
- Install an OC or SA.
- Select an available port number on which the service will be listening.
- Configure a FewsPiServiceCofig file for the OC/SA region.
PI Service configuration
The Pi Service configuration files are located in the directory 'PiServiceConfigFiles' of the region configuration. These files link the IDs know by the client applications to FEWS data, such as TimeSeries, States, ModuleDataSets and ModuleParameterSets.
A Pi Service file has five sections:
- General: Contains general configuration, such as import and export locations. Id mapping information for mapping client location/parameter ids to FEWS location/parameter ids.
- TimeSeries: Contains the mapping of client timeseries ids to the FEWS timeseries sets. Also some extra export options.
- ModuleDataSet: Contains the mapping of client moduleDataSet ids to the FEWS moduleInstance descriptor ids.
- ModuleParameterSet: Contains the mapping of client moduleParameterSet ids to the FEWS moduleInstance descriptor ids.
- ModuleState: Contains the mapping of client moduleState ids to the FEWS moduleInstance descriptor ids.
If a client application requires an application specific configuration file then this file must be configured in the directory ' PiClientConfigFiles' of the region configuration. This file is free format (text) and can be obtained from the API by calling #getClientConfigFile.
Initializing PI Service in Explorer config
The FEWS system does not automatically start up the PI service listener environment. This needs to be configured in the Explorer configuration file located in the directory 'SystemConfigFiles' of the region configuration. To do this the following line must be entered at the end of Explorer configuration file:
Code Block |
---|
<piServicePortRange start="8100" end="8100"/>
|
Where 'start' and 'end' represent the port number range within which the PI Service must find an available port. To fix the PI Service to a single port enter the same number twice.
Installing a FEWS PI Service as a backend process
It is also possible to initialize the FEWS PI Service as a backend process. The backend process is the same as the FEWS PI Service Client application, but then without the user interface. To run the service as a backend process the client needs to be installed first, as described above. After this has been completed continue with the following installation procedures:
The backend FEWS PI Service can be started in Windows by installing a Windows service that can start and stop the FEWS PI Service. Unpack the following archive containing the service installation files: NT_FewsEnvironmentShell_Service_Install.zip. Open a DOS command prompt in the directory containing the unpacked archive. Run the install:
Code Block |
---|
install_service.bat <work dir> <region name>
# Where 'work dir' is the directory containing the BIN, JRE and REGION dirs
# and 'region name' is the directory name of the region for which to install the service
|
Running the install_service.bat creates a file called bin.txt. This file contains the class path variable that needs to be inserted into the service parameter field JVM Option Number 1. This must be done using the tool 'regedit'. The reason for this complicated step is that the FEWS class path is too long causing the service install script to fail.
When in 'regedit' the installed service can be found in the location:
Computer->HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet->services->FewsShell <pi service name>
Start and stop the new service using the Windows services application. The service will have the following name; FewsShell <region name>.
Or in Linux by using the fews_piservice.sh file. This file should be placed in the same directory as the links to the JRE, BIN and the REGION dirs.
Code Block |
---|
# start the service
./fews_piservice.sh <REGION NAME> start
# stop the servie
./fews_piservice.sh <REGION NAME> stop
|
This backend FEWS PI Service does not use the Explorer configuration, as described above, to obtain the listener port number. This is to make sure that the client FEWS PI Services can run independently from the backend FEWS PI Services without port conflicts. Instead the backend FEWS PI Service obtains its listener port from the global.properties files, using the entry:
PiServicePort=2001
When not configured the value defaults to 2001.
Example code
Here follows some example code of how client applications can set up a connection the PI Service of a running FEWS OC.
Setting up a connection in JAVA
Before starting the client will require the following library: xfire-all-1.2.5.jar. This library can be found in the bin directory of the FEWS system.
Code Block |
---|
ObjectServiceFactory serviceFactory = new ObjectServiceFactory();
Service service = serviceFactory.create(FewsPiService.class);
XFireProxyFactory proxyFactory = new XFireProxyFactory();
//port Number must be equal to the number configured in the Explorer.xml
int portNumber = 8100;
//localhost can be replaced by the ip address of the machine on which the FEWS system is running.
FewsPiService serviceProxy = (FewsPiService) proxyFactory.create(service, "http://localhost:" + portNumber + "/FewsPiService")
|
Setting up a connection in C
Before starting the client will require the following librarys: libtcl.so and the libraries belonging to the TclSOAP package.
While there is a C++ libraries to handle SOAP, we could not find a pure C library. At first sight the C++ libraries seem to make it necessary to define classes and so on before you can start using them. With the Tcl approach the code remains quite simple. (We have not investigated exactly what TclSOAP requires, but it can be downloaded from ActiveState)
For the example fewspi.tcl file used refer to the attachment fewspi-C.tgz
Code Block |
---|
#include <stdio.h>
#include <tcl.h>
/* Define some helper variables and functions */
Tcl_Interp *interp;
int main( int argc, char *argv[] ) {
/* Get the library started */
if ( Init( argv[0] ) != TCL_OK ) {
fprintf( stderr, "Sorry, initialisation failed: %s\n",
Tcl_GetStringResult( interp ) );
}
/* Here insert calls to Pi Service */
fprintf( stdout, "Locations: %s\n", getLocations( "id not required" ) );
fprintf( stdout, "New task: %s\n", createTask( "id not required" ) );
}
void TearDown () {Tcl_Finalize();}
int EvalFile (char *fileName) {
return Tcl_EvalFile(interp, fileName);
}
int Init (char *argv0) {
char *pchar;
char buffer[1000];
/* Initialise the library itself */
Tcl_FindExecutable(argv0);
interp = Tcl_CreateInterp();
if (Tcl_Init(interp) != TCL_OK) {
return TCL_ERROR;
}
/* Initialise the FEWS PI services */
strcpy( buffer, argv0 );
pchar = strrchr( buffer, '/' );
if ( pchar == NULL ) {
pchar = strrchr( buffer, '\\' );
}
if ( pchar == NULL ) {
pchar = buffer;
}
strcpy( buffer, "fewspi.tcl" );
return EvalFile( buffer );
}
|
Setting up method calls JAVA
Here follow some code examples of how to query the PI Service proxy from the client application. The configuration used to make these examples can be found in the attached Example Configuration.
Code Block |
---|
/**
* Test the retrieval of system time.
* <p/>
* With this test the system time of a running Fews Region (on port 8191) can be retrieved. If the
* system time of the region is changed then the returned value here will match the change.
*/
public void testSystemTime() {
String clientId = "not required";
Date date = serviceProxy.getSystemTime(clientId);
System.out.println("Current System time : " + dateFormat.format(date));
}
/**
* Return the warm state times from the data base for the configured moduleState id=RSNWELEV_DETO3I
* in the service configuration file = TestConfig.
*/
public void testGetWarmStateTimes() {
//name of service config file
String clientId = "TestConfig";
//id of moduleState element
String moduleId = "RSNWELEV_DETO3I";
Date[] stateTimes = serviceProxy.getAvailableStateTimes(clientId, moduleId);
System.out.println("State times for Module " + moduleId);
for (Date stateTime : stateTimes) {
System.out.println("time: " + dateFormat.format(stateTime));
}
}
/**
* Return the cold state ids from the data base for the configured moduleState id=RSNWELEV_DETO3I
* in the service configuration file = TestConfig.
*/
public void testGetColdStateIds() {
//name of service config file
String clientId = "TestConfig";
//id of moduleState element
String moduleId = "RSNWELEV_DETO3I";
String[] stateIds = serviceProxy.getColdStateIds(clientId, moduleId);
System.out.println("Cold state ids for model " + moduleId);
for (String id : stateIds) {
System.out.println("cold state: " + id);
}
}
/**
* Return the warm state file from the data base for the configured moduleState id=SNOW17_LSMO3U
* in the service configuration file = TestConfig. Write file to location d:/temp/<moduleStateId>.zip
*/
public void testGetModuleStateBinary() throws IOException {
//name of service config file
String clientId = "TestConfig";
//id of moduleState element
String moduleId = "SNOW17_LSMO3U";
Date[] stateTimes = serviceProxy.getAvailableStateTimes(clientId, moduleId);
byte[] binary = serviceProxy.getModuleStateBinary(clientId, moduleId, stateTimes[0], null, -1);
ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(binary));
try {
ZipUtils.unzipFiles(zipInputStream, new File("d:/temp/" + moduleId + ".zip"));
} finally {
zipInputStream.close();
}
}
/**
* Returns the content of a client configuration file from the config directory PiClientConfigFiles.
*
* Only requirement is that a configuration file (any type) with the clientId as name and moduleId as extension
* must exist in this config directory.
*/
public void testGetClientConfigurationFile(){
//Name of client file
String clientId = "MyClientConfigFile";
//extension of client file
String moduleId = "txt";
String clientText = serviceProxy.getClientConfigFile(clientId, moduleId);
System.out.println("Client file content: " + clientText);
}
/**
* Retrieve the content of the locations xml. Write this to d:/temp/locations.xml
* @throws IOException
*/
public void testGetLocations() throws IOException {
String locations = serviceProxy.getLocations("id not required");
System.out.println("Content of locations xml file: " + locations);
FileUtils.writeText("d:/temp/locations.xml", IOUtils.UTF8_CHARSET, locations);
}
/**
* Return the member indices for the ensemble id = "ESP" from the timeseries table.
*
* This only works when there are ensemble members in the TimeSeries table.
*/
public void testGetEnsembleMemberIndices(){
String ensembleId = "ESP";
int[] indices = serviceProxy.getEnsembleMemberIndices("id not required", ensembleId);
System.out.println("Ensemble id " + ensembleId + " contains " + indices.length + " members.");
System.out.println("indices are: ");
for (int indice : indices) {
System.out.println(indice);
}
}
/**
* Get the logentries for an Import TaskId.
*
* Check the LogEntries table to find a matching taskId.
*
* @throws IOException
*/
public void testGetLogInformation() throws IOException {
String taskId = "NWSNWMC00:0000026"; //=import
String logInfo = serviceProxy.getLogMessages("id not required", taskId);
System.out.println("Content of log: " + logInfo);
FileUtils.writeText("d:/temp/log.xml", IOUtils.UTF8_CHARSET, logInfo);
}
/**
* Return the timeseries defined in the service configuration file under timeSeries element with id 'Reservoir'.
*
* Filter using parameter ids QIN and RQIN and location ids DETO3, GPRO3 and FOSO3
*
* Check timeseries table to look for existing times for these timeseries.
*
* @throws IOException
*/
public void testGetTimeSeries() throws IOException {
Date systemTime = serviceProxy.getSystemTime("id not required");
Calendar instance = GregorianCalendar.getInstance(TimeZone.getTimeZone("GMT"));
instance.set(2009, 4, 1);
Date start = instance.getTime();
instance.set(2009, 4, 11);
Date end = instance.getTime();
String[] params = new String[]{"QIN", "RQIN"};
String[] locs = new String[]{"DETO3","GPRO3","FOSO3"};
String headers = serviceProxy.getTimeSeriesHeaders("TestConfig", "Reservoir", null, start, systemTime, end, params, locs, null, -1);
System.out.println("Content of tineseries headers: " + headers);
String timeseriesfile = serviceProxy.getTimeSeries("TestConfig", "Reservoir", null, start, systemTime, end, params, locs, null, -1);
FileUtils.writeText("d:/temp/timeseries.xml", IOUtils.UTF8_CHARSET, timeseriesfile);
}
/**
* Upload a pi_diag log file to the region.
*
* Make sure to create an input file in corresponding directory.
*
* @throws IOException
*/
public void testInsertLogMessages() throws IOException {
String logText = FileUtils.readText("d:/temp/inputlog.xml");
serviceProxy.putLogMessage("used as description", logText);
}
/**
* Upload a pi_timeseries file to the Region. The timeseries in this file must be linked to timeseries configured
* in the PiServiceConfig file.
*
* Make sure to create an input file in the corresponding directory.
*
* @throws IOException
*/
public void testInsertTimeSeries() throws IOException {
String timeseriesText = FileUtils.readText("d:/temp/inputtimeseries.xml");
System.out.println("Input timeseries: " + timeseriesText);
serviceProxy.putTimeSeries("TestConfig", null, "Reservoir", timeseriesText, null, -1);
}
/**
* Schedule a task run and wait for it to finish.
*
*/
public void testRunningTask(){
String taskId = serviceProxy.createTask("id not required");
Date date = serviceProxy.getSystemTime("");
System.out.println("Starting task with id " + taskId + " time=" + new Date(System.currentTimeMillis()));
String taskRunId = serviceProxy.runTask("id not required", taskId, "Santiam_Forecast", date, date, date, null, null, "Test user", "PiWebservice taskrun");
boolean result = serviceProxy.waitForTask("id not required", taskRunId, 120000);
System.out.println("Task with id " + taskId + (result ? " finished successfully" : " failed"));
System.out.println("time=" + new Date(System.currentTimeMillis()));
}
|
Setting up method calls C
Here follow some code examples of how to query the PI Service proxy from the client application. The configuration used to make these examples can be found in the attached Example Configuration.
Code Block |
---|
/* Fews PI services: wrapper functions */
char *getLocations( char *clientId ) {
char buffer[1000];
strcpy( buffer, "getLocations " );
strcat( buffer, clientId );
if ( Tcl_Eval( interp, buffer ) != TCL_OK )
{
return NULL;
} else {
return Tcl_GetStringResult( interp ) ;
}
}
char *createTask( char *clientId ) {
Tcl_Obj *obj[2];
obj[0] = Tcl_NewStringObj( "createTask", -1 );
obj[1] = Tcl_NewStringObj( clientId, -1 );
Tcl_IncrRefCount( obj[0] ) ;
Tcl_IncrRefCount( obj[1] ) ;
if ( Tcl_EvalObjv( interp, 2, obj, 0 ) != TCL_OK ) {
return NULL;
} else {
Tcl_DecrRefCount( obj[0] ) ;
Tcl_DecrRefCount( obj[1] ) ;
return Tcl_GetStringResult( interp ) ;
}
}
|
Appendix
FewsPiService WSDL
Example of the FewsPiService WSDL definition. This definition file is used by other applications to connect to the webservice.
fewsPiServiceWSDL.xml
FewsPiService API
Example of the FewsPiService class. This class defines the API.
No Format |
---|
/* ================================================================
* Delft FEWS
* ================================================================
*
* Project Info: http://www.wldelft.nl/soft/fews/index.html
* Project Lead: Karel Heynert (karel.heynert@wldelft.nl)
*
* (C) Copyright 2003, by WL | Delft Hydraulics
* P.O. Box 177
* 2600 MH Delft
* The Netherlands
* http://www.wldelft.nl
*
* DELFT-FEWS is a sophisticated collection of modules designed
* for building a FEWS customised to the specific requirements
* of individual agencies. An open modelling approach allows users
* to add their own modules in an efficient way.
*
* ----------------------------------------------------------------
* WebService.java
* ----------------------------------------------------------------
* (C) Copyright 2003, by WL | Delft Hydraulics
*
* Original Author: Erik de Rooij
* Contributor(s):
*
* Changes:
* --------
* 10-Sep-2007 : Version 1 ();
*
*
*/
package nl.wldelft.fews.system.pi;
import java.util.Date;
/**
* TODO <code>ISSUES</code>
*<li>Optional Date arguments can not be set to NULL when not used.</li>
*<li> When retrieving timeseries. What use is it to add ensemble Id? Because the timeseries set already contains the ensemble id. </li>
*<li> Some interface call do not require the clientId. Should we remove this to simplify things?</li>
*/
public interface FewsPiService {
String getLocations(String clientId);
/**
* Retrieve the configuration file for the .
* @param clientId Id of web service client (obtained on command line when invoked)
* @param fileExtension. Case insensitive. Extension of the config file (e.g. xml, ini), One client can have multiple config files
* with different file extensions.
* @return client config text file. Format of file must be known by client.
*/
String getClientConfigFile(String clientId, String fileExtension);
/**
* Create a new Task. Use return Task id when exporting data to the WebService.
* @param clientId Id of web service client (obtained on command line when invoked)
* @return Task id for the new task.
*/
String createTask(String clientId);
/**
* Return the current time zero of the system.
*
* @param clientId Id of web service client (obtained on command line when invoked)
* @return Time zero
*/
Date getSystemTime(String clientId);
/**
* TODO
*
* ID of Configured timezone for the webservice
* @param clientId
* @return
*/
String getTimeZoneId(String clientId);
|
...
Code Block |
---|
String createTask(String clientId);
|
- clientId: <not required>
- returns: Unique task id.
...
Code Block |
---|
String runTask(String clientId, String taskId, String workflowId, Date startTime, Date timeZero,
Date endTime, String coldStateId, String scenarioId, String userId, String description);
|
- clientId: <not required>
- taskId: Id obtained by calling method #createTask
- workflowId: Id of workflow to run by task.
- startTime: <not required>
- timeZero: <not required>
- endTime: <not required>
- coldStateId: <not implemented>
- userId: Id of user running task.
- description: Description
- returns: TaskRun id
Code Block |
---|
void cancelTask(String clientId, String taskId);
|
- <not implemented>
Code Block |
---|
boolean waitForTask(String clientId, String taskId, int waitMillis);
|
- clientId: <not required>
- taskId: Id of task run. Returned by callingmethod #runTask.
- waitMillis: Wait time in milli seconds.
- returns: TRUE if task run completes successfully, else FALSE
Setting up PI Service Client
Setting up a PI Service Client requires the following actions:
- Install an OC or SA.
- Select an available port number on which the service will be listening.
- Configure a FewsPiServiceCofig file for the OC/SA region.
The Pi Service configuration files are located in the directory 'PiServiceConfigFiles' of the region configuration. These files link the IDs know by the client applications to FEWS data, such as TimeSeries, States, ModuleDataSets and ModuleParameterSets.
A Pi Service file has five sections:
- General: Contains general configuration, such as import and export locations. Id mapping information for mapping client location/parameter ids to FEWS location/parameter ids.
- TimeSeries: Contains the mapping of client timeseries ids to the FEWS timeseries sets. Also some extra export options.
- ModuleDataSet: Contains the mapping of client moduleDataSet ids to the FEWS moduleInstance descriptor ids.
- ModuleParameterSet: Contains the mapping of client moduleParameterSet ids to the FEWS moduleInstance descriptor ids.
- ModuleState: Contains the mapping of client moduleState ids to the FEWS moduleInstance descriptor ids.
If a client application requires an application specific configuration file then this file must be configured in the directory ' PiClientConfigFiles' of the region configuration. This file is free format (text) and can be obtained from the API by calling #getClientConfigFile.
The FEWS system does not automatically start up the PI service listener environment. This needs to be configured in the Explorer configuration file located in the directory 'SystemConfigFiles' of the region configuration. To do this the following line must be entered at the end of Explorer configuration file:
Code Block |
---|
<piServicePortRange start="8100" end="8100"/>
|
Where 'start' and 'end' represent the port number range within which the PI Service must find an available port. To fix the PI Service to a single port enter the same number twice.
Example code
Here follows some example code of how client applications can set up a connection the PI Service of a running FEWS OC.
Before starting the client will require the following library: xfire-all-1.2.5.jar. This library can be found in the bin directory of the FEWS system.
Setting up a connection
Code Block |
---|
ObjectServiceFactory serviceFactory = new ObjectServiceFactory();
Service service = serviceFactory.create(FewsPiService.class);
XFireProxyFactory proxyFactory = new XFireProxyFactory();
//port Number must be equal to the number configured in the Explorer.xml
int portNumber = 8100;
//localhost can be replaced by the ip address of the machine on which the FEWS system is running.
FewsPiService serviceProxy = (FewsPiService) proxyFactory.create(service, "http://localhost:" + portNumber + "/FewsPiService");
|
Appendix
FewsPiService API
Example of the FewsPiService class. This class defines the API.
No Format |
---|
/* ================================================================ * Delft FEWS * ================================================================ * * Project Info: http://www.wldelft.nl/soft/fews/index.html * Project Lead: Karel Heynert (karel.heynert@wldelft.nl) * * (C) Copyright 2003, by WL | Delft Hydraulics * P.O. Box 177 * 2600 MH Delft * The Netherlands * http://www.wldelft.nl * * DELFT-FEWS is a sophisticated collection of modules designed * for building a FEWS customised to the specific requirements * of individual agencies. An open modelling approach allows users * to add their own modules in an efficient way. * * ---------------------------------------------------------------- * WebService.java * ---------------------------------------------------------------- * (C) Copyright 2003, by WL | Delft Hydraulics * * Original Author: Erik de Rooij * Contributor(s): * * Changes: * -------- * 10-Sep-2007 : Version 1 (); * * */ package nl.wldelft.fews.system.pi; import java.util.Date; /** * TODO <code>ISSUES</code> *<li>Optional Date arguments can not be set to NULL when not used.</li> *<li> When retrieving timeseries. What use is it to add ensemble Id? Because the timeseries set already contains the ensemble id. </li> *<li> Some interface call do not require the clientId. Should we remove this to simplify things?</li> */ public interface FewsPiService { String getLocations(String clientId); /** * Retrieve the configuration file for the . Run a Single task. TaskId must be obtained using the method {@link FewsPiService#createTask(String)}. * * @param clientId Id of web service client (obtained on command line when invoked) * @param taskId Task Id * @param fileExtension. Case insensitive. Extension of the config file (e.g. xml, ini), One client can have multiple config filesworkflowId Workflow Id * @param startTime start date/time of run - NULL if the configured default is to be used * @param withtimeZero differentForecast filetime extensionszero. * @return client config text file. Format of file must be known by client. @param endTime end date/time of run - NULL if the configured default is to be used */ String getClientConfigFile(String clientId, String fileExtension); /** @param coldStateId String identifying the cold state to use - NULL if a cold state start is not forced * Create@param ascenarioId new Task. Use return Task id when exporting data to the WebService. String identifying the "what if" scenario - NULL if not used * @param clientIduserId Id of web service client (obtained on command line when invoked) user running task. * @param description Description * @return TaskReturns id for the newTaskRun task.id */ String createTaskrunTask(String clientId); /** * Return the current time zero of the system. , String taskId, String workflowId, Date startTime, Date timeZero, Date endTime, String coldStateId, String scenarioId, String userId, String description); /** * Request Ids of available cold states * * @param clientId Id of web service client (obtained on command line when invoked) * @return@param Timeid zero Id of the State module */ instance for which to Dateretrieve getSystemTime(String clientId); /** * TODO * * ID of Configured timezone for the webservice * @param clientId * @return */ String getTimeZoneId(String clientIdthe cold state ids. * @return List of available cold state groups */ String[] getColdStateIds(String clientId, String id); /** * Request Runrun astatus Singleof task. This TaskIdcan be mustused beto obtainedwait usingfor thea methodtask {@link FewsPiService#createTask(String)}.to complete * * @param clientId Id of web service client (obtained on command line when invoked) * @param taskId Task Id * @param workflowIdwaitMillis Workflownumber Id of milli-seconds to wait between *status @paramrequests startTime start date/time of run* -@return NULLboolean if thetask configured default is tocomplete beor used has * @param timeZero Forecast time zero.been cancelled * @param endTime end date/time of run - NULL if the configured default is to be used * @param coldStateId String identifying the cold state to use - NULL if a cold state start is not forced/ boolean waitForTask(String clientId, String taskId, int waitMillis); /** * cancel task. Cancel a running task * * @param userIdclientId Id of userweb runningservice task. client (obtained on command line * @param description Descriptionwhen invoked) * @return@param ReturnstaskId theTask TaskRun idId */ Stringvoid runTaskcancelTask(String clientId, String taskId,); String workflowId, Date startTime, Date timeZero, Date endTime, String coldStateId, String scenarioId, String userId, String description); /** * Request Ids of available cold states /** * Retrieve the indices for the given ensemble id. * * @param clientId Id of web service client (obtained on command line when invoked) * @param idensembleId Id of the ensemble State module instance for* which@return toAll retrievevalid theindices coldfor statethis idsensemble. * @return List of available*/ cold state groups */ String int[] getColdStateIdsgetEnsembleMemberIndices(String clientId, String idensembleId); /** * RequestWrite runtimeseries statusassociated ofto task.a This can be usedspecific task to waitwebservice. forThe awebservice taskwill tostore complete this information in the *database. * @param clientId Id of web service client (obtained on command line when invoked) * @paramIf taskIdthe Tasktime Id series is an ensemble then *each @paramensemble waitMillis number of milli-secondsmember needs to waitbe between status requestssubmitted individually. * @return boolean if task is complete or has been cancelled using the <i>ensembleMemberIndex</i> argument. For deterministic time series the <i>ensembleMemberIndex</i> is NULL */ Use boolean waitForTask{@link FewsPiService#getEnsembleMemberIndices(String clientId, String taskId, int waitMillis); )} /** to obtain valid ensemble *member cancelindex taskvalues. Cancel a running task* * * @param clientId Id of web service client (obtained on command line when invoked) * @param taskId Task Id */ The TaskId may be NULL or the requested task id. * In case it is NULL the time series is written as data visible to all other processes in FEWS void cancelTask(String clientId, String taskId); /** * Retrieve the indices for the given ensemble id.* In case it is TaskId the time series will be used only by the task run with TaskId (e.g. scenario time series) * * @param clientId Id of web service client (obtained on command line when invoked) line when invoked) * @param taskId Task id. Obtained using method {@link FewsPiService#createTask(String)} * @param ensembleIdid Id of the ensemble Pi timeseries xml content. * @param piTimeSeriesXmlContent @returnTime AllSeries validcontent indicesin forthe thisform ensemble. of a Pi timeseries xml */file. int[] getEnsembleMemberIndices(String clientId, String ensembleId); /** * @param ensembleId Id of the ensemble * Write@param timeseriesensembleMemberIndex associatedEnsemble tomember aindex specificfor taskthis totime webserviceseries. TheNULL webserviceif will store this informationis innot thean databaseensemble. * * If the time series is an ensemble then each ensemble member needs to be submitted individually. * using the <i>ensembleMemberIndex</i> argument. For deterministic time series the <i>ensembleMemberIndex</i> is NULL * Use {@link FewsPiService#getEnsembleMemberIndices(String, String)}/ void putTimeSeries(String clientId, String taskId, String id, String piTimeSeriesXmlContent, String ensembleId, int ensembleMemberIndex); /** * Write timeseries. The webservice will store this information in the database. * to obtain valid ensemble member index* values.<p> * For performance reasons it is possible *to Thesplit TaskIdthe maytimeseries beheader NULLinformation orfrom the requested task id.timeseries data. The header information * is Instored casein itthe is<i>piTimeSeriesXmlContent</i> NULLand the timetimeseries seriesdata is writtenstored asin data visible to all other processes in FEWSthe <i>byteTimeSeriesContent</i>. * <p> * In case it is TaskId If the time series is willan beensemble usedthen onlyeach byensemble themember taskneeds runto withbe TaskIdsubmitted (eindividually.g. scenario time series) * using the * * @param clientId Id of web service client (obtained on command line when invoked)<i>ensembleMemberIndex</i> argument. For deterministic time series the <i>ensembleMemberIndex</i> is NULL * Use {@link FewsPiService#getEnsembleMemberIndices(String, String)} * to obtain @paramvalid taskIdensemble member Taskindex idvalues. Obtained using method {@link FewsPiService#createTask(String)} * * @param id Id ofThe TaskId may be NULL or the Pirequested timeseriestask xml contentid. * @paramIn piTimeSeriesXmlContentcase it Timeis SeriesNULL contentthe intime theseries formis ofwritten aas Pidata timeseriesvisible xmlto file. all other processes in FEWS * @param ensembleId Id of* theIn ensemble case it is TaskId the *time @paramseries ensembleMemberIndexwill Ensemblebe memberused indexonly forby thisthe timetask series. NULL if this is not an ensemble.run with TaskId (e.g. scenario time series) */ void* putTimeSeries(String@param clientId, Id Stringof taskId,web Stringservice id,client String(obtained piTimeSeriesXmlContent,on Stringcommand ensembleId,line intwhen ensembleMemberIndexinvoked); /** * Write timeseries. The webservice will store this information in the database. ** @param taskId Task id. Obtained using method {@link FewsPiService#createTask(String)} * @param id Id of the Pi timeseries xml content. * <p> @param piTimeSeriesXmlContent TimeSeries content *in Forthe performanceform reasonsof ita isPi possible totimeseries splitxml thefile. timeseries header information from the* timeseries@param data.byteTimeSeriesContent The headerTimeSeries information data content in the form *of isa storedbyte inarray. the <i>piTimeSeriesXmlContent</i> and the timeseries* data@param isensembleId storedId inof the <i>byteTimeSeriesContent</i>.ensemble * <p> @param ensembleMemberIndex Ensemble member index *for If thethis time series. NULL isif anthis ensembleis thennot eachan ensemble. member needs to be submitted individually. */ void putTimeSeriesBinary(String *clientId, usingString the <i>ensembleMemberIndex</i> argument. For deterministic time series the <i>ensembleMemberIndex</i> is NULLtaskId, String id, String piTimeSeriesXmlContent, byte[] byteTimeSeriesContent, String ensembleId, int ensembleMemberIndex); /** Use {@link FewsPiService#getEnsembleMemberIndices(String, String)} * Write information about *the toparameter obtainset validfile ensemblegiven memberthe index valueswebservice. * * The TaskId may be NULL or the requested task id. * In case it is NULL the timeparameters seriesversion iswill written as data visible to all other processes in FEWSbe upaded * In case it is TaskId the time seriesparameters will be used only by the task run with TaskId (e.g. scenario time seriesrun) * * @param clientId Id of web service client (obtained on command line when invoked) * @param taskId Task id. Obtained using method {@link FewsPiService#createTask(String)} * @param id Id of parameter set * @param piParameterSetXmlContent Parameters content in the form of a Pi timeseriesparameters xml contentfile. * @param piTimeSeriesXmlContent TimeSeries content in the form of a Pi timeseries xml file. @param validityStartTime Start time of parameter validity (NULL if not applicable) * @param byteTimeSeriesContentvalidityEndTime End TimeSeriestime dataof contentparameter invalidity the(NULL formif of a byte array.not applicable) * @param ensembleId Id of the ensemble * @param ensembleMemberIndex Ensemble member index for this time series. NULL if this is not an ensemble. */ void putTimeSeriesBinaryputModuleParameterSet(String clientId, String id, String taskId, String idpiParameterSetXmlContent, StringDate piTimeSeriesXmlContentvalidityStartTime, byte[]Date byteTimeSeriesContentvalidityEndTime, String ensembleId, int ensembleMemberIndex); /** * Write information about the parameter set file given the webservice. * * The TaskId may be NULL or the requested task id. * In case it is NULL the parameters version will be upaded * In case it is TaskId the parameters will be used only by the task run with TaskId (e.g. scenario run) dataset file for the given taskId back to the webservice. The webservice will store this information and will add it to the * task properties when the task is run. * * @param clientId Id of web service client (obtained on command line when invoked) * @param taskId Task id. Obtained using method {@link FewsPiService#createTask(String)} * @param id Id of Module parameterDataSet setfile. * @param piParameterSetXmlContentbyteModuleDataSetContent Zipped Parameters content in the form of a Pi parameters xml file.module dataset file * @param validityStartTime Start time of parameterdataset validity (NULL if not applicable) * @param validityEndTime End time of parameterdataset validity (NULL if not applicable) * @param ensembleId Id of the ensemble * @param ensembleMemberIndex Ensemble member index for this time series. NULL if this is not an ensemble. */ void putModuleParameterSetputModuleDataSet(String clientId, String idtaskId, String taskIdid, Stringbyte[] piParameterSetXmlContentbyteModuleDataSetContent, Date validityStartTime, Date validityEndTime, String ensembleId, int ensembleMemberIndex); /** * Write information about the dataset file for the* givenWrite taskIdstate backinformation to the webservice. The webservice will store this information andin will add it to thethe database. * task properties when the task is run.* <p> * The state * @param clientId Id information consists of webtwo serviceseperate clientparts. (obtained on command line when invoked)The <i>piStateXmlContent</i> containing information * @paramabout taskIdthe state Task idfiles. ObtainedAnd usingthe method {@link FewsPiService#createTask(String)} * @param id Id of Module DataSet file. * @param byteModuleDataSetContent Zipped module dataset file<i>byteStateContent</i> containing the actual state data for the module. * * @param validityStartTimeclientId StartId timeof ofweb datasetservice validityclient (NULL if not applicableobtained on command line when invoked) * @param validityEndTimetaskId End timeTask ofid. datasetObtained validityusing (NULLmethod if not applicable){@link FewsPiService#createTask(String)} * @param ensembleIdpiStateXmlContent IdPi ofstate thexml ensemblefile. * @param ensembleMemberIndexbyteStateFileName Ensemble membername indexof forthe thisstate timefile series.data NULLcontent if this is not an ensemble. */byte array. void putModuleDataSet(String clientId, String taskId, String id, byte[] byteModuleDataSetContent, Date validityStartTime, Date validityEndTime, String ensembleId, int ensembleMemberIndex); /** * @param byteStateContent State file data content in the form of a byte array. * @param ensembleId WriteId stateof informationthe toensemble webservice. The webservice will store* this@param informationensembleMemberIndex inEnsemble themember database. index for this time series. * NULL if this is not *an <p>ensemble. */ The state information consistsvoid of two seperate parts. The <i>piStateXmlContent</i> containing information * about the state files. And the <i>byteStateContent</i> containing the actual state data for the module.putState(String clientId, String taskId, String piStateXmlContent, String byteStateFileName, byte[] byteStateContent, String ensembleId, int ensembleMemberIndex); /** * Put a log message * * @param clientId Id of web service client (obtained on command line when invoked) * @param taskId Task id. Obtained using method {@link FewsPiService#createTask(String)} * @param piStateXmlContent piDiagnosticsXmlContent Pi stateDiagnostics xml file. * @param byteStateFileName name of the state file data content byte array./ void * @param byteStateContent State file data content in the form of a byte array.putLogMessage(String clientId, String piDiagnosticsXmlContent); /** * @paramRead ensembleIdmodule Iddataset ofinformation thefrom ensemblewebservice. * @param ensembleMemberIndex Ensemble member* index<p> for this time series. NULL*Default ifdata thisset is not an ensemblereturned. */ void putState(String clientId, String taskId, String piStateXmlContent, String byteStateFileName, byte[] byteStateContent, String ensembleId, int ensembleMemberIndex); /** * @param clientId Id of webservice configuration that is to be queried * @param id Id of the module data set . * Put@return a log message *Module data set file as byte array. * @param clientIdensembleId Id of the ensemble web service client (obtained* on@param commandensembleMemberIndex lineEnsemble whenmember invoked) index for this time series. *NULL @paramif piDiagnosticsXmlContentthis Piis Diagnosticsnot xmlan fileensemble. */ voidbyte[] putLogMessagegetModuleDataSet(String clientId, String id, String ensembleId, int piDiagnosticsXmlContentensembleMemberIndex); /** * Read module parameter datasetset information from webservice. * * <p> *Default data setparameterSet is returned. * * @param clientId Id of webservice configuration that is to be queried * @param id Idname of the binary module dataparameter set . * @return Module data set file as byte array. * @param ensembleId Id of the ensemble * @param ensembleMemberIndex Ensemble member index for this time series. NULL if this is not an ensemble if this is not an ensemble. * @return Module parameter set PiParameters xml. */ byte[]String getModuleDataSetgetModuleParameterSet(String clientId, String id, String ensembleId, int ensembleMemberIndex); /** * Read all available modulestate parametertimes setfor informationrequested fromstate webservicefile. * * <p> @param clientId Id of webservice configuration that is to be queried *Default data parameterSet is returned @param id Id of the module state . * * @param clientId Id of webservice configuration that is to be queried @return All available state times for this module state file. */ Date[] getAvailableStateTimes(String clientId, String id); /** @param id name of the* binaryRead module state parameterinformation setfrom filewebservice. * @param ensembleId Id of the* ensemble<p> *Module @paramstate ensembleMemberIndexdata Ensemblefile memberis indexreturned for thisgiven time series. NULLUse ifmethod this is not an ensemble.{@link FewsPiService#getAvailableStateTimes(String, String)} * @returnto Moduleretrieve parameterthe setavailable PiParametersstate xmltimes. */ String* getModuleParameterSet(String@param clientId, String id, String ensembleId, int ensembleMemberIndex); Id of webservice configuration that is to be queried /*** @param id Id of the state . * Read@param stateTime allTime availablefor statewhich timesto forretrieve requesteda state file. * @return Module state data *file @paramas clientId Id of webservice configuration that is to be queriedbyte array. * @param idensembleId Id of the module state .ensemble * @return@param AllensembleMemberIndex availableEnsemble statemember timesindex for this time series. NULL if this is modulenot statean fileensemble. */ Datebyte[] getAvailableStateTimesgetModuleStateBinary(String clientId, String id); , Date stateTime, /** * Read module state information from webservice. *String ensembleId, int ensembleMemberIndex); /** <p> *Module stateRead datathe filetimeseries isfrom returned for given timethe webservice. UseReturns methoda {@link FewsPiService#getAvailableStateTimes(String, String)} * to retrieve the available state timespi timeseries xml file containing the timeseries information. * * @param clientId Id of webservice configuration that is to be queried * @param id Id of the state . * @param stateTime Time for which to retrieve a state file.<p> * If the ensemble id has been configured for this timeseries then add the <i>ensembleMemberIndex</i> as argument. Use NULL if not an ensemble * Use {@link FewsPiService#getEnsembleMemberIndices(String, String)} * to obtain @returnvalid Moduleindex statevalues. data file as byte array.* * @paramThe ensembleIdTaskId Idmay ofbe theNULL ensemble or the requested task id. * @paramIn ensembleMemberIndexcase Ensembleit memberis indexTaskId forthe this time series. NULLis ifretrieved thisfor isthe nottaskId anonly ensemble. for simulated time series */ In case it byte[] getModuleStateBinary(String clientId, String id, Date stateTime, String ensembleId, int ensembleMemberIndex); /**is NULL time series for the current forecast will be retreived * Read the timeseries from the* webservice.@param ReturnsclientId aId piof timeserieswebservice xmlconfiguration filethat containingis theto timeseriesbe information.queried * @param id Id of the time *series <p>string. * @param IftaskId the ensembleTask id. hasObtained beenusing configuredmethod for this timeseries then add the <i>ensembleMemberIndex</i> as argument. Use NULL if not an ensemble * Use {@link FewsPiService#getEnsembleMemberIndices(String, String)}{@link FewsPiService#createTask(String)} * @param startTime start date/time of run - NULL if the configured default is to be used * to@param obtaintimeZero validForecast indextime valueszero. * @param endTime end date/time of *run The- TaskIdNULL mayif bethe NULLconfigured ordefault theis requestedto taskbe id.used * In case it is* TaskId@param theparameterIds timeSubset seriesof isparmaters retrievedfor forwhich theto taskIdretrieve onlytimeseries. for simulated time series * @param locationIds InSubset caseof itlocations isfor NULLwhich timeto seriesretrieve fortimeseries. the current forecast will be* retreived @param ensembleId Id of the *ensemble * @param ensembleMemberIndex clientIdEnsemble Idmember ofindex webservicefor configurationthis thattime isseries. to(Only beif queriedconfigured) * @param@return id IdPiTimeseries ofxml the time series stringfile content. */ @param taskIdString TaskgetTimeSeries(String clientId, String id. Obtained using method {@link FewsPiService#createTask(String)} * @param startTime start date/time of run - NULL if the configured default is to be used * @param timeZero Forecast time zero., String taskId, Date startTime, Date timeZero, Date endTime, String[] parameterIds, String[] locationIds, String ensembleId, int ensembleMemberIndex); /** * Read the timeseries from the webservice. Returns a pi timeseries xml file * @paramcontaining endTimethe endtimeseries date/time of run - NULL ifheaders information. Retrieve the configuredtimeseries defaultdata isusing tothe be usedmethod * @param parameterIds Subset of parmaters for which to retrieve timeseries. {@link FewsPiService#getTimeSeriesBytes(String, String, String, java.util.Date, java.util.Date, java.util.Date, String[], String[], String, int)} * @param locationIds Subset of locations for which to retrieve timeseries.* <p> * @param ensembleId Id of If the ensemble id has been configured *for @paramthis ensembleMemberIndextimeseries Ensemble memberthen indexadd forthe this<i>ensembleMemberIndex</i> timeas seriesargument. (Only if configured)Otherwise * this @returnargument is PiTimeseriesskipped xmlby filethe contentwebservice. */ Use String getTimeSeries{@link FewsPiService#getEnsembleMemberIndices(String clientId, String)} id, String taskId, Date startTime,* Dateto timeZero,obtain Datevalid endTime, String[] parameterIds, String[] locationIds, String ensembleId, int ensembleMemberIndex); index values. * /** The TaskId may be *NULL Reador the timeseriesrequested fromtask the webservice. Returns a pi timeseries xml file * containing the timeseries headers information. Retrieve the timeseries data using the method * {@link FewsPiService#getTimeSeriesBytes(String, String, String, java.util.Date, java.util.Date, java.util.Date, String[], String[], String, int)}id. * In case it is TaskId the time series is retrieved for the taskId only for simulated time series * In case it is NULL time series for the current forecast will be retreived * * <p> * If the ensemble id has been configured for this timeseries then add the <i>ensembleMemberIndex</i> as argument. Otherwise @param clientId Id of webservice configuration that is to be queried * @param id Id of the time series string. * this@param argumenttaskId is skipped by the webservice. * UseTask id. Obtained using method {@link FewsPiService#getEnsembleMemberIndicesFewsPiService#createTask(String, String)} * @param tostartTime obtainstart validdate/time indexof values. run - NULL if the * configured default is to be *used The TaskId may be NULL* or@param thetimeZero requestedForecast tasktime idzero. * In case it* is@param TaskIdendTime theend date/time of seriesrun is- retrievedNULL forif the taskIdconfigured onlydefault for simulated time series * In case it is NULL time series for the current forecast will be retreived *is to be used * @param parameterIds Subset of parmaters for which to retrieve timeseries. * @param clientIdlocationIds IdSubset of webservicelocations configurationfor that iswhich to beretrieve queriedtimeseries. * @param idensembleId Id of the ensemble * @param ensembleMemberIndex Ensemble member index for this time series string.. (Only if configured) * @return @param taskIdPiTimeseries xml Taskfile idcontent. Obtained using method {@link FewsPiService#createTask(String)} * @param startTime start date/time of run - NULL if the configured default is to be used */ String getTimeSeriesHeaders(String clientId, String id, String taskId, Date startTime, Date timeZero, Date endTime, String[] parameterIds, String[] locationIds, String ensembleId, int ensembleMemberIndex); /** * @param timeZero Forecast time* zero. Read the timeseries data from *the @paramwebservice. endTimeReturns endthe date/timedata ofbelonging runto -the NULL if the configured default* istimeseries tothat beare used retrieved when the method * @param parameterIds Subset of parmaters for which to retrieve timeseries.{@link FewsPiService#getTimeSeriesBytes(String, String, String, java.util.Date, java.util.Date, java.util.Date, String[], String[], String, int)} * @paramis locationIdscalled Subsetusing ofthe locations for which to retrieve timeseriessame arguments. * @param ensembleId Id of the* ensemble<p> * @paramIf ensembleMemberIndexthe Ensembleensemble memberid index for this time series. (Only if configured) * @return PiTimeseries xml file content.has been configured for this timeseries then add the <i>ensembleMemberIndex</i> as argument. Otherwise */ this argument is Stringskipped getTimeSeriesHeaders(String clientId, String id, String taskId, Date startTime, Date timeZero, Date endTime, String[] parameterIds, String[] locationIds, String ensembleId, int ensembleMemberIndex); /**by the webservice. * Use {@link FewsPiService#getEnsembleMemberIndices(String, String)} * to obtain valid index values. * Read the timeseries data from* theThe webservice.TaskId Returnsmay thebe dataNULL belonging toor the requested task id. * timeseriesIn thatcase areit retrievedis whenTaskId the methodtime series {@link FewsPiService#getTimeSeriesBytes(String, String, String, java.util.Date, java.util.Date, java.util.Date, String[], String[], String, int)} * is called using the same arguments.is retrieved for the taskId only for simulated time series * In case it is NULL time series for the current forecast will be retreived * * <p> @param clientId Id of webservice * If the ensemble id has been configured for this timeseries then add the <i>ensembleMemberIndex</i> as argument. Otherwiseconfiguration that is to be queried * @param id Id of the time series string. * this@param argumenttaskId is skipped by the webservice. * UseTask id. Obtained using method {@link FewsPiService#getEnsembleMemberIndicesFewsPiService#createTask(String, String)} * to@param startTime obtainstart validdate/time indexof values. run - NULL if the * configured default is to be *used The TaskId may be NULL* or@param thetimeZero requestedForecast tasktime idzero. * In case it* is@param TaskIdendTime theend date/time of seriesrun is- retrievedNULL forif the taskIdconfigured onlydefault foris simulatedto timebe seriesused * In case it is* NULL@param timeparameterIds seriesSubset forof theparmaters currentfor forecastwhich willto be retreived *retrieve timeseries. * @param clientIdlocationIds IdSubset of webservicelocations configurationfor that iswhich to beretrieve queriedtimeseries. * @param idensembleId Id of the time series string. ensemble * @param taskIdensembleMemberIndex Ensemble Taskmember id.index Obtainedfor usingthis methodtime {@linkseries. FewsPiService#createTask(StringOnly if configured)} * @param@return startTime startPiTimeseries date/timexml offile runcontent. - NULL if the configured default is to be used */ * @param timeZero Forecast time zero. * @param endTime end date/time of run - NULL if the configured default is to be usedbyte[] getTimeSeriesBytes(String clientId, String id, String taskId, Date startTime, Date timeZero, Date endTime, String[] parameterIds, String[] locationIds, String ensembleId, int ensembleMemberIndex); /** * @paramget parameterIdsa Subsetlog ofmessage parmatersassociated forto whicha to retrieve timeseries.specified taskId * @param locationIdsclientId SubsetId of locationsweb forservice whichclient to(obtained retrieveon timeseries. command line * @param ensembleId Id of the ensemblewhen invoked) * @param ensembleMemberIndextaskId Ensemble memberTask indexid. forObtained thisusing timemethod series.{@link FewsPiService#createTask(Only if configuredString)} * @return PiDiagnostics PiTimeseries xmlXML file content. */ byte[] getTimeSeriesBytes(String clientId, String id, String taskId, Date startTime, Date timeZero, Date endTime, String[] parameterIds, String[] locationIds, String ensembleId, int ensembleMemberIndex); /** * get a log message associated to a specified taskId * @param clientId Id of web service client (obtained on command line when invoked) * @param taskId Task id. Obtained using method {@link FewsPiService#createTask(String)} * @return PiDiagnostics XML file content. */ String getLogMessages(String clientId, String taskId); } |
FewsPiServiceConfig XSD
...
String getLogMessages(String clientId, String taskId);
}
|
FewsPiServiceConfig XSD
Example of the FewsPiServiceConfig schema file.
Running Delft-FEWS in the background
When you use the PI service it is not necessary to have the main window displayed or anyone
operating the program at all. Under Windows, there is always a monitor, but on Linux machines
this may not be the case, especially with server machines.
To start Delft-FEWS in the background on Linux with no window present, use the following
recipe:
- Start the X virtual framebuffer server, Xvfb
- Set the DISPLAY environment variable to point to that display
- Start FEWS in the background
This way no window will be visible and no monitor will be needed. A small shell script
will take care of the details:
No Format |
---|
#
# Start the Xvfb server using screen "1" (to avoid issues with a possibly running X server)
Xvfb :1
#
# Set the DISPLAY environment variable so that FEWS will use the Xvfb server
#
export DISPLAY=:1.0
#
# Start FEWS (standalone or operator client) in the background
#
bin/fews.sh REGION
|