org.tmatesoft.svn.core.wc
public class SVNEvent extends Object
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!"); } }
import org.tmatesoft.svn.core.wc.SVNUpdateClient; ... SVNUpdateClient updateClient; ... updateClient.setEventHandler(new MyCustomUpdateEventHandler()); ...
updateClient.doUpdate(...);
Version: 1.1.1
See Also: ISVNEventHandler SVNStatusType SVNEventAction Examples
Constructor Summary | |
---|---|
SVNEvent(SVNErrorMessage errorMessage)
Constructs an SVNEvent object given
an error message for a filed operation.
| |
SVNEvent(SVNAdminAreaInfo info, SVNAdminArea adminArea, String name, SVNEventAction action, SVNEventAction expectedAction, SVNNodeKind kind, long revision, String mimetype, SVNStatusType cstatus, SVNStatusType pstatus, SVNStatusType lstatus, SVNLock lock, SVNErrorMessage error)
Constructs an SVNEvent object.
| |
SVNEvent(SVNAdminAreaInfo info, SVNAdminArea adminArea, String name, SVNEventAction action, SVNNodeKind kind, long revision, String mimetype, SVNStatusType cstatus, SVNStatusType pstatus, SVNStatusType lstatus, SVNLock lock, SVNErrorMessage error)
Constructs an SVNEvent object.
| |
SVNEvent(File rootFile, File file, SVNEventAction action, SVNEventAction expected, SVNNodeKind kind, long revision, String mimetype, SVNStatusType cstatus, SVNStatusType pstatus, SVNStatusType lstatus, SVNLock lock, SVNErrorMessage error)
Constructs an SVNEvent object filling it with informational
details most of that would be retrieved and analized by an
ISVNEventHandler implementation.
| |
SVNEvent(File rootFile, File file, SVNEventAction action, SVNNodeKind kind, long revision, String mimetype, SVNStatusType cstatus, SVNStatusType pstatus, SVNStatusType lstatus, SVNLock lock, SVNErrorMessage error)
Constructs an SVNEvent object filling it with informational
details most of that would be retrieved and analized by an
ISVNEventHandler implementation.
|
Method Summary | |
---|---|
SVNEventAction | getAction()
Gets the type of an action performed upon the item. |
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. |
File | getFile()
Gets a java.io.File representation of the item's path.
|
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. |
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. |
String | getPath()
Gets the item's path relative to the Working Copy root directory.
|
SVNStatusType | getPropertiesStatus()
Gets the status type of the item's properties.
|
long | getRevision()
Gets the revision number specific for the action context.
|
void | setErrorMessage(SVNErrorMessage errorMessage) |
void | setPath(String path)
Sets the item's path relative to the Working Copy root.
|
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
Used by SVNKit internals to construct and initialize an SVNEvent object. It's not intended for users (from an API point of view).
Parameters: info admin info adminArea admin area the item belongs to name the item's name action the type of action the item is exposed to expectedAction the action type that was expected 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 error an error message
Used by SVNKit internals to construct and initialize an SVNEvent object. It's not intended for users (from an API point of view).
Parameters: info admin info adminArea admin area the item belongs to name the item's name 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 error an error message
Used by SVNKit internals to construct and initialize an SVNEvent object. It's not intended for users (from an API point of view).
If action
is SKIP (i.e. operation is skipped)
then the expected action (that would have occurred if the operation hadn't been skipped)
is provided in expected
.
Parameters: rootFile the item's root directory file the item's path itself action the type of action the item is exposed to expected the action that is expected to happen, but may be skipped in real for some reason 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 error an error message
Used by SVNKit internals to construct and initialize an SVNEvent object. It's not intended for users (from an API point of view).
Parameters: rootFile the item's root directory file the item's path itself 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 error an error message
Returns: the current action
Returns: the item's status type
Returns: an error message (in case of an error occured) or null if everything is OK
Returns: the expected action
Returns: the item's path
Returns: the file item's lock info if the file is locked; otherwise null
Returns: the lock status of the file item
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
Returns: the item's node kind
Returns: a string representation of the item's path
Returns: the status type of the item's properties
Returns: a revision number
Parameters: path the item's relative path