From 31fd54c6be015b77bab270f9f01c4bc1257b033a Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 30 Sep 2022 14:23:54 +0200 Subject: [PATCH 1/5] adds update functionality for SCViewer --- .launch/Build SCViewer.launch | 4 + .launch/Set SCViewer version.launch | 4 + .../Application.e4xmi | 2 +- .../application/handlers/UpdateHandler.java | 134 ++++++++++++++++-- .../scviewer.product | 4 +- .../com.minres.scviewer.target.target | 4 +- .../category.xml | 12 ++ 7 files changed, 151 insertions(+), 13 deletions(-) diff --git a/.launch/Build SCViewer.launch b/.launch/Build SCViewer.launch index 267d93e..6f30297 100644 --- a/.launch/Build SCViewer.launch +++ b/.launch/Build SCViewer.launch @@ -1,5 +1,6 @@ + @@ -12,6 +13,9 @@ + + + diff --git a/.launch/Set SCViewer version.launch b/.launch/Set SCViewer version.launch index cf907bd..d293261 100644 --- a/.launch/Set SCViewer version.launch +++ b/.launch/Set SCViewer version.launch @@ -1,5 +1,6 @@ + @@ -15,6 +16,9 @@ + + + diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index b4b56a0..f896b0f 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -56,7 +56,7 @@ - + diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/UpdateHandler.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/UpdateHandler.java index 1c26b8d..077ac14 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/UpdateHandler.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/UpdateHandler.java @@ -1,24 +1,140 @@ - package com.minres.scviewer.e4.application.handlers; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.ui.di.UISynchronize; import org.eclipse.e4.ui.workbench.IWorkbench; import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.operations.ProvisioningJob; import org.eclipse.equinox.p2.operations.ProvisioningSession; import org.eclipse.equinox.p2.operations.UpdateOperation; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; public class UpdateHandler { + + boolean cancelled = false; + @Execute - public void execute(IProvisioningAgent agent, UISynchronize synchronize, IWorkbench workbench) { - ProvisioningSession session = new ProvisioningSession(agent); - UpdateOperation operation = new UpdateOperation(session); - IStatus status = operation.resolveModal(null); - if(status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) { - MessageDialog.openInformation(null, "Information", "Nothing to update"); + public void execute(IProvisioningAgent agent, UISynchronize sync, IWorkbench workbench) { + // update using a progress monitor + IRunnableWithProgress runnable = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + update(agent, monitor, sync, workbench); + } + }; + try { + new ProgressMonitorDialog(null).run(true, true, runnable); + } catch (InvocationTargetException | InterruptedException e) { + e.printStackTrace(); } } - -} \ No newline at end of file + + private IStatus update(IProvisioningAgent agent, IProgressMonitor monitor, UISynchronize sync, + IWorkbench workbench) { + ProvisioningSession session = new ProvisioningSession(agent); + // update the whole running profile, otherwise specify IUs + UpdateOperation operation = new UpdateOperation(session); + try { + operation.getProvisioningContext().setArtifactRepositories(new URI("http://https://minres.github.io/SCViewer/repository")); + operation.getProvisioningContext().setMetadataRepositories(new URI("http://https://minres.github.io/SCViewer/repository")); + } catch (URISyntaxException e) {} + SubMonitor sub = SubMonitor.convert(monitor, "Checking for application updates...", 200); + // check if updates are available + IStatus status = operation.resolveModal(sub.newChild(100)); + if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) { + showMessage(sync, "Nothing to update"); + return Status.CANCEL_STATUS; + } else { + ProvisioningJob provisioningJob = operation.getProvisioningJob(sub.newChild(100)); + if (provisioningJob != null) { + sync.syncExec(new Runnable() { + @Override + public void run() { + boolean performUpdate = MessageDialog.openQuestion(null, "Updates available", + "There are updates available. Do you want to install them now?"); + if (performUpdate) { + provisioningJob.addJobChangeListener(new JobChangeAdapter() { + @Override + public void done(IJobChangeEvent event) { + if (event.getResult().isOK()) { + sync.syncExec(new Runnable() { + + @Override + public void run() { + boolean restart = MessageDialog.openQuestion(null, + "Updates installed, restart?", + "Updates have been installed successfully, do you want to restart?"); + if (restart) { + workbench.restart(); + } + } + }); + } else { + showError(sync, event.getResult().getMessage()); + cancelled = true; + } + } + }); + // since we switched to the UI thread for interacting with the user + // we need to schedule the provisioning thread, otherwise it would + // be executed also in the UI thread and not in a background thread + provisioningJob.schedule(); + } else { + cancelled = true; + } + } + }); + } else { + if (operation.hasResolved()) { + showError(sync, "Couldn't get provisioning job: " + operation.getResolutionResult()); + } else { + showError(sync, "Couldn't resolve provisioning job"); + } + cancelled = true; + } + } + if (cancelled) { + // reset cancelled flag + cancelled = false; + return Status.CANCEL_STATUS; + } + return Status.OK_STATUS; + } + + private void showMessage(UISynchronize sync, final String message) { + // as the provision needs to be executed in a background thread + // we need to ensure that the message dialog is executed in + // the UI thread + sync.syncExec(new Runnable() { + + @Override + public void run() { + MessageDialog.openInformation(null, "Information", message); + } + }); + } + + private void showError(UISynchronize sync, final String message) { + // as the provision needs to be executed in a background thread + // we need to ensure that the message dialog is executed in + // the UI thread + sync.syncExec(new Runnable() { + @Override + public void run() { + MessageDialog.openError(null, "Error", message); + } + }); + } +} diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index 63caa8e..062b842 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -1,7 +1,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/releng/com.minres.scviewer.target/com.minres.scviewer.target.target b/releng/com.minres.scviewer.target/com.minres.scviewer.target.target index e77999c..d36c8ee 100644 --- a/releng/com.minres.scviewer.target/com.minres.scviewer.target.target +++ b/releng/com.minres.scviewer.target/com.minres.scviewer.target.target @@ -12,6 +12,8 @@ + + @@ -26,7 +28,7 @@ - + diff --git a/releng/com.minres.scviewer.updateSite/category.xml b/releng/com.minres.scviewer.updateSite/category.xml index 204beb5..9eaf4bb 100644 --- a/releng/com.minres.scviewer.updateSite/category.xml +++ b/releng/com.minres.scviewer.updateSite/category.xml @@ -18,6 +18,15 @@ + + + + + + + + + Viewer for transaction recording outputs of the SystemC Verification (SCV) library @@ -29,4 +38,7 @@ + + + From 25064f9744b4134589d22d4e6f08d23693e6053e Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 30 Sep 2022 15:28:48 +0200 Subject: [PATCH 2/5] externalizes strings --- .../scviewer/e4/application/Messages.java | 11 +++ .../application/handlers/UpdateHandler.java | 68 +++++++------------ .../e4/application/messages.properties | 12 +++- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/Messages.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/Messages.java index 6e683f4..1b1eee8 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/Messages.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/Messages.java @@ -95,6 +95,17 @@ public class Messages extends NLS { public static String marker_text; public static String rel_arrow; public static String rel_arrow_highlite; + public static String UpdateHandler_URI; + public static String UpdateHandler_10; + public static String UpdateHandler_11; + public static String UpdateHandler_2; + public static String UpdateHandler_3; + public static String UpdateHandler_4; + public static String UpdateHandler_5; + public static String UpdateHandler_6; + public static String UpdateHandler_7; + public static String UpdateHandler_8; + public static String UpdateHandler_9; static { // initialize resource bundle diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/UpdateHandler.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/UpdateHandler.java index 077ac14..ed3d562 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/UpdateHandler.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/UpdateHandler.java @@ -21,13 +21,14 @@ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; +import com.minres.scviewer.e4.application.Messages; + public class UpdateHandler { boolean cancelled = false; @Execute public void execute(IProvisioningAgent agent, UISynchronize sync, IWorkbench workbench) { - // update using a progress monitor IRunnableWithProgress runnable = new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { @@ -44,17 +45,18 @@ public class UpdateHandler { private IStatus update(IProvisioningAgent agent, IProgressMonitor monitor, UISynchronize sync, IWorkbench workbench) { ProvisioningSession session = new ProvisioningSession(agent); - // update the whole running profile, otherwise specify IUs UpdateOperation operation = new UpdateOperation(session); try { - operation.getProvisioningContext().setArtifactRepositories(new URI("http://https://minres.github.io/SCViewer/repository")); - operation.getProvisioningContext().setMetadataRepositories(new URI("http://https://minres.github.io/SCViewer/repository")); - } catch (URISyntaxException e) {} - SubMonitor sub = SubMonitor.convert(monitor, "Checking for application updates...", 200); - // check if updates are available + operation.getProvisioningContext().setArtifactRepositories(new URI(Messages.UpdateHandler_URI)); + operation.getProvisioningContext().setMetadataRepositories(new URI(Messages.UpdateHandler_URI)); + } catch (URISyntaxException e) { + } + SubMonitor sub = SubMonitor.convert(monitor, Messages.UpdateHandler_2, 200); IStatus status = operation.resolveModal(sub.newChild(100)); if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) { - showMessage(sync, "Nothing to update"); + sync.syncExec(() -> { + MessageDialog.openInformation(null, Messages.UpdateHandler_10, Messages.UpdateHandler_3); + }); return Status.CANCEL_STATUS; } else { ProvisioningJob provisioningJob = operation.getProvisioningJob(sub.newChild(100)); @@ -62,8 +64,8 @@ public class UpdateHandler { sync.syncExec(new Runnable() { @Override public void run() { - boolean performUpdate = MessageDialog.openQuestion(null, "Updates available", - "There are updates available. Do you want to install them now?"); + boolean performUpdate = MessageDialog.openQuestion(null, Messages.UpdateHandler_4, + Messages.UpdateHandler_5); if (performUpdate) { provisioningJob.addJobChangeListener(new JobChangeAdapter() { @Override @@ -74,22 +76,21 @@ public class UpdateHandler { @Override public void run() { boolean restart = MessageDialog.openQuestion(null, - "Updates installed, restart?", - "Updates have been installed successfully, do you want to restart?"); + Messages.UpdateHandler_6, Messages.UpdateHandler_7); if (restart) { workbench.restart(); } } }); } else { - showError(sync, event.getResult().getMessage()); + sync.syncExec(() -> { + MessageDialog.openInformation(null, Messages.UpdateHandler_11, + event.getResult().getMessage()); + }); cancelled = true; } } }); - // since we switched to the UI thread for interacting with the user - // we need to schedule the provisioning thread, otherwise it would - // be executed also in the UI thread and not in a background thread provisioningJob.schedule(); } else { cancelled = true; @@ -98,43 +99,22 @@ public class UpdateHandler { }); } else { if (operation.hasResolved()) { - showError(sync, "Couldn't get provisioning job: " + operation.getResolutionResult()); + sync.syncExec(() -> { + MessageDialog.openInformation(null, Messages.UpdateHandler_11, + Messages.UpdateHandler_8 + operation.getResolutionResult()); + }); } else { - showError(sync, "Couldn't resolve provisioning job"); + sync.syncExec(() -> { + MessageDialog.openInformation(null, Messages.UpdateHandler_11, Messages.UpdateHandler_9); + }); } cancelled = true; } } if (cancelled) { - // reset cancelled flag cancelled = false; return Status.CANCEL_STATUS; } return Status.OK_STATUS; } - - private void showMessage(UISynchronize sync, final String message) { - // as the provision needs to be executed in a background thread - // we need to ensure that the message dialog is executed in - // the UI thread - sync.syncExec(new Runnable() { - - @Override - public void run() { - MessageDialog.openInformation(null, "Information", message); - } - }); - } - - private void showError(UISynchronize sync, final String message) { - // as the provision needs to be executed in a background thread - // we need to ensure that the message dialog is executed in - // the UI thread - sync.syncExec(new Runnable() { - @Override - public void run() { - MessageDialog.openError(null, "Error", message); - } - }); - } } diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index 1266f5a..b5ae1dc 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -89,4 +89,14 @@ marker=Marker marker_text=Marker TExt rel_arrow=Relation arrow rel_arrow_highlite=highlighted Relation arrorw - +UpdateHandler_URI=http://https://minres.github.io/SCViewer/repository +UpdateHandler_10=Information +UpdateHandler_11=Error +UpdateHandler_2=Checking for application updates... +UpdateHandler_3=Nothing to update +UpdateHandler_4=Updates available +UpdateHandler_5=There are updates available. Do you want to install them now? +UpdateHandler_6=Updates installed, restart? +UpdateHandler_7=Updates have been installed successfully, do you want to restart? +UpdateHandler_8=Couldn't get provisioning job: +UpdateHandler_9=Couldn't resolve provisioning job From 0e705ce0e9aa3a61ed9bc2cf14a5cd95e0817aa9 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 21 Feb 2023 09:10:35 +0100 Subject: [PATCH 3/5] adds initial version of FTR reader --- .../feature.xml | 7 + .../.classpath | 11 + .../.gitignore | 3 + .../com.minres.scviewer.database.ftr/.project | 39 ++ .../META-INF/MANIFEST.MF | 18 + .../OSGI-INF/component.xml | 7 + .../build.properties | 14 + .../com.minres.scviewer.database.ftr/pom.xml | 14 + .../database/ftr/AbstractTxStream.java | 190 +++++++ .../scviewer/database/ftr/FtrDbLoader.java | 475 ++++++++++++++++ .../database/ftr/FtrDbLoaderFactory.java | 68 +++ .../scviewer/database/ftr/FtrRelation.java | 47 ++ .../minres/scviewer/database/ftr/FtrTx.java | 93 ++++ .../com/minres/scviewer/database/ftr/Tx.java | 233 ++++++++ .../scviewer/database/ftr/TxAttribute.java | 85 +++ .../database/ftr/TxAttributeType.java | 84 +++ .../minres/scviewer/database/ftr/TxEvent.java | 120 ++++ .../scviewer/database/ftr/TxGenerator.java | 96 ++++ .../scviewer/database/ftr/TxRelation.java | 69 +++ .../scviewer/database/ftr/TxStream.java | 73 +++ .../src/jacob/CborConstants.java | 89 +++ .../src/jacob/CborDecoder.java | 515 ++++++++++++++++++ .../src/jacob/CborEncoder.java | 488 +++++++++++++++++ .../src/jacob/CborType.java | 142 +++++ .../src/jacob/packageinfo | 1 + .../database/text/AbstractTxStream.java | 4 +- .../ui/swt/internal/WaveformView.java | 2 + .../META-INF/MANIFEST.MF | 2 + .../minres/scviewer/database/DataType.java | 7 +- .../database/internal/WaveformDb.java | 10 +- .../application/handlers/NavigateEvent.java | 2 +- .../e4/application/messages.properties | 2 +- pom.xml | 1 + .../scviewer.product | 1 + .../com.minres.scviewer.target.target | 8 +- .../DatabaseServicesTest.launch | 3 + .../inputs/my_db.ftr | Bin 0 -> 1774 bytes .../database/test/DatabaseServicesTest.java | 52 +- 38 files changed, 3061 insertions(+), 14 deletions(-) create mode 100644 plugins/com.minres.scviewer.database.ftr/.classpath create mode 100644 plugins/com.minres.scviewer.database.ftr/.gitignore create mode 100644 plugins/com.minres.scviewer.database.ftr/.project create mode 100644 plugins/com.minres.scviewer.database.ftr/META-INF/MANIFEST.MF create mode 100644 plugins/com.minres.scviewer.database.ftr/OSGI-INF/component.xml create mode 100644 plugins/com.minres.scviewer.database.ftr/build.properties create mode 100644 plugins/com.minres.scviewer.database.ftr/pom.xml create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/AbstractTxStream.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoaderFactory.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrRelation.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrTx.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/Tx.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxAttribute.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxAttributeType.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxEvent.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxGenerator.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxRelation.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxStream.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/jacob/CborConstants.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/jacob/CborDecoder.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/jacob/CborEncoder.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/jacob/CborType.java create mode 100644 plugins/com.minres.scviewer.database.ftr/src/jacob/packageinfo create mode 100644 tests/com.minres.scviewer.database.test/inputs/my_db.ftr diff --git a/features/com.minres.scviewer.database.feature/feature.xml b/features/com.minres.scviewer.database.feature/feature.xml index 2f9f01a..0aa2e38 100644 --- a/features/com.minres.scviewer.database.feature/feature.xml +++ b/features/com.minres.scviewer.database.feature/feature.xml @@ -70,4 +70,11 @@ http://www.eclipse.org/legal/epl-v10.html version="0.0.0" unpack="false"/> + + diff --git a/plugins/com.minres.scviewer.database.ftr/.classpath b/plugins/com.minres.scviewer.database.ftr/.classpath new file mode 100644 index 0000000..685a699 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/plugins/com.minres.scviewer.database.ftr/.gitignore b/plugins/com.minres.scviewer.database.ftr/.gitignore new file mode 100644 index 0000000..57f4ab0 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/.gitignore @@ -0,0 +1,3 @@ +/bin +/target/ +/.settings/ diff --git a/plugins/com.minres.scviewer.database.ftr/.project b/plugins/com.minres.scviewer.database.ftr/.project new file mode 100644 index 0000000..4c4a7e3 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/.project @@ -0,0 +1,39 @@ + + + com.minres.scviewer.database.ftr + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/plugins/com.minres.scviewer.database.ftr/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.database.ftr/META-INF/MANIFEST.MF new file mode 100644 index 0000000..a517a3d --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: CBOR transaction database +Bundle-SymbolicName: com.minres.scviewer.database.ftr +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: MINRES Technologies GmbH +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Import-Package: org.osgi.framework;version="1.3.0", + org.slf4j;version="1.7.2" +Require-Bundle: com.minres.scviewer.database, + org.eclipse.osgi.services;bundle-version="3.4.0", + com.google.guava;bundle-version="15.0.0", + org.eclipse.collections;bundle-version="10.4.0", + org.apache.commons.compress;bundle-version="1.20.0" +Service-Component: OSGI-INF/component.xml +Bundle-ActivationPolicy: lazy +Automatic-Module-Name: com.minres.scviewer.database.ftr +Bundle-ClassPath: . diff --git a/plugins/com.minres.scviewer.database.ftr/OSGI-INF/component.xml b/plugins/com.minres.scviewer.database.ftr/OSGI-INF/component.xml new file mode 100644 index 0000000..1f2eab0 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/OSGI-INF/component.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/com.minres.scviewer.database.ftr/build.properties b/plugins/com.minres.scviewer.database.ftr/build.properties new file mode 100644 index 0000000..8e6dc18 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/build.properties @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2014, 2015-2021 MINRES Technologies GmbH and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# MINRES Technologies GmbH - initial API and implementation +############################################################################### +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ +source.. = src/ diff --git a/plugins/com.minres.scviewer.database.ftr/pom.xml b/plugins/com.minres.scviewer.database.ftr/pom.xml new file mode 100644 index 0000000..fb19581 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/pom.xml @@ -0,0 +1,14 @@ + + 4.0.0 + com.minres.scviewer.database.ftr + 1.0.0-SNAPSHOT + + com.minres.scviewer + com.minres.scviewer.parent + 2.16.1 + ../.. + + eclipse-plugin + + diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/AbstractTxStream.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/AbstractTxStream.java new file mode 100644 index 0000000..1c2eff4 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/AbstractTxStream.java @@ -0,0 +1,190 @@ +/******************************************************************************* + * Copyright (c) 2012 IT Just working + * Copyright (c) 2020 MINRES Technologies GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IT Just working - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import java.util.ArrayList; +import java.util.HashMap; + +import com.minres.scviewer.database.EventEntry; +import com.minres.scviewer.database.EventList; +import com.minres.scviewer.database.HierNode; +import com.minres.scviewer.database.IEvent; +import com.minres.scviewer.database.IEventList; +import com.minres.scviewer.database.IWaveform; +import com.minres.scviewer.database.WaveformType; +import com.minres.scviewer.database.tx.ITx; +import com.minres.scviewer.database.tx.ITxEvent; + +/** + * The Class AbstractTxStream. + */ +abstract class AbstractTxStream extends HierNode implements IWaveform { + + private final String fullName; + + /** The id. */ + private Long id; + + /** The loader. */ + protected FtrDbLoader loader; + + /** The events. */ + IEventList events = new EventList(); + + /** The max concurrency. */ + private int rowCount = -1; + + /** + * Instantiates a new abstract tx stream. + * + * @param loader the loader + * @param id the id + * @param name the name + */ + protected AbstractTxStream(FtrDbLoader loader, Long id, String name) { + super(name); + fullName=name; + this.loader = loader; + this.id = id; + } + + /** + * Gets the full hierarchical name. + * + * @return the full name + */ + @Override + public String getFullName() { + return fullName; + } + /** + * Adds the event. + * + * @param evt the evt + */ + public void addEvent(ITxEvent evt) { + events.put(evt.getTime(), evt); + } + + /** + * Gets the events. + * + * @return the events + */ + @Override + public IEventList getEvents() { + return events; + } + + /** + * Gets the events at time. + * + * @param time the time + * @return the events at time + */ + @Override + public IEvent[] getEventsAtTime(long time) { + return events.get(time); + } + + /** + * Gets the events before time. + * + * @param time the time + * @return the events before time + */ + @Override + public IEvent[] getEventsBeforeTime(long time) { + EventEntry e = events.floorEntry(time); + if (e == null) + return new IEvent[] {}; + else + return events.floorEntry(time).events; + } + + /** + * Gets the type. + * + * @return the type + */ + @Override + public WaveformType getType() { + return WaveformType.TRANSACTION; + } + + /** + * Gets the id. + * + * @return the id + */ + @Override + public long getId() { + return id; + } + + /** + * Gets the width. + * + * @return the width + */ + @Override + public int getRowCount() { + if (rowCount<0) + calculateConcurrency(); + return rowCount; + } + + /** + * Calculate concurrency. + */ + void calculateConcurrency() { + if (rowCount>=0) + return; + ArrayList rowEndTime = new ArrayList<>(); + HashMap rowByTxId = new HashMap<>(); + for(EventEntry entry: events) { + for(IEvent evt:entry.events) { + TxEvent txEvt = (TxEvent) evt; + ITx tx = txEvt.getTransaction(); + int rowIdx = 0; + switch(evt.getKind()) { + case END: //TODO: might throw NPE in concurrent execution + Long txId = txEvt.getTransaction().getId(); + txEvt.setConcurrencyIndex(rowByTxId.get(txId)); + rowByTxId.remove(txId); + break; + case SINGLE: + for (; rowIdx < rowEndTime.size() && rowEndTime.get(rowIdx)>tx.getBeginTime(); rowIdx++); + if (rowEndTime.size() <= rowIdx) + rowEndTime.add(tx.getEndTime()); + else + rowEndTime.set(rowIdx, tx.getEndTime()); + ((TxEvent) evt).setConcurrencyIndex(rowIdx); + break; + case BEGIN: + for (; rowIdx < rowEndTime.size() && rowEndTime.get(rowIdx)>tx.getBeginTime(); rowIdx++); + if (rowEndTime.size() <= rowIdx) + rowEndTime.add(tx.getEndTime()); + else + rowEndTime.set(rowIdx, tx.getEndTime()); + ((TxEvent) evt).setConcurrencyIndex(rowIdx); + rowByTxId.put(tx.getId(), rowIdx); + break; + } + } + } + rowCount=rowEndTime.size()>0?rowEndTime.size():1; + //getChildNodes().parallelStream().forEach(c -> ((TxGenerator)c).calculateConcurrency()); + getChildNodes().stream().forEach(c -> ((TxGenerator)c).calculateConcurrency()); + } + +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java new file mode 100644 index 0000000..d2f0ba0 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java @@ -0,0 +1,475 @@ +/******************************************************************************* + * Copyright (c) 2012 IT Just working. + * Copyright (c) 2020 MINRES Technologies GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IT Just working - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.channels.FileChannel; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.eclipse.collections.impl.map.mutable.UnifiedMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.HashMultimap; +import com.minres.scviewer.database.AssociationType; +import com.minres.scviewer.database.DataType; +import com.minres.scviewer.database.EventKind; +import com.minres.scviewer.database.IWaveform; +import com.minres.scviewer.database.IWaveformDb; +import com.minres.scviewer.database.IWaveformDbLoader; +import com.minres.scviewer.database.InputFormatException; +import com.minres.scviewer.database.RelationType; +import com.minres.scviewer.database.RelationTypeFactory; +import com.minres.scviewer.database.tx.ITx; +import com.minres.scviewer.database.tx.ITxAttribute; +import com.minres.scviewer.database.RelationType; + +import jacob.CborDecoder; +import jacob.CborType; + +/** + * The Class TextDbLoader. + */ +public class FtrDbLoader implements IWaveformDbLoader { + + enum FileType { NONE, PLAIN, GZIP, LZ4}; + + /** The max time. */ + private Long maxTime = 0L; + + ArrayList strDict = new ArrayList<>(); + + + /** The attr values. */ + final List attrValues = new ArrayList<>(); + + /** The relation types. */ + final Map relationTypes = UnifiedMap.newMap(); + + /** The tx streams. */ + final Map txStreams = UnifiedMap.newMap(); + + /** The tx generators. */ + final Map txGenerators = UnifiedMap.newMap(); + + /** The transactions. */ + final Map transactions = UnifiedMap.newMap(); + + /** The attribute types. */ + final Map attributeTypes = UnifiedMap.newMap(); + + /** The relations in. */ + final HashMultimap relationsIn = HashMultimap.create(); + + /** The relations out. */ + final HashMultimap relationsOut = HashMultimap.create(); + + /** The tx cache. */ + final Map txCache = UnifiedMap.newMap(); + + /** The threads. */ + List threads = new ArrayList<>(); + + File file; + + private static final Logger LOG = LoggerFactory.getLogger(FtrDbLoader.class); + + /** The pcs. */ + protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + /** The Constant x. */ + static final byte[] x = "scv_tr_stream".getBytes(); + + /** + * Adds the property change listener. + * + * @param l the l + */ + @Override + public void addPropertyChangeListener(PropertyChangeListener l) { + pcs.addPropertyChangeListener(l); + } + + /** + * Removes the property change listener. + * + * @param l the l + */ + @Override + public void removePropertyChangeListener(PropertyChangeListener l) { + pcs.removePropertyChangeListener(l); + } + + /** + * Gets the max time. + * + * @return the max time + */ + @Override + public long getMaxTime() { + return maxTime; + } + + /** + * Gets the transaction. + * + * @param txId the tx id + * @return the transaction + */ + public ITx getTransaction(long txId) { + if (txCache.containsKey(txId)) + return txCache.get(txId); + if(transactions.containsKey(txId)) { + Tx tx = new Tx(this, transactions.get(txId)); + txCache.put(txId, tx); + return tx; + } else { + throw new IllegalArgumentException(); + } + } + + public FtrTx getScvTx(long id) { + if(transactions.containsKey(id)) + return transactions.get(id); + else + throw new IllegalArgumentException(); + } + + /** + * Gets the all waves. + * + * @return the all waves + */ + @Override + public Collection getAllWaves() { + ArrayList ret = new ArrayList<>(txStreams.values()); + ret.addAll(txGenerators.values()); + return ret; + } + + /** + * Gets the all relation types. + * + * @return the all relation types + */ + public Collection getAllRelationTypes() { + return relationTypes.values(); + } + + /** + * Load. + * + * @param db the db + * @param file the file + * @return true, if successful + * @throws InputFormatException the input format exception + */ + @Override + public void load(IWaveformDb db, File file) throws InputFormatException { + dispose(); + this.file=file; + try(FileInputStream fis = new FileInputStream(file)) { + new CborDbParser(this, fis); + } catch (Exception e) { + LOG.error("Error parsing file "+file.getName(), e); + transactions.clear(); + throw new InputFormatException(e.toString()); + } + txStreams.values().parallelStream().forEach(TxStream::calculateConcurrency); + } + + public List getChunksAtOffsets(ArrayList fileOffsets) throws InputFormatException { + List ret = new ArrayList<>(); + try(FileInputStream fis = new FileInputStream(file)) { + FileChannel fc = fis.getChannel(); + for (Long offset : fileOffsets) { + fc.position(offset); + CborDecoder parser = new CborDecoder(fis); + ret.add(parser.readByteString()); + } + } catch (Exception e) { + LOG.error("Error parsing file "+file.getName(), e); + transactions.clear(); + throw new InputFormatException(e.toString()); + } + return ret; + } + + public List parseAtrributes(byte[] chunk, long blockOffset) { + List ret = new ArrayList<>(); + ByteArrayInputStream bais = new ByteArrayInputStream(chunk); + bais.skip(blockOffset); + CborDecoder cborDecoder = new CborDecoder(bais); + try { + long tx_size = cborDecoder.readArrayLength(); + for(long i = 0; i0?"True":"False"); + ret.add(b); + break; + case 2: // INTEGER + case 3: // UNSIGNED + ITxAttribute a = new TxAttribute(attrType, String.valueOf(cborDecoder.readInt())); + ret.add(a); + break; + case 4: // FLOATING_POINT_NUMBER + case 7: // FIXED_POINT_INTEGER + case 8: // UNSIGNED_FIXED_POINT_INTEGER + ITxAttribute v = new TxAttribute(attrType, String.valueOf(cborDecoder.readFloat())); + ret.add(v); + break; + case 1: // ENUMERATION + case 5: // BIT_VECTOR + case 6: // LOGIC_VECTOR + case 12: // STRING + ITxAttribute s = new TxAttribute(attrType, strDict.get((int)cborDecoder.readInt())); + ret.add(s); + break; + } + } + } + } + } catch (IOException e) { + LOG.error("Error parsing file "+file.getName(), e); + } + return ret; + } + + /** + * Dispose. + */ + @Override + public void dispose() { + attrValues.clear(); + relationTypes.clear(); + txStreams.clear(); + txGenerators.clear(); + transactions.clear(); + attributeTypes.clear(); + relationsIn.clear(); + relationsOut.clear(); + } + + /** + * The Class TextDbParser. + */ + static class CborDbParser extends CborDecoder { + + static final private CborType break_type = CborType.valueOf(0xff); + + /** The loader. */ + final FtrDbLoader loader; + + /** + * Instantiates a new text db parser. + * + * @param loader the loader + */ + public CborDbParser(FtrDbLoader loader, FileInputStream inputStream) { + super(inputStream); + this.loader = loader; + try { + long cbor_tag = readTag(); + assert(cbor_tag == 55799); + long array_len = readArrayLength(); + assert(array_len==-1); + CborType next = peekType(); + while(next != null && !break_type.isEqualType(next)) { + long tag = readTag(); + switch((int)tag) { + case 6: // info + break; + case 8: { // dictionary uncompressed + parseDict(new CborDecoder(new ByteArrayInputStream(readByteString()))); + break; + } + case 10: { // directory uncompressed + parseDir(new CborDecoder(new ByteArrayInputStream(readByteString()))); + break; + } + case 12: { //tx chunk uncompressed + long len = readArrayLength(); + assert(len==2); + long stream_id = readInt(); + TxStream txStream = loader.txStreams.get(stream_id); + txStream.fileOffsets.add(inputStream.getChannel().position()); + parseTx(txStream, txStream.fileOffsets.size()-1, readByteString()); + break; + } + case 14: { // relations uncompressed + parseRel(new CborDecoder(new ByteArrayInputStream(readByteString()))); + break; + } + } + next = peekType(); + } + } catch(IOException e) { + LOG.error("Error parsing file input stream", e); + } + } + + + private void parseDict(CborDecoder cborDecoder) throws IOException { + long size = cborDecoder.readMapLength(); + ArrayList lst = new ArrayList<>((int)size); + for(long i = 0; i scvTx.endTime ? loader.maxTime : scvTx.endTime; + loader.transactions.put(txId, scvTx); + TxStream stream = loader.txStreams.get(gen.stream.getId()); + if (scvTx.beginTime == scvTx.endTime) { + stream.addEvent(new TxEvent(loader, EventKind.SINGLE, txId, scvTx.beginTime)); + gen.addEvent(new TxEvent(loader, EventKind.SINGLE, txId, scvTx.beginTime)); + } else { + stream.addEvent(new TxEvent(loader, EventKind.BEGIN, txId, scvTx.beginTime)); + gen.addEvent(new TxEvent(loader, EventKind.BEGIN, txId, scvTx.beginTime)); + stream.addEvent(new TxEvent(loader, EventKind.END, txId, scvTx.endTime)); + gen.addEvent(new TxEvent(loader, EventKind.END, txId, scvTx.endTime)); + } + break; + default: { // skip over 7:begin attr, 8:record attr, 9:end attr + long sz = cborDecoder.readArrayLength(); + assert(sz==3); + for(long j = 0; j attributes = new ArrayList<>(); + + final long blockId; + + final long blockOffset; + + /** + * Instantiates a new scv tx. + * + * @param id the id + * @param streamId the stream id + * @param generatorId the generator id + * @param begin the begin + */ + FtrTx(long id, long streamId, long generatorId, long begin, long end, long blockId, long blockOffset) { + this.id = id; + this.streamId = streamId; + this.generatorId = generatorId; + this.beginTime = begin; + this.endTime = end; + this.blockId=blockId; + this.blockOffset=blockOffset; + } + + /** + * Gets the id. + * + * @return the id + */ + Long getId() { + return id; + } + + public List getAttributes(FtrDbLoader loader) { + if(attributes.size()==0) + try { + TxStream stream = loader.txStreams.get(streamId); + byte[] chunk = stream.getChunks().get((int)blockId); + attributes.addAll(loader.parseAtrributes(chunk, blockOffset)); + } catch (InputFormatException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return attributes; + } +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/Tx.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/Tx.java new file mode 100644 index 0000000..9cc0bf8 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/Tx.java @@ -0,0 +1,233 @@ +/******************************************************************************* + * Copyright (c) 2012 IT Just working. + * Copyright (c) 2020 MINRES Technologies GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IT Just working - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import com.minres.scviewer.database.IWaveform; +import com.minres.scviewer.database.InputFormatException; +import com.minres.scviewer.database.tx.ITx; +import com.minres.scviewer.database.tx.ITxAttribute; +import com.minres.scviewer.database.tx.ITxRelation; + +/** + * The Class Tx. + */ +class Tx implements ITx { + + /** The loader. */ + private final FtrDbLoader loader; + + private FtrTx scvTx =null; + + /** The id. */ + private final long id; + + private final long generatorId; + + private final long streamId; + + /** The begin time. */ + long beginTime = -1; + + /** The end time. */ + long endTime = -1; + + /** + * Instantiates a new tx. + * + * @param loader the loader + * @param scvTx the scv tx + */ + public Tx(FtrDbLoader loader, FtrTx scvTx) { + this.loader = loader; + id = scvTx.id; + this.scvTx=scvTx; + generatorId=scvTx.generatorId; + streamId=scvTx.streamId; + beginTime=scvTx.beginTime; + endTime=scvTx.endTime; + } + + /** + * Instantiates a new tx. + * + * @param loader the loader + * @param txId the tx id + */ + public Tx(FtrDbLoader loader, long id, long generatorId, long streamId) { + this.loader = loader; + this.id = id; + this.generatorId=generatorId; + this.streamId = streamId; + } + + /** + * Gets the incoming relations. + * + * @return the incoming relations + */ + @Override + public Collection getIncomingRelations() { + Set rels = loader.relationsIn.get(id); + return rels.stream().map(rel -> new TxRelation(loader, rel)).collect(Collectors.toList()); + } + + /** + * Gets the outgoing relations. + * + * @return the outgoing relations + */ + @Override + public Collection getOutgoingRelations() { + Set rels = loader.relationsOut.get(id); + return rels.stream().map(rel -> new TxRelation(loader, rel)).collect(Collectors.toList()); + } + + /** + * Compare to. + * + * @param o the o + * @return the int + */ + @Override + public int compareTo(ITx o) { + int res = Long.compare(getBeginTime(), o.getBeginTime()); + if (res != 0) + return res; + else + return Long.compare(getId(), o.getId()); + } + + /** + * Equals. + * + * @param obj the obj + * @return true, if successful + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + return this.getScvTx().equals(((Tx) obj).getScvTx()); + } + + /** + * Hash code. + * + * @return the int + */ + @Override + public int hashCode() { + return getScvTx().hashCode(); + } + + /** + * To string. + * + * @return the string + */ + @Override + public String toString() { + return "tx#" + getId() + "[" + getBeginTime() / 1000000 + "ns - " + getEndTime() / 1000000 + "ns]"; + } + + /** + * Gets the id. + * + * @return the id + */ + @Override + public long getId() { + return getScvTx().id; + } + + /** + * Gets the stream. + * + * @return the stream + */ + @Override + public IWaveform getStream() { + return loader.txStreams.get(streamId); + } + + /** + * Gets the generator. + * + * @return the generator + */ + @Override + public IWaveform getGenerator() { + return loader.txGenerators.get(generatorId); + } + + /** + * Gets the begin time. + * + * @return the begin time + */ + @Override + public long getBeginTime() { + if (beginTime < 0) { + FtrTx tx = scvTx==null?loader.getScvTx(id):getScvTx(); + beginTime = tx.beginTime; + endTime = tx.endTime; + } + return beginTime; + } + + /** + * Gets the end time. + * + * @return the end time + */ + @Override + public long getEndTime() { + if (endTime < 0) { + FtrTx tx = scvTx==null?loader.getScvTx(id):getScvTx(); + beginTime = tx.beginTime; + endTime = tx.endTime; + } + return endTime; + } + + /** + * Sets the end time. + * + * @param time the new end time + */ + void setEndTime(Long time) { + getScvTx().endTime = time; + } + + /** + * Gets the attributes. + * + * @return the attributes + */ + @Override + public List getAttributes() { + return getScvTx().getAttributes(loader); + } + + private FtrTx getScvTx() { + if(scvTx==null) + scvTx=loader.getScvTx(id); + return scvTx; + } +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxAttribute.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxAttribute.java new file mode 100644 index 0000000..c29fe26 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxAttribute.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2012 IT Just working. + * Copyright (c) 2020 MINRES Technologies GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IT Just working - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import java.io.Serializable; + +import com.minres.scviewer.database.AssociationType; +import com.minres.scviewer.database.DataType; +import com.minres.scviewer.database.tx.ITxAttribute; + +/** + * The Class TxAttribute. + */ +public class TxAttribute implements ITxAttribute, Serializable { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 4767726016651807152L; + + /** The attribute type. */ + private final TxAttributeType attributeType; + + /** The value. */ + private final String value; + + /** + * Instantiates a new tx attribute. + * + * @param type the type + * @param value the value + */ + TxAttribute(TxAttributeType type, String value) { + this.attributeType = type; + this.value = value; + } + + /** + * Gets the name. + * + * @return the name + */ + @Override + public String getName() { + return attributeType.getName(); + } + + /** + * Gets the type. + * + * @return the type + */ + @Override + public AssociationType getType() { + return attributeType.getType(); + } + + /** + * Gets the data type. + * + * @return the data type + */ + @Override + public DataType getDataType() { + return attributeType.getDataType(); + } + + /** + * Gets the value. + * + * @return the value + */ + @Override + public Object getValue() { + return value; + } + +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxAttributeType.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxAttributeType.java new file mode 100644 index 0000000..7d6ad91 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxAttributeType.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2012 IT Just working. + * Copyright (c) 2020 MINRES Technologies GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IT Just working - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import java.io.Serializable; + +import com.minres.scviewer.database.AssociationType; +import com.minres.scviewer.database.DataType; +import com.minres.scviewer.database.tx.ITxAttributeType; + +/** + * The Class TxAttributeType. + */ +class TxAttributeType implements ITxAttributeType, Serializable { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 7159721937208946828L; + + /** The name. */ + private String name; + + /** The data type. */ + private DataType dataType; + + /** The type. */ + private AssociationType type; + + /** + * Instantiates a new tx attribute type. + * + * @param name the name + * @param dataType the data type + * @param type the type + */ + TxAttributeType(String name, DataType dataType, AssociationType type) { + this.name = name; + this.dataType = dataType; + this.type = type; + } + + /** + * Gets the name. + * + * @return the name + */ + @Override + public String getName() { + return name; + } + + /** + * Gets the data type. + * + * @return the data type + */ + @Override + public DataType getDataType() { + return dataType; + } + + /** + * Gets the type. + * + * @return the type + */ + @Override + public AssociationType getType() { + return type; + } + + @Override + public String toString() { + return name + ":" + dataType.name() + "@" + type.name(); + } +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxEvent.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxEvent.java new file mode 100644 index 0000000..18275fb --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxEvent.java @@ -0,0 +1,120 @@ +/******************************************************************************* + * Copyright (c) 2020 MINRES Technologies GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * MINRES Technologies GmbH - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import com.minres.scviewer.database.EventKind; +import com.minres.scviewer.database.WaveformType; +import com.minres.scviewer.database.tx.ITx; +import com.minres.scviewer.database.tx.ITxEvent; + +/** + * The Class TxEvent. + */ +class TxEvent implements ITxEvent { + + /** The loader. */ + final FtrDbLoader loader; + + /** The kind. */ + final EventKind kind; + + /** The transaction. */ + final long transaction; + + /** The time. */ + final long time; + + private int concurrencyIdx=-1; + /** + * Instantiates a new tx event. + * + * @param loader the loader + * @param kind the kind + * @param transaction the transaction + * @param time the time + */ + TxEvent(FtrDbLoader loader, EventKind kind, Long transaction, Long time) { + this.loader = loader; + this.kind = kind; + this.transaction = transaction; + this.time = time; + } + + /** + * Duplicate. + * + * @return the i tx event + * @throws CloneNotSupportedException the clone not supported exception + */ + @Override + public ITxEvent duplicate() throws CloneNotSupportedException { + return new TxEvent(loader, kind, transaction, time); + } + + /** + * To string. + * + * @return the string + */ + @Override + public String toString() { + return kind.toString() + "@" + time + " of tx #" + transaction; + } + + /** + * Gets the type. + * + * @return the type + */ + @Override + public WaveformType getType() { + return WaveformType.TRANSACTION; + } + + /** + * Gets the kind. + * + * @return the kind + */ + @Override + public EventKind getKind() { + return kind; + } + + /** + * Gets the time. + * + * @return the time + */ + @Override + public long getTime() { + return time; + } + + /** + * Gets the transaction. + * + * @return the transaction + */ + @Override + public ITx getTransaction() { + return loader.getTransaction(transaction); + } + + @Override + public int getRowIndex() { + return concurrencyIdx; + } + + public void setConcurrencyIndex(int idx) { + concurrencyIdx=idx; + } +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxGenerator.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxGenerator.java new file mode 100644 index 0000000..d32d01f --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxGenerator.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2012 IT Just working. + * Copyright (c) 2020 MINRES Technologies GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IT Just working - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import java.util.ArrayList; +import java.util.List; + +import com.minres.scviewer.database.IWaveform; + +/** + * The Class TxGenerator. + */ +class TxGenerator extends AbstractTxStream { + + /** The stream. */ + TxStream stream; + + /** The begin attrs. */ + List beginAttrs = new ArrayList<>(); + + /** The end attrs. */ + List endAttrs = new ArrayList<>(); + + /** + * Instantiates a new tx generator. + * + * @param loader the loader + * @param id the id + * @param name the name + * @param stream the stream + */ + TxGenerator(FtrDbLoader loader, Long id, String name, TxStream stream) { + super(loader, id, name); + this.stream = stream; + stream.addChild(this); + } + + /** + * Checks if is same. + * + * @param other the other + * @return true, if is same + */ + @Override + public boolean isSame(IWaveform other) { + return (other instanceof TxGenerator && this.getId()==other.getId()); + } + + /** + * Gets the begin attrs. + * + * @return the begin attrs + */ + public List getBeginAttrs() { + return beginAttrs; + } + + /** + * Gets the end attrs. + * + * @return the end attrs + */ + public List getEndAttrs() { + return endAttrs; + } + + /** + * Gets the kind. + * + * @return the kind + */ + @Override + public String getKind() { + return stream.getKind(); + } + + /** + * Gets the full hierarchical name. + * + * @return the full name + */ + @Override + public String getFullName() { + return ((AbstractTxStream)parent).getFullName()+"."+name; + } + +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxRelation.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxRelation.java new file mode 100644 index 0000000..b717b1f --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxRelation.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2020 MINRES Technologies GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * MINRES Technologies GmbH - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import com.minres.scviewer.database.RelationType; +import com.minres.scviewer.database.tx.ITx; +import com.minres.scviewer.database.tx.ITxRelation; + +/** + * The Class TxRelation. + */ +class TxRelation implements ITxRelation { + + /** The loader. */ + final FtrDbLoader loader; + + /** The scv relation. */ + final FtrRelation scvRelation; + + /** + * Instantiates a new tx relation. + * + * @param loader the loader + * @param scvRelation the scv relation + */ + public TxRelation(FtrDbLoader loader, FtrRelation scvRelation) { + this.loader = loader; + this.scvRelation = scvRelation; + } + + /** + * Gets the relation type. + * + * @return the relation type + */ + @Override + public RelationType getRelationType() { + return scvRelation.relationType; + } + + /** + * Gets the source. + * + * @return the source + */ + @Override + public ITx getSource() { + return loader.getTransaction(scvRelation.source); + } + + /** + * Gets the target. + * + * @return the target + */ + @Override + public ITx getTarget() { + return loader.getTransaction(scvRelation.target); + } + +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxStream.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxStream.java new file mode 100644 index 0000000..1a3c2f0 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxStream.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2012 IT Just working. + * Copyright (c) 2020 MINRES Technologies GmbH + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IT Just working - initial API and implementation + *******************************************************************************/ +package com.minres.scviewer.database.ftr; + +import java.util.ArrayList; +import java.util.List; + +import com.minres.scviewer.database.IWaveform; +import com.minres.scviewer.database.InputFormatException; + +/** + * The Class TxStream. + */ +class TxStream extends AbstractTxStream { + + /** The kind. */ + final String kind; + + final ArrayList fileOffsets = new ArrayList<>(); + + final ArrayList chunks = new ArrayList<>(); + + /** + * Instantiates a new tx stream. + * + * @param loader the loader + * @param id the id + * @param name the name + * @param kind the kind + */ + TxStream(FtrDbLoader loader, Long id, String name, String kind) { + super(loader, id, name); + this.kind = kind; + } + + /** + * Checks if is same. + * + * @param other the other + * @return true, if is same + */ + @Override + public boolean isSame(IWaveform other) { + return (other instanceof TxStream && this.getId() == other.getId()); + } + + /** + * Gets the kind. + * + * @return the kind + */ + @Override + public String getKind() { + return kind; + } + + public List getChunks() throws InputFormatException { + if(chunks.size()==0) { + chunks.addAll(loader.getChunksAtOffsets(fileOffsets)); + } + return chunks; + } + +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/jacob/CborConstants.java b/plugins/com.minres.scviewer.database.ftr/src/jacob/CborConstants.java new file mode 100644 index 0000000..df9fabd --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/jacob/CborConstants.java @@ -0,0 +1,89 @@ +/* + * JACOB - CBOR implementation in Java. + * + * (C) Copyright - 2013 - J.W. Janssen + * + * Licensed under Apache License v2.0. + */ +package jacob; + +/** + * Constant values used by the CBOR format. + */ +public interface CborConstants { + /** Major type 0: unsigned integers. */ + int TYPE_UNSIGNED_INTEGER = 0x00; + /** Major type 1: negative integers. */ + int TYPE_NEGATIVE_INTEGER = 0x01; + /** Major type 2: byte string. */ + int TYPE_BYTE_STRING = 0x02; + /** Major type 3: text/UTF8 string. */ + int TYPE_TEXT_STRING = 0x03; + /** Major type 4: array of items. */ + int TYPE_ARRAY = 0x04; + /** Major type 5: map of pairs. */ + int TYPE_MAP = 0x05; + /** Major type 6: semantic tags. */ + int TYPE_TAG = 0x06; + /** Major type 7: floating point, simple data types. */ + int TYPE_FLOAT_SIMPLE = 0x07; + + /** Denotes a one-byte value (uint8). */ + int ONE_BYTE = 0x18; + /** Denotes a two-byte value (uint16). */ + int TWO_BYTES = 0x19; + /** Denotes a four-byte value (uint32). */ + int FOUR_BYTES = 0x1a; + /** Denotes a eight-byte value (uint64). */ + int EIGHT_BYTES = 0x1b; + + /** The CBOR-encoded boolean false value (encoded as "simple value": {@link #MT_SIMPLE}). */ + int FALSE = 0x14; + /** The CBOR-encoded boolean true value (encoded as "simple value": {@link #MT_SIMPLE}). */ + int TRUE = 0x15; + /** The CBOR-encoded null value (encoded as "simple value": {@link #MT_SIMPLE}). */ + int NULL = 0x16; + /** The CBOR-encoded "undefined" value (encoded as "simple value": {@link #MT_SIMPLE}). */ + int UNDEFINED = 0x17; + /** Denotes a half-precision float (two-byte IEEE 754, see {@link #MT_FLOAT}). */ + int HALF_PRECISION_FLOAT = 0x19; + /** Denotes a single-precision float (four-byte IEEE 754, see {@link #MT_FLOAT}). */ + int SINGLE_PRECISION_FLOAT = 0x1a; + /** Denotes a double-precision float (eight-byte IEEE 754, see {@link #MT_FLOAT}). */ + int DOUBLE_PRECISION_FLOAT = 0x1b; + /** The CBOR-encoded "break" stop code for unlimited arrays/maps. */ + int BREAK = 0x1f; + + /** Semantic tag value describing date/time values in the standard format (UTF8 string, RFC3339). */ + int TAG_STANDARD_DATE_TIME = 0; + /** Semantic tag value describing date/time values as Epoch timestamp (numeric, RFC3339). */ + int TAG_EPOCH_DATE_TIME = 1; + /** Semantic tag value describing a positive big integer value (byte string). */ + int TAG_POSITIVE_BIGINT = 2; + /** Semantic tag value describing a negative big integer value (byte string). */ + int TAG_NEGATIVE_BIGINT = 3; + /** Semantic tag value describing a decimal fraction value (two-element array, base 10). */ + int TAG_DECIMAL_FRACTION = 4; + /** Semantic tag value describing a big decimal value (two-element array, base 2). */ + int TAG_BIGDECIMAL = 5; + /** Semantic tag value describing an expected conversion to base64url encoding. */ + int TAG_EXPECTED_BASE64_URL_ENCODED = 21; + /** Semantic tag value describing an expected conversion to base64 encoding. */ + int TAG_EXPECTED_BASE64_ENCODED = 22; + /** Semantic tag value describing an expected conversion to base16 encoding. */ + int TAG_EXPECTED_BASE16_ENCODED = 23; + /** Semantic tag value describing an encoded CBOR data item (byte string). */ + int TAG_CBOR_ENCODED = 24; + /** Semantic tag value describing an URL (UTF8 string). */ + int TAG_URI = 32; + /** Semantic tag value describing a base64url encoded string (UTF8 string). */ + int TAG_BASE64_URL_ENCODED = 33; + /** Semantic tag value describing a base64 encoded string (UTF8 string). */ + int TAG_BASE64_ENCODED = 34; + /** Semantic tag value describing a regular expression string (UTF8 string, PCRE). */ + int TAG_REGEXP = 35; + /** Semantic tag value describing a MIME message (UTF8 string, RFC2045). */ + int TAG_MIME_MESSAGE = 36; + /** Semantic tag value describing CBOR content. */ + int TAG_CBOR_MARKER = 55799; +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/jacob/CborDecoder.java b/plugins/com.minres.scviewer.database.ftr/src/jacob/CborDecoder.java new file mode 100644 index 0000000..b7b6433 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/jacob/CborDecoder.java @@ -0,0 +1,515 @@ +/* + * JACOB - CBOR implementation in Java. + * + * (C) Copyright - 2013 - J.W. Janssen + */ +package jacob; + +import static jacob.CborConstants.*; +import static jacob.CborType.*; + +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.io.PushbackInputStream; + +/** + * Provides a decoder capable of handling CBOR encoded data from a {@link InputStream}. + */ +public class CborDecoder { + protected final PushbackInputStream m_is; + + protected final int total_avail; + + static int getAvailableBytes(PushbackInputStream is) { + try { + return is.available(); + } catch (IOException e) { + return -1; + } + } + /** + * Creates a new {@link CborDecoder} instance. + * + * @param is the actual input stream to read the CBOR-encoded data from, cannot be null. + */ + public CborDecoder(InputStream is) { + if (is == null) { + throw new IllegalArgumentException("InputStream cannot be null!"); + } + m_is = (is instanceof PushbackInputStream) ? (PushbackInputStream) is : new PushbackInputStream(is); + total_avail = getAvailableBytes(m_is); + } + + private static void fail(String msg, Object... args) throws IOException { + throw new IOException(String.format(msg, args)); + } + + private static String lengthToString(int len) { + return (len < 0) ? "no payload" : (len == ONE_BYTE) ? "one byte" : (len == TWO_BYTES) ? "two bytes" + : (len == FOUR_BYTES) ? "four bytes" : (len == EIGHT_BYTES) ? "eight bytes" : "(unknown)"; + } + + public long getPos() { + try { + return total_avail-m_is.available(); + } catch (IOException e) { + return -1; + } + } + /** + * Peeks in the input stream for the upcoming type. + * + * @return the upcoming type in the stream, or null in case of an end-of-stream. + * @throws IOException in case of I/O problems reading the CBOR-type from the underlying input stream. + */ + public CborType peekType() throws IOException { + int p = m_is.read(); + if (p < 0) { + // EOF, nothing to peek at... + return null; + } + m_is.unread(p); + return valueOf(p); + } + + /** + * Prolog to reading an array value in CBOR format. + * + * @return the number of elements in the array to read, or -1 in case of infinite-length arrays. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public long readArrayLength() throws IOException { + return readMajorTypeWithSize(TYPE_ARRAY); + } + + /** + * Reads a boolean value in CBOR format. + * + * @return the read boolean. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public boolean readBoolean() throws IOException { + int b = readMajorType(TYPE_FLOAT_SIMPLE); + if (b != FALSE && b != TRUE) { + fail("Unexpected boolean value: %d!", b); + } + return b == TRUE; + } + + /** + * Reads a "break"/stop value in CBOR format. + * + * @return always null. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public Object readBreak() throws IOException { + readMajorTypeExact(TYPE_FLOAT_SIMPLE, BREAK); + + return null; + } + + /** + * Reads a byte string value in CBOR format. + * + * @return the read byte string, never null. In case the encoded string has a length of 0, an empty string is returned. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public byte[] readByteString() throws IOException { + long len = readMajorTypeWithSize(TYPE_BYTE_STRING); + if (len < 0) { + fail("Infinite-length byte strings not supported!"); + } + if (len > Integer.MAX_VALUE) { + fail("String length too long!"); + } + return readFully(new byte[(int) len]); + } + + /** + * Prolog to reading a byte string value in CBOR format. + * + * @return the number of bytes in the string to read, or -1 in case of infinite-length strings. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public long readByteStringLength() throws IOException { + return readMajorTypeWithSize(TYPE_BYTE_STRING); + } + + /** + * Reads a double-precision float value in CBOR format. + * + * @return the read double value, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public double readDouble() throws IOException { + readMajorTypeExact(TYPE_FLOAT_SIMPLE, DOUBLE_PRECISION_FLOAT); + + return Double.longBitsToDouble(readUInt64()); + } + + /** + * Reads a single-precision float value in CBOR format. + * + * @return the read float value, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public float readFloat() throws IOException { + readMajorTypeExact(TYPE_FLOAT_SIMPLE, SINGLE_PRECISION_FLOAT); + + return Float.intBitsToFloat((int) readUInt32()); + } + + /** + * Reads a half-precision float value in CBOR format. + * + * @return the read half-precision float value, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public double readHalfPrecisionFloat() throws IOException { + readMajorTypeExact(TYPE_FLOAT_SIMPLE, HALF_PRECISION_FLOAT); + + int half = readUInt16(); + int exp = (half >> 10) & 0x1f; + int mant = half & 0x3ff; + + double val; + if (exp == 0) { + val = mant * Math.pow(2, -24); + } else if (exp != 31) { + val = (mant + 1024) * Math.pow(2, exp - 25); + } else if (mant != 0) { + val = Double.NaN; + } else { + val = Double.POSITIVE_INFINITY; + } + + return ((half & 0x8000) == 0) ? val : -val; + } + + /** + * Reads a signed or unsigned integer value in CBOR format. + * + * @return the read integer value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public long readInt() throws IOException { + int ib = m_is.read(); + + // in case of negative integers, extends the sign to all bits; otherwise zero... + long ui = expectIntegerType(ib); + // in case of negative integers does a ones complement + return ui ^ readUInt(ib & 0x1f, false /* breakAllowed */); + } + + /** + * Reads a signed or unsigned 16-bit integer value in CBOR format. + * + * @read the small integer value, values from [-65536..65535] are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream. + */ + public int readInt16() throws IOException { + int ib = m_is.read(); + + // in case of negative integers, extends the sign to all bits; otherwise zero... + long ui = expectIntegerType(ib); + // in case of negative integers does a ones complement + return (int) (ui ^ readUIntExact(TWO_BYTES, ib & 0x1f)); + } + + /** + * Reads a signed or unsigned 32-bit integer value in CBOR format. + * + * @read the small integer value, values in the range [-4294967296..4294967295] are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream. + */ + public long readInt32() throws IOException { + int ib = m_is.read(); + + // in case of negative integers, extends the sign to all bits; otherwise zero... + long ui = expectIntegerType(ib); + // in case of negative integers does a ones complement + return ui ^ readUIntExact(FOUR_BYTES, ib & 0x1f); + } + + /** + * Reads a signed or unsigned 64-bit integer value in CBOR format. + * + * @read the small integer value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream. + */ + public long readInt64() throws IOException { + int ib = m_is.read(); + + // in case of negative integers, extends the sign to all bits; otherwise zero... + long ui = expectIntegerType(ib); + // in case of negative integers does a ones complement + return ui ^ readUIntExact(EIGHT_BYTES, ib & 0x1f); + } + + /** + * Reads a signed or unsigned 8-bit integer value in CBOR format. + * + * @read the small integer value, values in the range [-256..255] are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream. + */ + public int readInt8() throws IOException { + int ib = m_is.read(); + + // in case of negative integers, extends the sign to all bits; otherwise zero... + long ui = expectIntegerType(ib); + // in case of negative integers does a ones complement + return (int) (ui ^ readUIntExact(ONE_BYTE, ib & 0x1f)); + } + + /** + * Prolog to reading a map of key-value pairs in CBOR format. + * + * @return the number of entries in the map, >= 0. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public long readMapLength() throws IOException { + return readMajorTypeWithSize(TYPE_MAP); + } + + /** + * Reads a null-value in CBOR format. + * + * @return always null. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public Object readNull() throws IOException { + readMajorTypeExact(TYPE_FLOAT_SIMPLE, NULL); + return null; + } + + /** + * Reads a single byte value in CBOR format. + * + * @return the read byte value. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public byte readSimpleValue() throws IOException { + readMajorTypeExact(TYPE_FLOAT_SIMPLE, ONE_BYTE); + return (byte) readUInt8(); + } + + /** + * Reads a signed or unsigned small (<= 23) integer value in CBOR format. + * + * @read the small integer value, values in the range [-24..23] are supported. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying output stream. + */ + public int readSmallInt() throws IOException { + int ib = m_is.read(); + + // in case of negative integers, extends the sign to all bits; otherwise zero... + long ui = expectIntegerType(ib); + // in case of negative integers does a ones complement + return (int) (ui ^ readUIntExact(-1, ib & 0x1f)); + } + + /** + * Reads a semantic tag value in CBOR format. + * + * @return the read tag value. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public long readTag() throws IOException { + return readUInt(readMajorType(TYPE_TAG), false /* breakAllowed */); + } + + /** + * Reads an UTF-8 encoded string value in CBOR format. + * + * @return the read UTF-8 encoded string, never null. In case the encoded string has a length of 0, an empty string is returned. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public String readTextString() throws IOException { + long len = readMajorTypeWithSize(TYPE_TEXT_STRING); + if (len < 0) { + fail("Infinite-length text strings not supported!"); + } + if (len > Integer.MAX_VALUE) { + fail("String length too long!"); + } + return new String(readFully(new byte[(int) len]), "UTF-8"); + } + + /** + * Prolog to reading an UTF-8 encoded string value in CBOR format. + * + * @return the length of the string to read, or -1 in case of infinite-length strings. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public long readTextStringLength() throws IOException { + return readMajorTypeWithSize(TYPE_TEXT_STRING); + } + + /** + * Reads an undefined value in CBOR format. + * + * @return always null. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + public Object readUndefined() throws IOException { + readMajorTypeExact(TYPE_FLOAT_SIMPLE, UNDEFINED); + return null; + } + + /** + * Reads the next major type from the underlying input stream, and verifies whether it matches the given expectation. + * + * @param majorType the expected major type, cannot be null (unchecked). + * @return either -1 if the major type was an signed integer, or 0 otherwise. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + protected long expectIntegerType(int ib) throws IOException { + int majorType = ((ib & 0xFF) >>> 5); + if ((majorType != TYPE_UNSIGNED_INTEGER) && (majorType != TYPE_NEGATIVE_INTEGER)) { + fail("Unexpected type: %s, expected type %s or %s!", getName(majorType), getName(TYPE_UNSIGNED_INTEGER), + getName(TYPE_NEGATIVE_INTEGER)); + } + return -majorType; + } + + /** + * Reads the next major type from the underlying input stream, and verifies whether it matches the given expectation. + * + * @param majorType the expected major type, cannot be null (unchecked). + * @return the read subtype, or payload, of the read major type. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + protected int readMajorType(int majorType) throws IOException { + int ib = m_is.read(); + if (majorType != ((ib >>> 5) & 0x07)) { + fail("Unexpected type: %s, expected: %s!", getName(ib), getName(majorType)); + } + return ib & 0x1F; + } + + /** + * Reads the next major type from the underlying input stream, and verifies whether it matches the given expectations. + * + * @param majorType the expected major type, cannot be null (unchecked); + * @param subtype the expected subtype. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + protected void readMajorTypeExact(int majorType, int subtype) throws IOException { + int st = readMajorType(majorType); + if ((st ^ subtype) != 0) { + fail("Unexpected subtype: %d, expected: %d!", st, subtype); + } + } + + /** + * Reads the next major type from the underlying input stream, verifies whether it matches the given expectation, and decodes the payload into a size. + * + * @param majorType the expected major type, cannot be null (unchecked). + * @return the number of succeeding bytes, >= 0, or -1 if an infinite-length type is read. + * @throws IOException in case of I/O problems reading the CBOR-encoded value from the underlying input stream. + */ + protected long readMajorTypeWithSize(int majorType) throws IOException { + return readUInt(readMajorType(majorType), true /* breakAllowed */); + } + + /** + * Reads an unsigned integer with a given length-indicator. + * + * @param length the length indicator to use; + * @return the read unsigned integer, as long value. + * @throws IOException in case of I/O problems reading the unsigned integer from the underlying input stream. + */ + protected long readUInt(int length, boolean breakAllowed) throws IOException { + long result = -1; + if (length < ONE_BYTE) { + result = length; + } else if (length == ONE_BYTE) { + result = readUInt8(); + } else if (length == TWO_BYTES) { + result = readUInt16(); + } else if (length == FOUR_BYTES) { + result = readUInt32(); + } else if (length == EIGHT_BYTES) { + result = readUInt64(); + } else if (breakAllowed && length == BREAK) { + return -1; + } + if (result < 0) { + fail("Not well-formed CBOR integer found, invalid length: %d!", result); + } + return result; + } + + /** + * Reads an unsigned 16-bit integer value + * + * @return value the read value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected int readUInt16() throws IOException { + byte[] buf = readFully(new byte[2]); + return (buf[0] & 0xFF) << 8 | (buf[1] & 0xFF); + } + + /** + * Reads an unsigned 32-bit integer value + * + * @return value the read value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected long readUInt32() throws IOException { + byte[] buf = readFully(new byte[4]); + return ((buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF)) & 0xffffffffL; + } + + /** + * Reads an unsigned 64-bit integer value + * + * @return value the read value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected long readUInt64() throws IOException { + byte[] buf = readFully(new byte[8]); + return (buf[0] & 0xFFL) << 56 | (buf[1] & 0xFFL) << 48 | (buf[2] & 0xFFL) << 40 | (buf[3] & 0xFFL) << 32 | // + (buf[4] & 0xFFL) << 24 | (buf[5] & 0xFFL) << 16 | (buf[6] & 0xFFL) << 8 | (buf[7] & 0xFFL); + } + + /** + * Reads an unsigned 8-bit integer value + * + * @return value the read value, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected int readUInt8() throws IOException { + return m_is.read() & 0xff; + } + + /** + * Reads an unsigned integer with a given length-indicator. + * + * @param length the length indicator to use; + * @return the read unsigned integer, as long value. + * @throws IOException in case of I/O problems reading the unsigned integer from the underlying input stream. + */ + protected long readUIntExact(int expectedLength, int length) throws IOException { + if (((expectedLength == -1) && (length >= ONE_BYTE)) || ((expectedLength >= 0) && (length != expectedLength))) { + fail("Unexpected payload/length! Expected %s, but got %s.", lengthToString(expectedLength), + lengthToString(length)); + } + return readUInt(length, false /* breakAllowed */); + } + + private byte[] readFully(byte[] buf) throws IOException { + int len = buf.length; + int n = 0, off = 0; + while (n < len) { + int count = m_is.read(buf, off + n, len - n); + if (count < 0) { + throw new EOFException(); + } + n += count; + } + return buf; + } +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/jacob/CborEncoder.java b/plugins/com.minres.scviewer.database.ftr/src/jacob/CborEncoder.java new file mode 100644 index 0000000..b09aafe --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/jacob/CborEncoder.java @@ -0,0 +1,488 @@ +/* + * JACOB - CBOR implementation in Java. + * + * (C) Copyright - 2013 - J.W. Janssen + * + * Licensed under Apache License v2.0. + */ +package jacob; + +import static jacob.CborConstants.*; + +import java.io.IOException; +import java.io.OutputStream; + +/** + * Provides an encoder capable of encoding data into CBOR format to a given {@link OutputStream}. + */ +public class CborEncoder { + private static final int NEG_INT_MASK = TYPE_NEGATIVE_INTEGER << 5; + + private final OutputStream m_os; + + /** + * Creates a new {@link CborEncoder} instance. + * + * @param os the actual output stream to write the CBOR-encoded data to, cannot be null. + */ + public CborEncoder(OutputStream os) { + if (os == null) { + throw new IllegalArgumentException("OutputStream cannot be null!"); + } + m_os = os; + } + + /** + * Interprets a given float-value as a half-precision float value and + * converts it to its raw integer form, as defined in IEEE 754. + *

+ * Taken from: this Stack Overflow answer. + *

+ * + * @param fval the value to convert. + * @return the raw integer representation of the given float value. + */ + static int halfPrecisionToRawIntBits(float fval) { + int fbits = Float.floatToIntBits(fval); + int sign = (fbits >>> 16) & 0x8000; + int val = (fbits & 0x7fffffff) + 0x1000; + + // might be or become NaN/Inf + if (val >= 0x47800000) { + if ((fbits & 0x7fffffff) >= 0x47800000) { // is or must become NaN/Inf + if (val < 0x7f800000) { + // was value but too large, make it +/-Inf + return sign | 0x7c00; + } + return sign | 0x7c00 | (fbits & 0x007fffff) >>> 13; // keep NaN (and Inf) bits + } + return sign | 0x7bff; // unrounded not quite Inf + } + if (val >= 0x38800000) { + // remains normalized value + return sign | val - 0x38000000 >>> 13; // exp - 127 + 15 + } + if (val < 0x33000000) { + // too small for subnormal + return sign; // becomes +/-0 + } + + val = (fbits & 0x7fffffff) >>> 23; + // add subnormal bit, round depending on cut off and div by 2^(1-(exp-127+15)) and >> 13 | exp=0 + return sign | ((fbits & 0x7fffff | 0x800000) + (0x800000 >>> val - 102) >>> 126 - val); + } + + /** + * Writes the start of an indefinite-length array. + *

+ * After calling this method, one is expected to write the given number of array elements, which can be of any type. No length checks are performed.
+ * After all array elements are written, one should write a single break value to end the array, see {@link #writeBreak()}. + *

+ * + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeArrayStart() throws IOException { + writeSimpleType(TYPE_ARRAY, BREAK); + } + + /** + * Writes the start of a definite-length array. + *

+ * After calling this method, one is expected to write the given number of array elements, which can be of any type. No length checks are performed. + *

+ * + * @param length the number of array elements to write, should >= 0. + * @throws IllegalArgumentException in case the given length was negative; + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeArrayStart(int length) throws IOException { + if (length < 0) { + throw new IllegalArgumentException("Invalid array-length!"); + } + writeType(TYPE_ARRAY, length); + } + + /** + * Writes a boolean value in canonical CBOR format. + * + * @param value the boolean to write. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeBoolean(boolean value) throws IOException { + writeSimpleType(TYPE_FLOAT_SIMPLE, value ? TRUE : FALSE); + } + + /** + * Writes a "break" stop-value in canonical CBOR format. + * + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeBreak() throws IOException { + writeSimpleType(TYPE_FLOAT_SIMPLE, BREAK); + } + + /** + * Writes a byte string in canonical CBOR-format. + * + * @param value the byte string to write, can be null in which case a byte-string of length 0 is written. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeByteString(byte[] bytes) throws IOException { + writeString(TYPE_BYTE_STRING, bytes); + } + + /** + * Writes the start of an indefinite-length byte string. + *

+ * After calling this method, one is expected to write the given number of string parts. No length checks are performed.
+ * After all string parts are written, one should write a single break value to end the string, see {@link #writeBreak()}. + *

+ * + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeByteStringStart() throws IOException { + writeSimpleType(TYPE_BYTE_STRING, BREAK); + } + + /** + * Writes a double-precision float value in canonical CBOR format. + * + * @param value the value to write, values from {@link Double#MIN_VALUE} to {@link Double#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeDouble(double value) throws IOException { + writeUInt64(TYPE_FLOAT_SIMPLE << 5, Double.doubleToRawLongBits(value)); + } + + /** + * Writes a single-precision float value in canonical CBOR format. + * + * @param value the value to write, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeFloat(float value) throws IOException { + writeUInt32(TYPE_FLOAT_SIMPLE << 5, Float.floatToRawIntBits(value)); + } + + /** + * Writes a half-precision float value in canonical CBOR format. + * + * @param value the value to write, values from {@link Float#MIN_VALUE} to {@link Float#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeHalfPrecisionFloat(float value) throws IOException { + writeUInt16(TYPE_FLOAT_SIMPLE << 5, halfPrecisionToRawIntBits(value)); + } + + /** + * Writes a signed or unsigned integer value in canonical CBOR format, that is, tries to encode it in a little bytes as possible.. + * + * @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeInt(long value) throws IOException { + // extends the sign over all bits... + long sign = value >> 63; + // in case value is negative, this bit should be set... + int mt = (int) (sign & NEG_INT_MASK); + // complement negative value... + value = (sign ^ value); + + writeUInt(mt, value); + } + + /** + * Writes a signed or unsigned 16-bit integer value in CBOR format. + * + * @param value the value to write, values from [-65536..65535] are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeInt16(int value) throws IOException { + // extends the sign over all bits... + int sign = value >> 31; + // in case value is negative, this bit should be set... + int mt = (int) (sign & NEG_INT_MASK); + // complement negative value... + writeUInt16(mt, (sign ^ value) & 0xffff); + } + + /** + * Writes a signed or unsigned 32-bit integer value in CBOR format. + * + * @param value the value to write, values in the range [-4294967296..4294967295] are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeInt32(long value) throws IOException { + // extends the sign over all bits... + long sign = value >> 63; + // in case value is negative, this bit should be set... + int mt = (int) (sign & NEG_INT_MASK); + // complement negative value... + writeUInt32(mt, (int) ((sign ^ value) & 0xffffffffL)); + } + + /** + * Writes a signed or unsigned 64-bit integer value in CBOR format. + * + * @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeInt64(long value) throws IOException { + // extends the sign over all bits... + long sign = value >> 63; + // in case value is negative, this bit should be set... + int mt = (int) (sign & NEG_INT_MASK); + // complement negative value... + writeUInt64(mt, sign ^ value); + } + + /** + * Writes a signed or unsigned 8-bit integer value in CBOR format. + * + * @param value the value to write, values in the range [-256..255] are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeInt8(int value) throws IOException { + // extends the sign over all bits... + int sign = value >> 31; + // in case value is negative, this bit should be set... + int mt = (int) (sign & NEG_INT_MASK); + // complement negative value... + writeUInt8(mt, (sign ^ value) & 0xff); + } + + /** + * Writes the start of an indefinite-length map. + *

+ * After calling this method, one is expected to write any number of map entries, as separate key and value. Keys and values can both be of any type. No length checks are performed.
+ * After all map entries are written, one should write a single break value to end the map, see {@link #writeBreak()}. + *

+ * + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeMapStart() throws IOException { + writeSimpleType(TYPE_MAP, BREAK); + } + + /** + * Writes the start of a finite-length map. + *

+ * After calling this method, one is expected to write any number of map entries, as separate key and value. Keys and values can both be of any type. No length checks are performed. + *

+ * + * @param length the number of map entries to write, should >= 0. + * @throws IllegalArgumentException in case the given length was negative; + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeMapStart(int length) throws IOException { + if (length < 0) { + throw new IllegalArgumentException("Invalid length of map!"); + } + writeType(TYPE_MAP, length); + } + + /** + * Writes a null value in canonical CBOR format. + * + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeNull() throws IOException { + writeSimpleType(TYPE_FLOAT_SIMPLE, NULL); + } + + /** + * Writes a simple value, i.e., an "atom" or "constant" value in canonical CBOR format. + * + * @param value the (unsigned byte) value to write, values from 32 to 255 are supported (though not enforced). + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeSimpleValue(byte simpleValue) throws IOException { + // convert to unsigned value... + int value = (simpleValue & 0xff); + writeType(TYPE_FLOAT_SIMPLE, value); + } + + /** + * Writes a signed or unsigned small (<= 23) integer value in CBOR format. + * + * @param value the value to write, values in the range [-24..23] are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeSmallInt(int value) throws IOException { + // extends the sign over all bits... + int sign = value >> 31; + // in case value is negative, this bit should be set... + int mt = (int) (sign & NEG_INT_MASK); + // complement negative value... + value = Math.min(0x17, (sign ^ value)); + + m_os.write((int) (mt | value)); + } + + /** + * Writes a semantic tag in canonical CBOR format. + * + * @param tag the tag to write, should >= 0. + * @throws IllegalArgumentException in case the given tag was negative; + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeTag(long tag) throws IOException { + if (tag < 0) { + throw new IllegalArgumentException("Invalid tag specification, cannot be negative!"); + } + writeType(TYPE_TAG, tag); + } + + /** + * Writes an UTF-8 string in canonical CBOR-format. + *

+ * Note that this method is platform specific, as the given string value will be encoded in a byte array + * using the platform encoding! This means that the encoding must be standardized and known. + *

+ * + * @param value the UTF-8 string to write, can be null in which case an UTF-8 string of length 0 is written. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeTextString(String value) throws IOException { + writeString(TYPE_TEXT_STRING, value == null ? null : value.getBytes("UTF-8")); + } + + /** + * Writes the start of an indefinite-length UTF-8 string. + *

+ * After calling this method, one is expected to write the given number of string parts. No length checks are performed.
+ * After all string parts are written, one should write a single break value to end the string, see {@link #writeBreak()}. + *

+ * + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeTextStringStart() throws IOException { + writeSimpleType(TYPE_TEXT_STRING, BREAK); + } + + /** + * Writes an "undefined" value in canonical CBOR format. + * + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + public void writeUndefined() throws IOException { + writeSimpleType(TYPE_FLOAT_SIMPLE, UNDEFINED); + } + + /** + * Encodes and writes the major type and value as a simple type. + * + * @param majorType the major type of the value to write, denotes what semantics the written value has; + * @param value the value to write, values from [0..31] are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected void writeSimpleType(int majorType, int value) throws IOException { + m_os.write((majorType << 5) | (value & 0x1f)); + } + + /** + * Writes a byte string in canonical CBOR-format. + * + * @param majorType the major type of the string, should be either 0x40 or 0x60; + * @param value the byte string to write, can be null in which case a byte-string of length 0 is written. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected void writeString(int majorType, byte[] bytes) throws IOException { + int len = (bytes == null) ? 0 : bytes.length; + writeType(majorType, len); + for (int i = 0; i < len; i++) { + m_os.write(bytes[i]); + } + } + + /** + * Encodes and writes the major type indicator with a given payload (length). + * + * @param majorType the major type of the value to write, denotes what semantics the written value has; + * @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected void writeType(int majorType, long value) throws IOException { + writeUInt((majorType << 5), value); + } + + /** + * Encodes and writes an unsigned integer value, that is, tries to encode it in a little bytes as possible. + * + * @param mt the major type of the value to write, denotes what semantics the written value has; + * @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected void writeUInt(int mt, long value) throws IOException { + if (value < 0x18L) { + m_os.write((int) (mt | value)); + } else if (value < 0x100L) { + writeUInt8(mt, (int) value); + } else if (value < 0x10000L) { + writeUInt16(mt, (int) value); + } else if (value < 0x100000000L) { + writeUInt32(mt, (int) value); + } else { + writeUInt64(mt, value); + } + } + + /** + * Encodes and writes an unsigned 16-bit integer value + * + * @param mt the major type of the value to write, denotes what semantics the written value has; + * @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected void writeUInt16(int mt, int value) throws IOException { + m_os.write(mt | TWO_BYTES); + m_os.write(value >> 8); + m_os.write(value & 0xFF); + } + + /** + * Encodes and writes an unsigned 32-bit integer value + * + * @param mt the major type of the value to write, denotes what semantics the written value has; + * @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected void writeUInt32(int mt, int value) throws IOException { + m_os.write(mt | FOUR_BYTES); + m_os.write(value >> 24); + m_os.write(value >> 16); + m_os.write(value >> 8); + m_os.write(value & 0xFF); + } + + /** + * Encodes and writes an unsigned 64-bit integer value + * + * @param mt the major type of the value to write, denotes what semantics the written value has; + * @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected void writeUInt64(int mt, long value) throws IOException { + m_os.write(mt | EIGHT_BYTES); + m_os.write((int) (value >> 56)); + m_os.write((int) (value >> 48)); + m_os.write((int) (value >> 40)); + m_os.write((int) (value >> 32)); + m_os.write((int) (value >> 24)); + m_os.write((int) (value >> 16)); + m_os.write((int) (value >> 8)); + m_os.write((int) (value & 0xFF)); + } + + /** + * Encodes and writes an unsigned 8-bit integer value + * + * @param mt the major type of the value to write, denotes what semantics the written value has; + * @param value the value to write, values from {@link Long#MIN_VALUE} to {@link Long#MAX_VALUE} are supported. + * @throws IOException in case of I/O problems writing the CBOR-encoded value to the underlying output stream. + */ + protected void writeUInt8(int mt, int value) throws IOException { + m_os.write(mt | ONE_BYTE); + m_os.write(value & 0xFF); + } +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/jacob/CborType.java b/plugins/com.minres.scviewer.database.ftr/src/jacob/CborType.java new file mode 100644 index 0000000..70338c1 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/jacob/CborType.java @@ -0,0 +1,142 @@ +/* + * JACOB - CBOR implementation in Java. + * + * (C) Copyright - 2013 - J.W. Janssen + * + * Licensed under Apache License v2.0. + */ +package jacob; + +import static jacob.CborConstants.*; + +/** + * Represents the various major types in CBOR, along with their . + *

+ * The major type is encoded in the upper three bits of each initial byte. The lower 5 bytes represent any additional information. + *

+ */ +public class CborType { + private final int m_major; + private final int m_additional; + + private CborType(int major, int additional) { + m_major = major; + m_additional = additional; + } + + /** + * Returns a descriptive string for the given major type. + * + * @param mt the major type to return as string, values from [0..7] are supported. + * @return the name of the given major type, as String, never null. + * @throws IllegalArgumentException in case the given major type is not supported. + */ + public static String getName(int mt) { + switch (mt) { + case TYPE_ARRAY: + return "array"; + case TYPE_BYTE_STRING: + return "byte string"; + case TYPE_FLOAT_SIMPLE: + return "float/simple value"; + case TYPE_MAP: + return "map"; + case TYPE_NEGATIVE_INTEGER: + return "negative integer"; + case TYPE_TAG: + return "tag"; + case TYPE_TEXT_STRING: + return "text string"; + case TYPE_UNSIGNED_INTEGER: + return "unsigned integer"; + default: + throw new IllegalArgumentException("Invalid major type: " + mt); + } + } + + /** + * Decodes a given byte value to a {@link CborType} value. + * + * @param i the input byte (8-bit) to decode into a {@link CborType} instance. + * @return a {@link CborType} instance, never null. + */ + public static CborType valueOf(int i) { + return new CborType((i & 0xff) >>> 5, i & 0x1f); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + CborType other = (CborType) obj; + return (m_major == other.m_major) && (m_additional == other.m_additional); + } + + /** + * @return the additional information of this type, as integer value from [0..31]. + */ + public int getAdditionalInfo() { + return m_additional; + } + + /** + * @return the major type, as integer value from [0..7]. + */ + public int getMajorType() { + return m_major; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + m_additional; + result = prime * result + m_major; + return result; + } + + /** + * @return true if this type allows for an infinite-length payload, + * false if only definite-length payloads are allowed. + */ + public boolean isBreakAllowed() { + return m_major == TYPE_ARRAY || m_major == TYPE_BYTE_STRING || m_major == TYPE_MAP + || m_major == TYPE_TEXT_STRING; + } + + /** + * Determines whether the major type of a given {@link CborType} equals the major type of this {@link CborType}. + * + * @param other the {@link CborType} to compare against, cannot be null. + * @return true if the given {@link CborType} is of the same major type as this {@link CborType}, false otherwise. + * @throws IllegalArgumentException in case the given argument was null. + */ + public boolean isEqualType(CborType other) { + if (other == null) { + throw new IllegalArgumentException("Parameter cannot be null!"); + } + return m_major == other.m_major; + } + + /** + * Determines whether the major type of a given byte value (representing an encoded {@link CborType}) equals the major type of this {@link CborType}. + * + * @param encoded the encoded CBOR type to compare. + * @return true if the given byte value represents the same major type as this {@link CborType}, false otherwise. + */ + public boolean isEqualType(int encoded) { + return m_major == ((encoded & 0xff) >>> 5); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getName(m_major)).append('(').append(m_additional).append(')'); + return sb.toString(); + } +} diff --git a/plugins/com.minres.scviewer.database.ftr/src/jacob/packageinfo b/plugins/com.minres.scviewer.database.ftr/src/jacob/packageinfo new file mode 100644 index 0000000..a4f1546 --- /dev/null +++ b/plugins/com.minres.scviewer.database.ftr/src/jacob/packageinfo @@ -0,0 +1 @@ +version 1.0 \ No newline at end of file diff --git a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/AbstractTxStream.java b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/AbstractTxStream.java index 4ea449d..a3660ae 100644 --- a/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/AbstractTxStream.java +++ b/plugins/com.minres.scviewer.database.text/src/com/minres/scviewer/database/text/AbstractTxStream.java @@ -183,7 +183,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform { } } rowCount=rowEndTime.size()>0?rowEndTime.size():1; - getChildNodes().parallelStream().forEach(c -> ((TxGenerator)c).calculateConcurrency()); + //getChildNodes().parallelStream().forEach(c -> ((TxGenerator)c).calculateConcurrency()); + getChildNodes().stream().forEach(c -> ((TxGenerator)c).calculateConcurrency()); } - } diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java index c0c3fae..691fef4 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java @@ -585,6 +585,7 @@ public class WaveformView implements IWaveformView { if (trackVerticalOffset.isEmpty()) { waveformCanvas.setOrigin(0, 0); } + tl.dispose(); } private int calculateValueWidth() { @@ -595,6 +596,7 @@ public class WaveformView implements IWaveformView { tl.setText(v.currentValue); valueMaxWidth = Math.max(valueMaxWidth, tl.getBounds().width); } + tl.dispose(); return valueMaxWidth + 15; } diff --git a/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF index 0b7dec7..d232b9d 100644 --- a/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.database/META-INF/MANIFEST.MF @@ -7,6 +7,8 @@ Bundle-Vendor: MINRES Technologies GmbH Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: com.minres.scviewer.database, com.minres.scviewer.database.tx +Import-Package: org.slf4j +Require-Bundle: javax.inject;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml Automatic-Module-Name: com.minres.scviewer.database diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/DataType.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/DataType.java index 967078b..b37a16d 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/DataType.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/DataType.java @@ -51,6 +51,9 @@ public enum DataType { // T* ARRAY, /** The string. */ - // T[N] - STRING // string, std::string + // string, std::string + STRING, + /** The time. */ + // sc_time + TIME } diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java index 3514eef..4cc15c3 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java @@ -20,6 +20,11 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import javax.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.minres.scviewer.database.HierNode; import com.minres.scviewer.database.IHierNode; import com.minres.scviewer.database.IWaveform; @@ -47,7 +52,9 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL /** The max time. */ private long maxTime = -1; - + + private static final Logger LOG = LoggerFactory.getLogger(WaveformDb.class); + /** * Bind. * @@ -132,6 +139,7 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL try { loader.load(this, inp); } catch (Exception e) { + LOG.error("error loading file "+inp.getName(), e); retval=false; } loader.removePropertyChangeListener(this); diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/NavigateEvent.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/NavigateEvent.java index 7da354c..3c35c59 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/NavigateEvent.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/NavigateEvent.java @@ -32,7 +32,7 @@ public class NavigateEvent { @CanExecute public Boolean canExecute(EPartService partService){ MPart part = partService.getActivePart(); - if(part.getObject() instanceof WaveformViewer){ + if(part!=null && part.getObject() instanceof WaveformViewer){ Object sel = ((WaveformViewer)part.getObject()).getSelection(); if( sel instanceof IStructuredSelection) { if(((IStructuredSelection)sel).isEmpty()) return false; diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index b5ae1dc..f231ead 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -9,7 +9,7 @@ DesignBrowser_8=Insert before LoadingWaveformDb_0=Database loading... LoadStoreSettingsHandler_2=*.scview LoadStoreSettingsHandler_3=SCViewer.scview -OpenHandler_0=*.vcd;*.vcd.gz;*.txlog;*.txlog.gz;*.txdb;*.fbrdb +OpenHandler_0=*.vcd;*.vcd.gz;*.txlog;*.txlog.gz;*.txdb;*.fbrdb;*.ftr QuitHandler_0=Confirmation QuitHandler_1=Do you want to exit? RelationTypeToolControl_0=------------ diff --git a/pom.xml b/pom.xml index b4c65b8..be232f2 100644 --- a/pom.xml +++ b/pom.xml @@ -11,6 +11,7 @@ doc/com.minres.scviewer.doc plugins/com.minres.scviewer.database plugins/com.minres.scviewer.database.sqlite + plugins/com.minres.scviewer.database.ftr plugins/com.minres.scviewer.database.text plugins/com.minres.scviewer.database.vcd tests/com.minres.scviewer.database.test diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index 062b842..051b7ed 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -68,6 +68,7 @@ + diff --git a/releng/com.minres.scviewer.target/com.minres.scviewer.target.target b/releng/com.minres.scviewer.target/com.minres.scviewer.target.target index d36c8ee..55a1a8e 100644 --- a/releng/com.minres.scviewer.target/com.minres.scviewer.target.target +++ b/releng/com.minres.scviewer.target/com.minres.scviewer.target.target @@ -41,8 +41,12 @@ - - + + + + + + diff --git a/tests/com.minres.scviewer.database.test/DatabaseServicesTest.launch b/tests/com.minres.scviewer.database.test/DatabaseServicesTest.launch index 03a641c..75dbdeb 100644 --- a/tests/com.minres.scviewer.database.test/DatabaseServicesTest.launch +++ b/tests/com.minres.scviewer.database.test/DatabaseServicesTest.launch @@ -18,6 +18,7 @@ + @@ -28,6 +29,8 @@ + + diff --git a/tests/com.minres.scviewer.database.test/inputs/my_db.ftr b/tests/com.minres.scviewer.database.test/inputs/my_db.ftr new file mode 100644 index 0000000000000000000000000000000000000000..077592e2a9030aefa9b7223850182bfde04512bc GIT binary patch literal 1774 zcmZvb%WE4~6vpp7q>(%$$?@~}+VLZPD3N2wj-AJ%lz<5}^}?GhY$#Nsnl^G9*T@2s zc2VK$_8;gUAVa}~Zo0_Il#&!m;+C|;5DM88cjrxag@8Becg}c_DA|n8{LXjo9ev-u zuV24u9Ib`ltD?1CtIlp!w!+UUn_>AwyoIF)_C~E*+T1RERQtT@Y(h{fm#gPJm*2~! zTIu{fQN~0$8SYdowa_cGG8I-?kPdhF=eM;&XlEYOwd%5pZ)taip$#av7-C{u=0!(W)_45e}QrxGdXdMIZidxMS@DbSJwk+|urI?3e`nwaY=DwCa=u8wVEyW@f7}sjy z?>n-_Ls2}66wMdA_PX_DWB1vfom6sc_}?nLCz9u<2xlc`DKI%Y$@}}vEa*DGKW05(avXAhiH-=uK0rAF-G7RZRsm@MRATRYFQTVRhd?Fj zfqO+>lU$cJf);Z;D%3z>-Y z7Sn5>5)yI{dYkEWPzgq&!-t(Qy#Xp=%)L^geTV>@b?Yk*!0}?k?>?2Q43-2F!{Knu ze6Yyyyy!TD089+WrDYwn99U%dfnvrXbb*QCFgRxYVB$CIWhNnz1{J?yuTV+hBB=Nc zdxc60qoCq9>=i00jDyC03zZZmK*ev^D^yarl8XK2%M^V-6#&I=xj^`^CHw=L0TsXH z)?}O>hI4=|yCHqdbOAK7n{Nl`3e%gQ@c;ZqfIe#evG!xb_?B$~%Q3#2FoByizLzq7 zy2AvXZ-R7S{7lvanVj)EFPNaS%lO?r#_#PjL3h9LiDw4)r`;M?Fsqs2Ax5 K>P5QQZ2kvXxBwmi literal 0 HcmV?d00001 diff --git a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java index 21c3ac4..ef4f7ac 100644 --- a/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java +++ b/tests/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java @@ -15,15 +15,23 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.File; +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.junit.After; import org.junit.Before; import org.junit.Test; import com.minres.scviewer.database.EventEntry; +import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveformDb; +import com.minres.scviewer.database.tx.ITx; +import com.minres.scviewer.database.tx.ITxAttribute; +import com.minres.scviewer.database.tx.ITxEvent; public class DatabaseServicesTest { @@ -50,7 +58,7 @@ public class DatabaseServicesTest { assertEquals(2, waveformDb.getChildNodes().size()); IWaveform bus_data_wave = waves.get(0); EventEntry bus_data_entry = bus_data_wave.getEvents().floorEntry(1400000000L); - assertEquals("01111000", bus_data_entry.events[0].toString()); + assertEquals("00001011", bus_data_entry.events[0].toString()); IWaveform rw_wave = waves.get(2); EventEntry rw_entry = rw_wave.getEvents().floorEntry(2360000000L); assertEquals("1", rw_entry.events[0].toString()); @@ -62,8 +70,8 @@ public class DatabaseServicesTest { assertTrue(f.exists()); waveformDb.load(f); assertNotNull(waveformDb); - assertEquals(3, waveformDb.getAllWaves().size()); - assertEquals(1, waveformDb.getChildNodes().size()); + assertEquals(0, waveformDb.getAllWaves().size()); + assertEquals(0, waveformDb.getChildNodes().size()); } @Test @@ -73,7 +81,7 @@ public class DatabaseServicesTest { waveformDb.load(f); assertNotNull(waveformDb); List waveforms = waveformDb.getAllWaves(); - assertEquals(3, waveforms.size()); + assertEquals(8, waveforms.size()); assertEquals(1, waveformDb.getChildNodes().size()); for(IWaveform w:waveforms) { if(w.getId()==1) { @@ -92,7 +100,7 @@ public class DatabaseServicesTest { assertTrue(f.exists()); waveformDb.load(f); assertNotNull(waveformDb); - assertEquals(3, waveformDb.getAllWaves().size()); + assertEquals(8, waveformDb.getAllWaves().size()); assertEquals(1, waveformDb.getChildNodes().size()); } @@ -106,4 +114,38 @@ public class DatabaseServicesTest { assertEquals(1, waveformDb.getChildNodes().size()); } + @Test + public void testFtr() throws Exception { + File f = new File("inputs/my_db.ftr").getAbsoluteFile(); + assertTrue(f.exists()); + waveformDb.load(f); + assertNotNull(waveformDb); + List waveforms = waveformDb.getAllWaves(); + assertEquals(8, waveforms.size()); + assertEquals(1, waveformDb.getChildNodes().size()); + for(IWaveform w:waveforms) { + if(w.getId()==1) { + assertEquals(2, w.getRowCount()); + } else if(w.getId()==2l) { + assertEquals(1, w.getRowCount()); + } else if(w.getId()==3l) { + assertEquals(1, w.getRowCount()); + } + } + //waveforms.stream().filter(s -> s.getId()==1).collect(Collectors.toList()); + waveforms.stream().filter(s -> s.getId()==1).forEach(s -> { + assertEquals(27, s.getEvents().size()); + }); + waveforms.stream().filter(s -> s.getId()==1).map(s -> s.getEventsAtTime(0)).forEach(el -> { + assertEquals(1, el.length); + IEvent evt = el[0]; + assertTrue(evt instanceof ITxEvent); + ITx tx = ((ITxEvent)evt).getTransaction(); + assertNotNull(tx); + assertEquals(0, tx.getBeginTime()); + assertEquals(280000000, tx.getEndTime()); + List attr = tx.getAttributes(); + assertEquals(3, attr.size()); + }); + } } From b809042189c51ea3105a3e55df63c86a7be79c33 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 21 Feb 2023 19:24:13 +0100 Subject: [PATCH 4/5] fixes removing traces --- plugins/com.minres.scviewer.ui/plugin.xml | 31 ++++++++----------- .../com/minres/scviewer/ui/TxEditorPart.java | 4 +++ .../scviewer/ui/handler/RemoveHandler.java | 10 ++++-- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/plugins/com.minres.scviewer.ui/plugin.xml b/plugins/com.minres.scviewer.ui/plugin.xml index 4e7ff60..46310b0 100644 --- a/plugins/com.minres.scviewer.ui/plugin.xml +++ b/plugins/com.minres.scviewer.ui/plugin.xml @@ -316,30 +316,25 @@ id="com.minres.scviewer.ui.oneWaveSeleted"> - - - - - - - + + + + - - - - - - - + + + + Date: Tue, 21 Feb 2023 19:56:55 +0100 Subject: [PATCH 5/5] updates version numbers --- doc/com.minres.scviewer.doc/pom.xml | 2 +- features/com.minres.scviewer.database.feature/pom.xml | 2 +- features/com.minres.scviewer.e4.feature/pom.xml | 2 +- features/com.minres.scviewer.e4.help.feature/pom.xml | 2 +- features/com.minres.scviewer.e4.platform.feature/pom.xml | 2 +- features/com.minres.scviewer.feature/pom.xml | 2 +- features/com.minres.scviewer.ui.feature/pom.xml | 2 +- plugins/com.minres.scviewer.database.ftr/pom.xml | 2 +- plugins/com.minres.scviewer.database.sqlite/pom.xml | 2 +- plugins/com.minres.scviewer.database.text/pom.xml | 2 +- plugins/com.minres.scviewer.database.ui.swt/pom.xml | 2 +- plugins/com.minres.scviewer.database.vcd/pom.xml | 2 +- plugins/com.minres.scviewer.database/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.e4.application.help/pom.xml | 2 +- .../com.minres.scviewer.e4.application/META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.e4.application/pom.xml | 2 +- plugins/com.minres.scviewer.ui/pom.xml | 2 +- pom.xml | 4 ++-- products/com.minres.scviewer.e4.product/pom.xml | 4 ++-- products/com.minres.scviewer.e4.product/scviewer.product | 2 +- releng/com.minres.scviewer.target/pom.xml | 2 +- releng/com.minres.scviewer.updateSite/pom.xml | 2 +- tests/com.minres.scviewer.database.test/pom.xml | 2 +- 24 files changed, 26 insertions(+), 26 deletions(-) diff --git a/doc/com.minres.scviewer.doc/pom.xml b/doc/com.minres.scviewer.doc/pom.xml index ac99b20..27d7d1a 100644 --- a/doc/com.minres.scviewer.doc/pom.xml +++ b/doc/com.minres.scviewer.doc/pom.xml @@ -7,7 +7,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. diff --git a/features/com.minres.scviewer.database.feature/pom.xml b/features/com.minres.scviewer.database.feature/pom.xml index f445d67..0cf5a2a 100644 --- a/features/com.minres.scviewer.database.feature/pom.xml +++ b/features/com.minres.scviewer.database.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. 3.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.feature/pom.xml b/features/com.minres.scviewer.e4.feature/pom.xml index 94a5118..368c1a7 100644 --- a/features/com.minres.scviewer.e4.feature/pom.xml +++ b/features/com.minres.scviewer.e4.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. 1.1.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.help.feature/pom.xml b/features/com.minres.scviewer.e4.help.feature/pom.xml index 2f51a4c..5d0c641 100644 --- a/features/com.minres.scviewer.e4.help.feature/pom.xml +++ b/features/com.minres.scviewer.e4.help.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. 1.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.platform.feature/pom.xml b/features/com.minres.scviewer.e4.platform.feature/pom.xml index 4507cad..6cc5df3 100644 --- a/features/com.minres.scviewer.e4.platform.feature/pom.xml +++ b/features/com.minres.scviewer.e4.platform.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. 1.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.feature/pom.xml b/features/com.minres.scviewer.feature/pom.xml index 991d0e5..67f14a9 100644 --- a/features/com.minres.scviewer.feature/pom.xml +++ b/features/com.minres.scviewer.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. 1.1.0-SNAPSHOT diff --git a/features/com.minres.scviewer.ui.feature/pom.xml b/features/com.minres.scviewer.ui.feature/pom.xml index d62fad2..f98fb1c 100644 --- a/features/com.minres.scviewer.ui.feature/pom.xml +++ b/features/com.minres.scviewer.ui.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. 1.1.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.database.ftr/pom.xml b/plugins/com.minres.scviewer.database.ftr/pom.xml index fb19581..b35f6b7 100644 --- a/plugins/com.minres.scviewer.database.ftr/pom.xml +++ b/plugins/com.minres.scviewer.database.ftr/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.sqlite/pom.xml b/plugins/com.minres.scviewer.database.sqlite/pom.xml index 6acc76f..38f7d5c 100644 --- a/plugins/com.minres.scviewer.database.sqlite/pom.xml +++ b/plugins/com.minres.scviewer.database.sqlite/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.text/pom.xml b/plugins/com.minres.scviewer.database.text/pom.xml index ee4b549..645facd 100644 --- a/plugins/com.minres.scviewer.database.text/pom.xml +++ b/plugins/com.minres.scviewer.database.text/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.ui.swt/pom.xml b/plugins/com.minres.scviewer.database.ui.swt/pom.xml index 23ddfa4..c8c1553 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/pom.xml +++ b/plugins/com.minres.scviewer.database.ui.swt/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. 4.0.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.database.vcd/pom.xml b/plugins/com.minres.scviewer.database.vcd/pom.xml index 129a6c0..7fe350b 100644 --- a/plugins/com.minres.scviewer.database.vcd/pom.xml +++ b/plugins/com.minres.scviewer.database.vcd/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database/pom.xml b/plugins/com.minres.scviewer.database/pom.xml index 5ce5fb9..593105a 100644 --- a/plugins/com.minres.scviewer.database/pom.xml +++ b/plugins/com.minres.scviewer.database/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.e4.application.help/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.e4.application.help/META-INF/MANIFEST.MF index c3b825a..6e54435 100644 --- a/plugins/com.minres.scviewer.e4.application.help/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.e4.application.help/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: SCViewer Help Bundle-SymbolicName: com.minres.scviewer.e4.application.help;singleton:=true -Bundle-Version: 2.16.1 +Bundle-Version: 2.17.0 Bundle-Vendor: MINRES Technologies GmbH Automatic-Module-Name: com.minres.scviewer.e4.application.help Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/plugins/com.minres.scviewer.e4.application.help/pom.xml b/plugins/com.minres.scviewer.e4.application.help/pom.xml index f4a54f1..c913303 100644 --- a/plugins/com.minres.scviewer.e4.application.help/pom.xml +++ b/plugins/com.minres.scviewer.e4.application.help/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF index 943cacc..b3c837d 100644 --- a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true -Bundle-Version: 2.16.1 +Bundle-Version: 2.17.0 Bundle-Vendor: %Bundle-Vendor Require-Bundle: javax.inject;bundle-version="1.0.0", org.eclipse.core.runtime;bundle-version="3.11.1", diff --git a/plugins/com.minres.scviewer.e4.application/pom.xml b/plugins/com.minres.scviewer.e4.application/pom.xml index b63206d..673a2e5 100644 --- a/plugins/com.minres.scviewer.e4.application/pom.xml +++ b/plugins/com.minres.scviewer.e4.application/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.ui/pom.xml b/plugins/com.minres.scviewer.ui/pom.xml index d38d355..33d8616 100644 --- a/plugins/com.minres.scviewer.ui/pom.xml +++ b/plugins/com.minres.scviewer.ui/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-plugin diff --git a/pom.xml b/pom.xml index be232f2..e5ce28d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 pom releng/com.minres.scviewer.target @@ -70,7 +70,7 @@ com.minres.scviewer com.minres.scviewer.target - 2.16.1 + 2.17.0 org.eclipse.justj.openjdk.hotspot.jre.minimal-15 diff --git a/products/com.minres.scviewer.e4.product/pom.xml b/products/com.minres.scviewer.e4.product/pom.xml index 7f1fe2d..a9de28e 100644 --- a/products/com.minres.scviewer.e4.product/pom.xml +++ b/products/com.minres.scviewer.e4.product/pom.xml @@ -6,11 +6,11 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. com.minres.scviewer.e4.product - 2.16.1 + 2.17.0 eclipse-repository com.minres.scviewer diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index 051b7ed..237a44b 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -1,7 +1,7 @@ - + diff --git a/releng/com.minres.scviewer.target/pom.xml b/releng/com.minres.scviewer.target/pom.xml index b680d5b..62c3b58 100644 --- a/releng/com.minres.scviewer.target/pom.xml +++ b/releng/com.minres.scviewer.target/pom.xml @@ -12,7 +12,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. diff --git a/releng/com.minres.scviewer.updateSite/pom.xml b/releng/com.minres.scviewer.updateSite/pom.xml index 6976eb7..90e84a3 100644 --- a/releng/com.minres.scviewer.updateSite/pom.xml +++ b/releng/com.minres.scviewer.updateSite/pom.xml @@ -7,7 +7,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. diff --git a/tests/com.minres.scviewer.database.test/pom.xml b/tests/com.minres.scviewer.database.test/pom.xml index 7d8f2b2..1d34b0a 100644 --- a/tests/com.minres.scviewer.database.test/pom.xml +++ b/tests/com.minres.scviewer.database.test/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.16.1 + 2.17.0 ../.. eclipse-test-plugin