├── .gitreview ├── docs ├── marbles.graffle ├── com │ └── couchbase │ │ └── client │ │ └── java │ │ ├── get-found.png │ │ ├── get-not-found.png │ │ ├── replica-get-all.png │ │ └── replica-get-found.png └── teaser.html ├── src ├── test │ ├── resources │ │ ├── mock.properties │ │ └── log4j.properties │ └── java │ │ └── com │ │ └── couchbase │ │ └── client │ │ └── java │ │ ├── util │ │ └── AnalyticsIngesterTest.java │ │ └── auth │ │ └── CertAuthenticatorTest.java ├── main │ ├── resources │ │ └── com.couchbase.client.java.properties │ └── java │ │ └── com │ │ └── couchbase │ │ └── client │ │ ├── java │ │ ├── query │ │ │ ├── Statement.java │ │ │ ├── dsl │ │ │ │ ├── path │ │ │ │ │ ├── Path.java │ │ │ │ │ ├── LimitPath.java │ │ │ │ │ ├── MutateLimitPath.java │ │ │ │ │ ├── MergeDeletePath.java │ │ │ │ │ ├── AsPath.java │ │ │ │ │ ├── NestPath.java │ │ │ │ │ ├── UnnestPath.java │ │ │ │ │ ├── MergeUpdatePath.java │ │ │ │ │ ├── MergeInsertPath.java │ │ │ │ │ ├── MergeSourcePath.java │ │ │ │ │ ├── OffsetPath.java │ │ │ │ │ ├── OrderByPath.java │ │ │ │ │ ├── LettingPath.java │ │ │ │ │ ├── HavingPath.java │ │ │ │ │ ├── MergeDeleteWherePath.java │ │ │ │ │ ├── MergeUpdateWherePath.java │ │ │ │ │ ├── MergeInsertWherePath.java │ │ │ │ │ ├── MergeKeyClausePath.java │ │ │ │ │ ├── UpdateUnsetPath.java │ │ │ │ │ ├── InitialUpdateUnsetPath.java │ │ │ │ │ ├── FromPath.java │ │ │ │ │ ├── JoinPath.java │ │ │ │ │ ├── MergeUpdateUnsetPath.java │ │ │ │ │ ├── JoinType.java │ │ │ │ │ ├── index │ │ │ │ │ │ ├── IndexType.java │ │ │ │ │ │ ├── BuildIndexPath.java │ │ │ │ │ │ ├── UsingWithPath.java │ │ │ │ │ │ ├── UsingPath.java │ │ │ │ │ │ ├── DefaultUsingWithPath.java │ │ │ │ │ │ └── DefaultUsingPath.java │ │ │ │ │ ├── DeleteUsePath.java │ │ │ │ │ ├── SelectType.java │ │ │ │ │ ├── UpdateUsePath.java │ │ │ │ │ ├── DefaultLimitPath.java │ │ │ │ │ ├── MutateWherePath.java │ │ │ │ │ ├── DefaultMutateLimitPath.java │ │ │ │ │ ├── DefaultAsPath.java │ │ │ │ │ ├── DefaultNestPath.java │ │ │ │ │ ├── DefaultUnnestPath.java │ │ │ │ │ ├── ReturningPath.java │ │ │ │ │ ├── GroupByPath.java │ │ │ │ │ ├── DefaultMergeDeletePath.java │ │ │ │ │ ├── DefaultOffsetPath.java │ │ │ │ │ ├── DefaultMergeInsertPath.java │ │ │ │ │ ├── DefaultLettingPath.java │ │ │ │ │ ├── DefaultOrderByPath.java │ │ │ │ │ ├── DefaultHavingPath.java │ │ │ │ │ ├── DefaultMergeUpdatePath.java │ │ │ │ │ ├── DefaultMergeUpdateWherePath.java │ │ │ │ │ ├── SelectResultPath.java │ │ │ │ │ ├── DefaultMergeInsertWherePath.java │ │ │ │ │ ├── DefaultMutateWherePath.java │ │ │ │ │ ├── SelectPath.java │ │ │ │ │ ├── HashJoinHintElement.java │ │ │ │ │ ├── DefaultWherePath.java │ │ │ │ │ ├── DefaultMergeDeleteWherePath.java │ │ │ │ │ ├── DefaultMergeSourcePath.java │ │ │ │ │ └── HashSide.java │ │ │ │ ├── element │ │ │ │ │ ├── MergeDeleteElement.java │ │ │ │ │ ├── Element.java │ │ │ │ │ ├── AsElement.java │ │ │ │ │ ├── NestedLoopJoinHintElement.java │ │ │ │ │ ├── FromElement.java │ │ │ │ │ ├── LimitElement.java │ │ │ │ │ ├── OffsetElement.java │ │ │ │ │ ├── WhereElement.java │ │ │ │ │ ├── HavingElement.java │ │ │ │ │ ├── UsingElement.java │ │ │ │ │ ├── MergeInsertElement.java │ │ │ │ │ ├── LetElement.java │ │ │ │ │ ├── OrderByElement.java │ │ │ │ │ ├── JoinElement.java │ │ │ │ │ ├── NestElement.java │ │ │ │ │ └── LettingElement.java │ │ │ │ ├── clause │ │ │ │ │ └── package-info.java │ │ │ │ ├── functions │ │ │ │ │ └── package-info.java │ │ │ │ └── Alias.java │ │ │ ├── SerializableStatement.java │ │ │ ├── N1qlQueryRow.java │ │ │ ├── AsyncN1qlQueryRow.java │ │ │ └── NamedPreparedStatementException.java │ │ ├── document │ │ │ └── json │ │ │ │ └── JsonNull.java │ │ ├── search │ │ │ ├── sort │ │ │ │ ├── FieldMissing.java │ │ │ │ ├── FieldMode.java │ │ │ │ ├── FieldType.java │ │ │ │ ├── SearchSortId.java │ │ │ │ └── SearchSortScore.java │ │ │ ├── HighlightStyle.java │ │ │ ├── SearchConsistency.java │ │ │ ├── facet │ │ │ │ └── TermFacet.java │ │ │ ├── result │ │ │ │ ├── facets │ │ │ │ │ ├── TermFacetResult.java │ │ │ │ │ ├── DateRangeFacetResult.java │ │ │ │ │ └── NumericRangeFacetResult.java │ │ │ │ └── SearchMetrics.java │ │ │ └── queries │ │ │ │ └── Coordinate.java │ │ ├── error │ │ │ ├── FtsServerOverloadException.java │ │ │ ├── FtsMalformedRequestException.java │ │ │ ├── FtsConsistencyTimeoutException.java │ │ │ ├── TranscodingException.java │ │ │ ├── subdoc │ │ │ │ ├── DocumentNotJsonException.java │ │ │ │ ├── NumberTooBigException.java │ │ │ │ ├── PathNotFoundException.java │ │ │ │ ├── PathInvalidException.java │ │ │ │ ├── PathMismatchException.java │ │ │ │ ├── PathExistsException.java │ │ │ │ ├── SubDocumentException.java │ │ │ │ └── XattrOrderingException.java │ │ │ ├── FlushDisabledException.java │ │ │ ├── DesignDocumentException.java │ │ │ ├── CannotRetryException.java │ │ │ ├── DesignDocumentAlreadyExistsException.java │ │ │ ├── ViewDoesNotExistException.java │ │ │ ├── CASMismatchException.java │ │ │ ├── DurabilityException.java │ │ │ ├── AuthenticationException.java │ │ │ ├── RequestTooBigException.java │ │ │ ├── BucketDoesNotExistException.java │ │ │ ├── BucketAlreadyExistsException.java │ │ │ ├── DesignDocumentDoesNotExistException.java │ │ │ ├── InvalidPasswordException.java │ │ │ ├── CouchbaseOutOfMemoryException.java │ │ │ ├── DocumentDoesNotExistException.java │ │ │ ├── DocumentAlreadyExistsException.java │ │ │ ├── TemporaryFailureException.java │ │ │ └── MixedAuthenticationException.java │ │ ├── repository │ │ │ ├── mapping │ │ │ │ ├── EntityConverter.java │ │ │ │ ├── RepositoryMappingException.java │ │ │ │ └── EntityMetadata.java │ │ │ └── annotation │ │ │ │ ├── Id.java │ │ │ │ ├── Field.java │ │ │ │ └── EncryptedField.java │ │ ├── bucket │ │ │ └── BucketType.java │ │ ├── view │ │ │ ├── OnError.java │ │ │ └── Stale.java │ │ ├── cluster │ │ │ ├── api │ │ │ │ └── RestBuilderMarker.java │ │ │ ├── CompressionMode.java │ │ │ └── AuthDomain.java │ │ ├── analytics │ │ │ ├── AnalyticsQueryRow.java │ │ │ └── AsyncAnalyticsQueryRow.java │ │ ├── util │ │ │ └── LRUCache.java │ │ ├── auth │ │ │ └── CredentialContext.java │ │ └── ReplicaMode.java │ │ └── encryption │ │ └── errors │ │ ├── CryptoProviderSigningFailedException.java │ │ ├── CryptoProviderAliasNullException.java │ │ ├── CryptoProviderDecryptFailedException.java │ │ ├── CryptoProviderNotFoundException.java │ │ ├── CryptoProviderEncryptFailedException.java │ │ ├── CryptoProviderKeySizeException.java │ │ ├── CryptoProviderMissingPublicKeyException.java │ │ ├── CryptoProviderMissingPrivateKeyException.java │ │ └── CryptoProviderMissingSigningKeyException.java └── integration │ └── java │ └── com │ └── couchbase │ └── client │ └── java │ ├── AnalyticsTest.java │ ├── BucketInfoTest.java │ └── AnalyticsDeferredQueryTest.java ├── .gitignore └── .mailmap /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=review.couchbase.org 3 | project=couchbase-java-client.git 4 | -------------------------------------------------------------------------------- /docs/marbles.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbase/couchbase-java-client/HEAD/docs/marbles.graffle -------------------------------------------------------------------------------- /src/test/resources/mock.properties: -------------------------------------------------------------------------------- 1 | mock.enabled=${useMock} 2 | mock.nodeCount=1 3 | mock.replicaCount=1 4 | mock.bucketType=couchbase 5 | -------------------------------------------------------------------------------- /docs/com/couchbase/client/java/get-found.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbase/couchbase-java-client/HEAD/docs/com/couchbase/client/java/get-found.png -------------------------------------------------------------------------------- /docs/com/couchbase/client/java/get-not-found.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbase/couchbase-java-client/HEAD/docs/com/couchbase/client/java/get-not-found.png -------------------------------------------------------------------------------- /docs/com/couchbase/client/java/replica-get-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbase/couchbase-java-client/HEAD/docs/com/couchbase/client/java/replica-get-all.png -------------------------------------------------------------------------------- /docs/com/couchbase/client/java/replica-get-found.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/couchbase/couchbase-java-client/HEAD/docs/com/couchbase/client/java/replica-get-found.png -------------------------------------------------------------------------------- /src/main/resources/com.couchbase.client.java.properties: -------------------------------------------------------------------------------- 1 | #version information injected by the build 2 | implementationVersion=${git.commit.id.describe} 3 | specificationVersion=${project.version} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # General Ignores 2 | *~ 3 | .classpath 4 | .DS_Store 5 | .project 6 | build/ 7 | target/ 8 | log/ 9 | 10 | # IDE Support 11 | # IntelliJ specific files/directories 12 | .idea/ 13 | *.ipr 14 | *.iws 15 | *.iml 16 | atlassian-ide-plugin.xml 17 | 18 | # Eclipse 19 | .factorypath 20 | .settings/ 21 | .externalToolBuilders 22 | 23 | # NetBeans 24 | .nbattrs 25 | 26 | # Gradle 27 | .gradle/ 28 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Michael Nitschinger Michael Nitschinger 2 | Matt Ingenthron 3 | Mike Wiederhold Mike Wiederhold 4 | Raghavan Srinivas 5 | Deepti Dawar deeptida 6 | Tugdual Grall tgrall 7 | Sergey Avseyev 8 | -------------------------------------------------------------------------------- /src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Root logger option 2 | log4j.rootLogger=INFO, stdout 3 | 4 | # uncomment the following to force logging of BucketManager's N1QL index watcher steps 5 | #log4j.logger.indexWatch=DEBUG 6 | # uncomment the following to avoid seeing Node connect/disconnect logs 7 | #log4j.logger.com.couchbase.client.core.node.Node=OFF 8 | 9 | # Direct log messages to stdout 10 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 11 | log4j.appender.stdout.Target=System.out 12 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 13 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/Statement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query; 17 | 18 | public interface Statement { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/integration/java/com/couchbase/client/java/AnalyticsTest.java: -------------------------------------------------------------------------------- 1 | package com.couchbase.client.java; 2 | 3 | import com.couchbase.client.java.analytics.AnalyticsQuery; 4 | import com.couchbase.client.java.analytics.AnalyticsQueryResult; 5 | 6 | /** 7 | * Still manual simple test, to be expanded going forward once properly integrated 8 | * into the server. 9 | * 10 | * @author Michael Nitschinger 11 | * @since 2.4.3 12 | */ 13 | public class AnalyticsTest { 14 | 15 | public static void main(String... args) throws Exception { 16 | 17 | System.setProperty("com.couchbase.analyticsEnabled", "true"); 18 | 19 | Cluster cluster = CouchbaseCluster.create(); 20 | Bucket bucket = cluster.openBucket(); 21 | 22 | AnalyticsQueryResult result = bucket.query(AnalyticsQuery.simple("SELECT 1=1;")); 23 | System.out.println(result); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/Path.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public interface Path { 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/LimitPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | public interface LimitPath extends OffsetPath { 19 | 20 | OffsetPath limit(int limit); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MutateLimitPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | public interface MutateLimitPath extends ReturningPath { 19 | 20 | ReturningPath limit(int limit); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeDeletePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | 19 | public interface MergeDeletePath extends MergeInsertPath { 20 | 21 | MergeDeleteWherePath whenMatchedThenDelete(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/AsPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public interface AsPath extends HintPath { 24 | 25 | HintPath as(String alias); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/NestPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public interface NestPath extends KeysPath { 24 | 25 | KeysPath as(String alias); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/UnnestPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public interface UnnestPath extends LetPath { 24 | 25 | LetPath as(String alias); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeUpdatePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public interface MergeUpdatePath extends MergeDeletePath { 24 | 25 | MergeUpdateSetOrUnsetPath whenMatchedThenUpdate(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeInsertPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface MergeInsertPath extends MutateLimitPath { 22 | 23 | MergeInsertWherePath whenNotMatchedThenInsert(Expression expression); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeSourcePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | 20 | public interface MergeSourcePath extends Path { 21 | 22 | MergeKeyClausePath using(String source); 23 | MergeKeyClausePath using(Expression source); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/OffsetPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.Statement; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public interface OffsetPath extends Statement, Path { 26 | 27 | Statement offset(int offset); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/OrderByPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Sort; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public interface OrderByPath extends LimitPath { 26 | 27 | LimitPath orderBy(Sort... orderings); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/LettingPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Alias; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public interface LettingPath extends HavingPath { 26 | 27 | HavingPath letting(Alias... aliases); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderSigningFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderSigningFailedException is thrown when the crypto provider 12 | * is not able to sign/verify 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderSigningFailedException extends Exception { 18 | 19 | public CryptoProviderSigningFailedException() { super(); } 20 | 21 | public CryptoProviderSigningFailedException(String message) { super(message); } 22 | 23 | public CryptoProviderSigningFailedException(String message, Throwable cause) { super(message, cause); } 24 | 25 | public CryptoProviderSigningFailedException(Throwable cause) { 26 | super(cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderAliasNullException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderAliasNullException is thrown when the supplied argument to the 12 | * crypto manager fetch the crypto provider by name is null. 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderAliasNullException extends Exception { 18 | 19 | public CryptoProviderAliasNullException() { super(); } 20 | 21 | public CryptoProviderAliasNullException(String message) { super(message); } 22 | 23 | public CryptoProviderAliasNullException(String message, Throwable cause) { super(message, cause); } 24 | 25 | public CryptoProviderAliasNullException(Throwable cause) { super(cause); } 26 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/SerializableStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * A {@link Statement} that is also explicitly {@link Serializable}. 22 | * 23 | * @author Simon Baslé 24 | * @since 2.1 25 | */ 26 | public interface SerializableStatement extends Statement, Serializable { 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/HavingPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public interface HavingPath extends SelectResultPath { 26 | 27 | SelectResultPath having(Expression condition); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeDeleteWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface MergeDeleteWherePath extends MergeInsertPath { 22 | 23 | MergeInsertPath where(Expression expression); 24 | MergeInsertPath where(String expression); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeUpdateWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface MergeUpdateWherePath extends MergeDeletePath { 22 | 23 | MergeDeletePath where(Expression expression); 24 | MergeDeletePath where(String expression); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderDecryptFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderDecryptFailedException is thrown when the encrypted 12 | * field fetched from the server cannot be decrypted. 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderDecryptFailedException extends Exception { 18 | 19 | public CryptoProviderDecryptFailedException() { super(); } 20 | 21 | public CryptoProviderDecryptFailedException(String message) { super(message); } 22 | 23 | public CryptoProviderDecryptFailedException(String message, Throwable cause) { super(message, cause); } 24 | 25 | public CryptoProviderDecryptFailedException(Throwable cause) { super(cause); } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeInsertWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface MergeInsertWherePath extends MutateLimitPath { 22 | 23 | MutateLimitPath where(Expression expression); 24 | 25 | MutateLimitPath where(String expression); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/document/json/JsonNull.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.document.json; 17 | 18 | /** 19 | * Represents the JSON form of "NULL". 20 | * 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public class JsonNull extends JsonValue { 25 | 26 | public static JsonNull INSTANCE = new JsonNull(); 27 | 28 | private JsonNull() {} 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/sort/FieldMissing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.sort; 17 | 18 | 19 | public enum FieldMissing { 20 | FIRST("first"), 21 | LAST("last"); 22 | 23 | private final String value; 24 | 25 | FieldMissing(String value) { 26 | this.value = value; 27 | } 28 | 29 | public String value() { 30 | return value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/sort/FieldMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.sort; 17 | 18 | public enum FieldMode { 19 | DEFAULT("default"), 20 | MIN("min"), 21 | MAX("max"); 22 | 23 | private final String value; 24 | 25 | FieldMode(String value) { 26 | this.value = value; 27 | } 28 | 29 | public String value() { 30 | return value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderNotFoundException is thrown when the provider is 12 | * not registered on the Crypto manager. 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderNotFoundException extends Exception { 18 | 19 | public CryptoProviderNotFoundException() { 20 | super(); 21 | } 22 | 23 | public CryptoProviderNotFoundException(String message) { 24 | super(message); 25 | } 26 | 27 | public CryptoProviderNotFoundException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public CryptoProviderNotFoundException(Throwable cause) { 32 | super(cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderEncryptFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderEncryptFailedException is thrown when the field cannot 12 | * be encrypted. 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderEncryptFailedException extends Exception { 18 | 19 | public CryptoProviderEncryptFailedException() { 20 | super(); 21 | } 22 | 23 | public CryptoProviderEncryptFailedException(String message) { 24 | super(message); 25 | } 26 | 27 | public CryptoProviderEncryptFailedException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public CryptoProviderEncryptFailedException(Throwable cause) { 32 | super(cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/sort/FieldType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.sort; 17 | 18 | public enum FieldType { 19 | AUTO("auto"), 20 | STRING("string"), 21 | NUMBER("number"), 22 | DATE("date"); 23 | 24 | private final String value; 25 | 26 | FieldType(String value) { 27 | this.value = value; 28 | } 29 | 30 | public String value() { 31 | return value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderKeySizeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderKeySizeException is thrown when the supplied key's size 12 | * does not match the Crypto provider's expected key size 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderKeySizeException extends Exception { 18 | 19 | public CryptoProviderKeySizeException() { 20 | super(); 21 | } 22 | 23 | public CryptoProviderKeySizeException(String message) { 24 | super(message); 25 | } 26 | 27 | public CryptoProviderKeySizeException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public CryptoProviderKeySizeException(Throwable cause) { 32 | super(cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/FtsServerOverloadException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | /** 19 | * An exception denoting that the search engine couldn't parse an FTS request. 20 | */ 21 | public class FtsServerOverloadException extends TemporaryFailureException { 22 | 23 | public FtsServerOverloadException(String payload) { 24 | super("Search server is overloaded. Details: " + payload); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/repository/mapping/EntityConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.repository.mapping; 17 | 18 | import com.couchbase.client.java.document.Document; 19 | import com.couchbase.client.java.document.EntityDocument; 20 | 21 | public interface EntityConverter> { 22 | 23 | D fromEntity(EntityDocument source); 24 | 25 | EntityDocument toEntity(D source, Class clazz); 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderMissingPublicKeyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderMissingPublicKeyException is thrown when the public key is 12 | * not set on the Crypto provider. 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderMissingPublicKeyException extends Exception { 18 | 19 | public CryptoProviderMissingPublicKeyException() { 20 | super(); 21 | } 22 | 23 | public CryptoProviderMissingPublicKeyException(String message) { 24 | super(message); 25 | } 26 | 27 | public CryptoProviderMissingPublicKeyException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public CryptoProviderMissingPublicKeyException(Throwable cause) { 32 | super(cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderMissingPrivateKeyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderMissingPrivateKeyException is thrown when the private key is 12 | * not set on the Crypto provider. 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderMissingPrivateKeyException extends Exception { 18 | 19 | public CryptoProviderMissingPrivateKeyException() { 20 | super(); 21 | } 22 | 23 | public CryptoProviderMissingPrivateKeyException(String message) { 24 | super(message); 25 | } 26 | 27 | public CryptoProviderMissingPrivateKeyException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public CryptoProviderMissingPrivateKeyException(Throwable cause) { 32 | super(cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/encryption/errors/CryptoProviderMissingSigningKeyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Use of this software is subject to the Couchbase Inc. Enterprise Subscription License Agreement 5 | * which may be found at https://www.couchbase.com/ESLA-11132015. 6 | */ 7 | 8 | package com.couchbase.client.encryption.errors; 9 | 10 | /** 11 | * CryptoProviderMissingSigningKeyException is thrown when the signing key is 12 | * not set on the Crypto provider. 13 | * 14 | * @author Subhashni Balakrishnan 15 | * @since 1.0.0 16 | */ 17 | public class CryptoProviderMissingSigningKeyException extends Exception { 18 | 19 | public CryptoProviderMissingSigningKeyException() { 20 | super(); 21 | } 22 | 23 | public CryptoProviderMissingSigningKeyException(String message) { 24 | super(message); 25 | } 26 | 27 | public CryptoProviderMissingSigningKeyException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public CryptoProviderMissingSigningKeyException(Throwable cause) { 32 | super(cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeKeyClausePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface MergeKeyClausePath extends Path { 22 | 23 | MergeUpdatePath onKey(Expression expression); 24 | MergeUpdatePath onPrimaryKey(Expression expression); 25 | MergeUpdatePath onKey(String expression); 26 | MergeUpdatePath onPrimaryKey(String expression); 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/UpdateUnsetPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | 20 | public interface UpdateUnsetPath extends MutateWherePath { 21 | 22 | UpdateUnsetPath unset(String path); 23 | UpdateUnsetPath unset(String path, Expression updateFor); 24 | UpdateUnsetPath unset(Expression path); 25 | UpdateUnsetPath unset(Expression path, Expression updateFor); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/InitialUpdateUnsetPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | 20 | public interface InitialUpdateUnsetPath extends MutateWherePath { 21 | 22 | UpdateUnsetPath unset(String path); 23 | UpdateUnsetPath unset(String path, Expression updateFor); 24 | UpdateUnsetPath unset(Expression path); 25 | UpdateUnsetPath unset(Expression path, Expression updateFor); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/MergeDeleteElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | @InterfaceStability.Experimental 22 | @InterfaceAudience.Private 23 | public class MergeDeleteElement implements Element { 24 | 25 | @Override 26 | public String export() { 27 | return "WHEN MATCHED THEN DELETE"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/bucket/BucketType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.bucket; 17 | 18 | /** 19 | * The type of the bucket. 20 | * 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public enum BucketType { 25 | 26 | /** 27 | * The couchbase bucket type. 28 | */ 29 | COUCHBASE, 30 | 31 | /** 32 | * The memcached bucket type. 33 | */ 34 | MEMCACHED, 35 | 36 | /** 37 | * The ephemeral bucket type. 38 | */ 39 | EPHEMERAL 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/FromPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public interface FromPath extends LetPath { 26 | 27 | AsPath from(String from); 28 | 29 | /** Note that from Expression should be a single identifier/path **/ 30 | AsPath from(Expression expression); 31 | 32 | AsPath fromCurrentBucket(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/JoinPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public interface JoinPath extends KeysPath { 24 | 25 | JoinPath as(String alias); 26 | 27 | /** 28 | * Use hash join hint (Available in Enterprise Edition only) 29 | */ 30 | KeysPath useHash(HashSide side); 31 | 32 | /** 33 | * Use nested loop join 34 | */ 35 | KeysPath useNestedLoop(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MergeUpdateUnsetPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface MergeUpdateUnsetPath extends MergeUpdateWherePath { 22 | 23 | MergeUpdateUnsetPath unset(String path); 24 | MergeUpdateUnsetPath unset(String path, Expression updateFor); 25 | MergeUpdateUnsetPath unset(Expression path); 26 | MergeUpdateUnsetPath unset(Expression path, Expression updateFor); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/JoinType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public enum JoinType { 24 | 25 | DEFAULT(""), 26 | INNER("INNER"), 27 | LEFT("LEFT"), 28 | LEFT_OUTER("LEFT OUTER"); 29 | 30 | private final String value; 31 | 32 | JoinType(String value) { 33 | this.value = value; 34 | } 35 | 36 | public String value() { 37 | return value; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/clause/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Clauses are mini-DSL that can help you produce a well-formed 19 | * {@link com.couchbase.client.java.query.dsl.Expression Expression} for specific parts of some N1QL statement, 20 | * aka clauses. They stand between a more complex {@link com.couchbase.client.java.query.dsl.path.Path Path} (the 21 | * building block of the DSL) and {@link com.couchbase.client.java.query.dsl.functions Functions}. 22 | */ 23 | package com.couchbase.client.java.query.dsl.clause; -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/index/IndexType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path.index; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * Enum of the different types of indexes supported by N1QL. 23 | * 24 | * @author Simon Baslé 25 | * @since 2.2 26 | */ 27 | @InterfaceStability.Experimental 28 | @InterfaceAudience.Public 29 | public enum IndexType { 30 | GSI, 31 | VIEW 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DeleteUsePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.document.json.JsonArray; 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface DeleteUsePath extends MutateWherePath { 22 | 23 | MutateWherePath useKeys(Expression expression); 24 | 25 | MutateWherePath useKeys(String key); 26 | 27 | MutateWherePath useKeysValues(String... keys); 28 | 29 | MutateWherePath useKeys(JsonArray keys); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/view/OnError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.view; 17 | 18 | /** 19 | * Set the behavior on error for a view query. 20 | * 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public enum OnError { 25 | 26 | STOP("stop"), 27 | CONTINUE("continue"); 28 | 29 | private final String identifier; 30 | 31 | OnError(String identifier) { 32 | this.identifier = identifier; 33 | } 34 | 35 | public String identifier() { 36 | return identifier; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/sort/SearchSortId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.sort; 17 | 18 | /** 19 | * Sort by the document ID. 20 | * 21 | * @author Michael Nitschinger 22 | * @since 2.4.5 23 | */ 24 | public class SearchSortId extends SearchSort { 25 | 26 | @Override 27 | protected String identifier() { 28 | return "id"; 29 | } 30 | 31 | @Override 32 | public SearchSortId descending(boolean descending) { 33 | super.descending(descending); 34 | return this; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/FtsMalformedRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * An exception denoting that the search engine couldn't parse an FTS request. 22 | * 23 | * @author Simon Baslé 24 | * @since 2.3 25 | */ 26 | public class FtsMalformedRequestException extends CouchbaseException { 27 | 28 | public FtsMalformedRequestException(String payload) { 29 | super("FTS request is malformed. Details: " + payload); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/SelectType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public enum SelectType { 24 | 25 | DEFAULT(""), 26 | ALL("ALL"), 27 | DISTINCT("DISTINCT"), 28 | RAW("RAW"), 29 | DISTINCT_RAW("DISTINCT RAW"); 30 | 31 | private final String value; 32 | 33 | SelectType(String value) { 34 | this.value = value; 35 | } 36 | 37 | public String value() { 38 | return value; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/UpdateUsePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.document.json.JsonArray; 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface UpdateUsePath extends UpdateSetOrUnsetPath { 22 | 23 | UpdateSetOrUnsetPath useKeys(Expression expression); 24 | 25 | UpdateSetOrUnsetPath useKeys(String key); 26 | 27 | UpdateSetOrUnsetPath useKeysValues(String... keys); 28 | 29 | UpdateSetOrUnsetPath useKeys(JsonArray keys); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/sort/SearchSortScore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.sort; 17 | 18 | /** 19 | * Sort by the hit score. 20 | * 21 | * @author Michael Nitschinger 22 | * @since 2.4.5 23 | */ 24 | public class SearchSortScore extends SearchSort { 25 | 26 | @Override 27 | protected String identifier() { 28 | return "score"; 29 | } 30 | 31 | @Override 32 | public SearchSortScore descending(boolean descending) { 33 | super.descending(descending); 34 | return this; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultLimitPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.element.LimitElement; 19 | 20 | 21 | public class DefaultLimitPath extends DefaultOffsetPath implements LimitPath { 22 | 23 | public DefaultLimitPath(AbstractPath parent) { 24 | super(parent); 25 | } 26 | 27 | @Override 28 | public OffsetPath limit(int limit) { 29 | element(new LimitElement(limit)); 30 | return new DefaultOffsetPath(this); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/MutateWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | 20 | public interface MutateWherePath extends MutateLimitPath { 21 | 22 | /** 23 | * Filter resulting rows based on the given expression. 24 | * 25 | * @param expression the filter expression. 26 | * @return the next possible steps. 27 | */ 28 | MutateLimitPath where(Expression expression); 29 | 30 | MutateLimitPath where(String expression); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/Element.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * The Element interface describes keywords in the N1QL DSL. 23 | * 24 | * @author Michael Nitschinger 25 | */ 26 | @InterfaceStability.Experimental 27 | @InterfaceAudience.Private 28 | public interface Element { 29 | 30 | public static final String ESCAPE_CHAR = "`"; 31 | 32 | String export(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/HighlightStyle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * Enumeration of the highlighting styles recognized by the FTS engine. 23 | * 24 | * @author Simon Baslé 25 | * @author Michael Nitschinger 26 | * @since 2.3.0 27 | */ 28 | @InterfaceStability.Uncommitted 29 | @InterfaceAudience.Public 30 | public enum HighlightStyle { 31 | HTML, 32 | ANSI, 33 | SERVER_DEFAULT 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/view/Stale.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.view; 17 | 18 | /** 19 | * Sets the staleness requirement for the view query. 20 | * 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public enum Stale { 25 | 26 | TRUE("ok"), 27 | 28 | FALSE("false"), 29 | 30 | UPDATE_AFTER("update_after"); 31 | 32 | private String identifier; 33 | 34 | private Stale(String identifier) { 35 | this.identifier = identifier; 36 | } 37 | 38 | public String identifier() { 39 | return identifier; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMutateLimitPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.element.LimitElement; 19 | 20 | public class DefaultMutateLimitPath extends DefaultReturningPath implements MutateLimitPath { 21 | 22 | public DefaultMutateLimitPath(AbstractPath parent) { 23 | super(parent); 24 | } 25 | 26 | @Override 27 | public ReturningPath limit(int limit) { 28 | element(new LimitElement(limit)); 29 | return new DefaultReturningPath(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/AsElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | @InterfaceStability.Experimental 22 | @InterfaceAudience.Private 23 | public class AsElement implements Element { 24 | 25 | private final String as; 26 | 27 | public AsElement(String as) { 28 | this.as = as; 29 | } 30 | 31 | @Override 32 | public String export() { 33 | return "AS " + as; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/NestedLoopJoinHintElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * Hint to use Nested loop join 23 | * 24 | * @author Subhashni Balakrishnan 25 | */ 26 | @InterfaceStability.Experimental 27 | @InterfaceAudience.Private 28 | public class NestedLoopJoinHintElement implements Element { 29 | 30 | @Override 31 | public String export() { 32 | return "USE NL"; 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultAsPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.element.AsElement; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public class DefaultAsPath extends DefaultHintPath implements AsPath { 26 | 27 | public DefaultAsPath(AbstractPath parent) { 28 | super(parent); 29 | } 30 | 31 | @Override 32 | public HintPath as(String alias) { 33 | element(new AsElement(alias)); 34 | return new DefaultHintPath(this); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultNestPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.element.AsElement; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public class DefaultNestPath extends DefaultKeysPath implements NestPath { 26 | 27 | public DefaultNestPath(AbstractPath parent) { 28 | super(parent); 29 | } 30 | 31 | @Override 32 | public KeysPath as(String alias) { 33 | element(new AsElement(alias)); 34 | return new DefaultKeysPath(this); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/FromElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | @InterfaceStability.Experimental 22 | @InterfaceAudience.Private 23 | public class FromElement implements Element { 24 | 25 | private final String from; 26 | 27 | public FromElement(String from) { 28 | this.from = from; 29 | } 30 | 31 | @Override 32 | public String export() { 33 | return "FROM " + from; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultUnnestPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.element.AsElement; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public class DefaultUnnestPath extends DefaultLetPath implements UnnestPath { 26 | 27 | public DefaultUnnestPath(AbstractPath parent) { 28 | super(parent); 29 | } 30 | 31 | @Override 32 | public LetPath as(String alias) { 33 | element(new AsElement(alias)); 34 | return new DefaultLetPath(this); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/LimitElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | @InterfaceStability.Experimental 22 | @InterfaceAudience.Private 23 | public class LimitElement implements Element { 24 | 25 | private final int limit; 26 | 27 | public LimitElement(int limit) { 28 | this.limit = limit; 29 | } 30 | 31 | @Override 32 | public String export() { 33 | return "LIMIT " + limit; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/OffsetElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | @InterfaceStability.Experimental 22 | @InterfaceAudience.Private 23 | public class OffsetElement implements Element { 24 | 25 | private int offset; 26 | 27 | public OffsetElement(int offset) { 28 | this.offset = offset; 29 | } 30 | 31 | @Override 32 | public String export() { 33 | return "OFFSET " + offset; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/ReturningPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.Statement; 19 | import com.couchbase.client.java.query.dsl.Expression; 20 | 21 | public interface ReturningPath extends Statement, Path { 22 | 23 | Statement returning(String expression); 24 | Statement returning(Expression expression); 25 | 26 | Statement returningRaw(String expression); 27 | Statement returningRaw(Expression expression); 28 | 29 | Statement returningElement(String expression); 30 | Statement returningElement(Expression expression); 31 | 32 | } -------------------------------------------------------------------------------- /docs/teaser.html: -------------------------------------------------------------------------------- 1 | 2 |

