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,
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
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
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
*******************************************************************************/\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
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
*/\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
}\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
\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
\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
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
*******************************************************************************/\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
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
*/\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
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
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
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
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
*/\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
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
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
*******************************************************************************/\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
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
*/\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
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
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
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
*/\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
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
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
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
@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
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
*******************************************************************************/\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
*/\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
@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
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
\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
*/\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
@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
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
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
*/\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
@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
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
*******************************************************************************/\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
*/\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
@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
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
\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
*/\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
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
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
\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
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
*/\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
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
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
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
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
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",
\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
@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