- added SQLite back end
- reworked graphical representation to use widgets
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,5 @@
 | 
			
		||||
/.metadata/
 | 
			
		||||
/.graph-browser/
 | 
			
		||||
/.recommenders/
 | 
			
		||||
/RemoteSystemsTempFiles/
 | 
			
		||||
/*.zip
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
txviewer
 | 
			
		||||
SCViewer
 | 
			
		||||
========
 | 
			
		||||
 | 
			
		||||
TxViewer is composed of a set of eclipse plugins to show transaction streams created by the SystemC 
 | 
			
		||||
Verification Library (SCV). For further description of the SCV please refer to 
 | 
			
		||||
SCViewer is composed of a set of eclipse plugins to show VCD and transaction streams 
 | 
			
		||||
created by the SystemC VCD trace implementation and the SystemC Verification Library (SCV).
 | 
			
		||||
For further description of the SCV please refer to 
 | 
			
		||||
http://www.accellera.org/activities/committees/systemc-verification.
 | 
			
		||||
 | 
			
		||||
The viewer is in early alpha stage and not yet ready for production use!
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +0,0 @@
 | 
			
		||||
Manifest-Version: 1.0
 | 
			
		||||
Bundle-ManifestVersion: 2
 | 
			
		||||
Bundle-Name: Textual transaction database
 | 
			
		||||
Bundle-SymbolicName: com.itjw.txviewer.database.text
 | 
			
		||||
Bundle-Version: 1.0.0.qualifier
 | 
			
		||||
Bundle-Activator: com.itjw.txviewer.database.text.Activator
 | 
			
		||||
Bundle-Vendor: ITJW
 | 
			
		||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 | 
			
		||||
Import-Package: com.itjw.txviewer.database,
 | 
			
		||||
 org.osgi.framework;version="1.3.0"
 | 
			
		||||
Require-Bundle: com.itjw.txviewer.database;bundle-version="1.0.0",
 | 
			
		||||
 org.codehaus.groovy;bundle-version="1.8.6"
 | 
			
		||||
@@ -1,50 +0,0 @@
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * Copyright (c) 2012 IT Just working.
 | 
			
		||||
 * 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.itjw.txviewer.database.text;
 | 
			
		||||
 | 
			
		||||
import org.osgi.framework.BundleActivator;
 | 
			
		||||
import org.osgi.framework.BundleContext;
 | 
			
		||||
import org.osgi.framework.Constants;
 | 
			
		||||
 | 
			
		||||
import java.util.Dictionary
 | 
			
		||||
import java.util.Hashtable
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrDb;
 | 
			
		||||
import com.itjw.txviewer.database.ITransactionDbFactory;
 | 
			
		||||
 | 
			
		||||
public class Activator implements BundleActivator {
 | 
			
		||||
 | 
			
		||||
	private static BundleContext context;
 | 
			
		||||
 | 
			
		||||
	static BundleContext getContext() {
 | 
			
		||||
		return context;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
 | 
			
		||||
	 */
 | 
			
		||||
	public void start(BundleContext bundleContext) throws Exception {
 | 
			
		||||
		Activator.context = bundleContext;
 | 
			
		||||
		Dictionary<String, ?> dict = new Hashtable<String, ?>();
 | 
			
		||||
		dict.putAt(Constants.SERVICE_RANKING, 1);
 | 
			
		||||
		context.registerService(ITransactionDbFactory.class, new TrTextDbFactory(), dict);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
 | 
			
		||||
	 */
 | 
			
		||||
	public void stop(BundleContext bundleContext) throws Exception {
 | 
			
		||||
		Activator.context = null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
package com.itjw.txviewer.database.text
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrDb
 | 
			
		||||
import com.itjw.txviewer.database.ITransactionDbFactory;
 | 
			
		||||
 | 
			
		||||
class TrTextDbFactory implements ITransactionDbFactory {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITrDb createDatabase() {
 | 
			
		||||
		return new TrTextDb();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
source.. = src/
 | 
			
		||||
output.. = bin/
 | 
			
		||||
bin.includes = META-INF/,\
 | 
			
		||||
               .
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
 | 
			
		||||
public interface ITransactionDbFactory {
 | 
			
		||||
	
 | 
			
		||||
	ITrDb createDatabase();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,55 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<feature
 | 
			
		||||
      id="com.itjw.txviewer.feature"
 | 
			
		||||
      label="Transaction Viewer"
 | 
			
		||||
      version="1.0.0.qualifier"
 | 
			
		||||
      provider-name="ITJW">
 | 
			
		||||
 | 
			
		||||
   <description url="http://www.itjw.com/txviewer">
 | 
			
		||||
      A viewer for SystemC Verification Library transactions
 | 
			
		||||
   </description>
 | 
			
		||||
 | 
			
		||||
   <copyright url="http://wwwitjw.com/copyright">
 | 
			
		||||
      [Enter Copyright Description here.]
 | 
			
		||||
   </copyright>
 | 
			
		||||
 | 
			
		||||
   <license url="http://www.example.com/license">
 | 
			
		||||
      [Enter License Description here.]
 | 
			
		||||
   </license>
 | 
			
		||||
 | 
			
		||||
   <requires>
 | 
			
		||||
      <import plugin="org.eclipse.ui.views"/>
 | 
			
		||||
      <import plugin="com.itjw.txviewer.database" version="1.0.0" match="greaterOrEqual"/>
 | 
			
		||||
      <import plugin="org.codehaus.groovy" version="1.8.6" match="greaterOrEqual"/>
 | 
			
		||||
      <import plugin="org.eclipse.osgi"/>
 | 
			
		||||
      <import plugin="org.eclipse.ui"/>
 | 
			
		||||
      <import plugin="org.eclipse.core.runtime"/>
 | 
			
		||||
      <import plugin="org.eclipse.jface.text"/>
 | 
			
		||||
      <import plugin="org.eclipse.core.resources"/>
 | 
			
		||||
      <import plugin="org.eclipse.ui.editors"/>
 | 
			
		||||
      <import plugin="org.eclipse.ui.ide"/>
 | 
			
		||||
      <import plugin="org.eclipse.gef"/>
 | 
			
		||||
   </requires>
 | 
			
		||||
 | 
			
		||||
   <plugin
 | 
			
		||||
         id="com.itjw.txviewer.database"
 | 
			
		||||
         download-size="0"
 | 
			
		||||
         install-size="0"
 | 
			
		||||
         version="0.0.0"
 | 
			
		||||
         unpack="false"/>
 | 
			
		||||
 | 
			
		||||
   <plugin
 | 
			
		||||
         id="com.itjw.txviewer.database.text"
 | 
			
		||||
         download-size="0"
 | 
			
		||||
         install-size="0"
 | 
			
		||||
         version="0.0.0"
 | 
			
		||||
         unpack="false"/>
 | 
			
		||||
 | 
			
		||||
   <plugin
 | 
			
		||||
         id="com.itjw.txviewer.ui"
 | 
			
		||||
         download-size="0"
 | 
			
		||||
         install-size="0"
 | 
			
		||||
         version="0.0.0"
 | 
			
		||||
         unpack="false"/>
 | 
			
		||||
 | 
			
		||||
</feature>
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<site>
 | 
			
		||||
   <feature url="features/com.itjw.txviewer.feature_1.0.0.201206150709.jar" id="com.itjw.txviewer.feature" version="1.0.0.201206150709">
 | 
			
		||||
      <category name="com.itjw.txviewer"/>
 | 
			
		||||
   </feature>
 | 
			
		||||
   <category-def name="com.itjw.txviewer" label="TxViewer"/>
 | 
			
		||||
</site>
 | 
			
		||||
							
								
								
									
										8
									
								
								com.minres.scviewer.database.sqlite/.classpath
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,8 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<classpath>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
			
		||||
	<classpathentry kind="src" path="src"/>
 | 
			
		||||
	<classpathentry exported="true" kind="lib" path="sqlite-jdbc-3.8.7.jar"/>
 | 
			
		||||
	<classpathentry kind="output" path="bin"/>
 | 
			
		||||
</classpath>
 | 
			
		||||
							
								
								
									
										1
									
								
								com.minres.scviewer.database.sqlite/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1 @@
 | 
			
		||||
/bin/
 | 
			
		||||
							
								
								
									
										33
									
								
								com.minres.scviewer.database.sqlite/.project
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,33 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<projectDescription>
 | 
			
		||||
	<name>com.minres.scviewer.database.sqlite</name>
 | 
			
		||||
	<comment></comment>
 | 
			
		||||
	<projects>
 | 
			
		||||
	</projects>
 | 
			
		||||
	<buildSpec>
 | 
			
		||||
		<buildCommand>
 | 
			
		||||
			<name>org.eclipse.jdt.core.javabuilder</name>
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
		<buildCommand>
 | 
			
		||||
			<name>org.eclipse.pde.ManifestBuilder</name>
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
		<buildCommand>
 | 
			
		||||
			<name>org.eclipse.pde.SchemaBuilder</name>
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
		<buildCommand>
 | 
			
		||||
			<name>org.eclipse.pde.ds.core.builder</name>
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
	</buildSpec>
 | 
			
		||||
	<natures>
 | 
			
		||||
		<nature>org.eclipse.pde.PluginNature</nature>
 | 
			
		||||
		<nature>org.eclipse.jdt.core.javanature</nature>
 | 
			
		||||
	</natures>
 | 
			
		||||
</projectDescription>
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
eclipse.preferences.version=1
 | 
			
		||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
			
		||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 | 
			
		||||
org.eclipse.jdt.core.compiler.compliance=1.7
 | 
			
		||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
			
		||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
			
		||||
org.eclipse.jdt.core.compiler.source=1.7
 | 
			
		||||
@@ -0,0 +1,3 @@
 | 
			
		||||
eclipse.preferences.version=1
 | 
			
		||||
pluginProject.extensions=false
 | 
			
		||||
resolve.requirebundle=false
 | 
			
		||||
							
								
								
									
										14
									
								
								com.minres.scviewer.database.sqlite/META-INF/MANIFEST.MF
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,14 @@
 | 
			
		||||
Manifest-Version: 1.0
 | 
			
		||||
Bundle-ManifestVersion: 2
 | 
			
		||||
Bundle-Name: Sqlite transaction database
 | 
			
		||||
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
 | 
			
		||||
Bundle-Version: 1.0.0.qualifier
 | 
			
		||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
			
		||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 | 
			
		||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
 | 
			
		||||
 org.eclipse.equinox.util;bundle-version="1.0.500",
 | 
			
		||||
 org.eclipse.equinox.ds;bundle-version="1.4.200",
 | 
			
		||||
 org.eclipse.osgi.services;bundle-version="3.4.0"
 | 
			
		||||
Bundle-ClassPath: .,
 | 
			
		||||
 sqlite-jdbc-3.8.7.jar
 | 
			
		||||
Service-Component: OSGI-INF/component.xml
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="SQLiteDbFactory">
 | 
			
		||||
   <implementation class="com.minres.scviewer.database.sqlite.SQLiteDbFactory"/>
 | 
			
		||||
   <service>
 | 
			
		||||
      <provide interface="com.minres.scviewer.database.ITransactionDbFactory"/>
 | 
			
		||||
   </service>
 | 
			
		||||
</scr:component>
 | 
			
		||||
							
								
								
									
										6
									
								
								com.minres.scviewer.database.sqlite/build.properties
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,6 @@
 | 
			
		||||
source.. = src/
 | 
			
		||||
output.. = bin/
 | 
			
		||||
bin.includes = META-INF/,\
 | 
			
		||||
               .,\
 | 
			
		||||
               sqlite-jdbc-3.8.7.jar,\
 | 
			
		||||
               OSGI-INF/
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								com.minres.scviewer.database.sqlite/sqlite-jdbc-3.8.7.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,38 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.AssociationType;
 | 
			
		||||
import com.minres.scviewer.database.DataType;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttribute;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
 | 
			
		||||
 | 
			
		||||
public class Attribute implements ITrAttribute{
 | 
			
		||||
 | 
			
		||||
	Transaction trTransaction;
 | 
			
		||||
	ScvTxAttribute scvAttribute;
 | 
			
		||||
	
 | 
			
		||||
	public Attribute(Transaction trTransaction, ScvTxAttribute scvAttribute) {
 | 
			
		||||
		this.trTransaction=trTransaction;
 | 
			
		||||
		this.scvAttribute=scvAttribute;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return scvAttribute.getName();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public DataType getDataType() {
 | 
			
		||||
		return DataType.values()[scvAttribute.getData_type()];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public AssociationType getType() {
 | 
			
		||||
		return AssociationType.values()[scvAttribute.getType()];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Object getValue() {
 | 
			
		||||
		return scvAttribute.getData_value();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.ITrGenerator;
 | 
			
		||||
import com.minres.scviewer.database.ITrStream;
 | 
			
		||||
import com.minres.scviewer.database.ITransaction;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
 | 
			
		||||
 | 
			
		||||
public class Generator implements ITrGenerator {
 | 
			
		||||
 | 
			
		||||
	private ITrStream  stream;
 | 
			
		||||
	private ScvGenerator scvGenerator;
 | 
			
		||||
	public Generator(ITrStream  stream, ScvGenerator scvGenerator) {
 | 
			
		||||
		this.stream=stream;
 | 
			
		||||
		this.scvGenerator=scvGenerator;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Long getId() {
 | 
			
		||||
		return (long) scvGenerator.getId();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITrStream getStream() {
 | 
			
		||||
		return stream;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return scvGenerator.getName();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public List<ITransaction> getTransactions() {
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,52 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite;
 | 
			
		||||
 | 
			
		||||
import java.beans.PropertyChangeListener;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.ITrHierNode;
 | 
			
		||||
 | 
			
		||||
public class HierNode implements ITrHierNode {
 | 
			
		||||
 | 
			
		||||
	protected String name;
 | 
			
		||||
	
 | 
			
		||||
	protected ArrayList<ITrHierNode> childs;
 | 
			
		||||
	
 | 
			
		||||
	public HierNode(String name) {
 | 
			
		||||
		this.name=name;
 | 
			
		||||
		childs = new ArrayList<ITrHierNode>();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void addPropertyChangeListener(PropertyChangeListener l) {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void removePropertyChangeListener(PropertyChangeListener l) {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String getFullName() {
 | 
			
		||||
		return name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void setName(String name) {
 | 
			
		||||
		this.name=name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public List<ITrHierNode> getChildNodes() {
 | 
			
		||||
		return childs;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,33 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.ITrRelation;
 | 
			
		||||
import com.minres.scviewer.database.ITransaction;
 | 
			
		||||
import com.minres.scviewer.database.RelationType;
 | 
			
		||||
 | 
			
		||||
public class Relation implements ITrRelation {
 | 
			
		||||
 | 
			
		||||
	RelationType relationType;
 | 
			
		||||
	Transaction source, target;
 | 
			
		||||
 | 
			
		||||
	public Relation(RelationType relationType, Transaction source, Transaction target) {
 | 
			
		||||
		this.source = source;
 | 
			
		||||
		this.target = target;
 | 
			
		||||
		this.relationType = relationType;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public RelationType getRelationType() {
 | 
			
		||||
		return relationType;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITransaction getSource() {
 | 
			
		||||
		return source;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITransaction getTarget() {
 | 
			
		||||
		return target;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,49 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite;
 | 
			
		||||
 | 
			
		||||
import java.sql.Connection;
 | 
			
		||||
import java.sql.DriverManager;
 | 
			
		||||
import java.sql.PreparedStatement;
 | 
			
		||||
import java.sql.ResultSet;
 | 
			
		||||
import java.sql.SQLException;
 | 
			
		||||
import java.sql.Statement;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
 | 
			
		||||
 | 
			
		||||
public class SQLiteDatabase implements IDatabase {
 | 
			
		||||
 | 
			
		||||
	protected String dbFileName;
 | 
			
		||||
	
 | 
			
		||||
	public SQLiteDatabase(String dbFileName) {
 | 
			
		||||
		super();
 | 
			
		||||
		this.dbFileName = dbFileName;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Connection createConnection() throws SQLException {
 | 
			
		||||
        // create a database connection and return it
 | 
			
		||||
		return DriverManager.getConnection(getConnectionUrl() );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String getConnectionUrl() {
 | 
			
		||||
        // now we set up a set of fairly basic string variables to use in the body of the code proper
 | 
			
		||||
        String sJdbc = "jdbc:sqlite";
 | 
			
		||||
        String sDbUrl = sJdbc + ":" + dbFileName;
 | 
			
		||||
        // which will produce a legitimate Url for SqlLite JDBC :
 | 
			
		||||
        // jdbc:sqlite:hello.db
 | 
			
		||||
		return sDbUrl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void close(ResultSet resultSet, Statement statement, Connection connection) {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void close(PreparedStatement preparedStatement, Connection connection) {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,157 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite;
 | 
			
		||||
 | 
			
		||||
import java.beans.IntrospectionException;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.lang.reflect.InvocationTargetException;
 | 
			
		||||
import java.sql.SQLException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.EventTime;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttribute;
 | 
			
		||||
import com.minres.scviewer.database.ITrDb;
 | 
			
		||||
import com.minres.scviewer.database.ITrHierNode;
 | 
			
		||||
import com.minres.scviewer.database.ITrStream;
 | 
			
		||||
import com.minres.scviewer.database.InputFormatException;
 | 
			
		||||
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.ScvSimProps;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.tables.ScvStream;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.tables.ScvTxEvent;
 | 
			
		||||
 | 
			
		||||
public class SQLiteDb extends HierNode implements ITrDb {
 | 
			
		||||
 | 
			
		||||
	protected IDatabase database;
 | 
			
		||||
	
 | 
			
		||||
	protected List<ITrStream> streams;
 | 
			
		||||
 | 
			
		||||
	long timeResolution=1;
 | 
			
		||||
 | 
			
		||||
	private HashMap<String, RelationType> relationMap = new HashMap<String, RelationType>();
 | 
			
		||||
	
 | 
			
		||||
	IDatabase getDb(){
 | 
			
		||||
		return database;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public SQLiteDb() {
 | 
			
		||||
		super("SQLiteDb");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public EventTime getMaxTime() {
 | 
			
		||||
		SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
 | 
			
		||||
				database, "time = SELECT MAX(time) FROM ScvTxEvent");
 | 
			
		||||
		try {
 | 
			
		||||
			List<ScvTxEvent> event = handler.selectObjects();
 | 
			
		||||
			if(event.size()>0)
 | 
			
		||||
				return new EventTime(event.get(0).getTime(), "fs");
 | 
			
		||||
		} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
				| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
		}
 | 
			
		||||
		return new EventTime(0L, "s");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public List<ITrStream> getAllStreams() {
 | 
			
		||||
		if(streams==null){
 | 
			
		||||
			SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
 | 
			
		||||
			streams=new ArrayList<ITrStream>();
 | 
			
		||||
			try {
 | 
			
		||||
				for(ScvStream scvStream:handler.selectObjects()){
 | 
			
		||||
					streams.add(new Stream(this, scvStream));
 | 
			
		||||
				}
 | 
			
		||||
			} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
					| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
	//			e.printStackTrace();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return streams;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void load(File file) throws InputFormatException {
 | 
			
		||||
		database=new SQLiteDatabase(file.getAbsolutePath());
 | 
			
		||||
		SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<ScvSimProps>(ScvSimProps.class, database);
 | 
			
		||||
		try {
 | 
			
		||||
			for(ScvSimProps scvSimProps:handler.selectObjects()){
 | 
			
		||||
				timeResolution=scvSimProps.getTime_resolution();
 | 
			
		||||
			}
 | 
			
		||||
		} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
				| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
		}
 | 
			
		||||
		addHierarchyNodes();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void clear() {
 | 
			
		||||
		database=null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITrStream getStreamByName(String name) {
 | 
			
		||||
		 for (ITrStream n : getAllStreams()) {
 | 
			
		||||
		        if (n.getName().equals(name)) {
 | 
			
		||||
		            return n;
 | 
			
		||||
		        }
 | 
			
		||||
		    }
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public ITrStream getStreamById(long id) {
 | 
			
		||||
		 for (ITrStream n : getAllStreams()) {
 | 
			
		||||
		        if (n.getId().equals(id)) {
 | 
			
		||||
		            return n;
 | 
			
		||||
		        }
 | 
			
		||||
		    }
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void addHierarchyNodes() throws InputFormatException{
 | 
			
		||||
		for(ITrStream stream:getAllStreams()){
 | 
			
		||||
			String[] hier = stream.getFullName().split("\\./");
 | 
			
		||||
			ITrHierNode node = this;
 | 
			
		||||
			for(String name:hier){
 | 
			
		||||
				ITrHierNode n1 = null;
 | 
			
		||||
				 for (ITrHierNode n : node.getChildNodes()) {
 | 
			
		||||
				        if (n.getName().equals(name)) {
 | 
			
		||||
				            n1=n;
 | 
			
		||||
				            break;
 | 
			
		||||
				        }
 | 
			
		||||
				    }
 | 
			
		||||
				if(name == hier[hier.length-1]){ //leaf
 | 
			
		||||
					if(n1!=null) {
 | 
			
		||||
						if(n1 instanceof HierNode){
 | 
			
		||||
							node.getChildNodes().remove(n1);
 | 
			
		||||
							stream.getChildNodes().addAll(n1.getChildNodes());
 | 
			
		||||
						} else {
 | 
			
		||||
							throw new InputFormatException();
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					stream.setName(name);
 | 
			
		||||
					node.getChildNodes().add(stream);
 | 
			
		||||
					node=stream;
 | 
			
		||||
				} else { // intermediate
 | 
			
		||||
					if(n1 != null) {
 | 
			
		||||
						node=n1;
 | 
			
		||||
					} else {
 | 
			
		||||
						HierNode newNode = new HierNode(name);
 | 
			
		||||
						node.getChildNodes().add(newNode);
 | 
			
		||||
						node=newNode;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public RelationType getRelationType(String relationName) {
 | 
			
		||||
		if(relationMap.containsKey(relationName)) return relationMap.get(relationName);
 | 
			
		||||
		RelationType type = new RelationType(relationName);
 | 
			
		||||
		relationMap.put(relationName, type);
 | 
			
		||||
		return type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,36 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileInputStream;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.ITrDb;
 | 
			
		||||
import com.minres.scviewer.database.ITransactionDbFactory;
 | 
			
		||||
 | 
			
		||||
public class SQLiteDbFactory implements ITransactionDbFactory {
 | 
			
		||||
 | 
			
		||||
	private byte[] x = "SQLite format 3".getBytes();
 | 
			
		||||
 | 
			
		||||
	public SQLiteDbFactory() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITrDb createDatabase(File file) {
 | 
			
		||||
		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 null;
 | 
			
		||||
			SQLiteDb db = new SQLiteDb();
 | 
			
		||||
			db.load(file);
 | 
			
		||||
			return db;
 | 
			
		||||
		} catch (Exception e) {
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,107 @@
 | 
			
		||||
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.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.ITrDb;
 | 
			
		||||
import com.minres.scviewer.database.ITrGenerator;
 | 
			
		||||
import com.minres.scviewer.database.ITrStream;
 | 
			
		||||
import com.minres.scviewer.database.ITransaction;
 | 
			
		||||
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 Stream extends HierNode implements ITrStream {
 | 
			
		||||
 | 
			
		||||
	private String fullName;
 | 
			
		||||
	private SQLiteDb db;
 | 
			
		||||
	private ScvStream scvStream;
 | 
			
		||||
	private HashMap<Integer, Generator> generators;
 | 
			
		||||
	
 | 
			
		||||
	private List<ITransaction> transactions;
 | 
			
		||||
	
 | 
			
		||||
	public Stream(SQLiteDb trSQLiteDb, ScvStream scvStream) {
 | 
			
		||||
		super(scvStream.getName());
 | 
			
		||||
		fullName=scvStream.getName();
 | 
			
		||||
		this.scvStream=scvStream;
 | 
			
		||||
		db=trSQLiteDb;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String getFullName() {
 | 
			
		||||
		return fullName;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Long getId() {
 | 
			
		||||
		return (long) scvStream.getId();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String getKind() {
 | 
			
		||||
		return scvStream.getKind();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public SQLiteDb getDb() {
 | 
			
		||||
		return db;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public List<ITrGenerator> getGenerators() {
 | 
			
		||||
		if(generators==null){
 | 
			
		||||
			SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
 | 
			
		||||
					ScvGenerator.class, db.getDb(), "stream="+scvStream.getId());
 | 
			
		||||
			generators=new HashMap<Integer, Generator>();
 | 
			
		||||
			try {
 | 
			
		||||
				for(ScvGenerator scvGenerator:handler.selectObjects()){
 | 
			
		||||
					generators.put(scvGenerator.getId(), new Generator(this, scvGenerator));
 | 
			
		||||
				}
 | 
			
		||||
			} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
					| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
				e.printStackTrace();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return new ArrayList<ITrGenerator>(generators.values());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public List<ITransaction> getTransactions() {
 | 
			
		||||
		checkTransactions();
 | 
			
		||||
		return transactions;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITransaction getTransactionById(long id) {
 | 
			
		||||
		checkTransactions();
 | 
			
		||||
		for(ITransaction trans:transactions){
 | 
			
		||||
			if(trans.getId()==id)
 | 
			
		||||
				return trans;
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected void checkTransactions() {
 | 
			
		||||
		if(transactions==null){
 | 
			
		||||
			if(generators==null) getGenerators();
 | 
			
		||||
			SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, db.getDb(),
 | 
			
		||||
					"stream="+scvStream.getId());
 | 
			
		||||
			transactions=new ArrayList<ITransaction>();
 | 
			
		||||
			try {
 | 
			
		||||
				for(ScvTx scvTx:handler.selectObjects()){
 | 
			
		||||
					transactions.add(new Transaction(this, generators.get(scvTx.getGenerator()), scvTx));
 | 
			
		||||
				}
 | 
			
		||||
			} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
					| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
				e.printStackTrace();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,154 @@
 | 
			
		||||
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 com.minres.scviewer.database.AssociationType;
 | 
			
		||||
import com.minres.scviewer.database.EventTime;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttribute;
 | 
			
		||||
import com.minres.scviewer.database.ITrGenerator;
 | 
			
		||||
import com.minres.scviewer.database.ITrRelation;
 | 
			
		||||
import com.minres.scviewer.database.ITrStream;
 | 
			
		||||
import com.minres.scviewer.database.ITransaction;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.tables.ScvTx;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.tables.ScvTxEvent;
 | 
			
		||||
import com.minres.scviewer.database.sqlite.tables.ScvTxRelation;
 | 
			
		||||
 | 
			
		||||
public class Transaction implements ITransaction {
 | 
			
		||||
 | 
			
		||||
	private Stream trStream;
 | 
			
		||||
	private Generator trGenerator;
 | 
			
		||||
	private ScvTx scvTx;
 | 
			
		||||
	private List<ITrAttribute> attributes;
 | 
			
		||||
	private EventTime begin, end;
 | 
			
		||||
	private  List<ITrRelation> incoming, outgoing;
 | 
			
		||||
	
 | 
			
		||||
	public Transaction(Stream trStream, Generator trGenerator, ScvTx scvTx) {
 | 
			
		||||
		this.trStream=trStream;
 | 
			
		||||
		this.trGenerator=trGenerator;
 | 
			
		||||
		this.scvTx=scvTx;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Long getId() {
 | 
			
		||||
		return (long) scvTx.getId();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITrStream getStream() {
 | 
			
		||||
		return trStream;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITrGenerator getGenerator() {
 | 
			
		||||
		return trGenerator;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public EventTime getBeginTime() {
 | 
			
		||||
		if(begin==null){
 | 
			
		||||
		SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
 | 
			
		||||
				trStream.getDb().getDb(), "tx="+scvTx.getId()+" AND type="+ AssociationType.BEGIN.ordinal());
 | 
			
		||||
		try {
 | 
			
		||||
			for(ScvTxEvent scvEvent:handler.selectObjects()){
 | 
			
		||||
				begin= new EventTime(scvEvent.getTime()*trStream.getDb().timeResolution, "fs");
 | 
			
		||||
			}
 | 
			
		||||
		} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
				| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
		}
 | 
			
		||||
		}
 | 
			
		||||
		return begin;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public EventTime getEndTime() {
 | 
			
		||||
		if(end==null){
 | 
			
		||||
		SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
 | 
			
		||||
				trStream.getDb().getDb(), "tx="+scvTx.getId()+" AND type="+ AssociationType.END.ordinal());
 | 
			
		||||
		try {
 | 
			
		||||
			for(ScvTxEvent scvEvent:handler.selectObjects()){
 | 
			
		||||
				end = new EventTime(scvEvent.getTime()*trStream.getDb().timeResolution, "fs");
 | 
			
		||||
			}
 | 
			
		||||
		} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
				| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
		}
 | 
			
		||||
		}
 | 
			
		||||
		return end;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public List<ITrAttribute> getAttributes() {
 | 
			
		||||
		if(attributes==null){
 | 
			
		||||
			SQLiteDatabaseSelectHandler<ScvTxAttribute> handler = new SQLiteDatabaseSelectHandler<ScvTxAttribute>(
 | 
			
		||||
					ScvTxAttribute.class, trStream.getDb().getDb(), "tx="+scvTx.getId());
 | 
			
		||||
			try {
 | 
			
		||||
				attributes = new ArrayList<ITrAttribute>();
 | 
			
		||||
				for(ScvTxAttribute scvAttribute:handler.selectObjects()){
 | 
			
		||||
					attributes.add(new Attribute(this, scvAttribute));
 | 
			
		||||
					
 | 
			
		||||
				}
 | 
			
		||||
			} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
					| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return attributes;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Collection<ITrRelation> getIncomingRelations() {
 | 
			
		||||
		if(incoming==null){
 | 
			
		||||
			SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<ScvTxRelation>(
 | 
			
		||||
					ScvTxRelation.class, trStream.getDb().getDb(), "sink="+scvTx.getId());
 | 
			
		||||
			try {
 | 
			
		||||
				incoming = new ArrayList<ITrRelation>();
 | 
			
		||||
				for(ScvTxRelation scvRelation:handler.selectObjects()){
 | 
			
		||||
					incoming.add(createRelation(scvRelation, false));
 | 
			
		||||
				}
 | 
			
		||||
			} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
					| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return incoming;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Collection<ITrRelation> getOutgoingRelations() {
 | 
			
		||||
		if(outgoing==null){
 | 
			
		||||
			SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<ScvTxRelation>(
 | 
			
		||||
					ScvTxRelation.class, trStream.getDb().getDb(), "src="+scvTx.getId());
 | 
			
		||||
			try {
 | 
			
		||||
				outgoing = new ArrayList<ITrRelation>();
 | 
			
		||||
				for(ScvTxRelation scvRelation:handler.selectObjects()){
 | 
			
		||||
					outgoing.add(createRelation(scvRelation, true));
 | 
			
		||||
				}
 | 
			
		||||
			} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
					| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return outgoing;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private ITrRelation createRelation(ScvTxRelation rel, boolean outgoing) {
 | 
			
		||||
		long otherId = outgoing?rel.getSink():rel.getSrc();
 | 
			
		||||
		try {
 | 
			
		||||
			List<ScvTx> scvTx=new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, trStream.getDb().getDb(), "id="+otherId).selectObjects();
 | 
			
		||||
			assert(scvTx.size()==1);
 | 
			
		||||
			ITrStream stream = trStream.getDb().getStreamById(scvTx.get(0).getStream());
 | 
			
		||||
			Transaction that=(Transaction) stream.getTransactionById(otherId);
 | 
			
		||||
			if(outgoing)
 | 
			
		||||
				return new Relation(trStream.getDb().getRelationType(rel.getName()), this, that);
 | 
			
		||||
			else
 | 
			
		||||
				return new Relation(trStream.getDb().getRelationType(rel.getName()), that, this);
 | 
			
		||||
		} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
			
		||||
				| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
			
		||||
		}
 | 
			
		||||
		return null;		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,84 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.db;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * An abstract class that handles insert/select-operations into/from a database
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Tino for http://www.java-blog.com
 | 
			
		||||
 * 
 | 
			
		||||
 * @param <T>
 | 
			
		||||
 */
 | 
			
		||||
public abstract class AbstractDatabaseHandler<T> {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The type of the objects that should be created and filled with values
 | 
			
		||||
	 * from the database or inserted into the database
 | 
			
		||||
	 */
 | 
			
		||||
	protected Class<T>     type;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Contains the settings to create a connection to the database like
 | 
			
		||||
	 * host/port/database/user/password
 | 
			
		||||
	 */
 | 
			
		||||
	protected IDatabase     databaseConnectionFactory;
 | 
			
		||||
 | 
			
		||||
	/** The SQL-select-query */
 | 
			
		||||
	protected final String     query;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Constructor
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param type
 | 
			
		||||
	 *            The type of the objects that should be created and filled with
 | 
			
		||||
	 *            values from the database or inserted into the database
 | 
			
		||||
	 * @param databaseConnecter
 | 
			
		||||
	 *            Contains the settings to create a connection to the database
 | 
			
		||||
	 *            like host/port/database/user/password
 | 
			
		||||
	 */
 | 
			
		||||
	protected AbstractDatabaseHandler(Class<T> type,
 | 
			
		||||
			IDatabase databaseConnectionFactory, String criterion) {
 | 
			
		||||
 | 
			
		||||
		this.databaseConnectionFactory = databaseConnectionFactory;
 | 
			
		||||
		this.type = type;
 | 
			
		||||
		this.query = createQuery(criterion);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Create the SQL-String to insert into / select from the database
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @return the SQL-String
 | 
			
		||||
	 */
 | 
			
		||||
	protected abstract String createQuery(String criterion);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 
 | 
			
		||||
	 * Creates a comma-separated-String with the names of the variables in this
 | 
			
		||||
	 * class
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param usePlaceHolders
 | 
			
		||||
	 *            true, if PreparedStatement-placeholders ('?') should be used
 | 
			
		||||
	 *            instead of the names of the variables
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	protected String getColumns(boolean usePlaceHolders) {
 | 
			
		||||
		StringBuilder sb = new StringBuilder();
 | 
			
		||||
 | 
			
		||||
		boolean first = true;
 | 
			
		||||
		/* Iterate the column-names */
 | 
			
		||||
		for (Field f : type.getDeclaredFields()) {
 | 
			
		||||
			if (first)
 | 
			
		||||
				first = false;
 | 
			
		||||
			else
 | 
			
		||||
				sb.append(", ");
 | 
			
		||||
 | 
			
		||||
			if (usePlaceHolders)
 | 
			
		||||
				sb.append("?");
 | 
			
		||||
			else
 | 
			
		||||
				sb.append(f.getName());
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return sb.toString();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,48 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.db;
 | 
			
		||||
 | 
			
		||||
import java.sql.Connection;
 | 
			
		||||
import java.sql.PreparedStatement;
 | 
			
		||||
import java.sql.ResultSet;
 | 
			
		||||
import java.sql.SQLException;
 | 
			
		||||
import java.sql.Statement;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a connection to a database.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Tino
 | 
			
		||||
 * @created 03.12.2008
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public interface IDatabase {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Establishes a new connection to the database
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return A new connection to the database
 | 
			
		||||
	 * @throws SQLException
 | 
			
		||||
	 */
 | 
			
		||||
	public Connection createConnection() throws SQLException;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Returns the connection url
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public String getConnectionUrl();
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * releases the result set
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public void close(ResultSet resultSet, Statement statement, Connection connection);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * releases the preparedStatement
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public void close(PreparedStatement preparedStatement, Connection connection);
 | 
			
		||||
 | 
			
		||||
} 
 | 
			
		||||
@@ -0,0 +1,94 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.db;
 | 
			
		||||
import java.beans.IntrospectionException;
 | 
			
		||||
import java.beans.PropertyDescriptor;
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
import java.lang.reflect.InvocationTargetException;
 | 
			
		||||
import java.lang.reflect.Method;
 | 
			
		||||
import java.sql.Connection;
 | 
			
		||||
import java.sql.PreparedStatement;
 | 
			
		||||
import java.sql.SQLException;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * Class that inserts a list of <T>s into the corresponding database-table.
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Tino for http://www.java-blog.com
 | 
			
		||||
 * 
 | 
			
		||||
 * @param <T>
 | 
			
		||||
 */
 | 
			
		||||
public class SQLiteDatabaseInsertHandler<T> extends AbstractDatabaseHandler<T> {
 | 
			
		||||
 | 
			
		||||
	public SQLiteDatabaseInsertHandler(Class<T> type,
 | 
			
		||||
			IDatabase databaseConnecter) {
 | 
			
		||||
		super(type, databaseConnecter, null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected String createQuery(String criterion) {
 | 
			
		||||
 | 
			
		||||
		StringBuilder sb = new StringBuilder();
 | 
			
		||||
 | 
			
		||||
		sb.append("INSERT INTO ");
 | 
			
		||||
		sb.append(type.getSimpleName());
 | 
			
		||||
		sb.append("(");
 | 
			
		||||
		sb.append(super.getColumns(false));
 | 
			
		||||
		sb.append(")");
 | 
			
		||||
		sb.append(" VALUES (");
 | 
			
		||||
		sb.append(super.getColumns(true));
 | 
			
		||||
		sb.append(")");
 | 
			
		||||
 | 
			
		||||
		return sb.toString();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Inserts a list of <T>s into the corresponding database-table
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param list
 | 
			
		||||
	 *            List of <T>s that should be inserted into the corresponding
 | 
			
		||||
	 *            database-table
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @throws SQLException
 | 
			
		||||
	 * @throws SecurityException
 | 
			
		||||
	 * @throws IllegalArgumentException
 | 
			
		||||
	 * @throws InstantiationException
 | 
			
		||||
	 * @throws IllegalAccessException
 | 
			
		||||
	 * @throws IntrospectionException
 | 
			
		||||
	 * @throws InvocationTargetException
 | 
			
		||||
	 */
 | 
			
		||||
	public void insertObjects(List<T> list) throws SQLException,
 | 
			
		||||
			SecurityException, IllegalArgumentException,
 | 
			
		||||
			InstantiationException, IllegalAccessException,
 | 
			
		||||
			IntrospectionException, InvocationTargetException {
 | 
			
		||||
 | 
			
		||||
		Connection connection = null;
 | 
			
		||||
		PreparedStatement preparedStatement = null;
 | 
			
		||||
 | 
			
		||||
		try {
 | 
			
		||||
			connection = databaseConnectionFactory.createConnection();
 | 
			
		||||
			preparedStatement = connection.prepareStatement(query);
 | 
			
		||||
 | 
			
		||||
			for (T instance : list) {
 | 
			
		||||
				int i = 0;
 | 
			
		||||
 | 
			
		||||
				for (Field field : type.getDeclaredFields()) {
 | 
			
		||||
					PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
 | 
			
		||||
							field.getName(), type);
 | 
			
		||||
 | 
			
		||||
					Method method = propertyDescriptor
 | 
			
		||||
							.getReadMethod();
 | 
			
		||||
 | 
			
		||||
					Object value = method.invoke(instance);
 | 
			
		||||
 | 
			
		||||
					preparedStatement.setObject(++i, value);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				preparedStatement.addBatch();
 | 
			
		||||
			}
 | 
			
		||||
			preparedStatement.executeBatch();
 | 
			
		||||
 | 
			
		||||
		} finally {
 | 
			
		||||
			databaseConnectionFactory.close(preparedStatement, connection);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,135 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.db;
 | 
			
		||||
 | 
			
		||||
import java.beans.IntrospectionException;
 | 
			
		||||
import java.beans.PropertyDescriptor;
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
import java.lang.reflect.InvocationTargetException;
 | 
			
		||||
import java.lang.reflect.Method;
 | 
			
		||||
import java.sql.Connection;
 | 
			
		||||
import java.sql.ResultSet;
 | 
			
		||||
import java.sql.SQLException;
 | 
			
		||||
import java.sql.Statement;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * Class that creates a list of <T>s filled with values from the corresponding
 | 
			
		||||
 * database-table.
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Tino for http://www.java-blog.com
 | 
			
		||||
 * 
 | 
			
		||||
 * @param <T>
 | 
			
		||||
 */
 | 
			
		||||
public class SQLiteDatabaseSelectHandler<T> extends AbstractDatabaseHandler<T> {
 | 
			
		||||
	
 | 
			
		||||
	public SQLiteDatabaseSelectHandler(Class<T> type,
 | 
			
		||||
			IDatabase databaseConnectionFactory) {
 | 
			
		||||
		super(type, databaseConnectionFactory, null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public SQLiteDatabaseSelectHandler(Class<T> type,
 | 
			
		||||
			IDatabase databaseConnectionFactory, String criteria) {
 | 
			
		||||
		super(type, databaseConnectionFactory, criteria);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected String createQuery(String criterion) {
 | 
			
		||||
 | 
			
		||||
		StringBuilder sb = new StringBuilder();
 | 
			
		||||
 | 
			
		||||
		sb.append("SELECT ");
 | 
			
		||||
		sb.append(super.getColumns(false));
 | 
			
		||||
		sb.append(" FROM ");
 | 
			
		||||
 | 
			
		||||
		/* We assume the table-name exactly matches the simpleName of T */
 | 
			
		||||
		sb.append(type.getSimpleName());
 | 
			
		||||
		if(criterion!=null){
 | 
			
		||||
			sb.append(" WHERE ( ");
 | 
			
		||||
			sb.append(criterion);
 | 
			
		||||
			sb.append(" )");
 | 
			
		||||
		}
 | 
			
		||||
		return sb.toString();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Creates a list of <T>s filled with values from the corresponding
 | 
			
		||||
	 * database-table
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @return List of <T>s filled with values from the corresponding
 | 
			
		||||
	 *         database-table
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @throws SQLException
 | 
			
		||||
	 * @throws SecurityException
 | 
			
		||||
	 * @throws IllegalArgumentException
 | 
			
		||||
	 * @throws InstantiationException
 | 
			
		||||
	 * @throws IllegalAccessException
 | 
			
		||||
	 * @throws IntrospectionException
 | 
			
		||||
	 * @throws InvocationTargetException
 | 
			
		||||
	 */
 | 
			
		||||
	public List<T> selectObjects() throws SQLException,
 | 
			
		||||
			SecurityException, IllegalArgumentException,
 | 
			
		||||
			InstantiationException, IllegalAccessException,
 | 
			
		||||
			IntrospectionException, InvocationTargetException {
 | 
			
		||||
 | 
			
		||||
		Connection connection = null;
 | 
			
		||||
		Statement statement = null;
 | 
			
		||||
		ResultSet resultSet = null;
 | 
			
		||||
 | 
			
		||||
		try {
 | 
			
		||||
			connection = databaseConnectionFactory.createConnection();
 | 
			
		||||
			statement = connection.createStatement();
 | 
			
		||||
			resultSet = statement.executeQuery(query);
 | 
			
		||||
 | 
			
		||||
			return createObjects(resultSet);
 | 
			
		||||
 | 
			
		||||
		} finally {
 | 
			
		||||
			databaseConnectionFactory.close(resultSet, statement, connection);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 
 | 
			
		||||
	 * Creates a list of <T>s filled with values from the provided ResultSet
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param resultSet
 | 
			
		||||
	 *            ResultSet that contains the result of the
 | 
			
		||||
	 *            database-select-query
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @return List of <T>s filled with values from the provided ResultSet
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @throws SecurityException
 | 
			
		||||
	 * @throws IllegalArgumentException
 | 
			
		||||
	 * @throws SQLException
 | 
			
		||||
	 * @throws InstantiationException
 | 
			
		||||
	 * @throws IllegalAccessException
 | 
			
		||||
	 * @throws IntrospectionException
 | 
			
		||||
	 * @throws InvocationTargetException
 | 
			
		||||
	 */
 | 
			
		||||
	private List<T> createObjects(ResultSet resultSet)
 | 
			
		||||
			throws SecurityException, IllegalArgumentException,
 | 
			
		||||
			SQLException, InstantiationException,
 | 
			
		||||
			IllegalAccessException, IntrospectionException,
 | 
			
		||||
			InvocationTargetException {
 | 
			
		||||
 | 
			
		||||
		List<T> list = new ArrayList<T>();
 | 
			
		||||
 | 
			
		||||
		while (resultSet.next()) {
 | 
			
		||||
 | 
			
		||||
			T instance = type.newInstance();
 | 
			
		||||
 | 
			
		||||
			for (Field field : type.getDeclaredFields()) {
 | 
			
		||||
 | 
			
		||||
				/* We assume the table-column-names exactly match the variable-names of T */
 | 
			
		||||
				Object value = resultSet.getObject(field.getName());
 | 
			
		||||
				if(value!=null){
 | 
			
		||||
					PropertyDescriptor propertyDescriptor = new PropertyDescriptor(field.getName(), type);
 | 
			
		||||
					propertyDescriptor.getWriteMethod().invoke(instance, value);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			list.add(instance);
 | 
			
		||||
		}
 | 
			
		||||
		return list;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,49 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.tables;
 | 
			
		||||
 | 
			
		||||
public class ScvGenerator {
 | 
			
		||||
	public int getId() {
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setId(int id) {
 | 
			
		||||
		this.id = id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getStream() {
 | 
			
		||||
		return stream;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setStream(int stream) {
 | 
			
		||||
		this.stream = stream;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setName(String name) {
 | 
			
		||||
		this.name = name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getBegin_attr() {
 | 
			
		||||
		return begin_attr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setBegin_attr(int begin_attr) {
 | 
			
		||||
		this.begin_attr = begin_attr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getEnd_attr() {
 | 
			
		||||
		return end_attr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setEnd_attr(int end_attr) {
 | 
			
		||||
		this.end_attr = end_attr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private int id;
 | 
			
		||||
	private int stream;
 | 
			
		||||
	private String name;
 | 
			
		||||
	private int begin_attr;
 | 
			
		||||
	private int end_attr;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,19 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.tables;
 | 
			
		||||
 | 
			
		||||
public class ScvSimProps {
 | 
			
		||||
	
 | 
			
		||||
	private long time_resolution;
 | 
			
		||||
 | 
			
		||||
	public ScvSimProps() {
 | 
			
		||||
		super();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public long getTime_resolution() {
 | 
			
		||||
		return time_resolution;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setTime_resolution(long time_resolution) {
 | 
			
		||||
		this.time_resolution = time_resolution;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,31 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.tables;
 | 
			
		||||
 | 
			
		||||
public class ScvStream {
 | 
			
		||||
	public int getId() {
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setId(int id) {
 | 
			
		||||
		this.id = id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setName(String name) {
 | 
			
		||||
		this.name = name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getKind() {
 | 
			
		||||
		return kind;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setKind(String kind) {
 | 
			
		||||
		this.kind = kind;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private int id;
 | 
			
		||||
	private String name;
 | 
			
		||||
	private String kind;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,31 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.tables;
 | 
			
		||||
 | 
			
		||||
public class ScvTx {
 | 
			
		||||
	public int getId() {
 | 
			
		||||
		return id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setId(int id) {
 | 
			
		||||
		this.id = id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getGenerator() {
 | 
			
		||||
		return generator;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setGenerator(int generator) {
 | 
			
		||||
		this.generator = generator;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getStream() {
 | 
			
		||||
		return stream;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setStream(int stream) {
 | 
			
		||||
		this.stream = stream;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private int id;
 | 
			
		||||
	private int generator;
 | 
			
		||||
	private int stream;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,50 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.tables;
 | 
			
		||||
 | 
			
		||||
public class ScvTxAttribute {
 | 
			
		||||
 | 
			
		||||
	public int getTx() {
 | 
			
		||||
		return tx;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setTx(int tx) {
 | 
			
		||||
		this.tx = tx;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getType() {
 | 
			
		||||
		return type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setType(int type) {
 | 
			
		||||
		this.type = type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setName(String name) {
 | 
			
		||||
		this.name = name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getData_type() {
 | 
			
		||||
		return data_type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setData_type(int data_type) {
 | 
			
		||||
		this.data_type = data_type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getData_value() {
 | 
			
		||||
		return data_value;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setData_value(String data_value) {
 | 
			
		||||
		this.data_value = data_value;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private int tx;
 | 
			
		||||
	private int type;
 | 
			
		||||
	private String name;
 | 
			
		||||
	private int data_type;
 | 
			
		||||
	private String data_value;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,31 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.tables;
 | 
			
		||||
 | 
			
		||||
public class ScvTxEvent {
 | 
			
		||||
	public int getTx() {
 | 
			
		||||
		return tx;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setTx(int tx) {
 | 
			
		||||
		this.tx = tx;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getType() {
 | 
			
		||||
		return type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setType(int type) {
 | 
			
		||||
		this.type = type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public long getTime() {
 | 
			
		||||
		return time;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setTime(long time) {
 | 
			
		||||
		this.time = time;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private int tx;
 | 
			
		||||
	private int type;
 | 
			
		||||
	private long time;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,32 @@
 | 
			
		||||
package com.minres.scviewer.database.sqlite.tables;
 | 
			
		||||
 | 
			
		||||
public class ScvTxRelation {
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setName(String name) {
 | 
			
		||||
		this.name = name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getSrc() {
 | 
			
		||||
		return src;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setSrc(int src) {
 | 
			
		||||
		this.src = src;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int getSink() {
 | 
			
		||||
		return sink;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setSink(int sink) {
 | 
			
		||||
		this.sink = sink;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private String name;
 | 
			
		||||
	private int src;
 | 
			
		||||
	private int sink;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<classpath>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
			
		||||
	<classpathentry kind="src" path="src"/>
 | 
			
		||||
	<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<projectDescription>
 | 
			
		||||
	<name>com.itjw.txviewer.database.text</name>
 | 
			
		||||
	<name>com.minres.scviewer.database.text</name>
 | 
			
		||||
	<comment></comment>
 | 
			
		||||
	<projects>
 | 
			
		||||
	</projects>
 | 
			
		||||
@@ -20,6 +20,11 @@
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
		<buildCommand>
 | 
			
		||||
			<name>org.eclipse.pde.ds.core.builder</name>
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
	</buildSpec>
 | 
			
		||||
	<natures>
 | 
			
		||||
		<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
eclipse.preferences.version=1
 | 
			
		||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
			
		||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 | 
			
		||||
org.eclipse.jdt.core.compiler.compliance=1.7
 | 
			
		||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
			
		||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
			
		||||
org.eclipse.jdt.core.compiler.source=1.7
 | 
			
		||||
							
								
								
									
										15
									
								
								com.minres.scviewer.database.text/META-INF/MANIFEST.MF
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,15 @@
 | 
			
		||||
Manifest-Version: 1.0
 | 
			
		||||
Bundle-ManifestVersion: 2
 | 
			
		||||
Bundle-Name: Textual transaction database
 | 
			
		||||
Bundle-SymbolicName: com.minres.scviewer.database.text
 | 
			
		||||
Bundle-Version: 1.0.0.qualifier
 | 
			
		||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
			
		||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 | 
			
		||||
Import-Package: com.minres.scviewer.database,
 | 
			
		||||
 org.osgi.framework;version="1.3.0"
 | 
			
		||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
 | 
			
		||||
 org.codehaus.groovy;bundle-version="1.8.6",
 | 
			
		||||
 org.eclipse.equinox.util;bundle-version="1.0.500",
 | 
			
		||||
 org.eclipse.equinox.ds;bundle-version="1.4.200",
 | 
			
		||||
 org.eclipse.osgi.services;bundle-version="3.4.0"
 | 
			
		||||
Service-Component: OSGI-INF/component.xml
 | 
			
		||||
							
								
								
									
										7
									
								
								com.minres.scviewer.database.text/OSGI-INF/component.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,7 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="TextDbFactory">
 | 
			
		||||
   <implementation class="com.minres.scviewer.database.text.TextDbFactory"/>
 | 
			
		||||
   <service>
 | 
			
		||||
      <provide interface="com.minres.scviewer.database.ITransactionDbFactory"/>
 | 
			
		||||
   </service>
 | 
			
		||||
</scr:component>
 | 
			
		||||
							
								
								
									
										6
									
								
								com.minres.scviewer.database.text/build.properties
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,6 @@
 | 
			
		||||
output.. = bin/
 | 
			
		||||
bin.includes = META-INF/,\
 | 
			
		||||
               .,\
 | 
			
		||||
               component.xml,\
 | 
			
		||||
               OSGI-INF/
 | 
			
		||||
source.. = src/
 | 
			
		||||
@@ -8,20 +8,22 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database.text
 | 
			
		||||
package com.minres.scviewer.database.text
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttrType;
 | 
			
		||||
import com.minres.scviewer.database.AssociationType;
 | 
			
		||||
import com.minres.scviewer.database.DataType;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttrType;
 | 
			
		||||
 | 
			
		||||
class TrAttrType implements ITrAttrType {
 | 
			
		||||
class AttrType implements ITrAttrType {
 | 
			
		||||
	String name
 | 
			
		||||
	String dataType
 | 
			
		||||
	ITrAttrType.AttributeType type
 | 
			
		||||
	DataType dataType
 | 
			
		||||
	AssociationType type
 | 
			
		||||
	
 | 
			
		||||
	static TrAttrType getAttrType(String name, String dataType, ITrAttrType.AttributeType type){
 | 
			
		||||
		TrAttrTypeFactory.instance.getAttrType(name, dataType, type)
 | 
			
		||||
	static AttrType getAttrType(String name, DataType dataType, AssociationType type){
 | 
			
		||||
		AttrTypeFactory.instance.getAttrType(name, dataType, type)
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	TrAttrType(String name, String dataType, ITrAttrType.AttributeType type){
 | 
			
		||||
	AttrType(String name, DataType dataType, AssociationType type){
 | 
			
		||||
		this.name=name
 | 
			
		||||
		this.dataType=dataType
 | 
			
		||||
		this.type=type
 | 
			
		||||
@@ -8,27 +8,29 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database.text
 | 
			
		||||
package com.minres.scviewer.database.text
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttrType
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttribute
 | 
			
		||||
import com.minres.scviewer.database.AssociationType;
 | 
			
		||||
import com.minres.scviewer.database.DataType
 | 
			
		||||
import com.minres.scviewer.database.ITrAttrType
 | 
			
		||||
import com.minres.scviewer.database.ITrAttribute
 | 
			
		||||
 | 
			
		||||
class TrAttrTypeFactory {
 | 
			
		||||
	private static final instance = new TrAttrTypeFactory()
 | 
			
		||||
class AttrTypeFactory {
 | 
			
		||||
	private static final instance = new AttrTypeFactory()
 | 
			
		||||
	
 | 
			
		||||
	def attributes = [:]
 | 
			
		||||
	
 | 
			
		||||
	private TrAttrTypeFactory() {
 | 
			
		||||
		TrAttrTypeFactory.metaClass.constructor = {-> instance }
 | 
			
		||||
	private AttrTypeFactory() {
 | 
			
		||||
		AttrTypeFactory.metaClass.constructor = {-> instance }
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	ITrAttrType getAttrType(String name, String dataType, ITrAttrType.AttributeType type){
 | 
			
		||||
		def key = name+":"+dataType
 | 
			
		||||
	ITrAttrType getAttrType(String name, DataType dataType, AssociationType type){
 | 
			
		||||
		def key = name+":"+dataType.toString()
 | 
			
		||||
		ITrAttrType res
 | 
			
		||||
		if(attributes.containsKey(key)){
 | 
			
		||||
			res=attributes[key]
 | 
			
		||||
		} else {
 | 
			
		||||
			res=new TrAttrType(name, dataType, type)
 | 
			
		||||
			res=new AttrType(name, dataType, type)
 | 
			
		||||
			attributes[key]=res
 | 
			
		||||
		}
 | 
			
		||||
		return res
 | 
			
		||||
@@ -8,22 +8,24 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database.text
 | 
			
		||||
package com.minres.scviewer.database.text
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttrType;
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttribute
 | 
			
		||||
import com.minres.scviewer.database.AssociationType;
 | 
			
		||||
import com.minres.scviewer.database.DataType;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttrType;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttribute
 | 
			
		||||
 | 
			
		||||
class TrAttribute  implements ITrAttribute{
 | 
			
		||||
class Attribute  implements ITrAttribute{
 | 
			
		||||
	
 | 
			
		||||
	TrAttrType attributeType
 | 
			
		||||
	AttrType attributeType
 | 
			
		||||
 | 
			
		||||
	def value
 | 
			
		||||
	
 | 
			
		||||
	TrAttribute(String name, String dataType, ITrAttrType.AttributeType type, value){
 | 
			
		||||
		attributeType = TrAttrTypeFactory.instance.getAttrType(name, dataType, type)
 | 
			
		||||
	Attribute(String name, DataType dataType, AssociationType type, value){
 | 
			
		||||
		attributeType = AttrTypeFactory.instance.getAttrType(name, dataType, type)
 | 
			
		||||
		switch(dataType){
 | 
			
		||||
			case "STRING":
 | 
			
		||||
			case "ENUMERATION":
 | 
			
		||||
			case DataType.STRING:
 | 
			
		||||
			case DataType.ENUMERATION:
 | 
			
		||||
				this.value=value[1..-2]
 | 
			
		||||
				break;
 | 
			
		||||
			default:
 | 
			
		||||
@@ -31,11 +33,11 @@ class TrAttribute  implements ITrAttribute{
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	TrAttribute(TrAttrType other){
 | 
			
		||||
	Attribute(AttrType other){
 | 
			
		||||
		attributeType=other
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	TrAttribute(TrAttrType other, value){
 | 
			
		||||
	Attribute(AttrType other, value){
 | 
			
		||||
		this(other.name, other.dataType, other.type, value)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -45,13 +47,13 @@ class TrAttribute  implements ITrAttribute{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITrAttrType.AttributeType getType() {
 | 
			
		||||
		return attributeType.getType();
 | 
			
		||||
	public AssociationType getType() {
 | 
			
		||||
		attributeType.type;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		@Override
 | 
			
		||||
	public String getDataType() {
 | 
			
		||||
		return attributeType.getDataType();
 | 
			
		||||
	@Override
 | 
			
		||||
	public DataType getDataType() {
 | 
			
		||||
		attributeType.dataType;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -8,20 +8,20 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database.text
 | 
			
		||||
package com.minres.scviewer.database.text
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttrType
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttribute;
 | 
			
		||||
import com.itjw.txviewer.database.ITrGenerator;
 | 
			
		||||
import com.itjw.txviewer.database.ITrStream;
 | 
			
		||||
import com.itjw.txviewer.database.ITransaction;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttrType
 | 
			
		||||
import com.minres.scviewer.database.ITrAttribute;
 | 
			
		||||
import com.minres.scviewer.database.ITrGenerator;
 | 
			
		||||
import com.minres.scviewer.database.ITrStream;
 | 
			
		||||
import com.minres.scviewer.database.ITransaction;
 | 
			
		||||
 | 
			
		||||
class TrGenerator implements ITrGenerator{
 | 
			
		||||
class Generator implements ITrGenerator{
 | 
			
		||||
	Long id
 | 
			
		||||
	TrStream stream
 | 
			
		||||
	Stream stream
 | 
			
		||||
	String name
 | 
			
		||||
	Boolean active = false
 | 
			
		||||
	ArrayList<ITransaction> transactions=[]
 | 
			
		||||
@@ -31,7 +31,7 @@ class TrGenerator implements ITrGenerator{
 | 
			
		||||
	ArrayList<ITrAttrType> end_attrs= []
 | 
			
		||||
	int end_attrs_idx = 0
 | 
			
		||||
	
 | 
			
		||||
	TrGenerator(int id, TrStream stream, name){
 | 
			
		||||
	Generator(int id, Stream stream, name){
 | 
			
		||||
		this.id=id
 | 
			
		||||
		this.stream=stream
 | 
			
		||||
		this.name=name
 | 
			
		||||
@@ -8,23 +8,23 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database.text;
 | 
			
		||||
package com.minres.scviewer.database.text;
 | 
			
		||||
 | 
			
		||||
import java.beans.PropertyChangeListener;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrHierNode;
 | 
			
		||||
import com.minres.scviewer.database.ITrHierNode;
 | 
			
		||||
 | 
			
		||||
class TrHierNode implements ITrHierNode {
 | 
			
		||||
class HierNode implements ITrHierNode {
 | 
			
		||||
 | 
			
		||||
	String name
 | 
			
		||||
	def childs = []
 | 
			
		||||
 | 
			
		||||
	public TrHierNode(){
 | 
			
		||||
	public HierNode(){
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public TrHierNode(String name){
 | 
			
		||||
	public HierNode(String name){
 | 
			
		||||
		this.name=name
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
package com.itjw.txviewer.database.text
 | 
			
		||||
package com.minres.scviewer.database.text
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrRelation
 | 
			
		||||
import com.itjw.txviewer.database.ITransaction;
 | 
			
		||||
import com.itjw.txviewer.database.RelationType;
 | 
			
		||||
import com.minres.scviewer.database.ITrRelation
 | 
			
		||||
import com.minres.scviewer.database.ITransaction;
 | 
			
		||||
import com.minres.scviewer.database.RelationType;
 | 
			
		||||
 | 
			
		||||
class TrRelation implements ITrRelation {
 | 
			
		||||
class Relation implements ITrRelation {
 | 
			
		||||
	Transaction source
 | 
			
		||||
	
 | 
			
		||||
	Transaction target
 | 
			
		||||
@@ -12,7 +12,7 @@ class TrRelation implements ITrRelation {
 | 
			
		||||
	RelationType relationType
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	public TrRelation(RelationType relationType, Transaction source, Transaction target) {
 | 
			
		||||
	public Relation(RelationType relationType, Transaction source, Transaction target) {
 | 
			
		||||
		this.source = source;
 | 
			
		||||
		this.target = target;
 | 
			
		||||
		this.relationType = relationType;
 | 
			
		||||
@@ -8,25 +8,23 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database.text
 | 
			
		||||
package com.minres.scviewer.database.text
 | 
			
		||||
 | 
			
		||||
import java.beans.PropertyChangeListener;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrDb
 | 
			
		||||
import com.itjw.txviewer.database.ITrGenerator
 | 
			
		||||
import com.itjw.txviewer.database.ITrHierNode
 | 
			
		||||
import com.itjw.txviewer.database.ITrStream
 | 
			
		||||
import com.itjw.txviewer.database.ITransaction
 | 
			
		||||
import com.minres.scviewer.database.ITrDb
 | 
			
		||||
import com.minres.scviewer.database.ITrGenerator
 | 
			
		||||
import com.minres.scviewer.database.ITrHierNode
 | 
			
		||||
import com.minres.scviewer.database.ITrStream
 | 
			
		||||
import com.minres.scviewer.database.ITransaction
 | 
			
		||||
 | 
			
		||||
class TrStream extends TrHierNode implements ITrStream {
 | 
			
		||||
class Stream extends HierNode implements ITrStream {
 | 
			
		||||
 | 
			
		||||
	Long id;
 | 
			
		||||
	
 | 
			
		||||
	TrTextDb database
 | 
			
		||||
	
 | 
			
		||||
	String name;
 | 
			
		||||
	TextDb database
 | 
			
		||||
	
 | 
			
		||||
	String fullName;
 | 
			
		||||
	
 | 
			
		||||
@@ -34,21 +32,13 @@ class TrStream extends TrHierNode implements ITrStream {
 | 
			
		||||
	
 | 
			
		||||
	def generators = [];
 | 
			
		||||
	
 | 
			
		||||
	def childs = []
 | 
			
		||||
	
 | 
			
		||||
	private allTransactions;
 | 
			
		||||
 | 
			
		||||
	public TrHierNode(String name){
 | 
			
		||||
		this.name=name
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public List<ITrHierNode>  getChildNodes() {
 | 
			
		||||
		return childs.sort{it.name};
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	TrStream(int id, TrTextDb db, String name, String kind){
 | 
			
		||||
	Stream(int id, TextDb db, String name, String kind){
 | 
			
		||||
		this.id=id
 | 
			
		||||
		this.database=db
 | 
			
		||||
		this.name=name
 | 
			
		||||
@@ -65,7 +55,7 @@ class TrStream extends TrHierNode implements ITrStream {
 | 
			
		||||
		return database;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	// FIXME: maybe need to be somewhere else
 | 
			
		||||
	public int getMaxConcurrrentTx() {
 | 
			
		||||
		def rowendtime = [0]
 | 
			
		||||
		getTransactions().each{Transaction tx ->
 | 
			
		||||
@@ -86,4 +76,11 @@ class TrStream extends TrHierNode implements ITrStream {
 | 
			
		||||
			allTransactions=generators.transactions.flatten().sort{it.beginTime.value}
 | 
			
		||||
		return allTransactions
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITransaction getTransactionById(long id) {
 | 
			
		||||
		if(!allTransactions)
 | 
			
		||||
			allTransactions=generators.transactions.flatten().sort{it.beginTime.value}
 | 
			
		||||
		allTransactions.find{it.id==id}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database.text;
 | 
			
		||||
package com.minres.scviewer.database.text;
 | 
			
		||||
 | 
			
		||||
import java.io.InputStream;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
@@ -17,17 +17,19 @@ import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.TreeMap;
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttrType;
 | 
			
		||||
import com.itjw.txviewer.database.ITrAttribute;
 | 
			
		||||
import com.itjw.txviewer.database.ITrDb;
 | 
			
		||||
import com.itjw.txviewer.database.ITrGenerator;
 | 
			
		||||
import com.itjw.txviewer.database.ITrHierNode;
 | 
			
		||||
import com.itjw.txviewer.database.ITrStream;
 | 
			
		||||
import com.itjw.txviewer.database.InputFormatException;
 | 
			
		||||
import com.itjw.txviewer.database.EventTime
 | 
			
		||||
import com.itjw.txviewer.database.RelationType
 | 
			
		||||
import com.minres.scviewer.database.AssociationType;
 | 
			
		||||
import com.minres.scviewer.database.DataType;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttrType;
 | 
			
		||||
import com.minres.scviewer.database.ITrAttribute;
 | 
			
		||||
import com.minres.scviewer.database.ITrDb;
 | 
			
		||||
import com.minres.scviewer.database.ITrGenerator;
 | 
			
		||||
import com.minres.scviewer.database.ITrHierNode;
 | 
			
		||||
import com.minres.scviewer.database.ITrStream;
 | 
			
		||||
import com.minres.scviewer.database.InputFormatException;
 | 
			
		||||
import com.minres.scviewer.database.EventTime
 | 
			
		||||
import com.minres.scviewer.database.RelationType
 | 
			
		||||
 | 
			
		||||
public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
public class TextDb extends HierNode implements ITrDb{
 | 
			
		||||
 | 
			
		||||
	private EventTime maxTime;
 | 
			
		||||
	
 | 
			
		||||
@@ -58,7 +60,7 @@ public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
 | 
			
		||||
	public Map<Long, ITrGenerator> getGeneratorsById() {
 | 
			
		||||
		TreeMap<Long, ITrGenerator> res = new TreeMap<Long, ITrGenerator>();
 | 
			
		||||
		streams.each{TrStream stream -> stream.generators.each{res.put(it.id, id)} }
 | 
			
		||||
		streams.each{Stream stream -> stream.generators.each{res.put(it.id, id)} }
 | 
			
		||||
		return res;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -67,21 +69,16 @@ public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
		maxTime=new EventTime(0, "ns")
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	void load(InputStream inp) throws InputFormatException {
 | 
			
		||||
		parseInput(inp)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	void parseFromTextFile(filename){
 | 
			
		||||
		def file = new File(filename);
 | 
			
		||||
		this.databaseName = filname;
 | 
			
		||||
	void load(File file) throws InputFormatException {
 | 
			
		||||
		this.name = file.name;
 | 
			
		||||
		parseInput(file)
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private def parseInput(input){
 | 
			
		||||
 | 
			
		||||
	private def parseInput(File input){
 | 
			
		||||
		def streamsById = [:]
 | 
			
		||||
		def generatorsById = [:]
 | 
			
		||||
		def transactionsById = [:]
 | 
			
		||||
		TrGenerator generator
 | 
			
		||||
		Generator generator
 | 
			
		||||
		Transaction transaction
 | 
			
		||||
		boolean endTransaction=false
 | 
			
		||||
		def matcher
 | 
			
		||||
@@ -94,19 +91,19 @@ public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
				case "end_attribute":
 | 
			
		||||
					if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
 | 
			
		||||
						def id = Integer.parseInt(matcher[0][1])
 | 
			
		||||
						def stream = new TrStream(id, this, matcher[0][2], matcher[0][3])
 | 
			
		||||
						def stream = new Stream(id, this, matcher[0][2], matcher[0][3])
 | 
			
		||||
						streams<<stream
 | 
			
		||||
						streamsById[id]=stream
 | 
			
		||||
					} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
 | 
			
		||||
						def id = Integer.parseInt(matcher[0][1])
 | 
			
		||||
						ITrStream stream=streamsById[Integer.parseInt(matcher[0][3])]
 | 
			
		||||
						generator=new TrGenerator(id, stream, matcher[0][2])
 | 
			
		||||
						generator=new Generator(id, stream, matcher[0][2])
 | 
			
		||||
						stream.generators<<generator
 | 
			
		||||
						generatorsById[id]=generator
 | 
			
		||||
					} else if ((matcher = line =~ /^begin_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
 | 
			
		||||
						generator.begin_attrs << TrAttrType.getAttrType(matcher[0][2], matcher[0][3], ITrAttrType.AttributeType.BEGIN)
 | 
			
		||||
						generator.begin_attrs << AttrType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.BEGIN)
 | 
			
		||||
					} else if ((matcher = line =~ /^end_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
 | 
			
		||||
						generator.end_attrs << TrAttrType.getAttrType(matcher[0][2], matcher[0][3], ITrAttrType.AttributeType.END)
 | 
			
		||||
						generator.end_attrs << AttrType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.END)
 | 
			
		||||
					}
 | 
			
		||||
					break;
 | 
			
		||||
				case ")":
 | 
			
		||||
@@ -114,7 +111,7 @@ public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
					break
 | 
			
		||||
				case "tx_begin"://matcher = line =~ /^tx_begin\s+(\d+)\s+(\d+)\s+(\d+)\s+([munpf]?s)/
 | 
			
		||||
					def id = Integer.parseInt(tokens[1])
 | 
			
		||||
					TrGenerator gen=generatorsById[Integer.parseInt(tokens[2])]
 | 
			
		||||
					Generator gen=generatorsById[Integer.parseInt(tokens[2])]
 | 
			
		||||
					transaction = new Transaction(id, gen.stream, gen, new EventTime(Integer.parseInt(tokens[3]), tokens[4]))
 | 
			
		||||
					gen.transactions << transaction
 | 
			
		||||
					transactionsById[id]= transaction
 | 
			
		||||
@@ -133,13 +130,13 @@ public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
					break
 | 
			
		||||
				case "tx_record_attribute"://matcher = line =~ /^tx_record_attribute\s+(\d+)\s+"([^"]+)"\s+(\S+)\s*=\s*(.+)$/
 | 
			
		||||
					def id = Integer.parseInt(tokens[1])
 | 
			
		||||
					transactionsById[id].attributes<<new TrAttribute(tokens[2][1..-2], tokens[3], ITrAttrType.AttributeType.UNSPECIFIED, tokens[5..-1].join(' '))
 | 
			
		||||
					transactionsById[id].attributes<<new Attribute(tokens[2][1..-2], DataType.valueOf(tokens[3]), AssociationType.RECORD, tokens[5..-1].join(' '))
 | 
			
		||||
					break
 | 
			
		||||
				case "a"://matcher = line =~ /^a\s+(.+)$/
 | 
			
		||||
					if(endTransaction){
 | 
			
		||||
						transaction.attributes << new TrAttribute(transaction.generator.end_attrs[0], tokens[1])
 | 
			
		||||
						transaction.attributes << new Attribute(transaction.generator.end_attrs[0], tokens[1])
 | 
			
		||||
					} else {
 | 
			
		||||
						transaction.attributes << new TrAttribute(transaction.generator.begin_attrs[0], tokens[1])
 | 
			
		||||
						transaction.attributes << new Attribute(transaction.generator.begin_attrs[0], tokens[1])
 | 
			
		||||
					}
 | 
			
		||||
					break
 | 
			
		||||
				case "tx_relation"://matcher = line =~ /^tx_relation\s+\"(\S+)\"\s+(\d+)\s+(\d+)$/
 | 
			
		||||
@@ -147,7 +144,7 @@ public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
					Transaction tr2= transactionsById[Integer.parseInt(tokens[3])]
 | 
			
		||||
					def relType=tokens[1][1..-2]
 | 
			
		||||
					if(!relationTypes.containsKey(relType)) relationTypes[relType]=new RelationType(relType)
 | 
			
		||||
					def rel = new TrRelation(relationTypes[relType], tr1, tr2)
 | 
			
		||||
					def rel = new Relation(relationTypes[relType], tr1, tr2)
 | 
			
		||||
					tr1.outgoingRelations<<rel
 | 
			
		||||
					tr2.incomingRelations<<rel
 | 
			
		||||
					break
 | 
			
		||||
@@ -160,14 +157,14 @@ public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	def addHierarchyNodes(){
 | 
			
		||||
		streams.each{ TrStream stream->
 | 
			
		||||
		streams.each{ Stream stream->
 | 
			
		||||
			def hier = stream.fullName.split(/\./)
 | 
			
		||||
			ITrHierNode node = this
 | 
			
		||||
			hier.each { name ->
 | 
			
		||||
				def n1 = node.childNodes.find{it.name == name}
 | 
			
		||||
				if(name == hier[-1]){ //leaf
 | 
			
		||||
					if(n1!=null) {
 | 
			
		||||
						if(n1 instanceof TrHierNode){
 | 
			
		||||
						if(n1 instanceof HierNode){
 | 
			
		||||
							node.childNodes.remove(n1)
 | 
			
		||||
							stream.childNodes.addAll(n1.childNodes)
 | 
			
		||||
						} else {
 | 
			
		||||
@@ -181,7 +178,7 @@ public class TrTextDb extends TrHierNode implements ITrDb{
 | 
			
		||||
					if(n1 != null) {
 | 
			
		||||
						node=n1
 | 
			
		||||
					} else {
 | 
			
		||||
						TrHierNode newNode = new TrHierNode(name)
 | 
			
		||||
						HierNode newNode = new HierNode(name)
 | 
			
		||||
						node.childNodes<<newNode
 | 
			
		||||
						node=newNode
 | 
			
		||||
					}
 | 
			
		||||
@@ -0,0 +1,31 @@
 | 
			
		||||
package com.minres.scviewer.database.text
 | 
			
		||||
 | 
			
		||||
import java.io.FileInputStream;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.ITrDb
 | 
			
		||||
import com.minres.scviewer.database.ITransactionDbFactory;
 | 
			
		||||
 | 
			
		||||
class TextDbFactory implements ITransactionDbFactory {
 | 
			
		||||
 | 
			
		||||
	byte[] x = "scv_tr_stream".bytes
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public ITrDb createDatabase(File file) {
 | 
			
		||||
		try {
 | 
			
		||||
			FileInputStream fis = new FileInputStream(file);
 | 
			
		||||
            byte[] buffer = new byte[x.size()];
 | 
			
		||||
            def read = fis.read(buffer, 0, x.size());
 | 
			
		||||
            fis.close();
 | 
			
		||||
            if(read==x.size())
 | 
			
		||||
            	for(int i=0; i<x.size(); i++)
 | 
			
		||||
            		if(buffer[i]!=x[i]) return null;
 | 
			
		||||
			def db = new TextDb();
 | 
			
		||||
			db.load(file)
 | 
			
		||||
			return db
 | 
			
		||||
		} catch (Exception e) {
 | 
			
		||||
			e.printStackTrace()
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -8,20 +8,20 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database.text
 | 
			
		||||
package com.minres.scviewer.database.text
 | 
			
		||||
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Set
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.*
 | 
			
		||||
import com.minres.scviewer.database.*
 | 
			
		||||
 | 
			
		||||
class Transaction implements ITransaction {
 | 
			
		||||
	
 | 
			
		||||
	Long id
 | 
			
		||||
	
 | 
			
		||||
	TrGenerator generator
 | 
			
		||||
	Generator generator
 | 
			
		||||
 | 
			
		||||
	TrStream stream
 | 
			
		||||
	Stream stream
 | 
			
		||||
	
 | 
			
		||||
	EventTime beginTime
 | 
			
		||||
	
 | 
			
		||||
@@ -33,7 +33,7 @@ class Transaction implements ITransaction {
 | 
			
		||||
	
 | 
			
		||||
	def outgoingRelations =[]
 | 
			
		||||
	
 | 
			
		||||
	Transaction(int id, TrStream stream, TrGenerator generator, EventTime begin){
 | 
			
		||||
	Transaction(int id, Stream stream, Generator generator, EventTime begin){
 | 
			
		||||
		this.id=id
 | 
			
		||||
		this.generator=generator
 | 
			
		||||
		this.beginTime=begin
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<classpath>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
			
		||||
	<classpathentry kind="src" path="src"/>
 | 
			
		||||
	<classpathentry kind="output" path="bin"/>
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<projectDescription>
 | 
			
		||||
	<name>com.itjw.txviewer.database</name>
 | 
			
		||||
	<name>com.minres.scviewer.database</name>
 | 
			
		||||
	<comment></comment>
 | 
			
		||||
	<projects>
 | 
			
		||||
	</projects>
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
eclipse.preferences.version=1
 | 
			
		||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
			
		||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 | 
			
		||||
org.eclipse.jdt.core.compiler.compliance=1.7
 | 
			
		||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
			
		||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
			
		||||
org.eclipse.jdt.core.compiler.source=1.7
 | 
			
		||||
@@ -1,9 +1,8 @@
 | 
			
		||||
Manifest-Version: 1.0
 | 
			
		||||
Bundle-ManifestVersion: 2
 | 
			
		||||
Bundle-Name: Transaction Database
 | 
			
		||||
Bundle-SymbolicName: com.itjw.txviewer.database
 | 
			
		||||
Bundle-SymbolicName: com.minres.scviewer.database
 | 
			
		||||
Bundle-Version: 1.0.0.qualifier
 | 
			
		||||
Bundle-Vendor: ITJW
 | 
			
		||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
			
		||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 | 
			
		||||
Bundle-ActivationPolicy: lazy
 | 
			
		||||
Export-Package: com.itjw.txviewer.database
 | 
			
		||||
Export-Package: com.minres.scviewer.database
 | 
			
		||||
@@ -0,0 +1,3 @@
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
public enum AssociationType {BEGIN, RECORD, END}
 | 
			
		||||
@@ -0,0 +1,16 @@
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
  public enum DataType {
 | 
			
		||||
	    BOOLEAN,                       // bool
 | 
			
		||||
	    ENUMERATION,                   // enum
 | 
			
		||||
	    INTEGER,                       // char, short, int, long, long long, sc_int, sc_bigint  
 | 
			
		||||
	    UNSIGNED,                      // unsigned { char, short, int, long, long long }, sc_uint, sc_biguint  
 | 
			
		||||
	    FLOATING_POINT_NUMBER,         // float, double 
 | 
			
		||||
	    BIT_VECTOR,                    // sc_bit, sc_bv
 | 
			
		||||
	    LOGIC_VECTOR,                  // sc_logic, sc_lv
 | 
			
		||||
	    FIXED_POINT_INTEGER,           // sc_fixed
 | 
			
		||||
	    UNSIGNED_FIXED_POINT_INTEGER,  // sc_ufixed
 | 
			
		||||
	    RECORD,                        // struct/class
 | 
			
		||||
	    POINTER,                       // T*
 | 
			
		||||
	    ARRAY,                         // T[N]
 | 
			
		||||
	    STRING                         // string, std::string
 | 
			
		||||
	  };
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
public class EventTime implements Comparable<EventTime>{
 | 
			
		||||
	
 | 
			
		||||
@@ -8,11 +8,10 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
public interface ITrAttrType {
 | 
			
		||||
	enum AttributeType {UNSPECIFIED, BEGIN, END};
 | 
			
		||||
	public String getName();
 | 
			
		||||
	public String getDataType();
 | 
			
		||||
	public AttributeType getType();
 | 
			
		||||
	public DataType getDataType();
 | 
			
		||||
	public AssociationType getType();
 | 
			
		||||
}
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
public interface ITrAttribute extends ITrAttrType {
 | 
			
		||||
	public Object getValue();
 | 
			
		||||
@@ -8,8 +8,9 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.InputStream;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@@ -22,7 +23,7 @@ public interface ITrDb extends ITrHierNode {
 | 
			
		||||
	
 | 
			
		||||
	public List<ITrStream> getAllStreams();
 | 
			
		||||
	
 | 
			
		||||
	public void load(InputStream inp) throws InputFormatException;
 | 
			
		||||
	public void load(File inp) throws InputFormatException;
 | 
			
		||||
 | 
			
		||||
	public void clear();
 | 
			
		||||
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
import java.beans.PropertyChangeListener;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
public interface ITrRelation {
 | 
			
		||||
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@@ -24,6 +24,6 @@ public interface  ITrStream extends ITrHierNode {
 | 
			
		||||
 | 
			
		||||
	public List<ITransaction> getTransactions();
 | 
			
		||||
 | 
			
		||||
	public int getMaxConcurrrentTx();
 | 
			
		||||
	public ITransaction getTransactionById(long id);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
 | 
			
		||||
public interface ITransactionDbFactory {
 | 
			
		||||
	
 | 
			
		||||
	ITrDb createDatabase(File file);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
public class InputFormatException extends Exception {
 | 
			
		||||
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.database;
 | 
			
		||||
package com.minres.scviewer.database;
 | 
			
		||||
 | 
			
		||||
public class RelationType {
 | 
			
		||||
	
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<projectDescription>
 | 
			
		||||
	<name>com.itjw.txviewer.feature</name>
 | 
			
		||||
	<name>com.minres.scviewer.feature</name>
 | 
			
		||||
	<comment></comment>
 | 
			
		||||
	<projects>
 | 
			
		||||
	</projects>
 | 
			
		||||
							
								
								
									
										102
									
								
								com.minres.scviewer.feature/feature.properties
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,102 @@
 | 
			
		||||
featureName=SystemC simulation results viewer
 | 
			
		||||
providerName=MINRES Technologies GmbH
 | 
			
		||||
updateSiteName=SC Viewer Updates
 | 
			
		||||
description=SystemC simulation results viewer dependencies
 | 
			
		||||
licenseURL=license.html
 | 
			
		||||
license=\
 | 
			
		||||
ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
 | 
			
		||||
March 17, 2005\n\
 | 
			
		||||
\n\
 | 
			
		||||
Usage Of Content\n\
 | 
			
		||||
\n\
 | 
			
		||||
THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
 | 
			
		||||
OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
 | 
			
		||||
USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
 | 
			
		||||
AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
 | 
			
		||||
NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
 | 
			
		||||
AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
 | 
			
		||||
AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
 | 
			
		||||
OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
 | 
			
		||||
TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
 | 
			
		||||
OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
 | 
			
		||||
BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
 | 
			
		||||
\n\
 | 
			
		||||
Applicable Licenses\n\
 | 
			
		||||
\n\
 | 
			
		||||
Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
 | 
			
		||||
is provided to you under the terms and conditions of the Eclipse Public\n\
 | 
			
		||||
License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
 | 
			
		||||
Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
 | 
			
		||||
For purposes of the EPL, "Program" will mean the Content.\n\
 | 
			
		||||
\n\
 | 
			
		||||
Content includes, but is not limited to, source code, object code,\n\
 | 
			
		||||
documentation and other files maintained in the Eclipse.org CVS\n\
 | 
			
		||||
repository ("Repository") in CVS modules ("Modules") and made available\n\
 | 
			
		||||
as downloadable archives ("Downloads").\n\
 | 
			
		||||
\n\
 | 
			
		||||
   - Content may be structured and packaged into modules to facilitate delivering,\n\
 | 
			
		||||
     extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
 | 
			
		||||
     plug-in fragments ("Fragments"), and features ("Features").\n\
 | 
			
		||||
   - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
 | 
			
		||||
     in a directory named "plugins".\n\
 | 
			
		||||
   - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
 | 
			
		||||
     Each Feature may be packaged as a sub-directory in a directory named "features".\n\
 | 
			
		||||
     Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
 | 
			
		||||
     numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
 | 
			
		||||
   - Features may also include other Features ("Included Features"). Within a Feature, files\n\
 | 
			
		||||
     named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
 | 
			
		||||
\n\
 | 
			
		||||
Features may also include other Features ("Included Features"). Files named\n\
 | 
			
		||||
"feature.xml" may contain a list of the names and version numbers of\n\
 | 
			
		||||
Included Features.\n\
 | 
			
		||||
\n\
 | 
			
		||||
The terms and conditions governing Plug-ins and Fragments should be\n\
 | 
			
		||||
contained in files named "about.html" ("Abouts"). The terms and\n\
 | 
			
		||||
conditions governing Features and Included Features should be contained\n\
 | 
			
		||||
in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
 | 
			
		||||
Licenses may be located in any directory of a Download or Module\n\
 | 
			
		||||
including, but not limited to the following locations:\n\
 | 
			
		||||
\n\
 | 
			
		||||
   - The top-level (root) directory\n\
 | 
			
		||||
   - Plug-in and Fragment directories\n\
 | 
			
		||||
   - Inside Plug-ins and Fragments packaged as JARs\n\
 | 
			
		||||
   - Sub-directories of the directory named "src" of certain Plug-ins\n\
 | 
			
		||||
   - Feature directories\n\
 | 
			
		||||
\n\
 | 
			
		||||
Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
 | 
			
		||||
Eclipse Update Manager, you must agree to a license ("Feature Update\n\
 | 
			
		||||
License") during the installation process. If the Feature contains\n\
 | 
			
		||||
Included Features, the Feature Update License should either provide you\n\
 | 
			
		||||
with the terms and conditions governing the Included Features or inform\n\
 | 
			
		||||
you where you can locate them. Feature Update Licenses may be found in\n\
 | 
			
		||||
the "license" property of files named "feature.properties". Such Abouts,\n\
 | 
			
		||||
Feature Licenses and Feature Update Licenses contain the terms and\n\
 | 
			
		||||
conditions (or references to such terms and conditions) that govern your\n\
 | 
			
		||||
use of the associated Content in that directory.\n\
 | 
			
		||||
\n\
 | 
			
		||||
THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
 | 
			
		||||
TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
 | 
			
		||||
SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
 | 
			
		||||
\n\
 | 
			
		||||
    - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
 | 
			
		||||
    - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
 | 
			
		||||
    - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
 | 
			
		||||
    - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
 | 
			
		||||
    - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
 | 
			
		||||
    - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
 | 
			
		||||
\n\
 | 
			
		||||
IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
 | 
			
		||||
TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
 | 
			
		||||
is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
 | 
			
		||||
govern that particular Content.\n\
 | 
			
		||||
\n\
 | 
			
		||||
Cryptography\n\
 | 
			
		||||
\n\
 | 
			
		||||
Content may contain encryption software. The country in which you are\n\
 | 
			
		||||
currently may have restrictions on the import, possession, and use,\n\
 | 
			
		||||
and/or re-export to another country, of encryption software. BEFORE\n\
 | 
			
		||||
using any encryption software, please check the country's laws,\n\
 | 
			
		||||
regulations and policies concerning the import, possession, or use,\n\
 | 
			
		||||
and re-export of encryption software, to see if this is permitted.\n\
 | 
			
		||||
\n\
 | 
			
		||||
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
 | 
			
		||||
							
								
								
									
										73
									
								
								com.minres.scviewer.feature/feature.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,73 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<feature
 | 
			
		||||
      id="com.minres.scviewer.feature"
 | 
			
		||||
      label="%featureName"
 | 
			
		||||
      version="1.0.0.qualifier"
 | 
			
		||||
      provider-name="%providerName">
 | 
			
		||||
 | 
			
		||||
   <description>
 | 
			
		||||
      A viewer for SystemC Verification Library transactions. It supports
 | 
			
		||||
a SQLite based recording as well as the built-in text base recording.
 | 
			
		||||
   </description>
 | 
			
		||||
 | 
			
		||||
   <copyright>
 | 
			
		||||
      Copyright (c) 2015 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
 | 
			
		||||
   </copyright>
 | 
			
		||||
 | 
			
		||||
   <license url="%licenseURL">
 | 
			
		||||
      %license
 | 
			
		||||
   </license>
 | 
			
		||||
 | 
			
		||||
   <url>
 | 
			
		||||
      <update label="%updateSiteName" url="http://www.minres.com/scviewer/update"/>
 | 
			
		||||
      <discovery label="MINRES Website" url="http://www.minres.com"/>
 | 
			
		||||
   </url>
 | 
			
		||||
 | 
			
		||||
   <requires>
 | 
			
		||||
      <import plugin="org.codehaus.groovy" version="1.8.6" match="greaterOrEqual"/>
 | 
			
		||||
      <import plugin="org.eclipse.equinox.util" version="1.0.500" match="greaterOrEqual"/>
 | 
			
		||||
      <import plugin="org.eclipse.equinox.ds" version="1.4.200" match="greaterOrEqual"/>
 | 
			
		||||
      <import plugin="org.eclipse.osgi.services" version="3.4.0" match="greaterOrEqual"/>
 | 
			
		||||
      <import plugin="org.eclipse.osgi"/>
 | 
			
		||||
      <import plugin="org.eclipse.core.runtime"/>
 | 
			
		||||
      <import plugin="org.eclipse.core.resources"/>
 | 
			
		||||
      <import plugin="org.eclipse.jface.text"/>
 | 
			
		||||
      <import plugin="org.eclipse.ui"/>
 | 
			
		||||
      <import plugin="org.eclipse.ui.editors"/>
 | 
			
		||||
      <import plugin="org.eclipse.ui.ide"/>
 | 
			
		||||
      <import plugin="org.eclipse.ui.views.properties.tabbed"/>
 | 
			
		||||
      <import plugin="org.eclipse.swt"/>
 | 
			
		||||
      <import plugin="org.eclipse.ui.views"/>
 | 
			
		||||
      <import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
 | 
			
		||||
   </requires>
 | 
			
		||||
 | 
			
		||||
   <plugin
 | 
			
		||||
         id="com.minres.scviewer.database"
 | 
			
		||||
         download-size="0"
 | 
			
		||||
         install-size="0"
 | 
			
		||||
         version="0.0.0"
 | 
			
		||||
         unpack="false"/>
 | 
			
		||||
 | 
			
		||||
   <plugin
 | 
			
		||||
         id="com.minres.scviewer.database.text"
 | 
			
		||||
         download-size="0"
 | 
			
		||||
         install-size="0"
 | 
			
		||||
         version="0.0.0"
 | 
			
		||||
         unpack="false"/>
 | 
			
		||||
 | 
			
		||||
   <plugin
 | 
			
		||||
         id="com.minres.scviewer.ui"
 | 
			
		||||
         download-size="0"
 | 
			
		||||
         install-size="0"
 | 
			
		||||
         version="0.0.0"
 | 
			
		||||
         unpack="false"/>
 | 
			
		||||
 | 
			
		||||
   <plugin
 | 
			
		||||
         id="com.minres.scviewer.database.sqlite"
 | 
			
		||||
         download-size="0"
 | 
			
		||||
         install-size="0"
 | 
			
		||||
         version="0.0.0"
 | 
			
		||||
         unpack="false"/>
 | 
			
		||||
 | 
			
		||||
</feature>
 | 
			
		||||
@@ -1,8 +1,9 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<classpath>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
 | 
			
		||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
			
		||||
	<classpathentry kind="src" path="src"/>
 | 
			
		||||
	<classpathentry kind="lib" path="swing2swt.jar"/>
 | 
			
		||||
	<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
 | 
			
		||||
	<classpathentry kind="output" path="bin"/>
 | 
			
		||||
</classpath>
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<projectDescription>
 | 
			
		||||
	<name>com.itjw.txviewer.ui</name>
 | 
			
		||||
	<name>com.minres.scviewer.ui</name>
 | 
			
		||||
	<comment></comment>
 | 
			
		||||
	<projects>
 | 
			
		||||
	</projects>
 | 
			
		||||
@@ -20,6 +20,11 @@
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
		<buildCommand>
 | 
			
		||||
			<name>org.eclipse.pde.ds.core.builder</name>
 | 
			
		||||
			<arguments>
 | 
			
		||||
			</arguments>
 | 
			
		||||
		</buildCommand>
 | 
			
		||||
	</buildSpec>
 | 
			
		||||
	<natures>
 | 
			
		||||
		<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
eclipse.preferences.version=1
 | 
			
		||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
			
		||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 | 
			
		||||
org.eclipse.jdt.core.compiler.compliance=1.7
 | 
			
		||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
			
		||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
			
		||||
org.eclipse.jdt.core.compiler.source=1.7
 | 
			
		||||
@@ -1,23 +1,23 @@
 | 
			
		||||
Manifest-Version: 1.0
 | 
			
		||||
Bundle-ManifestVersion: 2
 | 
			
		||||
Bundle-Name: Graph
 | 
			
		||||
Bundle-SymbolicName: com.itjw.txviewer.ui;singleton:=true
 | 
			
		||||
Bundle-SymbolicName: com.minres.scviewer.ui;singleton:=true
 | 
			
		||||
Bundle-Version: 1.0.0.qualifier
 | 
			
		||||
Bundle-Activator: com.itjw.txviewer.ui.TxEditorPlugin
 | 
			
		||||
Bundle-Activator: com.minres.scviewer.ui.TxEditorPlugin
 | 
			
		||||
Bundle-Vendor: ITJW
 | 
			
		||||
Require-Bundle: org.eclipse.ui,
 | 
			
		||||
 org.eclipse.core.runtime,
 | 
			
		||||
 org.eclipse.jface.text,
 | 
			
		||||
Require-Bundle: org.eclipse.core.runtime,
 | 
			
		||||
 org.eclipse.core.resources,
 | 
			
		||||
 org.eclipse.jface.text,
 | 
			
		||||
 org.eclipse.ui,
 | 
			
		||||
 org.eclipse.ui.editors,
 | 
			
		||||
 org.eclipse.ui.ide,
 | 
			
		||||
 org.eclipse.gef,
 | 
			
		||||
 org.eclipse.ui.views.properties.tabbed,
 | 
			
		||||
 org.eclipse.swt,
 | 
			
		||||
 org.eclipse.osgi
 | 
			
		||||
 org.eclipse.osgi,
 | 
			
		||||
 com.minres.scviewer.database;bundle-version="1.0.0"
 | 
			
		||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 | 
			
		||||
Bundle-ActivationPolicy: lazy
 | 
			
		||||
Import-Package: com.itjw.txviewer.database,
 | 
			
		||||
 org.eclipse.ui.views.contentoutline
 | 
			
		||||
Import-Package: org.eclipse.ui.views.contentoutline
 | 
			
		||||
Bundle-ClassPath: .,
 | 
			
		||||
 swing2swt.jar
 | 
			
		||||
Service-Component: OSGI-INF/component.xml
 | 
			
		||||
							
								
								
									
										5
									
								
								com.minres.scviewer.ui/OSGI-INF/component.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,5 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.minres.scviewer.ui">
 | 
			
		||||
   <implementation class="com.minres.scviewer.ui.TxEditorPlugin"/>
 | 
			
		||||
   <reference bind="setTransactionDbFactory" cardinality="0..n" interface="com.minres.scviewer.database.ITransactionDbFactory" name="ITransactionDbFactory" policy="dynamic" unbind="unsetTransactionDbFactory"/>
 | 
			
		||||
</scr:component>
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
source.. = src/
 | 
			
		||||
output.. = bin/
 | 
			
		||||
bin.includes = plugin.xml,\
 | 
			
		||||
               META-INF/,\
 | 
			
		||||
@@ -6,4 +5,6 @@ bin.includes = plugin.xml,\
 | 
			
		||||
               icons/,\
 | 
			
		||||
               contexts.xml,\
 | 
			
		||||
               res/,\
 | 
			
		||||
               swing2swt.jar
 | 
			
		||||
               swing2swt.jar,\
 | 
			
		||||
               OSGI-INF/
 | 
			
		||||
source.. = src/
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 983 B After Width: | Height: | Size: 983 B  | 
@@ -6,7 +6,7 @@
 | 
			
		||||
         point="org.eclipse.ui.views">
 | 
			
		||||
      <category
 | 
			
		||||
            name="TxViewer"
 | 
			
		||||
            id="com.itjw.txviewer.ui">
 | 
			
		||||
            id="com.minres.scviewer.ui">
 | 
			
		||||
      </category>
 | 
			
		||||
   </extension>
 | 
			
		||||
   <extension
 | 
			
		||||
@@ -18,18 +18,18 @@
 | 
			
		||||
   <extension
 | 
			
		||||
         point="org.eclipse.ui.editors">
 | 
			
		||||
      <editor
 | 
			
		||||
            class="com.itjw.txviewer.ui.TxEditorPart"
 | 
			
		||||
            contributorClass="com.itjw.txviewer.ui.TxEditorActionBarContributor"
 | 
			
		||||
            class="com.minres.scviewer.ui.TxEditorPart"
 | 
			
		||||
            contributorClass="com.minres.scviewer.ui.TxEditorActionBarContributor"
 | 
			
		||||
            extensions="txdb"
 | 
			
		||||
            icon="icons/sample.gif"
 | 
			
		||||
            id="com.itjw.txviewer.ui.TxEditorPart"
 | 
			
		||||
            id="com.minres.scviewer.ui.TxEditorPart"
 | 
			
		||||
            name="Wave Viewer">
 | 
			
		||||
      </editor>
 | 
			
		||||
   </extension>
 | 
			
		||||
   <extension
 | 
			
		||||
         point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
 | 
			
		||||
      <propertyContributor
 | 
			
		||||
            contributorId="com.itjw.txviewer.ui.TxEditorPart">
 | 
			
		||||
            contributorId="com.minres.scviewer.ui.TxEditorPart">
 | 
			
		||||
         <propertyCategory
 | 
			
		||||
               category="Transaction"></propertyCategory>
 | 
			
		||||
      </propertyContributor>
 | 
			
		||||
@@ -37,22 +37,22 @@
 | 
			
		||||
   <extension
 | 
			
		||||
         point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
 | 
			
		||||
      <propertyTabs
 | 
			
		||||
            contributorId="com.itjw.txviewer.ui.TxEditorPart">
 | 
			
		||||
            contributorId="com.minres.scviewer.ui.TxEditorPart">
 | 
			
		||||
         <propertyTab
 | 
			
		||||
               category="Transaction"
 | 
			
		||||
               id="com.itjw.txviewer.ui.propertyTabTransaction"
 | 
			
		||||
               id="com.minres.scviewer.ui.propertyTabTransaction"
 | 
			
		||||
               label="Transaction">
 | 
			
		||||
         </propertyTab>
 | 
			
		||||
         <propertyTab
 | 
			
		||||
               afterTab="com.itjw.txviewer.ui.propertyTabTransaction"
 | 
			
		||||
               afterTab="com.minres.scviewer.ui.propertyTabTransaction"
 | 
			
		||||
               category="Transaction"
 | 
			
		||||
               id="com.itjw.txviewer.ui.propertyTabAttributes"
 | 
			
		||||
               id="com.minres.scviewer.ui.propertyTabAttributes"
 | 
			
		||||
               label="Attributes">
 | 
			
		||||
         </propertyTab>
 | 
			
		||||
         <propertyTab
 | 
			
		||||
               afterTab="com.itjw.txviewer.ui.propertyTabAttributes"
 | 
			
		||||
               afterTab="com.minres.scviewer.ui.propertyTabAttributes"
 | 
			
		||||
               category="Transaction"
 | 
			
		||||
               id="com.itjw.txviewer.ui.propertyTabRelated"
 | 
			
		||||
               id="com.minres.scviewer.ui.propertyTabRelated"
 | 
			
		||||
               label="Related Tx">
 | 
			
		||||
         </propertyTab>
 | 
			
		||||
      </propertyTabs>
 | 
			
		||||
@@ -60,31 +60,31 @@
 | 
			
		||||
   <extension
 | 
			
		||||
         point="org.eclipse.ui.views.properties.tabbed.propertySections">
 | 
			
		||||
      <propertySections
 | 
			
		||||
            contributorId="com.itjw.txviewer.ui.TxEditorPart">
 | 
			
		||||
            contributorId="com.minres.scviewer.ui.TxEditorPart">
 | 
			
		||||
         <propertySection
 | 
			
		||||
               class="org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection"
 | 
			
		||||
               id="com.itjw.txviewer.ui.propertySectionAll"
 | 
			
		||||
               tab="com.itjw.txviewer.ui.propertyTabTransaction">
 | 
			
		||||
               id="com.minres.scviewer.ui.propertySectionAll"
 | 
			
		||||
               tab="com.minres.scviewer.ui.propertyTabTransaction">
 | 
			
		||||
            <input
 | 
			
		||||
                  type="com.itjw.txviewer.database.ITransaction">
 | 
			
		||||
                  type="com.minres.scviewer.database.ITransaction">
 | 
			
		||||
            </input>
 | 
			
		||||
         </propertySection>
 | 
			
		||||
         <propertySection
 | 
			
		||||
               afterSection="com.itjw.txviewer.ui.propertySectionAll"
 | 
			
		||||
               class="com.itjw.txviewer.ui.views.sections.AttributeProperty"
 | 
			
		||||
               id="com.itjw.txviewer.ui.propertySectionAttributes"
 | 
			
		||||
               tab="com.itjw.txviewer.ui.propertyTabAttributes">
 | 
			
		||||
               afterSection="com.minres.scviewer.ui.propertySectionAll"
 | 
			
		||||
               class="com.minres.scviewer.ui.views.sections.AttributeProperty"
 | 
			
		||||
               id="com.minres.scviewer.ui.propertySectionAttributes"
 | 
			
		||||
               tab="com.minres.scviewer.ui.propertyTabAttributes">
 | 
			
		||||
            <input
 | 
			
		||||
                  type="com.itjw.txviewer.database.ITransaction">
 | 
			
		||||
                  type="com.minres.scviewer.database.ITransaction">
 | 
			
		||||
            </input>
 | 
			
		||||
         </propertySection>
 | 
			
		||||
         <propertySection
 | 
			
		||||
               afterSection="com.itjw.txviewer.ui.propertySectionAttributes"
 | 
			
		||||
               class="com.itjw.txviewer.ui.views.sections.RelatedProperty"
 | 
			
		||||
               id="com.itjw.txviewer.ui.propertySectionRelated"
 | 
			
		||||
               tab="com.itjw.txviewer.ui.propertyTabRelated">
 | 
			
		||||
               afterSection="com.minres.scviewer.ui.propertySectionAttributes"
 | 
			
		||||
               class="com.minres.scviewer.ui.views.sections.RelatedProperty"
 | 
			
		||||
               id="com.minres.scviewer.ui.propertySectionRelated"
 | 
			
		||||
               tab="com.minres.scviewer.ui.propertyTabRelated">
 | 
			
		||||
            <input
 | 
			
		||||
                  type="com.itjw.txviewer.database.ITransaction">
 | 
			
		||||
                  type="com.minres.scviewer.database.ITransaction">
 | 
			
		||||
            </input>
 | 
			
		||||
         </propertySection>
 | 
			
		||||
      </propertySections>
 | 
			
		||||
@@ -92,8 +92,8 @@
 | 
			
		||||
   <extension
 | 
			
		||||
         point="org.eclipse.core.runtime.adapters">
 | 
			
		||||
      <factory
 | 
			
		||||
            adaptableType="com.itjw.txviewer.database.ITransaction"
 | 
			
		||||
            class="com.itjw.txviewer.ui.adapter.AdapterFactory">
 | 
			
		||||
            adaptableType="com.minres.scviewer.database.ITransaction"
 | 
			
		||||
            class="com.minres.scviewer.ui.adapter.AdapterFactory">
 | 
			
		||||
         <adapter
 | 
			
		||||
               type="org.eclipse.ui.views.properties.IPropertySource">
 | 
			
		||||
         </adapter>
 | 
			
		||||
@@ -102,8 +102,8 @@
 | 
			
		||||
   <extension
 | 
			
		||||
         point="org.eclipse.ui.elementFactories">
 | 
			
		||||
      <factory
 | 
			
		||||
            class="com.itjw.txviewer.ui.TxEditorInputFactory"
 | 
			
		||||
            id="com.itjw.txviewer.ui.TxEditorInputFactory">
 | 
			
		||||
            class="com.minres.scviewer.ui.TxEditorInputFactory"
 | 
			
		||||
            id="com.minres.scviewer.ui.TxEditorInputFactory">
 | 
			
		||||
      </factory>
 | 
			
		||||
   </extension>
 | 
			
		||||
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 390 B  | 
| 
		 Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B  | 
| 
		 Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 444 B  | 
@@ -1,4 +1,4 @@
 | 
			
		||||
package com.itjw.txviewer.ui;
 | 
			
		||||
package com.minres.scviewer.ui;
 | 
			
		||||
 | 
			
		||||
import org.eclipse.ui.part.EditorActionBarContributor;
 | 
			
		||||
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
package com.itjw.txviewer.ui;
 | 
			
		||||
package com.minres.scviewer.ui;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.eclipse.core.resources.IFile;
 | 
			
		||||
@@ -1,13 +1,10 @@
 | 
			
		||||
package com.itjw.txviewer.ui;
 | 
			
		||||
package com.minres.scviewer.ui;
 | 
			
		||||
 | 
			
		||||
import java.io.ByteArrayInputStream;
 | 
			
		||||
import java.io.ByteArrayOutputStream;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.ObjectInputStream;
 | 
			
		||||
import java.io.ObjectOutputStream;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.eclipse.core.resources.IFile;
 | 
			
		||||
@@ -23,7 +20,7 @@ public class TxEditorInputFactory implements IElementFactory {
 | 
			
		||||
     * Factory id. The workbench plug-in registers a factory by this name
 | 
			
		||||
     * with the "org.eclipse.ui.elementFactories" extension point.
 | 
			
		||||
     */
 | 
			
		||||
    private static final String ID_FACTORY = "com.itjw.txviewer.ui.TxEditorInputFactory"; //$NON-NLS-1$
 | 
			
		||||
    private static final String ID_FACTORY = "com.minres.scviewer.ui.TxEditorInputFactory"; //$NON-NLS-1$
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Tag for the IFile.fullPath of the file resource.
 | 
			
		||||
@@ -8,23 +8,24 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.ui;
 | 
			
		||||
package com.minres.scviewer.ui;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.eclipse.core.resources.IFile;
 | 
			
		||||
import org.eclipse.core.runtime.IPath;
 | 
			
		||||
import org.eclipse.core.runtime.IProgressMonitor;
 | 
			
		||||
import org.eclipse.jface.action.Action;
 | 
			
		||||
import org.eclipse.jface.dialogs.MessageDialog;
 | 
			
		||||
import org.eclipse.jface.viewers.ISelection;
 | 
			
		||||
import org.eclipse.swt.widgets.Composite;
 | 
			
		||||
import org.eclipse.swt.widgets.Event;
 | 
			
		||||
import org.eclipse.ui.IActionBars;
 | 
			
		||||
import org.eclipse.ui.IEditorInput;
 | 
			
		||||
import org.eclipse.ui.IEditorSite;
 | 
			
		||||
import org.eclipse.ui.IFileEditorInput;
 | 
			
		||||
import org.eclipse.ui.PartInitException;
 | 
			
		||||
import org.eclipse.ui.PlatformUI;
 | 
			
		||||
import org.eclipse.ui.ide.FileStoreEditorInput;
 | 
			
		||||
import org.eclipse.ui.internal.ide.dialogs.IFileStoreFilter;
 | 
			
		||||
import org.eclipse.ui.part.EditorPart;
 | 
			
		||||
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
 | 
			
		||||
import org.eclipse.ui.views.properties.IPropertySheetPage;
 | 
			
		||||
@@ -32,19 +33,20 @@ import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributo
 | 
			
		||||
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
 | 
			
		||||
import org.osgi.framework.BundleContext;
 | 
			
		||||
import org.osgi.framework.FrameworkUtil;
 | 
			
		||||
import org.osgi.framework.InvalidSyntaxException;
 | 
			
		||||
import org.osgi.framework.ServiceReference;
 | 
			
		||||
 | 
			
		||||
import com.itjw.txviewer.database.ITrDb;
 | 
			
		||||
import com.itjw.txviewer.database.ITrStream;
 | 
			
		||||
import com.itjw.txviewer.database.ITransactionDbFactory;
 | 
			
		||||
import com.itjw.txviewer.ui.swt.TxDisplay;
 | 
			
		||||
import com.itjw.txviewer.ui.views.TxOutlinePage;
 | 
			
		||||
import com.minres.scviewer.database.ITrDb;
 | 
			
		||||
import com.minres.scviewer.database.ITrStream;
 | 
			
		||||
import com.minres.scviewer.database.ITransactionDbFactory;
 | 
			
		||||
import com.minres.scviewer.ui.swt.TxDisplay;
 | 
			
		||||
import com.minres.scviewer.ui.views.TxOutlinePage;
 | 
			
		||||
 | 
			
		||||
public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPageContributor {
 | 
			
		||||
 | 
			
		||||
	public static final String ID = "com.itjw.txviewer.ui.TxEditorPart"; //$NON-NLS-1$
 | 
			
		||||
	public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
 | 
			
		||||
 | 
			
		||||
	public static final String WAVE_ACTION_ID = "com.itjw.txviewer.ui.action.AddToWave";
 | 
			
		||||
	public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave";
 | 
			
		||||
 | 
			
		||||
	private TxDisplay txDisplay;
 | 
			
		||||
	
 | 
			
		||||
@@ -64,22 +66,23 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
 | 
			
		||||
	public void createPartControl(Composite parent) {
 | 
			
		||||
		myParent=parent;
 | 
			
		||||
		/** Add handlers for global actions (delete, etc) */
 | 
			
		||||
		IActionBars actionBars = getEditorSite().getActionBars();
 | 
			
		||||
		actionBars.setGlobalActionHandler(WAVE_ACTION_ID,	new Action() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void runWithEvent(Event event) {
 | 
			
		||||
				System.out.println("AddToWave with event");
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			@Override
 | 
			
		||||
			public void run() {
 | 
			
		||||
				System.out.println("AddToWave");
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
//		IActionBars actionBars = getEditorSite().getActionBars();
 | 
			
		||||
//		actionBars.setGlobalActionHandler(WAVE_ACTION_ID,	new Action() {
 | 
			
		||||
//			@Override
 | 
			
		||||
//			public void runWithEvent(Event event) {
 | 
			
		||||
//				System.out.println("AddToWave with event");
 | 
			
		||||
//			}
 | 
			
		||||
//			
 | 
			
		||||
//			@Override
 | 
			
		||||
//			public void run() {
 | 
			
		||||
//				System.out.println("AddToWave");
 | 
			
		||||
//			}
 | 
			
		||||
//		});
 | 
			
		||||
		
 | 
			
		||||
		txDisplay = new TxDisplay(parent);
 | 
			
		||||
		if(database!=null) database.addPropertyChangeListener(txDisplay); 
 | 
			
		||||
		getSite().setSelectionProvider(txDisplay);
 | 
			
		||||
		if(getEditorInput()!=null && ((TxEditorInput) getEditorInput()).getStreamNames().size()>0){
 | 
			
		||||
		if(getEditorInput()!=null && ((TxEditorInput) getEditorInput()).getStreamNames().size()>0 && database!=null){
 | 
			
		||||
			if(MessageDialog.openConfirm(parent.getShell(), "Confirm", "Do you want the restore last state of the wave form?"))
 | 
			
		||||
				for(String streamName:((TxEditorInput) getEditorInput()).getStreamNames()){
 | 
			
		||||
					ITrStream stream = database.getStreamByName(streamName);
 | 
			
		||||
@@ -101,17 +104,18 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
 | 
			
		||||
			if(!(input instanceof TxEditorInput))
 | 
			
		||||
				super.setInput(new TxEditorInput(((IFileEditorInput)input).getFile()));
 | 
			
		||||
			try {
 | 
			
		||||
				IFile file = ((IFileEditorInput) input).getFile();
 | 
			
		||||
				getTrDatabase();
 | 
			
		||||
				database.load(file.getContents());
 | 
			
		||||
				IPath location = ((IFileEditorInput) input).getFile().getLocation();
 | 
			
		||||
				if (location != null)
 | 
			
		||||
					getTrDatabase(location.toFile());
 | 
			
		||||
				setPartName(((IFileEditorInput) input).getFile().getName());
 | 
			
		||||
			} catch (Exception e) {
 | 
			
		||||
				handleLoadException(e);
 | 
			
		||||
			}
 | 
			
		||||
		} else if(input instanceof FileStoreEditorInput){
 | 
			
		||||
			try {
 | 
			
		||||
				getTrDatabase();
 | 
			
		||||
				database.load(((FileStoreEditorInput) input).getURI().toURL().openStream());
 | 
			
		||||
				//database.load(((FileStoreEditorInput) input).getURI().toURL().openStream());
 | 
			
		||||
				File file=new File(((FileStoreEditorInput) input).getURI().getPath());
 | 
			
		||||
				getTrDatabase(file);
 | 
			
		||||
				setPartName(((FileStoreEditorInput) input).getName());
 | 
			
		||||
			} catch (Exception e) {
 | 
			
		||||
				handleLoadException(e);
 | 
			
		||||
@@ -119,16 +123,37 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected void getTrDatabase() {
 | 
			
		||||
		BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
 | 
			
		||||
		ServiceReference<?> serviceReference = context.getServiceReference(ITransactionDbFactory.class.getName());
 | 
			
		||||
		database = ((ITransactionDbFactory) context.getService(serviceReference)).createDatabase();
 | 
			
		||||
		if(txDisplay !=null) database.addPropertyChangeListener(txDisplay);
 | 
			
		||||
	protected void getTrDatabase(File file) {
 | 
			
		||||
		try {
 | 
			
		||||
			BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
 | 
			
		||||
			ServiceReference<?>[] serviceReferences = context.getServiceReferences(ITransactionDbFactory.class.getName(), null);
 | 
			
		||||
			if(serviceReferences!=null){
 | 
			
		||||
				for(ServiceReference<?> serviceReference:serviceReferences){
 | 
			
		||||
					database = ((ITransactionDbFactory) context.getService(serviceReference)).createDatabase(file);
 | 
			
		||||
					if(database!=null){
 | 
			
		||||
						if(txDisplay !=null) database.addPropertyChangeListener(txDisplay);
 | 
			
		||||
						return;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		} catch (InvalidSyntaxException e) {
 | 
			
		||||
		}
 | 
			
		||||
		MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
 | 
			
		||||
				"Error loading database", "Could not find database loader implementation");
 | 
			
		||||
		database=null;
 | 
			
		||||
//		if(TxEditorPlugin.getDefault().getTransactionDbFactory()!=null){
 | 
			
		||||
//			database = TxEditorPlugin.getDefault().getTransactionDbFactory().createDatabase();
 | 
			
		||||
//			if(txDisplay !=null) database.addPropertyChangeListener(txDisplay);
 | 
			
		||||
//		} else {
 | 
			
		||||
//			MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
 | 
			
		||||
//					"Error loading database", "Could not find database loader implementation");
 | 
			
		||||
//			database=null;
 | 
			
		||||
//		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void handleLoadException(Exception e) {
 | 
			
		||||
		System.err.println("** Load failed. Using default model. **");
 | 
			
		||||
		e.printStackTrace();
 | 
			
		||||
		MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
 | 
			
		||||
				"Error loading database", e.getMessage());
 | 
			
		||||
		database = null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -8,20 +8,24 @@
 | 
			
		||||
 * Contributors:
 | 
			
		||||
 *     IT Just working - initial API and implementation
 | 
			
		||||
 *******************************************************************************/
 | 
			
		||||
package com.itjw.txviewer.ui;
 | 
			
		||||
package com.minres.scviewer.ui;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.MissingResourceException;
 | 
			
		||||
import java.util.ResourceBundle;
 | 
			
		||||
 | 
			
		||||
import org.eclipse.draw2d.ColorConstants;
 | 
			
		||||
import org.eclipse.jface.resource.ImageDescriptor;
 | 
			
		||||
import org.eclipse.swt.SWT;
 | 
			
		||||
import org.eclipse.swt.graphics.Color;
 | 
			
		||||
import org.eclipse.swt.graphics.Image;
 | 
			
		||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
 | 
			
		||||
import org.eclipse.wb.swt.SWTResourceManager;
 | 
			
		||||
import org.osgi.framework.BundleContext;
 | 
			
		||||
 | 
			
		||||
import com.minres.scviewer.database.ITransactionDbFactory;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The activator class controls the plug-in life cycle
 | 
			
		||||
 */
 | 
			
		||||
@@ -37,21 +41,19 @@ public class TxEditorPlugin extends AbstractUIPlugin {
 | 
			
		||||
	public static final int headerFgColor=7;
 | 
			
		||||
 | 
			
		||||
	// The plug-in ID
 | 
			
		||||
	public static final String PLUGIN_ID = "com.itjw.txviewer.ui"; //$NON-NLS-1$
 | 
			
		||||
	public static final String PLUGIN_ID = "com.minres.scviewer.ui"; //$NON-NLS-1$
 | 
			
		||||
 | 
			
		||||
	// The shared instance
 | 
			
		||||
	private static TxEditorPlugin plugin;
 | 
			
		||||
		
 | 
			
		||||
	private ResourceBundle resourceBundle;
 | 
			
		||||
	
 | 
			
		||||
	private TxEditorPart openedTxEditorPart;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * The constructor
 | 
			
		||||
	 */
 | 
			
		||||
	public TxEditorPlugin() {
 | 
			
		||||
		openedTxEditorPart=null;
 | 
			
		||||
	}
 | 
			
		||||
//	public TxEditorPlugin() {
 | 
			
		||||
//		openedTxEditorPart=null;
 | 
			
		||||
//	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
@@ -106,13 +108,13 @@ public class TxEditorPlugin extends AbstractUIPlugin {
 | 
			
		||||
	public Color getColor(int idx){
 | 
			
		||||
		switch (idx) {
 | 
			
		||||
		case lineColor:
 | 
			
		||||
			return ColorConstants.red;
 | 
			
		||||
			return SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
			
		||||
		case txBgColor:
 | 
			
		||||
			return ColorConstants.green;
 | 
			
		||||
			return SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
			
		||||
		case highliteLineColor:
 | 
			
		||||
			return ColorConstants.cyan;
 | 
			
		||||
			return SWTResourceManager.getColor(SWT.COLOR_CYAN);
 | 
			
		||||
		case txHighliteBgColor:
 | 
			
		||||
			return ColorConstants.darkGreen;
 | 
			
		||||
			return SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
 | 
			
		||||
		case trackBgLightColor:
 | 
			
		||||
			return SWTResourceManager.getColor(220, 220, 220);
 | 
			
		||||
		case trackBgDarkColor:
 | 
			
		||||
@@ -124,11 +126,28 @@ public class TxEditorPlugin extends AbstractUIPlugin {
 | 
			
		||||
		default:
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		return ColorConstants.black;
 | 
			
		||||
		return SWTResourceManager.getColor(SWT.COLOR_BLACK);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public ResourceBundle getResourceBundle() {
 | 
			
		||||
		return resourceBundle;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private ITransactionDbFactory transactionDbFactory;
 | 
			
		||||
	private List<ITransactionDbFactory> factories= new ArrayList<ITransactionDbFactory>();
 | 
			
		||||
	public ITransactionDbFactory getTransactionDbFactory() {
 | 
			
		||||
		return transactionDbFactory;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setTransactionDbFactory(ITransactionDbFactory transactionDbFactory) {
 | 
			
		||||
		factories.add( transactionDbFactory);
 | 
			
		||||
		System.out.println("Service bound");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void unsetTransactionDbFactory(ITransactionDbFactory transactionDbFactory) {
 | 
			
		||||
		factories.remove(transactionDbFactory);
 | 
			
		||||
		System.out.println("Service unbound");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||