org.apache.ivy.plugins.repository
public class TransferEvent extends IvyEvent
Copyright 2001-2005 The Apache Software Foundation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.Orginal class written by Michal Maczka.
Field Summary | |
---|---|
static int | REQUEST_GET
Indicates GET transfer (from the repository) |
static int | REQUEST_PUT
Indicates PUT transfer (to the repository) |
static int | TRANSFER_COMPLETED
A transfer is completed. |
static String | TRANSFER_COMPLETED_NAME |
static int | TRANSFER_ERROR
An error occured during transfer |
static String | TRANSFER_ERROR_NAME |
static int | TRANSFER_INITIATED
A transfer was attempted, but has not yet commenced. |
static String | TRANSFER_INITIATED_NAME |
static int | TRANSFER_PROGRESS
A transfer is in progress. |
static String | TRANSFER_PROGRESS_NAME |
static int | TRANSFER_STARTED
A transfer was started. |
static String | TRANSFER_STARTED_NAME |
Constructor Summary | |
---|---|
TransferEvent(Repository repository, Resource resource, int eventType, int requestType) | |
TransferEvent(Repository repository, Resource resource, Exception exception, int requestType) | |
TransferEvent(Repository repository, Resource resource, long length, int requestType) |
Method Summary | |
---|---|
long | getElapsedTime(int fromEventType, int toEventType)
Returns the elapsed time (in ms) between when the event entered one type until it entered
another event time.
|
int | getEventType() |
Exception | getException() |
long | getLength() |
File | getLocalFile() |
Repository | getRepository() |
int | getRequestType()
Returns the request type.
|
Resource | getResource() |
long | getTotalLength() |
boolean | isTotalLengthSet() |
protected void | setEventType(int eventType) |
void | setException(Exception exception) |
protected void | setLength(long length) |
protected void | setLocalFile(File localFile) |
protected void | setRequestType(int requestType)
Sets the request type
|
protected void | setResource(Resource resource) |
protected void | setTotalLength(long totalLength) |
void | setTotalLengthSet(boolean isTotalLengthSet) |
This is especially useful to get the elapsed transfer time:
getElapsedTime(TransferEvent.TRANSFER_STARTED, TransferEvent.TRANSFER_COMPLETED);
Special cases:
Parameters: fromEventType the event type constant from which time should be measured toEventType the event type constant to which time should be measured
Returns: the elapsed time (in ms) between when the event entered fromEventType until it entered toEventType.
Throws: IllegalArgumentException if either type is not a known constant event type.
Returns: Returns the eventType.
Returns: Returns the exception.
Returns: Returns the local file.
Returns: Returns the request type. The Request type is one of
TransferEvent.REQUEST_GET
or
TransferEvent.REQUEST_PUT
Returns: Returns the resource.
Parameters: eventType The eventType to set.
Parameters: localFile The local file to set.
Parameters: requestType
The requestType to set. The Request type value should be either
TransferEvent.REQUEST_GET
or
TransferEvent.REQUEST_PUT
.
Throws: IllegalArgumentException when
Parameters: resource The resource to set.