Upgrade to new spring.io project pages format.

This commit is contained in:
John Blum
2018-10-10 21:54:06 -07:00
parent 021f0647fb
commit 05636d3660
70 changed files with 9 additions and 35434 deletions

View File

@@ -1,221 +1,11 @@
---
# The name of your project
title: Spring Data Couchbase
badges:
# Specify your project's twitter handle, if any. Delete if none.
twitter: SpringData
# Customize your project's badges. Delete any entries that do not apply.
custom:
- name: Source (GitHub)
url: https://github.com/spring-projects/spring-data-couchbase
icon: github
- name: Issues (JIRA)
url: http://jira.springsource.org/browse/DATACOUCH
icon: tracking
- name: CI (Bamboo)
url: https://build.springsource.org/browse/SPRINGDATACOUCH
icon: ci
- name: StackOverflow
url: http://stackoverflow.com/questions/tagged/spring-data-couchbase
icon: stackoverflow
# - name: Metrics (SonarQube)
# url: https://sonar.springsource.org/dashboard/index/org.springframework.data:spring-data-couchbase
# icon: metrics
---
<!DOCTYPE HTML>
<!DOCTYPE html>
<html lang="en-US">
<!-- Specify the parent of this project (or delete if none) to influence the rendering of the breadcrumb -->
{% capture parent_link %}
[Spring Data]({{ site.projects_site_url }}/spring-data)
{% endcapture %}
{% capture billboard_description %}
Spring Data for [Couchbase](http://www.couchbase.com) is part of the umbrella
Spring Data project which aims to provide a familiar and consistent Spring-based
programming model for new datastores while retaining store-specific features and
capabilities.
{% endcapture %}
{% capture main_content %}
The Spring Data Couchbase project provides integration with the Couchbase Server
database. Key functional areas of Spring Data Couchbase are a POJO centric model
for interacting with Couchbase Buckets and easily writing a Repository style data
access layer.
## Features
* Spring configuration support using Java based `@Configuration` classes or an XML namespace for the Couchbase driver (Java SDK version `2.x`).
* `CouchbaseTemplate` helper class that increases productivity performing common Couchbase operations. Includes integrated object mapping between documents and POJOs.
* Exception translation into Spring's portable Data Access Exception hierarchy.
* Feature Rich Object Mapping integrated with Spring's Conversion Service.
* Annotation based mapping metadata but extensible to support other metadata formats.
* Automatic implementation of `Repository` interfaces including support for custom finder methods (backed by Couchbase's query language, `N1QL`) and `PagingAndSortingRepository`.
* For Couchbase server versions < 4.0, repositories can still be backed by Couchbase Views.
* Support for geospatial and multidimensional querying (backed by Couchbase Spatial Views)
* JMX administration and monitoring
* Can serve as the backend for `@Cacheable` support, to cache any objects you need for high performance access (see sibling Spring Cache project in Couchbase's github, [couchbaselabs/couchbase-spring-cache](https://github.com/couchbaselabs/couchbase-spring-cache)).
<span id="quick-start"></span>
## Quick Start
*Note that you should usually rely on the BOM, as described in [the Spring Data generic quick start](http://projects.spring.io/spring-data/#quick-start), especially when using Spring Boot.*
{% include download_widget.md %}
## Configuration
The minimal configuration requires you to set the name and password of the main `Bucket` into which Spring Data Couchbase will store the data: `getBucketName()` and `getBucketPassword()`.
The other required information is a list of IPs or hostnames to bootstrap from (at least one, preferably two): `getBootstrapHosts()`. These are just used to initiate connection to the cluster, after which the client will discover all nodes and keep the cluster map up to date.
```java
package foo;
import foo;
@Configuration
@EnableCouchbaseRepositories
public class Config extends AbstractCouchbaseConfiguration {
@Override
protected List<String> getBootstrapHosts() {
return Arrays.asList("host1", "host2");
}
@Override
protected String getBucketName() {
return "default";
}
@Override
protected String getBucketPassword() {
return "";
}
}
```
## Sample Repository
```java
public interface UserRepository extends CrudRepository<User, String> {
/**
* Additional custom finder method, backed by an auto-generated
* N1QL query.
*/
List<User> findByLastnameAndAgeBetween(String lastName, int minAge,
int maxAge);
/**
* Additional custom finder method, backed by a View that indexes
* the names.
*/
@View(designDocument = "user", viewName = "byName")
List<User> findByLastname(String lastName);
/**
* Additional custom finder method, backed by a geospatial view and
* allowing multi-dimensional queries.
* You can also query within a Circle or a Polygon.
*/
@Dimensional(designDocument = "userGeo", spatialViewName = "byLocation")
List<User> findByLocationWithin(Box cityBoundingBox);
}
```
## Server-side Setup
Note that some CRUD operations like `findAll` and `count`, as well as view-based custom finders each require you to set up a corresponding View on the server side:
For `findByLastname`:
```javascript
function (doc, meta) {
if(doc._class == "com.example.entity.User" && doc.firstname) {
emit(doc.firstname, null);
}
}
```
For `findAll` and `count` (also add a reduce `_count`):
```javascript
function (doc, meta) {
if(doc._class == "com.example.entity.User") {
emit(null, null);
}
}
```
For `findByLocationWithin`:
```javascript
function (doc, meta) {
if(doc._class == "com.example.entity.User" && doc.location) {
emit([doc.location.x, doc.location.y], null);
}
}
```
For more information on server side setup and how it can be partially automated in development environments, see the [Backing Views](http://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#couchbase.repository.views) and [Automatic Index Management](http://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#couchbase.repository.indexing) sections of the documentation.
## Usage
```java
@Service
public class MyService {
private final UserRepository userRepository;
@Autowired
public MyService(UserRepository userRepository) {
this.userRepository = userRepository;
}
public void doWork() {
userRepository.deleteAll();
User user = new User();
user.setLastname("Jackson");
user.setLocation(new Point(123, 456));
user = userRepository.save(user);
List<User> jacksonChildren =
userRepository.findByLastNameAndAgeBetween("Jackson", 0, 18);
List<User> jacksonFamily =
userRepository.findByLastName("Jackson");
//bounding box is lower-left, upper-right corners
Box cityBounds = new Box(new Point(100, 100), new Point(150, 500));
List<User> jacksonsInSomeCity =
userRepository.findByLocationWithin(cityBounds);
}
}
```
{% endcapture %}
{% capture related_resources %}
### Announcements
* [1.0 RC1](http://spring.io/blog/2014/02/06/spring-data-couchbase-1-0-rc1-released)
* [1.0 M2](http://spring.io/blog/2013/11/18/spring-data-couchbase-1-0-m2-released)
* [1.0 M1](http://spring.io/blog/2013/09/12/spring-data-couchbase-1-0-m1-and-spring-data-solr-1-0-ga-released)
{% endcapture %}
{% include project_page.html %}
<meta charset="utf-8">
<title>Redirecting&hellip;</title>
<link rel="canonical" href="http://spring.io/projects/spring-data-couchbase">
<meta http-equiv="refresh" content="0; url=http://spring.io/projects/spring-data-couchbase">
<meta name="robots" content="noindex">
<h1>Redirecting&hellip;</h1>
<a href="http://spring.io/projects/spring-data-couchbase">Click here if you are not redirected.</a>
<script>location="http://spring.io/projects/spring-data-couchbase"</script>
</html>