public class SVNEvent
extends java.lang.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(...);
ISVNEventHandler
,
SVNStatusType
,
SVNEventAction
,
ExamplesConstructor and 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.
|
Modifier and Type | Method and 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() |
public SVNEvent(SVNErrorMessage errorMessage, SVNEventAction expected)
Used by SVNKit internals to construct and initialize an SVNEvent object. It's not intended for users (from an API point of view).
errorMessage
- the message describing the operation faultpublic 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)
Used by SVNKit internals to construct and initialize an SVNEvent object. It's not intended for users (from an API point of view).
file
- local pathaction
- the type of action the item is exposed tokind
- the item's node kindrevision
- a revision numbermimetype
- the item's MIME typecstatus
- the item's contents statuspstatus
- the item's properties statuslstatus
- the item's lock statuslock
- the item's lockexpected
- the action type that was expectederror
- an error messagerange
- merge rangechangelistName
- change list namepublic java.io.File getFile()
public SVNEventAction getAction()
public SVNEventAction getExpectedAction()
getAction()
except those cases
when getAction()
returns SVNEventAction.SKIP
(i.e.
when the expected operation is skipped).public SVNStatusType getContentsStatus()
public SVNErrorMessage getErrorMessage()
public SVNLock getLock()
public SVNStatusType getLockStatus()
public java.lang.String getMimeType()
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 }
public SVNNodeKind getNodeKind()
public SVNStatusType getPropertiesStatus()
public long getRevision()
public long getPreviousRevision()
public SVNURL getURL()
public SVNURL getPreviousURL()
public java.lang.String getChangelistName()
SVNChangelistClient
.public SVNMergeRange getMergeRange()
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.public void setPreviousRevision(long previousRevision)
previousRevision
- previous revisionpublic void setURL(SVNURL url)
url
- repository urlpublic void setPreviousURL(SVNURL url)
url
- previous urlpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object getInfo()
public void setInfo(java.lang.Object info)
public void setFile(java.io.File path)
public SVNProperties getRevisionProperties()
public void setRevisionProperties(SVNProperties revisionProperties)
public java.lang.String getPropertyName()
public void setPropertyName(java.lang.String propertyName)
Copyright © 2004-2012 TMate Software Ltd. All Rights Reserved.