diff --git a/pom.xml b/pom.xml index ead63f1..41d0dea 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,121 @@ - - 4.0.0 - - org.gcube.tools - maven-parent - 1.0.0 - - org.gcube.accounting - accounting-analytics-persistence-couchbase - 1.0.0-SNAPSHOT - Accounting Analytics Persistence CouchBase - Accounting Analytics Persistence CouchBase Implementation + + 4.0.0 + + org.gcube.tools + maven-parent + 1.0.0 + + org.gcube.accounting + accounting-analytics-persistence-couchbase + 1.0.0-SNAPSHOT + Accounting Analytics Persistence CouchBase + Accounting Analytics Persistence CouchBase Implementation + + + UTF-8 + ${project.basedir}/distro + + + + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId} + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId} + https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/${project.artifactId} + + + + + + org.gcube.distribution + maven-smartgears-bom + LATEST + pom + import + + + + + + + org.gcube.accounting + accounting-analytics + [1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + org.gcube.data.publishing + document-store-lib + provided + + + org.gcube.accounting + accounting-lib + provided + + + org.slf4j + slf4j-api + provided + + + org.json + json + 20090211 + + + + + com.couchbase.client + java-client + 2.2.2 + + + + + + org.gcube.resources + registry-publisher + test + + + org.gcube.core + common-encryption + test + + + junit + junit + 4.11 + test + + + ch.qos.logback + logback-classic + 1.0.13 + test + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + jar-with-dependencies + + + + + package + + single + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/couchbase/AccountingPersistenceQueryCouchBase.java b/src/main/java/org/gcube/accounting/analytics/persistence/couchbase/AccountingPersistenceQueryCouchBase.java new file mode 100644 index 0000000..60ac72b --- /dev/null +++ b/src/main/java/org/gcube/accounting/analytics/persistence/couchbase/AccountingPersistenceQueryCouchBase.java @@ -0,0 +1,98 @@ +/** + * + */ +package org.gcube.accounting.analytics.persistence.couchbase; + +import java.util.Calendar; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.gcube.accounting.analytics.Filter; +import org.gcube.accounting.analytics.Info; +import org.gcube.accounting.analytics.TemporalConstraint; +import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery; +import org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration; +import org.gcube.documentstore.records.AggregatedRecord; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.Cluster; +import com.couchbase.client.java.CouchbaseCluster; + +/** + * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ + * + */ +public class AccountingPersistenceQueryCouchBase extends AccountingPersistenceBackendQuery { + + private static final Logger logger = LoggerFactory.getLogger(AccountingPersistenceQueryCouchBase.class); + + public static final String URL_PROPERTY_KEY = "URL"; + //public static final String USERNAME_PROPERTY_KEY = "username"; + public static final String PASSWORD_PROPERTY_KEY = "password"; + public static final String BUCKET_NAME_PROPERTY_KEY = "bucketName"; + + protected Cluster cluster; + protected Bucket bucket; + + /** + * {@inheritDoc} + */ + @Override + protected void prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) throws Exception { + String url = configuration.getProperty(URL_PROPERTY_KEY); + // String username = configuration.getProperty(USERNAME_PROPERTY_KEY); + String password = configuration.getProperty(PASSWORD_PROPERTY_KEY); + + cluster = CouchbaseCluster.create(url); + bucket = cluster.openBucket( + configuration.getProperty(BUCKET_NAME_PROPERTY_KEY), password); + } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws Exception { + cluster.disconnect(); + } + + /** + * {@inheritDoc} + */ + @Override + protected Map reallyQuery( + @SuppressWarnings("rawtypes") Class recordClass, + TemporalConstraint temporalConstraint, List filters) + throws Exception { + // TODO Auto-generated method stub + return null; + } + + + /** + * {@inheritDoc} + */ + @Override + public Set getKeys(Class recordClass) + throws Exception { + // TODO Auto-generated method stub + return null; + } + + + /** + * {@inheritDoc} + */ + @Override + public Set getPossibleValuesForKey( + Class recordClass, String key) + throws Exception { + // TODO Auto-generated method stub + return null; + } + + +}