001/* 002 * Copyright 2012-2017 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.autoconfigure.data.couchbase; 018 019import com.couchbase.client.java.Bucket; 020import com.couchbase.client.java.Cluster; 021import com.couchbase.client.java.cluster.ClusterInfo; 022import com.couchbase.client.java.env.CouchbaseEnvironment; 023 024import org.springframework.data.couchbase.config.CouchbaseConfigurer; 025 026/** 027 * A simple {@link CouchbaseConfigurer} implementation. 028 * 029 * @author Stephane Nicoll 030 * @since 1.4.0 031 */ 032public class SpringBootCouchbaseConfigurer implements CouchbaseConfigurer { 033 034 private final CouchbaseEnvironment env; 035 036 private final Cluster cluster; 037 038 private final ClusterInfo clusterInfo; 039 040 private final Bucket bucket; 041 042 public SpringBootCouchbaseConfigurer(CouchbaseEnvironment env, Cluster cluster, 043 ClusterInfo clusterInfo, Bucket bucket) { 044 this.env = env; 045 this.cluster = cluster; 046 this.clusterInfo = clusterInfo; 047 this.bucket = bucket; 048 } 049 050 @Override 051 public CouchbaseEnvironment couchbaseEnvironment() throws Exception { 052 return this.env; 053 } 054 055 @Override 056 public Cluster couchbaseCluster() throws Exception { 057 return this.cluster; 058 } 059 060 @Override 061 public ClusterInfo couchbaseClusterInfo() throws Exception { 062 return this.clusterInfo; 063 } 064 065 @Override 066 public Bucket couchbaseClient() throws Exception { 067 return this.bucket; 068 } 069 070}