[spring-extensions] branch master updated: IDP-1047 Annotate Constructor Parameters.

Rod Widdowson rdw at steadingsoftware.com
Tue Oct 11 05:56:48 EDT 2016


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=91fdef9a59c77a20bf6c656a5dae8523568adb42

The following commit(s) were added to refs/heads/master by this push:
       new  91fdef9   IDP-1047 Annotate Constructor Parameters.
91fdef9 is described below

commit 91fdef9a59c77a20bf6c656a5dae8523568adb42
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Oct 11 10:55:18 2016 +0100

    IDP-1047 Annotate Constructor Parameters.
    
    https://issues.shibboleth.net/jira/browse/IDP-1047
---
 .../ext/spring/resource/FileBackedHTTPResource.java |  2 ++
 .../ext/spring/resource/HTTPResource.java           | 14 +++++++-------
 .../ext/spring/resource/ResourceHelper.java         |  5 +++--
 .../resource/SVNBasicAuthenticationManager.java     | 14 ++++++++++----
 .../shibboleth/ext/spring/resource/SVNResource.java | 21 ++++++++++++++-------
 5 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java b/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
index db049f6..a010465 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResource.java
@@ -93,6 +93,8 @@ public class FileBackedHTTPResource extends HTTPResource {
         if (null == resource.getFile()) {
             throw new IOException("Backing resource has to be file backed");
         }
+        log.warn("This constructor is deprecated, use backingFile=\"/path/to/file\" instead "
+                + "of resource=\"file:///path/to/file\"");
     }
 
     /**
diff --git a/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java b/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
index 285ae9d..9c654fa 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/HTTPResource.java
@@ -28,6 +28,7 @@ import java.net.URL;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import net.shibboleth.utilities.java.support.annotation.ParameterName;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -64,13 +65,10 @@ public class HTTPResource extends AbstractIdentifiedInitializableComponent imple
     private final Logger log = LoggerFactory.getLogger(HTTPResource.class);
 
     /** HTTP Client used to pull the resource. */
-    private final HttpClient httpClient;
-
-    /** URI to the Resource. */
-    // private final URI resourceURI;
+    @Nonnull private final HttpClient httpClient;
 
     /** URL to the Resource. */
-    private final URL resourceURL;
+    @Nonnull private final URL resourceURL;
 
     /** HttpClient credentials provider. */
     private BasicCredentialsProvider credentialsProvider;
@@ -82,7 +80,8 @@ public class HTTPResource extends AbstractIdentifiedInitializableComponent imple
      * @param url URL to the remote data
      * @throws IOException if the URL was badly formed
      */
