Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
eecfe6c
#1847 Integration with the QuestDB database - temp
Limraj Aug 25, 2021
830dd94
#1847 Integration with the QuestDB database - refactor, added missing…
arturro96 Aug 26, 2021
ea2ff33
#1847 QuestDb integration - mysql view update
arturro96 Aug 30, 2021
d20360c
#1847 QuestDb integration - postrges lib moved to tomcat-libs directory
arturro96 Aug 30, 2021
9c0bcc3
#1847 QuestDb integration - int to long changed in schema
arturro96 Aug 30, 2021
dd641c3
#1847 QuestDb integration - import fix
arturro96 Aug 30, 2021
6dc2731
#1847 Integration with the QuestDB database - added db.values.export.…
Limraj Aug 31, 2021
1acb916
#1847 QuestDb integration - db query to system settings added
arturro96 Aug 31, 2021
54df525
#1847 Integration with the QuestDB database - mysql export by jdbc, c…
Limraj Sep 1, 2021
148e6a0
#1847 Integration with the QuestDB database - correct for secure_file…
Limraj Sep 1, 2021
520f597
#1847 Integration with the QuestDB database - added overwrite
Limraj Sep 1, 2021
d60a8aa
Merge remote-tracking branch 'origin/feature/#1847_Integration_with_t…
arturro96 Sep 1, 2021
21f445f
#1847 Integration with the QuestDB database - refactor, added dbquery…
Limraj Sep 1, 2021
d8872a7
#1847 Integration with the QuestDB database - added dbquery.values.im…
Limraj Sep 1, 2021
5fb32e4
#1847 Integration with the QuestDB database - correct overwrite
Limraj Sep 1, 2021
9f42eed
#1863 Deleting data from questDB - prototype
arturro96 Sep 2, 2021
f1a5228
#1863 Deleting data from questDB - data retention added, new DAO for …
arturro96 Sep 22, 2021
0b1023e
#1863 data retention - migration fix, schema fix
arturro96 Sep 24, 2021
d2f897e
#1863 - table per datapoint
arturro96 Nov 25, 2021
b335745
#1863 - table per datapoint - data retention with partition by month
arturro96 Nov 29, 2021
e7f252d
#1863 - removing quotes from metaData
arturro96 Dec 8, 2021
578b994
#1863 - QuestDB integration (table per datapoint) - AmchartsDAO rewri…
arturro96 Dec 15, 2021
58feb91
#1863 - QuestDB integration (table per datapoint) - refactor
arturro96 Dec 15, 2021
b2cb0d1
Merge branch 'preview/2.7.1' into feature/#1863_questdb_new_schema
arturro96 Dec 15, 2021
cb4d69e
#1863 - questDB integration - fix migration version
arturro96 Dec 15, 2021
720407c
#1863 Fix Mocha JS testing
radek2s Dec 15, 2021
85f67ff
#1863 - questDB integration - removed PointValueService from DataPoin…
arturro96 Dec 17, 2021
3332a26
#1986 Fixed permission for editing - correct security dwr init/save/d…
Limraj Dec 20, 2021
8fdc2a1
#1863 - questDB integration - init_object_test_junit
Limraj Dec 20, 2021
a59e885
Merge branch 'init_object_test_junit' of https://github.com/SCADA-LTS…
Limraj Dec 20, 2021
24945dd
#1863 - questDb integration - moved context.xml and postgres lib to t…
arturro96 Dec 22, 2021
ee9e24b
Merge branch 'preview/2.7.1' into feature/#1863_questdb_new_schema
arturro96 Dec 22, 2021
06b0e7a
#1863 - questDb integration - added missing things after resolving co…
arturro96 Dec 22, 2021
1b081c3
Merge branch 'feature/#1863_questdb_new_schema' into init_object_test…
arturro96 Dec 22, 2021
1d09b41
Merge pull request #2002 from SCADA-LTS/init_object_test_junit
arturro96 Dec 22, 2021
318f73c
#1863 QuestDB new schema - correct migration (overwrite); correct sch…
Limraj Dec 23, 2021
4de3e67
#1863 - questDb integration - fixes after adding dataType column
arturro96 Dec 23, 2021
db9d0ee
#1863 QuestDB new schema - correct migration
Limraj Dec 31, 2021
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
Binary file added WebContent/WEB-INF/lib/questdb-jdk8-6.0.1.jar
Binary file not shown.
4 changes: 4 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@
haltonfailure="yes">
</test>

<test name="org.scada_lts.InitObjectTestsSuite"
haltonfailure="yes">
</test>
</junit>