Welcome to the Couchbase Java SDK API Reference!

3 | 4 |

Here is a simple hello world that you can run and verify your installation works:

5 | 6 |
 7 |     // Connect to a cluster on localhost
 8 |     Cluster cluster = CouchbaseCluster.create();
 9 |     cluster.authenticate("username", "password");
10 | 
11 |     // Open the default bucket
12 |     Bucket bucket = cluster.openBucket("myTestBucket");
13 | 
14 |     // Create a user and insert it
15 |     JsonObject user = JsonObject.empty()
16 |         .put("firstname", "Walter")
17 |         .put("lastname", "White")
18 |         .put("job", "chemistry teacher")
19 |         .put("age", 50);
20 |     JsonDocument doc = JsonDocument.create("walter", user);
21 |     JsonDocument response = bucket.upsert(doc);
22 | 
23 |     // Read it back out
24 |     JsonDocument walter = bucket.get("walter");
25 |     System.out.println("Found: " + walter);
26 | 
27 |     // Disconnect from the cluster
28 |     cluster.disconnect();
29 |     
30 | 31 |

32 | If you don't know where to go next, start at the CouchbaseCluster class! 33 |

34 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/FtsConsistencyTimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * An exception denoting that the search engine couldn't satisfy an FTS request with 22 | * consistency before the specified timeout. 23 | * 24 | * @author Simon Baslé 25 | * @since 2.3 26 | */ 27 | public class FtsConsistencyTimeoutException extends CouchbaseException { 28 | 29 | public FtsConsistencyTimeoutException() { 30 | super("The requested consistency level could not be satisfied before the timeout was reached"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/GroupByPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.Expression; 21 | 22 | /** 23 | * . 24 | * 25 | * @author Michael Nitschinger 26 | */ 27 | @InterfaceStability.Experimental 28 | @InterfaceAudience.Public 29 | public interface GroupByPath extends SelectResultPath { 30 | 31 | LettingPath groupBy(Expression... expressions); 32 | 33 | LettingPath groupBy(String... identifiers); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/SearchConsistency.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * An enum listing the various consistency levels for FTS searches 23 | * that don't need additional parameters (like a mutation token vector). 24 | * 25 | * @author Simon Baslé 26 | * @since 2.3 27 | */ 28 | @InterfaceStability.Uncommitted 29 | @InterfaceAudience.Public 30 | public enum SearchConsistency { 31 | 32 | NOT_BOUNDED; 33 | //TODO in Spock, add REQUEST_PLUS 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMergeDeletePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.MergeDeleteElement; 20 | 21 | 22 | public class DefaultMergeDeletePath extends DefaultMergeInsertPath implements MergeDeletePath { 23 | 24 | public DefaultMergeDeletePath(AbstractPath parent) { 25 | super(parent); 26 | } 27 | 28 | 29 | @Override 30 | public MergeDeleteWherePath whenMatchedThenDelete() { 31 | element(new MergeDeleteElement()); 32 | return new DefaultMergeDeleteWherePath(this); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultOffsetPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.Statement; 19 | import com.couchbase.client.java.query.dsl.element.OffsetElement; 20 | 21 | /** 22 | * . 23 | * 24 | * @author Michael Nitschinger 25 | */ 26 | public class DefaultOffsetPath extends AbstractPath implements OffsetPath { 27 | 28 | public DefaultOffsetPath(AbstractPath parent) { 29 | super(parent); 30 | } 31 | 32 | @Override 33 | public Statement offset(int offset) { 34 | element(new OffsetElement(offset)); 35 | return this; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/facet/TermFacet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.facet; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * A facet that gives the number of occurrences of the most recurring terms in all hits. 23 | * 24 | * @author Simon Baslé 25 | * @author Michael Nitschinger 26 | * @since 2.3.0 27 | */ 28 | @InterfaceStability.Uncommitted 29 | @InterfaceAudience.Public 30 | public class TermFacet extends SearchFacet { 31 | 32 | TermFacet(String field, int limit) { 33 | super(field, limit); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/com/couchbase/client/java/util/AnalyticsIngesterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.util; 18 | 19 | import org.junit.Test; 20 | 21 | import static com.couchbase.client.java.util.AnalyticsIngester.IngestOptions.ingestOptions; 22 | 23 | /** 24 | * Verifies the functionality of the {@link AnalyticsIngester}. 25 | */ 26 | public class AnalyticsIngesterTest { 27 | 28 | @Test(expected = IllegalArgumentException.class) 29 | public void shouldNotAllowReplaceAndUUID() { 30 | AnalyticsIngester.ingest( 31 | null, 32 | null, 33 | ingestOptions().ingestMethod(AnalyticsIngester.IngestMethod.REPLACE) 34 | ); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/N1qlQueryRow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.document.json.JsonObject; 21 | 22 | @InterfaceStability.Committed 23 | @InterfaceAudience.Public 24 | public interface N1qlQueryRow { 25 | 26 | /** 27 | * @return the raw array of bytes representing the JSON of this row. 28 | */ 29 | byte[] byteValue(); 30 | 31 | /** 32 | * @return the {@link JsonObject} representation of the JSON corresponding to this row. 33 | */ 34 | JsonObject value(); 35 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/index/BuildIndexPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path.index; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.path.Path; 21 | 22 | /** 23 | * Starting path of the Index building DSL. 24 | * 25 | * @author Simon Baslé 26 | * @since 2.2 27 | */ 28 | @InterfaceStability.Experimental 29 | @InterfaceAudience.Public 30 | public interface BuildIndexPath extends Path { 31 | 32 | IndexNamesPath on(String namespace, String keyspace); 33 | 34 | IndexNamesPath on(String keyspace); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/repository/annotation/Id.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.repository.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Identifies a field which will not be stored in the document but rather 26 | * used as the document ID. 27 | * 28 | * @author Michael Nitschinger 29 | * @since 2.2.0 30 | */ 31 | @Documented 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE }) 34 | public @interface Id { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMergeInsertPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.MergeInsertElement; 20 | 21 | 22 | public class DefaultMergeInsertPath extends DefaultMutateLimitPath implements MergeInsertPath { 23 | 24 | public DefaultMergeInsertPath(AbstractPath parent) { 25 | super(parent); 26 | } 27 | 28 | @Override 29 | public MergeInsertWherePath whenNotMatchedThenInsert(Expression expression) { 30 | element(new MergeInsertElement(expression)); 31 | return new DefaultMergeInsertWherePath(this); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/repository/mapping/RepositoryMappingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.repository.mapping; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | public class RepositoryMappingException extends CouchbaseException { 21 | 22 | public RepositoryMappingException() { 23 | super(); 24 | } 25 | 26 | public RepositoryMappingException(String message) { 27 | super(message); 28 | } 29 | 30 | public RepositoryMappingException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | public RepositoryMappingException(Throwable cause) { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultLettingPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Alias; 19 | import com.couchbase.client.java.query.dsl.element.LettingElement; 20 | 21 | /** 22 | * . 23 | * 24 | * @author Michael Nitschinger 25 | */ 26 | public class DefaultLettingPath extends DefaultHavingPath implements LettingPath { 27 | 28 | public DefaultLettingPath(AbstractPath parent) { 29 | super(parent); 30 | } 31 | 32 | @Override 33 | public HavingPath letting(Alias... aliases) { 34 | element(new LettingElement(aliases)); 35 | return new DefaultHavingPath(this); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/index/UsingWithPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path.index; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * Using path of the Index creation DSL. 23 | * 24 | * @author Simon Baslé 25 | * @since 2.2 26 | */ 27 | @InterfaceStability.Experimental 28 | @InterfaceAudience.Public 29 | public interface UsingWithPath extends WithPath { 30 | 31 | /** 32 | * Describes what kind of index to create. 33 | * 34 | * @param type the type of index to create. 35 | */ 36 | WithPath using(IndexType type); 37 | 38 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/result/facets/TermFacetResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.result.facets; 17 | 18 | import java.util.List; 19 | 20 | import com.couchbase.client.core.annotations.InterfaceAudience; 21 | import com.couchbase.client.core.annotations.InterfaceStability; 22 | import com.couchbase.client.java.search.facet.TermFacet; 23 | 24 | /** 25 | * Represents the result for a {@link TermFacet}. 26 | * 27 | * @author Simon Baslé 28 | * @author Michael Nitschinger 29 | * @since 2.3.0 30 | */ 31 | @InterfaceStability.Experimental 32 | @InterfaceAudience.Public 33 | public interface TermFacetResult extends FacetResult { 34 | 35 | List terms(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultOrderByPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.element.OrderByElement; 19 | import com.couchbase.client.java.query.dsl.Sort; 20 | 21 | /** 22 | * . 23 | * 24 | * @author Michael Nitschinger 25 | */ 26 | public class DefaultOrderByPath extends DefaultLimitPath implements OrderByPath { 27 | 28 | public DefaultOrderByPath(AbstractPath parent) { 29 | super(parent); 30 | } 31 | 32 | @Override 33 | public LimitPath orderBy(Sort... orderings) { 34 | element(new OrderByElement(orderings)); 35 | return new DefaultLimitPath(this); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/cluster/api/RestBuilderMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.cluster.api; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * Marker interface for {@link RestBuilder} and {@link AsyncRestBuilder}. 23 | * These builder classes can be used to incrementally construct REST API requests and execute 24 | * them. The execution is synchronous or asynchronous depending on the concrete builder type. 25 | * 26 | * @author Simon Baslé 27 | * @since 2.3.2 28 | */ 29 | @InterfaceAudience.Private 30 | @InterfaceStability.Experimental 31 | public interface RestBuilderMarker { } 32 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/TranscodingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public class TranscodingException extends CouchbaseException { 25 | 26 | public TranscodingException() { 27 | super(); 28 | } 29 | 30 | public TranscodingException(String message) { 31 | super(message); 32 | } 33 | 34 | public TranscodingException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public TranscodingException(Throwable cause) { 39 | super(cause); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/subdoc/DocumentNotJsonException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.error.subdoc; 18 | 19 | import com.couchbase.client.core.annotations.InterfaceAudience; 20 | import com.couchbase.client.core.annotations.InterfaceStability; 21 | 22 | /** 23 | * Subdocument exception thrown when the targeted enclosing document itself is not JSON. 24 | * 25 | * @author Simon Baslé 26 | * @since 2.2 27 | */ 28 | @InterfaceStability.Committed 29 | @InterfaceAudience.Public 30 | public class DocumentNotJsonException extends SubDocumentException { 31 | 32 | public DocumentNotJsonException(String id) { 33 | super("Document " + id + " is not a JSON document"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/AsyncN1qlQueryRow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.document.json.JsonObject; 21 | 22 | @InterfaceStability.Committed 23 | @InterfaceAudience.Public 24 | public interface AsyncN1qlQueryRow { 25 | 26 | /** 27 | * @return the raw array of bytes representing the JSON of this row. 28 | */ 29 | byte[] byteValue(); 30 | 31 | /** 32 | * @return the {@link JsonObject} representation of the JSON corresponding to this row. 33 | */ 34 | JsonObject value(); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/analytics/AnalyticsQueryRow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.analytics; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.document.json.JsonObject; 21 | 22 | @InterfaceStability.Committed 23 | @InterfaceAudience.Public 24 | public interface AnalyticsQueryRow { 25 | 26 | /** 27 | * @return the raw array of bytes representing the JSON of this row. 28 | */ 29 | byte[] byteValue(); 30 | 31 | /** 32 | * @return the {@link JsonObject} representation of the JSON corresponding to this row. 33 | */ 34 | JsonObject value(); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/FlushDisabledException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public class FlushDisabledException extends CouchbaseException { 25 | 26 | public FlushDisabledException() { 27 | super(); 28 | } 29 | 30 | public FlushDisabledException(String message) { 31 | super(message); 32 | } 33 | 34 | public FlushDisabledException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public FlushDisabledException(Throwable cause) { 39 | super(cause); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/analytics/AsyncAnalyticsQueryRow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.analytics; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.document.json.JsonObject; 21 | 22 | @InterfaceStability.Committed 23 | @InterfaceAudience.Public 24 | public interface AsyncAnalyticsQueryRow { 25 | 26 | /** 27 | * @return the raw array of bytes representing the JSON of this row. 28 | */ 29 | byte[] byteValue(); 30 | 31 | /** 32 | * @return the {@link JsonObject} representation of the JSON corresponding to this row. 33 | */ 34 | JsonObject value(); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/cluster/CompressionMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.cluster; 17 | 18 | /** 19 | * The compression mode used for bucket settings. 20 | */ 21 | public enum CompressionMode { 22 | 23 | /** 24 | * Compressed documents are accepted but actively decompressed 25 | * for storage in memory and for streaming. Not advised! 26 | */ 27 | OFF, 28 | 29 | /** 30 | * Compressed documents can be stored and streamed from the server, 31 | * but the server does not try to actively compress documents (client-initiated) 32 | */ 33 | PASSIVE, 34 | 35 | /** 36 | * The server will try to actively compress documents in memory 37 | */ 38 | ACTIVE 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/DesignDocumentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public class DesignDocumentException extends CouchbaseException { 25 | 26 | public DesignDocumentException() { 27 | super(); 28 | } 29 | 30 | public DesignDocumentException(String message) { 31 | super(message); 32 | } 33 | 34 | public DesignDocumentException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public DesignDocumentException(Throwable cause) { 39 | super(cause); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/result/facets/DateRangeFacetResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.result.facets; 17 | 18 | import java.util.List; 19 | 20 | import com.couchbase.client.core.annotations.InterfaceAudience; 21 | import com.couchbase.client.core.annotations.InterfaceStability; 22 | import com.couchbase.client.java.search.facet.DateRangeFacet; 23 | 24 | /** 25 | * Represents the result for a {@link DateRangeFacet}. 26 | * 27 | * @author Simon Baslé 28 | * @author Michael Nitschinger 29 | * @since 2.3.0 30 | */ 31 | @InterfaceStability.Experimental 32 | @InterfaceAudience.Public 33 | public interface DateRangeFacetResult extends FacetResult { 34 | 35 | List dateRanges(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/NamedPreparedStatementException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * An exception marking the fact that a Named Prepared Statement in N1QL couldn't be executed and 22 | * that there was a fallback to re-preparing it. 23 | * 24 | * @author Simon Baslé 25 | * @since 2.2 26 | */ 27 | public class NamedPreparedStatementException extends CouchbaseException { 28 | 29 | public NamedPreparedStatementException(String message) { 30 | super(message); 31 | } 32 | 33 | public NamedPreparedStatementException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultHavingPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.HavingElement; 20 | 21 | /** 22 | * . 23 | * 24 | * @author Michael Nitschinger 25 | */ 26 | public class DefaultHavingPath extends DefaultSelectResultPath implements HavingPath { 27 | 28 | public DefaultHavingPath(AbstractPath parent) { 29 | super(parent); 30 | } 31 | 32 | @Override 33 | public SelectResultPath having(Expression condition) { 34 | element(new HavingElement(condition)); 35 | return new DefaultSelectResultPath(this); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/WhereElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.Expression; 21 | 22 | @InterfaceStability.Experimental 23 | @InterfaceAudience.Private 24 | public class WhereElement implements Element { 25 | 26 | private final Expression expression; 27 | 28 | public WhereElement(final Expression expression) { 29 | this.expression = expression; 30 | } 31 | 32 | @Override 33 | public String export() { 34 | return "WHERE " + expression.toString(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/CannotRetryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | import com.couchbase.client.java.util.retry.Retry; 20 | 21 | /** 22 | * A {@link CouchbaseException} that denotes that a retry cycle failed because the maximum allowed attempt 23 | * count was reached. 24 | * 25 | * @see Retry 26 | * @author Simon Baslé 27 | * @since 1.1 28 | */ 29 | public class CannotRetryException extends CouchbaseException { 30 | 31 | public CannotRetryException(String message) { 32 | super(message); 33 | } 34 | 35 | public CannotRetryException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/DesignDocumentAlreadyExistsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | /** 19 | * @author Michael Nitschinger 20 | * @since 2.0 21 | */ 22 | public class DesignDocumentAlreadyExistsException extends DesignDocumentException { 23 | 24 | public DesignDocumentAlreadyExistsException() { 25 | super(); 26 | } 27 | 28 | public DesignDocumentAlreadyExistsException(String message) { 29 | super(message); 30 | } 31 | 32 | public DesignDocumentAlreadyExistsException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | public DesignDocumentAlreadyExistsException(Throwable cause) { 37 | super(cause); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/ViewDoesNotExistException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public class ViewDoesNotExistException extends CouchbaseException { 25 | 26 | public ViewDoesNotExistException() { 27 | super(); 28 | } 29 | 30 | public ViewDoesNotExistException(String message) { 31 | super(message); 32 | } 33 | 34 | public ViewDoesNotExistException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public ViewDoesNotExistException(Throwable cause) { 39 | super(cause); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/HavingElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.Expression; 21 | 22 | @InterfaceStability.Experimental 23 | @InterfaceAudience.Private 24 | public class HavingElement implements Element { 25 | 26 | private final Expression expression; 27 | 28 | public HavingElement(Expression expression) { 29 | this.expression = expression; 30 | } 31 | 32 | @Override 33 | public String export() { 34 | return "HAVING " + expression.toString(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/result/facets/NumericRangeFacetResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.result.facets; 17 | 18 | import java.util.List; 19 | 20 | import com.couchbase.client.core.annotations.InterfaceAudience; 21 | import com.couchbase.client.core.annotations.InterfaceStability; 22 | import com.couchbase.client.java.search.facet.NumericRangeFacet; 23 | 24 | /** 25 | * Represents the result of a {@link NumericRangeFacet}. 26 | * 27 | * @author Simon Baslé 28 | * @author Michael Nitschinger 29 | * @since 2.3.0 30 | */ 31 | @InterfaceStability.Experimental 32 | @InterfaceAudience.Public 33 | public interface NumericRangeFacetResult extends FacetResult { 34 | 35 | List numericRanges(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/util/LRUCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.util; 17 | 18 | import java.util.LinkedHashMap; 19 | import java.util.Map; 20 | 21 | /** 22 | * Implements a generic LRU cache which evicts after the max size is reached. 23 | * 24 | * @author Michael Nitschinger 25 | * @since 2.2.0 26 | */ 27 | public class LRUCache extends LinkedHashMap { 28 | 29 | private final int maxCapacity; 30 | 31 | public LRUCache(final int maxCapacity) { 32 | super(maxCapacity + 1, 1.0f, true); 33 | this.maxCapacity = maxCapacity; 34 | } 35 | 36 | @Override 37 | protected boolean removeEldestEntry(Map.Entry eldest) { 38 | return super.size() > maxCapacity; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/CASMismatchException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Identifying a CAS mismatch on a replace operation.. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.0 25 | */ 26 | public class CASMismatchException extends CouchbaseException { 27 | 28 | public CASMismatchException() { 29 | super(); 30 | } 31 | 32 | public CASMismatchException(String message) { 33 | super(message); 34 | } 35 | 36 | public CASMismatchException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public CASMismatchException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/DurabilityException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Raised if the durability requirement could not be met. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.0 25 | */ 26 | public class DurabilityException extends CouchbaseException { 27 | 28 | public DurabilityException() { 29 | super(); 30 | } 31 | 32 | public DurabilityException(String message) { 33 | super(message); 34 | } 35 | 36 | public DurabilityException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public DurabilityException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/AuthenticationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Describes authentication issues, usually during bootstrap. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 1.6.0 25 | */ 26 | public class AuthenticationException extends CouchbaseException { 27 | 28 | public AuthenticationException() { 29 | } 30 | 31 | public AuthenticationException(String message) { 32 | super(message); 33 | } 34 | 35 | public AuthenticationException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public AuthenticationException(Throwable cause) { 40 | super(cause); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMergeUpdatePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.element.Element; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public class DefaultMergeUpdatePath extends DefaultMergeDeletePath implements MergeUpdatePath { 26 | 27 | public DefaultMergeUpdatePath(AbstractPath parent) { 28 | super(parent); 29 | } 30 | 31 | @Override 32 | public MergeUpdateSetOrUnsetPath whenMatchedThenUpdate() { 33 | element(new Element() { 34 | @Override 35 | public String export() { 36 | return "WHEN MATCHED THEN UPDATE"; 37 | } 38 | }); 39 | return new DefaultMergeUpdateSetOrUnsetPath(this); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/RequestTooBigException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Thrown when the request is too big for some reason. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.1.0 25 | */ 26 | public class RequestTooBigException extends CouchbaseException { 27 | 28 | public RequestTooBigException() { 29 | super(); 30 | } 31 | 32 | public RequestTooBigException(String message) { 33 | super(message); 34 | } 35 | 36 | public RequestTooBigException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public RequestTooBigException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/index/UsingPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path.index; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.Statement; 21 | import com.couchbase.client.java.query.dsl.path.Path; 22 | 23 | /** 24 | * Using path of the Index dropping DSL. 25 | * 26 | * @author Simon Baslé 27 | * @since 2.2 28 | */ 29 | @InterfaceStability.Experimental 30 | @InterfaceAudience.Public 31 | public interface UsingPath extends Path, Statement { 32 | 33 | /** 34 | * Describes the type of index to drop. 35 | * @param indexType the type of the index. 36 | */ 37 | Statement using(IndexType indexType); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/BucketDoesNotExistException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Exception identifying that a bucket does not exist. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.0 25 | */ 26 | public class BucketDoesNotExistException extends CouchbaseException { 27 | 28 | public BucketDoesNotExistException() { 29 | super(); 30 | } 31 | 32 | public BucketDoesNotExistException(String message) { 33 | super(message); 34 | } 35 | 36 | public BucketDoesNotExistException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public BucketDoesNotExistException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/BucketAlreadyExistsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Exception identifying that a bucket does already exist. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.0 25 | */ 26 | public class BucketAlreadyExistsException extends CouchbaseException { 27 | 28 | public BucketAlreadyExistsException() { 29 | super(); 30 | } 31 | 32 | public BucketAlreadyExistsException(String message) { 33 | super(message); 34 | } 35 | 36 | public BucketAlreadyExistsException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public BucketAlreadyExistsException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/DesignDocumentDoesNotExistException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | /** 19 | * Exception to indicate that Design document does not exist in the server 20 | * 21 | * @author Subhashni Balakrishnan 22 | * @since 2.4.0 23 | */ 24 | public class DesignDocumentDoesNotExistException extends DesignDocumentException { 25 | 26 | public DesignDocumentDoesNotExistException() { 27 | super(); 28 | } 29 | 30 | public DesignDocumentDoesNotExistException(String message) { 31 | super(message); 32 | } 33 | 34 | public DesignDocumentDoesNotExistException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | public DesignDocumentDoesNotExistException(Throwable cause) { 39 | super(cause); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/InvalidPasswordException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * This exception is commonly raised when the password for a resource does not match. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.0 25 | */ 26 | public class InvalidPasswordException extends CouchbaseException { 27 | 28 | public InvalidPasswordException() { 29 | super(); 30 | } 31 | 32 | public InvalidPasswordException(String message) { 33 | super(message); 34 | } 35 | 36 | public InvalidPasswordException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public InvalidPasswordException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/integration/java/com/couchbase/client/java/BucketInfoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java; 17 | 18 | import com.couchbase.client.java.bucket.BucketInfo; 19 | import com.couchbase.client.java.bucket.BucketType; 20 | import com.couchbase.client.java.util.ClusterDependentTest; 21 | import org.junit.Test; 22 | 23 | import static org.junit.Assert.*; 24 | 25 | public class BucketInfoTest extends ClusterDependentTest { 26 | 27 | @Test 28 | public void shouldLoadBucketInfo() { 29 | BucketInfo info = bucket().bucketManager().info(); 30 | 31 | assertEquals(BucketType.COUCHBASE, info.type()); 32 | assertEquals(bucketName(), info.name()); 33 | assertTrue(info.nodeCount() > 0); 34 | assertEquals(info.nodeCount(), info.nodeList().size()); 35 | assertNotNull(info.raw()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/CouchbaseOutOfMemoryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Thrown when Couchbase Server returns with an Out of Memory error. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.1.0 25 | */ 26 | public class CouchbaseOutOfMemoryException extends CouchbaseException { 27 | 28 | public CouchbaseOutOfMemoryException() { 29 | super(); 30 | } 31 | 32 | public CouchbaseOutOfMemoryException(String message) { 33 | super(message); 34 | } 35 | 36 | public CouchbaseOutOfMemoryException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public CouchbaseOutOfMemoryException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/DocumentDoesNotExistException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Raised when the document does not exist and a replace operation is used.. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.0 25 | */ 26 | public class DocumentDoesNotExistException extends CouchbaseException { 27 | 28 | public DocumentDoesNotExistException() { 29 | super(); 30 | } 31 | 32 | public DocumentDoesNotExistException(String message) { 33 | super(message); 34 | } 35 | 36 | public DocumentDoesNotExistException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public DocumentDoesNotExistException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/UsingElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.path.index.IndexType; 21 | 22 | /** 23 | * Element of the Index DSL that describes what kind of index to build. 24 | * 25 | * @author Simon Baslé 26 | * @since 2.2 27 | */ 28 | @InterfaceStability.Experimental 29 | @InterfaceAudience.Private 30 | public class UsingElement implements Element { 31 | private final IndexType type; 32 | 33 | public UsingElement(IndexType type) { 34 | this.type = type; 35 | } 36 | 37 | @Override 38 | public String export() { 39 | return "USING " + type.name(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/com/couchbase/client/java/auth/CertAuthenticatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.auth; 17 | 18 | import org.junit.Test; 19 | 20 | import java.util.List; 21 | 22 | import static org.junit.Assert.*; 23 | 24 | /** 25 | * Verifies the functionality of the {@link CertAuthenticator}. 26 | * 27 | * @author Michael Nitschinger 28 | * @since 1.6.0 29 | */ 30 | public class CertAuthenticatorTest { 31 | 32 | @Test 33 | public void getCredentials() { 34 | List creds = CertAuthenticator.INSTANCE.getCredentials(CredentialContext.BUCKET_KV, null); 35 | assertEquals(1, creds.size()); 36 | assertNull(creds.get(0).login()); 37 | assertNull(creds.get(0).password()); 38 | } 39 | 40 | @Test 41 | public void isEmpty() { 42 | assertFalse(CertAuthenticator.INSTANCE.isEmpty()); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/DocumentAlreadyExistsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Raised when the document already exists and an insert operation is used.. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.0 25 | */ 26 | public class DocumentAlreadyExistsException extends CouchbaseException { 27 | 28 | public DocumentAlreadyExistsException() { 29 | super(); 30 | } 31 | 32 | public DocumentAlreadyExistsException(String message) { 33 | super(message); 34 | } 35 | 36 | public DocumentAlreadyExistsException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public DocumentAlreadyExistsException(Throwable cause) { 41 | super(cause); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/subdoc/NumberTooBigException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.error.subdoc; 18 | 19 | import com.couchbase.client.core.annotations.InterfaceAudience; 20 | import com.couchbase.client.core.annotations.InterfaceStability; 21 | 22 | /** 23 | * Subdocument exception thrown when existing number value in document is too big. 24 | * 25 | * The value is interpreted as 64 bit on the server side so the acceptable range 26 | * is that of Java's long ({@link Long#MIN_VALUE} to {@link Long#MAX_VALUE}). 27 | * 28 | * @author Simon Baslé 29 | * @since 2.2 30 | */ 31 | @InterfaceStability.Committed 32 | @InterfaceAudience.Public 33 | public class NumberTooBigException extends SubDocumentException { 34 | 35 | public NumberTooBigException() { 36 | super("Current stored numeric value is too big"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/repository/annotation/Field.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.repository.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Documented 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE }) 27 | public @interface Field { 28 | 29 | /** 30 | * The actual name of the field inside the JSON document. 31 | * 32 | * It can be used to shorten or rename/map field names to save space 33 | * or provide additional compatibility. 34 | * 35 | * @return the actual name of the field inside the document. 36 | */ 37 | String value() default ""; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/integration/java/com/couchbase/client/java/AnalyticsDeferredQueryTest.java: -------------------------------------------------------------------------------- 1 | package com.couchbase.client.java; 2 | 3 | import java.util.Iterator; 4 | 5 | import com.couchbase.client.java.analytics.AnalyticsDeferredResultHandle; 6 | import com.couchbase.client.java.analytics.AnalyticsParams; 7 | import com.couchbase.client.java.analytics.AnalyticsQuery; 8 | import com.couchbase.client.java.analytics.AnalyticsQueryResult; 9 | import com.couchbase.client.java.analytics.AnalyticsQueryRow; 10 | 11 | /** 12 | * Stand alone test for now as it is experimental 13 | */ 14 | public class AnalyticsDeferredQueryTest { 15 | 16 | public static void main(String... args) throws Exception { 17 | Cluster cluster = CouchbaseCluster.create(); 18 | cluster.authenticate("Administrator", "password"); 19 | Bucket bucket = cluster.openBucket("default"); 20 | 21 | AnalyticsQueryResult result = bucket.query(AnalyticsQuery.simple("SELECT 1=1;", AnalyticsParams.build().deferred(true))); 22 | 23 | byte[] serialized = bucket.exportAnalyticsDeferredResultHandle(result.handle()); 24 | AnalyticsDeferredResultHandle handle = bucket.importAnalyticsDeferredResultHandle(serialized); 25 | 26 | while(!handle.status().equalsIgnoreCase("success")) { 27 | Thread.sleep(100); 28 | handle.status(); 29 | } 30 | Iterator it = handle.rows(); 31 | while (it.hasNext()) { 32 | System.out.println(it.next()); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMergeUpdateWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.WhereElement; 20 | 21 | import static com.couchbase.client.java.query.dsl.Expression.x; 22 | 23 | public class DefaultMergeUpdateWherePath extends DefaultMergeDeletePath implements MergeUpdateWherePath { 24 | 25 | public DefaultMergeUpdateWherePath(AbstractPath parent) { 26 | super(parent); 27 | } 28 | 29 | @Override 30 | public MergeDeletePath where(Expression expression) { 31 | element(new WhereElement(expression)); 32 | return new DefaultMergeDeletePath(this); 33 | } 34 | 35 | @Override 36 | public MergeDeletePath where(String expression) { 37 | return where(x(expression)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/SelectResultPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | /** 19 | * . 20 | * 21 | * @author Michael Nitschinger 22 | */ 23 | public interface SelectResultPath extends OrderByPath { 24 | 25 | SelectPath union(); 26 | 27 | SelectPath unionAll(); 28 | 29 | SelectPath intersect(); 30 | 31 | SelectPath intersectAll(); 32 | 33 | SelectPath except(); 34 | 35 | SelectPath exceptAll(); 36 | 37 | SelectResultPath union(SelectResultPath path); 38 | 39 | SelectResultPath unionAll(SelectResultPath path); 40 | 41 | SelectResultPath intersect(SelectResultPath path); 42 | 43 | SelectResultPath intersectAll(SelectResultPath path); 44 | 45 | SelectResultPath except(SelectResultPath path); 46 | 47 | SelectResultPath exceptAll(SelectResultPath path); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/TemporaryFailureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.core.CouchbaseException; 19 | 20 | /** 21 | * Thrown when the server reports a temporary failure. 22 | * 23 | * This is exception is very likely retryable. 24 | * 25 | * @author Michael Nitschinger 26 | * @since 2.1.0 27 | */ 28 | public class TemporaryFailureException extends CouchbaseException { 29 | 30 | public TemporaryFailureException() { 31 | super(); 32 | } 33 | 34 | public TemporaryFailureException(String message) { 35 | super(message); 36 | } 37 | 38 | public TemporaryFailureException(String message, Throwable cause) { 39 | super(message, cause); 40 | } 41 | 42 | public TemporaryFailureException(Throwable cause) { 43 | super(cause); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/functions/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Functions are {@link com.couchbase.client.java.query.dsl.Expression Expressions} that represent predefined utility 19 | * functions in N1QL. The xxxFunctions classes each map to a N1QL category of functions. Some other 20 | * utility methods allow you to build constructs that are not functions per se but can also be used in many places 21 | * where an Expression is accepted: see {@link com.couchbase.client.java.query.dsl.functions.Collections}, 22 | * {@link com.couchbase.client.java.query.dsl.functions.Case}. 23 | * 24 | * For more specialized Expression builders that don't apply everywhere but only on specific parts of a N1QL statement, 25 | * see {@link com.couchbase.client.java.query.dsl.clause clauses}. 26 | */ 27 | package com.couchbase.client.java.query.dsl.functions; -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMergeInsertWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.WhereElement; 20 | 21 | import static com.couchbase.client.java.query.dsl.Expression.x; 22 | 23 | 24 | public class DefaultMergeInsertWherePath extends DefaultMutateLimitPath implements MergeInsertWherePath { 25 | 26 | public DefaultMergeInsertWherePath(AbstractPath parent) { 27 | super(parent); 28 | } 29 | 30 | @Override 31 | public MutateLimitPath where(Expression expression) { 32 | element(new WhereElement(expression)); 33 | return new DefaultMutateLimitPath(this); 34 | } 35 | 36 | @Override 37 | public MutateLimitPath where(String expression) { 38 | return where(x(expression)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/subdoc/PathNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.error.subdoc; 18 | 19 | import com.couchbase.client.core.annotations.InterfaceAudience; 20 | import com.couchbase.client.core.annotations.InterfaceStability; 21 | 22 | /** 23 | * Subdocument exception thrown when a path does not exist in the document. 24 | * The exact meaning of path existence depends on the operation and inputs. 25 | * 26 | * @author Simon Baslé 27 | * @since 2.2 28 | */ 29 | @InterfaceStability.Committed 30 | @InterfaceAudience.Public 31 | public class PathNotFoundException extends SubDocumentException { 32 | 33 | public PathNotFoundException(String id, String path) { 34 | super("Path " + path + " not found in document " + id); 35 | } 36 | 37 | public PathNotFoundException(String reason) { 38 | super(reason); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMutateWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.WhereElement; 20 | 21 | import static com.couchbase.client.java.query.dsl.Expression.x; 22 | 23 | public class DefaultMutateWherePath extends DefaultMutateLimitPath implements MutateWherePath { 24 | 25 | public DefaultMutateWherePath(AbstractPath parent) { 26 | super(parent); 27 | } 28 | 29 | @Override 30 | public MutateLimitPath where(Expression expression) { 31 | element(new WhereElement(expression)); 32 | return new DefaultMutateLimitPath(this); 33 | } 34 | 35 | @Override 36 | public MutateLimitPath where(String expression) { 37 | return where(x(expression)); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/repository/annotation/EncryptedField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.repository.annotation; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | import com.couchbase.client.core.annotations.InterfaceStability; 26 | 27 | /** 28 | * Annotation for encrypted field 29 | * 30 | * @author Subhashni Balakrishnan 31 | * @since 2.6.0 32 | */ 33 | @Documented 34 | @Retention(RetentionPolicy.RUNTIME) 35 | @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE }) 36 | public @interface EncryptedField { 37 | 38 | /** 39 | * Cryptographic algorithm provider name 40 | * 41 | * @return name of the provider 42 | */ 43 | String provider(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/auth/CredentialContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.auth; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * Enum of the contexts that can be used to retrieve an implicit credential from an 23 | * {@link Authenticator}. Note that not all Authenticator implementations will support 24 | * all these contexts, and some contexts may also require additional information (a 25 | * "specific"). 26 | * 27 | * @author Simon Baslé 28 | * @since 2.3 29 | */ 30 | @InterfaceStability.Committed 31 | @InterfaceAudience.Public 32 | public enum CredentialContext { 33 | 34 | BUCKET_KV, BUCKET_VIEW, BUCKET_N1QL, BUCKET_FTS, BUCKET_ANALYTICS, 35 | CLUSTER_N1QL, CLUSTER_FTS, CLUSTER_ANALYTICS, 36 | BUCKET_MANAGEMENT, CLUSTER_MANAGEMENT 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/MergeInsertElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.Expression; 21 | 22 | @InterfaceStability.Experimental 23 | @InterfaceAudience.Private 24 | public class MergeInsertElement implements Element { 25 | 26 | private final Expression expression; 27 | 28 | public MergeInsertElement(Expression expression) { 29 | if (expression == null) { 30 | throw new IllegalArgumentException("Expression on Merge Insert is required."); 31 | } 32 | 33 | this.expression = expression; 34 | } 35 | 36 | @Override 37 | public String export() { 38 | return "WHEN NOT MATCHED THEN INSERT " + expression.toString(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/SelectPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public interface SelectPath extends Path { 26 | 27 | FromPath select(Expression... expressions); 28 | 29 | FromPath select(String... expressions); 30 | 31 | FromPath selectAll(Expression... expressions); 32 | 33 | FromPath selectAll(String... expressions); 34 | 35 | FromPath selectDistinct(Expression... expressions); 36 | 37 | FromPath selectDistinct(String... expressions); 38 | 39 | FromPath selectRaw(Expression expression); 40 | 41 | FromPath selectRaw(String expression); 42 | 43 | FromPath selectDistinctRaw(Expression expression); 44 | 45 | FromPath selectDistinctRaw(String expression); 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/subdoc/PathInvalidException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.error.subdoc; 18 | 19 | import com.couchbase.client.core.annotations.InterfaceAudience; 20 | import com.couchbase.client.core.annotations.InterfaceStability; 21 | 22 | /** 23 | * Subdocument exception thrown when path has a syntax error, or path syntax is incorrect for the operation 24 | * (for example, if operation requires an array index). 25 | * 26 | * @author Simon Baslé 27 | * @since 2.2 28 | */ 29 | @InterfaceStability.Committed 30 | @InterfaceAudience.Public 31 | public class PathInvalidException extends SubDocumentException { 32 | 33 | public PathInvalidException(String id, String path) { 34 | super("Path " + path + " is malformed or invalid in " + id); 35 | } 36 | 37 | public PathInvalidException(String reason) { 38 | super(reason); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/Alias.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl; 17 | 18 | import static com.couchbase.client.java.query.dsl.Expression.x; 19 | 20 | /** 21 | * . 22 | * 23 | * @author Michael Nitschinger 24 | */ 25 | public class Alias { 26 | 27 | private final String alias; 28 | private final Expression original; 29 | 30 | private Alias(String alias, Expression original) { 31 | this.alias = alias; 32 | this.original = original; 33 | } 34 | 35 | public static Alias alias(String alias, Expression original) { 36 | return new Alias(alias, original); 37 | } 38 | 39 | public static Alias alias(String alias, String original) { 40 | return new Alias(alias, x(original)); 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return alias + " = " + original.toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/HashJoinHintElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.query.dsl.path; 18 | 19 | import java.util.Objects; 20 | 21 | import com.couchbase.client.core.annotations.InterfaceAudience; 22 | import com.couchbase.client.core.annotations.InterfaceStability; 23 | import com.couchbase.client.java.query.dsl.element.Element; 24 | 25 | /** 26 | * Hash Join hint for hash based join 27 | * 28 | * @author Subhashni Balakrishnan 29 | */ 30 | @InterfaceStability.Experimental 31 | @InterfaceAudience.Private 32 | public class HashJoinHintElement implements Element { 33 | 34 | private final HashSide side; 35 | 36 | public HashJoinHintElement(HashSide side) { 37 | Objects.requireNonNull(side); 38 | this.side = side; 39 | } 40 | 41 | @Override 42 | public String export() { 43 | return "USE HASH(" + this.side + ")"; 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/subdoc/PathMismatchException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.error.subdoc; 18 | 19 | import com.couchbase.client.core.annotations.InterfaceAudience; 20 | import com.couchbase.client.core.annotations.InterfaceStability; 21 | 22 | /** 23 | * Subdocument exception thrown when the path structure conflicts with the document structure 24 | * (for example, if a path mentions foo.bar[0].baz, but foo.bar is actually a JSON object). 25 | * 26 | * @author Simon Baslé 27 | * @since 2.2 28 | */ 29 | @InterfaceStability.Committed 30 | @InterfaceAudience.Public 31 | public class PathMismatchException extends SubDocumentException { 32 | 33 | public PathMismatchException(String id, String path) { 34 | super("Path mismatch \"" + path + "\" in " + id); 35 | } 36 | 37 | public PathMismatchException(String reason) { 38 | super(reason); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.WhereElement; 20 | 21 | import static com.couchbase.client.java.query.dsl.Expression.x; 22 | 23 | /** 24 | * . 25 | * 26 | * @author Michael Nitschinger 27 | */ 28 | public class DefaultWherePath extends DefaultGroupByPath implements WherePath { 29 | 30 | public DefaultWherePath(AbstractPath parent) { 31 | super(parent); 32 | } 33 | 34 | @Override 35 | public GroupByPath where(Expression expression) { 36 | element(new WhereElement(expression)); 37 | return new DefaultGroupByPath(this); 38 | } 39 | 40 | @Override 41 | public GroupByPath where(String expression) { 42 | return where(x(expression)); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/result/SearchMetrics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.result; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * Provides statistics on an FTS query result (number of hits, time taken...). 23 | * 24 | * @author Simon Baslé 25 | * @author Michael Nitschinger 26 | * @since 2.3.0 27 | */ 28 | @InterfaceStability.Committed 29 | @InterfaceAudience.Public 30 | public interface SearchMetrics { 31 | 32 | /** 33 | * The number of nanoseconds the request took executing on the server side. 34 | */ 35 | long took(); 36 | 37 | /** 38 | * The total number of hits (or {@link SearchQueryRow}) in the result. 39 | */ 40 | long totalHits(); 41 | 42 | /** 43 | * The largest score amongst the hits. 44 | */ 45 | double maxScore(); 46 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/cluster/AuthDomain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.cluster; 17 | 18 | /** 19 | * The possible authentication domains that can be used when managing users with RBAC. 20 | * 21 | * @author Michael Nitschinger 22 | * @since 2.5.0 23 | */ 24 | public enum AuthDomain { 25 | LOCAL("local"), 26 | EXTERNAL("external"); 27 | 28 | private final String alias; 29 | 30 | AuthDomain(String alias) { 31 | this.alias = alias; 32 | } 33 | 34 | public String alias() { 35 | return alias; 36 | } 37 | 38 | public static AuthDomain fromAlias(final String alias) { 39 | if (alias.equalsIgnoreCase("local")) { 40 | return LOCAL; 41 | } else if (alias.equalsIgnoreCase("external")) { 42 | return EXTERNAL; 43 | } else { 44 | throw new IllegalStateException("unknown alias:" + alias); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMergeDeleteWherePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.WhereElement; 20 | 21 | import static com.couchbase.client.java.query.dsl.Expression.x; 22 | 23 | /** 24 | * . 25 | * 26 | * @author Michael Nitschinger 27 | */ 28 | public class DefaultMergeDeleteWherePath extends DefaultMergeInsertPath implements MergeDeleteWherePath { 29 | 30 | public DefaultMergeDeleteWherePath(AbstractPath parent) { 31 | super(parent); 32 | } 33 | 34 | @Override 35 | public MergeInsertPath where(Expression expression) { 36 | element(new WhereElement(expression)); 37 | return new DefaultMergeInsertPath(this); 38 | } 39 | 40 | @Override 41 | public MergeInsertPath where(String expression) { 42 | return where(x(expression)); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/MixedAuthenticationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error; 17 | 18 | import com.couchbase.client.java.auth.PasswordAuthenticator; 19 | 20 | /** 21 | * This exception is commonly raised when the {@link PasswordAuthenticator} 22 | * containing RBAC user credentials and bucket credentials are used together 23 | * 24 | * @author Subhashni Balakrishnan 25 | * @since 2.4.4 26 | */ 27 | public class MixedAuthenticationException extends AuthenticationException { 28 | 29 | public MixedAuthenticationException() { 30 | super(); 31 | } 32 | 33 | public MixedAuthenticationException(String message) { 34 | super(message); 35 | } 36 | 37 | public MixedAuthenticationException(String message, Throwable cause) { 38 | super(message, cause); 39 | } 40 | 41 | public MixedAuthenticationException(Throwable cause) { 42 | super(cause); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/repository/mapping/EntityMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.repository.mapping; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * Represents the metadata for a document entity. 22 | * 23 | * @author Michael Nitschinger 24 | * @since 2.2.0 25 | */ 26 | public interface EntityMetadata { 27 | 28 | /** 29 | * Returns the metadata for all properties in this entity. 30 | * 31 | * @return the property information. 32 | */ 33 | List properties(); 34 | 35 | /** 36 | * True if it contains an id property, false otherwise. 37 | * 38 | * @return true if there is one, false otherwise. 39 | */ 40 | boolean hasIdProperty(); 41 | 42 | /** 43 | * Returns the metadata for the id property if set, or null otherwise. 44 | * 45 | * @return the metadata or null. 46 | */ 47 | PropertyMetadata idProperty(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/search/queries/Coordinate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.search.queries; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * The {@link Coordinate} represents the longitude and latitude of a point. 23 | * 24 | * @author Jyotsna Nayak 25 | */ 26 | @InterfaceStability.Experimental 27 | @InterfaceAudience.Public 28 | public class Coordinate { 29 | 30 | private final double lon; 31 | private final double lat; 32 | 33 | public static Coordinate ofLonLat(double lon, double lat) { 34 | return new Coordinate(lon, lat); 35 | } 36 | 37 | private Coordinate(final double lon, final double lat) { 38 | this.lon = lon; 39 | this.lat = lat; 40 | } 41 | 42 | public double lon() { 43 | return lon; 44 | } 45 | 46 | public double lat() { 47 | return lat; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/DefaultMergeSourcePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path; 17 | 18 | import com.couchbase.client.java.query.dsl.Expression; 19 | import com.couchbase.client.java.query.dsl.element.Element; 20 | 21 | import static com.couchbase.client.java.query.dsl.Expression.x; 22 | 23 | public class DefaultMergeSourcePath extends AbstractPath implements MergeSourcePath { 24 | 25 | public DefaultMergeSourcePath(AbstractPath parent) { 26 | super(parent); 27 | } 28 | 29 | @Override 30 | public MergeKeyClausePath using(String source) { 31 | return using(x(source)); 32 | } 33 | 34 | @Override 35 | public MergeKeyClausePath using(final Expression source) { 36 | element(new Element() { 37 | @Override 38 | public String export() { 39 | return "USING " + source.toString(); 40 | } 41 | }); 42 | return new DefaultMergeKeyClausePath(this); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/HashSide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.query.dsl.path; 18 | 19 | import com.couchbase.client.core.annotations.InterfaceAudience; 20 | import com.couchbase.client.core.annotations.InterfaceStability; 21 | 22 | /** 23 | * Hash side for hash based join 24 | * 25 | * @author Subhashni Balakrishnan 26 | */ 27 | @InterfaceStability.Experimental 28 | @InterfaceAudience.Public 29 | public enum HashSide { 30 | 31 | /** 32 | * The PROBE side will use that table to find matches and perform the join 33 | * */ 34 | PROBE("PROBE"), 35 | 36 | /** 37 | * The BUILD side of the join will be used to create an in-memory hash table 38 | * */ 39 | BUILD("BUILD"); 40 | 41 | private final String value; 42 | 43 | HashSide(String value) { 44 | this.value = value; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return this.value; 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/index/DefaultUsingWithPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path.index; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.element.UsingElement; 21 | import com.couchbase.client.java.query.dsl.path.AbstractPath; 22 | 23 | /** 24 | * See {@link UsingWithPath}. 25 | * 26 | * @author Simon Baslé 27 | * @since 2.2 28 | */ 29 | @InterfaceStability.Experimental 30 | @InterfaceAudience.Private 31 | public class DefaultUsingWithPath extends DefaultWithPath implements UsingWithPath { 32 | 33 | protected DefaultUsingWithPath(AbstractPath parent) { 34 | super(parent); 35 | } 36 | 37 | @Override 38 | public WithPath using(IndexType type) { 39 | element(new UsingElement(type)); 40 | return new DefaultWithPath(this); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/subdoc/PathExistsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.error.subdoc; 18 | 19 | import com.couchbase.client.core.annotations.InterfaceAudience; 20 | import com.couchbase.client.core.annotations.InterfaceStability; 21 | import com.couchbase.client.java.subdoc.MutateInBuilder; 22 | 23 | /** 24 | * Subdocument exception thrown when a path already exists and it shouldn't 25 | * (for example, when using {@link MutateInBuilder#insert(String, Object, boolean)} subdoc insert}). 26 | * 27 | * @author Simon Baslé 28 | * @since 2.2 29 | */ 30 | @InterfaceStability.Committed 31 | @InterfaceAudience.Public 32 | public class PathExistsException extends SubDocumentException { 33 | 34 | public PathExistsException(String id, String path) { 35 | super("Path " + path + " already exist in document " + id); 36 | } 37 | 38 | public PathExistsException(String reason) { 39 | super(reason); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/path/index/DefaultUsingPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.path.index; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.Statement; 21 | import com.couchbase.client.java.query.dsl.element.UsingElement; 22 | import com.couchbase.client.java.query.dsl.path.AbstractPath; 23 | 24 | /** 25 | * See {@link UsingPath}. 26 | * 27 | * @author Simon Baslé 28 | * @since 2.2 29 | */ 30 | @InterfaceStability.Experimental 31 | @InterfaceAudience.Private 32 | public class DefaultUsingPath extends AbstractPath implements UsingPath { 33 | 34 | protected DefaultUsingPath(AbstractPath parent) { 35 | super(parent); 36 | } 37 | 38 | @Override 39 | public Statement using(IndexType indexType) { 40 | element(new UsingElement(indexType)); 41 | return this; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/ReplicaMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java; 17 | 18 | /** 19 | * Represents the different modes to read from replica nodes. 20 | * 21 | * @author Michael Nitschinger 22 | * @since 2.0 23 | */ 24 | public enum ReplicaMode { 25 | 26 | /** 27 | * Get from all replicas and the active node. 28 | */ 29 | ALL(4), 30 | 31 | /** 32 | * Get only from the first replica configured for the document. 33 | */ 34 | FIRST(1), 35 | 36 | /** 37 | * Get only from the second replica configured for the document. 38 | */ 39 | SECOND(1), 40 | 41 | /** 42 | * Get only from the third replica configured for the document. 43 | */ 44 | THIRD(1); 45 | 46 | private int maxAffectedNodes; 47 | 48 | ReplicaMode(int maxAffectedNodes) { 49 | this.maxAffectedNodes = maxAffectedNodes; 50 | } 51 | 52 | public int maxAffectedNodes() { 53 | return maxAffectedNodes; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/subdoc/SubDocumentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.couchbase.client.java.error.subdoc; 18 | 19 | import com.couchbase.client.core.CouchbaseException; 20 | import com.couchbase.client.core.annotations.InterfaceAudience; 21 | import com.couchbase.client.core.annotations.InterfaceStability; 22 | 23 | /** 24 | * An abstract common class for all {@link CouchbaseException} that relates 25 | * to the sub-document feature. 26 | * 27 | * @author Simon Baslé 28 | * @since 2.2 29 | */ 30 | @InterfaceStability.Committed 31 | @InterfaceAudience.Public 32 | public abstract class SubDocumentException extends CouchbaseException { 33 | 34 | protected SubDocumentException(String message) { 35 | super(message); 36 | } 37 | 38 | protected SubDocumentException(String message, Throwable cause) { 39 | super(message, cause); 40 | } 41 | 42 | protected SubDocumentException(Throwable cause) { 43 | super(cause); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/error/subdoc/XattrOrderingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.error.subdoc; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | 21 | /** 22 | * This exception is raised when non-xattr based commands are set before xattr-based ones. 23 | * 24 | * The server is expecting xattr commands at the very beginning and if this is not the case it will fail 25 | * with an error. 26 | */ 27 | @InterfaceStability.Committed 28 | @InterfaceAudience.Public 29 | public class XattrOrderingException extends SubDocumentException { 30 | 31 | public XattrOrderingException(String message) { 32 | super(message); 33 | } 34 | 35 | public XattrOrderingException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public XattrOrderingException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/LetElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.Alias; 21 | 22 | @InterfaceStability.Experimental 23 | @InterfaceAudience.Private 24 | public class LetElement implements Element { 25 | 26 | private final Alias[] aliases; 27 | 28 | public LetElement(Alias[] aliases) { 29 | this.aliases = aliases; 30 | } 31 | 32 | @Override 33 | public String export() { 34 | StringBuilder sb = new StringBuilder(); 35 | sb.append("LET "); 36 | for (int i = 0; i < aliases.length; i++) { 37 | sb.append(aliases[i].toString()); 38 | if (i < aliases.length-1) { 39 | sb.append(", "); 40 | } 41 | } 42 | return sb.toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/OrderByElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.Sort; 21 | 22 | @InterfaceStability.Experimental 23 | @InterfaceAudience.Private 24 | public class OrderByElement implements Element { 25 | 26 | private final Sort[] sorts; 27 | 28 | public OrderByElement(Sort... sorts) { 29 | this.sorts = sorts; 30 | } 31 | 32 | @Override 33 | public String export() { 34 | StringBuilder sb = new StringBuilder(); 35 | sb.append("ORDER BY "); 36 | for (int i = 0; i < sorts.length; i++) { 37 | sb.append(sorts[i].toString()); 38 | if (i < sorts.length-1) { 39 | sb.append(", "); 40 | } 41 | } 42 | return sb.toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/JoinElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.path.JoinType; 21 | 22 | @InterfaceStability.Experimental 23 | @InterfaceAudience.Private 24 | public class JoinElement implements Element { 25 | 26 | private final JoinType joinType; 27 | private final String from; 28 | 29 | public JoinElement(JoinType joinType, String from) { 30 | this.joinType = joinType; 31 | this.from = from; 32 | } 33 | 34 | @Override 35 | public String export() { 36 | StringBuilder sb = new StringBuilder(); 37 | if (joinType != JoinType.DEFAULT) { 38 | sb.append(joinType.value()).append(" "); 39 | } 40 | sb.append("JOIN ").append(from); 41 | return sb.toString(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/NestElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.path.JoinType; 21 | 22 | @InterfaceStability.Experimental 23 | @InterfaceAudience.Private 24 | public class NestElement implements Element { 25 | 26 | private final JoinType joinType; 27 | private final String from; 28 | 29 | public NestElement(JoinType joinType, String from) { 30 | this.joinType = joinType; 31 | this.from = from; 32 | } 33 | 34 | @Override 35 | public String export() { 36 | StringBuilder sb = new StringBuilder(); 37 | if (joinType != JoinType.DEFAULT) { 38 | sb.append(joinType.value()).append(" "); 39 | } 40 | sb.append("NEST ").append(from); 41 | return sb.toString(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/couchbase/client/java/query/dsl/element/LettingElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Couchbase, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.couchbase.client.java.query.dsl.element; 17 | 18 | import com.couchbase.client.core.annotations.InterfaceAudience; 19 | import com.couchbase.client.core.annotations.InterfaceStability; 20 | import com.couchbase.client.java.query.dsl.Alias; 21 | 22 | @InterfaceStability.Experimental 23 | @InterfaceAudience.Private 24 | public class LettingElement implements Element { 25 | 26 | private final Alias[] aliases; 27 | 28 | public LettingElement(Alias[] aliases) { 29 | this.aliases = aliases; 30 | } 31 | 32 | @Override 33 | public String export() { 34 | StringBuilder sb = new StringBuilder(); 35 | sb.append("LETTING "); 36 | for (int i = 0; i < aliases.length; i++) { 37 | sb.append(aliases[i].toString()); 38 | if (i < aliases.length-1) { 39 | sb.append(", "); 40 | } 41 | } 42 | return sb.toString(); 43 | } 44 | } 45 | --------------------------------------------------------------------------------