Class DBTagStore
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.sqltags.providers.AbstractTagStore
-
- com.inductiveautomation.ignition.gateway.sqltags.providers.datasource.tagstore.DBTagStore
-
- All Implemented Interfaces:
TagConfigProvider
,TagStore
public class DBTagStore extends AbstractTagStore
This class represents a DB tag storage mechanism. Right now it's written with the external legacy db in mind, in could be broken up into a proper class hierarchy that supported that along w/ the internal db and others. Also, it implements SQLTagErrorLogger and SQLTagValueLogger, though both of those could be broken out into separate classes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DBTagStore.DBWriteResult
This wrapper is used to actually write results to the database.protected class
DBTagStore.PollRunner
protected class
DBTagStore.SqlTWriteOperation
static class
DBTagStore.TagWriteTask
protected class
DBTagStore.WriteJob
-
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.gateway.sqltags.providers.AbstractTagStore
AbstractTagStore.LegacyAlertInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
BASE_VALUE_READ_QUERY
protected static int
CLEANUP_CYCLE
protected static int
LEASE_EXTENSION_PERIOD
protected static int
LEASE_UPDATE_WRITE_CYCLE
protected static int
MAX_PARAMETERS
protected boolean
tablesVerified
protected static int
WRITE_CYCLE_WAIT_TIME
protected static int
WRITE_TIMEOUT
-
Fields inherited from class com.inductiveautomation.ignition.gateway.sqltags.providers.AbstractTagStore
log
-
-
Constructor Summary
Constructors Constructor Description DBTagStore(GatewayContext context, java.lang.String managerName, java.lang.String dataSource, int pollRate, int pollOverlap, boolean isDriving, java.lang.String driverName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLeaseChangeListener(LeaseEventListener listener)
protected void
addPropertySetToBatch(int tagId, BatchStatement stmt, java.lang.String subPath, PropertySet props)
protected void
addPropertyToBatch(int tagId, BatchStatement propStmt, java.lang.String name, java.lang.Object value, DataTypeClass dtype)
protected void
addPropertyToBatch(int tagId, BatchStatement stmt, java.lang.String name, java.lang.Object value, DataTypeClass dtype, DataType type, java.lang.String subPath, boolean isCustom)
void
addScanClasses(java.util.Collection<ScanClass> scanclasses)
Same as with tags, but for scanclasses.void
addTags(TagPath parentFolder, java.util.List<? extends Tag> tags)
Saves the specified tag definitions to the store.protected int
addTagsV2(TagPath parentFolder, java.util.List<? extends Tag> tags)
protected void
bulkInsertTagMeta(BatchStatement stmt, int tagId, java.util.Iterator<PropertyValue> itr)
protected void
cacheValuesToWrite(java.util.List<TagPropertyValue> values)
NOTE: Only call after already having sychronized on valuesToWrite *protected void
checkVersion()
protected void
cleanupTables()
Cleans up tables that might have "abandoned" rows.protected void
configPoll()
protected void
deletePropertiesForUpdate(EntityId id, PropertySet ps, java.lang.String overridePath, BatchStatement stmt)
protected void
deletePropertyForUpdate(EntityId owner, Property<?> prop, java.lang.String overridePath, BatchStatement stmt)
void
deleteScanClasses(java.util.Collection<EntityId> scanclassIds)
protected void
deleteTagPropertiesForUpdate(EntityId id, TagDiff diff, BatchStatement stmt)
protected void
deleteTagPropertiesForUpdate(java.util.Collection<EntityId> ids, TagDiff diff)
void
deleteTags(java.util.Collection<EntityId> tagIds)
Deletes the given tags from the store.protected void
deleteTagsBatch(SRConnection conn, java.util.List<EntityId> tagIds, TaskProgressUpdater updater)
protected int
findScid(java.lang.String scName)
protected java.sql.PreparedStatement
getAlarmStateStatement(SRConnection conn)
protected int
getBatchSize()
Returns the size that should be used for batching.protected SRConnection
getConnection()
Returns a new connection.java.sql.Timestamp
getCurrentUpdateDate()
protected Datasource
getDatasource()
java.lang.String
getDataSource()
TagDefinition
getDefinition(EntityId id)
java.util.List<TagDefinition>
getDefinitions(java.util.List<EntityId> ids)
java.lang.String
getDriverName()
ExternalScanclassUpdateListener
getExternalScanclassListener()
protected java.util.Map<java.lang.String,java.lang.Integer>
getIdsForNewTags(SRConnection conn)
protected java.sql.Timestamp
getLastUpdateDate(boolean overlapAdjusted)
protected java.sql.PreparedStatement
getMetaInsertStatement(SRConnection conn)
protected java.sql.PreparedStatement
getPermissionStatment(SRConnection conn)
QualifiedValue
getProperty(EntityId id, TagProp prop)
protected java.lang.String
getQuery(java.lang.String key, java.lang.String rawQuery)
Gets a quoted query from the cache, inserting it if not already there.protected java.util.List<DBTableSchema>
getRequiredTables()
protected java.lang.String
getSCName(EntityId id)
protected java.util.Iterator<PropertyValue>
getTagPropValues(Tag tag)
protected java.lang.String
getTagValueReadQuery()
DBValueUpdateListener
getValueListener()
DBWriteHandler
getWriteHandler()
protected void
insertComplexTag(java.lang.Integer ownerId, ComplexTag tag)
protected void
insertInWriteTable(DBTagStore.WriteJob job)
protected void
insertTagAlarmConfig(SRConnection conn, java.lang.Long tagId, java.util.List<AlarmDefinition> config, java.lang.String overridePath)
protected void
insertTagAlarmProperties(SRConnection conn, java.util.Map<java.lang.Long,AlarmDefinition> defs)
protected void
insertTagEventScripts(SRConnection conn, java.lang.Long tagId, TagEventScripts scripts, java.lang.String overridePath)
protected java.util.Map<java.lang.Integer,GeneralTagConfig<Tag,java.lang.String>>
insertTags(java.util.List<GeneralTagConfig<Tag,java.lang.String>> tags, java.lang.Integer ownerId)
protected void
internalConfigPoll()
This is where the work is done.protected void
internalDeleteTag(java.util.List<EntityId> tagIds, TaskProgressUpdater updater)
protected void
internalStoreTagValues(java.util.List<TagPropertyValue> tagVals)
Stores the values.protected boolean
isConfigPaused()
protected boolean
isDatasourceAvailable()
protected void
loadAlarmStates(java.util.Map<java.lang.Integer,TagDefinition> tagDefs, boolean cfgLoad, java.lang.Object param)
protected TagDefinition
loadDefinition(EntityId id)
protected void
loadEventScripts(java.util.Map<java.lang.Integer,TagDefinition> tagDefs, boolean cfgLoad, java.lang.Object param)
protected java.util.List<LeaseInfo>
loadLeaseChanges()
protected void
loadMetaProperties(java.util.Map<java.lang.Integer,TagDefinition> tagDefs)
protected QualifiedValue
loadMetaPropFromResultset(Dataset set, int rowId, TagProp prop)
protected void
loadPermissions(java.util.Map<java.lang.Integer,TagDefinition> tagDefs, boolean cfgLoad, java.lang.Object param)
protected void
loadScanClasses(java.util.List<TagStoreObject<ScanClass>> modifiedSCIs, java.util.List<EntityId> deletedSCIs)
Returns a map of scan classes loaded from the database.protected void
loadTags(java.util.List<TagStoreObject<TagConfig>> modifiedTags, java.util.List<EntityId> deletedTags)
protected void
loadTags(java.util.List<TagStoreObject<TagConfig>> modifiedTags, java.util.List<EntityId> deletedTags, boolean cfgLoad, java.lang.Object param)
Loads the tags from the db.protected void
loadTagsFromResultset(Dataset resultSet, java.util.List<TagStoreObject<TagConfig>> modifiedTags, java.util.List<EntityId> deletedTags, java.util.Map<java.lang.Integer,TagDefinition> tagMap, java.util.Map<java.lang.Integer,ComplexTagStoreObject> ownerLookup)
This function does slightly different things based on the parameters.protected java.util.List<DBTagValue>
loadTagValueChanges()
This function reads the value changes for "external tags" (the definition of which depends on what mode we're in).protected java.util.List<DBWriteRequest>
loadWriteQueueRequests()
Scans the write queue for write commands.protected void
modifyComplexTag(EntityId tagId, ComplexTagDiff diff)
void
modifyScanClass(EntityId scanclassId, ScanClass newDefinition)
void
modifyTagPaths(java.util.List<EntityId> ids, java.util.List<TagPath> newPaths)
Writes new tag paths to the store.void
modifyTags(TagDiff diff, java.util.Collection<EntityId> tagIds)
Applies the tagdiff to the given tags.protected void
modifyTags(java.util.Collection<EntityId> tagIds, TagDiff diff, TaskProgressUpdater updater)
protected void
notifyLeasesModified(java.util.Collection<LeaseInfo> leases)
protected void
processScanClassLeases()
************************** START - Scanclass leasing ***************************java.util.Map<java.lang.String,DriverInformation>
readDriverInformation()
protected void
readExternalWriteResults()
This function looks for results of write tasks that we've entered.void
reloadTags(java.util.Set<EntityId> ids)
void
removeLeaseChangeListener(LeaseEventListener listener)
protected void
reportError(ErrorLifecycle lifeCycle, ErrorSeverity severity, java.lang.String message)
protected void
runTableVerification()
protected void
saveWriteResults(java.util.List<DBTagStore.DBWriteResult> results)
protected void
setConfigPaused(boolean value)
void
setConfigPoll(int value)
void
setCurrentUpdateDate(java.sql.Timestamp value)
void
setDataSource(java.lang.String value)
void
setDriverInformation(java.lang.String ipAddress, int port)
void
setExternalScanclassListener(ExternalScanclassUpdateListener listener)
protected void
setLastUpdateDate(java.sql.Timestamp value)
void
setPollOverlap(int value)
void
setValueListener(DBValueUpdateListener valueListener)
void
setWriteHandler(DBWriteHandler writeHandler)
void
shutdown()
Shuts down the tag store, finalizing any writes and preventing further operations.void
startup()
Start up the tag store, checks the tables and starts polling.protected void
storeAlarmConfiguration(SRConnection conn, java.lang.Long tagId, AlarmConfiguration config, java.lang.String overridePath, boolean tryUpdate)
protected void
storeTagEventScripts(SRConnection conn, java.lang.Long tagId, TagEventScripts scripts, boolean tryUpdate)
void
storeTagValues(java.util.Collection<TagPropertyValue> tagVals)
Writes the given values to the store.protected void
updateDriverTable()
This function updates the driver information in the database, inserting it if necessary.protected void
updateExternalScanclasses()
Reads the full scanclassinstance table and returns the rows as SCI objects.void
updateLeasedScanclassSet(java.util.Collection<EntityId> scanClasseIds)
protected void
updateTagCache(java.util.List<TagStoreObject<TagConfig>> modifiedTags, java.util.List<EntityId> deletedTags)
protected void
upgradeAlerts()
protected void
verifyTables(boolean createIfAbsent)
void
writeAgainstExternalProvider(java.util.List<DBTagStore.TagWriteTask> tasks)
************************** START - Value write code ***************************protected void
writeCoreTag(BatchStatement stmt, java.util.List<GeneralTagConfig<Tag,java.lang.String>> tags, java.lang.Integer ownerId)
protected void
writePermissions(SRConnection conn, int tagid, TagPermissionsModel permissions, boolean deletePrevious)
protected void
writePermissions(BatchStatement stmt, int tagid, TagPermissionsModel permissions)
-
Methods inherited from class com.inductiveautomation.ignition.gateway.sqltags.providers.AbstractTagStore
addConfigurationListener, buildPropertyValue, executeScalar, flattenTags, getDBId, getDeepTagCount, getGatewayContext, getIdForMemberPath, getIdsForMemberPaths, getLastError, getLogger, getManagerName, getTypeForValueProp, isErrored, notifyItemsAdded, notifyItemsRemoved, notifyPropertiesChanged, registerUDTs, removeConfigurationListener, removeFromUidEidCache, setErrored, updateStatMetrics, updateUdtEidCache, updateUDTsForLoadedTags
-
-
-
-
Field Detail
-
LEASE_UPDATE_WRITE_CYCLE
protected static final int LEASE_UPDATE_WRITE_CYCLE
- See Also:
- Constant Field Values
-
LEASE_EXTENSION_PERIOD
protected static final int LEASE_EXTENSION_PERIOD
- See Also:
- Constant Field Values
-
WRITE_TIMEOUT
protected static final int WRITE_TIMEOUT
- See Also:
- Constant Field Values
-
WRITE_CYCLE_WAIT_TIME
protected static final int WRITE_CYCLE_WAIT_TIME
- See Also:
- Constant Field Values
-
CLEANUP_CYCLE
protected static final int CLEANUP_CYCLE
- See Also:
- Constant Field Values
-
MAX_PARAMETERS
protected static final int MAX_PARAMETERS
- See Also:
- Constant Field Values
-
BASE_VALUE_READ_QUERY
protected static final java.lang.String BASE_VALUE_READ_QUERY
- See Also:
- Constant Field Values
-
tablesVerified
protected boolean tablesVerified
-
-
Constructor Detail
-
DBTagStore
public DBTagStore(GatewayContext context, java.lang.String managerName, java.lang.String dataSource, int pollRate, int pollOverlap, boolean isDriving, java.lang.String driverName)
-
-
Method Detail
-
getBatchSize
protected int getBatchSize()
Returns the size that should be used for batching. If 0, batching won't be used.
-
getDriverName
public java.lang.String getDriverName()
-
getDataSource
public java.lang.String getDataSource()
-
setDataSource
public void setDataSource(java.lang.String value)
-
isDatasourceAvailable
protected boolean isDatasourceAvailable()
-
isConfigPaused
protected boolean isConfigPaused()
-
setConfigPaused
protected void setConfigPaused(boolean value)
-
getWriteHandler
public DBWriteHandler getWriteHandler()
-
setWriteHandler
public void setWriteHandler(DBWriteHandler writeHandler)
-
getValueListener
public DBValueUpdateListener getValueListener()
-
setValueListener
public void setValueListener(DBValueUpdateListener valueListener)
-
getExternalScanclassListener
public ExternalScanclassUpdateListener getExternalScanclassListener()
-
setExternalScanclassListener
public void setExternalScanclassListener(ExternalScanclassUpdateListener listener)
-
setConfigPoll
public void setConfigPoll(int value)
-
setPollOverlap
public void setPollOverlap(int value)
-
getLastUpdateDate
protected java.sql.Timestamp getLastUpdateDate(boolean overlapAdjusted)
-
setLastUpdateDate
protected void setLastUpdateDate(java.sql.Timestamp value)
-
getCurrentUpdateDate
public java.sql.Timestamp getCurrentUpdateDate()
-
setCurrentUpdateDate
public void setCurrentUpdateDate(java.sql.Timestamp value)
-
addLeaseChangeListener
public void addLeaseChangeListener(LeaseEventListener listener)
-
removeLeaseChangeListener
public void removeLeaseChangeListener(LeaseEventListener listener)
-
notifyLeasesModified
protected void notifyLeasesModified(java.util.Collection<LeaseInfo> leases)
-
startup
public void startup() throws java.lang.Exception
Start up the tag store, checks the tables and starts polling.- Throws:
java.lang.Exception
-
shutdown
public void shutdown()
Description copied from interface:TagStore
Shuts down the tag store, finalizing any writes and preventing further operations.
-
getConnection
protected SRConnection getConnection() throws java.sql.SQLException
Returns a new connection. Used to return read_uncommitted, but now returns normal connection. 11/3/2010 - I've changed the isolation level to read_uncommitted in hopes of reducing deadlock errors in SQL Server. The stuff we do here doesn't really need strong isolation anyhow- there's not really anything that gets rolled back (value updates are performed in a transaction, but only for performance, we may not even be necessary in Java). 3/31/2011 - Commented that out, since oracle doesn't seem to support it.- Throws:
java.sql.SQLException
-
getDatasource
protected Datasource getDatasource()
-
getQuery
protected java.lang.String getQuery(java.lang.String key, java.lang.String rawQuery)
Gets a quoted query from the cache, inserting it if not already there. If key is null, it won't be stored, just quoted and returned.
-
getSCName
protected java.lang.String getSCName(EntityId id)
-
configPoll
protected final void configPoll()
-
internalConfigPoll
protected void internalConfigPoll() throws java.lang.Exception
This is where the work is done. It can be overridden by inheriting classes in order to do their own thing, but they should always call this super function first.- Throws:
java.lang.Exception
-
getDefinition
public TagDefinition getDefinition(EntityId id)
-
getDefinitions
public java.util.List<TagDefinition> getDefinitions(java.util.List<EntityId> ids)
-
loadDefinition
protected TagDefinition loadDefinition(EntityId id)
-
getProperty
public QualifiedValue getProperty(EntityId id, TagProp prop)
-
updateTagCache
protected void updateTagCache(java.util.List<TagStoreObject<TagConfig>> modifiedTags, java.util.List<EntityId> deletedTags)
-
reloadTags
public void reloadTags(java.util.Set<EntityId> ids)
-
loadTags
protected void loadTags(java.util.List<TagStoreObject<TagConfig>> modifiedTags, java.util.List<EntityId> deletedTags) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
loadTags
protected void loadTags(java.util.List<TagStoreObject<TagConfig>> modifiedTags, java.util.List<EntityId> deletedTags, boolean cfgLoad, java.lang.Object param) throws java.sql.SQLException
Loads the tags from the db. It supports 2 load methodologies: by id, and by config change. The later is used if cfgLoad is true. Both methods take 1 param: for config, the last time, and for id, the tag id.- Throws:
java.sql.SQLException
-
loadTagsFromResultset
protected void loadTagsFromResultset(Dataset resultSet, java.util.List<TagStoreObject<TagConfig>> modifiedTags, java.util.List<EntityId> deletedTags, java.util.Map<java.lang.Integer,TagDefinition> tagMap, java.util.Map<java.lang.Integer,ComplexTagStoreObject> ownerLookup)
This function does slightly different things based on the parameters. First, we load simple tags, and udt parents. In this case deleted tags will be marked in the passed in list, and udt parents will be put in the ownerLookup. On second pass, we'll be loading udt children. Deleted tags are ignored (deleted list should be null). In both cases, all tags are put in the tagLookup. Only in the first pass are tags put in the modified map.
-
loadMetaProperties
protected void loadMetaProperties(java.util.Map<java.lang.Integer,TagDefinition> tagDefs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
loadMetaPropFromResultset
protected QualifiedValue loadMetaPropFromResultset(Dataset set, int rowId, TagProp prop)
-
loadAlarmStates
protected void loadAlarmStates(java.util.Map<java.lang.Integer,TagDefinition> tagDefs, boolean cfgLoad, java.lang.Object param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
loadPermissions
protected void loadPermissions(java.util.Map<java.lang.Integer,TagDefinition> tagDefs, boolean cfgLoad, java.lang.Object param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
loadEventScripts
protected void loadEventScripts(java.util.Map<java.lang.Integer,TagDefinition> tagDefs, boolean cfgLoad, java.lang.Object param) throws java.lang.Exception
- Throws:
java.lang.Exception
-
loadScanClasses
protected void loadScanClasses(java.util.List<TagStoreObject<ScanClass>> modifiedSCIs, java.util.List<EntityId> deletedSCIs) throws java.sql.SQLException
Returns a map of scan classes loaded from the database. Key = SCID.- Throws:
java.sql.SQLException
-
loadWriteQueueRequests
protected java.util.List<DBWriteRequest> loadWriteQueueRequests() throws java.sql.SQLException
Scans the write queue for write commands. Only called if the provider is Driving.- Throws:
java.sql.SQLException
-
saveWriteResults
protected void saveWriteResults(java.util.List<DBTagStore.DBWriteResult> results) throws java.lang.Exception
- Throws:
java.lang.Exception
-
reportError
protected void reportError(ErrorLifecycle lifeCycle, ErrorSeverity severity, java.lang.String message)
-
getTagValueReadQuery
protected java.lang.String getTagValueReadQuery()
-
loadTagValueChanges
protected java.util.List<DBTagValue> loadTagValueChanges()
This function reads the value changes for "external tags" (the definition of which depends on what mode we're in). It should be called periodically, normally from the configPoll function because it uses the same timestamp to track changes.
-
storeTagValues
public void storeTagValues(java.util.Collection<TagPropertyValue> tagVals)
Description copied from interface:TagStore
Writes the given values to the store. The "value" is not necessarily the "tag value"- it can be the value of any property of the tag. The tag store may not store all of the properties- it will only store what it believes is necessary.
-
internalStoreTagValues
protected void internalStoreTagValues(java.util.List<TagPropertyValue> tagVals)
Stores the values. If tagVals is null, will attempt to write the valuesToWrite cache. *
-
cacheValuesToWrite
protected void cacheValuesToWrite(java.util.List<TagPropertyValue> values)
NOTE: Only call after already having sychronized on valuesToWrite *
-
updateExternalScanclasses
protected void updateExternalScanclasses()
Reads the full scanclassinstance table and returns the rows as SCI objects.
-
addTags
public void addTags(TagPath parentFolder, java.util.List<? extends Tag> tags) throws java.lang.Exception
Description copied from interface:TagStore
Saves the specified tag definitions to the store. Should result in the listeners being notified about the addition/removal of tags. Will result in itemsAdded notification.- Throws:
java.lang.Exception
-
addTagsV2
protected int addTagsV2(TagPath parentFolder, java.util.List<? extends Tag> tags) throws java.lang.Exception
- Throws:
java.lang.Exception
-
insertComplexTag
protected void insertComplexTag(java.lang.Integer ownerId, ComplexTag tag) throws java.lang.Exception
- Throws:
java.lang.Exception
-
insertTags
protected java.util.Map<java.lang.Integer,GeneralTagConfig<Tag,java.lang.String>> insertTags(java.util.List<GeneralTagConfig<Tag,java.lang.String>> tags, java.lang.Integer ownerId) throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeCoreTag
protected void writeCoreTag(BatchStatement stmt, java.util.List<GeneralTagConfig<Tag,java.lang.String>> tags, java.lang.Integer ownerId) throws java.sql.SQLException, TaskCancellationException
- Throws:
java.sql.SQLException
TaskCancellationException
-
getIdsForNewTags
protected java.util.Map<java.lang.String,java.lang.Integer> getIdsForNewTags(SRConnection conn) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getTagPropValues
protected java.util.Iterator<PropertyValue> getTagPropValues(Tag tag)
-
modifyTags
public void modifyTags(TagDiff diff, java.util.Collection<EntityId> tagIds)
Description copied from interface:TagStore
Applies the tagdiff to the given tags. Will result in itemsModified/itemsRemoved notification (removed if tag path changed)
-
modifyTags
protected void modifyTags(java.util.Collection<EntityId> tagIds, TagDiff diff, TaskProgressUpdater updater)
-
modifyTagPaths
public void modifyTagPaths(java.util.List<EntityId> ids, java.util.List<TagPath> newPaths) throws java.lang.Exception
Description copied from interface:TagStore
Writes new tag paths to the store. The entity ids must map 1-to-1 with the new tag paths. The new paths should be the full path of the tag, including the tag name. It will change the tag name as well, but won't check for collisions.- Throws:
java.lang.Exception
-
getMetaInsertStatement
protected java.sql.PreparedStatement getMetaInsertStatement(SRConnection conn) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
bulkInsertTagMeta
protected void bulkInsertTagMeta(BatchStatement stmt, int tagId, java.util.Iterator<PropertyValue> itr) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addPropertyToBatch
protected void addPropertyToBatch(int tagId, BatchStatement propStmt, java.lang.String name, java.lang.Object value, DataTypeClass dtype) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addPropertySetToBatch
protected void addPropertySetToBatch(int tagId, BatchStatement stmt, java.lang.String subPath, PropertySet props) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addPropertyToBatch
protected void addPropertyToBatch(int tagId, BatchStatement stmt, java.lang.String name, java.lang.Object value, DataTypeClass dtype, DataType type, java.lang.String subPath, boolean isCustom) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
deleteTagPropertiesForUpdate
protected void deleteTagPropertiesForUpdate(java.util.Collection<EntityId> ids, TagDiff diff) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
deleteTagPropertiesForUpdate
protected void deleteTagPropertiesForUpdate(EntityId id, TagDiff diff, BatchStatement stmt) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
deletePropertiesForUpdate
protected void deletePropertiesForUpdate(EntityId id, PropertySet ps, java.lang.String overridePath, BatchStatement stmt) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
deletePropertyForUpdate
protected void deletePropertyForUpdate(EntityId owner, Property<?> prop, java.lang.String overridePath, BatchStatement stmt) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getAlarmStateStatement
protected java.sql.PreparedStatement getAlarmStateStatement(SRConnection conn) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
modifyComplexTag
protected void modifyComplexTag(EntityId tagId, ComplexTagDiff diff) throws java.lang.Exception
- Throws:
java.lang.Exception
-
storeTagEventScripts
protected void storeTagEventScripts(SRConnection conn, java.lang.Long tagId, TagEventScripts scripts, boolean tryUpdate) throws java.lang.Exception
- Throws:
java.lang.Exception
-
storeAlarmConfiguration
protected void storeAlarmConfiguration(SRConnection conn, java.lang.Long tagId, AlarmConfiguration config, java.lang.String overridePath, boolean tryUpdate) throws java.lang.Exception
- Throws:
java.lang.Exception
-
insertTagEventScripts
protected void insertTagEventScripts(SRConnection conn, java.lang.Long tagId, TagEventScripts scripts, java.lang.String overridePath)
-
insertTagAlarmConfig
protected void insertTagAlarmConfig(SRConnection conn, java.lang.Long tagId, java.util.List<AlarmDefinition> config, java.lang.String overridePath) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
insertTagAlarmProperties
protected void insertTagAlarmProperties(SRConnection conn, java.util.Map<java.lang.Long,AlarmDefinition> defs) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getPermissionStatment
protected java.sql.PreparedStatement getPermissionStatment(SRConnection conn) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
writePermissions
protected void writePermissions(SRConnection conn, int tagid, TagPermissionsModel permissions, boolean deletePrevious) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
writePermissions
protected void writePermissions(BatchStatement stmt, int tagid, TagPermissionsModel permissions) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
findScid
protected int findScid(java.lang.String scName)
-
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
- Overrides:
deleteTags
in classAbstractTagStore
- Throws:
java.lang.Exception
-
internalDeleteTag
protected void internalDeleteTag(java.util.List<EntityId> tagIds, TaskProgressUpdater updater) throws java.lang.Exception
- Specified by:
internalDeleteTag
in classAbstractTagStore
- Throws:
java.lang.Exception
-
deleteTagsBatch
protected void deleteTagsBatch(SRConnection conn, java.util.List<EntityId> tagIds, TaskProgressUpdater updater) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addScanClasses
public void addScanClasses(java.util.Collection<ScanClass> scanclasses) throws java.lang.Exception
Description copied from interface:TagStore
Same as with tags, but for scanclasses.- Throws:
java.lang.Exception
-
modifyScanClass
public void modifyScanClass(EntityId scanclassId, ScanClass newDefinition) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteScanClasses
public void deleteScanClasses(java.util.Collection<EntityId> scanclassIds)
-
getRequiredTables
protected java.util.List<DBTableSchema> getRequiredTables()
-
runTableVerification
protected void runTableVerification()
-
verifyTables
protected final void verifyTables(boolean createIfAbsent) throws java.lang.Exception
- Throws:
java.lang.Exception
-
checkVersion
protected void checkVersion()
-
setDriverInformation
public void setDriverInformation(java.lang.String ipAddress, int port)
-
updateDriverTable
protected void updateDriverTable()
This function updates the driver information in the database, inserting it if necessary.
-
loadLeaseChanges
protected java.util.List<LeaseInfo> loadLeaseChanges()
-
processScanClassLeases
protected void processScanClassLeases()
************************** START - Scanclass leasing ***************************
-
updateLeasedScanclassSet
public void updateLeasedScanclassSet(java.util.Collection<EntityId> scanClasseIds)
-
readDriverInformation
public java.util.Map<java.lang.String,DriverInformation> readDriverInformation()
-
cleanupTables
protected void cleanupTables() throws java.lang.Exception
Cleans up tables that might have "abandoned" rows. Throws an exception, but only for serious connection level stuff. Otherwise captures and logs errors in the individual operations.- Throws:
java.lang.Exception
-
upgradeAlerts
protected void upgradeAlerts() throws java.lang.Exception
- Throws:
java.lang.Exception
-
writeAgainstExternalProvider
public void writeAgainstExternalProvider(java.util.List<DBTagStore.TagWriteTask> tasks)
************************** START - Value write code ***************************
-
insertInWriteTable
protected void insertInWriteTable(DBTagStore.WriteJob job)
-
readExternalWriteResults
protected void readExternalWriteResults()
This function looks for results of write tasks that we've entered.
-
-