]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.interop.mapping/src/org/simantics/interop/mapping/Mapper.java
Replace log4j with slf4j
[simantics/interop.git] / org.simantics.interop.mapping / src / org / simantics / interop / mapping / Mapper.java
index 60c5c4835862dd683b78c8ab1c4149b13ebd0200..063f8acdfc713379f547ab118f2c87a4e90767af 100644 (file)
@@ -26,6 +26,8 @@ import org.simantics.interop.mapping.data.ResourceIdentifiable;
 import org.simantics.ui.jobs.SessionGarbageCollectorJob;\r
 import org.simantics.utils.datastructures.MapList;\r
 import org.simantics.utils.datastructures.Pair;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * \r
@@ -33,7 +35,9 @@ import org.simantics.utils.datastructures.Pair;
  *\r
  */\r
 public class Mapper {\r
-       \r
+\r
+       private static final Logger LOGGER = LoggerFactory.getLogger(Mapper.class);\r
+\r
        public static final boolean USE_SPLIT_TRANSACTIONS = false; // Split transactions\r
        public static int OBJECTS_PER_TRANSACTION = 5000;           // number of objects handled per transaction (split mode) \r
        private static boolean SLEEP_BETWEEN_WRITES = false;        // sleep between transactions (split mode)     \r
@@ -319,7 +323,7 @@ public class Mapper {
        \r
        \r
        \r
-       private void applyGenerations(WriteGraph graph, Collection<GraphNode<Identifiable>> nodes, IProgressMonitor monitor) throws Exception {\r
+       protected void applyGenerations(WriteGraph graph, Collection<GraphNode<Identifiable>> nodes, IProgressMonitor monitor) throws Exception {\r
                \r
                int size = nodes.size();\r
                int count = 0;\r
@@ -369,7 +373,7 @@ public class Mapper {
                }\r
        }\r
        \r
-       private void applyConnections(WriteGraph g, Collection<GraphNode<Identifiable>> nodes, IProgressMonitor monitor) throws Exception {\r
+       protected void applyConnections(WriteGraph g, Collection<GraphNode<Identifiable>> nodes, IProgressMonitor monitor) throws Exception {\r
                int size = nodes.size();\r
                int count = 0;\r
                \r
@@ -397,7 +401,7 @@ public class Mapper {
        \r
 \r
        \r
-       private void initializeRules(Session session, VirtualGraph vg, final Resource model ) throws DatabaseException{\r
+       protected void initializeRules(Session session, VirtualGraph vg, final Resource model ) throws DatabaseException{\r
                session.syncRequest(new WriteRequest(vg) {\r
                        @Override\r
                        public void perform(WriteGraph g) throws DatabaseException {\r
@@ -409,7 +413,7 @@ public class Mapper {
                \r
        }\r
                \r
-       private void collect(ReadGraph g) throws DatabaseException {\r
+       protected void collect(ReadGraph g) throws DatabaseException {\r
                if (vg != null)\r
                        return;\r
                SessionGarbageCollection.gc(g, 0, -1);\r
@@ -417,7 +421,7 @@ public class Mapper {
        \r
        int collect = 0;\r
        \r
-       private void collect2(ReadGraph g) throws DatabaseException {\r
+       protected void collect2(ReadGraph g) throws DatabaseException {\r
                if (vg != null)\r
                        return;\r
                \r
@@ -429,7 +433,7 @@ public class Mapper {
                }\r
        }\r
        \r
-       private void applyModifications(Session session, final Collection<GraphNode<Identifiable>> nodes, final IProgressMonitor monitor) throws Exception {\r
+       protected void applyModifications(Session session, final Collection<GraphNode<Identifiable>> nodes, final IProgressMonitor monitor) throws Exception {\r
                \r
                \r
                \r
@@ -545,7 +549,7 @@ public class Mapper {
                });\r
        }\r
        \r
-       private void applyGenerations(Session session, VirtualGraph vg, Collection<GraphNode<Identifiable>> nodes, IProgressMonitor monitor) throws Exception {\r
+       protected void applyGenerations(Session session, VirtualGraph vg, Collection<GraphNode<Identifiable>> nodes, IProgressMonitor monitor) throws Exception {\r
                \r
                int size = nodes.size();\r
                int count = 0;\r
@@ -678,7 +682,7 @@ public class Mapper {
                }\r
        }\r
        \r
-       private void applyConnections(Session session, VirtualGraph vg, Collection<GraphNode<Identifiable>> nodes, IProgressMonitor monitor) throws Exception {\r
+       protected void applyConnections(Session session, VirtualGraph vg, Collection<GraphNode<Identifiable>> nodes, IProgressMonitor monitor) throws Exception {\r
                int size = nodes.size();\r
                int count = 0;\r
                \r
@@ -730,7 +734,7 @@ public class Mapper {
                });\r
        }\r
 \r
-       private void applyModifications(ReadGraph g, GraphNode<Identifiable> n, Pair<IdentificationRule, ModificationRule> modRule, Collection<GraphNode<Identifiable>> ruleModified) throws Exception {\r
+       protected void applyModifications(ReadGraph g, GraphNode<Identifiable> n, Pair<IdentificationRule, ModificationRule> modRule, Collection<GraphNode<Identifiable>> ruleModified) throws Exception {\r
                if (!n.isDisposed() && modRule.first.matches(g, n)) { // we have to check \r
                        Collection<GraphNode<Identifiable>> perRule = new ArrayList<GraphNode<Identifiable>>();\r
                        perRule.add(n);\r
@@ -738,13 +742,13 @@ public class Mapper {
                }\r
        }\r
        \r
-       private void applyConnections(WriteGraph g, GraphNode<Identifiable> node) throws Exception {\r
+       protected void applyConnections(WriteGraph g, GraphNode<Identifiable> node) throws Exception {\r
                for (Link<Identifiable> link : node.getLinks()) {\r
                        if (link.isMain()) {\r
                                \r
                                for (Pair<ConnectionIdentificationRule, ConnectionGenerationRule> r : connectionRules) {\r
                                        if (r.first.mathces(g, node, link.to(), link)) {\r
-                                               Logger.defaultLogInfo("Connecting " +  getName(g, node.getData()) + " to " + getName(g, link.to().getData()) + " " + link.getName() + "/"+link.getInverseName());\r
+                                               LOGGER.info("Connecting " +  getName(g, node.getData()) + " to " + getName(g, link.to().getData()) + " " + link.getName() + "/"+link.getInverseName());\r
                                                r.second.generate(g, node, link.to(), link);\r
                                                break;\r
                                        }\r