]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Switched from log4j to slf4j to remove all log4j dependencies
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 18 Aug 2020 09:13:08 +0000 (12:13 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 18 Aug 2020 09:13:08 +0000 (12:13 +0300)
gitlab simantics/platform#579

Change-Id: I50a49d736b42dc5b351314a8ff122dd85c078f15

16 files changed:
bundles/org.simantics.objmap/META-INF/MANIFEST.MF
bundles/org.simantics.objmap/src/org/simantics/objmap/annotations/factories/UpdateMethodFactory.java
bundles/org.simantics.objmap/src/org/simantics/objmap/impl/Mapping.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementRule.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementsRule.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/ValueRule.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/MappingUtils.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedListElementsAccessor.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectAccessor.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectsAccessor.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedOrderedSetElementsAccessor.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java
bundles/org.simantics.objmap/src/org/simantics/objmap/rules/range/FieldAccessor.java
bundles/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java
bundles/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF
bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/Activator.java

index fb209ef6519ac569b03e18d1fe6cc5adf1758600..3549fa61583f3961b8662054cfa72c38924becd2 100644 (file)
@@ -5,7 +5,7 @@ Bundle-SymbolicName: org.simantics.objmap
 Bundle-Version: 0.1.0.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-11
 Require-Bundle: gnu.trove3;bundle-version="3.0.3",
- org.apache.log4j;bundle-version="1.2.15",
+ org.slf4j.api,
  org.simantics.layer0;bundle-version="1.0.0",
  org.simantics.db.common;bundle-version="1.1.0"
 Export-Package: org.simantics.objmap,
index 5cab576f46d88d68619322024179c16197ce3a4b..0a0b21911f46e2033d4939729015d1281756d46a 100644 (file)
@@ -14,7 +14,6 @@ package org.simantics.objmap.annotations.factories;
 import java.lang.annotation.Annotation;\r
 import java.lang.reflect.Method;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -23,10 +22,12 @@ import org.simantics.objmap.IFunction;
 import org.simantics.objmap.IMappingRule;\r
 import org.simantics.objmap.MappingException;\r
 import org.simantics.objmap.rules.factory.IMethodRuleFactory;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 public class UpdateMethodFactory implements IMethodRuleFactory {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
     @Override\r
     public IMappingRule create(ReadGraph g, \r
@@ -40,7 +41,7 @@ public class UpdateMethodFactory implements IMethodRuleFactory {
             public boolean updateRange(ReadGraph g, IFunction<Resource, Object> map,\r
                     Resource domainElement, Object rangeElement)\r
                     throws MappingException {\r
-                LOGGER.info("    UpdateMethodFactory.updateRange");      \r
+                LOGGER.trace("    UpdateMethodFactory.updateRange");      \r
                 try {\r
                     return (Boolean)method.invoke(rangeElement, g, domainElement);\r
                 } catch (Exception e) {\r
index 7db9a28d185e3551d4cf35dc7a823f123d7dffe0..2f1e9c514a65cd7053e11c5415d0f3ba7c6182e6 100644 (file)
  *******************************************************************************/\r
 package org.simantics.objmap.impl;\r
 \r
-import gnu.trove.map.hash.TCustomHashMap;\r
-import gnu.trove.map.hash.THashMap;\r
-import gnu.trove.strategy.IdentityHashingStrategy;\r
-\r
 import java.util.AbstractSet;\r
 import java.util.ArrayList;\r
 import java.util.Collection;\r
 import java.util.Iterator;\r
 import java.util.Set;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -32,6 +27,12 @@ import org.simantics.objmap.IMapping;
 import org.simantics.objmap.IMappingListener;\r
 import org.simantics.objmap.IMappingSchema;\r
 import org.simantics.objmap.MappingException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+import gnu.trove.map.hash.TCustomHashMap;\r
+import gnu.trove.map.hash.THashMap;\r
+import gnu.trove.strategy.IdentityHashingStrategy;\r
 \r
 /**\r
  * An implementation of IMapping. The class should not be created\r
@@ -41,7 +42,7 @@ import org.simantics.objmap.MappingException;
  */\r
 public class Mapping implements IMapping {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
        \r
        IMappingSchema schema;\r
        \r
@@ -69,7 +70,7 @@ public class Mapping implements IMapping {
        }\r
        \r
        private void createDomain(WriteGraph g, Link link) throws MappingException {\r
-           LOGGER.info("        createDomain for " + link.rangeElement);\r
+           LOGGER.trace("        createDomain for " + link.rangeElement);\r
                ILinkType type = schema.linkTypeOfRangeElement(link.rangeElement);\r
                Resource domainElement = type.createDomainElement(g, link.rangeElement);\r
                \r
@@ -228,11 +229,11 @@ public class Mapping implements IMapping {
        \r
        @Override\r
        public synchronized Collection<Resource> updateDomain(WriteGraph g) throws MappingException {\r
-           LOGGER.info("Mapping.updateDomain");\r
+           LOGGER.trace("Mapping.updateDomain");\r
                RangeToDomain map = new RangeToDomain(g);\r
                ArrayList<Resource> updated = new ArrayList<Resource>();\r
                while(!modifiedRangeLinks.isEmpty()) {\r
-                   LOGGER.info("    modifiedRangeLinks.size() = " + modifiedRangeLinks.size());\r
+                   LOGGER.trace("    modifiedRangeLinks.size() = " + modifiedRangeLinks.size());\r
                    \r
                        Link link = modifiedRangeLinks.remove(modifiedRangeLinks.size()-1);\r
                        link.rangeModified = false;\r
@@ -253,11 +254,11 @@ public class Mapping implements IMapping {
        \r
        @Override\r
        public synchronized Collection<Object> updateRange(ReadGraph g) throws MappingException {\r
-           LOGGER.info("Mapping.updateRange");\r
+           LOGGER.trace("Mapping.updateRange");\r
                DomainToRange map = new DomainToRange(g);\r
                ArrayList<Object> updated = new ArrayList<Object>();\r
                while(!modifiedDomainLinks.isEmpty()) {             \r
-                   LOGGER.info("    modifiedDomainLinks.size() = " + modifiedDomainLinks.size());\r
+                   LOGGER.trace("    modifiedDomainLinks.size() = " + modifiedDomainLinks.size());\r
                    \r
                        Link link = modifiedDomainLinks.remove(modifiedDomainLinks.size()-1);\r
                        link.domainModified = false;\r
@@ -322,7 +323,7 @@ public class Mapping implements IMapping {
        void domainModified(Link link) {\r
            if(!link.domainModified) {          \r
                synchronized(modifiedDomainLinks) {\r
-                   LOGGER.info("        domainModified for " + link.rangeElement);\r
+                   LOGGER.trace("        domainModified for " + link.rangeElement);\r
                 link.domainModified = true;\r
                 modifiedDomainLinks.add(link);\r
                 if(modifiedDomainLinks.size() == 1) {\r
index 9ce335982a7950b5f184c9059e90cab90d3a4d3e..21bb3315baf4d494b54ee7dfce87057346359e3a 100644 (file)
@@ -11,7 +11,6 @@
  *******************************************************************************/\r
 package org.simantics.objmap.rules;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -20,6 +19,8 @@ import org.simantics.objmap.IMappingRule;
 import org.simantics.objmap.MappingException;\r
 import org.simantics.objmap.rules.domain.IDomainAccessor;\r
 import org.simantics.objmap.rules.range.IRangeAccessor;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * A rule that synchronizes collection of elements between\r
@@ -29,7 +30,7 @@ import org.simantics.objmap.rules.range.IRangeAccessor;
  */\r
 public class MappedElementRule implements IMappingRule {\r
     \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
        IDomainAccessor<Resource> domainAccessor;\r
        IRangeAccessor<Object> rangeAccessor;\r
@@ -44,7 +45,7 @@ public class MappedElementRule implements IMappingRule {
        public boolean updateDomain(WriteGraph g, IFunction<Object, Resource> map,\r
                        Resource domainElement, Object rangeElement)\r
                        throws MappingException {\r
-        LOGGER.info("    MappedElementRule.updateDomain");\r
+        LOGGER.trace("    MappedElementRule.updateDomain");\r
            Object value = rangeAccessor.get(rangeElement);\r
            Resource mappedValue = value == null ? null : map.get(value);\r
                return domainAccessor.set(g, domainElement, mappedValue);\r
@@ -54,7 +55,7 @@ public class MappedElementRule implements IMappingRule {
        public boolean updateRange(ReadGraph g, IFunction<Resource, Object> map,\r
                        Resource domainElement, Object rangeElement)\r
                        throws MappingException {\r
-        LOGGER.info("    MappedElementRule.updateRange");   \r
+        LOGGER.trace("    MappedElementRule.updateRange");   \r
            Resource value = domainAccessor.get(g, domainElement);\r
         Object mappedValue = value == null ? null : map.get(value);\r
         return rangeAccessor.set(rangeElement, mappedValue);\r
index 750926d4300a3fa5e78fb692d87a2474659c6fcb..8a9cc38cd149a7ba946223ebef646ea1469a0938 100644 (file)
@@ -14,7 +14,6 @@ package org.simantics.objmap.rules;
 import java.util.ArrayList;\r
 import java.util.Collection;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -23,6 +22,8 @@ import org.simantics.objmap.IMappingRule;
 import org.simantics.objmap.MappingException;\r
 import org.simantics.objmap.rules.domain.IDomainAccessor;\r
 import org.simantics.objmap.rules.range.IRangeAccessor;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * A rule that synchronizes collection of elements between\r
@@ -32,7 +33,7 @@ import org.simantics.objmap.rules.range.IRangeAccessor;
  */\r
 public class MappedElementsRule implements IMappingRule {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
 \r
     IDomainAccessor<Collection<Resource>> domainAccessor;\r
     IRangeAccessor<Collection<Object>> rangeAccessor;\r
@@ -47,7 +48,7 @@ public class MappedElementsRule implements IMappingRule {
     public boolean updateDomain(WriteGraph g, IFunction<Object, Resource> map,\r
             Resource domainElement, Object rangeElement)\r
     throws MappingException {\r
-        LOGGER.info("    MappedElementsRule.updateDomain");\r
+        LOGGER.trace("    MappedElementsRule.updateDomain");\r
         // Snapshot the accessed range value for concurrency safety.\r
         // NOTE: still assumes that the accessed collection is concurrent or\r
         // synchronized for toArray to be atomic.\r
@@ -63,7 +64,7 @@ public class MappedElementsRule implements IMappingRule {
     public boolean updateRange(ReadGraph g, IFunction<Resource, Object> map,\r
             Resource domainElement, Object rangeElement)\r
     throws MappingException {\r
-        LOGGER.info("    MappedElementsRule.updateRange");\r
+        LOGGER.trace("    MappedElementsRule.updateRange");\r
         Collection<Resource> value = domainAccessor.get(g, domainElement);\r
         ArrayList<Object> mappedValue = new ArrayList<Object>(value.size());\r
         for(Resource r : value)\r
index 8135d2d04a5c5211fdfdb65df73243d84fc42dcb..3ea8c35a009ce7a56dc211d513275a3e2991be43 100644 (file)
@@ -11,7 +11,6 @@
  *******************************************************************************/\r
 package org.simantics.objmap.rules;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -20,6 +19,8 @@ import org.simantics.objmap.IMappingRule;
 import org.simantics.objmap.MappingException;\r
 import org.simantics.objmap.rules.domain.IDomainAccessor;\r
 import org.simantics.objmap.rules.range.IRangeAccessor;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * A rule that synchronizes values between domain and\r
@@ -28,7 +29,7 @@ import org.simantics.objmap.rules.range.IRangeAccessor;
  */\r
 public class ValueRule implements IMappingRule {\r
     \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
        IDomainAccessor<Object> domainAccessor;\r
        IRangeAccessor<Object> rangeAccessor;\r
@@ -43,7 +44,7 @@ public class ValueRule implements IMappingRule {
        public boolean updateDomain(WriteGraph g, IFunction<Object, Resource> map,\r
                        Resource domainElement, Object rangeElement)\r
                        throws MappingException {\r
-        LOGGER.info("    ValueRule.updateDomain");         \r
+        LOGGER.trace("    ValueRule.updateDomain");        \r
                Object value = rangeAccessor.get(rangeElement);\r
                return domainAccessor.set(g, domainElement, value);\r
        }\r
@@ -52,7 +53,7 @@ public class ValueRule implements IMappingRule {
        public boolean updateRange(ReadGraph g, IFunction<Resource, Object> map,\r
                        Resource domainElement, Object rangeElement)\r
                        throws MappingException {\r
-        LOGGER.info("    ValueRule.updateRange");\r
+        LOGGER.trace("    ValueRule.updateRange");\r
                Object value = domainAccessor.get(g, domainElement);\r
                return rangeAccessor.set(rangeElement, value);\r
        }       \r
index 927d012113769600111f2e4829d62ccca4d9e82b..e378d86d410a1738b1289192152499487b7af03c 100644 (file)
@@ -14,10 +14,11 @@ package org.simantics.objmap.rules.domain;
 import java.util.Arrays;\r
 import java.util.Collection;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * Static utility methods for rule implementations.\r
@@ -25,7 +26,7 @@ import org.simantics.db.exception.DatabaseException;
  */\r
 public class MappingUtils {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
     /**\r
      * Adds and removes statements to/from the database so that <code>objects</code>\r
@@ -47,7 +48,7 @@ public class MappingUtils {
                while(true) {\r
                        int cmp = currentObjects[i].compareTo(objects[j]);\r
                        if(cmp < 0) {\r
-                           LOGGER.info("            remove statement");\r
+                           LOGGER.trace("            remove statement");\r
                            if(deleteExtraObjects)\r
                                g.deny(currentObjects[i]);\r
                            else\r
@@ -58,7 +59,7 @@ public class MappingUtils {
                                        break;\r
                        }\r
                        else if(cmp > 0) {\r
-                           LOGGER.info("            add statement");\r
+                           LOGGER.trace("            add statement");\r
                                g.claim(subject, predicate, objects[j]);\r
                                modified = true;\r
                                ++j;\r
index 59b544f0f19ff9ee2b28cc0eec775ac37c2bcf78..b0841fc6a4e4bb985aee6f67ca954e18de4137c4 100644 (file)
@@ -14,17 +14,18 @@ package org.simantics.objmap.rules.domain;
 import java.util.Collection;\r
 import java.util.Collections;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.utils.ListUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.objmap.MappingException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 public class RelatedListElementsAccessor implements IDomainAccessor<Collection<Resource>> {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
     Resource relation;\r
 \r
@@ -36,7 +37,7 @@ public class RelatedListElementsAccessor implements IDomainAccessor<Collection<R
     @Override\r
        public Collection<Resource> get(ReadGraph g, Resource element) throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedListElementsAccessor.get");\r
+                   LOGGER.trace("        RelatedListElementsAccessor.get");\r
                    Resource listResource = g.getPossibleObject(element, relation);\r
                    if(listResource != null)\r
                        return ListUtils.toList(g, listResource);\r
@@ -51,7 +52,7 @@ public class RelatedListElementsAccessor implements IDomainAccessor<Collection<R
        public boolean set(WriteGraph g, Resource element, Collection<Resource> value)\r
                        throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedListElementsAccessor.set");\r
+                   LOGGER.trace("        RelatedListElementsAccessor.set");\r
                Resource listResource = g.getPossibleObject(element, relation);\r
                if(listResource != null)\r
                    ListUtils.createExisting(g, listResource, value);\r
index 10761d6c70911bcff8a3b68913dcdcc3e8a6e578..b65fec5f202df0d5a2fa8ae715253bcba870699e 100644 (file)
  *******************************************************************************/\r
 package org.simantics.objmap.rules.domain;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.objmap.MappingException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * Accesses a resource attached to the element by given functional relation.\r
@@ -24,7 +25,7 @@ import org.simantics.objmap.MappingException;
  */\r
 public class RelatedObjectAccessor implements IDomainAccessor<Resource> {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
        Resource relation;\r
        \r
@@ -35,7 +36,7 @@ public class RelatedObjectAccessor implements IDomainAccessor<Resource> {
        @Override\r
        public Resource get(ReadGraph g, Resource element) throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedObjectAccessor.get");\r
+                   LOGGER.trace("        RelatedObjectAccessor.get");\r
                        return g.getPossibleObject(element, relation);\r
                } catch (DatabaseException e) {\r
                        throw new MappingException(e);\r
@@ -46,7 +47,7 @@ public class RelatedObjectAccessor implements IDomainAccessor<Resource> {
        public boolean set(WriteGraph g, Resource element, Resource value)\r
                        throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedObjectAccessor.set");\r
+                   LOGGER.trace("        RelatedObjectAccessor.set");\r
                    Resource resource = g.getPossibleObject(element, relation);\r
                        if(resource == null) {\r
                            if(value == null)\r
index c7b6cabb3c4ae6ee9d2c2dbaa664a7c59ac14df2..fadfc35450cdff59a314b05502cd490d9c381bce 100644 (file)
@@ -13,12 +13,13 @@ package org.simantics.objmap.rules.domain;
 \r
 import java.util.Collection;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.objmap.MappingException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * Accesses the set of objects attached to the element by the given relation.\r
@@ -26,7 +27,7 @@ import org.simantics.objmap.MappingException;
  */\r
 public class RelatedObjectsAccessor implements IDomainAccessor<Collection<Resource>> {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
        Resource relation;\r
        boolean deleteExtraObjects;\r
@@ -40,7 +41,7 @@ public class RelatedObjectsAccessor implements IDomainAccessor<Collection<Resour
     @Override\r
        public Collection<Resource> get(ReadGraph g, Resource element) throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedObjectsAccessor.get");\r
+                   LOGGER.trace("        RelatedObjectsAccessor.get");\r
                        return g.getObjects(element, relation);\r
                } catch (DatabaseException e) {\r
                        throw new MappingException(e);\r
@@ -51,7 +52,7 @@ public class RelatedObjectsAccessor implements IDomainAccessor<Collection<Resour
        public boolean set(WriteGraph g, Resource element, Collection<Resource> value)\r
                        throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedObjectsAccessor.set");\r
+                   LOGGER.trace("        RelatedObjectsAccessor.set");\r
                        return MappingUtils.synchronizeStatements(g, element, relation, \r
                                value.toArray(new Resource[value.size()]), deleteExtraObjects);\r
                } catch (DatabaseException e) {\r
index 35c5e3f85b1a502ee6fd32d92966482186ff01e3..6b0947d671e185bd5ee12cb23ed072266e8c340b 100644 (file)
@@ -14,13 +14,14 @@ package org.simantics.objmap.rules.domain;
 import java.util.Collection;\r
 import java.util.Collections;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.utils.OrderedSetUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.objmap.MappingException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * Accesses the set of objects attached to the element by the given relation.\r
@@ -28,7 +29,7 @@ import org.simantics.objmap.MappingException;
  */\r
 public class RelatedOrderedSetElementsAccessor implements IDomainAccessor<Collection<Resource>> {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
        boolean deleteExtraObjects;\r
 \r
@@ -40,7 +41,7 @@ public class RelatedOrderedSetElementsAccessor implements IDomainAccessor<Collec
     @Override\r
        public Collection<Resource> get(ReadGraph g, Resource element) throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedOrderedSetElementsAccessor.get");\r
+                   LOGGER.trace("        RelatedOrderedSetElementsAccessor.get");\r
                    if(g.hasStatement(element))\r
                        return OrderedSetUtils.toList(g, element);\r
                    else\r
@@ -54,7 +55,7 @@ public class RelatedOrderedSetElementsAccessor implements IDomainAccessor<Collec
        public boolean set(WriteGraph g, Resource element, Collection<Resource> value)\r
                        throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedOrderedSetElementsAccessor.set");\r
+                   LOGGER.trace("        RelatedOrderedSetElementsAccessor.set");\r
                    return OrderedSetUtils.set(g, element, value);\r
                    // FIXME Implement deleteExtraObjects\r
                } catch (DatabaseException e) {\r
index 4cf7ecde19d4d354fbd0ecf295a0c7a55a023cd4..214c1688e18dc7133c718edd7c02b7166406175d 100644 (file)
  *******************************************************************************/\r
 package org.simantics.objmap.rules.domain;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.objmap.MappingException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * Accesses a value attached to the element by given functional relation.\r
@@ -25,7 +26,7 @@ import org.simantics.objmap.MappingException;
  */\r
 public class RelatedValueAccessor implements IDomainAccessor<Object> {\r
 \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
        Resource relation;\r
        Resource valueType;\r
@@ -38,7 +39,7 @@ public class RelatedValueAccessor implements IDomainAccessor<Object> {
        @Override\r
        public Object get(ReadGraph g, Resource element) throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedValueAccessor.get");\r
+                   LOGGER.trace("        RelatedValueAccessor.get");\r
                        Resource valueResource = g.getPossibleObject(element, relation);\r
                        if(valueResource == null)\r
                                return null;\r
@@ -52,7 +53,7 @@ public class RelatedValueAccessor implements IDomainAccessor<Object> {
        public boolean set(WriteGraph g, Resource element, Object value)\r
                        throws MappingException {\r
                try {\r
-                   LOGGER.info("        RelatedValueAccessor.set");\r
+                   LOGGER.trace("        RelatedValueAccessor.set");\r
                        Resource valueResource = g.getPossibleObject(element, relation);\r
                        if(valueResource == null) {\r
                                if(value == null)\r
index e731e3e9197f28ff28f36ac87969db056a0d53e1..23246c23391dc9b3357e1030d35944ac9824d112 100644 (file)
@@ -13,8 +13,9 @@ package org.simantics.objmap.rules.range;
 \r
 import java.lang.reflect.Field;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.objmap.MappingException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * Accesses the given field of the element.\r
@@ -22,7 +23,7 @@ import org.simantics.objmap.MappingException;
  */\r
 public class FieldAccessor<T> implements IRangeAccessor<T> {\r
     \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
        Field field;\r
 \r
@@ -37,7 +38,7 @@ public class FieldAccessor<T> implements IRangeAccessor<T> {
                        T result = (T)field.get(element);\r
                    \r
                if(LOGGER.isInfoEnabled())\r
-                   LOGGER.info("        FieldAccessor.get " +\r
+                   LOGGER.trace("        FieldAccessor.get " +\r
                            field.getName() + " -> " + result\r
                    );\r
                \r
@@ -55,7 +56,7 @@ public class FieldAccessor<T> implements IRangeAccessor<T> {
                        Object currentValue = field.get(element);\r
                        \r
             if(LOGGER.isInfoEnabled())\r
-                LOGGER.info("        FieldAccessor.set " +\r
+                LOGGER.trace("        FieldAccessor.set " +\r
                         field.getName() + " " + currentValue +  \r
                         " -> " + value\r
                 );\r
index 7cbfbb3d113d7479ec4d0e52c396ac072593794c..21fab23a6e4f2aba3a8e7075d4991c4d7885e662 100644 (file)
@@ -13,7 +13,6 @@ package org.simantics.objmap.schema;
 \r
 import java.util.ArrayList;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -24,6 +23,8 @@ import org.simantics.objmap.IFunction;
 import org.simantics.objmap.ILinkType;\r
 import org.simantics.objmap.IMappingRule;\r
 import org.simantics.objmap.MappingException;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * A link type that is associated with single domain and range type (class).\r
@@ -33,7 +34,7 @@ import org.simantics.objmap.MappingException;
  */\r
 public class SimpleLinkType implements ILinkType {\r
     \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
+    static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap");\r
     \r
     public Resource domainType;\r
     public Class<?> rangeType;\r
@@ -63,7 +64,7 @@ public class SimpleLinkType implements ILinkType {
             throws MappingException {\r
         try {\r
             if(LOGGER.isInfoEnabled())\r
-                LOGGER.info("SimpleLinkType.createDomainElement " +\r
+                LOGGER.trace("SimpleLinkType.createDomainElement " +\r
                         rangeElement.toString()\r
                 );\r
             Resource result = g.newResource();\r
@@ -79,7 +80,7 @@ public class SimpleLinkType implements ILinkType {
         try {\r
             if(LOGGER.isInfoEnabled())\r
                 try { \r
-                    LOGGER.info("SimpleLinkType.createRangeElement " +\r
+                    LOGGER.trace("SimpleLinkType.createRangeElement " +\r
                                NameUtils.getSafeName(g, domainElement)\r
                             );\r
                 } catch(DatabaseException e) {\r
@@ -98,7 +99,7 @@ public class SimpleLinkType implements ILinkType {
             throws MappingException {\r
         if(LOGGER.isInfoEnabled())\r
             try { \r
-                LOGGER.info("SimpleLinkType.updateDomain " +\r
+                LOGGER.trace("SimpleLinkType.updateDomain " +\r
                         NameUtils.getSafeName(g, domainElement) + " " +\r
                         rangeElement.toString()\r
                         );\r
@@ -117,7 +118,7 @@ public class SimpleLinkType implements ILinkType {
             throws MappingException {\r
         if(LOGGER.isInfoEnabled())\r
             try { \r
-                LOGGER.info("SimpleLinkType.updateRange " +\r
+                LOGGER.trace("SimpleLinkType.updateRange " +\r
                                NameUtils.getSafeName(g, domainElement) + " " +\r
                         rangeElement.toString()\r
                         );\r
index cb3cfacae7e0da29e0619f5c7ddf7f52cb94aa17..9aef99787110e0d32b2c6fc875c47d2babf003fd 100644 (file)
@@ -17,7 +17,6 @@ Require-Bundle: org.simantics.layer0.utils;bundle-version="0.6.2",
  org.eclipse.ui.editors;bundle-version="3.5.0",
  org.jfree.jchart;bundle-version="1.5.0",
  org.simantics.modelica;bundle-version="1.0.0",
- org.apache.log4j;bundle-version="1.2.15",
  org.eclipse.ui.console;bundle-version="3.4.0",
  org.simantics.browsing.ui.graph;bundle-version="1.1.0",
  org.simantics.browsing.ui.swt;bundle-version="1.1.0",
index 5e1333d758511e7a18251ca30f8697be067195de..45e9d6a45b5fd27f6356e2ccb279e2aecf584fc6 100644 (file)
@@ -13,11 +13,6 @@ package org.simantics.sysdyn.ui;
 \r
 import java.net.URL;\r
 \r
-import org.apache.log4j.BasicConfigurator;\r
-import org.apache.log4j.ConsoleAppender;\r
-import org.apache.log4j.Level;\r
-import org.apache.log4j.Logger;\r
-import org.apache.log4j.SimpleLayout;\r
 import org.eclipse.jface.resource.ImageDescriptor;\r
 import org.eclipse.jface.resource.ImageRegistry;\r
 import org.eclipse.jface.resource.JFaceResources;\r
@@ -50,13 +45,8 @@ public class Activator extends AbstractUIPlugin {
     @Override\r
     public void start(BundleContext context) throws Exception {\r
         super.start(context);\r
-        ConsoleAppender appender =\r
-            new ConsoleAppender(new SimpleLayout());\r
-        BasicConfigurator.configure(appender);\r
-        Logger.getRootLogger().setLevel(Level.WARN);\r
         plugin = this;\r
-        \r
-        \r
+\r
         Bundle bundle = context.getBundle();\r
 \r
         FATAL_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/fatal.svg"));\r