-    public HTTPResource(@Nonnull final HttpClient client, @NotEmpty @Nonnull final String url) throws IOException {
+    public HTTPResource(@Nonnull @ParameterName(name="client") final HttpClient client,
+            @Nonnull @NotEmpty @ParameterName(name="url") final String url) throws IOException {
         httpClient = Constraint.isNotNull(client, "The Client must not be null");
         final String trimmedAddress =
                 Constraint.isNotNull(StringSupport.trimOrNull(url), "Provided URL must be non empty and non null");
@@ -97,7 +96,8 @@ public class HTTPResource extends AbstractIdentifiedInitializableComponent imple
      * @param url URL to the remote data
      * @throws IOException if the URL was badly formed
      */
-    public HTTPResource(@Nonnull final HttpClient client, @Nonnull final URL url) throws IOException {
+    public HTTPResource(@Nonnull @ParameterName(name="") final HttpClient client,
+            @Nonnull @ParameterName(name="url") final URL url) throws IOException {
         httpClient = Constraint.isNotNull(client, "The Client must not be null");
         resourceURL = Constraint.isNotNull(url, "Provided URL must be non empty and non null");
 
diff --git a/src/main/java/net/shibboleth/ext/spring/resource/ResourceHelper.java b/src/main/java/net/shibboleth/ext/spring/resource/ResourceHelper.java
index a44a090..016b062 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/ResourceHelper.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/ResourceHelper.java
@@ -25,6 +25,7 @@ import java.net.URL;
 
 import javax.annotation.Nonnull;
 
+import net.shibboleth.utilities.java.support.annotation.ParameterName;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.springframework.core.io.Resource;
@@ -43,7 +44,6 @@ public final class ResourceHelper implements net.shibboleth.utilities.java.suppo
      * @param theResource the spring resource;
      */
     private ResourceHelper(@Nonnull final Resource theResource) {
-
         springResource = Constraint.isNotNull(theResource, "provided Spring Resource should not be null");
     }
 
@@ -54,7 +54,8 @@ public final class ResourceHelper implements net.shibboleth.utilities.java.suppo
      * @param springResource the input
      * @return a {@link Resource} which reflects what the Spring one does
      */
-    public static net.shibboleth.utilities.java.support.resource.Resource of(final Resource springResource) {
+    public static net.shibboleth.utilities.java.support.resource.Resource
+                 of(@ParameterName(name="springResource") final Resource springResource) {
         if (springResource instanceof net.shibboleth.utilities.java.support.resource.Resource) {
             return (net.shibboleth.utilities.java.support.resource.Resource) springResource;
         }
diff --git a/src/main/java/net/shibboleth/ext/spring/resource/SVNBasicAuthenticationManager.java b/src/main/java/net/shibboleth/ext/spring/resource/SVNBasicAuthenticationManager.java
index 51a85d0..328da19 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/SVNBasicAuthenticationManager.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/SVNBasicAuthenticationManager.java
@@ -22,6 +22,8 @@ import java.util.List;
 
 import javax.annotation.concurrent.ThreadSafe;
 
+import net.shibboleth.utilities.java.support.annotation.ParameterName;
+
 import org.springframework.beans.factory.InitializingBean;
 import org.tmatesoft.svn.core.auth.BasicAuthenticationManager;
 import org.tmatesoft.svn.core.auth.SVNAuthentication;
@@ -53,7 +55,7 @@ public class SVNBasicAuthenticationManager extends BasicAuthenticationManager im
      * 
      * @param authentications authentications
      */
-    public SVNBasicAuthenticationManager(final List<SVNAuthentication> authentications) {
+    public SVNBasicAuthenticationManager(@ParameterName(name="")  final List<SVNAuthentication> authentications) {
         super(authentications.toArray(new SVNAuthentication[authentications.size()]));
     }
 
@@ -66,8 +68,11 @@ public class SVNBasicAuthenticationManager extends BasicAuthenticationManager im
      * @param portNumber a port number over which an ssh tunnel is established
      */
     @SuppressWarnings("deprecation")
-    public SVNBasicAuthenticationManager(final String userName, final File keyFile, 
-            final String passphrase, final int portNumber) {
+    public SVNBasicAuthenticationManager(
+            @ParameterName(name="userName") final String userName,
+            @ParameterName(name="keyFile" ) final File keyFile,
+            @ParameterName(name="passphrase") final String passphrase,
+            @ParameterName(name="portNumber") final int portNumber) {
         super(userName, keyFile, passphrase, portNumber);
     }
 
@@ -78,7 +83,8 @@ public class SVNBasicAuthenticationManager extends BasicAuthenticationManager im
      * @param password a password
      */
     @SuppressWarnings("deprecation")
-    public SVNBasicAuthenticationManager(final String userName, final String password) {
+    public SVNBasicAuthenticationManager(@ParameterName(name="userName") final String userName,
+            @ParameterName(name="password") final String password) {
         super(userName, password);
     }
 
diff --git a/src/main/java/net/shibboleth/ext/spring/resource/SVNResource.java b/src/main/java/net/shibboleth/ext/spring/resource/SVNResource.java
index ce4b3f9..25be902 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/SVNResource.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/SVNResource.java
@@ -25,6 +25,9 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 
+import javax.annotation.Nonnull;
+
+import net.shibboleth.utilities.java.support.annotation.ParameterName;
 import net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
@@ -67,13 +70,13 @@ public class SVNResource extends AbstractIdentifiedInitializableComponent implem
     private final Logger log = LoggerFactory.getLogger(SVNResource.class);
 
     /** SVN Client manager. */
-    private final SVNClientManager clientManager;
+    @Nonnull private final SVNClientManager clientManager;
 
     /** URL to the remote repository. */
-    private SVNURL remoteRepository;
+    @Nonnull private SVNURL remoteRepository;
 
     /** Directory where the working copy will be kept. */
-    private File workingCopyDirectory;
+    @Nonnull private File workingCopyDirectory;
 
     /** Revision of the working copy. */
     private SVNRevision retrievalRevision;
@@ -95,8 +98,12 @@ public class SVNResource extends AbstractIdentifiedInitializableComponent implem
      * 
      * @throws BeanCreationException thrown if there is a problem initializing the SVN resource
      */
-    public SVNResource(final SVNClientManager svnClientMgr, final SVNURL repositoryUrl, 
-            final File workingCopy, final long workingRevision, final String resourceFile) {
+    public SVNResource(
+            @Nonnull @ParameterName(name="svnClientMgr") final SVNClientManager svnClientMgr,
+            @Nonnull @ParameterName(name="repositoryUrl") final SVNURL repositoryUrl,
+            @Nonnull @ParameterName(name="workingCopy") final File workingCopy,
+            @ParameterName(name="workingRevision") final long workingRevision,
+            @Nonnull @ParameterName(name="resourceFile") final String resourceFile) {
         DAVRepositoryFactory.setup();
         SVNRepositoryFactoryImpl.setup();
         FSRepositoryFactory.setup();
@@ -149,7 +156,7 @@ public class SVNResource extends AbstractIdentifiedInitializableComponent implem
      * 
      * @param fileName the name
      */
-    public void setFilename(final String fileName) {
+    public void setFilename(@Nonnull final String fileName) {
         resourceFileName = StringSupport.trimOrNull(fileName);
         if (resourceFileName == null) {
             log.error("SVN working copy resource file name may not be null or empty");
@@ -186,7 +193,7 @@ public class SVNResource extends AbstractIdentifiedInitializableComponent implem
      * 
      * @throws IOException thrown if the file is invalid
      */
-    protected void checkWorkingCopyDirectory(final File directory) throws IOException {
+    protected void checkWorkingCopyDirectory(@Nonnull final File directory) throws IOException {
         if (directory == null) {
             log.error("SVN working copy directory cannot be null");
             throw new IOException("SVN working copy directory cannot be null");

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list