From c60232315bf0529f55f33f798a6feaf157e153cf Mon Sep 17 00:00:00 2001 From: Thomas Risberg Date: Mon, 14 Feb 2011 23:40:57 -0500 Subject: [PATCH] preparing for 1.0.0.M1 MongoDB release --- pom.xml | 4 +- spring-data-document-core/pom.xml | 2 +- spring-data-document-parent/pom.xml | 13 +-- spring-data-mongodb/pom.xml | 2 +- .../document/mongodb/config/package-info.java | 2 +- .../mongodb/monitor/package-info.java | 4 + .../data/document/mongodb/package-info.java | 4 + .../data/document/mongodb/query/Criteria.java | 94 +++++++++++++++++++ .../data/document/mongodb/query/Update.java | 69 ++++++++++++++ .../document/mongodb/query/package-info.java | 4 + .../mongodb/repository/package-info.java | 2 +- src/assembly/distribution.xml | 4 +- src/docbkx/reference/mongodb.xml | 59 ++++++------ src/main/resources/changelog.txt | 29 +++++- .../{apache-license.txt => license.txt} | 15 +++ src/main/resources/notice.txt | 27 ++---- src/main/resources/readme.txt | 6 +- 17 files changed, 264 insertions(+), 76 deletions(-) create mode 100644 spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/monitor/package-info.java create mode 100644 spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/package-info.java create mode 100644 spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/package-info.java rename src/main/resources/{apache-license.txt => license.txt} (91%) diff --git a/pom.xml b/pom.xml index 9e14ed16c..fa5744d82 100644 --- a/pom.xml +++ b/pom.xml @@ -5,13 +5,13 @@ org.springframework.data spring-data-document-dist Spring Data Document Distribution - 1.0.0.BUILD-SNAPSHOT + 1.0.0.M1 pom spring-data-document-parent spring-data-document-core spring-data-mongodb - spring-data-couchdb + diff --git a/spring-data-document-core/pom.xml b/spring-data-document-core/pom.xml index ac325d868..e8bb91c98 100644 --- a/spring-data-document-core/pom.xml +++ b/spring-data-document-core/pom.xml @@ -4,7 +4,7 @@ org.springframework.data spring-data-document-parent - 1.0.0.BUILD-SNAPSHOT + 1.0.0.M1 ../spring-data-document-parent/pom.xml spring-data-document-core diff --git a/spring-data-document-parent/pom.xml b/spring-data-document-parent/pom.xml index cc213deca..c4d178265 100644 --- a/spring-data-document-parent/pom.xml +++ b/spring-data-document-parent/pom.xml @@ -6,7 +6,7 @@ spring-data-document-parent Spring Data Document Parent http://www.springsource.org/spring-data/data-document - 1.0.0.BUILD-SNAPSHOT + 1.0.0.M1 pom UTF-8 @@ -16,17 +16,6 @@ 1.8.4 1.5.10 3.0.5.RELEASE - - spring-data-document - Spring data Document - DATADOC - ${project.version} - snapshot - ${dist.id}-${dist.version} - ${dist.finalName}.zip - target/${dist.fileName} - dist.springframework.org - diff --git a/spring-data-mongodb/pom.xml b/spring-data-mongodb/pom.xml index 655571c91..6a563e3a8 100644 --- a/spring-data-mongodb/pom.xml +++ b/spring-data-mongodb/pom.xml @@ -4,7 +4,7 @@ org.springframework.data spring-data-document-parent - 1.0.0.BUILD-SNAPSHOT + 1.0.0.M1 ../spring-data-document-parent/pom.xml spring-data-mongodb diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/config/package-info.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/config/package-info.java index 9b2e656d4..4e53a77e4 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/config/package-info.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/config/package-info.java @@ -1,4 +1,4 @@ /** - * Spring XML namespace configuration for Mongo DB specific repositories. + * Spring XML namespace configuration for MongoDB specific repositories. */ package org.springframework.data.document.mongodb.config; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/monitor/package-info.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/monitor/package-info.java new file mode 100644 index 000000000..6ccef7a13 --- /dev/null +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/monitor/package-info.java @@ -0,0 +1,4 @@ +/** + * MongoDB specific JMX monitoring support. + */ +package org.springframework.data.document.mongodb.monitor; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/package-info.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/package-info.java new file mode 100644 index 000000000..9f38f637e --- /dev/null +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/package-info.java @@ -0,0 +1,4 @@ +/** + * MongoDB core support. + */ +package org.springframework.data.document.mongodb; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Criteria.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Criteria.java index ad2ef5871..beb0c68a9 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Criteria.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Criteria.java @@ -38,10 +38,22 @@ public class Criteria implements CriteriaDefinition { } + /** + * Static factory method to create a Criteria using the provided key + * + * @param key + * @return + */ public static Criteria where(String key) { return new Criteria(key); } + /** + * Creates a criterion using the $is operator + * + * @param o + * @return + */ public Criteria is(Object o) { if (isValue != null) { throw new InvalidDocumentStoreApiUsageException("Multiple 'is' values declared."); @@ -50,36 +62,78 @@ public class Criteria implements CriteriaDefinition { return this; } + /** + * Creates a criterion using the $lt operator + * + * @param o + * @return + */ public Criteria lt(Object o) { criteria.put("$lt", o); return this; } + /** + * Creates a criterion using the $lte operator + * + * @param o + * @return + */ public Criteria lte(Object o) { criteria.put("$lte", o); return this; } + /** + * Creates a criterion using the $gt operator + * + * @param o + * @return + */ public Criteria gt(Object o) { criteria.put("$gt", o); return this; } + /** + * Creates a criterion using the $gte operator + * + * @param o + * @return + */ public Criteria gte(Object o) { criteria.put("$gte", o); return this; } + /** + * Creates a criterion using the $in operator + * @param o + * @return + */ public Criteria in(Object... o) { criteria.put("$in", o); return this; } + /** + * Creates a criterion using the $nin operator + * + * @param o + * @return + */ public Criteria nin(Object... o) { criteria.put("$min", o); return this; } + /** + * Creates a criterion using the $mod operator + * + * @param value + * @param remainder + * @return + */ public Criteria mod(Number value, Number remainder) { List l = new ArrayList(); l.add(value); @@ -88,36 +142,76 @@ public class Criteria implements CriteriaDefinition { return this; } + /** + * Creates a criterion using the $all operator + * + * @param o + * @return + */ public Criteria all(Object o) { criteria.put("$is", o); return this; } + /** + * Creates a criterion using the $size operator + * + * @param s + * @return + */ public Criteria size(int s) { criteria.put("$size", s); return this; } + /** + * Creates a criterion using the $exists operator + * + * @param b + * @return + */ public Criteria exists(boolean b) { criteria.put("$exists", b); return this; } + /** + * Creates a criterion using the $type operator + * + * @param t + * @return + */ public Criteria type(int t) { criteria.put("$type", t); return this; } + /** + * Creates a criterion using the $not meta operator which affects the clause directly following + * + * @return + */ public Criteria not() { criteria.put("$not", null); return this; } + /** + * Creates a criterion using a $regex + * + * @param re + * @return + */ public Criteria regex(String re) { criteria.put("$regex", re); return this; } + /** + * Creates an or query using the $or operator for all of the provided queries + * + * @param queries + */ public void or(List queries) { criteria.put("$or", queries); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Update.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Update.java index 6ea981cfc..1d8005f51 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Update.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Update.java @@ -30,26 +30,60 @@ public class Update { private HashMap criteria = new LinkedHashMap(); + /** + * Update using the $set update modifier + * + * @param key + * @param value + * @return + */ public Update set(String key, Object value) { criteria.put("$set", Collections.singletonMap(key, convertValueIfNecessary(value))); return this; } + /** + * Update using the $unset update modifier + * + * @param key + * @return + */ public Update unset(String key) { criteria.put("$unset", Collections.singletonMap(key, 1)); return this; } + /** + * Update using the $inc update modifier + * + * @param key + * @param inc + * @return + */ public Update inc(String key, Number inc) { criteria.put("$inc", Collections.singletonMap(key, inc)); return this; } + /** + * Update using the $push update modifier + * + * @param key + * @param value + * @return + */ public Update push(String key, Object value) { criteria.put("$push", Collections.singletonMap(key, convertValueIfNecessary(value))); return this; } + /** + * Update using the $pushAll update modifier + * + * @param key + * @param values + * @return + */ public Update pushAll(String key, Object[] values) { Object[] convertedValues = new Object[values.length]; for (int i = 0; i < values.length; i++) { @@ -61,21 +95,49 @@ public class Update { return this; } + /** + * Update using the $addToSet update modifier + * + * @param key + * @param value + * @return + */ public Update addToSet(String key, Object value) { criteria.put("$addToSet", Collections.singletonMap(key, convertValueIfNecessary(value))); return this; } + /** + * Update using the $pop update modifier + * + * @param key + * @param pos + * @return + */ public Update pop(String key, Position pos) { criteria.put("$pop", Collections.singletonMap(key, (pos == Position.FIRST ? -1 : 1))); return this; } + /** + * Update using the $pull update modifier + * + * @param key + * @param value + * @return + */ public Update pull(String key, Object value) { criteria.put("$pull", Collections.singletonMap(key, convertValueIfNecessary(value))); return this; } + /** + * Update using the $pullAll update modifier + * + * @param key + * @param values + * @return + */ public Update pullAll(String key, Object[] values) { Object[] convertedValues = new Object[values.length]; for (int i = 0; i < values.length; i++) { @@ -87,6 +149,13 @@ public class Update { return this; } + /** + * Update using the $rename update modifier + * + * @param oldName + * @param newName + * @return + */ public Update rename(String oldName, String newName) { criteria.put("$rename", Collections.singletonMap(oldName, newName)); return this; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/package-info.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/package-info.java new file mode 100644 index 000000000..993e03849 --- /dev/null +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/package-info.java @@ -0,0 +1,4 @@ +/** + * MongoDB specific query and update support. + */ +package org.springframework.data.document.mongodb.query; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/repository/package-info.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/repository/package-info.java index b1ccdc5fd..ddab9303b 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/repository/package-info.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/repository/package-info.java @@ -1,4 +1,4 @@ /** - * Mongo DB specific repository implementation. + * MongoDB specific repository implementation. */ package org.springframework.data.document.mongodb.repository; diff --git a/src/assembly/distribution.xml b/src/assembly/distribution.xml index 1b158556d..6bc8bba01 100644 --- a/src/assembly/distribution.xml +++ b/src/assembly/distribution.xml @@ -43,7 +43,7 @@ org.springframework.data:spring-data-document-core - org.springframework.data:spring-data-couchdb + org.springframework.data:spring-data-mongodb @@ -57,7 +57,7 @@ see pom.xml 'maven-source-plugin' declaration --> org.springframework.data:spring-data-document-core - org.springframework.data:spring-data-couchdb + org.springframework.data:spring-data-mongodb diff --git a/src/docbkx/reference/mongodb.xml b/src/docbkx/reference/mongodb.xml index 768110731..7fd37fee2 100644 --- a/src/docbkx/reference/mongodb.xml +++ b/src/docbkx/reference/mongodb.xml @@ -952,74 +952,71 @@ public class AppConfig { Criteria all(Object o) creates + role="bold">all(Object o) Creates a criterion using the $all operator Criteria exists(boolean b) - creates a criterion using the + Creates a criterion using the $exists operator Criteria gt(Object o) creates a + role="bold">gt(Object o) Creates a criterion using the $gt operator Criteria gte(Object o) creates + role="bold">gte(Object o) Creates a criterion using the $gte operator Criteria in(Object... o) - creates a criterion using the $in + Creates a criterion using the $in operator Criteria is(Object o) creates a + role="bold">is(Object o) Creates a criterion using the $is operator Criteria lt(Object o) creates a + role="bold">lt(Object o) Creates a criterion using the $lt operator Criteria lte(Object o) creates + role="bold">lte(Object o) Creates a criterion using the $lte operator - - Criteria - - mod - - (Number value, Number remainder) - + Criteriamod(Number value, Number + remainder) Creates a criterion using the + $mod operator Criteria nin(Object... o) - creates a criterion using the $nin + Creates a criterion using the $nin operator Criteria not() creates a + role="bold">not() Creates a criterion using the $not meta operator which affects the clause directly following @@ -1027,26 +1024,26 @@ public class AppConfig { Criteria regex(String re) - creates a criterion using a + Creates a criterion using a $regex Criteria size(int s) creates a + role="bold">size(int s) Creates a criterion using the $size operator Criteria type(int t) creates a + role="bold">type(int t) Creates a criterion using the $type operator void or(List<Query> queries) - creates an or query using the $or + Creates an or query using the $or operator for all of the provided queries @@ -1140,70 +1137,70 @@ public class AppConfig { Update addToSet(String key, Object - value) update using the $addToSet + value) Update using the $addToSet update modifier Update inc(String key, Number - inc) update using the $inc update + inc) Update using the $inc update modifier Update pop(String key, Update.Position - pos) update using the $pop update + pos) Update using the $pop update modifier Update pull(String key, Object - value) update using the $pull + value) Update using the $pull update modifier Update pullAll(String key, Object[] - values) update using the $pullAll + values) Update using the $pullAll update modifier Update push(String key, Object - value) update using the $push + value) Update using the $push update modifier Update pushAll(String key, Object[] - values) update using the $pushAll + values) Update using the $pushAll update modifier Update rename(String oldName, String - newName) update using the $rename + newName) Update using the $rename update modifier Update set(String key, Object - value) update using the $set update + value) Update using the $set update modifier Update unset(String key) - update using the $unset update + Update using the $unset update modifier diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt index a186131f4..b908efabb 100644 --- a/src/main/resources/changelog.txt +++ b/src/main/resources/changelog.txt @@ -1,5 +1,28 @@ -Spring Datastore Document 1.0.0 Milestone 1 (?, 2010) +Spring Data Document Changelog ============================================= -New Features - * Lot's of good stuff \ No newline at end of file +Changes in version 1.0.0.M1 MongoDB (2011-02-14) +------------------------------------------------ + +General +* BeanFactory for basic configuration of Mongo environment +* Namespace for basic configuration of Mongo environment + +Core Data Access + +* Introduce MongoTemplate implementation with methods defined in MongoOperations interface +* MongoTemplate support for insert, find, save, update, remove +* MongoTemplate support for basic POJO serialization based on bean properties +* Allow MongoTemplate methods to use a default collection name +* Exception translation in MongoTemplate to Spring's DAO exception hierarchy +* Support for update modifiers to allow for partial document updates +* Expose WriteConcern settings on MongoTemplate used for any write operations +* Support in MongoTemplate for enabling either logging or throwing exceptions based on value of WriteResult return value. + +Repository + +* Introducing generic repository implementation for MongoDB +* Automatic implementation of interface query method names on repositories. +* Namespace support for Mongo repositories +* Allow usage of pagination and sorting with repositories + diff --git a/src/main/resources/apache-license.txt b/src/main/resources/license.txt similarity index 91% rename from src/main/resources/apache-license.txt rename to src/main/resources/license.txt index 261eeb9e9..7584e2dfe 100644 --- a/src/main/resources/apache-license.txt +++ b/src/main/resources/license.txt @@ -199,3 +199,18 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +======================================================================= + +To the extent any open source subcomponents are licensed under the EPL and/or other +similar licenses that require the source code and/or modifications to +source code to be made available (as would be noted above), you may obtain a +copy of the source code corresponding to the binaries for such open source +components and modifications thereto, if any, (the "Source Files"), by +downloading the Source Files from http://www.springsource.org/download, +or by sending a request, with your name and address to: VMware, Inc., 3401 Hillview +Avenue, Palo Alto, CA 94304, United States of America or email info@vmware.com. All +such requests should clearly specify: OPEN SOURCE FILES REQUEST, Attention General +Counsel. VMware shall mail a copy of the Source Files to you on a CD or equivalent +physical medium. This offer to obtain a copy of the Source Files is valid for three +years from the date you acquired this Software product. \ No newline at end of file diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index e6900be90..8378cbc1c 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,21 +1,10 @@ - ======================================================================== - == NOTICE file corresponding to section 4 d of the Apache License, == - == Version 2.0, in this case for the Spring Integration distribution. == - ======================================================================== +Spring Data Document 1.0 +Copyright (c) [2010-2011] SpringSource, a division of VMware, Inc. - This product includes software developed by - the Apache Software Foundation (http://www.apache.org). +This product is licensed to you under the Apache License, Version 2.0 (the "License"). +You may not use this product except in compliance with the License. - The end-user documentation included with a redistribution, if any, - must include the following acknowledgement: - - "This product includes software developed by the Spring Framework - Project (http://www.springframework.org)." - - Alternatively, this acknowledgement may appear in the software itself, - if and wherever such third-party acknowledgements normally appear. - - The names "Spring", "Spring Framework", and "Spring Data" must - not be used to endorse or promote products derived from this software - without prior written permission. For written permission, please contact - enquiries@springsource.com. +This product may include a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the subcomponent's license, as noted in the LICENSE file. \ No newline at end of file diff --git a/src/main/resources/readme.txt b/src/main/resources/readme.txt index 842e0e1f8..e4153a113 100644 --- a/src/main/resources/readme.txt +++ b/src/main/resources/readme.txt @@ -1,5 +1,5 @@ -SPRING DATASTORE DOCUMENT 1.0.0 M1 (? ? 2010) -------------------------------------------------- +SPRING DATASTORE DOCUMENT 1.0.0.M1 MongoDB +------------------------------------------ Spring Datastore Document is released under the terms of the Apache Software License Version 2.0 (see license.txt). @@ -14,4 +14,4 @@ The reference manual and javadoc are located in the 'docs' directory. ADDITIONAL RESOURCES: Spring Data Homepage: http://www.springsource.org/spring-data -Spring Data Forum: http://forum.springsource.org/forumdisplay.php?f=?? +Spring Data Forum: http://forum.springsource.org/forumdisplay.php?f=80