001    package org.hackystat.telemetry.analyzer.configuration;
002    
003    import java.util.Collection;
004    import java.util.List;
005    
006    import org.hackystat.sensorbase.resource.users.jaxb.User;
007    import org.hackystat.telemetry.analyzer.configuration.jaxb.TelemetryDefinition;
008    
009    /**
010     * Provides the base class associated with the persistent and non-persistent
011     * Telemetry definition managers.
012     * 
013     * @author (Cedric) Qin Zhang
014     */
015    public abstract class TelemetryDefinitionManager {
016      
017      /**
018       * Gets the telemetry definition information by name.
019       * 
020       * @param owner The owner under which to find the telemetry definition object.
021       * @param name The name of the telemetry definition.
022       * @param includeShared If true, then those telemetry definitions owned by other users, 
023       *        but is shared will also be returned.
024       * @param type The definition type.
025       * 
026       * @return The object if found, or null.
027       */
028      public abstract TelemetryDefinitionInfo get(
029          User owner, String name, boolean includeShared, TelemetryDefinitionType type);
030      
031      /**
032       * Gets all telemetry definitions that this user has access to.
033       * 
034       * @param owner The owner of the telemetry definitions returned.
035       * @param includeShared If true, then those telemetry definitions owned by
036       *        other users, but is shared will also be returned.
037       * @param type The definition type.
038       *       
039       * @return A collection of found objects.
040       */
041      public abstract Collection<TelemetryDefinitionInfo> getAll(User owner, boolean includeShared, 
042          TelemetryDefinitionType  type);
043      
044      /**
045       * Adds information about a definition.
046       * 
047       * @param defInfo Information about the definition to be added.
048       * 
049       * @throws TelemetryConfigurationException If there is duplicated definition.
050       */
051      public abstract void add(TelemetryDefinitionInfo defInfo) 
052          throws TelemetryConfigurationException;
053      
054      /**
055       * Returns the list of TelemetryDefinitions associated with this manager.
056       * @return The list of telemetry definitions.
057       */
058      public abstract List<TelemetryDefinition> getDefinitions();
059    
060      /**
061       * Deletes a telemetry object definition. Does nothing if the definition does not exist.
062       * 
063       * @param owner The owner of the definition.
064       * @param name The name of the definition.
065       * @param type The definition type.
066       */
067      public abstract void remove(User owner, String name, TelemetryDefinitionType  type);
068    }