diff --git a/spring-core/src/main/java/org/springframework/core/io/ClassPathResource.java b/spring-core/src/main/java/org/springframework/core/io/ClassPathResource.java index dacfb011adf..10a379700e6 100644 --- a/spring-core/src/main/java/org/springframework/core/io/ClassPathResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/ClassPathResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -27,8 +27,8 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; /** - * {@link Resource} implementation for class path resources. - * Uses either a given ClassLoader or a given Class for loading resources. + * {@link Resource} implementation for class path resources. Uses either a + * given {@link ClassLoader} or a given {@link Class} for loading resources. * *
Supports resolution as {@code java.io.File} if the class path * resource resides in the file system, but not for resources in a JAR. @@ -229,6 +229,7 @@ public class ClassPathResource extends AbstractFileResolvingResource { return builder.toString(); } + /** * This implementation compares the underlying class path locations. */ diff --git a/spring-core/src/main/java/org/springframework/core/io/FileSystemResource.java b/spring-core/src/main/java/org/springframework/core/io/FileSystemResource.java index 8f332385c67..294a3e3726b 100644 --- a/spring-core/src/main/java/org/springframework/core/io/FileSystemResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/FileSystemResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -115,6 +115,26 @@ public class FileSystemResource extends AbstractResource implements WritableReso return new FileInputStream(this.file); } + /** + * This implementation checks whether the underlying file is marked as writable + * (and corresponds to an actual file with content, not to a directory). + * @see java.io.File#canWrite() + * @see java.io.File#isDirectory() + */ + @Override + public boolean isWritable() { + return (this.file.canWrite() && !this.file.isDirectory()); + } + + /** + * This implementation opens a FileOutputStream for the underlying file. + * @see java.io.FileOutputStream + */ + @Override + public OutputStream getOutputStream() throws IOException { + return new FileOutputStream(this.file); + } + /** * This implementation returns a URL for the underlying file. * @see java.io.File#toURI() @@ -180,29 +200,6 @@ public class FileSystemResource extends AbstractResource implements WritableReso } - // implementation of WritableResource - - /** - * This implementation checks whether the underlying file is marked as writable - * (and corresponds to an actual file with content, not to a directory). - * @see java.io.File#canWrite() - * @see java.io.File#isDirectory() - */ - @Override - public boolean isWritable() { - return (this.file.canWrite() && !this.file.isDirectory()); - } - - /** - * This implementation opens a FileOutputStream for the underlying file. - * @see java.io.FileOutputStream - */ - @Override - public OutputStream getOutputStream() throws IOException { - return new FileOutputStream(this.file); - } - - /** * This implementation compares the underlying File references. */ diff --git a/spring-core/src/main/java/org/springframework/core/io/PathResource.java b/spring-core/src/main/java/org/springframework/core/io/PathResource.java index 8dfd0447edd..f84ccfa9083 100644 --- a/spring-core/src/main/java/org/springframework/core/io/PathResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/PathResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -37,6 +37,7 @@ import org.springframework.util.Assert; * Implements the extended {@link WritableResource} interface. * * @author Philippe Marschall + * @author Juergen Hoeller * @since 4.0 * @see java.nio.file.Path */ @@ -130,6 +131,29 @@ public class PathResource extends AbstractResource implements WritableResource { return Files.newInputStream(this.path); } + /** + * This implementation checks whether the underlying file is marked as writable + * (and corresponds to an actual file with content, not to a directory). + * @see java.nio.file.Files#isWritable(Path) + * @see java.nio.file.Files#isDirectory(Path, java.nio.file.LinkOption...) + */ + @Override + public boolean isWritable() { + return (Files.isWritable(this.path) && !Files.isDirectory(this.path)); + } + + /** + * This implementation opens a OutputStream for the underlying file. + * @see java.nio.file.spi.FileSystemProvider#newOutputStream(Path, OpenOption...) + */ + @Override + public OutputStream getOutputStream() throws IOException { + if (Files.isDirectory(this.path)) { + throw new FileNotFoundException(getPath() + " (is a directory)"); + } + return Files.newOutputStream(this.path); + } + /** * This implementation returns a URL for the underlying file. * @see java.nio.file.Path#toUri() @@ -178,8 +202,8 @@ public class PathResource extends AbstractResource implements WritableResource { */ @Override public long lastModified() throws IOException { - // we can not use the super class method since it uses conversion to a File and - // only Paths on the default file system can be converted to a File + // We can not use the superclass method since it uses conversion to a File and + // only a Path on the default file system can be converted to a File... return Files.getLastModifiedTime(path).toMillis(); } @@ -207,31 +231,6 @@ public class PathResource extends AbstractResource implements WritableResource { return "path [" + this.path.toAbsolutePath() + "]"; } - // implementation of WritableResource - - /** - * This implementation checks whether the underlying file is marked as writable - * (and corresponds to an actual file with content, not to a directory). - * @see java.nio.file.Files#isWritable(Path) - * @see java.nio.file.Files#isDirectory(Path, java.nio.file.LinkOption...) - */ - @Override - public boolean isWritable() { - return Files.isWritable(this.path) && !Files.isDirectory(this.path); - } - - /** - * This implementation opens a OutputStream for the underlying file. - * @see java.nio.file.spi.FileSystemProvider#newOutputStream(Path, OpenOption...) - */ - @Override - public OutputStream getOutputStream() throws IOException { - if (Files.isDirectory(this.path)) { - throw new FileNotFoundException(getPath() + " (is a directory)"); - } - return Files.newOutputStream(this.path); - } - /** * This implementation compares the underlying Path references. diff --git a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListener.java b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListener.java index 4a9cf987b45..a4617023d37 100644 --- a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListener.java +++ b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -25,21 +25,20 @@ import java.lang.annotation.Target; import org.springframework.messaging.handler.annotation.MessageMapping; /** - * Annotation that marks a method to be the target of a JMS message - * listener on the specified {@link #destination}. The {@link #containerFactory} - * identifies the {@link org.springframework.jms.config.JmsListenerContainerFactory - * JmsListenerContainerFactory} to use to build the JMS listener container. If not - * set, a default container factory is assumed to be available with a bean - * name of {@code jmsListenerContainerFactory} unless an explicit default has been - * provided through configuration. + * Annotation that marks a method to be the target of a JMS message listener on the + * specified {@link #destination}. The {@link #containerFactory} identifies the + * {@link org.springframework.jms.config.JmsListenerContainerFactory} to use to build + * the JMS listener container. If not set, a default container factory is + * assumed to be available with a bean name of {@code jmsListenerContainerFactory} + * unless an explicit default has been provided through configuration. * - *
Processing of {@code @JmsListener} annotations is performed by
- * registering a {@link JmsListenerAnnotationBeanPostProcessor}. This can be
- * done manually or, more conveniently, through the {@code
Processing of {@code @JmsListener} annotations is performed by registering a
+ * {@link JmsListenerAnnotationBeanPostProcessor}. This can be done manually or,
+ * more conveniently, through the {@code
Annotated methods are allowed to have flexible signatures similar to what - * {@link MessageMapping} provides: + *
Annotated JMS listener methods are allowed to have flexible signatures similar + * to what {@link MessageMapping} provides: *
Annotated methods may have a non-{@code void} return type. When they do, @@ -73,8 +72,8 @@ import org.springframework.messaging.handler.annotation.MessageMapping; */ @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) -@MessageMapping @Documented +@MessageMapping public @interface JmsListener { /** @@ -85,7 +84,7 @@ public @interface JmsListener { String id() default ""; /** - * The bean name of the {@link org.springframework.jms.config.JmsListenerContainerFactory JmsListenerContainerFactory} + * The bean name of the {@link org.springframework.jms.config.JmsListenerContainerFactory} * to use to create the message listener container responsible for serving this endpoint. *
If not specified, the default container factory is used, if any. */ @@ -93,8 +92,7 @@ public @interface JmsListener { /** * The destination name for this listener, resolved through the container-wide - * {@link org.springframework.jms.support.destination.DestinationResolver DestinationResolver} - * strategy. + * {@link org.springframework.jms.support.destination.DestinationResolver} strategy. */ String destination(); diff --git a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java index edf6c97634a..2aa44a5b069 100644 --- a/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java +++ b/spring-jms/src/main/java/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -54,8 +54,8 @@ import org.springframework.util.StringUtils; /** * Bean post-processor that registers methods annotated with {@link JmsListener} * to be invoked by a JMS message listener container created under the cover - * by a {@link org.springframework.jms.config.JmsListenerContainerFactory} according - * to the parameters of the annotation. + * by a {@link org.springframework.jms.config.JmsListenerContainerFactory} + * according to the attributes of the annotation. * *
Annotated methods can use flexible arguments as defined by {@link JmsListener}.
*
@@ -63,10 +63,10 @@ import org.springframework.util.StringUtils;
* {@code Auto-detect any {@link JmsListenerConfigurer} instances in the container,
+ * Autodetects any {@link JmsListenerConfigurer} instances in the container,
* allowing for customization of the registry to be used, the default container
- * factory or for fine-grained control over endpoints registration. See
- * {@link EnableJms} Javadoc for complete usage details.
+ * factory or for fine-grained control over endpoints registration. See the
+ * {@link EnableJms} javadocs for complete usage details.
*
* @author Stephane Nicoll
* @author Juergen Hoeller
@@ -208,8 +208,8 @@ public class JmsListenerAnnotationBeanPostProcessor
});
if (annotatedMethods.isEmpty()) {
this.nonAnnotatedClasses.add(bean.getClass());
- if (logger.isDebugEnabled()) {
- logger.debug("No @JmsListener annotations found on bean class: " + bean.getClass());
+ if (logger.isTraceEnabled()) {
+ logger.trace("No @JmsListener annotations found on bean class: " + bean.getClass());
}
}
else {
@@ -281,7 +281,7 @@ public class JmsListenerAnnotationBeanPostProcessor
return resolve(jmsListener.id());
}
else {
- return "org.springframework.jms.JmsListenerEndpointContainer#" + counter.getAndIncrement();
+ return "org.springframework.jms.JmsListenerEndpointContainer#" + this.counter.getAndIncrement();
}
}
diff --git a/spring-messaging/src/main/java/org/springframework/messaging/MessageHeaders.java b/spring-messaging/src/main/java/org/springframework/messaging/MessageHeaders.java
index a227e8d6e8e..7c69098acd2 100644
--- a/spring-messaging/src/main/java/org/springframework/messaging/MessageHeaders.java
+++ b/spring-messaging/src/main/java/org/springframework/messaging/MessageHeaders.java
@@ -165,6 +165,7 @@ public class MessageHeaders implements Map