Package org.tmatesoft.svn.core.wc

## Class SVNEvent

- java.lang.Object
- - org.tmatesoft.svn.core.wc.SVNEvent

-     public class SVNEvent
      extends java.lang.Object

  The SVNEvent class is used to provide detailed information on an operation progress to the ISVNEventHandler (if any) registered for an SVN*Client object. Such events are generated by an operation invoked by do*() method of an SVN*Client object and passed to a developer's event handler for notification. Retrieving information out of an SVNEvent the developer can decide how it should be interpreted.

  This is an example:
  implementing ISVNEventHandler

       import org.tmatesoft.svn.core.wc.ISVNEventHandler;
       import org.tmatesoft.svn.core.SVNCancelException;
       import org.tmatesoft.svn.core.wc.SVNEvent;
       import org.tmatesoft.svn.core.wc.SVNEventAction;
       import org.tmatesoft.svn.core.wc.SVNStatusType;
       import org.tmatesoft.svn.core.SVNNodeKind;
       import java.io.File;
       ...

       public class MyCustomUpdateEventHandler implements ISVNEventHandler {
           public void handleEvent(SVNEvent event, double progress) {
               //get the action type
               if(event.getAction() == SVNEventAction.UPDATE_UPDATE){
                   //get the item's node kind
                   SVNNodeKind kind = even.getNodeKind();
                   //get the item's contents status
                   if(event.getContentsStatus() == SVNStatusType.CHANGED &&
                      kind == SVNNodeKind.FILE){
                       ...
                   }
                   ...
                   //get the item's properties status
                   if(event.getPropertiesStatus() == SVNStatusType.MERGED){
                       ...
                   }
                   //get the item's lock status
                   if(event.getLockStatus() == SVNStatusType.LOCK_UNLOCKED){
                       ...
                   }
                   //get the item's relative path
                   String path = event.getPath();
                   //or in a java.io.File representation
                   File fsEntry = event.getFile();

                   //get update revision
                   long revision = event.getRevision();
                   ...
               }
               ...
           }

           public void checkCancelled() throws SVNCancelException{
               throw new SVNCancelException("cancelled!");
           }
       }

  then registering a handler:

       import org.tmatesoft.svn.core.wc.SVNUpdateClient;
       ...

       SVNUpdateClient updateClient;
       ...
       updateClient.setEventHandler(new MyCustomUpdateEventHandler());
       ...

  now when invoking an update operation:

       updateClient.doUpdate(...);

  the registered instance of the ISVNEventHandler implementation will be dispatched progress events.
  Since:
    1.2
  Version:
    1.3
  Author:
    TMate Software Ltd.
  See Also:
    `ISVNEventHandler`, `SVNStatusType`, `SVNEventAction`, Examples

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SVNEvent​(java.io.File file, SVNNodeKind kind, java.lang.String mimetype, long revision, SVNStatusType cstatus, SVNStatusType pstatus, SVNStatusType lstatus, SVNLock lock, SVNEventAction action, SVNEventAction expected, SVNErrorMessage error, SVNMergeRange range, java.lang.String changelistName, SVNProperties revisionProperties, java.lang.String propertyName)` | Constructs an SVNEvent object.
    `SVNEvent​(SVNErrorMessage errorMessage, SVNEventAction expected)` | Constructs an SVNEvent object given an error message for a filed operation.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SVNEventAction` | `getAction()` | Gets the type of an action performed upon the item.
    `java.lang.String` | `getChangelistName()` | Returns a changelist name.
    `SVNStatusType` | `getContentsStatus()` | Gets the status type of either file or directory contents.
    `SVNErrorMessage` | `getErrorMessage()` | Gets the error message that (if it's an error situation and therefore the string is not null) points to some fault.
    `SVNEventAction` | `getExpectedAction()` | Returns the expected action.
    `java.io.File` | `getFile()` | Returns local path the event is fired for.
    `java.lang.Object` | `getInfo()` |
    `SVNLock` | `getLock()` | Gets the file item's lock information (if any) represented by an SVNLock object.
    `SVNStatusType` | `getLockStatus()` | Gets the file item's lock status.
    `SVNMergeRange` | `getMergeRange()` | Returns the merge range.
    `java.lang.String` | `getMimeType()` | Gets the MIME type of the item relying upon the special SVN's 'svn:mime-type' property.
    `SVNNodeKind` | `getNodeKind()` | Gets the node kind of the item characterizing it as an entry - whether it's a directory, file, etc.
    `long` | `getPreviousRevision()` | Returns the local revision before it will be changed by an update.
    `SVNURL` | `getPreviousURL()` | Returns the item's repository url before it will be changed by an update.
    `SVNStatusType` | `getPropertiesStatus()` | Gets the status type of the item's properties.
    `java.lang.String` | `getPropertyName()` |
    `long` | `getRevision()` | Gets the revision number specific for the action context.
    `SVNProperties` | `getRevisionProperties()` |
    `SVNURL` | `getURL()` | Returns the repository URL that this event is fired for.
    `void` | `setFile​(java.io.File path)` |
    `void` | `setInfo​(java.lang.Object info)` |
    `void` | `setPreviousRevision​(long previousRevision)` | Sets the item revision which will be changed by the operation after this event is handled.
    `void` | `setPreviousURL​(SVNURL url)` | Sets the item url which will be changed by the operation after this event is handled.
    `void` | `setPropertyName​(java.lang.String propertyName)` |
    `void` | `setRevisionProperties​(SVNProperties revisionProperties)` |
    `void` | `setURL​(SVNURL url)` | Sets the repository url.
    `java.lang.String` | `toString()` |

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

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

- - ### Constructor Detail

    - #### SVNEvent

          public SVNEvent​(SVNErrorMessage errorMessage,
                          SVNEventAction expected)

      Constructs an SVNEvent object given an error message for a filed operation.

      Used by SVNKit internals to construct and initialize an SVNEvent object. It's not intended for users (from an API point of view).

      Parameters:
        `errorMessage` - the message describing the operation fault

    - #### SVNEvent

          public SVNEvent​(java.io.File file,
                          SVNNodeKind kind,
                          java.lang.String mimetype,
                          long revision,
                          SVNStatusType cstatus,
                          SVNStatusType pstatus,
                          SVNStatusType lstatus,
                          SVNLock lock,
                          SVNEventAction action,
                          SVNEventAction expected,
                          SVNErrorMessage error,
                          SVNMergeRange range,
                          java.lang.String changelistName,
                          SVNProperties revisionProperties,
                          java.lang.String propertyName)

      Constructs an SVNEvent object.

      Used by SVNKit internals to construct and initialize an SVNEvent object. It's not intended for users (from an API point of view).

      Parameters:
        `file` - local path
        `action` - the type of action the item is exposed to
        `kind` - the item's node kind
        `revision` - a revision number
        `mimetype` - the item's MIME type
        `cstatus` - the item's contents status
        `pstatus` - the item's properties status
        `lstatus` - the item's lock status
        `lock` - the item's lock
        `expected` - the action type that was expected
        `error` - an error message
        `range` - merge range
        `changelistName` - change list name

  - ### Method Detail

    - #### getFile

          public java.io.File getFile()

      Returns local path the event is fired for.
      Returns:
        local path

    - #### getAction

          public SVNEventAction getAction()

      Gets the type of an action performed upon the item. An action is one of predefined SVNEventAction constants that are specific for each kind of operation, such as update actions, commit actions, etc.
      Returns:
        the current action

    - #### getExpectedAction

          public SVNEventAction getExpectedAction()

      Returns the expected action. It is always the same as the action returned by `getAction()` except those cases when `getAction()` returns `SVNEventAction.SKIP` (i.e. when the expected operation is skipped).
      Returns:
        the expected action

    - #### getContentsStatus

          public SVNStatusType getContentsStatus()

      Gets the status type of either file or directory contents. Use predefined SVNStatusType constants to examine the item's status. For a directory contents are its entries.
      Returns:
        the item's status type

    - #### getErrorMessage

          public SVNErrorMessage getErrorMessage()

      Gets the error message that (if it's an error situation and therefore the string is not null) points to some fault.
      Returns:
        an error message (in case of an error occured) or null if everything is OK

    - #### getLock

          public SVNLock getLock()

      Gets the file item's lock information (if any) represented by an SVNLock object.
      Returns:
        the file item's lock info if the file is locked; otherwise null

    - #### getLockStatus

          public SVNStatusType getLockStatus()

      Gets the file item's lock status. The value of SVNStatusType.LOCK_INAPPLICABLE means the lock status is irrelevant during the current event action.
      Returns:
        the lock status of the file item

    - #### getMimeType

          public java.lang.String getMimeType()

      Gets the MIME type of the item relying upon the special SVN's 'svn:mime-type' property.

      You can use `SVNProperty`'s metods to find out whether it's a text MIME type or a binary:

           import org.tmatesoft.svn.core.SVNProperty;
           ...

           String mimeType = event.getMimeType();
           if(SVNProperty.isBinaryMimeType(mimeType)){
               //your processing
           }

      Returns:
        the item's MIME type as a string or null if the item has no 'svn:mime-type' property set

    - #### getNodeKind

          public SVNNodeKind getNodeKind()

      Gets the node kind of the item characterizing it as an entry - whether it's a directory, file, etc. The value of SVNNodeKind.NONE may mean the node kind is inapplicable diring the current event action. The value of SVNNodeKind.UNKNOWN may mean deleted entries.
      Returns:
        the item's node kind

    - #### getPropertiesStatus

          public SVNStatusType getPropertiesStatus()

      Gets the status type of the item's properties. The value of SVNStatusType.INAPPLICABLE may mean the item has no versioned properties or that properties status is irrelevant during the current event action.
      Returns:
        the status type of the item's properties

    - #### getRevision

          public long getRevision()

      Gets the revision number specific for the action context. It may be whether an update revision or a committed one or an inapplicable value when a revision number is irrelevant during the event action.
      Returns:
        a revision number

    - #### getPreviousRevision

          public long getPreviousRevision()

      Returns the local revision before it will be changed by an update.
      Returns:
        revision prior to modification
      Since:
        1.2.0, SVN 1.5.0

    - #### getURL

          public SVNURL getURL()

      Returns the repository URL that this event is fired for.
      Returns:
        repository url

    - #### getPreviousURL

          public SVNURL getPreviousURL()

      Returns the item's repository url before it will be changed by an update.
      Returns:
        repository url prior to modification
      Since:
        1.2.0, SVN 1.5.0

    - #### getChangelistName

          public java.lang.String getChangelistName()

      Returns a changelist name. Relevant for changelist operations provided by `SVNChangelistClient`.
      Returns:
        changelist name
      Since:
        1.2.0, SVN 1.5.0

    - #### getMergeRange

          public SVNMergeRange getMergeRange()

      Returns the merge range.

      When `action` is `SVNEventAction.MERGE_BEGIN`, and both the left and right sides of the merge are not from the same URL, the return value is null.
      Returns:
        merge range
      Since:
        1.2.0, New in SVN 1.5.0

    - #### setPreviousRevision

          public void setPreviousRevision​(long previousRevision)

      Sets the item revision which will be changed by the operation after this event is handled.

      Note: this method is not intended for API users.
      Parameters:
        `previousRevision` - previous revision
      Since:
        1.2.0, SVN 1.5.0

    - #### setURL

          public void setURL​(SVNURL url)

      Sets the repository url.

      Note: this method is not intended for API users.
      Parameters:
        `url` - repository url

    - #### setPreviousURL

          public void setPreviousURL​(SVNURL url)

      Sets the item url which will be changed by the operation after this event is handled.

      Note: this method is not intended for API users.
      Parameters:
        `url` - previous url
      Since:
        1.2.0, SVN 1.5.0

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getInfo

          public java.lang.Object getInfo()

    - #### setInfo

          public void setInfo​(java.lang.Object info)

    - #### setFile

          public void setFile​(java.io.File path)

    - #### getRevisionProperties

          public SVNProperties getRevisionProperties()

    - #### setRevisionProperties

          public void setRevisionProperties​(SVNProperties revisionProperties)

    - #### getPropertyName

          public java.lang.String getPropertyName()

    - #### setPropertyName

          public void setPropertyName​(java.lang.String propertyName)