code formatting
diff --git a/org.springframework.build.aws.maven/pom.xml b/org.springframework.build.aws.maven/pom.xml
index c09344e..5525262 100644
--- a/org.springframework.build.aws.maven/pom.xml
+++ b/org.springframework.build.aws.maven/pom.xml
@@ -4,11 +4,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.springframework.build.aws</groupId>
+ <groupId>net.anzix</groupId>
<artifactId>org.springframework.build.aws.maven</artifactId>
<packaging>jar</packaging>
<name>Amazon Web Services Maven Wagon Support</name>
- <version>3.1.0.RELEASE</version>
+ <version>3.1.2-SNAPSHOT</version>
<description>Standard Maven wagon support for s3:// urls</description>
<url>http://www.springframework.org</url>
<inceptionYear>2007</inceptionYear>
diff --git a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/AbstractWagon.java b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/AbstractWagon.java
index 2a0849c..e806b94 100644
--- a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/AbstractWagon.java
+++ b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/AbstractWagon.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.aws.maven;
import org.apache.maven.wagon.ConnectionException;
@@ -43,352 +42,326 @@
*/
public abstract class AbstractWagon implements Wagon {
- private boolean interactive;
+ private boolean interactive;
- private Repository repository;
+ private Repository repository;
- private boolean supportsDirectoryCopy;
+ private boolean supportsDirectoryCopy;
- private SessionListenerSupport sessionListeners = new SessionListenerSupport(this);
+ private SessionListenerSupport sessionListeners = new SessionListenerSupport(this);
- private TransferListenerSupport transferListeners = new TransferListenerSupport(this);
+ private TransferListenerSupport transferListeners = new TransferListenerSupport(this);
- private int timeout;
+ private int timeout;
- protected AbstractWagon(boolean supportsDirectoryCopy) {
- this.supportsDirectoryCopy = supportsDirectoryCopy;
- }
+ protected AbstractWagon(boolean supportsDirectoryCopy) {
+ this.supportsDirectoryCopy = supportsDirectoryCopy;
+ }
- public final void addSessionListener(SessionListener listener) {
- sessionListeners.addListener(listener);
- }
+ public final void addSessionListener(SessionListener listener) {
+ sessionListeners.addListener(listener);
+ }
- protected final SessionListenerSupport getSessionListeners() {
- return sessionListeners;
- }
+ protected final SessionListenerSupport getSessionListeners() {
+ return sessionListeners;
+ }
- public final boolean hasSessionListener(SessionListener listener) {
- return sessionListeners.hasListener(listener);
- }
+ public final boolean hasSessionListener(SessionListener listener) {
+ return sessionListeners.hasListener(listener);
+ }
- public final void removeSessionListener(SessionListener listener) {
- sessionListeners.removeListener(listener);
- }
+ public final void removeSessionListener(SessionListener listener) {
+ sessionListeners.removeListener(listener);
+ }
- public final void addTransferListener(TransferListener listener) {
- transferListeners.addListener(listener);
- }
+ public final void addTransferListener(TransferListener listener) {
+ transferListeners.addListener(listener);
+ }
- protected final TransferListenerSupport getTransferListeners() {
- return transferListeners;
- }
+ protected final TransferListenerSupport getTransferListeners() {
+ return transferListeners;
+ }
- public final boolean hasTransferListener(TransferListener listener) {
- return transferListeners.hasListener(listener);
- }
+ public final boolean hasTransferListener(TransferListener listener) {
+ return transferListeners.hasListener(listener);
+ }
- public final void removeTransferListener(TransferListener listener) {
- transferListeners.removeListener(listener);
- }
+ public final void removeTransferListener(TransferListener listener) {
+ transferListeners.removeListener(listener);
+ }
- public final Repository getRepository() {
- return repository;
- }
+ public final Repository getRepository() {
+ return repository;
+ }
- public final boolean isInteractive() {
- return interactive;
- }
+ public final boolean isInteractive() {
+ return interactive;
+ }
- public final void setInteractive(boolean interactive) {
- this.interactive = interactive;
- }
+ public final void setInteractive(boolean interactive) {
+ this.interactive = interactive;
+ }
- public final void connect(Repository source) throws ConnectionException, AuthenticationException {
- connect(source, null, (ProxyInfoProvider)null);
- }
+ public final void connect(Repository source) throws ConnectionException, AuthenticationException {
+ connect(source, null, (ProxyInfoProvider) null);
+ }
- public final void connect(Repository source, ProxyInfo proxyInfo) throws ConnectionException,
- AuthenticationException {
- connect(source, null, proxyInfo);
- }
+ public final void connect(Repository source, ProxyInfo proxyInfo) throws ConnectionException,
+ AuthenticationException {
+ connect(source, null, proxyInfo);
+ }
- public final void connect(Repository source, AuthenticationInfo authenticationInfo) throws ConnectionException,
- AuthenticationException {
- connect(source, authenticationInfo, (ProxyInfoProvider)null);
- }
+ public final void connect(Repository source, AuthenticationInfo authenticationInfo) throws ConnectionException,
+ AuthenticationException {
+ connect(source, authenticationInfo, (ProxyInfoProvider) null);
+ }
- public void connect(Repository source, ProxyInfoProvider proxyInfoProvider) throws ConnectionException, AuthenticationException {
- connect(source, null, proxyInfoProvider);
- }
+ public void connect(Repository source, ProxyInfoProvider proxyInfoProvider) throws ConnectionException, AuthenticationException {
+ connect(source, null, proxyInfoProvider);
+ }
- public void connect(Repository source, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo) throws ConnectionException, AuthenticationException {
- final ProxyInfo proxy = proxyInfo;
- connect(source, authenticationInfo, new ProxyInfoProvider() {
- public ProxyInfo getProxyInfo(String protocol) {
- if (protocol == null || proxy == null || protocol.equalsIgnoreCase(proxy.getType())) {
- return proxy;
- }
- else {
- return null;
- }
- }
- } );
- }
+ public void connect(Repository source, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo) throws ConnectionException, AuthenticationException {
+ final ProxyInfo proxy = proxyInfo;
+ connect(source, authenticationInfo, new ProxyInfoProvider() {
- public final void connect(Repository source, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider)
- throws ConnectionException, AuthenticationException {
- repository = source;
- sessionListeners.fireSessionOpening();
- try {
- connectToRepository(source, authenticationInfo, proxyInfoProvider);
- }
- catch (ConnectionException e) {
- sessionListeners.fireSessionConnectionRefused();
- throw e;
- }
- catch (AuthenticationException e) {
- sessionListeners.fireSessionConnectionRefused();
- throw e;
- }
- catch (Exception e) {
- sessionListeners.fireSessionConnectionRefused();
- throw new ConnectionException("Could not connect to repository", e);
- }
- sessionListeners.fireSessionLoggedIn();
- sessionListeners.fireSessionOpened();
- }
+ public ProxyInfo getProxyInfo(String protocol) {
+ if (protocol == null || proxy == null || protocol.equalsIgnoreCase(proxy.getType())) {
+ return proxy;
+ } else {
+ return null;
+ }
+ }
+ });
+ }
- public final void disconnect() throws ConnectionException {
- sessionListeners.fireSessionDisconnecting();
- try {
- disconnectFromRepository();
- }
- catch (ConnectionException e) {
- sessionListeners.fireSessionConnectionRefused();
- throw e;
- }
- catch (Exception e) {
- sessionListeners.fireSessionConnectionRefused();
- throw new ConnectionException("Could not disconnect from repository", e);
- }
- sessionListeners.fireSessionLoggedOff();
- sessionListeners.fireSessionDisconnected();
- }
+ public final void connect(Repository source, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider)
+ throws ConnectionException, AuthenticationException {
+ repository = source;
+ sessionListeners.fireSessionOpening();
+ try {
+ connectToRepository(source, authenticationInfo, proxyInfoProvider);
+ } catch (ConnectionException e) {
+ sessionListeners.fireSessionConnectionRefused();
+ throw e;
+ } catch (AuthenticationException e) {
+ sessionListeners.fireSessionConnectionRefused();
+ throw e;
+ } catch (Exception e) {
+ sessionListeners.fireSessionConnectionRefused();
+ throw new ConnectionException("Could not connect to repository", e);
+ }
+ sessionListeners.fireSessionLoggedIn();
+ sessionListeners.fireSessionOpened();
+ }
- public final void get(String resourceName, File destination) throws TransferFailedException,
- ResourceDoesNotExistException, AuthorizationException {
- Resource resource = new Resource(resourceName);
- transferListeners.fireTransferInitiated(resource, TransferEvent.REQUEST_GET);
- transferListeners.fireTransferStarted(resource, TransferEvent.REQUEST_GET);
+ public final void disconnect() throws ConnectionException {
+ sessionListeners.fireSessionDisconnecting();
+ try {
+ disconnectFromRepository();
+ } catch (ConnectionException e) {
+ sessionListeners.fireSessionConnectionRefused();
+ throw e;
+ } catch (Exception e) {
+ sessionListeners.fireSessionConnectionRefused();
+ throw new ConnectionException("Could not disconnect from repository", e);
+ }
+ sessionListeners.fireSessionLoggedOff();
+ sessionListeners.fireSessionDisconnected();
+ }
- try {
- getResource(resourceName, destination, new TransferProgress(resource, TransferEvent.REQUEST_GET,
- transferListeners));
- transferListeners.fireTransferCompleted(resource, TransferEvent.REQUEST_GET);
- }
- catch (TransferFailedException e) {
- throw e;
- }
- catch (ResourceDoesNotExistException e) {
- throw e;
- }
- catch (AuthorizationException e) {
- throw e;
- }
- catch (Exception e) {
- transferListeners.fireTransferError(resource, TransferEvent.REQUEST_GET, e);
- throw new TransferFailedException("Transfer of resource " + destination + "failed", e);
- }
- }
+ public final void get(String resourceName, File destination) throws TransferFailedException,
+ ResourceDoesNotExistException, AuthorizationException {
+ Resource resource = new Resource(resourceName);
+ transferListeners.fireTransferInitiated(resource, TransferEvent.REQUEST_GET);
+ transferListeners.fireTransferStarted(resource, TransferEvent.REQUEST_GET);
- @SuppressWarnings("unchecked")
- public final List getFileList(String destinationDirectory) throws TransferFailedException,
- ResourceDoesNotExistException, AuthorizationException {
- try {
- return listDirectory(destinationDirectory);
- }
- catch (TransferFailedException e) {
- throw e;
- }
- catch (ResourceDoesNotExistException e) {
- throw e;
- }
- catch (AuthorizationException e) {
- throw e;
- }
- catch (Exception e) {
- sessionListeners.fireSessionError(e);
- throw new TransferFailedException("Listing of directory " + destinationDirectory + "failed", e);
- }
- }
+ try {
+ getResource(resourceName, destination, new TransferProgress(resource, TransferEvent.REQUEST_GET,
+ transferListeners));
+ transferListeners.fireTransferCompleted(resource, TransferEvent.REQUEST_GET);
+ } catch (TransferFailedException e) {
+ throw e;
+ } catch (ResourceDoesNotExistException e) {
+ throw e;
+ } catch (AuthorizationException e) {
+ throw e;
+ } catch (Exception e) {
+ transferListeners.fireTransferError(resource, TransferEvent.REQUEST_GET, e);
+ throw new TransferFailedException("Transfer of resource " + destination + "failed", e);
+ }
+ }
- public final boolean getIfNewer(String resourceName, File destination, long timestamp)
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
- Resource resource = new Resource(resourceName);
- try {
- if (isRemoteResourceNewer(resourceName, timestamp)) {
- get(resourceName, destination);
- return true;
- }
- else {
- return false;
- }
- }
- catch (TransferFailedException e) {
- throw e;
- }
- catch (ResourceDoesNotExistException e) {
- throw e;
- }
- catch (AuthorizationException e) {
- throw e;
- }
- catch (Exception e) {
- transferListeners.fireTransferError(resource, TransferEvent.REQUEST_GET, e);
- throw new TransferFailedException("Transfer of resource " + destination + "failed", e);
- }
- }
+ @SuppressWarnings("unchecked")
+ public final List getFileList(String destinationDirectory) throws TransferFailedException,
+ ResourceDoesNotExistException, AuthorizationException {
+ try {
+ return listDirectory(destinationDirectory);
+ } catch (TransferFailedException e) {
+ throw e;
+ } catch (ResourceDoesNotExistException e) {
+ throw e;
+ } catch (AuthorizationException e) {
+ throw e;
+ } catch (Exception e) {
+ sessionListeners.fireSessionError(e);
+ throw new TransferFailedException("Listing of directory " + destinationDirectory + "failed", e);
+ }
+ }
- public final void openConnection() throws ConnectionException, AuthenticationException {
- // Nothing to do here (never called by the wagon manager)
- }
+ public final boolean getIfNewer(String resourceName, File destination, long timestamp)
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
+ Resource resource = new Resource(resourceName);
+ try {
+ if (isRemoteResourceNewer(resourceName, timestamp)) {
+ get(resourceName, destination);
+ return true;
+ } else {
+ return false;
+ }
+ } catch (TransferFailedException e) {
+ throw e;
+ } catch (ResourceDoesNotExistException e) {
+ throw e;
+ } catch (AuthorizationException e) {
+ throw e;
+ } catch (Exception e) {
+ transferListeners.fireTransferError(resource, TransferEvent.REQUEST_GET, e);
+ throw new TransferFailedException("Transfer of resource " + destination + "failed", e);
+ }
+ }
- public final void put(File source, String destination) throws TransferFailedException,
- ResourceDoesNotExistException, AuthorizationException {
- Resource resource = new Resource(destination);
- transferListeners.fireTransferInitiated(resource, TransferEvent.REQUEST_PUT);
- transferListeners.fireTransferStarted(resource, TransferEvent.REQUEST_PUT);
+ public final void openConnection() throws ConnectionException, AuthenticationException {
+ // Nothing to do here (never called by the wagon manager)
+ }
- try {
- putResource(source, destination, new TransferProgress(resource, TransferEvent.REQUEST_PUT,
- transferListeners));
- transferListeners.fireTransferCompleted(resource, TransferEvent.REQUEST_PUT);
- }
- catch (TransferFailedException e) {
- throw e;
- }
- catch (ResourceDoesNotExistException e) {
- throw e;
- }
- catch (AuthorizationException e) {
- throw e;
- }
- catch (Exception e) {
- transferListeners.fireTransferError(resource, TransferEvent.REQUEST_PUT, e);
- throw new TransferFailedException("Transfer of resource " + destination + "failed", e);
- }
- }
+ public final void put(File source, String destination) throws TransferFailedException,
+ ResourceDoesNotExistException, AuthorizationException {
+ Resource resource = new Resource(destination);
+ transferListeners.fireTransferInitiated(resource, TransferEvent.REQUEST_PUT);
+ transferListeners.fireTransferStarted(resource, TransferEvent.REQUEST_PUT);
- public final void putDirectory(File sourceDirectory, String destinationDirectory) throws TransferFailedException,
- ResourceDoesNotExistException, AuthorizationException {
- for (File f : sourceDirectory.listFiles()) {
- put(f, destinationDirectory + "/" + f.getName());
- }
- }
+ try {
+ putResource(source, destination, new TransferProgress(resource, TransferEvent.REQUEST_PUT,
+ transferListeners));
+ transferListeners.fireTransferCompleted(resource, TransferEvent.REQUEST_PUT);
+ } catch (TransferFailedException e) {
+ throw e;
+ } catch (ResourceDoesNotExistException e) {
+ throw e;
+ } catch (AuthorizationException e) {
+ throw e;
+ } catch (Exception e) {
+ transferListeners.fireTransferError(resource, TransferEvent.REQUEST_PUT, e);
+ throw new TransferFailedException("Transfer of resource " + destination + "failed", e);
+ }
+ }
- public final boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException {
- try {
- return doesRemoteResourceExist(resourceName);
- }
- catch (TransferFailedException e) {
- throw e;
- }
- catch (AuthorizationException e) {
- throw e;
- }
- catch (Exception e) {
- sessionListeners.fireSessionError(e);
- throw new TransferFailedException("Listing of resource " + resourceName + "failed", e);
- }
- }
+ public final void putDirectory(File sourceDirectory, String destinationDirectory) throws TransferFailedException,
+ ResourceDoesNotExistException, AuthorizationException {
+ for (File f : sourceDirectory.listFiles()) {
+ put(f, destinationDirectory + "/" + f.getName());
+ }
+ }
- public final boolean supportsDirectoryCopy() {
- return supportsDirectoryCopy;
- }
+ public final boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException {
+ try {
+ return doesRemoteResourceExist(resourceName);
+ } catch (TransferFailedException e) {
+ throw e;
+ } catch (AuthorizationException e) {
+ throw e;
+ } catch (Exception e) {
+ sessionListeners.fireSessionError(e);
+ throw new TransferFailedException("Listing of resource " + resourceName + "failed", e);
+ }
+ }
- public int getTimeout() {
- return timeout;
- }
+ public final boolean supportsDirectoryCopy() {
+ return supportsDirectoryCopy;
+ }
- public void setTimeout(int timeout) {
- this.timeout = timeout;
- }
+ public int getTimeout() {
+ return timeout;
+ }
- /**
- * Subclass must implement with specific connection behavior
- *
- * @param source The repository connection information
- * @param authenticationInfo Authentication information, if any
- * @param proxyInfo Proxy information, if any
- * @throws Exception Implementations can throw any exception and it will be
- * handled by the base class
- */
- protected abstract void connectToRepository(Repository source, AuthenticationInfo authenticationInfo,
- ProxyInfoProvider proxyInfo) throws Exception;
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
- /**
- * Subclass must implement with specific detection behavior
- *
- * @param resourceName The remote resource to detect
- * @return true if the remote resource exists
- * @throws Exception Implementations can throw any exception and it will be
- * handled by the base class
- */
- protected abstract boolean doesRemoteResourceExist(String resourceName) throws Exception;
+ /**
+ * Subclass must implement with specific connection behavior
+ *
+ * @param source The repository connection information
+ * @param authenticationInfo Authentication information, if any
+ * @param proxyInfo Proxy information, if any
+ * @throws Exception Implementations can throw any exception and it will be
+ * handled by the base class
+ */
+ protected abstract void connectToRepository(Repository source, AuthenticationInfo authenticationInfo,
+ ProxyInfoProvider proxyInfo) throws Exception;
- /**
- * Subclasses must implement with specific disconnection behavior
- *
- * @throws Exception Implementations can throw any exception and it will be
- * handled by the base class
- */
- protected abstract void disconnectFromRepository() throws Exception;
+ /**
+ * Subclass must implement with specific detection behavior
+ *
+ * @param resourceName The remote resource to detect
+ * @return true if the remote resource exists
+ * @throws Exception Implementations can throw any exception and it will be
+ * handled by the base class
+ */
+ protected abstract boolean doesRemoteResourceExist(String resourceName) throws Exception;
- /**
- * Subclass must implement with specific get behavior
- *
- * @param resourceName The name of the remote resource to read
- * @param destination The local file to write to
- * @param progress A progress notifier for the upload. It must be used or
- * hashes will not be calculated correctly
- * @throws Exception Implementations can throw any exception and it will be
- * handled by the base class
- */
- protected abstract void getResource(String resourceName, File destination, TransferProgress progress)
- throws Exception;
+ /**
+ * Subclasses must implement with specific disconnection behavior
+ *
+ * @throws Exception Implementations can throw any exception and it will be
+ * handled by the base class
+ */
+ protected abstract void disconnectFromRepository() throws Exception;
- /**
- * Subclass must implement with newer detection behavior
- *
- * @param resourceName The name of the resource being compared
- * @param timestamp The timestamp to compare against
- * @return true if the current version of the resource is newer than the
- * timestamp
- * @throws Exception Implementations can throw any exception and it will be
- * handled by the base class
- */
- protected abstract boolean isRemoteResourceNewer(String resourceName, long timestamp) throws Exception;
+ /**
+ * Subclass must implement with specific get behavior
+ *
+ * @param resourceName The name of the remote resource to read
+ * @param destination The local file to write to
+ * @param progress A progress notifier for the upload. It must be used or
+ * hashes will not be calculated correctly
+ * @throws Exception Implementations can throw any exception and it will be
+ * handled by the base class
+ */
+ protected abstract void getResource(String resourceName, File destination, TransferProgress progress)
+ throws Exception;
- /**
- * Subclass must implement with specific directory listing behavior
- *
- * @param directory The directory to list files in
- * @return A collection of file names
- * @throws Exception Implementations can throw any exception and it will be
- * handled by the base class
- */
- protected abstract List<String> listDirectory(String directory) throws Exception;
+ /**
+ * Subclass must implement with newer detection behavior
+ *
+ * @param resourceName The name of the resource being compared
+ * @param timestamp The timestamp to compare against
+ * @return true if the current version of the resource is newer than the
+ * timestamp
+ * @throws Exception Implementations can throw any exception and it will be
+ * handled by the base class
+ */
+ protected abstract boolean isRemoteResourceNewer(String resourceName, long timestamp) throws Exception;
- /**
- * Subclasses must implement with specific put behavior
- *
- * @param source The local source file to read from
- * @param destination The name of the remote resource to write to
- * @param progress A progress notifier for the upload. It must be used or
- * hashes will not be calculated correctly
- * @throws Exception Implementations can throw any exception and it will be
- * handled by the base class
- */
- protected abstract void putResource(File source, String destination, TransferProgress progress) throws Exception;
+ /**
+ * Subclass must implement with specific directory listing behavior
+ *
+ * @param directory The directory to list files in
+ * @return A collection of file names
+ * @throws Exception Implementations can throw any exception and it will be
+ * handled by the base class
+ */
+ protected abstract List<String> listDirectory(String directory) throws Exception;
+ /**
+ * Subclasses must implement with specific put behavior
+ *
+ * @param source The local source file to read from
+ * @param destination The name of the remote resource to write to
+ * @param progress A progress notifier for the upload. It must be used or
+ * hashes will not be calculated correctly
+ * @throws Exception Implementations can throw any exception and it will be
+ * handled by the base class
+ */
+ protected abstract void putResource(File source, String destination, TransferProgress progress) throws Exception;
}
diff --git a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/SessionListenerSupport.java b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/SessionListenerSupport.java
index 6084c10..a3e481f 100644
--- a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/SessionListenerSupport.java
+++ b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/SessionListenerSupport.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.aws.maven;
import java.util.HashSet;
@@ -32,128 +31,128 @@
*/
class SessionListenerSupport {
- private Wagon wagon;
+ private Wagon wagon;
- private Set<SessionListener> listeners = new HashSet<SessionListener>();
+ private Set<SessionListener> listeners = new HashSet<SessionListener>();
- /**
- * Creates a new instance
- * @param wagon The wagon that events will come from
- */
- public SessionListenerSupport(Wagon wagon) {
- this.wagon = wagon;
- }
+ /**
+ * Creates a new instance
+ * @param wagon The wagon that events will come from
+ */
+ public SessionListenerSupport(Wagon wagon) {
+ this.wagon = wagon;
+ }
- /**
- * Adds a listener to the collection
- * @param listener The listener to add
- */
- public void addListener(SessionListener listener) {
- listeners.add(listener);
- }
+ /**
+ * Adds a listener to the collection
+ * @param listener The listener to add
+ */
+ public void addListener(SessionListener listener) {
+ listeners.add(listener);
+ }
- /**
- * Removes a listener from the collection
- * @param listener The listener to remove
- */
- public void removeListener(SessionListener listener) {
- listeners.remove(listener);
- }
+ /**
+ * Removes a listener from the collection
+ * @param listener The listener to remove
+ */
+ public void removeListener(SessionListener listener) {
+ listeners.remove(listener);
+ }
- /**
- * Whether the collection already contains a listener
- * @param listener The listener to check for
- * @return Whether the collection contains a listener
- */
- public boolean hasListener(SessionListener listener) {
- return listeners.contains(listener);
- }
+ /**
+ * Whether the collection already contains a listener
+ * @param listener The listener to check for
+ * @return Whether the collection contains a listener
+ */
+ public boolean hasListener(SessionListener listener) {
+ return listeners.contains(listener);
+ }
- /**
- * Sends a session opening event to all listeners
- * @see SessionEvent#SESSION_OPENING
- */
- public void fireSessionOpening() {
- SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_OPENING);
- for (SessionListener listener : listeners) {
- listener.sessionOpening(event);
- }
- }
+ /**
+ * Sends a session opening event to all listeners
+ * @see SessionEvent#SESSION_OPENING
+ */
+ public void fireSessionOpening() {
+ SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_OPENING);
+ for (SessionListener listener : listeners) {
+ listener.sessionOpening(event);
+ }
+ }
- /**
- * Sends a session opened event to all listeners
- * @see SessionEvent#SESSION_OPENED
- */
- public void fireSessionOpened() {
- SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_OPENED);
- for (SessionListener listener : listeners) {
- listener.sessionOpened(event);
- }
- }
+ /**
+ * Sends a session opened event to all listeners
+ * @see SessionEvent#SESSION_OPENED
+ */
+ public void fireSessionOpened() {
+ SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_OPENED);
+ for (SessionListener listener : listeners) {
+ listener.sessionOpened(event);
+ }
+ }
- /**
- * Sends a session disconnecting event to all listeners
- * @see SessionEvent#SESSION_DISCONNECTING
- */
- public void fireSessionDisconnecting() {
- SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_DISCONNECTING);
- for (SessionListener listener : listeners) {
- listener.sessionDisconnecting(event);
- }
- }
+ /**
+ * Sends a session disconnecting event to all listeners
+ * @see SessionEvent#SESSION_DISCONNECTING
+ */
+ public void fireSessionDisconnecting() {
+ SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_DISCONNECTING);
+ for (SessionListener listener : listeners) {
+ listener.sessionDisconnecting(event);
+ }
+ }
- /**
- * Sends a session disconnected event to all listeners
- * @see SessionEvent#SESSION_DISCONNECTED
- */
- public void fireSessionDisconnected() {
- SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_DISCONNECTED);
- for (SessionListener listener : listeners) {
- listener.sessionDisconnected(event);
- }
- }
+ /**
+ * Sends a session disconnected event to all listeners
+ * @see SessionEvent#SESSION_DISCONNECTED
+ */
+ public void fireSessionDisconnected() {
+ SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_DISCONNECTED);
+ for (SessionListener listener : listeners) {
+ listener.sessionDisconnected(event);
+ }
+ }
- /**
- * Sends a session connection refused event to all listeners
- * @see SessionEvent#SESSION_CONNECTION_REFUSED
- */
- public void fireSessionConnectionRefused() {
- SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_CONNECTION_REFUSED);
- for (SessionListener listener : listeners) {
- listener.sessionConnectionRefused(event);
- }
- }
+ /**
+ * Sends a session connection refused event to all listeners
+ * @see SessionEvent#SESSION_CONNECTION_REFUSED
+ */
+ public void fireSessionConnectionRefused() {
+ SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_CONNECTION_REFUSED);
+ for (SessionListener listener : listeners) {
+ listener.sessionConnectionRefused(event);
+ }
+ }
- /**
- * Sends a session logged in event to all listeners
- * @see SessionEvent#SESSION_LOGGED_IN
- */
- public void fireSessionLoggedIn() {
- SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_LOGGED_IN);
- for (SessionListener listener : listeners) {
- listener.sessionLoggedIn(event);
- }
- }
+ /**
+ * Sends a session logged in event to all listeners
+ * @see SessionEvent#SESSION_LOGGED_IN
+ */
+ public void fireSessionLoggedIn() {
+ SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_LOGGED_IN);
+ for (SessionListener listener : listeners) {
+ listener.sessionLoggedIn(event);
+ }
+ }
- /**
- * Sends a session logged off event to all listeners
- * @see SessionEvent#SESSION_LOGGED_OFF
- */
- public void fireSessionLoggedOff() {
- SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_LOGGED_OFF);
- for (SessionListener listener : listeners) {
- listener.sessionLoggedOff(event);
- }
- }
+ /**
+ * Sends a session logged off event to all listeners
+ * @see SessionEvent#SESSION_LOGGED_OFF
+ */
+ public void fireSessionLoggedOff() {
+ SessionEvent event = new SessionEvent(wagon, SessionEvent.SESSION_LOGGED_OFF);
+ for (SessionListener listener : listeners) {
+ listener.sessionLoggedOff(event);
+ }
+ }
- /**
- * Sends a session error event to all listeners
- * @param e The session error
- */
- public void fireSessionError(Exception e) {
- SessionEvent event = new SessionEvent(wagon, e);
- for (SessionListener listener : listeners) {
- listener.sessionError(event);
- }
- }
+ /**
+ * Sends a session error event to all listeners
+ * @param e The session error
+ */
+ public void fireSessionError(Exception e) {
+ SessionEvent event = new SessionEvent(wagon, e);
+ for (SessionListener listener : listeners) {
+ listener.sessionError(event);
+ }
+ }
}
diff --git a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/SimpleStorageServiceWagon.java b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/SimpleStorageServiceWagon.java
index 0a6db3d..d48a14b 100644
--- a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/SimpleStorageServiceWagon.java
+++ b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/SimpleStorageServiceWagon.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.aws.maven;
import org.apache.maven.wagon.ResourceDoesNotExistException;
@@ -51,165 +50,160 @@
*/
public class SimpleStorageServiceWagon extends AbstractWagon {
- private S3Service service;
+ private S3Service service;
- private S3Bucket bucket;
+ private S3Bucket bucket;
- private String basedir;
+ private String basedir;
- public SimpleStorageServiceWagon() {
- super(false);
- }
+ public SimpleStorageServiceWagon() {
+ super(false);
+ }
- protected void connectToRepository(Repository source, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider)
- throws AuthenticationException {
- try {
- service = new RestS3Service(getCredentials(authenticationInfo));
- }
- catch (S3ServiceException e) {
- throw new AuthenticationException("Cannot authenticate with current credentials", e);
- }
- bucket = new S3Bucket(source.getHost());
- basedir = getBaseDir(source);
- }
+ protected void connectToRepository(Repository source, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider)
+ throws AuthenticationException {
+ try {
+ service = new RestS3Service(getCredentials(authenticationInfo));
+ } catch (S3ServiceException e) {
+ throw new AuthenticationException("Cannot authenticate with current credentials", e);
+ }
+ bucket = new S3Bucket(source.getHost());
+ basedir = getBaseDir(source);
+ }
- protected boolean doesRemoteResourceExist(String resourceName) {
- try {
- service.getObjectDetails(bucket, basedir + resourceName);
- }
- catch (S3ServiceException e) {
- return false;
- }
- return true;
- }
+ protected boolean doesRemoteResourceExist(String resourceName) {
+ try {
+ service.getObjectDetails(bucket, basedir + resourceName);
+ } catch (S3ServiceException e) {
+ return false;
+ }
+ return true;
+ }
- protected void disconnectFromRepository() {
- // Nothing to do for S3
- }
+ protected void disconnectFromRepository() {
+ // Nothing to do for S3
+ }
- protected void getResource(String resourceName, File destination, TransferProgress progress)
- throws ResourceDoesNotExistException, S3ServiceException, IOException {
- S3Object object;
- try {
- object = service.getObject(bucket, basedir + resourceName);
- }
- catch (S3ServiceException e) {
- throw new ResourceDoesNotExistException("Resource " + resourceName + " does not exist in the repository", e);
- }
+ protected void getResource(String resourceName, File destination, TransferProgress progress)
+ throws ResourceDoesNotExistException, S3ServiceException, IOException {
+ S3Object object;
+ try {
+ object = service.getObject(bucket, basedir + resourceName);
+ } catch (S3ServiceException e) {
+ throw new ResourceDoesNotExistException("Resource " + resourceName + " does not exist in the repository", e);
+ }
- if(!destination.getParentFile().exists()) {
- destination.getParentFile().mkdirs();
- }
+ if (!destination.getParentFile().exists()) {
+ destination.getParentFile().mkdirs();
+ }
- InputStream in = null;
- OutputStream out = null;
- try {
- in = object.getDataInputStream();
- out = new TransferProgressFileOutputStream(destination, progress);
- byte[] buffer = new byte[1024];
- int length;
- while ((length = in.read(buffer)) != -1) {
- out.write(buffer, 0, length);
- }
- }
- finally {
- if (in != null) {
- try {
- in.close();
- }
- catch (IOException e) {
- // Nothing possible at this point
- }
- }
- if (out != null) {
- try {
- out.close();
- }
- catch (IOException e) {
- // Nothing possible at this point
- }
- }
- }
- }
+ InputStream in = null;
+ OutputStream out = null;
+ try {
+ in = object.getDataInputStream();
+ out = new TransferProgressFileOutputStream(destination, progress);
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = in.read(buffer)) != -1) {
+ out.write(buffer, 0, length);
+ }
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // Nothing possible at this point
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // Nothing possible at this point
+ }
+ }
+ }
+ }
- protected boolean isRemoteResourceNewer(String resourceName, long timestamp) throws S3ServiceException {
- S3Object object = service.getObjectDetails(bucket, basedir + resourceName);
- return object.getLastModifiedDate().compareTo(new Date(timestamp)) < 0;
- }
+ protected boolean isRemoteResourceNewer(String resourceName, long timestamp) throws S3ServiceException {
+ S3Object object = service.getObjectDetails(bucket, basedir + resourceName);
+ return object.getLastModifiedDate().compareTo(new Date(timestamp)) < 0;
+ }
- protected List<String> listDirectory(String directory) throws Exception {
- S3Object[] objects = service.listObjects(bucket, basedir + directory, "");
- List<String> fileNames = new ArrayList<String>(objects.length);
- for (S3Object object : objects) {
- fileNames.add(object.getKey());
- }
- return fileNames;
- }
+ protected List<String> listDirectory(String directory) throws Exception {
+ S3Object[] objects = service.listObjects(bucket, basedir + directory, "");
+ List<String> fileNames = new ArrayList<String>(objects.length);
+ for (S3Object object : objects) {
+ fileNames.add(object.getKey());
+ }
+ return fileNames;
+ }
- protected void putResource(File source, String destination, TransferProgress progress) throws S3ServiceException,
- IOException {
- buildDestinationPath(getDestinationPath(destination));
- S3Object object = new S3Object(basedir + destination);
- object.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
- object.setDataInputFile(source);
- object.setContentLength(source.length());
+ protected void putResource(File source, String destination, TransferProgress progress) throws S3ServiceException,
+ IOException {
+ buildDestinationPath(getDestinationPath(destination));
+ S3Object object = new S3Object(basedir + destination);
+ object.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
+ object.setDataInputFile(source);
+ object.setContentLength(source.length());
- InputStream in = null;
- try {
- service.putObject(bucket, object);
+ InputStream in = null;
+ try {
+ service.putObject(bucket, object);
- in = new FileInputStream(source);
- byte[] buffer = new byte[1024];
- int length;
- while ((length = in.read(buffer)) != -1) {
- progress.notify(buffer, length);
- }
- }
- finally {
- if (in != null) {
- try {
- in.close();
- }
- catch (IOException e) {
- // Nothing possible at this point
- }
- }
- }
- }
+ in = new FileInputStream(source);
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = in.read(buffer)) != -1) {
+ progress.notify(buffer, length);
+ }
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // Nothing possible at this point
+ }
+ }
+ }
+ }
- private void buildDestinationPath(String destination) throws S3ServiceException {
- S3Object object = new S3Object(basedir + destination + "/");
- object.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
- object.setContentLength(0);
- service.putObject(bucket, object);
- int index = destination.lastIndexOf('/');
- if (index != -1) {
- buildDestinationPath(destination.substring(0, index));
- }
- }
+ private void buildDestinationPath(String destination) throws S3ServiceException {
+ S3Object object = new S3Object(basedir + destination + "/");
+ object.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
+ object.setContentLength(0);
+ service.putObject(bucket, object);
+ int index = destination.lastIndexOf('/');
+ if (index != -1) {
+ buildDestinationPath(destination.substring(0, index));
+ }
+ }
- private String getDestinationPath(String destination) {
- return destination.substring(0, destination.lastIndexOf('/'));
- }
+ private String getDestinationPath(String destination) {
+ return destination.substring(0, destination.lastIndexOf('/'));
+ }
- private String getBaseDir(Repository source) {
- StringBuilder sb = new StringBuilder(source.getBasedir());
- sb.deleteCharAt(0);
- if (sb.charAt(sb.length() - 1) != '/') {
- sb.append('/');
- }
- return sb.toString();
- }
+ private String getBaseDir(Repository source) {
+ StringBuilder sb = new StringBuilder(source.getBasedir());
+ sb.deleteCharAt(0);
+ if (sb.charAt(sb.length() - 1) != '/') {
+ sb.append('/');
+ }
+ return sb.toString();
+ }
- private AWSCredentials getCredentials(AuthenticationInfo authenticationInfo) throws AuthenticationException {
- if (authenticationInfo == null) {
- return null;
- }
- String accessKey = authenticationInfo.getUserName();
- String secretKey = authenticationInfo.getPassphrase();
- if (accessKey == null || secretKey == null) {
- throw new AuthenticationException("S3 requires a username and passphrase to be set");
- }
- return new AWSCredentials(accessKey, secretKey);
- }
+ private AWSCredentials getCredentials(AuthenticationInfo authenticationInfo) throws AuthenticationException {
+ if (authenticationInfo == null) {
+ return null;
+ }
+ String accessKey = authenticationInfo.getUserName();
+ String secretKey = authenticationInfo.getPassphrase();
+ if (secretKey == null) {
+ secretKey = authenticationInfo.getPassword();
+ }
+ if (accessKey == null || secretKey == null) {
+ throw new AuthenticationException("S3 requires a username and passphrase to be set");
+ }
+ return new AWSCredentials(accessKey, secretKey);
+ }
}
diff --git a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferListenerSupport.java b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferListenerSupport.java
index 83e502d..ef6c143 100644
--- a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferListenerSupport.java
+++ b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferListenerSupport.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.aws.maven;
import java.util.HashSet;
@@ -33,99 +32,99 @@
*/
class TransferListenerSupport {
- private Wagon wagon;
+ private Wagon wagon;
- private Set<TransferListener> listeners = new HashSet<TransferListener>();
+ private Set<TransferListener> listeners = new HashSet<TransferListener>();
- /**
- * Creates a new instance
- * @param wagon The wagon that events will come from
- */
- public TransferListenerSupport(Wagon wagon) {
- this.wagon = wagon;
- }
+ /**
+ * Creates a new instance
+ * @param wagon The wagon that events will come from
+ */
+ public TransferListenerSupport(Wagon wagon) {
+ this.wagon = wagon;
+ }
- /**
- * Adds a listener to the collection
- * @param listener The listener to add
- */
- public void addListener(TransferListener listener) {
- listeners.add(listener);
- }
+ /**
+ * Adds a listener to the collection
+ * @param listener The listener to add
+ */
+ public void addListener(TransferListener listener) {
+ listeners.add(listener);
+ }
- /**
- * Removes a listener from the collection
- * @param listener The listener to remove
- */
- public void removeListener(TransferListener listener) {
- listeners.remove(listener);
- }
+ /**
+ * Removes a listener from the collection
+ * @param listener The listener to remove
+ */
+ public void removeListener(TransferListener listener) {
+ listeners.remove(listener);
+ }
- /**
- * Whether the collection already contains a listener
- * @param listener The listener to check for
- * @return whether the collection contains the listener
- */
- public boolean hasListener(TransferListener listener) {
- return listeners.contains(listener);
- }
+ /**
+ * Whether the collection already contains a listener
+ * @param listener The listener to check for
+ * @return whether the collection contains the listener
+ */
+ public boolean hasListener(TransferListener listener) {
+ return listeners.contains(listener);
+ }
- /**
- * Sends a transfer initated event to all listeners
- * @param resource The resource being transfered
- * @param requestType GET or PUT request
- * @see TransferEvent#TRANSFER_INITIATED
- */
- public void fireTransferInitiated(Resource resource, int requestType) {
- TransferEvent event = new TransferEvent(wagon, resource, TransferEvent.TRANSFER_INITIATED, requestType);
- for (TransferListener listener : listeners) {
- listener.transferInitiated(event);
- }
- }
+ /**
+ * Sends a transfer initated event to all listeners
+ * @param resource The resource being transfered
+ * @param requestType GET or PUT request
+ * @see TransferEvent#TRANSFER_INITIATED
+ */
+ public void fireTransferInitiated(Resource resource, int requestType) {
+ TransferEvent event = new TransferEvent(wagon, resource, TransferEvent.TRANSFER_INITIATED, requestType);
+ for (TransferListener listener : listeners) {
+ listener.transferInitiated(event);
+ }
+ }
- /**
- * Sends a transfer started event to all listeners
- * @param resource The resource being transfered
- * @param requestType GET or PUT request
- * @see TransferEvent#TRANSFER_STARTED
- */
- public void fireTransferStarted(Resource resource, int requestType) {
- TransferEvent event = new TransferEvent(wagon, resource, TransferEvent.TRANSFER_STARTED, requestType);
- for (TransferListener listener : listeners) {
- listener.transferStarted(event);
- }
- }
+ /**
+ * Sends a transfer started event to all listeners
+ * @param resource The resource being transfered
+ * @param requestType GET or PUT request
+ * @see TransferEvent#TRANSFER_STARTED
+ */
+ public void fireTransferStarted(Resource resource, int requestType) {
+ TransferEvent event = new TransferEvent(wagon, resource, TransferEvent.TRANSFER_STARTED, requestType);
+ for (TransferListener listener : listeners) {
+ listener.transferStarted(event);
+ }
+ }
- public void fireTransferProgress(Resource resource, int requestType, byte[] buffer, int length) {
- TransferEvent event = new TransferEvent(wagon, resource, TransferEvent.TRANSFER_PROGRESS, requestType);
- for (TransferListener listener : listeners) {
- listener.transferProgress(event, buffer, length);
- }
- }
+ public void fireTransferProgress(Resource resource, int requestType, byte[] buffer, int length) {
+ TransferEvent event = new TransferEvent(wagon, resource, TransferEvent.TRANSFER_PROGRESS, requestType);
+ for (TransferListener listener : listeners) {
+ listener.transferProgress(event, buffer, length);
+ }
+ }
- /**
- * Sends a transfer completed event to all listeners
- * @param resource The resource being transfered
- * @param requestType GET or PUT request
- * @see TransferEvent#TRANSFER_COMPLETED
- */
- public void fireTransferCompleted(Resource resource, int requestType) {
- TransferEvent event = new TransferEvent(wagon, resource, TransferEvent.TRANSFER_COMPLETED, requestType);
- for (TransferListener listener : listeners) {
- listener.transferCompleted(event);
- }
- }
+ /**
+ * Sends a transfer completed event to all listeners
+ * @param resource The resource being transfered
+ * @param requestType GET or PUT request
+ * @see TransferEvent#TRANSFER_COMPLETED
+ */
+ public void fireTransferCompleted(Resource resource, int requestType) {
+ TransferEvent event = new TransferEvent(wagon, resource, TransferEvent.TRANSFER_COMPLETED, requestType);
+ for (TransferListener listener : listeners) {
+ listener.transferCompleted(event);
+ }
+ }
- /**
- * Sends a transfer error event to all listeners
- * @param resource The resource being transfered
- * @param requestType GET or PUT request
- * @param e The transfer error
- */
- public void fireTransferError(Resource resource, int requestType, Exception e) {
- TransferEvent event = new TransferEvent(wagon, resource, e, requestType);
- for (TransferListener listener : listeners) {
- listener.transferError(event);
- }
- }
+ /**
+ * Sends a transfer error event to all listeners
+ * @param resource The resource being transfered
+ * @param requestType GET or PUT request
+ * @param e The transfer error
+ */
+ public void fireTransferError(Resource resource, int requestType, Exception e) {
+ TransferEvent event = new TransferEvent(wagon, resource, e, requestType);
+ for (TransferListener listener : listeners) {
+ listener.transferError(event);
+ }
+ }
}
diff --git a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgress.java b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgress.java
index a45cc86..e1ebece 100644
--- a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgress.java
+++ b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgress.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.aws.maven;
import org.apache.maven.wagon.resource.Resource;
@@ -27,20 +26,19 @@
*/
class TransferProgress {
- private Resource resource;
+ private Resource resource;
- private int requestType;
+ private int requestType;
- private TransferListenerSupport transferListeners;
+ private TransferListenerSupport transferListeners;
- public TransferProgress(Resource resource, int requestType, TransferListenerSupport listeners) {
- this.resource = resource;
- this.requestType = requestType;
- this.transferListeners = listeners;
- }
+ public TransferProgress(Resource resource, int requestType, TransferListenerSupport listeners) {
+ this.resource = resource;
+ this.requestType = requestType;
+ this.transferListeners = listeners;
+ }
- protected void notify(byte[] buffer, int length) {
- transferListeners.fireTransferProgress(resource, requestType, buffer, length);
- }
-
+ protected void notify(byte[] buffer, int length) {
+ transferListeners.fireTransferProgress(resource, requestType, buffer, length);
+ }
}
diff --git a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgressFileInputStream.java b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgressFileInputStream.java
index c1fce13..438bb51 100644
--- a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgressFileInputStream.java
+++ b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgressFileInputStream.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.aws.maven;
import java.io.File;
@@ -30,35 +29,34 @@
*/
public class TransferProgressFileInputStream extends FileInputStream {
- private TransferProgress progress;
+ private TransferProgress progress;
- public TransferProgressFileInputStream(File file, TransferProgress progress) throws FileNotFoundException {
- super(file);
- this.progress = progress;
- }
+ public TransferProgressFileInputStream(File file, TransferProgress progress) throws FileNotFoundException {
+ super(file);
+ this.progress = progress;
+ }
- public int read() throws IOException {
- int b = super.read();
- progress.notify(new byte[] { (byte) b }, 1);
- return b;
- }
+ public int read() throws IOException {
+ int b = super.read();
+ progress.notify(new byte[]{(byte) b}, 1);
+ return b;
+ }
- public int read(byte b[]) throws IOException {
- int count = super.read(b);
- progress.notify(b, b.length);
- return count;
- }
+ public int read(byte b[]) throws IOException {
+ int count = super.read(b);
+ progress.notify(b, b.length);
+ return count;
+ }
- public int read(byte b[], int off, int len) throws IOException {
- int count = super.read(b, off, len);
- if (off == 0) {
- progress.notify(b, len);
- }
- else {
- byte[] bytes = new byte[len];
- System.arraycopy(b, off, bytes, 0, len);
- progress.notify(bytes, len);
- }
- return count;
- }
+ public int read(byte b[], int off, int len) throws IOException {
+ int count = super.read(b, off, len);
+ if (off == 0) {
+ progress.notify(b, len);
+ } else {
+ byte[] bytes = new byte[len];
+ System.arraycopy(b, off, bytes, 0, len);
+ progress.notify(bytes, len);
+ }
+ return count;
+ }
}
diff --git a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgressFileOutputStream.java b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgressFileOutputStream.java
index e24b8a3..73815e3 100644
--- a/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgressFileOutputStream.java
+++ b/org.springframework.build.aws.maven/src/main/java/org/springframework/aws/maven/TransferProgressFileOutputStream.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.aws.maven;
import java.io.File;
@@ -30,32 +29,31 @@
*/
class TransferProgressFileOutputStream extends FileOutputStream {
- private TransferProgress progress;
+ private TransferProgress progress;
- public TransferProgressFileOutputStream(File file, TransferProgress progress) throws FileNotFoundException {
- super(file);
- this.progress = progress;
- }
+ public TransferProgressFileOutputStream(File file, TransferProgress progress) throws FileNotFoundException {
+ super(file);
+ this.progress = progress;
+ }
- public void write(int b) throws IOException {
- super.write(b);
- progress.notify(new byte[] { (byte) b }, 1);
- }
+ public void write(int b) throws IOException {
+ super.write(b);
+ progress.notify(new byte[]{(byte) b}, 1);
+ }
- public void write(byte b[]) throws IOException {
- super.write(b);
- progress.notify(b, b.length);
- }
+ public void write(byte b[]) throws IOException {
+ super.write(b);
+ progress.notify(b, b.length);
+ }
- public void write(byte b[], int off, int len) throws IOException {
- super.write(b, off, len);
- if (off == 0) {
- progress.notify(b, len);
- }
- else {
- byte[] bytes = new byte[len];
- System.arraycopy(b, off, bytes, 0, len);
- progress.notify(bytes, len);
- }
- }
+ public void write(byte b[], int off, int len) throws IOException {
+ super.write(b, off, len);
+ if (off == 0) {
+ progress.notify(b, len);
+ } else {
+ byte[] bytes = new byte[len];
+ System.arraycopy(b, off, bytes, 0, len);
+ progress.notify(bytes, len);
+ }
+ }
}