<junitreport todir="${build-project.test.report}">
Expand Down Expand Up @@ -660,6 +663,7 @@
<pathelement location="WebContent/WEB-INF/lib/xmlsec-1.4.3.jar"/>
<pathelement location="WebContent/WEB-INF/lib/cache-api-1.1.1.jar"/>
<pathelement location="WebContent/WEB-INF/lib/ehcache-3.9.4.jar"/>
<pathelement location="WebContent/WEB-INF/lib/questdb-jdk8-6.0.1.jar"/>
<pathelement location="WebContent/WEB-INF/classes"/>
</path>
<path id="EAR Libraries.libraryclasspath"/>
Expand Down
3 changes: 3 additions & 0 deletions scadalts-ui/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
"systemsettings.notification.save.systemevent": "System Event Types Settings saved!",
"systemsettings.notification.save.systeminfo": "Systeminfo-Einstellungen gespeichert!",
"systemsettings.notification.send.email": "E-Mail wurde gesendet an ",
"systemsettings.notification.save.dbquery": "DbQuery Einstellungen gespeichert!",
"systemsettings.scadaconf.aclServer": "Zugriffskontrolllistenserver",
"systemsettings.scadaconf.apiReplaceAlertOnView": "Ersetzen Sie die angezeigte Warnung",
"systemsettings.scadaconf.cacheEnable": "Event cache",
Expand All @@ -356,6 +357,8 @@
"systemsettings.scadaconf.useCacheDataSourcePointsWhenSystemIsReady": "Verwenden Sie Cache-Datenquellenpunkte, wenn das System bereit ist",
"systemsettings.smsdomain.label": "SMS-Gateway-Serveradresse",
"systemsettings.smsdomain.title": "SMS Domain",
"systemsettings.dbquery.title": "DBQuery-Einstellungen",
"systemsettings.dbquery.readEnabled": "Lesen aktivieren",
"systemsettings.title": "Systemeinstellungen",
"systemsettings.tooltip.derbydatabase": "Die Derby-Datenbank ist in dieser ScadaLTS-Version nicht verfügbar!",
"systemsettings.tooltip.purgedata": "Löschen Sie die Zustimmung zum historischen Datenpunkt",
Expand Down
3 changes: 3 additions & 0 deletions scadalts-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@
"systemsettings.notification.save.systemevent": "System Event Types settings saved!",
"systemsettings.notification.save.systeminfo": "System info settings saved!",
"systemsettings.notification.send.email": "Email has been sent to ",
"systemsettings.notification.save.dbquery": "DbQuery settings saved!",
"systemsettings.scadaconf.aclServer": "Access Control List server",
"systemsettings.scadaconf.apiReplaceAlertOnView": "Replace alert on view",
"systemsettings.scadaconf.cacheEnable": "Event cache",
Expand All @@ -806,6 +807,8 @@
"systemsettings.scadaconf.useCacheDataSourcePointsWhenSystemIsReady": "Use cache data sources points when the system is ready",
"systemsettings.smsdomain.label": "SMS-Gateway server address",
"systemsettings.smsdomain.title": "SMS Domain",
"systemsettings.dbquery.title": "DBQuery settings",
"systemsettings.dbquery.readEnabled": "Enable read",
"systemsettings.title": "System settings",
"systemsettings.tooltip.derbydatabase": "Derby database is unavailable in this ScadaLTS version!",
"systemsettings.tooltip.purgedata": "Delete all historical datapoint values",
Expand Down
18 changes: 18 additions & 0 deletions scadalts-ui/src/store/systemSettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const storeSystemSettings = {
schemaVersion: undefined,
scadaConfig: undefined,
defaultLoggingType: undefined,
dbQuerySettings: undefined,
},
mutations: {
setDatabaseType(state, databaseType) {
Expand Down Expand Up @@ -71,6 +72,9 @@ const storeSystemSettings = {
setDefaultLoggingType(state, defaultLoggingType) {
state.defaultLoggingType = defaultLoggingType;
},
setDbQuerySettings(state, dbQuerySettings) {
state.dbQuerySettings = dbQuerySettings;
},
},
actions: {
getDatabaseType({ commit, dispatch }) {
Expand Down Expand Up @@ -272,6 +276,20 @@ const storeSystemSettings = {
});
},

getDbQuerySettings({ commit, dispatch }) {
return dispatch('requestGet', '/systemSettings/getDbQuerySettings').then((r) => {
commit('setDbQuerySettings', r);
return r;
});
},

saveDbQuerySettings({ state, dispatch }) {
return dispatch('requestPost', {
url: '/systemSettings/saveDbQuerySettings',
data: state.dbQuerySettings,
});
},

purgeData(context) {
return new Promise((resolve, reject) => {
axios
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<template>
<v-col cols="12" md="6">
<v-card>
<v-card-title>
{{ $t('systemsettings.dbquery.title') }}
<span v-if="isDbQueryEdited">*</span>
</v-card-title>
<v-card-text>
<v-row>
<v-col cols="12">
<v-switch
v-model="dbQuerySettings.readEnabled"
:label="$t('systemsettings.dbquery.readEnabled')"
@click="watchRadioDataChagne(dbQuerySettings.readEnabled)"
></v-switch>
</v-col>
</v-row>
</v-card-text>
</v-card>

<v-snackbar v-model="response.status" :color="response.color">
{{ response.message }}
</v-snackbar>
</v-col>
</template>
<script>

export default {
name: 'DbQuerySettingsComponent',

data() {
return {
dbQuerySettings: undefined,
dbQuerySettingsStore: undefined,
isDbQueryEdited: false,
response: {
color: 'success',
status: false,
message: '',
},
};
},

mounted() {
this.fetchData();
},

methods: {
async fetchData() {
this.dbQuerySettings = await this.$store.dispatch('getDbQuerySettings');
this.dbQuerySettingsStore = this.copyDataFromStore();
},

saveData() {
console.log('Saved!');
this.$store.commit('setDbQuerySettings', this.dbQuerySettings);
this.dbQuerySettingsStore = this.copyDataFromStore();
this.$store
.dispatch('saveDbQuerySettings')
.then((resp) => {
if (resp) {
this.restoreData();
this.response = {
status: true,
message: this.$t('systemsettings.notification.save.dbquery'),
color: 'success',
};
}
})
.catch(() => {
this.response = {
status: true,
message: this.$t('systemsettings.notification.fail'),
color: 'danger',
};
});
},

restoreData() {
this.fetchData();
this.isDbQueryEdited = false;
},

copyDataFromStore() {
return JSON.parse(JSON.stringify(this.$store.state.systemSettings.dbQuerySettings));
},

watchRadioDataChagne(value) {
this.dbQuerySettings.readEnabled = value;
this.watchDataChange();
},

async watchDataChange() {
this.isDbQueryEdited = await this.isDataChanged();
this.emitData(this.isDbQueryEdited);
},

async isDataChanged() {
return !(await this.$store.dispatch('configurationEqual', {
object1: this.dbQuerySettings,
object2: this.dbQuerySettingsStore,
}));
},

emitData(changed) {
this.$emit('changed', {
component: 'dbQuerySettingsComponent',
title: 'systemsettings.dbquery.title',
changed: changed,
data: this.sumarizeDataChanges(),
});
},

sumarizeDataChanges() {
let data = [];
for (let key in this.dbQuerySettings) {
if (this.dbQuerySettings[key] !== this.dbQuerySettingsStore[key]) {
data.push({
label: `systemsettings.dbquery.${key}`,
originalData: this.dbQuerySettingsStore[key],
changedData: this.dbQuerySettings[key],
});
}
}
return data;
},
},
};
</script>
<style></style>
9 changes: 8 additions & 1 deletion scadalts-ui/src/views/System/SystemSettings/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
<ScadaConfigurationComponent
id="scada-configuration"
></ScadaConfigurationComponent>
<DbQuerySettingsComponent
ref="dbQuerySettingsComponent"
@changed="componentChanged"
></DbQuerySettingsComponent>
<ScadaConfigurationComponent></ScadaConfigurationComponent>
</v-row>
</v-col>
</v-row>
Expand Down Expand Up @@ -281,6 +286,7 @@ import SmsDomainSettingsComponent from './SmsDomainSettingsComponent';
import ScadaConfigurationComponent from './ScadaConfigurationComponent';
import AmChartSettingsComponent from './AmChartSettingsComponent';
import DataBaseInfoComponent from './DataBaseInfoComponent';
import DbQuerySettingsComponent from './DbQuerySettingsComponent';

export default {
el: '#systemsettings',
Expand All @@ -298,6 +304,7 @@ export default {
ScadaConfigurationComponent,
AmChartSettingsComponent,
DataBaseInfoComponent,
DbQuerySettingsComponent,
},
filters: {
blank: function (value) {
Expand Down Expand Up @@ -347,7 +354,7 @@ export default {
setTimeout(() => {
let el = document.getElementById(element);
if(!!el) {
el.scrollIntoView();
el.scrollIntoView();
}
}, 1000);
}
Expand Down
1 change: 1 addition & 0 deletions src/com/serotonin/mango/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public interface ContextKeys {
String HTTP_RECEIVER_MULTICASTER = "HTTP_RECEIVER_MULTICASTER";
String DOCUMENTATION_MANIFEST = "DOCUMENTATION_MANIFEST";
String DATA_POINTS_NAME_ID_MAPPING = "DATAPOINTS_NAME_ID_MAPPING";
String DATABASE_QUERY_ACCESS = "DATABASE_QUERY_ACCESS";
}

public interface TimePeriods {
Expand Down
20 changes: 19 additions & 1 deletion src/com/serotonin/mango/MangoContextListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,31 @@ private void databaseInitialize(ServletContext ctx) {
DatabaseAccess databaseAccess = DatabaseAccess
.createDatabaseAccess(ctx);
ctx.setAttribute(Common.ContextKeys.DATABASE_ACCESS, databaseAccess);
databaseAccess.initialize();
boolean dbQueryEnabled = Common.getEnvironmentProfile().getBoolean("dbquery.enabled",
false);
if(dbQueryEnabled) {
DatabaseAccess databaseQueryAccess = DatabaseAccess
.createDatabaseAccess(ctx, "dbquery.");
ctx.setAttribute(Common.ContextKeys.DATABASE_QUERY_ACCESS, databaseQueryAccess);

databaseAccess.initOnlyDatasourceJdbc();
databaseQueryAccess.initOnlyDatasourceJdbc();

databaseAccess.initialize();
databaseQueryAccess.initialize();
} else {
databaseAccess.initialize();
}
}

private void databaseTerminate(ContextWrapper ctx) {
DatabaseAccess databaseAccess = ctx.getDatabaseAccess();
if (databaseAccess != null)
databaseAccess.terminate();

DatabaseAccess databaseQueryAccess = ctx.getDatabaseQueryAccess();
if(databaseQueryAccess != null)
databaseQueryAccess.terminate();
}

//
Expand Down
19 changes: 12 additions & 7 deletions src/com/serotonin/mango/db/BasePooledAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,23 @@ public BasePooledAccess(ServletContext ctx)
super(ctx);
}

public BasePooledAccess(ServletContext ctx, String dbPrefix)
{
super(ctx, dbPrefix);
}

@SuppressWarnings("deprecation")
@Override
protected void initializeImpl(String propertyPrefix, String dataSourceName)
{
log.info("Initializing pooled connection manager");

if(Common.getEnvironmentProfile().getString(propertyPrefix + "db.datasource", "false").equals("true"))
if(Common.getEnvironmentProfile().getString(propertyPrefix + getDbPrefix() + "datasource", "false").equals("true"))
{
try
{
log.info("Looking for Datasource: " + Common.getEnvironmentProfile().getString(propertyPrefix + "db.datasourceName"));
dataSource = (DataSource) new InitialContext().lookup(Common.getEnvironmentProfile().getString(propertyPrefix + "db.datasourceName"));
log.info("Looking for Datasource: " + Common.getEnvironmentProfile().getString(propertyPrefix + getDbPrefix() + "datasourceName"));
dataSource = (DataSource) new InitialContext().lookup(Common.getEnvironmentProfile().getString(propertyPrefix + getDbPrefix() + "datasourceName"));
Connection conn = dataSource.getConnection();
log.info("DataSource meta: " + conn.getMetaData().getDatabaseProductName() + " " + conn.getMetaData().getDatabaseProductVersion());
dataSourceFound = true;
Expand All @@ -84,15 +89,15 @@ protected void initializeImpl(String propertyPrefix)
dataSource = new BasicDataSource();
((BasicDataSource) dataSource).setDriverClassName(getDriverClassName());
((BasicDataSource) dataSource).setUrl(getUrl(propertyPrefix));
((BasicDataSource) dataSource).setUsername(Common.getEnvironmentProfile().getString(propertyPrefix + "db.username"));
((BasicDataSource) dataSource).setUsername(Common.getEnvironmentProfile().getString(propertyPrefix + getDbPrefix() + "username"));
((BasicDataSource) dataSource).setPassword(getDatabasePassword(propertyPrefix));
((BasicDataSource) dataSource).setMaxActive(Common.getEnvironmentProfile().getInt(propertyPrefix + "db.pool.maxActive", 10));
((BasicDataSource) dataSource).setMaxIdle(Common.getEnvironmentProfile().getInt(propertyPrefix + "db.pool.maxIdle", 10));
((BasicDataSource) dataSource).setMaxActive(Common.getEnvironmentProfile().getInt(propertyPrefix + getDbPrefix() + "pool.maxActive", 10));
((BasicDataSource) dataSource).setMaxIdle(Common.getEnvironmentProfile().getInt(propertyPrefix + getDbPrefix() + "pool.maxIdle", 10));
}

protected String getUrl(String propertyPrefix)
{
return Common.getEnvironmentProfile().getString(propertyPrefix + "db.url");
return Common.getEnvironmentProfile().getString(propertyPrefix + getDbPrefix() + "url");
}

abstract protected String getDriverClassName();
Expand Down
Loading