X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=inline;f=org.simantics.interop.mapping%2Fsrc%2Forg%2Fsimantics%2Finterop%2Fmapping%2FMapper.java;h=063f8acdfc713379f547ab118f2c87a4e90767af;hb=refs%2Fheads%2Fmaster;hp=60c5c4835862dd683b78c8ab1c4149b13ebd0200;hpb=ee84f0b8a58b513ef47968a83ad7ffadd931af55;p=simantics%2Finterop.git diff --git a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/Mapper.java b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/Mapper.java index 60c5c48..063f8ac 100644 --- a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/Mapper.java +++ b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/Mapper.java @@ -26,6 +26,8 @@ import org.simantics.interop.mapping.data.ResourceIdentifiable; import org.simantics.ui.jobs.SessionGarbageCollectorJob; import org.simantics.utils.datastructures.MapList; import org.simantics.utils.datastructures.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -33,7 +35,9 @@ import org.simantics.utils.datastructures.Pair; * */ public class Mapper { - + + private static final Logger LOGGER = LoggerFactory.getLogger(Mapper.class); + public static final boolean USE_SPLIT_TRANSACTIONS = false; // Split transactions public static int OBJECTS_PER_TRANSACTION = 5000; // number of objects handled per transaction (split mode) private static boolean SLEEP_BETWEEN_WRITES = false; // sleep between transactions (split mode) @@ -319,7 +323,7 @@ public class Mapper { - private void applyGenerations(WriteGraph graph, Collection> nodes, IProgressMonitor monitor) throws Exception { + protected void applyGenerations(WriteGraph graph, Collection> nodes, IProgressMonitor monitor) throws Exception { int size = nodes.size(); int count = 0; @@ -369,7 +373,7 @@ public class Mapper { } } - private void applyConnections(WriteGraph g, Collection> nodes, IProgressMonitor monitor) throws Exception { + protected void applyConnections(WriteGraph g, Collection> nodes, IProgressMonitor monitor) throws Exception { int size = nodes.size(); int count = 0; @@ -397,7 +401,7 @@ public class Mapper { - private void initializeRules(Session session, VirtualGraph vg, final Resource model ) throws DatabaseException{ + protected void initializeRules(Session session, VirtualGraph vg, final Resource model ) throws DatabaseException{ session.syncRequest(new WriteRequest(vg) { @Override public void perform(WriteGraph g) throws DatabaseException { @@ -409,7 +413,7 @@ public class Mapper { } - private void collect(ReadGraph g) throws DatabaseException { + protected void collect(ReadGraph g) throws DatabaseException { if (vg != null) return; SessionGarbageCollection.gc(g, 0, -1); @@ -417,7 +421,7 @@ public class Mapper { int collect = 0; - private void collect2(ReadGraph g) throws DatabaseException { + protected void collect2(ReadGraph g) throws DatabaseException { if (vg != null) return; @@ -429,7 +433,7 @@ public class Mapper { } } - private void applyModifications(Session session, final Collection> nodes, final IProgressMonitor monitor) throws Exception { + protected void applyModifications(Session session, final Collection> nodes, final IProgressMonitor monitor) throws Exception { @@ -545,7 +549,7 @@ public class Mapper { }); } - private void applyGenerations(Session session, VirtualGraph vg, Collection> nodes, IProgressMonitor monitor) throws Exception { + protected void applyGenerations(Session session, VirtualGraph vg, Collection> nodes, IProgressMonitor monitor) throws Exception { int size = nodes.size(); int count = 0; @@ -678,7 +682,7 @@ public class Mapper { } } - private void applyConnections(Session session, VirtualGraph vg, Collection> nodes, IProgressMonitor monitor) throws Exception { + protected void applyConnections(Session session, VirtualGraph vg, Collection> nodes, IProgressMonitor monitor) throws Exception { int size = nodes.size(); int count = 0; @@ -730,7 +734,7 @@ public class Mapper { }); } - private void applyModifications(ReadGraph g, GraphNode n, Pair modRule, Collection> ruleModified) throws Exception { + protected void applyModifications(ReadGraph g, GraphNode n, Pair modRule, Collection> ruleModified) throws Exception { if (!n.isDisposed() && modRule.first.matches(g, n)) { // we have to check Collection> perRule = new ArrayList>(); perRule.add(n); @@ -738,13 +742,13 @@ public class Mapper { } } - private void applyConnections(WriteGraph g, GraphNode node) throws Exception { + protected void applyConnections(WriteGraph g, GraphNode node) throws Exception { for (Link link : node.getLinks()) { if (link.isMain()) { for (Pair r : connectionRules) { if (r.first.mathces(g, node, link.to(), link)) { - Logger.defaultLogInfo("Connecting " + getName(g, node.getData()) + " to " + getName(g, link.to().getData()) + " " + link.getName() + "/"+link.getInverseName()); + LOGGER.info("Connecting " + getName(g, node.getData()) + " to " + getName(g, link.to().getData()) + " " + link.getName() + "/"+link.getInverseName()); r.second.generate(g, node, link.to(), link); break; }