Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/pom.xml
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/pom.xml	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/pom.xml	(revision 48273)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<groupId>eu.dnetlib</groupId>
+		<artifactId>dnet45-parent</artifactId>
+		<version>1.0.0</version>
+		<relativePath />
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eu.dnetlib</groupId>
+	<artifactId>dnet-modular-logging</artifactId>
+	<packaging>jar</packaging>
+	<version>1.1.3</version>
+        <scm>
+          <developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3</developerConnection>
+        </scm>
+	<dependencies>
+		<dependency>
+			<groupId>eu.dnetlib</groupId>
+			<artifactId>cnr-misc-utils</artifactId>
+			<version>[1.0.0,2.0.0)</version>
+		</dependency>
+		<dependency>
+			<groupId>eu.dnetlib</groupId>
+			<artifactId>cnr-spring-utils</artifactId>
+			<version>[1.0.0,2.0.0)</version>
+		</dependency>
+		<dependency>
+			<groupId>com.typesafe</groupId>
+			<artifactId>config</artifactId>
+			<version>0.3.1</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/deploy.info
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/deploy.info	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/deploy.info	(revision 48273)
@@ -0,0 +1 @@
+{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-modular-logging/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-modular-logging"}
\ No newline at end of file
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/dao/DnetLoggerDao.java
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/dao/DnetLoggerDao.java	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/dao/DnetLoggerDao.java	(revision 48273)
@@ -0,0 +1,28 @@
+package eu.dnetlib.common.logging.dao;
+
+import java.util.*;
+
+public interface DnetLoggerDao {
+
+	void init(final String collection);
+
+	void writeLog(final String collection, final Map<String, Object> map);
+
+	void configureIndex(final String collection, final Map<String, IndexConf> indexConf);
+
+	Iterator<Map<String, String>> obtainLogIterator(final String collection);
+
+	Map<String, String> findOne(final String collection, final String key, final String value);
+
+	Iterator<Map<String, String>> find(final String collection, final String key, final String value);
+
+	Iterator<Map<String, String>> find(final String collection, final Map<String, Object> criteria);
+
+	Iterator<Map<String, String>> findByDateRange(final String collection, final Date startDate, final Date endDate, final String key, final String value);
+
+	Iterator<Map<String, String>> findByDateRange(final String collection, final Date startDate, final Date endDate);
+
+	Iterator<Map<String, String>> findByDateRange(final String name, final Date startDate, final Date endDate, final Map<String, Object> criteria);
+
+	Iterator<Map<String, String>> find(final String collection, final String cql, final List<String> fields);
+}
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/dao/IndexConf.java
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/dao/IndexConf.java	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/dao/IndexConf.java	(revision 48273)
@@ -0,0 +1,34 @@
+package eu.dnetlib.common.logging.dao;
+
+import java.util.Map;
+
+public class IndexConf {
+
+	private String field;
+	private Map<String, String> params;
+
+	public IndexConf() {}
+
+	public IndexConf(final String field, final Map<String, String> params) {
+		super();
+		this.field = field;
+		this.params = params;
+	}
+
+	public String getField() {
+		return field;
+	}
+
+	public void setField(final String field) {
+		this.field = field;
+	}
+
+	public Map<String, String> getParams() {
+		return params;
+	}
+
+	public void setParams(final Map<String, String> params) {
+		this.params = params;
+	}
+
+}
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/DnetLogger.java
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/DnetLogger.java	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/DnetLogger.java	(revision 48273)
@@ -0,0 +1,89 @@
+package eu.dnetlib.common.logging;
+
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.beans.factory.annotation.Required;
+import org.springframework.core.io.Resource;
+
+import eu.dnetlib.common.logging.conf.DnetLogConfigurationLoader;
+import eu.dnetlib.common.logging.dao.DnetLoggerDao;
+
+public class DnetLogger implements Iterable<Map<String, String>> {
+
+	private String name;
+
+	private Resource indexConf;
+
+	@javax.annotation.Resource
+	private DnetLoggerDao dao;
+
+	@PostConstruct
+	public void init() {
+		dao.init(name);
+		dao.configureIndex(name, DnetLogConfigurationLoader.getIndexedPaths(indexConf));
+	}
+
+	public LogMessage newLogMessage(final DnetLogLevel level) {
+		return new LogMessage(dao, name, level);
+	}
+
+	public LogMessage newLogMessage() {
+		return newLogMessage(DnetLogLevel.INFO);
+	}
+
+	public Iterator<Map<String, String>> find(final String key, final String value) {
+		return dao.find(name, key, value);
+	}
+
+	public Iterator<Map<String, String>> find(final Map<String, Object> criteria) {
+		return dao.find(name, criteria);
+	}
+
+	public Map<String, String> findOne(final String key, final String value) {
+		return dao.findOne(name, key, value);
+	}
+
+	public Iterator<Map<String, String>> find(final String cql, final List<String> fields) {
+		return dao.find(name, cql, fields);
+	}
+
+	@Override
+	public Iterator<Map<String, String>> iterator() {
+		return dao.obtainLogIterator(name);
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	@Required
+	public void setName(final String name) {
+		this.name = name;
+	}
+
+	public Resource getIndexConf() {
+		return indexConf;
+	}
+
+	public void setIndexConf(final Resource indexConf) {
+		this.indexConf = indexConf;
+	}
+
+	public Iterator<Map<String, String>> range(final Date startDate, final Date endDate) {
+		return dao.findByDateRange(name, startDate, endDate);
+	}
+
+	public Iterator<Map<String, String>> range(final Date startDate, final Date endDate, final String key, final String value) {
+		return dao.findByDateRange(name, startDate, endDate, key, value);
+	}
+
+	public Iterator<Map<String, String>> range(final Date startDate, final Date endDate, final Map<String, Object> criteria) {
+		return dao.findByDateRange(name, startDate, endDate, criteria);
+	}
+
+}
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/LogMessage.java
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/LogMessage.java	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/LogMessage.java	(revision 48273)
@@ -0,0 +1,41 @@
+package eu.dnetlib.common.logging;
+
+import java.util.Date;
+import java.util.Map;
+
+import com.google.common.collect.Maps;
+
+import eu.dnetlib.common.logging.dao.DnetLoggerDao;
+
+public class LogMessage {
+
+	private DnetLoggerDao dao;
+	private String logname;
+	private Map<String, Object> details;
+
+	public static final String LOG_LEVEL_FIELD = "log:level";
+	public static final String LOG_DATE_FIELD = "log:date";
+
+	public LogMessage(final DnetLoggerDao dao, final String logname, final DnetLogLevel level) {
+		this.dao = dao;
+		this.details = Maps.newHashMap();
+		this.details.put(LOG_LEVEL_FIELD, level.toString());
+		this.details.put(LOG_DATE_FIELD, (new Date()).getTime());
+		this.logname = logname;
+	}
+
+	public LogMessage addDetail(final String name, final String value) {
+		this.details.put(name, value);
+		return this;
+	}
+
+	public LogMessage addDetails(final Map<String, String> map) {
+		this.details.putAll(map);
+		return this;
+	}
+
+	public void flush() {
+		dao.writeLog(logname, details);
+	}
+
+}
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/DnetLogLevel.java
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/DnetLogLevel.java	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/DnetLogLevel.java	(revision 48273)
@@ -0,0 +1,5 @@
+package eu.dnetlib.common.logging;
+
+public enum DnetLogLevel {
+	DEBUG, INFO, WARN, ERROR, FATAL
+}
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/conf/DnetLogConfigurationLoader.java
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/conf/DnetLogConfigurationLoader.java	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/java/eu/dnetlib/common/logging/conf/DnetLogConfigurationLoader.java	(revision 48273)
@@ -0,0 +1,46 @@
+package eu.dnetlib.common.logging.conf;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.io.IOUtils;
+import org.springframework.core.io.Resource;
+
+import com.google.common.collect.Maps;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import com.typesafe.config.ConfigValue;
+
+import eu.dnetlib.common.logging.LogMessage;
+import eu.dnetlib.common.logging.dao.IndexConf;
+
+public class DnetLogConfigurationLoader {
+
+	public static Map<String, IndexConf> getIndexedPaths(final Resource indexConf) {
+		Map<String, IndexConf> response = Maps.newHashMap();
+		response.put(LogMessage.LOG_LEVEL_FIELD, null);
+		response.put(LogMessage.LOG_DATE_FIELD, null);
+		if (indexConf != null) {
+			Config config = loadConfiguration(indexConf);
+			if (config != null) {
+				for (Entry<String, ConfigValue> e : config.getObject("dnet.log.index.conf").entrySet()) {
+					response.put(e.getKey(), null);
+				}
+			}
+		}
+		return response;
+	}
+
+	public static final Config loadConfiguration(final Resource resource) {
+		if (resource != null) {
+			try {
+				return ConfigFactory.parseString(IOUtils.toString(resource.getInputStream()));
+			} catch (IOException e) {
+				return null;
+			}
+		}
+		return null;
+	}
+
+}
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/resources/eu/dnetlib/common/logging/applicationContext-dnet-modular-logging.xml
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/resources/eu/dnetlib/common/logging/applicationContext-dnet-modular-logging.xml	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3/src/main/resources/eu/dnetlib/common/logging/applicationContext-dnet-modular-logging.xml	(revision 48273)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
+	xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
+	xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template"
+	xmlns:util="http://www.springframework.org/schema/util"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                                    http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
+                                    http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
+                                    http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+                            http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+                            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
+                            http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd">
+
+</beans>
\ No newline at end of file
Index: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3
===================================================================
--- modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3	(nonexistent)
+++ modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3	(revision 48273)

Property changes on: modules/dnet-modular-logging/tags/dnet-modular-logging-1.1.3
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.project
+.classpath
+.settings
+target
+*.iml
