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.
Modifier and Type | Field and Description |
---|---|
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 java.lang.String |
TRANSFER_COMPLETED_NAME |
static int |
TRANSFER_ERROR
An error occurred during transfer
|
static java.lang.String |
TRANSFER_ERROR_NAME |
static int |
TRANSFER_INITIATED
A transfer was attempted, but has not yet commenced.
|
static java.lang.String |
TRANSFER_INITIATED_NAME |
static int |
TRANSFER_PROGRESS
A transfer is in progress.
|
static java.lang.String |
TRANSFER_PROGRESS_NAME |
static int |
TRANSFER_STARTED
A transfer was started.
|
static java.lang.String |
TRANSFER_STARTED_NAME |
Constructor and Description |
---|
TransferEvent(Repository repository,
Resource resource,
java.lang.Exception exception,
int requestType) |
TransferEvent(Repository repository,
Resource resource,
int eventType,
int requestType) |
TransferEvent(Repository repository,
Resource resource,
long length,
int requestType) |
Modifier and Type | Method and Description |
---|---|
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() |
java.lang.Exception |
getException() |
long |
getLength() |
java.io.File |
getLocalFile() |
Repository |
getRepository() |
int |
getRequestType()
Returns the request type.
|
Resource |
getResource() |
long |
getTotalLength() |
boolean |
isTotalLengthSet() |
protected void |
setEventType(int eventType) |
void |
setException(java.lang.Exception exception) |
protected void |
setLength(long length) |
protected void |
setLocalFile(java.io.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) |
addAttribute, addAttributes, addConfsAttribute, addMDAttributes, addModuleIdAttributes, addMridAttributes, equals, getAttributes, getName, getSource, hashCode, toString
public static final int TRANSFER_INITIATED
public static final int TRANSFER_STARTED
public static final int TRANSFER_COMPLETED
public static final int TRANSFER_PROGRESS
public static final int TRANSFER_ERROR
public static final int REQUEST_GET
public static final int REQUEST_PUT
public static final java.lang.String TRANSFER_INITIATED_NAME
public static final java.lang.String TRANSFER_STARTED_NAME
public static final java.lang.String TRANSFER_PROGRESS_NAME
public static final java.lang.String TRANSFER_COMPLETED_NAME
public static final java.lang.String TRANSFER_ERROR_NAME
public TransferEvent(Repository repository, Resource resource, int eventType, int requestType)
public TransferEvent(Repository repository, Resource resource, java.lang.Exception exception, int requestType)
public TransferEvent(Repository repository, Resource resource, long length, int requestType)
public Resource getResource()
public java.lang.Exception getException()
public int getRequestType()
TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUT
protected void setRequestType(int requestType)
requestType
- The requestType to set. The Request type value should be either
TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUT.
java.lang.IllegalArgumentException
- whenpublic int getEventType()
protected void setEventType(int eventType)
eventType
- The eventType to set.protected void setResource(Resource resource)
resource
- The resource to set.public java.io.File getLocalFile()
protected void setLocalFile(java.io.File localFile)
localFile
- The local file to set.public long getLength()
protected void setLength(long length)
public long getTotalLength()
protected void setTotalLength(long totalLength)
public void setException(java.lang.Exception exception)
public boolean isTotalLengthSet()
public void setTotalLengthSet(boolean isTotalLengthSet)
public Repository getRepository()
public long getElapsedTime(int fromEventType, int toEventType)
This is especially useful to get the elapsed transfer time:
getElapsedTime(TransferEvent.TRANSFER_STARTED, TransferEvent.TRANSFER_COMPLETED);
Special cases:
fromEventType
- the event type constant from which time should be measuredtoEventType
- the event type constant to which time should be measuredjava.lang.IllegalArgumentException
- if either type is not a known constant event type.