Class StorageReadHelper

  • All Implemented Interfaces:
    StorageRead

    public class StorageReadHelper
    extends java.lang.Object
    implements StorageRead
    Wraps and adds some utility methods to a StorageRead implementation.
    Author:
    Bruno Dillenseger, Tomas Perez Segovia
    • Constructor Summary

      Constructors 
      Constructor Description
      StorageReadHelper​(StorageRead backend)
      Creates a new front-end on top of the provided StorageRead back-end implementation, providing extra utility methods.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeEventIterator​(java.io.Serializable iteratorKey)
      Discards the iterator associated to the given key, possibly releasing resources.
      long countEvents​(java.lang.String testName, java.lang.String bladeId, java.lang.String eventTypeLabel, EventFilter filter)
      Counts the number of available events matching a given filter.
      java.lang.Object[][] getAllFieldsValues​(java.lang.String testName, java.lang.String bladeId, java.lang.String eventTypeLabel, java.lang.String xFieldLabel, java.lang.String yFieldLabel, int start, int end, int count)  
      BladeEvent[] getBladeEvents​(java.lang.String testName, java.lang.String bladeId, java.lang.String eventTypeLabel, java.lang.Object object)  
      java.lang.Object[][] getBladeEventsValues​(BladeEvent[] bladeEventList, java.lang.String xFieldLabel, java.lang.String yFieldLabel)  
      java.util.List<BladeEvent> getBladeOneEventValues​(java.lang.String testName, java.lang.String bladeId, java.lang.String eventTypeLabel)  
      java.util.Properties getBladeProperties​(java.lang.String testName, java.lang.String bladeId)
      Gets the java system properties for the given blade from the given test run
      java.util.SortedSet<java.lang.String> getBladesIds​(java.lang.String testName)  
      java.lang.String[] getEventFieldLabels​(java.lang.String testName, java.lang.String bladeId, java.lang.String eventTypeLabel)
      Gets the labels of fields hold by a given event type.
      java.io.Serializable getEventIterator​(java.lang.String testName, java.lang.String bladeId, java.lang.String eventTypeLabel, EventFilter filter)
      Creates an event iterator.
      BladeEvent[] getEvents​(java.lang.String testName, java.lang.String bladeId, java.lang.String eventTypeLabel, EventFilter filter, long fromIndex, int count)
      Retrieves a given number of events matching a given filter, from a given index.
      java.util.SortedSet<java.lang.String> getEventsTypeLabels​(java.lang.String testName, java.lang.String bladeId)  
      long getLifecycleCompleted​(java.lang.String testName, java.lang.String bladeId)  
      long getLifecycleRunning​(java.lang.String testName, java.lang.String bladeId)  
      long getMaxTimeFor​(java.lang.String testName, java.lang.String bladeId)  
      long getMinTimeFor​(java.lang.String testName, java.lang.String bladeId)  
      BladeEvent[] getNextEvents​(java.io.Serializable iteratorKey, int count)
      Gets next events from the given event iterator.
      BladeDescriptor[] getTestPlan​(java.lang.String testName, BladeFilter filter)
      Gets the test plan definition for a given test run name.
      TestDescriptor[] getTests​(TestFilter filter)
      Gets a list of test runs matching a given filter.
      java.util.SortedSet<java.lang.String> getTestsNames()
      Get the tests' names.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StorageReadHelper

        public StorageReadHelper​(StorageRead backend)
        Creates a new front-end on top of the provided StorageRead back-end implementation, providing extra utility methods.
        Parameters:
        backend -
    • Method Detail

      • getTestPlan

        public BladeDescriptor[] getTestPlan​(java.lang.String testName,
                                             BladeFilter filter)
                                      throws ClifException
        Description copied from interface: StorageRead
        Gets the test plan definition for a given test run name.
        Specified by:
        getTestPlan in interface StorageRead
        Parameters:
        testName - the test run name
        filter - retains only blades (injectors, probes) accepted by this filter. If null, all blades are retained.
        Returns:
        an array of descriptors for blades composing the test run and accepted by the optional filter.
        Throws:
        ClifException
      • getEventFieldLabels

        public java.lang.String[] getEventFieldLabels​(java.lang.String testName,
                                                      java.lang.String bladeId,
                                                      java.lang.String eventTypeLabel)
        Description copied from interface: StorageRead
        Gets the labels of fields hold by a given event type.
        Specified by:
        getEventFieldLabels in interface StorageRead
        Parameters:
        testName - the test run name
        bladeId - the blade identifier from the given test run
        eventTypeLabel - the label of the event type
        Returns:
        an array of event field labels provided by the given event type
      • getEventIterator

        public java.io.Serializable getEventIterator​(java.lang.String testName,
                                                     java.lang.String bladeId,
                                                     java.lang.String eventTypeLabel,
                                                     EventFilter filter)
                                              throws ClifException
        Description copied from interface: StorageRead
        Creates an event iterator.
        Specified by:
        getEventIterator in interface StorageRead
        Parameters:
        testName - the test name to retrieve events from
        bladeId - the blade identifier in this test to retrieve events from
        eventTypeLabel - the type label of the retrieved events
        filter - the filter object to be used for event selection. If null, the iterator will return all events. The filter object may throw a NoMoreEvent exception, in which case current iterator step stops and currently selected events are returned.
        Returns:
        the iterator key to be used to iterate on getting events, and then to discard the iterator when done
        Throws:
        ClifException - the given test, blade, or event type could not be found
        See Also:
        StorageRead.getNextEvents(Serializable, int), StorageRead.closeEventIterator(Serializable)
      • closeEventIterator

        public void closeEventIterator​(java.io.Serializable iteratorKey)
        Description copied from interface: StorageRead
        Discards the iterator associated to the given key, possibly releasing resources.
        Specified by:
        closeEventIterator in interface StorageRead
        Parameters:
        iteratorKey - the key for the target event iterator
      • getEvents

        public BladeEvent[] getEvents​(java.lang.String testName,
                                      java.lang.String bladeId,
                                      java.lang.String eventTypeLabel,
                                      EventFilter filter,
                                      long fromIndex,
                                      int count)
                               throws ClifException
        Description copied from interface: StorageRead
        Retrieves a given number of events matching a given filter, from a given index.
        Specified by:
        getEvents in interface StorageRead
        Parameters:
        testName - the test name to retrieve events from
        bladeId - the blade identifier in this test to retrieve events from
        eventTypeLabel - the type label of the retrieved events
        filter - the filter object to be used for event selection. If null, all events are selected. If the filter throws a NoMoreEvent exception, the selection process stops, and currently selected events are returned.
        fromIndex - the index of the first event to be considered (in other words, events in range 0..fromIndex-1 are ignored). If negative and count parameter is greater than zero, then the latest events will be retrieved.
        count - the maximum number of events to retrieve. If negative, the number of retrieved events is not limited.
        Returns:
        selected blade events
        Throws:
        ClifException
      • countEvents

        public long countEvents​(java.lang.String testName,
                                java.lang.String bladeId,
                                java.lang.String eventTypeLabel,
                                EventFilter filter)
                         throws ClifException
        Description copied from interface: StorageRead
        Counts the number of available events matching a given filter.
        Specified by:
        countEvents in interface StorageRead
        Parameters:
        testName - the test name to retrieve events from
        bladeId - the blade identifier in this test to retrieve events from
        eventTypeLabel - the type label of the retrieved events
        filter - the filter object to be used for event selection. If null, all events are counted. Counting stops before completion if the filter object throws a NoMoreEvent exception, in which case count value before exception is returned.
        Returns:
        the number of available blade events matching the provided filter.
        Throws:
        ClifException
      • getTestsNames

        public java.util.SortedSet<java.lang.String> getTestsNames()
        Get the tests' names.
        Returns:
        an array that contains the tests' names
      • getBladesIds

        public java.util.SortedSet<java.lang.String> getBladesIds​(java.lang.String testName)
      • getBladeEventsValues

        public java.lang.Object[][] getBladeEventsValues​(BladeEvent[] bladeEventList,
                                                         java.lang.String xFieldLabel,
                                                         java.lang.String yFieldLabel)
      • getBladeEvents

        public BladeEvent[] getBladeEvents​(java.lang.String testName,
                                           java.lang.String bladeId,
                                           java.lang.String eventTypeLabel,
                                           java.lang.Object object)
      • getLifecycleCompleted

        public long getLifecycleCompleted​(java.lang.String testName,
                                          java.lang.String bladeId)
      • getLifecycleRunning

        public long getLifecycleRunning​(java.lang.String testName,
                                        java.lang.String bladeId)
      • getAllFieldsValues

        public java.lang.Object[][] getAllFieldsValues​(java.lang.String testName,
                                                       java.lang.String bladeId,
                                                       java.lang.String eventTypeLabel,
                                                       java.lang.String xFieldLabel,
                                                       java.lang.String yFieldLabel,
                                                       int start,
                                                       int end,
                                                       int count)
      • getEventsTypeLabels

        public java.util.SortedSet<java.lang.String> getEventsTypeLabels​(java.lang.String testName,
                                                                         java.lang.String bladeId)
      • getMinTimeFor

        public long getMinTimeFor​(java.lang.String testName,
                                  java.lang.String bladeId)
      • getMaxTimeFor

        public long getMaxTimeFor​(java.lang.String testName,
                                  java.lang.String bladeId)
      • getBladeOneEventValues

        public java.util.List<BladeEvent> getBladeOneEventValues​(java.lang.String testName,
                                                                 java.lang.String bladeId,
                                                                 java.lang.String eventTypeLabel)