diff --git a/spring-datastore-document-core/.classpath b/spring-datastore-document-core/.classpath
index 0bb7ad5ca..6019b8317 100644
--- a/spring-datastore-document-core/.classpath
+++ b/spring-datastore-document-core/.classpath
@@ -2,6 +2,11 @@
-
+
+
+
+
+
+
diff --git a/spring-datastore-document-core/.project b/spring-datastore-document-core/.project
index 779e03217..98098d5e5 100644
--- a/spring-datastore-document-core/.project
+++ b/spring-datastore-document-core/.project
@@ -1,23 +1,36 @@
-
-
- spring-datastore-document-core
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.maven.ide.eclipse.maven2Builder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.maven.ide.eclipse.maven2Nature
-
-
+
+
+ spring-datastore-document-core
+
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.eclipse.jdt.core.javanature
+ org.maven.ide.eclipse.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+
+
diff --git a/spring-datastore-document-core/.settings/org.eclipse.jdt.core.prefs b/spring-datastore-document-core/.settings/org.eclipse.jdt.core.prefs
index 449698a94..41cf44aec 100644
--- a/spring-datastore-document-core/.settings/org.eclipse.jdt.core.prefs
+++ b/spring-datastore-document-core/.settings/org.eclipse.jdt.core.prefs
@@ -1,6 +1,9 @@
-#Wed Oct 06 14:49:48 EDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
+#Thu Oct 14 10:28:37 EDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/spring-datastore-document-core/src/main/java/org/springframework/datastore/document/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-datastore-document-core/src/main/java/org/springframework/datastore/document/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java
index f767eeae4..e9ad372b6 100644
--- a/spring-datastore-document-core/src/main/java/org/springframework/datastore/document/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java
+++ b/spring-datastore-document-core/src/main/java/org/springframework/datastore/document/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java
@@ -29,6 +29,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
@@ -60,6 +61,11 @@ import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.Ordered;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.annotation.AnnotationUtils;
+import org.springframework.datastore.document.web.servlet.ActionExecutedContext;
+import org.springframework.datastore.document.web.servlet.ActionExecutingContext;
+import org.springframework.datastore.document.web.servlet.ActionInterceptor;
+import org.springframework.datastore.document.web.servlet.mvc.annotation.support.InterceptingHandlerMethodInvoker;
+import org.springframework.format.support.FormattingConversionService;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
@@ -149,6 +155,9 @@ import org.springframework.web.util.WebUtils;
public class AnnotationMethodHandlerAdapter extends WebContentGenerator
implements HandlerAdapter, Ordered, BeanFactoryAware {
+
+ private ActionInterceptor[] actionInterceptors;
+
/**
* Log category to use when no mapped handler is found for a request.
* @see #pageNotFoundLogger
@@ -170,7 +179,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
private WebBindingInitializer webBindingInitializer;
- private SessionAttributeStore sessionAttributeStore = new DefaultSessionAttributeStore();
+ private SessionAttributeStore amhaSessionAttributeStore = new DefaultSessionAttributeStore();
private int cacheSecondsForSessionAttributeHandlers = 0;
@@ -196,6 +205,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
public AnnotationMethodHandlerAdapter() {
// no restriction of HTTP methods by default
+ // MLP
super(false);
// See SPR-7316
@@ -272,7 +282,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
*/
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore) {
Assert.notNull(sessionAttributeStore, "SessionAttributeStore must not be null");
- this.sessionAttributeStore = sessionAttributeStore;
+ this.amhaSessionAttributeStore = sessionAttributeStore;
}
/**
@@ -369,6 +379,10 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
public HttpMessageConverter>[] getMessageConverters() {
return messageConverters;
}
+
+ public void setActionInterceptors(ActionInterceptor[] actionInterceptors) {
+ this.actionInterceptors = actionInterceptors;
+ }
/**
* Specify the order value for this HandlerAdapter bean.
@@ -427,17 +441,17 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
ServletHandlerMethodResolver methodResolver = getMethodResolver(handler);
Method handlerMethod = methodResolver.resolveHandlerMethod(request);
- ServletHandlerMethodInvoker methodInvoker = new ServletHandlerMethodInvoker(methodResolver);
+ ServletHandlerMethodInvoker methodInvoker = new ServletHandlerMethodInvoker(methodResolver, actionInterceptors);
ServletWebRequest webRequest = new ServletWebRequest(request, response);
ExtendedModelMap implicitModel = new BindingAwareModelMap();
- //return methodInvoker.doInvoke(handlerMethod, handler, )
- Object result = methodInvoker.invokeHandlerMethod(handlerMethod, handler, webRequest, implicitModel);
- ModelAndView mav =
- methodInvoker.getModelAndView(handlerMethod, handler.getClass(), result, implicitModel, webRequest);
- methodInvoker.updateModelAttributes(handler, (mav != null ? mav.getModel() : null), implicitModel, webRequest);
- return mav;
+ return methodInvoker.interceptingInvokeHandlerMethod(handlerMethod, handler, webRequest, implicitModel);
+ //Object result = methodInvoker.invokeHandlerMethod(handlerMethod, handler, webRequest, implicitModel);
+ //ModelAndView mav =
+ // methodInvoker.getModelAndView(handlerMethod, handler.getClass(), result, implicitModel, webRequest);
+ // methodInvoker.updateModelAttributes(handler, (mav != null ? mav.getModel() : null), implicitModel, webRequest);
+ // return mav;
}
public long getLastModified(HttpServletRequest request, Object handler) {
@@ -710,15 +724,121 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
/**
* Servlet-specific subclass of {@link HandlerMethodInvoker}.
*/
- private class ServletHandlerMethodInvoker extends HandlerMethodInvoker {
+ private class ServletHandlerMethodInvoker extends InterceptingHandlerMethodInvoker {
private boolean responseArgumentUsed = false;
- private ServletHandlerMethodInvoker(HandlerMethodResolver resolver) {
- super(resolver, webBindingInitializer, sessionAttributeStore, parameterNameDiscoverer,
- customArgumentResolvers, messageConverters);
+ private ServletHandlerMethodInvoker(HandlerMethodResolver resolver, ActionInterceptor[] actionInterceptors) {
+ super(resolver, webBindingInitializer, amhaSessionAttributeStore, parameterNameDiscoverer,
+ customArgumentResolvers, messageConverters, actionInterceptors);
}
+ public ModelAndView interceptingInvokeHandlerMethod(Method handlerMethod, Object handler,
+ NativeWebRequest webRequest, ExtendedModelMap implicitModel) throws Exception {
+
+ int interceptorIndex = -1;
+ ModelAndView mav = null;
+ ActionExecutingContext executingContext = null;
+ Method handlerMethodToInvoke = BridgeMethodResolver.findBridgedMethod(handlerMethod);
+ try {
+ boolean debug = logger.isDebugEnabled();
+ for (String attrName : this.methodResolver.getActualSessionAttributeNames()) {
+ Object attrValue = this.sessionAttributeStore.retrieveAttribute(webRequest, attrName);
+ if (attrValue != null) {
+ implicitModel.addAttribute(attrName, attrValue);
+ }
+ }
+ for (Method attributeMethod : this.methodResolver.getModelAttributeMethods()) {
+ Method attributeMethodToInvoke = BridgeMethodResolver.findBridgedMethod(attributeMethod);
+ Object[] args = resolveHandlerArguments(attributeMethodToInvoke, handler, webRequest, implicitModel);
+ if (debug) {
+ logger.debug("Invoking model attribute method: " + attributeMethodToInvoke);
+ }
+ String attrName = AnnotationUtils.findAnnotation(attributeMethod, ModelAttribute.class).value();
+ if (!"".equals(attrName) && implicitModel.containsAttribute(attrName)) {
+ continue;
+ }
+ ReflectionUtils.makeAccessible(attributeMethodToInvoke);
+ Object attrValue = attributeMethodToInvoke.invoke(handler, args);
+ if ("".equals(attrName)) {
+ Class resolvedType = GenericTypeResolver.resolveReturnType(attributeMethodToInvoke, handler.getClass());
+ attrName = Conventions.getVariableNameForReturnType(attributeMethodToInvoke, resolvedType, attrValue);
+ }
+ if (!implicitModel.containsAttribute(attrName)) {
+ implicitModel.addAttribute(attrName, attrValue);
+ }
+ }
+ Object[] args = resolveHandlerArguments(handlerMethodToInvoke, handler, webRequest, implicitModel);
+ if (debug) {
+ logger.debug("Invoking request handler method: " + handlerMethodToInvoke);
+ }
+ ReflectionUtils.makeAccessible(handlerMethodToInvoke);
+
+ executingContext = new ActionExecutingContext((ServletWebRequest)webRequest, handler, handlerMethodToInvoke, args, implicitModel);
+
+ // Apply preHandle methods of registered interceptors.
+ ActionInterceptor[] interceptors = getActionInterceptors();
+ if (interceptors != null) {
+ for (int i = 0; i < interceptors.length; i++) {
+ ActionInterceptor interceptor = interceptors[i];
+ if (!interceptor.preHandle(executingContext)) {
+ triggerAfterCompletion(executingContext, interceptorIndex, null, null);
+ return null; //TODO verify null is ok
+ }
+ interceptorIndex = i;
+ }
+ }
+
+ // Actually invoke the handler
+ Object result = handlerMethodToInvoke.invoke(handler, args);
+
+
+ mav = getModelAndView(handlerMethod, handler.getClass(), result, implicitModel, (ServletWebRequest)webRequest);
+ updateModelAttributes(handler, (mav != null ? mav.getModel() : null), implicitModel, webRequest);
+
+ // Trigger after-completion for successful outcome
+ triggerAfterCompletion(executingContext, interceptorIndex, mav, null);
+
+ return mav;
+ }
+ catch (IllegalStateException ex) {
+ // Internal assertion failed (e.g. invalid signature):
+ // throw exception with full handler method context...
+ triggerAfterCompletion(executingContext, interceptorIndex, mav, ex);
+ throw new HandlerMethodInvocationException(handlerMethodToInvoke, ex);
+ }
+ catch (InvocationTargetException ex) {
+ // User-defined @ModelAttribute/@InitBinder/@RequestMapping method threw an exception...
+ triggerAfterCompletion(executingContext, interceptorIndex, mav, ex);
+ ReflectionUtils.rethrowException(ex.getTargetException());
+ return null;
+ }
+ }
+
+ private void triggerAfterCompletion(ActionExecutingContext executingContext,
+ int interceptorIndex,
+ ModelAndView modelAndView,
+ Exception ex) throws Exception {
+
+ // Apply afterCompletion methods of registered interceptors.
+ if (executingContext.getHandler() != null) {
+ //TODO should be passed in;
+ ActionInterceptor[] interceptors = getActionInterceptors();
+ if (interceptors != null) {
+ for (int i = interceptorIndex; i >= 0; i--) {
+ ActionInterceptor interceptor = interceptors[i];
+ ActionExecutedContext actionExecutedContext = new ActionExecutedContext(executingContext, modelAndView, ex);
+ try {
+ interceptor.afterCompletion(actionExecutedContext);
+ }
+ catch (Throwable ex2) {
+ logger.error("ActionInterceptor threw exception", ex2);
+ }
+ }
+ }
+ }
+ }
+
@Override
protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception {
diff --git a/spring-datastore-mongodb/.classpath b/spring-datastore-mongodb/.classpath
index 945d190a4..1209d5490 100644
--- a/spring-datastore-mongodb/.classpath
+++ b/spring-datastore-mongodb/.classpath
@@ -1,9 +1,14 @@
-
-
+
+
-
+
+
+
+
+
+
diff --git a/spring-datastore-mongodb/.project b/spring-datastore-mongodb/.project
index f40a78f9f..d56e29ce6 100644
--- a/spring-datastore-mongodb/.project
+++ b/spring-datastore-mongodb/.project
@@ -1,23 +1,36 @@
-
-
- spring-datastore-mongodb
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.maven.ide.eclipse.maven2Builder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.maven.ide.eclipse.maven2Nature
-
-
+
+
+ spring-datastore-mongodb
+
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.eclipse.jdt.core.javanature
+ org.maven.ide.eclipse.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+
+
diff --git a/spring-datastore-mongodb/.settings/org.eclipse.jdt.core.prefs b/spring-datastore-mongodb/.settings/org.eclipse.jdt.core.prefs
index 449698a94..cdc6b1939 100644
--- a/spring-datastore-mongodb/.settings/org.eclipse.jdt.core.prefs
+++ b/spring-datastore-mongodb/.settings/org.eclipse.jdt.core.prefs
@@ -1,6 +1,9 @@
-#Wed Oct 06 14:49:48 EDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
+#Thu Oct 14 10:28:36 EDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CannotGetMongoDbConnectionException.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CannotGetMongoDbConnectionException.java
index e6046e6db..61735fac8 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CannotGetMongoDbConnectionException.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CannotGetMongoDbConnectionException.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
import org.springframework.dao.DataAccessResourceFailureException;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CollectionCallback.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CollectionCallback.java
index b812963f7..44fc46be1 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CollectionCallback.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CollectionCallback.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
import org.springframework.dao.DataAccessException;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CollectionOptions.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CollectionOptions.java
index a75115df3..9b7315785 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CollectionOptions.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/CollectionOptions.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
public class CollectionOptions {
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoConverter.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoConverter.java
index 19ff7d946..5e33793f0 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoConverter.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoDocumentSource.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoDocumentSource.java
index 71d759b7c..29d061dcc 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoDocumentSource.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoDocumentSource.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
import org.springframework.datastore.document.DocumentSource;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoDocumentWriter.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoDocumentWriter.java
index 3e5d0deb6..52237a42a 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoDocumentWriter.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoDocumentWriter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
public interface MongoDocumentWriter {
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoReader.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoReader.java
index 04a74129c..b21c1614b 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoReader.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoReader.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
import com.mongodb.DBObject;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoReaderWriter.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoReaderWriter.java
index c5ae66782..14e6767b8 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoReaderWriter.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoReaderWriter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
public interface MongoReaderWriter extends MongoWriter, MongoReader {
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoWriter.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoWriter.java
index b9a515bfa..2e5351a31 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoWriter.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/MongoWriter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
import com.mongodb.DBObject;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/SimpleMongoConverter.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/SimpleMongoConverter.java
index 4a852a1c2..ee88e6d8f 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/SimpleMongoConverter.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/SimpleMongoConverter.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb;
import java.beans.PropertyDescriptor;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/BasicQuery.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/BasicQuery.java
index 321fed314..a3ae5f017 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/BasicQuery.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/BasicQuery.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;
import com.mongodb.DBObject;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/Criteria.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/Criteria.java
index 16f071b37..9e045f64c 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/Criteria.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/Criteria.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;
import java.util.ArrayList;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/CriteriaSpec.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/CriteriaSpec.java
index d6804d3fc..c4548205a 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/CriteriaSpec.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/CriteriaSpec.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;
import com.mongodb.DBObject;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/FieldSpecification.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/FieldSpecification.java
index 746927d09..5977f5191 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/FieldSpecification.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/FieldSpecification.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/OrCriteria.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/OrCriteria.java
index b5f97e88f..434008592 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/OrCriteria.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/OrCriteria.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;
import org.bson.types.BasicBSONList;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/Query.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/Query.java
index 2dafdb450..132dc5475 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/Query.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/Query.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;
import com.mongodb.DBObject;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/QueryBuilder.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/QueryBuilder.java
index dd0fa5f30..c710ad6cb 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/QueryBuilder.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/QueryBuilder.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;
import java.util.LinkedHashMap;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/SliceSpecification.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/SliceSpecification.java
index c5d97c153..92aaf6f6c 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/SliceSpecification.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/SliceSpecification.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;
diff --git a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/SortSpecification.java b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/SortSpecification.java
index 25e9196f0..9bf117527 100644
--- a/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/SortSpecification.java
+++ b/spring-datastore-mongodb/src/main/java/org/springframework/datastore/document/mongodb/query/SortSpecification.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
package org.springframework.datastore.document.mongodb.query;