Interface DatabaseHandlerI

  • All Known Implementing Classes:
    DatabaseHandlerImpl

    public interface DatabaseHandlerI
    Interface to manage database operations of the Framework.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addComplianceConfig​(java.lang.String thingId, java.lang.String ruleName, java.lang.String deviceProperty, java.lang.String ruleCondition, int duration, java.lang.String ruleValue, java.lang.String pollingType)
      Add compliance configuration.
      void addComplianceProperty​(java.lang.String thingId, java.lang.String property, java.lang.String value, java.lang.String type)
      Add compliance property data.
      void addEvent​(java.lang.String requestId, java.lang.String data)
      Add a compliance event.
      void addJobXML​(java.lang.String thingId, java.lang.String jobXML)
      Add JobXML.
      void addOrUpdateCompianceProperty​(java.lang.String thingId, java.lang.String property, java.lang.String value, java.lang.String type)
      Add or update compliance property data.
      void addOrUpdateComplianceConfig​(java.lang.String thingId, java.lang.String ruleName, java.lang.String deviceProperty, java.lang.String ruleCondition, int duration, java.lang.String ruleValue, java.lang.String pollingType)
      Add or update compliance configuration based on existence.
      void addOrUpdateJobXML​(java.lang.String thingId, java.lang.String jobXML)
      Add or update JobXML.
      boolean cleanDB​(java.lang.String thingId, java.util.List<java.lang.String> properties)
      Clean compliance DB data based on intersection of current and old compliance job.
      void deleteCompliance​(java.lang.String thingId)
      Delete compliance for a thing.
      boolean deleteComplianceConfig​(java.lang.String thingId, java.lang.String property)
      Delete compliance configuration for a property.
      boolean deleteComplianceProperty​(java.lang.String thingId, java.lang.String property)
      Delete compliance data for a property.
      void deleteEvent​(java.lang.String requestId)
      Delete a compliance event.
      void deleteJobXML​(java.lang.String thingId)
      Delete JobXML.
      org.json.JSONObject getAllConfig()
      Get compliance configuration for all properties.
      org.json.JSONObject getAllEvents()
      Get all compliance events.
      org.json.JSONObject getAllPendingEvents()
      Get all pending compliance events.
      org.json.JSONArray getComplianceProperties()
      Get all compliance properties data.
      org.json.JSONObject getConfigForProperty​(java.lang.String thingId, java.lang.String property)
      Get compliance configuration for a property.
      java.util.List<java.lang.String> getConfigPropertyNames​(java.lang.String thingId, boolean onlyNormalPoll)
      List of compliance configured properties.
      java.lang.String getJobXML​(java.lang.String thingId)
      Get JobXML.
      java.util.List<java.lang.String> getThingIDs()
      List of thingIds on which the compliance is configured.
      boolean isCompliancePropertyExists​(java.lang.String thingId, java.lang.String property)
      Check if compliance data of a property exists.
      void setCompliance​(java.lang.String thingId, java.lang.String property, int isCompliant, long complianceTime)
      Set compliance status of a property.
      void setNixNotify​(java.lang.String requestId, int nixNotified, int notifyCount)
      Set nix notify status of a property.
      void updateComplianceConfig​(java.lang.String thingId, java.lang.String ruleName, java.lang.String deviceProperty, java.lang.String ruleCondition, int duration, java.lang.String ruleValue, java.lang.String pollingType)
      Update compliance configuration based on existence.
      void updateComplianceProperty​(java.lang.String thingId, java.lang.String property, java.lang.String value)
      Update compliance property data.
      void updateJobXML​(java.lang.String thingId, java.lang.String jobXML)
      Update JobXML.
    • Method Detail

      • addOrUpdateComplianceConfig

        void addOrUpdateComplianceConfig​(java.lang.String thingId,
                                         java.lang.String ruleName,
                                         java.lang.String deviceProperty,
                                         java.lang.String ruleCondition,
                                         int duration,
                                         java.lang.String ruleValue,
                                         java.lang.String pollingType)
        Add or update compliance configuration based on existence.
        Parameters:
        thingId - Id of the thing.
        ruleName - Name of the rule.
        deviceProperty - Compliance configured property.
        ruleCondition - Condition to decide compliance.
        duration - Duration till which the property should stay out of compliance to decide it as the later.
        ruleValue - Threshold value.
        pollingType - Property polling type.
      • addComplianceConfig

        void addComplianceConfig​(java.lang.String thingId,
                                 java.lang.String ruleName,
                                 java.lang.String deviceProperty,
                                 java.lang.String ruleCondition,
                                 int duration,
                                 java.lang.String ruleValue,
                                 java.lang.String pollingType)
        Add compliance configuration.
        Parameters:
        thingId - Id of the thing.
        ruleName - Name of the rule.
        deviceProperty - Compliance configured property.
        ruleCondition - Condition to decide compliance.
        duration - Duration till which the property should stay out of compliance to decide it as the later.
        ruleValue - Threshold value.
        pollingType - Property polling type.
      • updateComplianceConfig

        void updateComplianceConfig​(java.lang.String thingId,
                                    java.lang.String ruleName,
                                    java.lang.String deviceProperty,
                                    java.lang.String ruleCondition,
                                    int duration,
                                    java.lang.String ruleValue,
                                    java.lang.String pollingType)
        Update compliance configuration based on existence.
        Parameters:
        thingId - Id of the thing.
        ruleName - Name of the rule.
        deviceProperty - Compliance configured property.
        ruleCondition - Condition to decide compliance.
        duration - Duration till which the property should stay out of compliance to decide it as the later.
        ruleValue - Threshold value.
        pollingType - Property polling type.
      • cleanDB

        boolean cleanDB​(java.lang.String thingId,
                        java.util.List<java.lang.String> properties)
        Clean compliance DB data based on intersection of current and old compliance job.
        Parameters:
        thingId - Id of the thing.
        properties - List of current job properties.
        Returns:
        is cleanDB success.
      • getThingIDs

        java.util.List<java.lang.String> getThingIDs()
        List of thingIds on which the compliance is configured.
        Returns:
        List of thingIds.
      • getConfigPropertyNames

        java.util.List<java.lang.String> getConfigPropertyNames​(java.lang.String thingId,
                                                                boolean onlyNormalPoll)
        List of compliance configured properties.
        Parameters:
        thingId - Id of the thing.
        onlyNormalPoll - Property polling type.
        Returns:
        List of Property names.
      • addOrUpdateCompianceProperty

        void addOrUpdateCompianceProperty​(java.lang.String thingId,
                                          java.lang.String property,
                                          java.lang.String value,
                                          java.lang.String type)
        Add or update compliance property data.
        Parameters:
        thingId - Id of the thing.
        property - property name.
        value - Latest value of the property.
        type - Value type of the property.
      • addComplianceProperty

        void addComplianceProperty​(java.lang.String thingId,
                                   java.lang.String property,
                                   java.lang.String value,
                                   java.lang.String type)
        Add compliance property data.
        Parameters:
        thingId - Id of the thing.
        property - property name.
        value - Latest value of the property.
        type - Value type of the property.
      • updateComplianceProperty

        void updateComplianceProperty​(java.lang.String thingId,
                                      java.lang.String property,
                                      java.lang.String value)
        Update compliance property data.
        Parameters:
        thingId - Id of the thing.
        property - property name.
        value - Latest value of the property.
      • isCompliancePropertyExists

        boolean isCompliancePropertyExists​(java.lang.String thingId,
                                           java.lang.String property)
        Check if compliance data of a property exists.
        Parameters:
        thingId - Id of the thing.
        property - property name.
        Returns:
        true if compliance data of a property exists.
      • getComplianceProperties

        org.json.JSONArray getComplianceProperties()
        Get all compliance properties data.
        Returns:
        All compliance properties data.
      • getConfigForProperty

        org.json.JSONObject getConfigForProperty​(java.lang.String thingId,
                                                 java.lang.String property)
        Get compliance configuration for a property.
        Parameters:
        thingId - Id of the thing.
        property - property name.
        Returns:
        Compliance configuration for a property.
      • getAllConfig

        org.json.JSONObject getAllConfig()
        Get compliance configuration for all properties.
        Returns:
        Compliance configuration for all properties.
      • setCompliance

        void setCompliance​(java.lang.String thingId,
                           java.lang.String property,
                           int isCompliant,
                           long complianceTime)
        Set compliance status of a property.
        Parameters:
        thingId - Id of the thing.
        property - property name.
        isCompliant - compliant status.
        complianceTime - Time of compliance status change.
      • setNixNotify

        void setNixNotify​(java.lang.String requestId,
                          int nixNotified,
                          int notifyCount)
        Set nix notify status of a property.
        Parameters:
        requestId - requestId of event.
        nixNotified - Nix notified status.
        notifyCount - notify try count.
      • deleteCompliance

        void deleteCompliance​(java.lang.String thingId)
        Delete compliance for a thing.
        Parameters:
        thingId - thingId.
      • deleteComplianceConfig

        boolean deleteComplianceConfig​(java.lang.String thingId,
                                       java.lang.String property)
        Delete compliance configuration for a property.
        Parameters:
        thingId - thingId.
        property - compliance property.
        Returns:
        true if successful, false otherwise.
      • deleteComplianceProperty

        boolean deleteComplianceProperty​(java.lang.String thingId,
                                         java.lang.String property)
        Delete compliance data for a property.
        Parameters:
        thingId - thingId.
        property - compliance property.
        Returns:
        true if successful, false otherwise.
      • addEvent

        void addEvent​(java.lang.String requestId,
                      java.lang.String data)
        Add a compliance event.
        Parameters:
        requestId - Event requestId.
        data - Event data.
      • deleteEvent

        void deleteEvent​(java.lang.String requestId)
        Delete a compliance event.
        Parameters:
        requestId - Event requestId.
      • getAllPendingEvents

        org.json.JSONObject getAllPendingEvents()
        Get all pending compliance events.
        Returns:
        Pending events.
      • getAllEvents

        org.json.JSONObject getAllEvents()
        Get all compliance events.
        Returns:
        All compliance events.
      • addOrUpdateJobXML

        void addOrUpdateJobXML​(java.lang.String thingId,
                               java.lang.String jobXML)
        Add or update JobXML.
        Parameters:
        thingId - thingId.
        jobXML - jobXML.
      • addJobXML

        void addJobXML​(java.lang.String thingId,
                       java.lang.String jobXML)
        Add JobXML.
        Parameters:
        thingId - thingId.
        jobXML - jobXML.
      • updateJobXML

        void updateJobXML​(java.lang.String thingId,
                          java.lang.String jobXML)
        Update JobXML.
        Parameters:
        thingId - thingId.
        jobXML - jobXML.
      • getJobXML

        java.lang.String getJobXML​(java.lang.String thingId)
        Get JobXML.
        Parameters:
        thingId - thingId.
        Returns:
        jobXML.
      • deleteJobXML

        void deleteJobXML​(java.lang.String thingId)
        Delete JobXML.
        Parameters:
        thingId - thingId.