Compare commits
1 Commits
tx_end_tim
...
2.6
Author | SHA1 | Date | |
---|---|---|---|
ae3dcb51ad |
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,6 +6,5 @@
|
|||||||
SCViewer initiator_target.launch
|
SCViewer initiator_target.launch
|
||||||
SCViewer.xcf
|
SCViewer.xcf
|
||||||
SCViewer_1.png
|
SCViewer_1.png
|
||||||
|
*.launch
|
||||||
copyrightLog.txt
|
copyrightLog.txt
|
||||||
/workspace
|
|
||||||
?*.launch
|
|
@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
|
|
||||||
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
|
|
||||||
<stringAttribute key="M2_GOALS" value="package"/>
|
|
||||||
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
|
|
||||||
<booleanAttribute key="M2_OFFLINE" value="false"/>
|
|
||||||
<stringAttribute key="M2_PROFILES" value=""/>
|
|
||||||
<listAttribute key="M2_PROPERTIES"/>
|
|
||||||
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
|
|
||||||
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
|
|
||||||
<intAttribute key="M2_THREADS" value="1"/>
|
|
||||||
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
|
|
||||||
<stringAttribute key="M2_USER_SETTINGS" value=""/>
|
|
||||||
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
|
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.minres.scviewer.parent}"/>
|
|
||||||
</launchConfiguration>
|
|
@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
|
|
||||||
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
|
|
||||||
<stringAttribute key="M2_GOALS" value="package"/>
|
|
||||||
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
|
|
||||||
<booleanAttribute key="M2_OFFLINE" value="false"/>
|
|
||||||
<stringAttribute key="M2_PROFILES" value="release-composite"/>
|
|
||||||
<listAttribute key="M2_PROPERTIES"/>
|
|
||||||
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
|
|
||||||
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
|
|
||||||
<intAttribute key="M2_THREADS" value="1"/>
|
|
||||||
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
|
|
||||||
<stringAttribute key="M2_USER_SETTINGS" value=""/>
|
|
||||||
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="true"/>
|
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/AdoptOpenJDK 8 [1.8.0_232]"/>
|
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.minres.scviewer.parent}"/>
|
|
||||||
</launchConfiguration>
|
|
@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
|
|
||||||
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
|
|
||||||
<stringAttribute key="M2_GOALS" value="tycho-versions:set-version tycho-versions:update-pom"/>
|
|
||||||
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
|
|
||||||
<booleanAttribute key="M2_OFFLINE" value="false"/>
|
|
||||||
<stringAttribute key="M2_PROFILES" value=""/>
|
|
||||||
<listAttribute key="M2_PROPERTIES">
|
|
||||||
<listEntry value="newVersion=${string_prompt:new version number}"/>
|
|
||||||
</listAttribute>
|
|
||||||
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
|
|
||||||
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
|
|
||||||
<intAttribute key="M2_THREADS" value="1"/>
|
|
||||||
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
|
|
||||||
<stringAttribute key="M2_USER_SETTINGS" value=""/>
|
|
||||||
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
|
|
||||||
<stringAttribute key="bad_container_name" value="/com.minres.scviewer.parent/.launch"/>
|
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.minres.scviewer.parent}"/>
|
|
||||||
</launchConfiguration>
|
|
@ -9,6 +9,7 @@ Import-Package: org.osgi.framework;version="1.3.0"
|
|||||||
Automatic-Module-Name: com.minres.scviewer.database.leveldb
|
Automatic-Module-Name: com.minres.scviewer.database.leveldb
|
||||||
Service-Component: OSGI-INF/*.xml
|
Service-Component: OSGI-INF/*.xml
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-ClassPath: leveldb-0.11-SNAPSHOT-uber.jar,
|
Bundle-ClassPath: leveldb-0.11-SNAPSHOT-uber.jar,
|
@ -7,7 +7,7 @@
|
|||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
@ -4,5 +4,4 @@ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: SQLite transaction database
|
Bundle-Name: SQLite transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
||||||
Bundle-Version: 1.1.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0"
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0"
|
@ -1,5 +1,5 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2014, 2015-2021 MINRES Technologies GmbH and others.
|
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
@ -4,8 +4,8 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>2.11.0</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -15,5 +15,5 @@
|
|||||||
<version>3.8.7</version>
|
<version>3.8.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<version>1.1.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -11,11 +11,10 @@
|
|||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.beans.PropertyChangeSupport;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -25,7 +24,6 @@ import java.util.List;
|
|||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||||
import com.minres.scviewer.database.InputFormatException;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
|
||||||
@ -39,21 +37,21 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
protected IDatabase database;
|
protected IDatabase database;
|
||||||
|
|
||||||
private List<RelationType> usedRelationsList = new ArrayList<>();
|
private List<RelationType> usedRelationsList = new ArrayList<>();
|
||||||
|
|
||||||
|
private IWaveformDb db;
|
||||||
|
|
||||||
private ScvSimProps scvSimProps;
|
private ScvSimProps scvSimProps;
|
||||||
|
|
||||||
private static final byte[] x = "SQLite format 3".getBytes();
|
public SQLiteDbLoader() {
|
||||||
|
}
|
||||||
/** The pcs. */
|
|
||||||
protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getMaxTime() {
|
public Long getMaxTime() {
|
||||||
SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class,
|
SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
|
||||||
database, "time = (SELECT MAX(time) FROM ScvTxEvent)");
|
database, "time = (SELECT MAX(time) FROM ScvTxEvent)");
|
||||||
try {
|
try {
|
||||||
List<ScvTxEvent> event = handler.selectObjects();
|
List<ScvTxEvent> event = handler.selectObjects();
|
||||||
if(!event.isEmpty())
|
if(event.size()>0)
|
||||||
return event.get(0).getTime()*scvSimProps.getTime_resolution();
|
return event.get(0).getTime()*scvSimProps.getTime_resolution();
|
||||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
@ -64,85 +62,59 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<>(ScvStream.class, database);
|
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
||||||
List<IWaveform> streams=new ArrayList<>();
|
List<IWaveform> streams=new ArrayList<IWaveform>();
|
||||||
try {
|
try {
|
||||||
for(ScvStream scvStream:handler.selectObjects()){
|
for(ScvStream scvStream:handler.selectObjects()){
|
||||||
TxStream stream = new TxStream(database, scvStream);
|
TxStream stream = new TxStream(database, db, scvStream);
|
||||||
stream.setRelationTypeList(usedRelationsList);
|
stream.setRelationTypeList(usedRelationsList);
|
||||||
streams.add(stream);
|
streams.add(stream);
|
||||||
}
|
}
|
||||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private byte[] x = "SQLite format 3".getBytes();
|
||||||
public boolean canLoad(File inputFile) {
|
|
||||||
if (!inputFile.isDirectory() && inputFile.exists()) {
|
|
||||||
try(InputStream stream = new FileInputStream(inputFile)){
|
|
||||||
byte[] buffer = new byte[x.length];
|
|
||||||
int readCnt = stream.read(buffer, 0, x.length);
|
|
||||||
if (readCnt == x.length) {
|
|
||||||
for (int i = 0; i < x.length; i++)
|
|
||||||
if (buffer[i] != x[i])
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(IWaveformDb db, File file) throws InputFormatException {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
dispose();
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
database=new SQLiteDatabase(file.getAbsolutePath(), db);
|
this.db=db;
|
||||||
|
try {
|
||||||
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
byte[] buffer = new byte[x.length];
|
||||||
|
int read = fis.read(buffer, 0, x.length);
|
||||||
|
fis.close();
|
||||||
|
if (read == x.length)
|
||||||
|
for (int i = 0; i < x.length; i++)
|
||||||
|
if (buffer[i] != x[i]) return false;
|
||||||
|
} catch(FileNotFoundException e) {
|
||||||
|
return false;
|
||||||
|
} catch(IOException e) { //if an I/O error occurs
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
database=new SQLiteDatabase(file.getAbsolutePath());
|
||||||
database.setData("TIMERESOLUTION", 1L);
|
database.setData("TIMERESOLUTION", 1L);
|
||||||
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<>(ScvSimProps.class, database);
|
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<ScvSimProps>(ScvSimProps.class, database);
|
||||||
try {
|
try {
|
||||||
for(ScvSimProps simProps:handler.selectObjects()){
|
for(ScvSimProps simProps:handler.selectObjects()){
|
||||||
scvSimProps=simProps;
|
scvSimProps=simProps;
|
||||||
database.setData("TIMERESOLUTION", scvSimProps.getTime_resolution());
|
database.setData("TIMERESOLUTION", scvSimProps.getTime_resolution());
|
||||||
}
|
}
|
||||||
pcs.firePropertyChange(IWaveformDbLoader.LOADING_FINISHED, null, null);
|
return true;
|
||||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
throw new InputFormatException(e.toString());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
|
||||||
database=null;
|
|
||||||
usedRelationsList=null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<RelationType> getAllRelationTypes(){
|
public Collection<RelationType> getAllRelationTypes(){
|
||||||
return usedRelationsList;
|
return usedRelationsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -18,7 +18,12 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.minres.scviewer.database.AssociationType;
|
import com.minres.scviewer.database.AssociationType;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.ITxGenerator;
|
||||||
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvStream;
|
import com.minres.scviewer.database.sqlite.tables.ScvStream;
|
||||||
@ -26,10 +31,6 @@ import com.minres.scviewer.database.sqlite.tables.ScvTx;
|
|||||||
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
|
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvTxEvent;
|
import com.minres.scviewer.database.sqlite.tables.ScvTxEvent;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvTxRelation;
|
import com.minres.scviewer.database.sqlite.tables.ScvTxRelation;
|
||||||
import com.minres.scviewer.database.tx.ITx;
|
|
||||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
|
||||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
|
||||||
import com.minres.scviewer.database.tx.ITxRelation;
|
|
||||||
|
|
||||||
public class Tx implements ITx {
|
public class Tx implements ITx {
|
||||||
|
|
||||||
@ -38,10 +39,8 @@ public class Tx implements ITx {
|
|||||||
private TxGenerator trGenerator;
|
private TxGenerator trGenerator;
|
||||||
private ScvTx scvTx;
|
private ScvTx scvTx;
|
||||||
private List<ITxAttribute> attributes;
|
private List<ITxAttribute> attributes;
|
||||||
private Long begin;
|
private Long begin, end;
|
||||||
private Long end;
|
private List<ITxRelation> incoming, outgoing;
|
||||||
private List<ITxRelation> incoming;
|
|
||||||
private List<ITxRelation> outgoing;
|
|
||||||
|
|
||||||
public Tx(IDatabase database, TxStream trStream, TxGenerator trGenerator, ScvTx scvTx) {
|
public Tx(IDatabase database, TxStream trStream, TxGenerator trGenerator, ScvTx scvTx) {
|
||||||
this.database=database;
|
this.database=database;
|
||||||
@ -56,7 +55,7 @@ public class Tx implements ITx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWaveform getStream() {
|
public ITxStream<ITxEvent> getStream() {
|
||||||
return trStream;
|
return trStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +72,7 @@ public class Tx implements ITx {
|
|||||||
@Override
|
@Override
|
||||||
public Long getBeginTime() {
|
public Long getBeginTime() {
|
||||||
if(begin==null){
|
if(begin==null){
|
||||||
SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class,
|
SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
|
||||||
database, "tx="+scvTx.getId()+" AND type="+ AssociationType.BEGIN.ordinal());
|
database, "tx="+scvTx.getId()+" AND type="+ AssociationType.BEGIN.ordinal());
|
||||||
try {
|
try {
|
||||||
for(ScvTxEvent scvEvent:handler.selectObjects()){
|
for(ScvTxEvent scvEvent:handler.selectObjects()){
|
||||||
@ -89,7 +88,7 @@ public class Tx implements ITx {
|
|||||||
@Override
|
@Override
|
||||||
public Long getEndTime() {
|
public Long getEndTime() {
|
||||||
if(end==null){
|
if(end==null){
|
||||||
SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class,
|
SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
|
||||||
database, "tx="+scvTx.getId()+" AND type="+ AssociationType.END.ordinal());
|
database, "tx="+scvTx.getId()+" AND type="+ AssociationType.END.ordinal());
|
||||||
try {
|
try {
|
||||||
for(ScvTxEvent scvEvent:handler.selectObjects()){
|
for(ScvTxEvent scvEvent:handler.selectObjects()){
|
||||||
@ -105,10 +104,10 @@ public class Tx implements ITx {
|
|||||||
@Override
|
@Override
|
||||||
public List<ITxAttribute> getAttributes() {
|
public List<ITxAttribute> getAttributes() {
|
||||||
if(attributes==null){
|
if(attributes==null){
|
||||||
SQLiteDatabaseSelectHandler<ScvTxAttribute> handler = new SQLiteDatabaseSelectHandler<>(
|
SQLiteDatabaseSelectHandler<ScvTxAttribute> handler = new SQLiteDatabaseSelectHandler<ScvTxAttribute>(
|
||||||
ScvTxAttribute.class, database, "tx="+scvTx.getId());
|
ScvTxAttribute.class, database, "tx="+scvTx.getId());
|
||||||
try {
|
try {
|
||||||
attributes = new ArrayList<>();
|
attributes = new ArrayList<ITxAttribute>();
|
||||||
for(ScvTxAttribute scvAttribute:handler.selectObjects()){
|
for(ScvTxAttribute scvAttribute:handler.selectObjects()){
|
||||||
attributes.add(new TxAttribute(this, scvAttribute));
|
attributes.add(new TxAttribute(this, scvAttribute));
|
||||||
|
|
||||||
@ -123,10 +122,10 @@ public class Tx implements ITx {
|
|||||||
@Override
|
@Override
|
||||||
public Collection<ITxRelation> getIncomingRelations() {
|
public Collection<ITxRelation> getIncomingRelations() {
|
||||||
if(incoming==null){
|
if(incoming==null){
|
||||||
SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<>(
|
SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<ScvTxRelation>(
|
||||||
ScvTxRelation.class, database, "sink="+scvTx.getId());
|
ScvTxRelation.class, database, "sink="+scvTx.getId());
|
||||||
try {
|
try {
|
||||||
incoming = new ArrayList<>();
|
incoming = new ArrayList<ITxRelation>();
|
||||||
for(ScvTxRelation scvRelation:handler.selectObjects()){
|
for(ScvTxRelation scvRelation:handler.selectObjects()){
|
||||||
incoming.add(createRelation(scvRelation, false));
|
incoming.add(createRelation(scvRelation, false));
|
||||||
}
|
}
|
||||||
@ -140,10 +139,10 @@ public class Tx implements ITx {
|
|||||||
@Override
|
@Override
|
||||||
public Collection<ITxRelation> getOutgoingRelations() {
|
public Collection<ITxRelation> getOutgoingRelations() {
|
||||||
if(outgoing==null){
|
if(outgoing==null){
|
||||||
SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<>(
|
SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<ScvTxRelation>(
|
||||||
ScvTxRelation.class, database, "src="+scvTx.getId());
|
ScvTxRelation.class, database, "src="+scvTx.getId());
|
||||||
try {
|
try {
|
||||||
outgoing = new ArrayList<>();
|
outgoing = new ArrayList<ITxRelation>();
|
||||||
for(ScvTxRelation scvRelation:handler.selectObjects()){
|
for(ScvTxRelation scvRelation:handler.selectObjects()){
|
||||||
outgoing.add(createRelation(scvRelation, true));
|
outgoing.add(createRelation(scvRelation, true));
|
||||||
}
|
}
|
||||||
@ -156,7 +155,7 @@ public class Tx implements ITx {
|
|||||||
|
|
||||||
private ITxRelation createRelation(ScvTxRelation rel, boolean outgoing) {
|
private ITxRelation createRelation(ScvTxRelation rel, boolean outgoing) {
|
||||||
int otherId = outgoing?rel.getSink():rel.getSrc();
|
int otherId = outgoing?rel.getSink():rel.getSrc();
|
||||||
SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<>(ScvTx.class, database,
|
SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database,
|
||||||
"id="+otherId);
|
"id="+otherId);
|
||||||
try {
|
try {
|
||||||
List<ScvTx> res = handler.selectObjects();
|
List<ScvTx> res = handler.selectObjects();
|
||||||
@ -164,7 +163,7 @@ public class Tx implements ITx {
|
|||||||
List<ScvStream> streams = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database,
|
List<ScvStream> streams = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database,
|
||||||
"id="+res.get(0).getStream()).selectObjects();
|
"id="+res.get(0).getStream()).selectObjects();
|
||||||
if(streams.size()!=1) return null;
|
if(streams.size()!=1) return null;
|
||||||
TxStream tgtStream = (TxStream) database.getWaveformDb().getStreamByName(streams.get(0).getName());
|
TxStream tgtStream = (TxStream) trStream.getDb().getStreamByName(streams.get(0).getName());
|
||||||
Tx that = (Tx) tgtStream.getTransactions().get(otherId);
|
Tx that = (Tx) tgtStream.getTransactions().get(otherId);
|
||||||
if(outgoing)
|
if(outgoing)
|
||||||
return new TxRelation(trStream.getRelationType(rel.getName()), this, that);
|
return new TxRelation(trStream.getRelationType(rel.getName()), this, that);
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -12,8 +12,8 @@ package com.minres.scviewer.database.sqlite;
|
|||||||
|
|
||||||
import com.minres.scviewer.database.AssociationType;
|
import com.minres.scviewer.database.AssociationType;
|
||||||
import com.minres.scviewer.database.DataType;
|
import com.minres.scviewer.database.DataType;
|
||||||
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
|
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
|
||||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
|
||||||
|
|
||||||
public class TxAttribute implements ITxAttribute{
|
public class TxAttribute implements ITxAttribute{
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -10,18 +10,16 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import com.minres.scviewer.database.EventKind;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.IEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.WaveformType;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.tx.ITx;
|
|
||||||
import com.minres.scviewer.database.tx.ITxEvent;
|
|
||||||
|
|
||||||
public class TxEvent implements ITxEvent {
|
public class TxEvent implements ITxEvent {
|
||||||
|
|
||||||
private final EventKind type;
|
private final Type type;
|
||||||
private ITx tx;
|
private ITx tx;
|
||||||
|
|
||||||
public TxEvent(EventKind type, ITx tx) {
|
public TxEvent(Type type, ITx tx) {
|
||||||
super();
|
super();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.tx = tx;
|
this.tx = tx;
|
||||||
@ -29,21 +27,26 @@ public class TxEvent implements ITxEvent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getTime() {
|
public Long getTime() {
|
||||||
return type==EventKind.BEGIN?tx.getBeginTime():tx.getEndTime();
|
return type==Type.BEGIN?tx.getBeginTime():tx.getEndTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IEvent duplicate() throws CloneNotSupportedException {
|
public IWaveformEvent duplicate() throws CloneNotSupportedException {
|
||||||
return new TxEvent(type, tx);
|
return new TxEvent(type, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(IWaveformEvent o) {
|
||||||
|
return getTime().compareTo(o.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITx getTransaction() {
|
public ITx getTransaction() {
|
||||||
return tx;
|
return tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EventKind getKind() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,9 +54,4 @@ public class TxEvent implements ITxEvent {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
|
return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public WaveformType getType() {
|
|
||||||
return WaveformType.TRANSACTION;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 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.sqlite;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.ITxGenerator;
|
||||||
|
import com.minres.scviewer.database.ITxStream;
|
||||||
|
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||||
|
|
||||||
|
public class TxGenerator implements ITxGenerator {
|
||||||
|
|
||||||
|
private ITxStream<ITxEvent> stream;
|
||||||
|
|
||||||
|
private ScvGenerator scvGenerator;
|
||||||
|
|
||||||
|
public TxGenerator(ITxStream<ITxEvent> stream, ScvGenerator scvGenerator) {
|
||||||
|
this.stream=stream;
|
||||||
|
this.scvGenerator=scvGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return (long) scvGenerator.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITxStream<ITxEvent> getStream() {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return scvGenerator.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ITx> getTransactions() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -10,15 +10,14 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.tx.ITx;
|
|
||||||
import com.minres.scviewer.database.tx.ITxRelation;
|
|
||||||
|
|
||||||
public class TxRelation implements ITxRelation {
|
public class TxRelation implements ITxRelation {
|
||||||
|
|
||||||
RelationType relationType;
|
RelationType relationType;
|
||||||
Tx source;
|
Tx source, target;
|
||||||
Tx target;
|
|
||||||
|
|
||||||
public TxRelation(RelationType relationType, Tx source, Tx target) {
|
public TxRelation(RelationType relationType, Tx source, Tx target) {
|
||||||
this.source = source;
|
this.source = source;
|
@ -0,0 +1,199 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 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.sqlite;
|
||||||
|
|
||||||
|
import java.beans.IntrospectionException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.NavigableMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.HierNode;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.ITxGenerator;
|
||||||
|
import com.minres.scviewer.database.ITxStream;
|
||||||
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||||
|
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||||
|
import com.minres.scviewer.database.sqlite.tables.ScvStream;
|
||||||
|
import com.minres.scviewer.database.sqlite.tables.ScvTx;
|
||||||
|
|
||||||
|
public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||||
|
|
||||||
|
private IDatabase database;
|
||||||
|
|
||||||
|
private String fullName;
|
||||||
|
|
||||||
|
private IWaveformDb db;
|
||||||
|
|
||||||
|
private ScvStream scvStream;
|
||||||
|
|
||||||
|
private TreeMap<Integer, TxGenerator> generators;
|
||||||
|
|
||||||
|
private TreeMap<Integer, ITx> transactions;
|
||||||
|
|
||||||
|
private Integer maxConcurrency;
|
||||||
|
|
||||||
|
private TreeMap<Long, List<ITxEvent>> events;
|
||||||
|
|
||||||
|
private List<RelationType> usedRelationsList;
|
||||||
|
|
||||||
|
public TxStream(IDatabase database, IWaveformDb waveformDb, ScvStream scvStream) {
|
||||||
|
super(scvStream.getName());
|
||||||
|
this.database=database;
|
||||||
|
fullName=scvStream.getName();
|
||||||
|
this.scvStream=scvStream;
|
||||||
|
db=waveformDb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWaveformDb getDb() {
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFullName() {
|
||||||
|
return fullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return (long) scvStream.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKind() {
|
||||||
|
return scvStream.getKind();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ITxGenerator> getGenerators() {
|
||||||
|
if(generators==null){
|
||||||
|
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
|
||||||
|
ScvGenerator.class, database, "stream="+scvStream.getId());
|
||||||
|
generators=new TreeMap<Integer, TxGenerator>();
|
||||||
|
try {
|
||||||
|
for(ScvGenerator scvGenerator:handler.selectObjects()){
|
||||||
|
generators.put(scvGenerator.getId(), new TxGenerator(this, scvGenerator));
|
||||||
|
}
|
||||||
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList<ITxGenerator>(generators.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxConcurrency() {
|
||||||
|
if(maxConcurrency==null){
|
||||||
|
java.sql.Connection connection=null;
|
||||||
|
java.sql.Statement statement=null;
|
||||||
|
java.sql.ResultSet resultSet=null;
|
||||||
|
try {
|
||||||
|
connection = database.createConnection();
|
||||||
|
statement = connection.createStatement();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("SELECT MAX(concurrencyLevel) as concurrencyLevel FROM ScvTx where stream=");
|
||||||
|
sb.append(scvStream.getId());
|
||||||
|
resultSet = statement.executeQuery(sb.toString());
|
||||||
|
while (resultSet.next()) {
|
||||||
|
if(maxConcurrency==null) maxConcurrency=0;
|
||||||
|
Object value = resultSet.getObject("concurrencyLevel");
|
||||||
|
if(value!=null)
|
||||||
|
maxConcurrency=(Integer) value;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
if(maxConcurrency==null) maxConcurrency=0;
|
||||||
|
} finally {
|
||||||
|
try{
|
||||||
|
if(resultSet!=null) resultSet.close();
|
||||||
|
if(statement!=null) statement.close();
|
||||||
|
if(connection!=null) connection.close();
|
||||||
|
} catch (SQLException e) { }
|
||||||
|
}
|
||||||
|
maxConcurrency+=1;
|
||||||
|
}
|
||||||
|
return maxConcurrency;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NavigableMap<Long, List<ITxEvent>> getEvents(){
|
||||||
|
if(events==null){
|
||||||
|
events=new TreeMap<Long, List<ITxEvent>>();
|
||||||
|
for(Entry<Integer, ITx> entry:getTransactions().entrySet()){
|
||||||
|
putEvent(new TxEvent(TxEvent.Type.BEGIN, entry.getValue()));
|
||||||
|
putEvent(new TxEvent(TxEvent.Type.END, entry.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void putEvent(TxEvent ev){
|
||||||
|
Long time = ev.getTime();
|
||||||
|
if(!events.containsKey(time)){
|
||||||
|
Vector<ITxEvent> vector=new Vector<ITxEvent>();
|
||||||
|
vector.add(ev);
|
||||||
|
events.put(time, vector);
|
||||||
|
} else {
|
||||||
|
events.get(time).add(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Map<Integer, ITx> getTransactions() {
|
||||||
|
if(transactions==null){
|
||||||
|
if(generators==null) getGenerators();
|
||||||
|
transactions = new TreeMap<Integer, ITx>();
|
||||||
|
SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database,
|
||||||
|
"stream="+scvStream.getId());
|
||||||
|
try {
|
||||||
|
for(ScvTx scvTx:handler.selectObjects()){
|
||||||
|
transactions.put(scvTx.getId(), new Tx(database, this, generators.get(scvTx.getGenerator()), scvTx));
|
||||||
|
}
|
||||||
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return transactions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ITxEvent> getWaveformEventsAtTime(Long time) {
|
||||||
|
return getEvents().get(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelationTypeList(List<RelationType> usedRelationsList){
|
||||||
|
this.usedRelationsList=usedRelationsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelationType getRelationType(String name) {
|
||||||
|
RelationType relType=RelationType.create(name);
|
||||||
|
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
|
||||||
|
return relType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean equals(IWaveform other) {
|
||||||
|
return(other instanceof TxStream && this.getId().equals(other.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -16,8 +16,6 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Creates a connection to a database.
|
* Creates a connection to a database.
|
||||||
@ -60,6 +58,4 @@ public interface IDatabase {
|
|||||||
public void setData(String name, Object value);
|
public void setData(String name, Object value);
|
||||||
|
|
||||||
public Object getData(String name);
|
public Object getData(String name);
|
||||||
|
|
||||||
public IWaveformDb getWaveformDb();
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -20,14 +20,10 @@ import java.sql.SQLException;
|
|||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
|
||||||
|
|
||||||
public class SQLiteDatabase implements IDatabase {
|
public class SQLiteDatabase implements IDatabase {
|
||||||
|
|
||||||
protected String dbFileName;
|
protected String dbFileName;
|
||||||
|
|
||||||
protected IWaveformDb waveformDb;
|
|
||||||
|
|
||||||
protected HashMap<String, Object> props;
|
protected HashMap<String, Object> props;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -43,10 +39,9 @@ public class SQLiteDatabase implements IDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SQLiteDatabase(String dbFileName, IWaveformDb waveformDb) {
|
public SQLiteDatabase(String dbFileName) {
|
||||||
super();
|
super();
|
||||||
this.dbFileName = dbFileName;
|
this.dbFileName = dbFileName;
|
||||||
this.waveformDb = waveformDb;
|
|
||||||
props = new HashMap<String, Object>();
|
props = new HashMap<String, Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,9 +89,4 @@ public class SQLiteDatabase implements IDatabase {
|
|||||||
return props.get(name);
|
return props.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IWaveformDb getWaveformDb() {
|
|
||||||
return waveformDb;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -77,6 +77,7 @@ public class SQLiteDatabaseSelectHandler<T> extends AbstractDatabaseHandler<T> {
|
|||||||
* @throws InvocationTargetException
|
* @throws InvocationTargetException
|
||||||
*/
|
*/
|
||||||
public synchronized List<T> selectObjects() throws SQLException,
|
public synchronized List<T> selectObjects() throws SQLException,
|
||||||
|
SecurityException, IllegalArgumentException,
|
||||||
InstantiationException, IllegalAccessException,
|
InstantiationException, IllegalAccessException,
|
||||||
IntrospectionException, InvocationTargetException {
|
IntrospectionException, InvocationTargetException {
|
||||||
|
|
||||||
@ -115,11 +116,12 @@ public class SQLiteDatabaseSelectHandler<T> extends AbstractDatabaseHandler<T> {
|
|||||||
* @throws InvocationTargetException
|
* @throws InvocationTargetException
|
||||||
*/
|
*/
|
||||||
private List<T> createObjects(ResultSet resultSet)
|
private List<T> createObjects(ResultSet resultSet)
|
||||||
throws SQLException, InstantiationException,
|
throws SecurityException, IllegalArgumentException,
|
||||||
|
SQLException, InstantiationException,
|
||||||
IllegalAccessException, IntrospectionException,
|
IllegalAccessException, IntrospectionException,
|
||||||
InvocationTargetException {
|
InvocationTargetException {
|
||||||
|
|
||||||
List<T> list = new ArrayList<>();
|
List<T> list = new ArrayList<T>();
|
||||||
|
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
@ -5,5 +5,4 @@ org.eclipse.jdt.core.compiler.compliance=1.8
|
|||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
@ -34,7 +34,7 @@
|
|||||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx2G"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
||||||
<stringAttribute key="pde.version" value="3.3"/>
|
<stringAttribute key="pde.version" value="3.3"/>
|
||||||
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
||||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
@ -3,14 +3,13 @@ Bundle-ManifestVersion: 2
|
|||||||
Bundle-Name: SCViewer database tests
|
Bundle-Name: SCViewer database tests
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.test
|
Bundle-SymbolicName: com.minres.scviewer.database.test
|
||||||
Bundle-Version: 1.0.1.qualifier
|
Bundle-Version: 1.0.1.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GnbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database,
|
Require-Bundle: org.junit,
|
||||||
|
com.minres.scviewer.database,
|
||||||
com.minres.scviewer.database.sqlite;bundle-version="1.0.0",
|
com.minres.scviewer.database.sqlite;bundle-version="1.0.0",
|
||||||
com.minres.scviewer.database.text;bundle-version="1.0.0",
|
com.minres.scviewer.database.text;bundle-version="1.0.0",
|
||||||
com.minres.scviewer.database.vcd;bundle-version="1.0.0",
|
com.minres.scviewer.database.vcd;bundle-version="1.0.0"
|
||||||
org.junit,
|
|
||||||
org.junit.jupiter.api
|
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
Automatic-Module-Name: com.minres.scviewer.database.test
|
Automatic-Module-Name: com.minres.scviewer.database.test
|
2
com.minres.scviewer.database.test/inputs/.gitignore
vendored
Normal file
2
com.minres.scviewer.database.test/inputs/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/.scviewer.*
|
||||||
|
/.my_db.txlog*
|
@ -6,8 +6,8 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>2.11.0</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-test-plugin</packaging>
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
<build>
|
<build>
|
||||||
@ -16,7 +16,16 @@
|
|||||||
<groupId>org.eclipse.tycho</groupId>
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
<artifactId>tycho-surefire-plugin</artifactId>
|
<artifactId>tycho-surefire-plugin</artifactId>
|
||||||
<version>${tycho-version}</version>
|
<version>${tycho-version}</version>
|
||||||
|
<configuration>
|
||||||
|
<!-- <bundleStartLevel /> -->
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<type>p2-installable-unit</type>
|
||||||
|
<artifactId>org.eclipse.equinox.ds</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
@ -17,12 +17,20 @@ import static org.junit.Assert.assertTrue;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IEvent;
|
import com.minres.scviewer.database.AssociationType;
|
||||||
|
import com.minres.scviewer.database.DataType;
|
||||||
|
import com.minres.scviewer.database.ISignal;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.ITxEvent.Type;
|
||||||
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
@ -63,11 +71,13 @@ public class DatabaseServicesTest {
|
|||||||
assertEquals(14, waves.size());
|
assertEquals(14, waves.size());
|
||||||
assertEquals(2, waveformDb.getChildNodes().size());
|
assertEquals(2, waveformDb.getChildNodes().size());
|
||||||
IWaveform bus_data_wave = waves.get(0);
|
IWaveform bus_data_wave = waves.get(0);
|
||||||
Entry<Long, IEvent[]> bus_data_entry = bus_data_wave.getEvents().floorEntry(1400000000L);
|
ISignal<?> bus_data_sig = (ISignal<?>) bus_data_wave;
|
||||||
assertEquals("01111000", bus_data_entry.getValue()[0].toString());
|
Entry<Long, ?> bus_data_entry = bus_data_sig.getEvents().floorEntry(1400000000L);
|
||||||
|
assertTrue("01111000".equals(bus_data_entry.getValue().toString()));
|
||||||
IWaveform rw_wave = waves.get(2);
|
IWaveform rw_wave = waves.get(2);
|
||||||
Entry<Long, IEvent[]> rw_entry = rw_wave.getEvents().floorEntry(2360000000L);
|
ISignal<?> rw_sig = (ISignal<?>) rw_wave;
|
||||||
assertEquals("1", rw_entry.getValue()[0].toString());
|
Entry<Long, ?> rw_entry = rw_sig.getEvents().floorEntry(2360000000L);
|
||||||
|
assertTrue("1".equals(rw_entry.getValue().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -86,18 +96,8 @@ public class DatabaseServicesTest {
|
|||||||
assertTrue(f.exists());
|
assertTrue(f.exists());
|
||||||
waveformDb.load(f);
|
waveformDb.load(f);
|
||||||
assertNotNull(waveformDb);
|
assertNotNull(waveformDb);
|
||||||
List<IWaveform> waveforms = waveformDb.getAllWaves();
|
assertEquals(3, waveformDb.getAllWaves().size());
|
||||||
assertEquals(3, waveforms.size());
|
|
||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
for(IWaveform w:waveforms) {
|
|
||||||
if(w.getId().equals(1l)) {
|
|
||||||
assertEquals(2, w.getWidth());
|
|
||||||
} else if(w.getId().equals(2l)) {
|
|
||||||
assertEquals(1, w.getWidth());
|
|
||||||
} else if(w.getId().equals(3l)) {
|
|
||||||
assertEquals(1, w.getWidth());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -110,6 +110,39 @@ public class DatabaseServicesTest {
|
|||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
public void testTxLDb() throws Exception {
|
||||||
|
File f = new File("inputs/my_ldb.txldb").getAbsoluteFile();
|
||||||
|
assertTrue(f.exists());
|
||||||
|
waveformDb.load(f);
|
||||||
|
assertNotNull(waveformDb);
|
||||||
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
|
List<IWaveform> waves = waveformDb.getAllWaves();
|
||||||
|
assertEquals(3, waves.size());
|
||||||
|
IWaveform wave = waves.get(0);
|
||||||
|
assertTrue(wave instanceof ITxStream<?>);
|
||||||
|
ITxStream<?> stream = (ITxStream<?>) wave;
|
||||||
|
assertEquals(2, stream.getGenerators().size());
|
||||||
|
NavigableMap<Long, List<ITxEvent>> eventsList = stream.getEvents();
|
||||||
|
assertEquals(27, eventsList.size());
|
||||||
|
Entry<Long, List<ITxEvent>> eventEntry = eventsList.firstEntry();
|
||||||
|
assertEquals(100000000L, (long) eventEntry.getKey());
|
||||||
|
List<ITxEvent> events = eventEntry.getValue();
|
||||||
|
assertEquals(1, events.size());
|
||||||
|
ITxEvent event = events.get(0);
|
||||||
|
assertEquals(Type.BEGIN, event.getType());
|
||||||
|
ITx tx = event.getTransaction();
|
||||||
|
assertEquals(3L, (long) tx.getId());
|
||||||
|
List<ITxAttribute> attrs = tx.getAttributes();
|
||||||
|
assertEquals(1, attrs.size());
|
||||||
|
ITxAttribute attr = attrs.get(0);
|
||||||
|
assertEquals("data", attr.getName());
|
||||||
|
assertEquals(DataType.UNSIGNED, attr.getDataType());
|
||||||
|
assertEquals(AssociationType.END, attr.getType());
|
||||||
|
assertTrue(attr.getValue() instanceof Integer);
|
||||||
|
assertEquals(0, (int) attr.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHierarchicalVCD() throws Exception {
|
public void testHierarchicalVCD() throws Exception {
|
||||||
File f = new File("inputs/simple_system.vcd").getAbsoluteFile();
|
File f = new File("inputs/simple_system.vcd").getAbsoluteFile();
|
||||||
@ -120,15 +153,5 @@ public class DatabaseServicesTest {
|
|||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLargeTxText() throws Exception {
|
|
||||||
File f = new File("inputs/hw_config_10_10.txlog").getAbsoluteFile();
|
|
||||||
assertTrue(f.exists());
|
|
||||||
waveformDb.load(f);
|
|
||||||
assertNotNull(waveformDb);
|
|
||||||
List<IWaveform> waveforms = waveformDb.getAllWaves();
|
|
||||||
assertEquals(100, waveforms.size());
|
|
||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -11,7 +11,10 @@
|
|||||||
<attribute name="javadoc_location" value="jar:platform:/resource/com.minres.scviewer.database.text/lib/mapdb-3.0.7-javadoc.jar!/"/>
|
<attribute name="javadoc_location" value="jar:platform:/resource/com.minres.scviewer.database.text/lib/mapdb-3.0.7-javadoc.jar!/"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src/"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-9.2.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-api-9.2.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-forkjoin-9.2.0.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/>
|
@ -33,6 +33,7 @@
|
|||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
</natures>
|
</natures>
|
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
groovy.compiler.level=25
|
@ -2,19 +2,23 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Textual transaction database
|
Bundle-Name: Textual transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.text
|
Bundle-SymbolicName: com.minres.scviewer.database.text
|
||||||
Bundle-Version: 3.0.0.qualifier
|
Bundle-Version: 2.0.2.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: org.osgi.framework;version="1.3.0"
|
Import-Package: org.osgi.framework;version="1.3.0"
|
||||||
Require-Bundle: com.minres.scviewer.database,
|
Require-Bundle: com.minres.scviewer.database,
|
||||||
|
org.codehaus.groovy;bundle-version="2.5.8",
|
||||||
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0",
|
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||||
com.google.guava;bundle-version="15.0.0",
|
com.google.guava;bundle-version="15.0.0"
|
||||||
org.eclipse.collections;bundle-version="10.4.0"
|
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Automatic-Module-Name: com.minres.scviewer.database.text
|
Automatic-Module-Name: com.minres.scviewer.database.text
|
||||||
Bundle-ClassPath: .,
|
Bundle-ClassPath: lib/mapdb-3.0.7.jar,
|
||||||
lib/mapdb-3.0.7.jar,
|
.,
|
||||||
|
lib/eclipse-collections-9.2.0.jar,
|
||||||
|
lib/eclipse-collections-api-9.2.0.jar,
|
||||||
|
lib/eclipse-collections-forkjoin-9.2.0.jar,
|
||||||
lib/kotlin-stdlib-1.2.42.jar,
|
lib/kotlin-stdlib-1.2.42.jar,
|
||||||
lib/lz4-1.3.0.jar,
|
lib/lz4-1.3.0.jar,
|
||||||
lib/elsa-3.0.0-M5.jar
|
lib/elsa-3.0.0-M5.jar
|
@ -1,5 +1,5 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2014, 2015-2021 MINRES Technologies GmbH and others.
|
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
@ -13,6 +13,9 @@ bin.includes = META-INF/,\
|
|||||||
OSGI-INF/,\
|
OSGI-INF/,\
|
||||||
lib/,\
|
lib/,\
|
||||||
lib/mapdb-3.0.7.jar,\
|
lib/mapdb-3.0.7.jar,\
|
||||||
|
lib/eclipse-collections-9.2.0.jar,\
|
||||||
|
lib/eclipse-collections-api-9.2.0.jar,\
|
||||||
|
lib/eclipse-collections-forkjoin-9.2.0.jar,\
|
||||||
lib/kotlin-stdlib-1.2.42.jar,\
|
lib/kotlin-stdlib-1.2.42.jar,\
|
||||||
lib/lz4-1.3.0.jar,\
|
lib/lz4-1.3.0.jar,\
|
||||||
lib/elsa-3.0.0-M5.jar
|
lib/elsa-3.0.0-M5.jar
|
BIN
com.minres.scviewer.database.text/lib/eclipse-collections-9.2.0.jar
Executable file
BIN
com.minres.scviewer.database.text/lib/eclipse-collections-9.2.0.jar
Executable file
Binary file not shown.
BIN
com.minres.scviewer.database.text/lib/eclipse-collections-api-9.2.0.jar
Executable file
BIN
com.minres.scviewer.database.text/lib/eclipse-collections-api-9.2.0.jar
Executable file
Binary file not shown.
BIN
com.minres.scviewer.database.text/lib/eclipse-collections-forkjoin-9.2.0.jar
Executable file
BIN
com.minres.scviewer.database.text/lib/eclipse-collections-forkjoin-9.2.0.jar
Executable file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user