Time Series Management

From Gcube Wiki
Revision as of 17:31, 26 June 2012 by Lucio.lelii (Talk | contribs) (How To Access TimeSeries data)

Jump to: navigation, search

Time Series Management and Analysis facilities.


Overview

The TimeSeriesManagerService is an application that offers facilities to import, curate and access time series data. The main goal of this service is to elaborate large amount of time series data in real time applying multiple operations: aggregation, union, grouping, filters etc.

Architecture

The interface of the TimeSeries Manager service is distributed across 6 port-types:

  • the ImportFactory port-type serves as the interface of a single WS-Resource, it allows clients to create new import resources (ImportManager instances).
  • the ImportManager port-type allows clients to import new time series offering operations like import, de-normalization etc.
  • the CurationFactory port-type serves as the interface of a single WS-Resource, it allows clients to create new curation resources (CurationManager instances).
  • the CurationManager port-type allows clients to curate time series offering operations like set column type, replace value etc.
  • the TimeSeriesFactory port-type serves as the interface of a single WS-Resource, it allows clients to create new time series resources (TimeSeriesManager instances).
  • the TimeSeriesManager port-type allows clients to operate on time series offering operations like union, grouping, aggregation etc.

How To Access TimeSeries data

TimeSeries offers an high-level library for interaction included in the TimeSeriesServiceStubs. This library offers facilities for service retrieving simply instantiating a TimeSeriesFactoryCall Object passing as argument a GCUBEScope and a SecurityManager Array.

GCUBEScope scope= ..some scope..
//running without security
GCUBESecurityManager secMan= new GCUBESecurityManagerImpl(){
 			@Override
			public boolean isSecurityEnabled() {
				return false;
			}
 
		};
 
TimeSeriesFactoryCall timeSeriesFactoryCall= new TimeSeriesFactoryCall(scope, new GCUBESecurityManager[]{secMan});

The TimeSeriesFactoryCall offers facilities to retrieve information about time series or to open a certain time series giving it a specific id.

...
TimeSeriesFactoryCall timeSeriesFactoryCall= new TimeSeriesFactoryCall(scope, new GCUBESecurityManager[]{secMan});
String user = ..some user..
//getting the list of timeseries by ownertimeSeriesFactoryCall.getUserRelatedTimeSeries(user);
//getting the list of published timeseries
timeSeriesFactoryCall.getPublishedTimeSeries();
 
//retrieving the EPR to interact with a  timeseries
String timeSeriesId= ..id..
EndpointReferenceType timeSeriesEPR = timeSeriesFactoryCall.open(timeSeriesId, user);


Once the EPR for the TimeSeries has been retrieved the client can interact directly with the TimeSeriesManager port-type to retrieve information about column definition and the contained data.

TimeSeriesServiceCall timeSeriesServiceCall = new TimeSeriesServiceCall(user, timeSeriesEPR , scope , secMan);
 
//retrieving the column definitions
ColumnDefinition[] columns =timeSeriesServiceCall.getDimensions();for (ColumnDefinition column: columns){
        EntryType type = column.getColumnType(); //returns the entry type of this column (Attribute, Dimension, Value)
        String fieldId = column.getId(); //returns the id of this column (the name of this column in the db)
        String label = column.getLabel(); //returns the user defined name for this column
        Dimension dimension = column.getDimension(); //in case of dimension entry type it return the informations about the related codelist (id, name) otherwise it is null
}
 
//retrieving data (order can be null only if the default order is required)
String jsonData= timeSeriesServiceCall.getAllDataAsJSon(new Limit(0, 1000), new Order(columnId, OrderType.Descending));
//json data contains the field id of every column and the related value