org.gcube.accounting.ut
Class UsageTrackerRestAPI

java.lang.Object
  extended by org.gcube.accounting.ut.UsageTrackerRestAPI

public class UsageTrackerRestAPI
extends Object

A client-side class for accessing the Usage Tracker

Author:
Paolo Fabriani, Ermanno Travaglino

Constructor Summary
UsageTrackerRestAPI(String uri)
           
 
Method Summary
 void clear()
          Deprecated. this operation is for development/testing purposes only. It will be removed in future releases
 void deleteUsageRecord(org.gcube.accounting.datamodel.UsageRecord record)
           
 FilterRating getFilterRating(Report r)
           
 long getNumberOfRecords(String query)
          Return the number of the usage records matching the given query
 Collection<AggregatedResult> getReport(Report r)
           
 Collection<Consumer> getTrackedConsumers()
           
 Collection<ResourceScope> getTrackedResourceScopes()
           
 Collection<ResourceType> getTrackedResourceTypes()
           
 Collection<UpdateInfo> getUpdateInfo()
          Query the Usage Tracker for update information from each infrastructure (resource owner)
 Collection<org.gcube.accounting.datamodel.UsageRecord> getUsageRecords(String query)
          Return the usage records matching the given query and aggregation fields for sorting/pagination purposes Example: resourceType=job&resourceScope=testing&sortField=startTime&paginationStartPage=1&paginationRecords=6 Aggregation fields ====================== sortField : field on which you want to order the results sortOrder : sort criteria (asc/desc) paginationStartRecord : start record of the pagination paginationRecords : number of records per page
 Collection<User> getUsers()
          Deprecated. this operation is for development/testing purposes only. It will be removed in future releases
 void insertUsageRecord(org.gcube.accounting.datamodel.AbstractDelegateUsageRecord ur)
          Insert the new given usage record
 void insertUsageRecord(org.gcube.accounting.datamodel.RawUsageRecord ur)
          Insert the given storage-specific usage record
 void insertUsageRecord(org.gcube.accounting.datamodel.UsageRecord ur)
          Insert the new given usage record
 void insertUsageRecords(Collection<org.gcube.accounting.datamodel.UsageRecord> records)
          Insert a set of usage records
static void main(String[] args)
           
static GregorianCalendar randomDate()
           
 void setUserToken(String username, String password)
           
 void setUserToken(String username, String password, String delegator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsageTrackerRestAPI

public UsageTrackerRestAPI(String uri)
Parameters:
uri - the URI of the Usage Tracker
Method Detail

insertUsageRecords

public void insertUsageRecords(Collection<org.gcube.accounting.datamodel.UsageRecord> records)
Insert a set of usage records

Parameters:
records -

insertUsageRecord

public void insertUsageRecord(org.gcube.accounting.datamodel.UsageRecord ur)
Insert the new given usage record

Parameters:
ur -

insertUsageRecord

public void insertUsageRecord(org.gcube.accounting.datamodel.AbstractDelegateUsageRecord ur)
Insert the new given usage record

Parameters:
ur -

insertUsageRecord

public void insertUsageRecord(org.gcube.accounting.datamodel.RawUsageRecord ur)
Insert the given storage-specific usage record

Parameters:
ur -

getUsageRecords

public Collection<org.gcube.accounting.datamodel.UsageRecord> getUsageRecords(String query)
Return the usage records matching the given query and aggregation fields for sorting/pagination purposes Example: resourceType=job&resourceScope=testing&sortField=startTime&paginationStartPage=1&paginationRecords=6 Aggregation fields ====================== sortField : field on which you want to order the results sortOrder : sort criteria (asc/desc) paginationStartRecord : start record of the pagination paginationRecords : number of records per page

Parameters:
query - must have the form: name=value&name>value&kname=value&...
Returns:

getUpdateInfo

public Collection<UpdateInfo> getUpdateInfo()
Query the Usage Tracker for update information from each infrastructure (resource owner)

Returns:

getUsers

public Collection<User> getUsers()
Deprecated. this operation is for development/testing purposes only. It will be removed in future releases

Return the list of users with an associated usage record

Returns:

getTrackedConsumers

public Collection<Consumer> getTrackedConsumers()

getTrackedResourceTypes

public Collection<ResourceType> getTrackedResourceTypes()

getTrackedResourceScopes

public Collection<ResourceScope> getTrackedResourceScopes()

getNumberOfRecords

public long getNumberOfRecords(String query)
Return the number of the usage records matching the given query

Parameters:
query -
Returns:

clear

public void clear()
Deprecated. this operation is for development/testing purposes only. It will be removed in future releases

Remove all elements in the Usage Tracker


deleteUsageRecord

public void deleteUsageRecord(org.gcube.accounting.datamodel.UsageRecord record)

setUserToken

public void setUserToken(String username,
                         String password)

setUserToken

public void setUserToken(String username,
                         String password,
                         String delegator)

getReport

public Collection<AggregatedResult> getReport(Report r)

getFilterRating

public FilterRating getFilterRating(Report r)

main

public static void main(String[] args)

randomDate

public static GregorianCalendar randomDate()


Copyright © 2013. All Rights Reserved.