Browse Source

preparing for 1.0.0.M1 MongoDB release

pull/1/head 1.0.0.M1-MongoDB
Thomas Risberg 15 years ago
parent
commit
c60232315b
  1. 4
      pom.xml
  2. 2
      spring-data-document-core/pom.xml
  3. 13
      spring-data-document-parent/pom.xml
  4. 2
      spring-data-mongodb/pom.xml
  5. 2
      spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/config/package-info.java
  6. 4
      spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/monitor/package-info.java
  7. 4
      spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/package-info.java
  8. 94
      spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Criteria.java
  9. 69
      spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Update.java
  10. 4
      spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/package-info.java
  11. 2
      spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/repository/package-info.java
  12. 4
      src/assembly/distribution.xml
  13. 59
      src/docbkx/reference/mongodb.xml
  14. 29
      src/main/resources/changelog.txt
  15. 15
      src/main/resources/license.txt
  16. 27
      src/main/resources/notice.txt
  17. 6
      src/main/resources/readme.txt

4
pom.xml

@ -5,13 +5,13 @@ @@ -5,13 +5,13 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-document-dist</artifactId>
<name>Spring Data Document Distribution</name>
<version>1.0.0.BUILD-SNAPSHOT</version>
<version>1.0.0.M1</version>
<packaging>pom</packaging>
<modules>
<module>spring-data-document-parent</module>
<module>spring-data-document-core</module>
<module>spring-data-mongodb</module>
<module>spring-data-couchdb</module>
<!-- <module>spring-data-couchdb</module> -->
</modules>
<developers>

2
spring-data-document-core/pom.xml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-document-parent</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<version>1.0.0.M1</version>
<relativePath>../spring-data-document-parent/pom.xml</relativePath>
</parent>
<artifactId>spring-data-document-core</artifactId>

13
spring-data-document-parent/pom.xml

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<artifactId>spring-data-document-parent</artifactId>
<name>Spring Data Document Parent</name>
<url>http://www.springsource.org/spring-data/data-document</url>
<version>1.0.0.BUILD-SNAPSHOT</version>
<version>1.0.0.M1</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -16,17 +16,6 @@ @@ -16,17 +16,6 @@
<org.mockito.version>1.8.4</org.mockito.version>
<org.slf4j.version>1.5.10</org.slf4j.version>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<!-- dist.* properties are used by the antrun tasks below -->
<dist.id>spring-data-document</dist.id>
<dist.name>Spring data Document</dist.name>
<dist.key>DATADOC</dist.key>
<dist.version>${project.version}</dist.version>
<dist.releaseType>snapshot</dist.releaseType>
<dist.finalName>${dist.id}-${dist.version}</dist.finalName>
<dist.fileName>${dist.finalName}.zip</dist.fileName>
<dist.filePath>target/${dist.fileName}</dist.filePath>
<dist.bucketName>dist.springframework.org</dist.bucketName>
</properties>
<profiles>
<profile>

2
spring-data-mongodb/pom.xml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-document-parent</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<version>1.0.0.M1</version>
<relativePath>../spring-data-document-parent/pom.xml</relativePath>
</parent>
<artifactId>spring-data-mongodb</artifactId>

2
spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/config/package-info.java

@ -1,4 +1,4 @@ @@ -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;

4
spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/monitor/package-info.java

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
/**
* MongoDB specific JMX monitoring support.
*/
package org.springframework.data.document.mongodb.monitor;

4
spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/package-info.java

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
/**
* MongoDB core support.
*/
package org.springframework.data.document.mongodb;

94
spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Criteria.java

