Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ dependencies {
api(libs.jsvg)
api(libs.bundles.coroutines)
api(libs.bundles.flatlaf)
api(libs.bundles.ignition) {
// Exclude transitive IA dependencies - we only need core Ignition classes for cache deserialization
isTransitive = false
}
api(libs.bundles.ignition) // Gradle will not include these packages unless they are transitive
api(libs.poi)
api(libs.excelkt) {
// bringing in POI manually, since this wrapper appears unmaintained
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kotlin = "2.2.10"
coroutines = "1.10.2"
flatlaf = "3.6.1"
kotest = "5.9.1"
ignition = "8.1.20"
ignition = "8.3.0"
jackson = "2.19.2"

[plugins]
Expand Down Expand Up @@ -46,8 +46,8 @@ rsyntaxtextarea = { group = "com.fifesoft", name = "rsyntaxtextarea", version =
jfreechart = { group = "org.jfree", name = "jfreechart", version = "1.5.6" }

# Ignition
ignition-common = { group = "com.inductiveautomation.ignition", name = "common", version.ref = "ignition" }
ignition-gateway = { group = "com.inductiveautomation.ignition", name = "gateway-api", version.ref = "ignition" }
ignition-common = { group = "com.inductiveautomation.ignitionsdk", name = "ignition-common", version.ref = "ignition" }
ignition-gateway = { group = "com.inductiveautomation.ignitionsdk", name = "gateway-api", version.ref = "ignition" }
# Ignition core types use classes from these libs (e.g. StringUtils, ImmutableMap), so we're forced to include these
apache-commons = { group = "org.apache.commons", name = "commons-lang3", version = "3.8.1" }
# This leads to a warning at runtime about multiple logging providers on the classpath, but is unavoidable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.github.inductiveautomation.kindling.cache

import com.formdev.flatlaf.extras.FlatSVGIcon
import io.github.inductiveautomation.kindling.core.Tool
import io.github.inductiveautomation.kindling.core.ToolOpeningException
import io.github.inductiveautomation.kindling.core.ToolPanel
import io.github.inductiveautomation.kindling.utils.FileFilter
import java.nio.file.Path
import kotlin.io.path.extension

data object CacheViewer : Tool {
override val serialKey = "sf-cache"
override val title = "Store & Forward Cache"
override val description = "S&F Cache (.zip, 8.1: .data, .script, 8.3: .idb)"
override val icon = FlatSVGIcon("icons/bx-data.svg")
internal val extensions = arrayOf("data", "script", "zip", "idb")
override val filter = FileFilter(description, *extensions)

override fun open(path: Path): ToolPanel = when (path.extension) {
"data",
"script",
-> {
io.github.inductiveautomation.kindling.cache.hsql.CacheView(path)
Comment thread
Joshlha marked this conversation as resolved.
Outdated
}
"idb" -> {
io.github.inductiveautomation.kindling.cache.sqlite.CacheView.fromIdb(path)
}
"zip" -> {
try {
io.github.inductiveautomation.kindling.cache.hsql.CacheView(path)
} catch (_: Exception) {
io.github.inductiveautomation.kindling.cache.sqlite.CacheView.fromZip(path)
}
}
else -> throw ToolOpeningException("Invalid file extension; ${path.extension}")
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.inductiveautomation.kindling.cache
package io.github.inductiveautomation.kindling.cache.hsql

import io.github.inductiveautomation.kindling.utils.ColumnList
import org.jdesktop.swingx.renderer.DefaultTableRenderer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.inductiveautomation.kindling.cache
package io.github.inductiveautomation.kindling.cache.hsql

import java.sql.Timestamp

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package io.github.inductiveautomation.kindling.cache
package io.github.inductiveautomation.kindling.cache.hsql

import com.formdev.flatlaf.extras.FlatSVGIcon
import com.formdev.flatlaf.extras.components.FlatPopupMenu
import com.jidesoft.swing.JideButton
import io.github.inductiveautomation.kindling.cache.CacheViewer
import io.github.inductiveautomation.kindling.core.Detail
import io.github.inductiveautomation.kindling.core.DetailsPane
import io.github.inductiveautomation.kindling.core.Tool
import io.github.inductiveautomation.kindling.core.ToolOpeningException
import io.github.inductiveautomation.kindling.core.ToolPanel
import io.github.inductiveautomation.kindling.utils.Action
import io.github.inductiveautomation.kindling.utils.EDT_SCOPE
import io.github.inductiveautomation.kindling.utils.FileFilter
import io.github.inductiveautomation.kindling.utils.FlatScrollPane
import io.github.inductiveautomation.kindling.utils.HorizontalSplitPane
import io.github.inductiveautomation.kindling.utils.ReifiedJXTable
Expand Down Expand Up @@ -295,7 +294,7 @@ class CacheView(path: Path) : ToolPanel() {
try {
val deserialized = bytes.deserializeStoreAndForward()
deserialized.toDetail()
} catch (e: Exception) {
} catch (_: Exception) {
// It's not serialized with a class in the public API, or some other problem;
// give up, and try to just dump the serialized data in a friendlier format
val serializationDumper = deser.SerializationDumper(bytes)
Expand Down Expand Up @@ -335,14 +334,3 @@ class CacheView(path: Path) : ToolPanel() {
val cacheFileExtensions = listOf("data", "script", "log", "backup", "properties")
}
}

data object CacheViewer : Tool {
override val serialKey = "sf-cache"
override val title = "Store & Forward Cache"
override val description = "S&F Cache (.data, .script, .zip)"
override val icon = FlatSVGIcon("icons/bx-hdd.svg")
internal val extensions = arrayOf("data", "script", "zip")
override val filter = FileFilter(description, *extensions)

override fun open(path: Path): ToolPanel = CacheView(path)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.inductiveautomation.kindling.cache
package io.github.inductiveautomation.kindling.cache.hsql

import com.jidesoft.swing.CheckBoxList
import io.github.inductiveautomation.kindling.utils.listCellRenderer
Expand All @@ -11,16 +11,12 @@ class SchemaModel(data: List<SchemaRecord>) : AbstractListModel<Any>() {
private val comparator: Comparator<SchemaRecord> = compareBy(nullsFirst()) { it.id }
private val values = data.sortedWith(comparator)

override fun getSize(): Int {
return values.size + 1
}
override fun getSize(): Int = values.size + 1

override fun getElementAt(index: Int): Any {
return if (index == 0) {
CheckBoxList.ALL_ENTRY
} else {
values[index - 1]
}
override fun getElementAt(index: Int): Any = if (index == 0) {
CheckBoxList.ALL_ENTRY
} else {
values[index - 1]
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.inductiveautomation.kindling.cache
package io.github.inductiveautomation.kindling.cache.hsql

data class SchemaRecord(
val id: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.inductiveautomation.kindling.cache.model
package io.github.inductiveautomation.kindling.cache.hsql.model

import com.inductiveautomation.ignition.common.alarming.EventData
import com.inductiveautomation.ignition.common.alarming.evaluation.EventPropertyType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.github.inductiveautomation.kindling.cache.model
package io.github.inductiveautomation.kindling.cache.hsql.model

import com.inductiveautomation.ignition.gateway.audit.AuditRecord
import io.github.inductiveautomation.kindling.core.Detail
import java.io.Serializable
import java.util.Date

@Suppress("unused")
class AuditProfileData(
private val auditRecord: AuditRecord,
private val auditRecord: DefaultAuditRecord,
private val insertQuery: String,
private val parentLog: String,
) : Serializable {
Expand Down Expand Up @@ -37,3 +37,21 @@ class AuditProfileData(
private val serialVersionUID = 3037488986978918285L
}
}

@Suppress("unused")
class DefaultAuditRecord(
val originatingContext: Int,
val statusCode: Int,
val action: String,
val actionTarget: String?,
val actionValue: String,
val actor: String,
val actorHost: String,
val originatingSystem: String,
val timestamp: Date,
) : Serializable {
companion object {
@JvmStatic
private val serialVersionUID = 0x21d9a89f09913781
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.inductiveautomation.kindling.cache.model
package io.github.inductiveautomation.kindling.cache.hsql.model

import com.inductiveautomation.ignition.common.Dataset
import com.inductiveautomation.ignition.common.model.values.QualityCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package io.github.inductiveautomation.kindling.cache.model
@file:Suppress("DEPRECATION")

package io.github.inductiveautomation.kindling.cache.hsql.model

import com.inductiveautomation.ignition.common.alarming.AlarmPriority
import com.inductiveautomation.ignition.common.alarming.AlarmStateTransition
Expand All @@ -9,9 +11,9 @@ import com.inductiveautomation.ignition.gateway.alarming.journal.EventFlags.IS_C
import com.inductiveautomation.ignition.gateway.alarming.journal.EventFlags.SHELVED_EVENT_FLAG
import com.inductiveautomation.ignition.gateway.alarming.journal.EventFlags.SYSTEM_ACK_FLAG
import com.inductiveautomation.ignition.gateway.alarming.journal.EventFlags.SYSTEM_EVENT_FLAG
import com.inductiveautomation.ignition.gateway.history.DatasourceData
import com.inductiveautomation.ignition.gateway.history.HistoricalData
import com.inductiveautomation.ignition.gateway.history.HistoryFlavor
import com.inductiveautomation.ignition.gateway.storeforward.data.PersistentData
import com.inductiveautomation.ignition.gateway.storeforward.deprecated.HistoricalData
import com.inductiveautomation.ignition.gateway.storeforward.deprecated.HistoryFlavor
import io.github.inductiveautomation.kindling.core.Detail
import java.io.Serial

Expand All @@ -25,10 +27,11 @@ class RemoteEvent(
val eventFlags: Int = 0,
val data: EventData? = null,
) : HistoricalData {
override fun getFlavor(): HistoryFlavor = DatasourceData.FLAVOR
override fun getFlavor(): HistoryFlavor = HistoryFlavor("__datasourcedata__")
override fun getSignature(): String = "Remote Alarm Journal Event"
override fun getDataCount(): Int = 1
override fun getLoggerName(): String? = null
override fun upgrade(p0: String?): PersistentData? = null

fun toDetail(): Detail {
val details = mapOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.inductiveautomation.kindling.cache.model
package io.github.inductiveautomation.kindling.cache.hsql.model

import io.github.inductiveautomation.kindling.core.Detail
import java.io.Serializable
Expand Down
Loading