diff --git a/pom.xml b/pom.xml
index 3c27dc8..7beee74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
eu.dnetlib.dhp
dhp-schemas
jar
- 2.2.6-SNAPSHOT
+ 2.3.6-SNAPSHOT
@@ -287,6 +287,13 @@
provided
+
+ javax.persistence
+ javax.persistence-api
+ 2.2
+ provided
+
+
@@ -338,6 +345,11 @@
commons-codec
+
+ javax.persistence
+ javax.persistence-api
+
+
diff --git a/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStore.java b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStore.java
new file mode 100644
index 0000000..99e9cea
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStore.java
@@ -0,0 +1,119 @@
+
+package eu.dnetlib.dhp.schema.mdstore;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "mdstores")
+public class MDStore implements Serializable {
+
+ /** */
+ private static final long serialVersionUID = 3160530489149700055L;
+
+ @Id
+ @Column(name = "id")
+ private String id;
+
+ @Column(name = "format")
+ private String format;
+
+ @Column(name = "layout")
+ private String layout;
+
+ @Column(name = "interpretation")
+ private String interpretation;
+
+ @Column(name = "datasource_name")
+ private String datasourceName;
+
+ @Column(name = "datasource_id")
+ private String datasourceId;
+
+ @Column(name = "api_id")
+ private String apiId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public void setFormat(final String format) {
+ this.format = format;
+ }
+
+ public String getLayout() {
+ return layout;
+ }
+
+ public void setLayout(final String layout) {
+ this.layout = layout;
+ }
+
+ public String getInterpretation() {
+ return interpretation;
+ }
+
+ public void setInterpretation(final String interpretation) {
+ this.interpretation = interpretation;
+ }
+
+ public String getDatasourceName() {
+ return datasourceName;
+ }
+
+ public void setDatasourceName(final String datasourceName) {
+ this.datasourceName = datasourceName;
+ }
+
+ public String getDatasourceId() {
+ return datasourceId;
+ }
+
+ public void setDatasourceId(final String datasourceId) {
+ this.datasourceId = datasourceId;
+ }
+
+ public String getApiId() {
+ return apiId;
+ }
+
+ public void setApiId(final String apiId) {
+ this.apiId = apiId;
+ }
+
+ public static MDStore newInstance(
+ final String format, final String layout, final String interpretation) {
+ return newInstance(format, layout, interpretation, null, null, null);
+ }
+
+ public static MDStore newInstance(
+ final String format,
+ final String layout,
+ final String interpretation,
+ final String dsName,
+ final String dsId,
+ final String apiId) {
+ final MDStore md = new MDStore();
+ md.setId("md-" + UUID.randomUUID());
+ md.setFormat(format);
+ md.setLayout(layout);
+ md.setInterpretation(interpretation);
+ md.setDatasourceName(dsName);
+ md.setDatasourceId(dsId);
+ md.setApiId(apiId);
+ return md;
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreCurrentVersion.java b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreCurrentVersion.java
new file mode 100644
index 0000000..e741c43
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreCurrentVersion.java
@@ -0,0 +1,51 @@
+
+package eu.dnetlib.dhp.schema.mdstore;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "mdstore_current_versions")
+public class MDStoreCurrentVersion implements Serializable {
+
+ /** */
+ private static final long serialVersionUID = -4757725888593745773L;
+
+ @Id
+ @Column(name = "mdstore")
+ private String mdstore;
+
+ @Column(name = "current_version")
+ private String currentVersion;
+
+ public String getMdstore() {
+ return mdstore;
+ }
+
+ public void setMdstore(final String mdstore) {
+ this.mdstore = mdstore;
+ }
+
+ public String getCurrentVersion() {
+ return currentVersion;
+ }
+
+ public void setCurrentVersion(final String currentVersion) {
+ this.currentVersion = currentVersion;
+ }
+
+ public static MDStoreCurrentVersion newInstance(final String mdId, final String versionId) {
+ final MDStoreCurrentVersion cv = new MDStoreCurrentVersion();
+ cv.setMdstore(mdId);
+ cv.setCurrentVersion(versionId);
+ return cv;
+ }
+
+ public static MDStoreCurrentVersion newInstance(final MDStoreVersion v) {
+ return newInstance(v.getMdstore(), v.getId());
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreVersion.java b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreVersion.java
new file mode 100644
index 0000000..d6f62ce
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreVersion.java
@@ -0,0 +1,99 @@
+
+package eu.dnetlib.dhp.schema.mdstore;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name = "mdstore_versions")
+public class MDStoreVersion implements Serializable {
+
+ /** */
+ private static final long serialVersionUID = -4763494442274298339L;
+
+ @Id
+ @Column(name = "id")
+ private String id;
+
+ @Column(name = "mdstore")
+ private String mdstore;
+
+ @Column(name = "writing")
+ private boolean writing;
+
+ @Column(name = "readcount")
+ private int readCount = 0;
+
+ @Column(name = "lastupdate")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date lastUpdate;
+
+ @Column(name = "size")
+ private long size = 0;
+
+ public static MDStoreVersion newInstance(final String mdId, final boolean writing) {
+ final MDStoreVersion t = new MDStoreVersion();
+ t.setId(mdId + "-" + new Date().getTime());
+ t.setMdstore(mdId);
+ t.setLastUpdate(null);
+ t.setWriting(writing);
+ t.setReadCount(0);
+ t.setSize(0);
+ return t;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public String getMdstore() {
+ return mdstore;
+ }
+
+ public void setMdstore(final String mdstore) {
+ this.mdstore = mdstore;
+ }
+
+ public boolean isWriting() {
+ return writing;
+ }
+
+ public void setWriting(final boolean writing) {
+ this.writing = writing;
+ }
+
+ public int getReadCount() {
+ return readCount;
+ }
+
+ public void setReadCount(final int readCount) {
+ this.readCount = readCount;
+ }
+
+ public Date getLastUpdate() {
+ return lastUpdate;
+ }
+
+ public void setLastUpdate(final Date lastUpdate) {
+ this.lastUpdate = lastUpdate;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public void setSize(final long size) {
+ this.size = size;
+ }
+}
diff --git a/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreWithInfo.java b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreWithInfo.java
new file mode 100644
index 0000000..7367890
--- /dev/null
+++ b/src/main/java/eu/dnetlib/dhp/schema/mdstore/MDStoreWithInfo.java
@@ -0,0 +1,143 @@
+
+package eu.dnetlib.dhp.schema.mdstore;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name = "mdstores_with_info")
+public class MDStoreWithInfo implements Serializable {
+
+ /** */
+ private static final long serialVersionUID = -8445784770687571492L;
+
+ @Id
+ @Column(name = "id")
+ private String id;
+
+ @Column(name = "format")
+ private String format;
+
+ @Column(name = "layout")
+ private String layout;
+
+ @Column(name = "interpretation")
+ private String interpretation;
+
+ @Column(name = "datasource_name")
+ private String datasourceName;
+
+ @Column(name = "datasource_id")
+ private String datasourceId;
+
+ @Column(name = "api_id")
+ private String apiId;
+
+ @Column(name = "current_version")
+ private String currentVersion;
+
+ @Column(name = "lastupdate")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date lastUpdate;
+
+ @Column(name = "size")
+ private long size = 0;
+
+ @Column(name = "n_versions")
+ private long numberOfVersions = 0;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public void setFormat(final String format) {
+ this.format = format;
+ }
+
+ public String getLayout() {
+ return layout;
+ }
+
+ public void setLayout(final String layout) {
+ this.layout = layout;
+ }
+
+ public String getInterpretation() {
+ return interpretation;
+ }
+
+ public void setInterpretation(final String interpretation) {
+ this.interpretation = interpretation;
+ }
+
+ public String getDatasourceName() {
+ return datasourceName;
+ }
+
+ public void setDatasourceName(final String datasourceName) {
+ this.datasourceName = datasourceName;
+ }
+
+ public String getDatasourceId() {
+ return datasourceId;
+ }
+
+ public void setDatasourceId(final String datasourceId) {
+ this.datasourceId = datasourceId;
+ }
+
+ public String getApiId() {
+ return apiId;
+ }
+
+ public void setApiId(final String apiId) {
+ this.apiId = apiId;
+ }
+
+ public String getCurrentVersion() {
+ return currentVersion;
+ }
+
+ public void setCurrentVersion(final String currentVersion) {
+ this.currentVersion = currentVersion;
+ }
+
+ public Date getLastUpdate() {
+ return lastUpdate;
+ }
+
+ public void setLastUpdate(final Date lastUpdate) {
+ this.lastUpdate = lastUpdate;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public void setSize(final long size) {
+ this.size = size;
+ }
+
+ public long getNumberOfVersions() {
+ return numberOfVersions;
+ }
+
+ public void setNumberOfVersions(final long numberOfVersions) {
+ this.numberOfVersions = numberOfVersions;
+ }
+}