Class AbstractTagStore
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.sqltags.providers.AbstractTagStore
-
- All Implemented Interfaces:
TagConfigProvider
,TagStore
- Direct Known Subclasses:
DBTagStore
public abstract class AbstractTagStore extends java.lang.Object implements TagStore
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractTagStore.LegacyAlertInfo
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTagStore(java.lang.String managerName, GatewayContext context)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addConfigurationListener(TagStoreListener listener)
The configuration listener will be notified any time items are added or removed.protected PropertyValue
buildPropertyValue(java.lang.String propId, java.lang.Object value, int bindType, DataTypeClass fallbackType)
void
deleteTags(java.util.Collection<EntityId> tagIds)
Deletes the given tags from the store.protected java.lang.Object
executeScalar(java.sql.PreparedStatement stmt)
protected java.util.List<GeneralTagConfig<Tag,java.lang.String>>
flattenTags(TagPath parent, java.util.List<? extends Tag> tags)
protected java.lang.Long
getDBId(EntityId id)
Returns the long value contained in the entityid.protected int
getDeepTagCount(java.util.List<? extends Tag> tags)
Takes a set of tags and returns how many tags are contained below them.protected GatewayContext
getGatewayContext()
protected EntityId
getIdForMemberPath(EntityId parent, java.lang.String memberUid)
protected java.util.List<EntityId>
getIdsForMemberPaths(EntityId parent, java.util.Collection<java.lang.String> uids)
Returns a 1-to-1 list of ids for the passed in paths.java.lang.Exception
getLastError()
If isErrored() is TRUE, this should return the error that is causing that state.LoggerEx
getLogger()
java.lang.String
getManagerName()
protected DataType
getTypeForValueProp(PropertySet propSet)
Gets the data type for the value property stored in the provided property setprotected abstract void
internalDeleteTag(java.util.List<EntityId> tags, TaskProgressUpdater updater)
boolean
isErrored()
Returns whether or not the tag provider is running without error.protected void
notifyItemsAdded(java.util.Collection<TagStoreObject<TagConfig>> tags, java.util.Collection<TagStoreObject<ScanClass>> scanClasses)
protected void
notifyItemsRemoved(java.util.Collection<EntityId> tagIds, java.util.Collection<EntityId> scIds)
protected void
notifyPropertiesChanged(java.util.Collection<TagPropertyValue> properties)
protected void
registerUDTs(java.util.Map<EntityId,java.util.Map<java.lang.String,EntityId>> udtMap)
Registers new UDTs with the udt/eid cache, which maps from EntityId (for UDT) to map of Path/EntityId for member path to EID.void
removeConfigurationListener(TagStoreListener listener)
protected java.util.List<EntityId>
removeFromUidEidCache(java.util.Collection<EntityId> tagIds)
Goes through the tag ids, and removes them from the UDT/EID cache.protected void
setErrored(boolean isErrored, java.lang.Exception lastError)
void
updateStatMetrics(java.util.Map<java.lang.String,NamedValue<StatMetric>> statMetrics)
Allows tag stores to update StatMetrics for the provider status display.protected void
updateUdtEidCache(EntityId owner, java.lang.String memberUid, EntityId memberId)
The UDT EID cache is a structure containing EID mappings for UDT member items.protected void
updateUDTsForLoadedTags(java.util.List<TagStoreObject<TagConfig>> loaded)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.ignition.gateway.sqltags.model.tagstore.TagConfigProvider
getDefinition, getDefinitions, getProperty
-
Methods inherited from interface com.inductiveautomation.ignition.gateway.sqltags.model.tagstore.TagStore
addScanClasses, addTags, deleteScanClasses, modifyScanClass, modifyTagPaths, modifyTags, reloadTags, shutdown, startup, storeTagValues
-
-
-
-
Field Detail
-
log
protected LoggerEx log
-
-
Constructor Detail
-
AbstractTagStore
protected AbstractTagStore(java.lang.String managerName, GatewayContext context)
-
-
Method Detail
-
getLogger
public LoggerEx getLogger()
-
isErrored
public boolean isErrored()
Description copied from interface:TagStore
Returns whether or not the tag provider is running without error.
-
updateStatMetrics
public void updateStatMetrics(java.util.Map<java.lang.String,NamedValue<StatMetric>> statMetrics)
Description copied from interface:TagStore
Allows tag stores to update StatMetrics for the provider status display. The key of the named value describes the metric.- Specified by:
updateStatMetrics
in interfaceTagStore
-
getLastError
public java.lang.Exception getLastError()
Description copied from interface:TagStore
If isErrored() is TRUE, this should return the error that is causing that state.- Specified by:
getLastError
in interfaceTagStore
-
getManagerName
public java.lang.String getManagerName()
-
getGatewayContext
protected GatewayContext getGatewayContext()
-
addConfigurationListener
public void addConfigurationListener(TagStoreListener listener)
Description copied from interface:TagStore
The configuration listener will be notified any time items are added or removed. When first added, it will be called immediately with the current set of objects, unless startup has not been called. In that case, it will likely be called at startup.- Specified by:
addConfigurationListener
in interfaceTagStore
-
removeConfigurationListener
public void removeConfigurationListener(TagStoreListener listener)
- Specified by:
removeConfigurationListener
in interfaceTagStore
-
setErrored
protected void setErrored(boolean isErrored, java.lang.Exception lastError)
-
getDBId
protected java.lang.Long getDBId(EntityId id)
Returns the long value contained in the entityid. Handles override ids as well.
-
updateUdtEidCache
protected void updateUdtEidCache(EntityId owner, java.lang.String memberUid, EntityId memberId)
The UDT EID cache is a structure containing EID mappings for UDT member items. This function updates the specified member under the given owner.
-
updateUDTsForLoadedTags
protected void updateUDTsForLoadedTags(java.util.List<TagStoreObject<TagConfig>> loaded)
-
registerUDTs
protected void registerUDTs(java.util.Map<EntityId,java.util.Map<java.lang.String,EntityId>> udtMap)
Registers new UDTs with the udt/eid cache, which maps from EntityId (for UDT) to map of Path/EntityId for member path to EID.
-
removeFromUidEidCache
protected java.util.List<EntityId> removeFromUidEidCache(java.util.Collection<EntityId> tagIds)
Goes through the tag ids, and removes them from the UDT/EID cache. Returns the full list of all member EIDs, in addition to the complex tag's id.
-
getIdForMemberPath
protected EntityId getIdForMemberPath(EntityId parent, java.lang.String memberUid)
-
getIdsForMemberPaths
protected java.util.List<EntityId> getIdsForMemberPaths(EntityId parent, java.util.Collection<java.lang.String> uids)
Returns a 1-to-1 list of ids for the passed in paths. A id will be null if the member doesn't exist.
-
notifyItemsAdded
protected void notifyItemsAdded(java.util.Collection<TagStoreObject<TagConfig>> tags, java.util.Collection<TagStoreObject<ScanClass>> scanClasses)
-
notifyItemsRemoved
protected void notifyItemsRemoved(java.util.Collection<EntityId> tagIds, java.util.Collection<EntityId> scIds)
-
notifyPropertiesChanged
protected void notifyPropertiesChanged(java.util.Collection<TagPropertyValue> properties)
-
getDeepTagCount
protected int getDeepTagCount(java.util.List<? extends Tag> tags)
Takes a set of tags and returns how many tags are contained below them. Includes folders and top level tags.
-
flattenTags
protected java.util.List<GeneralTagConfig<Tag,java.lang.String>> flattenTags(TagPath parent, java.util.List<? extends Tag> tags)
-
deleteTags
public void deleteTags(java.util.Collection<EntityId> tagIds) throws java.lang.Exception
Description copied from interface:TagStore
Deletes the given tags from the store. Will result in the itemsRemoved notification.- Specified by:
deleteTags
in interfaceTagStore
- Throws:
java.lang.Exception
-
internalDeleteTag
protected abstract void internalDeleteTag(java.util.List<EntityId> tags, TaskProgressUpdater updater) throws java.lang.Exception
- Throws:
java.lang.Exception
-
executeScalar
protected java.lang.Object executeScalar(java.sql.PreparedStatement stmt) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
buildPropertyValue
protected PropertyValue buildPropertyValue(java.lang.String propId, java.lang.Object value, int bindType, DataTypeClass fallbackType)
-
getTypeForValueProp
protected DataType getTypeForValueProp(PropertySet propSet)
Gets the data type for the value property stored in the provided property set
-
-