|
SVNKit Home | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tmatesoft.svn.core.wc.SVNEvent
public class SVNEvent
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!"); } }
import org.tmatesoft.svn.core.wc.SVNUpdateClient; ... SVNUpdateClient updateClient; ... updateClient.setEventHandler(new MyCustomUpdateEventHandler()); ...
updateClient.doUpdate(...);
ISVNEventHandler
,
SVNStatusType
,
SVNEventAction
,
ExamplesConstructor Summary | |
---|---|
SVNEvent(File file,
SVNNodeKind kind,
String mimetype,
long revision,
SVNStatusType cstatus,
SVNStatusType pstatus,
SVNStatusType lstatus,
SVNLock lock,
SVNEventAction action,
SVNEventAction expected,
SVNErrorMessage error,
SVNMergeRange range,
String changelistName)
Constructs an SVNEvent object. |
|
SVNEvent(SVNErrorMessage errorMessage)
Constructs an SVNEvent object given an error message for a filed operation. |
Method Summary | |
---|---|
SVNEventAction |
getAction()
Gets the type of an action performed upon the item. |
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. |
File |
getFile()
Returns local path the event is fired for. |
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. |
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. |
long |
getRevision()
Gets the revision number specific for the action context. |
SVNURL |
getURL()
Returns the repository URL that this event is fired for. |
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 |
setURL(SVNURL url)
Sets the repository url. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SVNEvent(SVNErrorMessage errorMessage)
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(File file, SVNNodeKind kind, String mimetype, long revision, SVNStatusType cstatus, SVNStatusType pstatus, SVNStatusType lstatus, SVNLock lock, SVNEventAction action, SVNEventAction expected, SVNErrorMessage error, SVNMergeRange range, String changelistName)
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 nameMethod Detail |
---|
public 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 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 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 String toString()
toString
in class Object
|
SVNKit Home | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |