Class SQLiteHistorian

    • Field Detail

      • FILE_PATH

        public static final Property<java.lang.String> FILE_PATH
    • Constructor Detail

      • SQLiteHistorian

        public SQLiteHistorian()
      • SQLiteHistorian

        public SQLiteHistorian​(java.lang.String filePath)
    • Method Detail

      • getProperty

        @Nullable
        public <T> T getProperty​(Property<T> prop)
        Description copied from interface: Historian
        Returns the configured or status property requested, or the default value if no further info is available. Most of these properties are defined in HistorianProperties.
        Specified by:
        getProperty in interface Historian
      • getTotalDataCount

        protected long getTotalDataCount()
      • getQueryStatus

        public Status getQueryStatus()
        Description copied from interface: Historian
        Returns the status of the storage system. If the system does not support querying, NotAvailable will be returned.
        Specified by:
        getQueryStatus in interface Historian
      • getStorageStatus

        public Status getStorageStatus()
        Description copied from interface: Historian
        Returns the status of the storage system. If the system does not support storage, NotAvailable will be returned. If this is the case, calls to createStorageSession will fail.
        Specified by:
        getStorageStatus in interface Historian
      • getConnection

        protected java.sql.Connection getConnection()
                                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • initDriver

        public void initDriver()
                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • initialize

        public void initialize​(PropertySet properties)
                        throws java.lang.Exception
        Specified by:
        initialize in interface Historian
        Throws:
        java.lang.Exception
      • register

        public void register​(java.lang.String tagPath,
                             PropertySet properties)
                      throws java.lang.Exception
        Description copied from interface: Historian
        Provides information about a path. May be called before or after values have been stored, will replace any previous information stored for a path. The property values are usually defined in HistorianProperties.
        Specified by:
        register in interface Historian
        Throws:
        java.lang.Exception
      • unregister

        public void unregister​(java.lang.String tagPath)
                        throws java.lang.Exception
        Specified by:
        unregister in interface Historian
        Throws:
        java.lang.Exception
      • createTag

        protected SQLiteHistorian.Tag createTag​(java.sql.Connection c,
                                                java.lang.String tagPath)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createTag

        protected SQLiteHistorian.Tag createTag​(java.lang.String tagPath)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createStorageSession

        public StorageSession createStorageSession()
                                            throws java.lang.Exception
        Description copied from interface: Historian
        Used to store values to the historian. Should be used for the immediate set of values and then closed. It should not be held open for longer than necessary.

        It implements AutoClosable, and should often be used in a try-with-resources block, such as:
        try(StorageSession s = historian.createStorageSession()){ s.store... }

        Important: Not every historian will support storage, some are read-only. This can be checked by calling getStorageStatus() and checking the return for "NotSupported".

        Specified by:
        createStorageSession in interface Historian
        Throws:
        java.lang.Exception
      • browse

        public java.util.List<java.lang.String> browse​(java.util.Optional<java.lang.String> filter)
        Description copied from interface: Historian
        Returns a list of paths with data stored, optionally matching a filter.
        Specified by:
        browse in interface Historian
        Parameters:
        filter - a wildcard ("Tag*") based string that will be used to filter tags. If empty, all paths will be returned.
      • delete

        public void delete​(java.util.List<java.lang.String> paths)
        Description copied from interface: Historian
        Deletes the tags and all data for the specified paths. Paths may be wildcards using "*". Only expected to work if the historian supports storage, as indicated by getStorageStatus().
        Specified by:
        delete in interface Historian
      • query

        public QueryResult query​(java.util.List<java.lang.String> tags,
                                 long startTime,
                                 long endTime,
                                 boolean includeBounding)
        Description copied from interface: Historian
        Queries the values for the given paths over the specified span of time. The implementation will conform to the following rules:
        1. If endTime is less than start time, results MAY be provided latest first. If that is not possible, the parameters will be swapped and values returned as normal.
        2. The result will have a unique PathInfo item for EACH of the paths passed in. If a path is specified multiple times, it will be returned multiple times.
        3. If a path is not valid, the query result will return ONE DataPoint for the query start time with a quality of 404 (NOT FOUND)
        4. The timestamps for a given path will be ascending, though between paths they may not be.
        Specified by:
        query in interface Historian
        includeBounding - if true, the closest value previous to the start time will be returned, as well as the closest value following the end time.
      • executeMaintenance

        public void executeMaintenance()
      • initializeSync

        protected void initializeSync()
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • sync

        public java.util.List<HistoricalData> sync​(long syncId)
        Description copied from interface: HistorianSyncSource
        This returns a set of data- it's up to the implementation to decide what makes sense. If the caller wants more data, it can just call again.
        Specified by:
        sync in interface HistorianSyncSource
        Parameters:
        syncId - if 0, returns next set of available data based on last query. Otherwise, starts at the given time period.
      • getSyncableTagData

        public HistoricalData getSyncableTagData​(long syncId)
      • getSyncableAnnotations

        public HistoricalData getSyncableAnnotations​(long syncId)
      • getSyncableRetiredTags

        public HistoricalData getSyncableRetiredTags​(long syncId)
      • transformToHistoricalPath

        public QualifiedPath transformToHistoricalPath​(java.lang.String tagPath)
      • newSyncId

        protected void newSyncId()
      • getStorageSyncId

        protected int getStorageSyncId()
      • getSyncableCount

        public int getSyncableCount​(long syncId)
        Description copied from interface: HistorianSyncSource
        Returns the number of data points that could be synchronized from the given point.
        Specified by:
        getSyncableCount in interface HistorianSyncSource