@ -38,10 +38,22 @@ public class Criteria implements CriteriaDefinition { @@ -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 { @@ -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<Object> l = new ArrayList<Object>();
l.add(value);
@ -88,36 +142,76 @@ public class Criteria implements CriteriaDefinition { @@ -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<Query> queries) {
criteria.put("$or", queries);
}

69
spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/Update.java

@ -30,26 +30,60 @@ public class Update { @@ -30,26 +30,60 @@ public class Update {
private HashMap<String, Object> criteria = new LinkedHashMap<String, Object>();
/**
* 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 { @@ -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 { @@ -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;

4
spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/query/package-info.java

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
/**
* MongoDB specific query and update support.
*/
package org.springframework.data.document.mongodb.query;

2
spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/repository/package-info.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
/**
* Mongo DB specific repository implementation.
* MongoDB specific repository implementation.
*/
package org.springframework.data.document.mongodb.repository;

4
src/assembly/distribution.xml

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
<!-- adds module jars to the distribution archive under the 'dist' directory -->
<includes>
<include>org.springframework.data:spring-data-document-core</include>
<include>org.springframework.data:spring-data-couchdb</include>
<!-- <include>org.springframework.data:spring-data-couchdb</include> -->
<include>org.springframework.data:spring-data-mongodb</include>
</includes>
<binaries>
@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
see pom.xml 'maven-source-plugin' declaration -->
<includes>
<include>org.springframework.data:spring-data-document-core</include>
<include>org.springframework.data:spring-data-couchdb</include>
<!-- <include>org.springframework.data:spring-data-couchdb</include> -->
<include>org.springframework.data:spring-data-mongodb</include>
</includes>
<binaries>

59
src/docbkx/reference/mongodb.xml

@ -952,74 +952,71 @@ public class AppConfig { @@ -952,74 +952,71 @@ public class AppConfig {
<itemizedlist>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">all</emphasis><literal>(Object o) </literal>creates
role="bold">all</emphasis><literal>(Object o) </literal>Creates
a criterion using the <literal>$all</literal> operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">exists</emphasis><literal>(boolean b)
</literal>creates a criterion using the
</literal>Creates a criterion using the
<literal>$exists</literal> operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">gt</emphasis><literal>(Object o) </literal>creates a
role="bold">gt</emphasis><literal>(Object o) </literal>Creates a
criterion using the <literal>$gt</literal> operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">gte</emphasis><literal>(Object o) </literal>creates
role="bold">gte</emphasis><literal>(Object o) </literal>Creates
a criterion using the <literal>$gte</literal> operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">in</emphasis><literal>(Object... o)
</literal>creates a criterion using the <literal>$in</literal>
</literal>Creates a criterion using the <literal>$in</literal>
operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">is</emphasis><literal>(Object o) </literal>creates a
role="bold">is</emphasis><literal>(Object o) </literal>Creates a
criterion using the <literal>$is</literal> operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">lt</emphasis><literal>(Object o) </literal>creates a
role="bold">lt</emphasis><literal>(Object o) </literal>Creates a
criterion using the <literal>$lt</literal> operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">lte</emphasis><literal>(Object o) </literal>creates
role="bold">lte</emphasis><literal>(Object o) </literal>Creates
a criterion using the <literal>$lte</literal> operator</para>
</listitem>
<listitem>
<para>
<literal>Criteria</literal>
<emphasis role="bold">mod</emphasis>
<literal>(Number value, Number remainder)</literal>
</para>
<para><literal>Criteria</literal><emphasis
role="bold">mod</emphasis><literal>(Number value, Number
remainder) </literal>Creates a criterion using the
<literal>$mod</literal> operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">nin</emphasis><literal>(Object... o)
</literal>creates a criterion using the <literal>$nin</literal>
</literal>Creates a criterion using the <literal>$nin</literal>
operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">not</emphasis><literal>() </literal>creates a
role="bold">not</emphasis><literal>() </literal>Creates a
criterion using the <literal>$not</literal> meta operator which
affects the clause directly following</para>
</listitem>
@ -1027,26 +1024,26 @@ public class AppConfig { @@ -1027,26 +1024,26 @@ public class AppConfig {
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">regex</emphasis><literal>(String re)
</literal>creates a criterion using a
</literal>Creates a criterion using a
<literal>$regex</literal></para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">size</emphasis><literal>(int s) </literal>creates a
role="bold">size</emphasis><literal>(int s) </literal>Creates a
criterion using the <literal>$size</literal> operator</para>
</listitem>
<listitem>
<para><literal>Criteria</literal> <emphasis
role="bold">type</emphasis><literal>(int t) </literal>creates a
role="bold">type</emphasis><literal>(int t) </literal>Creates a
criterion using the <literal>$type</literal> operator</para>
</listitem>
<listitem>
<para><literal>void </literal> <emphasis
role="bold">or</emphasis><literal>(List&lt;Query&gt; queries)
</literal>creates an or query using the <literal>$or</literal>
</literal>Creates an or query using the <literal>$or</literal>
operator for all of the provided queries</para>
<para />
@ -1140,70 +1137,70 @@ public class AppConfig { @@ -1140,70 +1137,70 @@ public class AppConfig {
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">addToSet</emphasis><literal>(String key, Object
value)</literal> update using the <literal>$addToSet</literal>
value)</literal> Update using the <literal>$addToSet</literal>
update modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">inc</emphasis><literal>(String key, Number
inc)</literal> update using the <literal>$inc</literal> update
inc)</literal> Update using the <literal>$inc</literal> update
modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">pop</emphasis><literal>(String key, Update.Position
pos)</literal> update using the <literal>$pop</literal> update
pos)</literal> Update using the <literal>$pop</literal> update
modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">pull</emphasis><literal>(String key, Object
value)</literal> update using the <literal>$pull</literal>
value)</literal> Update using the <literal>$pull</literal>
update modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">pullAll</emphasis><literal>(String key, Object[]
values)</literal> update using the <literal>$pullAll</literal>
values)</literal> Update using the <literal>$pullAll</literal>
update modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">push</emphasis><literal>(String key, Object
value)</literal> update using the <literal>$push</literal>
value)</literal> Update using the <literal>$push</literal>
update modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">pushAll</emphasis><literal>(String key, Object[]
values)</literal> update using the <literal>$pushAll</literal>
values)</literal> Update using the <literal>$pushAll</literal>
update modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">rename</emphasis><literal>(String oldName, String
newName)</literal> update using the <literal>$rename</literal>
newName)</literal> Update using the <literal>$rename</literal>
update modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">set</emphasis><literal>(String key, Object
value)</literal> update using the <literal>$set</literal> update
value)</literal> Update using the <literal>$set</literal> update
modifier</para>
</listitem>
<listitem>
<para><literal>Update</literal> <emphasis
role="bold">unset</emphasis><literal>(String key)</literal>
update using the <literal>$unset</literal> update
Update using the <literal>$unset</literal> update
modifier</para>
</listitem>
</itemizedlist></para>

29
src/main/resources/changelog.txt

@ -1,5 +1,28 @@ @@ -1,5 +1,28 @@
Spring Datastore Document 1.0.0 Milestone 1 (?, 2010)
Spring Data Document Changelog
=============================================
New Features
* Lot's of good stuff
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

15
src/main/resources/apache-license.txt → src/main/resources/license.txt

@ -199,3 +199,18 @@ @@ -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.

27
src/main/resources/notice.txt

@ -1,21 +1,10 @@ @@ -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.

6
src/main/resources/readme.txt

@ -1,5 +1,5 @@ @@ -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. @@ -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

Loading…
Cancel
Save