Merge pull request #40 from simonbasle/vestigialTemplate

prepare bare template class, use preview of SDK 2.2.0
This commit is contained in:
Simon Baslé
2015-06-16 19:19:48 +02:00
5 changed files with 118 additions and 10 deletions

View File

@@ -21,7 +21,7 @@
<dist.key>DATACOUCH</dist.key>
<couchbase>2.1.3</couchbase>
<couchbase>2.2.0-dp</couchbase>
<jackson>2.3.2</jackson>
<springdata.commons>1.11.0.BUILD-SNAPSHOT</springdata.commons>
<validation>1.0.0.GA</validation>
@@ -126,6 +126,12 @@
<id>spring-libs-snapshot</id>
<url>https://repo.spring.io/libs-snapshot</url>
</repository>
<repository>
<id>couchbase</id>
<name>couchbase repo</name>
<url>http://files.couchbase.com/maven2</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>

View File

@@ -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();
}

View File

@@ -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;
}
}

View File

@@ -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.
* <br/>
* 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;

View File

@@ -1,8 +0,0 @@
/**
* This package contains the Couchbase implementation to support the Spring Data template abstraction.
* <br/>
* 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;