com.ansys.ingress.client.api.transfers

## Class TransferMonitor

- java.lang.Object
- - com.ansys.ingress.client.api.transfers.TransferMonitor

-     public abstract class TransferMonitor
      extends java.lang.Object

  TransferMonitor is the base class for defining a class that monitors a file transfer.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.ansys.ingress.commons.concurrent.ThreadEvent` | `semaphore`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransferMonitor()` Creates a new instance of TransferMonitorImpl.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected TransferEvent.Error` | `createError(com.ansys.ingress.commons.job.JobEvent event, TransferEvent tEvent)` Creates a `TransferEvent.Error`.
    `protected ConnectorEventError` | `createError(TransferEvent.Error err)` Creates a `ConnectorEventError` from error information in a `TransferEvent.Error`.
    `protected int` | `getPercentComplete(com.ansys.ingress.commons.job.JobEvent event)` Calculates percent complete from the event.
    `protected java.lang.String` | `getStackTrace(java.lang.Throwable e)` Dumps a stack trace into a string.
    `void` | `setSemaphore(com.ansys.ingress.commons.concurrent.ThreadEvent semaphore)` Sets the semaphore used to notify interested parties when the transfer is completed or cached.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### semaphore

          protected com.ansys.ingress.commons.concurrent.ThreadEvent semaphore

  - ### Constructor Detail

    - #### TransferMonitor

          public TransferMonitor()

      Creates a new instance of TransferMonitorImpl.

  - ### Method Detail

    - #### setSemaphore

          public void setSemaphore(com.ansys.ingress.commons.concurrent.ThreadEvent semaphore)

      Sets the semaphore used to notify interested parties when the transfer is completed or cached.
      Parameters:
        `semaphore` - the semaphore

    - #### createError

          protected TransferEvent.Error createError(com.ansys.ingress.commons.job.JobEvent event,
                                                    TransferEvent tEvent)

      Creates a `TransferEvent.Error`.
      Parameters:
        `event` - the actual event containing the error.
        `tEvent` - the instance of TransferEvent used to create the error.
      Returns:
        Returns the error.

    - #### createError

          protected ConnectorEventError createError(TransferEvent.Error err)

      Creates a `ConnectorEventError` from error information in a `TransferEvent.Error`.
      Parameters:
        `err` - the error data
      Returns:
        Returns the error object.

    - #### getPercentComplete

          protected int getPercentComplete(com.ansys.ingress.commons.job.JobEvent event)

      Calculates percent complete from the event.
      Parameters:
        `event` - the event
      Returns:
        Returns the percent complete as a value between 0 and 100.

    - #### getStackTrace

          protected java.lang.String getStackTrace(java.lang.Throwable e)

      Dumps a stack trace into a string.
      Parameters:
        `e` - the exception used to generate the stack trace
      Returns:
        Returns a string containing the stack trace.