diff --git a/pom.xml b/pom.xml index b75fd33b..6232a81a 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ DATACOUCH - 2.1.3 + 2.2.0-dp 2.3.2 1.11.0.BUILD-SNAPSHOT 1.0.0.GA @@ -126,6 +126,12 @@ spring-libs-snapshot https://repo.spring.io/libs-snapshot + + couchbase + couchbase repo + http://files.couchbase.com/maven2 + false + diff --git a/src/main/java/org/springframework/data/couchbase/core/CouchbaseOperations.java b/src/main/java/org/springframework/data/couchbase/core/CouchbaseOperations.java new file mode 100644 index 00000000..dddf0427 --- /dev/null +++ b/src/main/java/org/springframework/data/couchbase/core/CouchbaseOperations.java @@ -0,0 +1,37 @@ +/* + * Copyright 2012-2015 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.data.couchbase.core; + + +import com.couchbase.client.java.Bucket; + +/** + * Defines common operations on the Couchbase data source, most commonly implemented by {@link CouchbaseTemplate}. + * + * @author Michael Nitschinger + * @author Simon Baslé + */ +public interface CouchbaseOperations { + + /** + * Returns the linked {@link Bucket} to this template. + * + * @return the client used for the template. + */ + Bucket getCouchbaseBucket(); + +} diff --git a/src/main/java/org/springframework/data/couchbase/core/CouchbaseTemplate.java b/src/main/java/org/springframework/data/couchbase/core/CouchbaseTemplate.java new file mode 100644 index 00000000..d7c31083 --- /dev/null +++ b/src/main/java/org/springframework/data/couchbase/core/CouchbaseTemplate.java @@ -0,0 +1,52 @@ +/* + * Copyright 2012-2015 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.data.couchbase.core; + +import com.couchbase.client.java.Bucket; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.ApplicationEventPublisherAware; + +/** + * @author Michael Nitschinger + * @author Oliver Gierke + * @author Simon Baslé + */ +public class CouchbaseTemplate implements CouchbaseOperations, ApplicationEventPublisherAware { + + private static final Logger LOGGER = LoggerFactory.getLogger(CouchbaseTemplate.class); + + private final Bucket client; + + private ApplicationEventPublisher eventPublisher; + + public CouchbaseTemplate(final Bucket client) { + this.client = client; + } + + @Override + public void setApplicationEventPublisher(final ApplicationEventPublisher eventPublisher) { + this.eventPublisher = eventPublisher; + } + + @Override + public Bucket getCouchbaseBucket() { + return client; + } +} diff --git a/src/main/java/org/springframework/data/couchbase/core/package-info.java b/src/main/java/org/springframework/data/couchbase/core/package-info.java index de398688..ddb60dfc 100644 --- a/src/main/java/org/springframework/data/couchbase/core/package-info.java +++ b/src/main/java/org/springframework/data/couchbase/core/package-info.java @@ -1,5 +1,26 @@ +/* + * Copyright 2012-2015 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * This package contains the specific implementations and core classes for - * Spring Data Couchbase internals. + * Spring Data Couchbase internals. It also contains Couchbase implementation + * to support the Spring Data template abstraction. + *
+ * The template provides lower level access to the underlying database and also serves as the foundation for + * repositories. Any time a repository is too high-level for you needs chances are good that the templates will serve + * you well. */ package org.springframework.data.couchbase.core; \ No newline at end of file diff --git a/src/main/java/org/springframework/data/couchbase/template/package-info.java b/src/main/java/org/springframework/data/couchbase/template/package-info.java deleted file mode 100644 index c0df3239..00000000 --- a/src/main/java/org/springframework/data/couchbase/template/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This package contains the Couchbase implementation to support the Spring Data template abstraction. - *
- * The template provides lower level access to the underlying database and also serves as the foundation for - * repositories. Any time a repository is too high-level for you needs chances are good that the templates will serve - * you well. - */ -package org.springframework.data.couchbase.template; \ No newline at end of file