From: Hannu Niemistö Date: Fri, 12 May 2017 07:20:15 +0000 (+0300) Subject: (refs #7216) Removed OldTransferableGraph1 and all referring code X-Git-Tag: v1.29.0~57^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=f5d579079d4a49913256d6fb907ed748f80b3312 (refs #7216) Removed OldTransferableGraph1 and all referring code Change-Id: Idde9dde36c06b5270730036ab7e435f38f59a5fd --- diff --git a/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF b/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF index f21b3e776..165a104ed 100644 --- a/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF @@ -9,6 +9,5 @@ Require-Bundle: org.simantics.graph;bundle-version="1.0.0";visibility:=reexport, gnu.trove3;bundle-version="3.0.3", org.simantics.layer0;bundle-version="1.0.0", org.slf4j.api;bundle-version="1.7.2" -Export-Package: org.simantics.graph.db, - org.simantics.graph.db.old +Export-Package: org.simantics.graph.db Bundle-Vendor: VTT Technical Research Centre of Finland diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldMissingDependencyException.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldMissingDependencyException.java deleted file mode 100644 index 7ca83f318..000000000 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldMissingDependencyException.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.simantics.graph.db.old; - -import java.util.Set; - -import org.simantics.db.exception.DatabaseException; - -public class OldMissingDependencyException extends DatabaseException { - - private static final long serialVersionUID = -1579450497603555931L; - - private final OldTransferableGraphImportProcess1 process; - - public OldMissingDependencyException(OldTransferableGraphImportProcess1 process) { - super(createMessage(process)); - this.process = process; - } - - private static String createMessage(OldTransferableGraphImportProcess1 process) { - StringBuilder b = new StringBuilder(); - b.append("The following references were not found:\r\n"); - for(String missing : process.missingExternals) { - b.append(" -" + missing + "\r\n"); - } - return b.toString(); - } - - public Set getMissingURIs() { - return process.missingExternals; - } - -} diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphImportProcess1.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphImportProcess1.java deleted file mode 100644 index 6a69e8d92..000000000 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphImportProcess1.java +++ /dev/null @@ -1,479 +0,0 @@ -package org.simantics.graph.db.old; - -import java.io.DataOutput; -import java.io.DataOutputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.simantics.databoard.Bindings; -import org.simantics.databoard.adapter.AdaptException; -import org.simantics.databoard.binding.mutable.Variant; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.VirtualGraph; -import org.simantics.db.WriteOnlyGraph; -import org.simantics.db.common.WriteBindings; -import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; -import org.simantics.db.common.uri.UnescapedChildMapOfResource; -import org.simantics.db.common.utils.Logger; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.exception.ResourceNotFoundException; -import org.simantics.db.service.ClusterBuilder; -import org.simantics.db.service.ClusterBuilder.ResourceHandle; -import org.simantics.db.service.SerialisationSupport; -import org.simantics.db.service.TransferableGraphSupport; -import org.simantics.graph.db.CoreInitialization; -import org.simantics.graph.db.IImportAdvisor; -import org.simantics.graph.representation.Extensions; -import org.simantics.graph.representation.External; -import org.simantics.graph.representation.Identity; -import org.simantics.graph.representation.IdentityDefinition; -import org.simantics.graph.representation.Internal; -import org.simantics.graph.representation.Optional; -import org.simantics.graph.representation.Root; -import org.simantics.graph.representation.TransferableGraphUtils; -import org.simantics.graph.representation.old.OldTransferableGraph1; -import org.simantics.graph.representation.old.OldValue1; - -public class OldTransferableGraphImportProcess1 { - - public static String LOG_FILE = "transferableGraphs.log"; - final static private boolean LOG = false; - - static DataOutput log; - - static { - - if (LOG) { - try { - FileOutputStream stream = new FileOutputStream(LOG_FILE); - log = new DataOutputStream(stream); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } - - } - - private static void log(String line) { - if (LOG) { - try { - log.writeUTF(line + "\n"); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - OldTransferableGraph1 tg; - IImportAdvisor advisor; - - Resource[] resources; - ResourceHandle[] handles; - - Set missingExternals = new HashSet(); - - // Builtins - Resource RootLibrary; - Resource String; - Resource Library; - - Resource InstanceOf; - Resource ConsistsOf; - Resource PartOf; - Resource HasName; - Resource NameOf; - - public OldTransferableGraphImportProcess1(OldTransferableGraph1 tg, IImportAdvisor advisor) { - this.tg = tg; - this.advisor = advisor; - /*System.out.println("Transferable graph identities:"); - for(Identity id : tg.identities) { - if(id.definition instanceof Internal) { - Internal def = (Internal)id.definition; - System.out.println(" internal " + def.name); - } - else if(id.definition instanceof External) { - External def = (External)id.definition; - System.out.println(" external " + def.name); - } - }*/ - } - - public void findBuiltins(WriteOnlyGraph g) throws DatabaseException { - RootLibrary = g.getBuiltin("http:/"); - String = g.getBuiltin(CoreInitialization.LAYER0 + "String"); - Library = g.getBuiltin(CoreInitialization.LAYER0 + "Library"); - InstanceOf = g.getBuiltin(CoreInitialization.LAYER0 + "InstanceOf"); - ConsistsOf = g.getBuiltin(CoreInitialization.LAYER0 + "ConsistsOf"); - PartOf = g.getBuiltin(CoreInitialization.LAYER0 + "PartOf"); - HasName = g.getBuiltin(CoreInitialization.LAYER0 + "HasName"); - NameOf = g.getBuiltin(CoreInitialization.LAYER0 + "NameOf"); - } - - public void findBuiltins(ReadGraph g) throws DatabaseException { - RootLibrary = g.getBuiltin("http:/"); - String = g.getBuiltin(CoreInitialization.LAYER0 + "String"); - Library = g.getBuiltin(CoreInitialization.LAYER0 + "Library"); - InstanceOf = g.getBuiltin(CoreInitialization.LAYER0 + "InstanceOf"); - ConsistsOf = g.getBuiltin(CoreInitialization.LAYER0 + "ConsistsOf"); - PartOf = g.getBuiltin(CoreInitialization.LAYER0 + "PartOf"); - HasName = g.getBuiltin(CoreInitialization.LAYER0 + "HasName"); - NameOf = g.getBuiltin(CoreInitialization.LAYER0 + "NameOf"); - } - - /* Preparation that is used when the core is empty. - */ - void initialPrepare(WriteOnlyGraph graph) throws DatabaseException { - findBuiltins(graph); - - resources = new Resource[tg.resourceCount]; - - int Root = -1; - int SimanticsDomain = -1; - int Layer0 = -1; - - for(Identity identity : tg.identities) { - if(identity.definition instanceof Internal) { - Internal def = (Internal)identity.definition; - Resource res = null; - if(def.parent == Layer0) { - try { - res = graph.getBuiltin(CoreInitialization.LAYER0 + def.name); - } catch(ResourceNotFoundException e) { - } - } - else if(def.parent == SimanticsDomain) { - if(def.name.equals("Layer0-1.1")) - Layer0 = identity.resource; - } - else if(def.parent == Root) { - if(def.name.equals("www.simantics.org")) - SimanticsDomain = identity.resource; - } - - if(res == null) - res = createChild(graph, resources[def.parent], def.name); - else - createChild(graph, res, resources[def.parent], def.name); - resources[identity.resource] = res; - } - else if(identity.definition instanceof Root) { - Root = identity.resource; - resources[identity.resource] = RootLibrary; - } - } - } - - void addMissing(String external) { - Set removals = new HashSet(); - for(String ext : missingExternals) if(ext.startsWith(external)) return; - for(String ext : missingExternals) if(external.startsWith(ext)) removals.add(ext); - missingExternals.removeAll(removals); - missingExternals.add(external); - } - - void prepare(ReadGraph graph) throws DatabaseException { - findBuiltins(graph); - - Resource[] resources = new Resource[tg.resourceCount]; - - for(Identity identity : tg.identities) { - IdentityDefinition definition = identity.definition; - if(definition instanceof External) { - External def = (External)definition; - if(def.parent == -1) { - resources[identity.resource] = RootLibrary; - } else { - if("@inverse".equals(def.name)) { - Resource parent = resources[def.parent]; - Resource child = graph.getInverse(parent); - resources[identity.resource] = child; - } else { - Resource parent = resources[def.parent]; - // TODO: escape should be removed when names become well-behaving - if(parent != null) { - Resource child = graph - .syncRequest(new UnescapedChildMapOfResource(parent), - new TransientCacheAsyncListener>()) - .get(def.name); - if(child == null) { - addMissing(graph.getURI(parent) + "/" + def.name); - } - resources[identity.resource] = child; - } else { - addMissing(TransferableGraphUtils.getURI(tg.resourceCount, tg.identities, def.parent) + "/" + def.name); - } - } - } - } - else if(definition instanceof Internal) { - // Do not do anything for now - } - else if(definition instanceof Root) { - Root root = (Root)definition; - if(root.name.equals("")) - resources[identity.resource] = RootLibrary; - else - advisor.analyzeRoot(graph, root); - } - else if(definition instanceof Optional) { - External def = (External)definition; - Resource parent = resources[def.parent]; - if(parent != null) - resources[identity.resource] = - graph.syncRequest(new UnescapedChildMapOfResource(parent)).get(def.name); - } - } - - this.resources = resources; - - if(!missingExternals.isEmpty()) throw new OldMissingDependencyException(this); - - } - - Resource createChild(WriteOnlyGraph graph, Resource parent, String name) throws DatabaseException { - Resource child = graph.newResource(); - graph.claim(parent, ConsistsOf, PartOf, child); - Resource nameResource = graph.newResource(); - graph.claim(nameResource, InstanceOf, null, String); - graph.claimValue(nameResource, name, WriteBindings.STRING); - graph.claim(child, HasName, NameOf, nameResource); - return child; - } - - void createChild(WriteOnlyGraph graph, Resource child, Resource parent, String name) throws DatabaseException { - graph.claim(parent, ConsistsOf, PartOf, child); - Resource nameResource = graph.newResource(); - graph.claim(nameResource, InstanceOf, null, String); - graph.claimValue(nameResource, name, WriteBindings.STRING); - graph.claim(child, HasName, NameOf, nameResource); - } - - int[] getClustering() { - Variant v = tg.extensions.get(Extensions.CLUSTERING); - if(v == null) return null; - try { - return (int[])v.getValue(Bindings.INT_ARRAY); - } catch (AdaptException e) { - Logger.defaultLogError(e); - return null; - } - } - - void write(WriteOnlyGraph graph) throws DatabaseException { - - Resource[] resources = this.resources; - - this.handles = new ResourceHandle[resources.length]; - - ResourceHandle[] handles = this.handles; - - int[] clustering = getClustering(); - - // Internal identities - for(Identity identity : tg.identities) { - IdentityDefinition definition = identity.definition; - if(resources[identity.resource] != null) - continue; - if(definition instanceof External) { - // Already done everything - } - else if(definition instanceof Internal) { - Internal def = (Internal)definition; - resources[identity.resource] = - createChild(graph, resources[def.parent], def.name); - } - else if(definition instanceof Root) { - Root root = (Root)definition; - resources[identity.resource] = advisor.createRoot(graph, root); - } - else if(definition instanceof Optional) { - Optional def = (Optional)definition; - Resource child = createChild(graph, resources[def.parent], def.name); - graph.claim(child, InstanceOf, null, Library); // ??? - resources[identity.resource] = child; - } - } - - ClusterBuilder builder = graph.getService(ClusterBuilder.class); - SerialisationSupport ss = graph.getService(SerialisationSupport.class); - - if(clustering != null) { - - int i = 0; - for(int c : clustering) { - builder.newCluster(); - for(int r=0;r= 0) { - - if(resources[obj] == null) { - ResourceHandle inverse = handles[inv]; - object.addStatement(graph, inverse, subject); - } else { - graph.claim( - handles[obj].resource(ss), - handles[inv].resource(ss), - null, handles[sub].resource(ss)); - } - - } - - if(LOG) { - log("[STATEMENT] " + resources[statements[i]].getResourceId() + ", " + resources[statements[i+1]].getResourceId() + ", " + resources[statements[i+3]].getResourceId()); - } - - } - - // Write values - TransferableGraphSupport tgSupport = - graph.getService(TransferableGraphSupport.class); - VirtualGraph vg = graph.getProvider(); - for(OldValue1 value : tg.values) { - int file = value.resource & 0x80000000; - int resource = value.resource & 0x7FFFFFFF; - if (file != 0) { - graph.claimValue(handles[resource].resource(ss), value.value, Bindings.BYTE_ARRAY); - } else { - if(resource < internals) { - handles[resource].addValue(graph, value.value); - } else { - tgSupport.setValue(graph, handles[resource].resource(ss), vg, value.value); - } - //tgSupport.setValue(resources[resource], vg, value.value); - } - } - } - - void write2(WriteOnlyGraph graph) throws DatabaseException { - Resource[] resources = this.resources; - - // Internal identities - for(Identity identity : tg.identities) { - IdentityDefinition definition = identity.definition; - if(resources[identity.resource] != null) - continue; - if(definition instanceof External) { - // Already done everything - } - else if(definition instanceof Internal) { - Internal def = (Internal)definition; - resources[identity.resource] = - createChild(graph, resources[def.parent], def.name); - } - else if(definition instanceof Root) { - Root root = (Root)definition; - resources[identity.resource] = advisor.createRoot(graph, root); - } - else if(definition instanceof Optional) { - Optional def = (Optional)definition; - Resource child = createChild(graph, resources[def.parent], def.name); - graph.claim(child, InstanceOf, null, Library); // ??? - resources[identity.resource] = child; - } - } - - // Create blank resources - for(int i=0;i callback) throws DatabaseException, TransferableGraphException { - final OldTransferableGraphImportProcess1 process = new OldTransferableGraphImportProcess1(tg, - advisor == null ? new ImportAdvisor() : advisor); - session.syncRequest(new ReadRequest() { - @Override - public void run(ReadGraph graph) throws DatabaseException { - process.prepare(graph); - } - }); - session.syncRequest(new WriteOnlyRequest() { - @Override - public void perform(WriteOnlyGraph graph) throws DatabaseException { - process.write(graph); - if(callback != null) - callback.apply(graph, process); - } - }); - } - - public static void importGraph1(WriteGraph graph, final OldTransferableGraph1 tg, IImportAdvisor advisor) throws DatabaseException { - final OldTransferableGraphImportProcess1 process = new OldTransferableGraphImportProcess1(tg, - advisor == null ? new ImportAdvisor() : advisor); - process.prepare(graph); - process.write2(graph); - - } - -} diff --git a/bundles/org.simantics.graph/META-INF/MANIFEST.MF b/bundles/org.simantics.graph/META-INF/MANIFEST.MF index d64e63f57..6ae6e86fe 100644 --- a/bundles/org.simantics.graph/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graph/META-INF/MANIFEST.MF @@ -12,7 +12,6 @@ Export-Package: org.simantics.graph, org.simantics.graph.query, org.simantics.graph.refactoring, org.simantics.graph.representation, - org.simantics.graph.representation.old, org.simantics.graph.store, org.simantics.graph.tests.conversion, org.simantics.graph.utils diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/query/TransferableGraphConversion.java b/bundles/org.simantics.graph/src/org/simantics/graph/query/TransferableGraphConversion.java index 850c47d85..9c96f834d 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/query/TransferableGraphConversion.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/query/TransferableGraphConversion.java @@ -15,7 +15,6 @@ import org.simantics.graph.representation.Optional; import org.simantics.graph.representation.Root; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.graph.representation.Value; -import org.simantics.graph.representation.old.OldTransferableGraph1; import org.simantics.graph.store.GraphStore; import org.simantics.graph.store.IStore; import org.simantics.graph.store.IdentityStore; @@ -44,10 +43,6 @@ public class TransferableGraphConversion { return extractIdentities(tg.resourceCount, tg.identities); } - public static IdentityStore extractIdentities(OldTransferableGraph1 tg) { - return extractIdentities(tg.resourceCount, tg.identities); - } - private static IdentityStore extractIdentities(int resourceCount, Identity[] ids) { IdentityStore identities = new IdentityStore(); identities.setResourceCount(resourceCount); diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java index ddc31aa5b..9f8eca398 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java @@ -1,6 +1,5 @@ package org.simantics.graph.refactoring; -import java.util.ArrayList; import java.util.Arrays; import org.simantics.databoard.util.URIStringUtils; @@ -11,14 +10,10 @@ import org.simantics.graph.query.UriUtils; import org.simantics.graph.refactoring.MappingSpecification.MappingRule; import org.simantics.graph.representation.External; import org.simantics.graph.representation.Identity; -import org.simantics.graph.representation.IdentityDefinition; import org.simantics.graph.representation.Internal; -import org.simantics.graph.representation.Optional; import org.simantics.graph.representation.Root; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.graph.representation.TransferableGraphUtils; -import org.simantics.graph.representation.old.OldTransferableGraph1; -import org.simantics.graph.representation.old.OldValue1; import org.simantics.graph.store.GraphStore; import org.simantics.graph.store.IdentityStore; import org.slf4j.Logger; @@ -159,69 +154,4 @@ public class GraphRefactoringUtils { } } - public static void compactify(OldTransferableGraph1 tg, - TIntHashSet removed) { - // Filter removed set - for(Identity id : tg.identities) { - IdentityDefinition def = id.definition; - if(def instanceof Root) - removed.remove(id.resource); - else if(def instanceof External) - removed.remove(((External)def).parent); - else if(def instanceof Internal) - removed.remove(((Internal)def).parent); - else if(def instanceof Optional) - removed.remove(((Optional)def).parent); - } - for(int r : tg.statements) - removed.remove(r); - for(OldValue1 value : tg.values) - removed.remove(value.resource); - - // Compactify - if(!removed.isEmpty()) { - // create map - int resourceCount = tg.resourceCount; - int[] map = new int[resourceCount]; - for(int i=0;i newIdentities = new ArrayList(tg.identities.length); - for(Identity id : tg.identities) { - if(removed.contains(id.resource)) - continue; - else - newIdentities.add(id); - id.resource = map[id.resource]; - IdentityDefinition def = id.definition; - if(def instanceof External) { - External d = (External)def; - d.parent = map[d.parent]; - } - else if(def instanceof Internal) { - External d = (External)def; - d.parent = map[d.parent]; - } - else if(def instanceof Optional) { - External d = (External)def; - d.parent = map[d.parent]; - } - } - tg.identities = newIdentities.toArray(new Identity[newIdentities.size()]); - int[] statements = tg.statements; - for(int i=0;i= 0) - statements[i] = map[r]; - } - for(OldValue1 value : tg.values) - value.resource = map[value.resource]; - tg.resourceCount = resourceCount; - } - } - } diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java deleted file mode 100644 index d98069227..000000000 --- a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.simantics.graph.refactoring; - -import gnu.trove.map.hash.THashMap; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; - -import org.simantics.databoard.Files; -import org.simantics.graph.query.TransferableGraphConversion; -import org.simantics.graph.representation.old.OldTransferableGraph1; -import org.simantics.graph.store.IdentityStore; -import org.simantics.graph.store.IdentityStore.ConsistsOf; - -public class PrintReferencesTool { - - public static void main(String[] args) throws Exception { - print(new File(args[0])); - } - - public static void print(File input) throws IOException { - OldTransferableGraph1 tg = (OldTransferableGraph1) - Files.readFile(input, OldTransferableGraph1.BINDING); - GraphRefactoringUtils.fixIncorrectRoot(tg.identities); - IdentityStore idStore = TransferableGraphConversion.extractIdentities(tg); - printExternals(idStore, idStore.getRoot(""), 0); - } - - private static void printExternals(IdentityStore idStore, int cur, int indentation) { - THashMap map = idStore.getChildMap(cur); - if(map == null) - return; - ArrayList names = new ArrayList(map.keySet()); - Collections.sort(names); - for(String name : names) { - ConsistsOf co = map.get(name); - if(!idStore.isNewResource(co.child)) { - for(int i=0;i rules = new ArrayList(); - while(true) { - String line = reader.readLine(); - if(line == null) - break; - line = line.trim(); - if(line.isEmpty()) - continue; - String[] parts = line.trim().split(" "); - if(parts.length != 2) - throw new IOException("Invalid mapping spec format. Every non-empty line should contain two URIs."); - - Path from = UriUtils.uriToPath(parts[0]); - Path to = UriUtils.uriToPath(parts[1]); - - rules.add(new MappingRule(from, to)); - } - reader.close(); - - return new MappingSpecification(rules); - } - -} diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/representation/old/OldTransferableGraph1.java b/bundles/org.simantics.graph/src/org/simantics/graph/representation/old/OldTransferableGraph1.java deleted file mode 100644 index b68bea31e..000000000 --- a/bundles/org.simantics.graph/src/org/simantics/graph/representation/old/OldTransferableGraph1.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * 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: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.graph.representation.old; - -import java.util.TreeMap; - -import org.simantics.databoard.Bindings; -import org.simantics.databoard.binding.Binding; -import org.simantics.databoard.binding.mutable.Variant; -import org.simantics.databoard.serialization.Serializer; -import org.simantics.graph.representation.External; -import org.simantics.graph.representation.Identity; -import org.simantics.graph.representation.Internal; -import org.simantics.graph.representation.Root; -import org.simantics.graph.tests.conversion.TransferableGraph0; - - -/** - * Transferable graph datatype. - * See specification. - * @author Hannu Niemist� - * - * @deprecated superceded by {@link TransferableGraph0} - */ -@Deprecated -public class OldTransferableGraph1 { - public static Binding BINDING = Bindings.getBindingUnchecked(OldTransferableGraph1.class); - public static Serializer SERIALIZER = Bindings.getSerializerUnchecked(BINDING); - - public int resourceCount; - public Identity[] identities; - public int[] statements; - public OldValue1[] values; - public TreeMap extensions; - - public OldTransferableGraph1() {} - - public OldTransferableGraph1(int resourceCount, Identity[] identities, - int[] statements, OldValue1[] values) { - this(resourceCount, identities, statements, values, - new TreeMap()); - } - - public OldTransferableGraph1(int resourceCount, Identity[] identities, - int[] statements, OldValue1[] values, TreeMap extensions) { - this.resourceCount = resourceCount; - this.identities = identities; - this.statements = statements; - this.values = values; - this.extensions = extensions; - } - - public void print() { - System.out.println("Identities"); - for(Identity id : identities) { - System.out.print(" " + id.resource + " = "); - if(id.definition instanceof Root) { - Root def = (Root)id.definition; - System.out.println("ROOT(" + def.name + ")"); - } - else if(id.definition instanceof External) { - External def = (External)id.definition; - System.out.println("EXTERNAL(" + def.parent + ", " + def.name + ")"); - } - else if(id.definition instanceof Internal) { - Internal def = (Internal)id.definition; - System.out.println("INTERNAL(" + def.parent + ", " + def.name + ")"); - } - } - System.out.println("Statements:"); - for(int i=0;i inputFiles = new ArrayList(); - List outputFiles = new ArrayList(); - String ext = ".aprosSymbol"; - File outDir = new File(dir,"out"); - if (!outDir.exists()) - outDir.mkdir(); - for (File f: allFiles) { - if (!f.isFile()) - continue; - if (!f.getName().endsWith(ext)) - continue; - inputFiles.add(f); - String outputName = f.getName(); - outputFiles.add(new File(outDir,outputName)); - } - - File mappingSpec = new File(dir, "mappingSpec.txt"); - for (int i = 0; i < inputFiles.size() ; i++) { - - File input = inputFiles.get(i); - File output = outputFiles.get(i); - - System.out.println(input + " -> " + output); - - RefactoringTool.refactor(mappingSpec, input, output); - } - } - -} diff --git a/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/mappingSpec.txt b/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/mappingSpec.txt deleted file mode 100644 index d85d332c2..000000000 --- a/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/mappingSpec.txt +++ /dev/null @@ -1,6 +0,0 @@ -http://www.apros.fi/AprosStatic-6.0 http://www.apros.fi/Combustion/Configuration-6.0 -http://www.apros.fi/AprosDiagram-6.0/Terminals http://www.apros.fi/Apros-6.1/Terminals -http://www.apros.fi/AprosDiagram-6.0/Relations http://www.apros.fi/Combustion/Diagram-6.0/Relations -http://www.apros.fi/AprosDiagram-6.0/Symbols http://www.apros.fi/Combustion/Diagram-6.0/Symbols -http://www.apros.fi/AprosDiagram-6.0/AnalogSignalOutputRelation http://www.apros.fi/Combustion/Diagram-6.0/AnalogSignalOutputRelation -http://www.apros.fi/AprosDiagram-6.0/BinarySignalOutputRelation http://www.apros.fi/Combustion/Diagram-6.0/BinarySignalOutputRelation \ No newline at end of file diff --git a/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/xor5.aprosSymbol b/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/xor5.aprosSymbol deleted file mode 100644 index d005eb22c..000000000 Binary files a/bundles/org.simantics.graph/tests/org/simantics/graph/tests/refactoring/xor5.aprosSymbol and /dev/null differ