You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wagon-commits@maven.apache.org by mi...@apache.org on 2003/12/02 19:01:30 UTC
cvs commit: maven-wagon/wagon-api project.xml
michal 2003/12/02 10:01:30
Modified: wagon-api/src/main/java/org/apache/maven/wagon/events
Debug.java SessionEvent.java
SessionEventSupport.java SessionListener.java
TransferEvent.java TransferEventSupport.java
WagonEvent.java
wagon-api/src/main/java/org/apache/maven/wagon/result
ByteArrayResult.java FileResult.java
WagonResult.java
wagon-api/src/main/java/org/apache/maven/wagon/source
ByteArraySource.java FileSource.java
StreamSource.java WagonSource.java
wagon-api/src/main/java/org/apache/maven/wagon
AbstractWagon.java AuthenticationInfo.java
PathUtils.java ProxyInfo.java Repository.java
Wagon.java
wagon-api/src/test/java/org/apache/maven/wagon/events
MockSessionListener.java MockWagon.java
SessionEventSupportTest.java SessionEventTest.java
TransferEventSupportTest.java
TransferEventTest.java
wagon-api/src/test/java/org/apache/maven/wagon/source
ByteArraySourceTest.java
wagon-api/src/test/java/org/apache/maven/wagon
AuthenticationInfoTest.java ProxyInfoTest.java
wagon-api project.xml
Removed: wagon-api/src/main/java/org/apache/maven/wagon/managers
MavenRepositoryManager.java
Log:
More javadocs and minor changes in the API
Revision Changes Path
1.4 +18 -18 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/Debug.java
Index: Debug.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/Debug.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Debug.java 26 Nov 2003 20:58:31 -0000 1.3
+++ Debug.java 2 Dec 2003 18:01:29 -0000 1.4
@@ -56,9 +56,9 @@
long transfer;
/**
- * @see org.apache.maven.wagon.events.SessionListener#connectionOpenning(org.apache.maven.wagon.events.SessionEvent)
+ * @see SessionListener#sessionOpening(SessionEvent)
*/
- public void sessionOpenning( final SessionEvent sessionEvent )
+ public void sessionOpening( final SessionEvent sessionEvent )
{
//System.out.println( .getUrl() + " - Session: Opening ");
@@ -66,56 +66,56 @@
}
/**
- * @see org.apache.maven.wagon.events.SessionListener#connectionOpened(org.apache.maven.wagon.events.SessionEvent)
+ * @see SessionListener#sessionOpened(SessionEvent)
*/
public void sessionOpened( final SessionEvent sessionEvent )
{
- System.out.println( sessionEvent.getRepository().getUrl() + " - Session: Opened " );
+ System.out.println( sessionEvent.getWagon().getRepository().getUrl() + " - Session: Opened " );
}
/**
- * @see org.apache.maven.wagon.events.SessionListener#connectionDisconnecting(org.apache.maven.wagon.events.SessionEvent)
+ * @see SessionListener#sessionDisconnecting(SessionEvent)
*/
public void sessionDisconnecting( final SessionEvent sessionEvent )
{
- System.out.println( sessionEvent.getRepository().getUrl() + " - Session: Disconnecting " );
+ System.out.println( sessionEvent.getWagon().getRepository().getUrl() + " - Session: Disconnecting " );
}
/**
- * @see org.apache.maven.wagon.events.SessionListener#connectionDisconnected(org.apache.maven.wagon.events.SessionEvent)
+ * @see org.apache.maven.wagon.events.SessionListener#sessionDisconnected(org.apache.maven.wagon.events.SessionEvent)
*/
public void sessionDisconnected( final SessionEvent sessionEvent )
{
- System.out.println( sessionEvent.getRepository().getUrl() + " - Session: Disconnected" );
+ System.out.println( sessionEvent.getWagon().getRepository().getUrl() + " - Session: Disconnected" );
}
/**
- * @see org.apache.maven.wagon.events.SessionListener#connectionRefused(org.apache.maven.wagon.events.SessionEvent)
+ * @see SessionListener#sessionConnectionRefused(SessionEvent)
*/
- public void sessionRefused( final SessionEvent sessionEvent )
+ public void sessionConnectionRefused( final SessionEvent sessionEvent )
{
- System.out.println( sessionEvent.getRepository().getUrl() + " - Session: Connection refused" );
+ System.out.println( sessionEvent.getWagon().getRepository().getUrl() + " - Session: Connection refused" );
}
/**
- * @see org.apache.maven.wagon.events.SessionListener#connectionLoggedIn(org.apache.maven.wagon.events.SessionEvent)
+ * @see SessionListener#sessionLoggedIn(SessionEvent)
*/
public void sessionLoggedIn( final SessionEvent sessionEvent )
{
- System.out.println( sessionEvent.getRepository().getUrl() + " - Session: Logged in" );
+ System.out.println( sessionEvent.getWagon().getRepository().getUrl() + " - Session: Logged in" );
}
/**
- * @see org.apache.maven.wagon.events.SessionListener#connectionLoggedOff(org.apache.maven.wagon.events.SessionEvent)
+ * @see SessionListener#sessionLoggedOff(SessionEvent)
*/
public void sessionLoggedOff( final SessionEvent sessionEvent )
{
- System.out.println( sessionEvent.getRepository().getUrl() + " - Session: Logged off" );
+ System.out.println( sessionEvent.getWagon().getRepository().getUrl() + " - Session: Logged off" );
}
@@ -141,7 +141,7 @@
"Downloading: "
+ transferEvent.getResource()
+ " from "
- + transferEvent.getRepository().getUrl() );
+ + transferEvent.getWagon().getRepository().getUrl() );
System.out.println( "" );
}
else
@@ -150,7 +150,7 @@
"Uploading: "
+ transferEvent.getResource()
+ " to "
- + transferEvent.getRepository().getUrl() );
+ + transferEvent.getWagon().getRepository().getUrl() );
System.out.println( "" );
}
1.4 +29 -50 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java
Index: SessionEvent.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SessionEvent.java 26 Nov 2003 20:58:31 -0000 1.3
+++ SessionEvent.java 2 Dec 2003 18:01:29 -0000 1.4
@@ -44,10 +44,24 @@
* ====================================================================
*/
-import org.apache.maven.wagon.Repository;
import org.apache.maven.wagon.Wagon;
/**
+ *
+ * SessionEvent is used for notifing SessionListeners about
+ * occurences of various sistutation releated.
+ *
+ * The session event is emitted by <code>Wagon</code> objects when
+ *
+ * <ul>
+ * <li>Before connection to the repository will be opened</li>
+ * <li>After connection to the repository was opened</li>
+ * <li>After wagon has logged-in to the repository</li>
+ * <li>After wagon has logged-off from the repository</li>
+ * <li>Before connection to the repository will be closed</li>
+ * <li>After connection to the repository was closed</li>
+ * </ul>
+ *
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
@@ -64,7 +78,7 @@
public final static int SESSION_DISCONNECTED = 3;
/** A SESSION was refused. */
- public final static int SESSION_REFUSED = 4;
+ public final static int SESSION_CONNECTION_REFUSED = 4;
/** A SESSION is about to be opened. */
public final static int SESSION_OPENING = 5;
@@ -81,52 +95,41 @@
/** A SESSION was opened. */
public final static int SESSION_ERROR_OCCURRED = 9;
- private Repository repository;
-
+ /** The type of the event. One of the SESSSION_XXX constans*/
private int eventType;
private Exception exception;
- private long timestamp;
-
/**
- * @param source
+ * Creates new instance of SessionEvent
+ * @param wagon <code>Wagon<code> object which created this event
+ * @param eventType the type of the event
*/
public SessionEvent(
- final Wagon source,
- final Repository repository,
+ final Wagon wagon,
final int eventType )
{
- super( source );
+ super( wagon );
this.eventType = eventType;
- this.repository = repository;
}
/**
- * @param source
+ * Creates new instance of SessionEvent. Sets event type to <code>SESSION_ERROR_OCCURRED</code>
+ * @param wagon <code>Wagon<code> object which created this event
+ * @param exception the exception
*/
public SessionEvent(
- final Wagon source,
- final Repository repository,
+ final Wagon wagon,
final Exception exception )
{
- super( source );
- this.repository = repository;
+ super( wagon );
this.exception = exception;
this.eventType = SESSION_ERROR_OCCURRED;
}
/**
- * @return Returns the repository.
- */
- public Repository getRepository()
- {
- return repository;
- }
-
- /**
* @return Returns the type.
*/
public int getEventType()
@@ -166,7 +169,7 @@
break;
case SessionEvent.SESSION_OPENING:
break;
- case SessionEvent.SESSION_REFUSED:
+ case SessionEvent.SESSION_CONNECTION_REFUSED:
break;
default :
throw new IllegalArgumentException(
@@ -181,30 +184,6 @@
public void setException( final Exception exception )
{
this.exception = exception;
- }
-
- /**
- * @param repository The repository to set.
- */
- public void setRepository( final Repository repository )
- {
- this.repository = repository;
- }
-
- /**
- * @param timestamp The timestamp to set.
- */
- public void setTimestamp( final long timestamp )
- {
- this.timestamp = timestamp;
- }
-
- /**
- * @return Returns the timestamp.
- */
- public long getTimestamp()
- {
- return timestamp;
}
}
1.4 +87 -24 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java
Index: SessionEventSupport.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SessionEventSupport.java 26 Nov 2003 20:58:31 -0000 1.3
+++ SessionEventSupport.java 2 Dec 2003 18:01:29 -0000 1.4
@@ -59,8 +59,8 @@
import java.util.List;
/**
- * The class allows registration and removal of event listners of type
- * ConnectionListener and dispatches events to those listeners
+ * The class allows registration and deregistration of session listeners
+ *
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
@@ -72,9 +72,16 @@
private final List listeners = new ArrayList();
/**
- * Adds new listener to this monitor
- *
- * @param listener <code>SessionListener<code> which will be added to this monitor
+ * Adds the listener to the collection of listeners
+ * who will be notifed when any session event occurs
+ * in this <code>Wagon</code> object.
+ * <br/>
+ * If listener is <code>null</code>, no exception is thrown and no action is performed
+ *
+ * @param listener the transfer listener
+ *
+ * @see #removeSessionListener(SessionListener)
+ * @see TransferListener
*/
public void addSessionListener( final SessionListener listener )
{
@@ -82,9 +89,16 @@
}
/**
- * Remove
- *
- * @param listener <code>WagonListener<code> which will be removed from this monitor
+ * Removes the session listener from the collection of listeners so
+ * it no longer receives session events.
+ * <br/>
+ * If listener is <code>null</code> or specified listener was not added
+ * to this <code>SessionEventSupport</code> object
+ * no exception is thrown and no action is performed
+ *
+ * @param listener the session listener
+ *
+ * @see #addSessionListener(org.apache.maven.wagon.events.SessionListener)
*/
public void removeSessionListener( final SessionListener listener )
{
@@ -92,9 +106,18 @@
}
/**
- * Remove
- *
- * @param listener <code>SessionListener<code> which will be removed from this monitor
+ * Returns whether the specified instance of session
+ * listener was added to the collection of listeners
+ * who will be notifed when an seesion event occurs
+ *
+ * @param listener the session listener
+ *
+ * @return <code>true<code>
+ * if given listner was added to the collection of listeners
+ * <code>false</code> otherwise
+ *
+ * @see org.apache.maven.wagon.events.SessionListener
+ * @see #addSessionListener(org.apache.maven.wagon.events.SessionListener)
*/
public boolean hasSessionListener( final SessionListener listener )
{
@@ -102,7 +125,11 @@
}
/**
- * @param sessionEvent
+ * Dispatches the given <code>SessionEvent</code>
+ * to all registred listeners (calls method {@link SessionListener#sessionDisconnected(SessionEvent)} on all of them}.
+ * The Event should be of type {@link SessionEvent#SESSION_DISCONNECTED}
+ *
+ * @param sessionEvent the SessionEvent which will be dispached to listeners
*/
public void fireSessionDisconnected( final SessionEvent sessionEvent )
{
@@ -115,7 +142,12 @@
}
/**
- * @param sessionEvent
+ * Dispatches the given <code>SessionEvent</code>
+ * to all registred listeners (calls method {@link SessionListener#sessionDisconnecting(SessionEvent)} } on all of them}.
+ * The Event should be of type {@link SessionEvent#SESSION_DISCONNECTING}
+ *
+ *
+ * @param sessionEvent the SessionEvent which will be dispached to listeners
*/
public void fireSessionDisconnecting( final SessionEvent sessionEvent )
{
@@ -128,7 +160,11 @@
}
/**
- * @param sessionEvent
+ * Dispatches the given <code>SessionEvent</code>
+ * to all registred listeners (calls method {@link SessionListener#sessionLoggedIn(SessionEvent)} on all of them}.
+ * The Event should be of type {@link SessionEvent#SESSION_LOGGED_IN}
+ *
+ * @param sessionEvent the SessionEvent which will be dispached to listeners
*/
public void fireSessionLoggedIn( final SessionEvent sessionEvent )
{
@@ -142,7 +178,11 @@
}
/**
- * @param sessionEvent
+ * Dispatches the given <code>SessionEvent</code>
+ * to all registred listeners (calls method {@link SessionListener#sessionLoggedOff(SessionEvent)} on all of them}.
+ * The Event should be of type {@link SessionEvent#SESSION_LOGGED_OFF}
+ *
+ * @param sessionEvent the SessionEvent which will be dispached to listeners
*/
public void fireSessionLoggedOff( final SessionEvent sessionEvent )
{
@@ -155,7 +195,11 @@
}
/**
- * @param sessionEvent
+ * Dispatches the given <code>SessionEvent</code>
+ * to all registred listeners (calls method {@link SessionListener#sessionOpened(SessionEvent)} on all of them}.
+ * The Event should be of type {@link SessionEvent#SESSION_OPENED}
+ *
+ * @param sessionEvent the SessionEvent which will be dispached to listeners
*/
public void fireSessionOpened( final SessionEvent sessionEvent )
{
@@ -167,31 +211,45 @@
}
/**
- * @param sessionEvent
+ * Dispatches the given <code>SessionEvent</code>
+ * to all registred listeners (calls method {@link SessionListener#sessionOpening(SessionEvent)} on all of them}.
+ * The Event should be of type {@link SessionEvent#SESSION_OPENING}
+ *
+ * @param sessionEvent the SessionEvent which will be dispached to listeners
*/
- public void fireSessionOpenning( final SessionEvent sessionEvent )
+ public void fireSessionOpening( final SessionEvent sessionEvent )
{
for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
{
final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionOpenning( sessionEvent );
+ listener.sessionOpening( sessionEvent );
}
}
/**
- * @param sessionEvent
+ * Dispatches the given <code>SessionEvent</code>
+ * to all registred listeners (calls method {@link SessionListener#sessionConnectionRefused(SessionEvent)} on all of them}.
+ * The Event should be of type {@link SessionEvent#SESSION_CONNECTION_REFUSED}
+ *
+ * @param sessionEvent the SessionEvent which will be dispached to listeners
*/
- public void fireSessionRefused( final SessionEvent sessionEvent )
+ public void fireSessionConnectionRefused( final SessionEvent sessionEvent )
{
for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
{
final SessionListener listener = ( SessionListener ) iter.next();
- listener.sessionRefused( sessionEvent );
+ listener.sessionConnectionRefused( sessionEvent );
}
}
+ /**
+ * Dispatches the given debug message
+ * to all registred listeners (calls method {@link SessionListener#debug(String)} on all of them}.
+ *
+ * @param message the debug message which will be dispached to listeners
+ */
public void fireDebug( final String message )
{
for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
@@ -204,7 +262,12 @@
}
/**
- * @param sessionEvent
+ * Dispatches the given <code>SessionEvent</code>
+ * to all registred listeners (calls method {@link SessionListener#sessionConnectionRefused(SessionEvent)} on all of them.
+ * The Event should be of type {@link SessionEvent#SESSION_ERROR_OCCURRED} and it is expected that
+ * {@link SessionEvent#getException()} method will return not null value
+ *
+ * @param sessionEvent the SessionEvent which will be dispached to listeners
*/
public void fireSessionError( final SessionEvent sessionEvent )
{
1.4 +51 -23 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/SessionListener.java
Index: SessionListener.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/SessionListener.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SessionListener.java 26 Nov 2003 20:58:31 -0000 1.3
+++ SessionListener.java 2 Dec 2003 18:01:29 -0000 1.4
@@ -46,6 +46,8 @@
*/
/**
+ * Interface for classes which wants to receive and respond to any session update events.
+ *
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
@@ -53,63 +55,89 @@
{
/**
- * This method will be called when Wagon is about to open network
- * connection to given connection
+ * This method will be called when Wagon is about to open
+ * connection to the repository.
+ * The type of the event should
+ * be set to {@link SessionEvent.SESSION_OPENING}
*
- * @param sessionEvent
+ * @param sessionEvent the session event
*/
- void sessionOpenning( SessionEvent sessionEvent );
+ void sessionOpening( SessionEvent sessionEvent );
/**
- * This method will be called when Wagon has sucessfully connectted to
- * given connection
+ * This method will be called when Wagon has sucessfully connected to
+ * to the repository.
+ * The type of the event should
+ * be set to {@link SessionEvent.SESSION_OPENED}
*
- * @param sessionEvent
+ * @param sessionEvent the session event
*/
void sessionOpened( SessionEvent sessionEvent );
/**
- * This method will be called when Wagon has closed network connection to
- * given connection
+ * This method will be called when Wagon has closed connection to
+ * to the repository.
+ * The type of the event should
+ * be set to {@link SessionEvent.SESSION_DISCONNECTING}
*
- * @param sessionEvent
+ * @param sessionEvent the session event
*/
void sessionDisconnecting( SessionEvent sessionEvent );
/**
- * This method will be called when Wagon has closed network connection to
- * given connection
+ * This method will be called when Wagon has closed connection to
+ * the repository.
+ * The type of the event should
+ * be set to {@link SessionEvent.SESSION_DISCONNECTED}
*
- * @param sessionEvent
+ * @param sessionEvent the session event
*/
void sessionDisconnected( SessionEvent sessionEvent );
/**
- * This method will be called when Wagon has closed network connection to
- * given connection
+ * This method will be called when Wagon when connection to
+ * the repository was refused.
+ *
+ * The type of the event should
+ * be set to {@link SessionEvent.SESSION_CONNECTION_REFUSED}
*
- * @param sessionEvent The connection name
+ * @param sessionEvent the session event
*/
- void sessionRefused( SessionEvent sessionEvent );
+ void sessionConnectionRefused( SessionEvent sessionEvent );
/**
- * @param sessionEvent
+ * This method will be called by Wagon when Wagon manged
+ * to login to the repository.
+ *
+ * @param sessionEvent the session event
*/
void sessionLoggedIn( SessionEvent sessionEvent );
-
/**
- * @param sessionEvent
+ * This method will be called by Wagon has logged off
+ * from the repository.
+ *
+ * The type of the event should
+ * be set to {@link SessionEvent.SESSION_LOGGED_OFF}
+ *
+ * @param sessionEvent the session event
*/
void sessionLoggedOff( SessionEvent sessionEvent );
/**
- * @param sessionEvent
+ * This method will be called by Wagon when an error occured.
+ *
+ * The type of the event should
+ * be set to {@link SessionEvent.SESSION_ERROR_OCCURRED}
+ *
+ * @param sessionEvent the session event
*/
void sessionError( SessionEvent sessionEvent );
/**
- * @param message
+ * This methid allows to send arbitrary debug messages.
+ *
+ * @param message the debug messgae
*/
void debug( String message );
1.9 +44 -52 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java
Index: TransferEvent.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TransferEvent.java 26 Nov 2003 20:58:31 -0000 1.8
+++ TransferEvent.java 2 Dec 2003 18:01:29 -0000 1.9
@@ -47,37 +47,40 @@
import org.apache.maven.wagon.Repository;
import org.apache.maven.wagon.Wagon;
-/**
+/***
+ * TransferEvent is used to notify TransferListeners about progress
+ * in transfer of resources form/to the respository
+ *
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
public class TransferEvent extends WagonEvent
{
- /** A connection was closed. */
+ /** A transfer was started. */
public final static int TRANSFER_STARTED = 1;
- /** A connection is about to be disconnected. */
+ /** A transfer is completed. */
public final static int TRANSFER_COMPLETED = 2;
- /** A connection was disconnected (not currently used). */
+ /** A transfer is in progress. */
public final static int TRANSFER_PROGRESS = 3;
- /** A connection was refused. */
+ /** An error occured during transfer */
public final static int TRANSFER_ERROR = 4;
- /** Indicates Fetch transfer */
+ /** Indicates GET transfer (from the repository) */
public final static int REQUEST_GET = 5;
- /** Indicates Deploy transfer */
+ /** Indicates PUT transfer (to the repository)*/
public final static int REQUEST_PUT = 6;
- private Repository repository;
- private String resourceId;
+
+ private String resource;
private int eventType;
private int requestType;
- private long timestamp;
+
private byte[] data;
private int dataLength;
@@ -87,14 +90,12 @@
public TransferEvent(
final Wagon wagon,
- final Repository repository,
- final String resourceId,
+ final String resource,
final int eventType,
final int requestType )
{
super( wagon );
- this.repository = repository;
- this.resourceId = resourceId;
+ this.resource = resource;
setEventType( eventType );
setRequestType( requestType );
@@ -102,32 +103,24 @@
public TransferEvent(
final Wagon wagon,
- final Repository repository,
- final String resourceId,
+ final String resource,
final Exception exception )
{
super( wagon );
- this.repository = repository;
- this.resourceId = resourceId;
+ this.resource = resource;
setEventType( TRANSFER_ERROR );
this.exception = exception;
}
- /**
- * @return Returns the repository.
- */
- public Repository getRepository()
- {
- return repository;
- }
+
/**
- * @return Returns the resourceId.
+ * @return Returns the resource.
*/
public String getResource()
{
- return resourceId;
+ return resource;
}
/**
@@ -139,7 +132,9 @@
}
/**
- * @return Returns the requestType.
+ * Returns the request type.
+ * @return Returns the request type. The Request type is one of
+ * <code>TransferEvent.REQUEST_GET<code> or <code>TransferEvent.REQUEST_PUT<code>
*/
public int getRequestType()
{
@@ -147,7 +142,11 @@
}
/**
+ * Sets the request type
* @param requestType The requestType to set.
+ * The Request type value should be either
+ * <code>TransferEvent.REQUEST_GET<code> or <code>TransferEvent.REQUEST_PUT<code>.
+ * @throws IllegalArgumentException when
*/
public void setRequestType( final int requestType )
{
@@ -200,6 +199,7 @@
}
/**
+ * The
* @param exception The exception to set.
*/
public void setException( final Exception exception )
@@ -207,20 +207,13 @@
this.exception = exception;
}
- /**
- * @param repository The repository to set.
- */
- public void setRepository( final Repository repository )
- {
- this.repository = repository;
- }
/**
- * @param resourceId The resourceId to set.
+ * @param resource The resource to set.
*/
- public void setResourceId( final String resourceId )
+ public void setResource( final String resource )
{
- this.resourceId = resourceId;
+ this.resource = resource;
}
/**
@@ -240,33 +233,32 @@
return progress;
}
- /**
- * @return Returns the timestamp.
- */
- public long getTimestamp()
- {
- return timestamp;
- }
+
/**
- * @param timestamp The timestamp to set.
+ *
+ * @param data
+ * @param dataLength
*/
- public void setTimestamp( final long timestamp )
- {
- this.timestamp = timestamp;
- }
-
public void setData( final byte[] data, final int dataLength )
{
this.data = data;
this.dataLength = dataLength;
}
+ /**
+ *
+ * @return
+ */
public byte[] getData()
{
return data;
}
+ /**
+ *
+ * @return
+ */
public int getDataLength()
{
return dataLength;
1.5 +70 -17 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java
Index: TransferEventSupport.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TransferEventSupport.java 26 Nov 2003 20:58:31 -0000 1.4
+++ TransferEventSupport.java 2 Dec 2003 18:01:29 -0000 1.5
@@ -72,21 +72,33 @@
private final List listeners = new ArrayList();
/**
- * Adds given listener to the collection of listners to which events will
- * be dispatcher
- *
- * @param listener <code>TransferListener<code> which will registred for eveny dispatching
+ * Adds the listener to the collection of listeners
+ * who will be notifed when any transfer event occurs
+ * in this <code>Wagon</code> object.
+ * <br/>
+ * If listener is <code>null</code>, no exception is thrown and no action is performed
+ *
+ * @param listener the transfer listener
+ *
+ * @see #removeTransferListener(org.apache.maven.wagon.events.TransferListener)
+ * @see TransferListener
*/
public void addTransferListener( final TransferListener listener )
{
listeners.add( listener );
}
- /**
- * Removes given listners from collecton of listeners. No more events will
- * be dispatched to given listner
- *
- * @param listener <code>TransferListener<code> which will be removed from this monitor
+ /**
+ * Removes the transfer listener from the collection of listeners so
+ * it no longer receives transfer events.
+ * <br/>
+ * If listener is <code>null</code> or specified listener was not added
+ * to this <code>TransferEventSupport</code> object
+ * no exception is thrown and no action is performed
+ *
+ * @param listener the transfer listener
+ *
+ * @see #addTransferListener(TransferListener)
*/
public void removeTransferListener( final TransferListener listener )
{
@@ -94,28 +106,48 @@
}
/**
- * Return whether the given instance of the listener is in the collection
- * of listeners.
- *
- * @param listener <code>TransferListener<code>
- * @return <code>true</code> if given <code>TransferListener<code> is present in the collection
- * of this listeners of this object, <code>false</false> otherwise
+ * Returns whether the specified instance of transfer
+ * listener was added to the collection of listeners
+ * who will be notifed when an transfer event occurs
+ *
+ * @param listener the transfer listener
+ *
+ * @return <code>true<code>
+ * if given listner was added to the collection of listeners
+ * <code>false</code> otherwise
+ *
+ * @see org.apache.maven.wagon.events.TransferEvent
+ * @see #addTransferListener(TransferListener)
*/
public boolean hasTransferListener( final TransferListener listener )
{
return listeners.contains( listener );
}
+
+ /**
+ * Dispatches the given <code>TransferEvent</code>
+ * to all registred listeners (calls method {@link TransferListener#transferStarted(TransferEvent)} on all of them}.
+ * The Event should be of type {@link TransferEvent#TRANSFER_COMPLETED}
+ *
+ * @param transferEvent the TransferEvent which will be dispached to listeners
+ */
public void fireTransferStarted( final TransferEvent transferEvent )
{
for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
{
final TransferListener listener = ( TransferListener ) iter.next();
listener.transferStarted( transferEvent );
-
}
}
+ /**
+ * Dispatches the given <code>TransferEvent</code>
+ * to all registred listeners (calls method {@link TransferListener#transferProgress(TransferEvent)} on all of them}.
+ * The Event should be of type {@link TransferEvent#TRANSFER_PROGRESS}.
+ *
+ * @param transferEvent the TransferEvent which will be dispached to listeners
+ */
public void fireTransferProgress( final TransferEvent transferEvent )
{
for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
@@ -126,6 +158,13 @@
}
}
+ /**
+ * Dispatches the given <code>TransferEvent</code>
+ * to all registred listeners (calls method {@link TransferListener#transferCompleted(TransferEvent)} on all of them}.
+ * The Event should be of type {@link TransferEvent#TRANSFER_COMPLETED}
+ *
+ * @param transferEvent the TransferEvent which will be dispached to listeners
+ */
public void fireTransferCompleted( final TransferEvent transferEvent )
{
for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
@@ -136,6 +175,14 @@
}
}
+ /**
+ * Dispatches the given <code>TransferEvent</code>
+ * to all registred listeners (calls method {@link TransferListener#transferError(TransferEvent)} on all of them.
+ * The Event should be of type {@link TransferEvent#TRANSFER_ERROR} and it is expected that
+ * {@link TransferEvent#getException()} } method will return not null value
+ *
+ * @param transferEvent the TransferEvent which will be dispached to listeners
+ */
public void fireTransferError( final TransferEvent transferEvent )
{
for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
@@ -146,6 +193,12 @@
}
}
+ /**
+ * Dispatches the given debug message
+ * to all registred listeners (calls method {@link TransferListener#debug(String)} on all of them.
+ *
+ * @param message the debug message which will be dispached to listeners
+ */
public void fireDebug( final String message )
{
1.4 +33 -3 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java
Index: WagonEvent.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WagonEvent.java 26 Nov 2003 20:58:31 -0000 1.3
+++ WagonEvent.java 2 Dec 2003 18:01:29 -0000 1.4
@@ -57,18 +57,29 @@
*/
import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.Repository;
import java.util.EventObject;
/**
+ * Base class for all events emitted by <code>Wagon</code> objects.
+ *
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
public class WagonEvent extends EventObject
{
+ /**
+ * Repository to which the Wagon
+ * object which emitted this event is connected
+ */
+ protected Repository repository;
+
+ /** The time when event occured*/
+ protected long timestamp;
/**
- * @param source
+ * @param source The Wagon object on which the WagonEvent initially occurred
*/
public WagonEvent( final Wagon source )
{
@@ -76,11 +87,30 @@
}
/**
- * @return
+ * Returns The Wagon object on which the WagonEvent initially occurred
+ * @return The Wagon object on which the WagonEvent initially occurred
*/
public Wagon getWagon()
{
return ( Wagon ) getSource();
+ }
+
+ /**
+ * Returns the timestamp which indicated the time when this event has occured
+ * @return Returns the timestamp.
+ */
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+
+ /**
+ * Sets the timestamp which indicated the time when this event has occured
+ * @param timestamp The timestamp to set.
+ */
+ public void setTimestamp( final long timestamp )
+ {
+ this.timestamp = timestamp;
}
}
1.7 +2 -2 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/result/ByteArrayResult.java
Index: ByteArrayResult.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/result/ByteArrayResult.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ByteArrayResult.java 26 Nov 2003 20:58:19 -0000 1.6
+++ ByteArrayResult.java 2 Dec 2003 18:01:29 -0000 1.7
@@ -50,7 +50,7 @@
/**
* Implementation of {@link org.apache.maven.wagon.result.WagonResult}
- * which directs transferd data to memomry buffer
+ * which send transferd data to the memomry buffer
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
1.8 +2 -2 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/result/FileResult.java
Index: FileResult.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/result/FileResult.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FileResult.java 26 Nov 2003 20:58:19 -0000 1.7
+++ FileResult.java 2 Dec 2003 18:01:29 -0000 1.8
@@ -48,7 +48,7 @@
/**
* Implementation of {@link org.apache.maven.wagon.result.WagonResult}
- * which directs transferd data to a file
+ * which sends transferd data to the file
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
1.9 +5 -5 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/result/WagonResult.java
Index: WagonResult.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/result/WagonResult.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WagonResult.java 26 Nov 2003 20:58:19 -0000 1.8
+++ WagonResult.java 2 Dec 2003 18:01:29 -0000 1.9
@@ -61,8 +61,8 @@
import java.io.OutputStream;
/**
- * This interface represents an abstraction of the place where data
- * trasfered from remote repository is written
+ * This interface represents an abstraction of the enity which will consume
+ * the where data transfered ftom the repository.
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
@@ -100,8 +100,8 @@
/**
- * Retrieves whether this WagonResult object has been closed.
- * A WagonResult is closed if the method close has been called on it or
+ * Retrieves whether this <code>WagonResult</code> object has been closed.
+ * A <code>WagonResult</code> is closed if the method close has been called on it or
* if certain fatal errors have occurred.
*
* @return <code>true</code> if this <code>WagonResult</code>
1.6 +2 -2 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/source/ByteArraySource.java
Index: ByteArraySource.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/source/ByteArraySource.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ByteArraySource.java 26 Nov 2003 20:58:25 -0000 1.5
+++ ByteArraySource.java 2 Dec 2003 18:01:30 -0000 1.6
@@ -49,7 +49,7 @@
/**
* Implementation of {@link org.apache.maven.wagon.source.WagonSource}which
- * directs transferd data to memomry buffer
+ * prvides data to transfer from the memory buffer
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
1.6 +24 -3 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/source/FileSource.java
Index: FileSource.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/source/FileSource.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FileSource.java 26 Nov 2003 20:58:25 -0000 1.5
+++ FileSource.java 2 Dec 2003 18:01:30 -0000 1.6
@@ -47,6 +47,8 @@
import java.io.*;
/**
+ * Implementation of {@link WagonSource} interface which serves data from file
+ *
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
@@ -60,16 +62,34 @@
private boolean closed = false;
- public FileSource( final String file )
+ /**
+ * Create a file source from file of given name
+ * @param filename the name of file from which this source will read data
+ */
+ public FileSource( final String filename )
{
- this.file = new File( file );
+ this.file = new File( filename );
}
+ /**
+ * Create a file source from given file
+ * @param file the file from which this source will read data
+ */
public FileSource( final File file )
{
this.file = file;
}
+ /**
+ * Returns input stream which reads data from the file provided in constructor.
+ * <br/>
+ * InputStream will be opened only once. Repeted calls
+ * of this method will return always the same instance of the input stream
+ * or <code>null</code> when close() method has been called on this <code>WagonSource</code>
+ * object
+ * @return * Returns input stream
+ * @throws IOException
+ */
public synchronized InputStream getInputStream() throws IOException
{
if ( closed )
@@ -84,6 +104,7 @@
}
/**
+ * Calls close on underlying file input stream
* @see org.apache.maven.wagon.source.WagonSource#close()
*/
public synchronized void close()
1.5 +2 -1 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/source/StreamSource.java
Index: StreamSource.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/source/StreamSource.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StreamSource.java 26 Nov 2003 20:58:25 -0000 1.4
+++ StreamSource.java 2 Dec 2003 18:01:30 -0000 1.5
@@ -48,6 +48,7 @@
import java.io.InputStream;
/**
+ * Implementation of {@link WagonSource} interface which serves data from input strea,
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
1.7 +21 -9 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/source/WagonSource.java
Index: WagonSource.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/source/WagonSource.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WagonSource.java 26 Nov 2003 20:58:25 -0000 1.6
+++ WagonSource.java 2 Dec 2003 18:01:30 -0000 1.7
@@ -61,8 +61,8 @@
import java.io.InputStream;
/**
- * This interface represents an abstraction of the place from where data
- * is transfered to remote repository
+ * This interface represents an abstraction of the enity which provides data
+ * for transfer to the repository
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
@@ -72,24 +72,36 @@
/**
* Returns input stream from which implementors of </code>Wagon</code>
* interface will read data which will be trasfered to the repository.
- * <p/>
* <br/>
- * <b>NOTE: That this input stream should be closed when all the data was
- * read from the stream</b>
+ * The same instance of Input Stream should be always returned.
+ * <br/>
+ * When <code>close()</code> method was called this method should return
+ * <code>null</code>
+ *
+ * <br/>
+ * <b>NOTE:</br> That this input stream should not closed directly.
+ * Instead close of <code>WagonSource</code> should be called.
+ *
+ *
*
- * @return
+ * @see #close()
+ * @return the input stream
* @throws IOException when error occured during IO operation
* (e.g the stream for any reason cannot be instantiated)
*/
InputStream getInputStream() throws IOException;
/**
- *
+ * This method should be called by implementors of </code>Wagon</code> interfcae
+ * when transfer to remote repository has finished (not necesserly sucessfully)
*/
void close();
/**
- * @return
+ * Return <code>true</code> if the input stream is closed
+ * (<code>close()<code> was called on this instance of <code>WagonSource</code>)
+ * @return <code>true</code> if the input stream is closed
+
*/
boolean isClosed();
1.10 +101 -32 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
Index: AbstractWagon.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AbstractWagon.java 26 Nov 2003 20:57:51 -0000 1.9
+++ AbstractWagon.java 2 Dec 2003 18:01:30 -0000 1.10
@@ -60,33 +60,47 @@
{
private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+ /** Session Event dispatcher*/
private SessionEventSupport sessionEventSupport = new SessionEventSupport();
+
+ /** Transfer Event dispatcher*/
private TransferEventSupport transferEventSupport =
new TransferEventSupport();
private Repository repository = null;
- protected Repository getRepository()
+ /**
+ * @see Wagon#getRepository()
+ */
+ public Repository getRepository()
{
return repository;
}
+ /**
+ * Sets the repository with wich this Wagon will interoperate
+ * @param repository theh repository to which this Wagon will be connected
+ */
protected void setRepository( final Repository repository )
{
this.repository = repository;
}
/**
- * @param resource
+ * Creates new <code>TransfeEvent</code>
+ * with <code>eventType=TRANSFER_COMPLETED<code> and <code>commandType=REQUEST_GET</code>
+ * and sets the <code>timestamp</code> and <code>resource</code> fields,
+ * then delegates event dispatching
+ * to {@link TransferEventSupport#fireTransferCompleted(org.apache.maven.wagon.events.TransferEvent)}
+ *
+ * @param resource The resource
*/
protected void fireGetCompleted( final String resource )
{
-
final long timestamp = System.currentTimeMillis();
final TransferEvent transferEvent =
new TransferEvent(
this,
- repository,
resource,
TransferEvent.TRANSFER_COMPLETED,
TransferEvent.REQUEST_GET );
@@ -97,7 +111,13 @@
}
/**
- * @param resource
+ * Creates new <code>TransferEvent</code>
+ * with <code>eventType=TRANSFER_STARTED<code> and <code>commandType=REQUEST_GET</code>
+ * and sets the <code>timestamp</code> and <code>resource</code> fields,
+ * then delegates event dispatching
+ * to {@link TransferEventSupport#fireTransferStarted(org.apache.maven.wagon.events.TransferEvent)}
+ *
+ * @param resource The resource
*/
protected void fireGetStarted( final String resource )
{
@@ -105,7 +125,6 @@
final TransferEvent transferEvent =
new TransferEvent(
this,
- repository,
resource,
TransferEvent.TRANSFER_STARTED,
TransferEvent.REQUEST_GET );
@@ -116,7 +135,13 @@
}
/**
- * @param resource
+ * Creates new <code>TransferEvent</code>
+ * with <code>eventType=TRANSFER_COMPLETED<code> and <code>commandType=REQUEST_PUT</code>
+ * and sets the <code>timestamp</code> and <code>resource</code> fields,
+ * then delegates event dispatching
+ * to {@link TransferEventSupport#fireTransferCompleted(org.apache.maven.wagon.events.TransferEvent)}
+ *
+ * @param resource The resource
*/
protected void firePutCompleted( final String resource )
{
@@ -125,7 +150,6 @@
final TransferEvent transferEvent =
new TransferEvent(
this,
- repository,
resource,
TransferEvent.TRANSFER_COMPLETED,
TransferEvent.REQUEST_PUT );
@@ -136,7 +160,13 @@
}
/**
- * @param resource
+ * Creates new <code>TransferEvent</code>
+ * with <code>eventType=TRANSFER_STARTED<code> and <code>commandType=REQUEST_PUT</code>
+ * and sets the <code>timestamp</code> and <code>resource</code> fields,
+ * then delegates event dispatching
+ * to {@link TransferEventSupport#fireTransferStarted(org.apache.maven.wagon.events.TransferEvent)}
+ *
+ * @param resource The resource
*/
protected void firePutStarted( final String resource )
{
@@ -144,7 +174,6 @@
final TransferEvent transferEvent =
new TransferEvent(
this,
- repository,
resource,
TransferEvent.TRANSFER_STARTED,
TransferEvent.REQUEST_PUT );
@@ -155,6 +184,11 @@
}
/**
+ * Creates new <code>SessionEvent</code>
+ * with <code>type=TRANSFER_SESSION_DISCONNECTED<code>,
+ * sets the <code>timestamp</code> field,
+ * then delegates event dispatching
+ * to {@link SessionEventSupport#fireSessionDisconnected(org.apache.maven.wagon.events.SessionEvent)}
*
*/
protected void fireSessionDisconnected()
@@ -164,7 +198,6 @@
final SessionEvent sessionEvent =
new SessionEvent(
this,
- repository,
SessionEvent.SESSION_DISCONNECTED );
sessionEvent.setTimestamp( timestamp );
@@ -172,6 +205,11 @@
}
/**
+ * Creates new <code>SessionEvent</code>
+ * with <code>type=TRANSFER_SESSION_DISCONNECTING<code>,
+ * sets the <code>timestamp</code> field,
+ * then delegates event dispatching
+ * to {@link SessionEventSupport#fireSessionDisconnecting(org.apache.maven.wagon.events.SessionEvent)}
*
*/
protected void fireSessionDisconnecting()
@@ -181,7 +219,6 @@
final SessionEvent sessionEvent =
new SessionEvent(
this,
- repository,
SessionEvent.SESSION_DISCONNECTING );
sessionEvent.setTimestamp( timestamp );
@@ -189,6 +226,11 @@
}
/**
+ * Creates new <code>SessionEvent</code>
+ * with <code>type={@link SessionEvent#SESSION_LOGGED_IN}<code>,
+ * sets the <code>timestamp</code> field,
+ * then delegates event dispatching
+ * to {@link SessionEventSupport#fireSessionDisconnecting(org.apache.maven.wagon.events.SessionEvent)}
*
*/
protected void fireSessionLoggedIn()
@@ -196,69 +238,94 @@
final long timestamp = System.currentTimeMillis();
final SessionEvent sessionEvent =
- new SessionEvent( this, repository, SessionEvent.SESSION_LOGGED_IN );
+ new SessionEvent( this, SessionEvent.SESSION_LOGGED_IN );
sessionEvent.setTimestamp( timestamp );
sessionEventSupport.fireSessionLoggedIn( sessionEvent );
}
/**
+ * Creates new <code>SessionEvent</code>
+ * with <code>type={@link SessionEvent#SESSION_LOGGED_IN}<code>,
+ * sets the <code>timestamp</code> field,
+ * then delegates event dispatching
+ * to {@link SessionEventSupport#fireSessionDisconnecting(org.apache.maven.wagon.events.SessionEvent)}
*
*/
protected void fireSessionLoggedOff()
{
final long timestamp = System.currentTimeMillis();
final SessionEvent sessionEvent =
- new SessionEvent( this, repository, SessionEvent.SESSION_LOGGED_OFF );
+ new SessionEvent( this, SessionEvent.SESSION_LOGGED_OFF );
sessionEvent.setTimestamp( timestamp );
sessionEventSupport.fireSessionLoggedOff( sessionEvent );
}
/**
+ * Creates new <code>SessionEvent</code>
+ * with <code>type={@link SessionEvent#SESSION_OPENED}<code>,
+ * sets the <code>timestamp</code> field,
+ * then delegates event dispatching
+ * to {@link SessionEventSupport#fireSessionOpened(org.apache.maven.wagon.events.SessionEvent)}
*
*/
protected void fireSessionOpened()
{
final long timestamp = System.currentTimeMillis();
final SessionEvent sessionEvent =
- new SessionEvent( this, repository, SessionEvent.SESSION_OPENED );
+ new SessionEvent( this, SessionEvent.SESSION_OPENED );
sessionEvent.setTimestamp( timestamp );
sessionEventSupport.fireSessionOpened( sessionEvent );
}
/**
+ * Creates new <code>SessionEvent</code>
+ * with <code>type={@link SessionEvent#SESSION_OPENING}<code>,
+ * sets the <code>timestamp</code> field,
+ * then delegates event dispatching
+ * to {@link SessionEventSupport#fireSessionOpening(org.apache.maven.wagon.events.SessionEvent)}
*
*/
protected void fireSessionOpenning()
{
final long timestamp = System.currentTimeMillis();
final SessionEvent sessionEvent =
- new SessionEvent( this, repository, SessionEvent.SESSION_OPENING );
+ new SessionEvent( this, SessionEvent.SESSION_OPENING );
sessionEvent.setTimestamp( timestamp );
- sessionEventSupport.fireSessionOpenning( sessionEvent );
+ sessionEventSupport.fireSessionOpening( sessionEvent );
}
/**
+ * Creates new <code>SessionEvent</code>
+ * with <code>type={@link SessionEvent#SESSION_CONNECTION_REFUSED}<code>,
+ * sets the <code>timestamp</code> field,
+ * then delegates event dispatching
+ * to {@link SessionEventSupport#fireSessionConnectionRefused(org.apache.maven.wagon.events.SessionEvent)}
*
*/
- protected void fireSessionRefused()
+ protected void fireSessionConnectionRefused()
{
final long timestamp = System.currentTimeMillis();
final SessionEvent sessionEvent =
- new SessionEvent( this, repository, SessionEvent.SESSION_REFUSED );
+ new SessionEvent( this, SessionEvent.SESSION_CONNECTION_REFUSED );
sessionEvent.setTimestamp( timestamp );
- sessionEventSupport.fireSessionRefused( sessionEvent );
+ sessionEventSupport.fireSessionConnectionRefused( sessionEvent );
}
/**
- * @param exception
+ * Creates new <code>SessionEvent</code>
+ * with <code>type={@link SessionEvent#SESSION_ERROR_OCCURRED}<code>,
+ * sets the <code>timestamp</code> <code>exception<code> fields,
+ * then delegates event dispatching
+ * to {@link SessionEventSupport#fireSessionError(org.apache.maven.wagon.events.SessionEvent)}
+ *
*/
protected void fireSessionError( final Exception exception )
{
final long timestamp = System.currentTimeMillis();
final SessionEvent sessionEvent =
- new SessionEvent( this, repository, exception );
+ new SessionEvent( this, exception );
sessionEvent.setTimestamp( timestamp );
sessionEventSupport.fireSessionError( sessionEvent );
@@ -281,8 +348,7 @@
}
/**
- * @param listener
- * @return
+ * @see Wagon#hasTransferListener(org.apache.maven.wagon.events.TransferListener)
*/
public boolean hasTransferListener( final TransferListener listener )
{
@@ -297,13 +363,18 @@
transferEventSupport.addTransferListener( listener );
}
+ /**
+ *
+ * @see Wagon#hasTransferListener(org.apache.maven.wagon.events.TransferListener)
+ */
public void removeTransferListener( final TransferListener listener )
{
transferEventSupport.removeTransferListener( listener );
}
+
/**
- * @param listener
+ * @see Wagon#addSessionListener(org.apache.maven.wagon.events.SessionListener)
*/
public void addSessionListener( final SessionListener listener )
{
@@ -311,8 +382,7 @@
}
/**
- * @param listener
- * @return
+ * @see Wagon#hasSessionListener(org.apache.maven.wagon.events.SessionListener)
*/
public boolean hasSessionListener( final SessionListener listener )
{
@@ -320,7 +390,7 @@
}
/**
- * @param listener
+ * @see Wagon#removeSessionListener(org.apache.maven.wagon.events.SessionListener)
*/
public void removeSessionListener( final SessionListener listener )
{
@@ -361,7 +431,7 @@
{
final TransferEvent transferEvent =
- new TransferEvent( this, repository, resource, e );
+ new TransferEvent( this, resource, e );
transferEventSupport.fireTransferError( transferEvent );
@@ -408,14 +478,13 @@
final TransferEvent transferEvent =
new TransferEvent(
this,
- repository,
resource,
TransferEvent.TRANSFER_PROGRESS,
requestType );
while ( -1 != ( n = input.read( buffer ) ) )
{
-// @todo probably new event should be created!!
+ // @todo probably new event should be created!!
transferEvent.setProgress( n );
transferEvent.setData( buffer, n );
output.write( buffer, 0, n );
1.4 +4 -1 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/AuthenticationInfo.java
Index: AuthenticationInfo.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/AuthenticationInfo.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AuthenticationInfo.java 26 Nov 2003 20:57:51 -0000 1.3
+++ AuthenticationInfo.java 2 Dec 2003 18:01:30 -0000 1.4
@@ -59,6 +59,9 @@
import java.io.Serializable;
/**
+ * This class holds the set of properties used when instance of the <code>Wagon</code>
+ * will use during login opreration
+ *
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
1.8 +16 -7 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/PathUtils.java
Index: PathUtils.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/PathUtils.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PathUtils.java 26 Nov 2003 20:57:51 -0000 1.7
+++ PathUtils.java 2 Dec 2003 18:01:30 -0000 1.8
@@ -47,6 +47,7 @@
import java.util.StringTokenizer;
/**
+ * Various path (URL) manipulation routines
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
@@ -88,7 +89,7 @@
final String separator,
final int max )
{
- StringTokenizer tok = null;
+ StringTokenizer tok;
if ( separator == null )
{
// Null separator means we're using StringTokenizer's default
@@ -134,10 +135,11 @@
}
/**
- * Return the host name (Cuts off protocol from the URL) E.g: for input
+ * Return the host name (Removes protocol and path from the URL) E.g: for input
* <code>http://www.codehause.org</code> this method will return <code>www.apache.org</code>
*
- * @return host name
+ * @param url the url
+ * @return the host name
*/
public static String host( final String url )
{
@@ -167,8 +169,15 @@
}
/**
- * @param url
- * @return
+ *
+ /**
+ * Return the protocol name.
+ * <br/>
+ * E.g: for input
+ * <code>http://www.codehause.org</code> this method will return <code>http</code>
+ *
+ * @param url the url
+ * @return the host name
*/
public static String protocol( final String url )
{
@@ -234,7 +243,7 @@
{
final String host = PathUtils.host( url );
final int port = PathUtils.port( url );
- int pos;
+ final int pos;
if ( port != WagonConstants.UNKNOWN_PORT )
{
pos = ( protocol + "://" + host + ":" + port + "/" ).length();
1.4 +7 -2 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/ProxyInfo.java
Index: ProxyInfo.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/ProxyInfo.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProxyInfo.java 26 Nov 2003 20:57:51 -0000 1.3
+++ ProxyInfo.java 2 Dec 2003 18:01:30 -0000 1.4
@@ -48,6 +48,12 @@
import java.io.Serializable;
/**
+ * Conatins set of properties used by <code>Wagon</code> objects
+ * while connection to the repository must go thru a proxy server.
+ *
+ * @todo Propose standard types of proxy servers (e.g. <i>SOCKSv4</i>),
+ * which can be shared between wagon api and providers
+ *
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
*/
@@ -156,7 +162,6 @@
/**
* Get the type of the proxy server.
*
- * @todo Propose standard names like <i>SOCKSv4</i>, which can be shared between plugins
*
* @return the type of the proxy server
*/
1.8 +21 -4 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/Repository.java
Index: Repository.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/Repository.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Repository.java 26 Nov 2003 20:57:51 -0000 1.7
+++ Repository.java 2 Dec 2003 18:01:30 -0000 1.8
@@ -48,8 +48,10 @@
import java.net.URL;
/**
- * Contains the set of properties used when connecting to a repository for
- * artifact retrieval and/or deployment.
+ * This class is an abstraction of the location from/to resources
+ * can be transfered.
+ *
+ *
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
@@ -57,7 +59,7 @@
public class Repository implements Serializable
{
- /** The nickname (alias) of the repository */
+ /** The name the repository */
private String name;
/** URL of the host */
@@ -69,6 +71,7 @@
/** Basedir */
private String basedir;
+ /** Protocol used to communicate with the repository*/
private String protocol;
/** */
@@ -77,17 +80,31 @@
/** */
private AuthenticationInfo authenticationInfo;
+ /**
+ * Default constructor
+ */
public Repository()
{
}
+ /**
+ *
+ * @param url
+ */
public Repository( final URL url )
{
setUrl( url );
}
+ /**
+ *
+ * @param protocol
+ * @param host
+ * @param port
+ * @param basedir
+ */
public Repository(
final String protocol,
final String host,
1.11 +115 -16 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/Wagon.java
Index: Wagon.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/Wagon.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Wagon.java 26 Nov 2003 20:57:51 -0000 1.10
+++ Wagon.java 2 Dec 2003 18:01:30 -0000 1.11
@@ -54,8 +54,8 @@
/**
* Common interface for classes capable to:
* <ol>
- * <li>downloading files from a repository.</li>
- * <li>upload files to a repository.</li>
+ * <li>downloading resources from the repository.</li>
+ * <li>uploading resources to the repository.</li>
* </ol>
*
* @author <a href="mailto:michl.maczka@dimatics.com">Michal Maczka</a>
@@ -67,13 +67,16 @@
/**
* Initialize with a set of properties describing various connection
* parameters to a repository that artifacts can be deployed to or fetched
- * from. Implementors can use this method to allocate the resources which
+ * from.
+ * <br/>
+ * Implementors of this interfcae can use this method to allocate resources which
* will be needed to perform an upload or download. E.g. a connection to a
- * remote host can be opened. Resources allocated in this method should be
+ * FTP host can be opened. Resources allocated in this method should be
* released when they are not needed any more via <tt>close</tt>.
*
* @param repository descriptor contained connection-related properties for a
* repository
+ *
* @throws AuthenticationException when a connection to the repository was refused
* @throws CannotConnectException when a connection to the repository cannot be established
* @see #close()
@@ -89,9 +92,11 @@
public void close();
/**
- * Perform a download of single file from a repository. <code>Wagon</code>
- * is reponsible to clean up after itself. E.g. the file was downloaded
- * partially should be deleted.
+ * Perform a download of the resource from the repository.
+ * <br/>
+ * <code>Wagon</code>
+ * is reponsible to clean up after itself. E.g. when an error occured
+ * a file which was downloaded partially should be deleted.
* <p/>
* When transfer is finished method {@link org.apache.maven.wagon.result.WagonResult#close()}</code>
* should be called on <code>WagonResult</code> provided with <code>FetchCommand</code>
@@ -99,6 +104,7 @@
* @param request <code>GetRequest/code> which should contatin all
* parameters which are necessery to download a file to a
* repository.
+ *
* @throws TransferFailedException when an error occured during file transfer
* @throws ResourceDoesNotExistException when source file does not exist in the remote filesystem
* @throws NotAuthorizedException when an user is not authorized to read file in remote file
@@ -111,36 +117,129 @@
NotAuthorizedException;
/**
- * Perform an upload of single file to a repository.
+ * Perform an upload (<i>PUT</i>) of the resource to the repository.
*
* @param request <code>DeployRequest</code> which should contatin all
* parameters which are necessery to upload a file to a
* repository.
+ *
* @throws TransferFailedException when an error occured during file transfer
* @throws ResourceDoesNotExistException when source file does not exist in the local filesystem
* @throws NotAuthorizedException when an user is not authorized to read file in local file
* system or to upload file to remote system.
*/
- public void transfer( PutRequest request )
+ void transfer( PutRequest request )
throws
TransferFailedException,
ResourceDoesNotExistException,
NotAuthorizedException;
- public void addSessionListener( SessionListener listener );
+ /**
+ * Adds the listener to the collection of listeners
+ * who will be notifed when any session event occurs
+ * in this <code>Wagon</code> object.
+ * <br/>
+ * If listener is <code>null</code>,
+ * no exception is thrown and no action is performed
+ *
+ * @param listener the session listner
+ */
+ void addSessionListener( SessionListener listener );
+
+
+ /**
+ * Adds the listener to the collection of listeners
+ * who will be notifed when any transfer event occurs
+ * in this <code>Wagon</code> object.
+ * <br/>
+ * If listener is <code>null</code>, no exception is thrown and no action is performed
+ *
+ * @param listener the transfer listener
+ *
+ * @see #removeTransferListener(org.apache.maven.wagon.events.TransferListener)
+ * @see TransferListener
+ */
+ void addTransferListener( TransferListener listener );
+
+
+ /**
+ * Removes the session listener from the collection of listeners so
+ * it no longer receives session events from this <code>Wagon</code>.
+ * <br/>
+ * If listener is <code>null</code> or specified lisetner was not added
+ * to this <code>Wagon</code> object
+ * no exception is thrown and no action is performed
+ *
+ * @param listener the session listener
+ *
+ * @see #addSessionListener(org.apache.maven.wagon.events.SessionListener)
+ */
+ void removeSessionListener( SessionListener listener );
+
+
+ /**
+ * Removes the transfer listener from the collection of listeners so
+ * it no longer receives transfer events from this <code>Wagon</code>.
+ * <br/>
+ * If listener is <code>null</code> or specified listner is not registred
+ * in this <code>Wagon</code> object
+ * no exception is thrown and no action is performed
+ *
+ * @param listener the transfer listener
+ *
+ * @see #addTransferListener(org.apache.maven.wagon.events.TransferListener)
+ */
+ void removeTransferListener( TransferListener listener );
- public void addTransferListener( TransferListener listener );
+ /**
+ * Return whether the specified instance of session
+ * listener was added to the collection of listeners
+ * who will be notifed when an transfer event occurs
+ *
+ * @param listener the session listener
+ *
+ * @return <code>true<code>
+ * if given listner was added to the collection of listeners
+ * <code>false</code> otherwise
+ *
+ * @see org.apache.maven.wagon.events.SessionListener
+ * @see #addSessionListener(org.apache.maven.wagon.events.SessionListener)
+ * @see #removeSessionListener(org.apache.maven.wagon.events.SessionListener)
+ */
+ boolean hasSessionListener( SessionListener listener );
- public void removeSessionListener( SessionListener listener );
+ /**
+ * Return whether the specified instance of transfer
+ * listener was added to the collection of listeners
+ * who will be notifed when an transfer event occurs
+ *
+ * @param listener the transfer listener
+ *
+ * @return <code>true<code>
+ * if given listner was added to the collection of listeners
+ * <code>false</code> otherwise
+ *
+ * @see org.apache.maven.wagon.events.TransferListener
+ * @see #addTransferListener(org.apache.maven.wagon.events.TransferListener)
+ */
+ boolean hasTransferListener( TransferListener listener );
- public void removeTransferListener( TransferListener listener );
+ /**
+ * Returns the names of supported protocols like: <tt>"http"</tt>, <tt>"ftp"</tt>.
+ *
+ * @return the names of supported protocols
+ */
+ String[] getSupportedProtocols();
- public boolean hasSessionListener( SessionListener listener );
- public boolean hasTransferListener( TransferListener listener );
+ /**
+ * Returns the repository to which this <code>Wagon</code> object is connected.
+ * @return the repository to which this <code>Wagon</code> object is connected or <code>null</null>
+ */
+ Repository getRepository();
}
1.4 +3 -3 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/MockSessionListener.java
Index: MockSessionListener.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/MockSessionListener.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MockSessionListener.java 26 Nov 2003 20:58:31 -0000 1.3
+++ MockSessionListener.java 2 Dec 2003 18:01:30 -0000 1.4
@@ -157,7 +157,7 @@
/**
* @see org.apache.maven.wagon.events.SessionListener#connectionOpenning(org.apache.maven.wagon.events.SessionEvent)
*/
- public void sessionOpenning( final SessionEvent connectionEvent )
+ public void sessionOpening( final SessionEvent connectionEvent )
{
connectionOpenningCalled = true;
this.sessionEvent = connectionEvent;
@@ -196,7 +196,7 @@
/**
* @see org.apache.maven.wagon.events.SessionListener#connectionRefused(org.apache.maven.wagon.events.SessionEvent)
*/
- public void sessionRefused( final SessionEvent connectionEvent )
+ public void sessionConnectionRefused( final SessionEvent connectionEvent )
{
connectionRefusedCalled = true;
this.sessionEvent = connectionEvent;
1.9 +8 -2 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/MockWagon.java
Index: MockWagon.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/MockWagon.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MockWagon.java 26 Nov 2003 20:58:31 -0000 1.8
+++ MockWagon.java 2 Dec 2003 18:01:30 -0000 1.9
@@ -69,13 +69,19 @@
super();
}
+ public String[] getSupportedProtocols()
+ {
+ final String[] retValue = {"mock"};
+ return retValue;
+ }
+
public void connect( final Repository repository )
{
setRepository( repository );
fireSessionOpenning();
fireSessionOpened();
fireSessionLoggedIn();
- fireSessionRefused();
+ fireSessionConnectionRefused();
}
/**
1.4 +10 -12 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
Index: SessionEventSupportTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SessionEventSupportTest.java 26 Nov 2003 20:58:31 -0000 1.3
+++ SessionEventSupportTest.java 2 Dec 2003 18:01:30 -0000 1.4
@@ -115,7 +115,7 @@
eventSupport.addSessionListener( mock2 );
final Wagon wagon = new MockWagon();
- final SessionEvent event = new SessionEvent( wagon, null, 1 );
+ final SessionEvent event = new SessionEvent( wagon, 1 );
eventSupport.fireSessionDisconnected( event );
@@ -135,7 +135,7 @@
eventSupport.addSessionListener( mock2 );
final Wagon wagon = new MockWagon();
- final SessionEvent event = new SessionEvent( wagon, null, 1 );
+ final SessionEvent event = new SessionEvent( wagon, 1 );
eventSupport.fireSessionDisconnecting( event );
@@ -154,7 +154,7 @@
eventSupport.addSessionListener( mock2 );
final Wagon wagon = new MockWagon();
- final SessionEvent event = new SessionEvent( wagon, null, 1 );
+ final SessionEvent event = new SessionEvent( wagon, 1 );
eventSupport.fireSessionLoggedIn( event );
@@ -174,7 +174,7 @@
eventSupport.addSessionListener( mock2 );
final Wagon wagon = new MockWagon();
- final SessionEvent event = new SessionEvent( wagon, null, 1 );
+ final SessionEvent event = new SessionEvent( wagon, 1 );
eventSupport.fireSessionLoggedOff( event );
@@ -194,7 +194,7 @@
eventSupport.addSessionListener( mock2 );
final Wagon wagon = new MockWagon();
- final SessionEvent event = new SessionEvent( wagon, null, 1 );
+ final SessionEvent event = new SessionEvent( wagon, 1 );
eventSupport.fireSessionOpened( event );
@@ -215,9 +215,9 @@
eventSupport.addSessionListener( mock2 );
final Wagon wagon = new MockWagon();
- final SessionEvent event = new SessionEvent( wagon, null, 1 );
+ final SessionEvent event = new SessionEvent( wagon, 1 );
- eventSupport.fireSessionOpenning( event );
+ eventSupport.fireSessionOpening( event );
assertTrue( mock1.isSessionOpenningCalled() );
assertTrue( mock2.isSessionOpenningCalled() );
@@ -235,9 +235,9 @@
eventSupport.addSessionListener( mock2 );
final Wagon wagon = new MockWagon();
- final SessionEvent event = new SessionEvent( wagon, null, 1 );
+ final SessionEvent event = new SessionEvent( wagon, 1 );
- eventSupport.fireSessionRefused( event );
+ eventSupport.fireSessionConnectionRefused( event );
assertTrue( mock1.isSessionRefusedCalled() );
assertTrue( mock2.isSessionRefusedCalled() );
@@ -252,8 +252,6 @@
final MockSessionListener mock2 = new MockSessionListener();
eventSupport.addSessionListener( mock2 );
-
- final Wagon wagon = new MockWagon();
eventSupport.fireDebug( "mm" );
1.4 +17 -13 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
Index: SessionEventTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SessionEventTest.java 26 Nov 2003 20:58:31 -0000 1.3
+++ SessionEventTest.java 2 Dec 2003 18:01:30 -0000 1.4
@@ -48,6 +48,7 @@
import org.apache.maven.wagon.AuthenticationException;
import org.apache.maven.wagon.Repository;
import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.CannotConnectException;
/**
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
@@ -78,38 +79,41 @@
* Class to test for void SESSIONEvent(Wagon, Repository, String, int,
* int)
*/
- public void testSESSIONEventProperties()
+ public void testSessionEventProperties()
{
final Wagon wagon = new MockWagon();
final Repository repo = new Repository();
+ try
+ {
+ wagon.connect( repo );
+ }
+ catch ( Exception e )
+ {
+ fail( e.getMessage() );
+ }
final long timestamp = System.currentTimeMillis();
final Exception exception = new AuthenticationException( "dummy" );
SessionEvent event =
new SessionEvent(
wagon,
- repo,
SessionEvent.SESSION_CLOSED );
assertEquals( wagon, event.getWagon() );
- assertEquals( repo, event.getRepository() );
+ assertEquals( repo, event.getWagon().getRepository() );
assertEquals( SessionEvent.SESSION_CLOSED, event.getEventType() );
- event = new SessionEvent( wagon, repo, exception );
+ event = new SessionEvent( wagon, exception );
assertEquals( wagon, event.getWagon() );
- assertEquals( repo, event.getRepository() );
+ assertEquals( repo, event.getWagon().getRepository() );
assertEquals( SessionEvent.SESSION_ERROR_OCCURRED, event.getEventType() );
assertEquals( exception, event.getException() );
- event.setRepository( null );
- assertEquals( null, event.getRepository() );
- event.setRepository( repo );
- assertEquals( repo, event.getRepository() );
event.setException( null );
@@ -145,8 +149,8 @@
event.setEventType( SessionEvent.SESSION_OPENING );
assertEquals( SessionEvent.SESSION_OPENING, event.getEventType() );
- event.setEventType( SessionEvent.SESSION_REFUSED );
- assertEquals( SessionEvent.SESSION_REFUSED, event.getEventType() );
+ event.setEventType( SessionEvent.SESSION_CONNECTION_REFUSED );
+ assertEquals( SessionEvent.SESSION_CONNECTION_REFUSED, event.getEventType() );
try
@@ -173,7 +177,7 @@
SessionEvent.SESSION_LOGGED_OFF,
SessionEvent.SESSION_OPENED,
SessionEvent.SESSION_OPENING,
- SessionEvent.SESSION_REFUSED};
+ SessionEvent.SESSION_CONNECTION_REFUSED};
for ( int i = 0; i < values.length; i++ )
{
1.7 +0 -1 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
Index: TransferEventSupportTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TransferEventSupportTest.java 26 Nov 2003 20:58:31 -0000 1.6
+++ TransferEventSupportTest.java 2 Dec 2003 18:01:30 -0000 1.7
@@ -194,7 +194,6 @@
new TransferEvent(
wagon,
null,
- null,
TransferEvent.TRANSFER_COMPLETED,
TransferEvent.REQUEST_GET );
return event;
1.7 +14 -11 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
Index: TransferEventTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TransferEventTest.java 26 Nov 2003 20:58:31 -0000 1.6
+++ TransferEventTest.java 2 Dec 2003 18:01:30 -0000 1.7
@@ -83,41 +83,44 @@
final Wagon wagon = new MockWagon();
final Repository repo = new Repository();
+ try
+ {
+ wagon.connect( repo );
+ }
+ catch ( Exception e )
+ {
+ fail( e.getMessage() );
+ }
final long timestamp = System.currentTimeMillis();
final Exception exception = new AuthenticationException( "dummy" );
TransferEvent event =
new TransferEvent(
wagon,
- repo,
"mm",
TransferEvent.TRANSFER_COMPLETED,
TransferEvent.REQUEST_GET );
assertEquals( wagon, event.getWagon() );
- assertEquals( repo, event.getRepository() );
+ assertEquals( repo, event.getWagon().getRepository() );
assertEquals( "mm", event.getResource() );
assertEquals( TransferEvent.TRANSFER_COMPLETED, event.getEventType() );
assertEquals( TransferEvent.REQUEST_GET, event.getRequestType() );
- event = new TransferEvent( wagon, repo, "mm", exception );
+ event = new TransferEvent( wagon, "mm", exception );
assertEquals( wagon, event.getWagon() );
- assertEquals( repo, event.getRepository() );
+ assertEquals( repo, event.getWagon().getRepository() );
assertEquals( "mm", event.getResource() );
assertEquals( TransferEvent.TRANSFER_ERROR, event.getEventType() );
assertEquals( exception, event.getException() );
- event.setRepository( null );
- assertEquals( null, event.getRepository() );
- event.setRepository( repo );
- assertEquals( repo, event.getRepository() );
- event.setResourceId( null );
+ event.setResource( null );
assertEquals( null, event.getResource() );
- event.setResourceId( "/foo/baa" );
+ event.setResource( "/foo/baa" );
assertEquals( "/foo/baa", event.getResource() );
event.setException( null );
1.6 +2 -2 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/source/ByteArraySourceTest.java
Index: ByteArraySourceTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/source/ByteArraySourceTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ByteArraySourceTest.java 26 Nov 2003 20:58:32 -0000 1.5
+++ ByteArraySourceTest.java 2 Dec 2003 18:01:30 -0000 1.6
@@ -53,7 +53,7 @@
public class ByteArraySourceTest extends TestCase
{
- public void testByteArraySource() throws Exception
+ public void testByteArraySource()
{
ByteArraySource source = new ByteArraySource( "string" );
1.5 +1 -2 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/AuthenticationInfoTest.java
Index: AuthenticationInfoTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/AuthenticationInfoTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AuthenticationInfoTest.java 26 Nov 2003 20:58:02 -0000 1.4
+++ AuthenticationInfoTest.java 2 Dec 2003 18:01:30 -0000 1.5
@@ -71,7 +71,6 @@
}
public void testAuthenticationInfoProperties()
- throws Exception
{
final AuthenticationInfo authenticationInfo = new AuthenticationInfo();
1.5 +2 -2 maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/ProxyInfoTest.java
Index: ProxyInfoTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/ProxyInfoTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ProxyInfoTest.java 26 Nov 2003 20:58:02 -0000 1.4
+++ ProxyInfoTest.java 2 Dec 2003 18:01:30 -0000 1.5
@@ -71,7 +71,7 @@
}
public void testProxyInfoProperties()
- throws Exception
+
{
final ProxyInfo proxyInfo = new ProxyInfo();
1.8 +9 -3 maven-wagon/wagon-api/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/project.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- project.xml 26 Nov 2003 21:00:41 -0000 1.7
+++ project.xml 2 Dec 2003 18:01:30 -0000 1.8
@@ -5,10 +5,16 @@
<id>wagon-api</id>
<groupId>wagon</groupId>
<artifactId>wagon-api</artifactId>
+ <type>jar</type>
<name>Wagon API</name>
<currentVersion>1.0-beta-1</currentVersion>
<description></description>
<shortDescription>Tools to manage artifacts and deployment</shortDescription>
+ <description>
+ Wagon in general utility resource transport framework.
+ The Wagon API defines
+ the interfaces, clasess and their respective roles.
+ </description>
<package>org.apache.maven.wagon</package>
<inceptionYear>2003</inceptionYear>
@@ -28,8 +34,8 @@
<build>
- <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
- <unitTestSourceDirectory>${basedir}/src/test/java</unitTestSourceDirectory>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*Test.java</include>
@@ -37,7 +43,7 @@
<resources>
<resource>
- <directory>${basedir}/src/test/test-data</directory>
+ <directory>src/test/test-data</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-cvs-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-cvs-help@maven.apache.org