org.netbeans.modules.versioning/1 1.32.0 1

org.netbeans.modules.versioning.spi
Class VCSInterceptor

java.lang.Object
  extended by org.netbeans.modules.versioning.spi.VCSInterceptor

public abstract class VCSInterceptor
extends Object

Versioning systems that need to intercept or listen to file system operations implement this class.


Constructor Summary
protected VCSInterceptor()
          Protected constructor, does nothing.
 
Method Summary
 void afterChange(File file)
          Called after a file changed.
 void afterCopy(File from, File to)
          Called after a file or folder has been copied.
 void afterCreate(File file)
          Called after a new file or folder has beed created.
 void afterDelete(File file)
          Called after a file or folder is deleted.
 void afterMove(File from, File to)
          Called after a file or folder has beed moved.
 void beforeChange(File file)
          Called before a file is changed.
 boolean beforeCopy(File from, File to)
          Notifies the interceptor that the file or folder is about to be copied.
 boolean beforeCreate(File file, boolean isDirectory)
          Notifies the interceptor that the file or folder is about to be created.
 boolean beforeDelete(File file)
          Notifies the interceptor that the file or folder is about to be deleted.
 void beforeEdit(File file)
          Called before a file is about to enter Edit mode.
 boolean beforeMove(File from, File to)
          Notifies the interceptor that the file or folder is about to be moved.
 void doCopy(File from, File to)
          Called if beforeCopy() returns true and delegates the copy operation to this interceptor.
 void doCreate(File file, boolean isDirectory)
          Called if beforeCreate() returns true and delegates the create operation to this interceptor.
 void doDelete(File file)
          Called if beforeDelete() returns true and delegates the delete operation to this interceptor.
 void doMove(File from, File to)
          Called if beforeMove() returns true and delegates the move operation to this interceptor.
 Object getAttribute(File file, String attrName)
          Queries the versioning system for a files VCS specific attribute.
 boolean isMutable(File file)
          Queries the versioning system for file mutability (write, delete, move).
 long refreshRecursively(File dir, long lastTimeStamp, List<? super File> children)
          Allows versioning system to exclude some children from recursive listening check.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VCSInterceptor

protected VCSInterceptor()
Protected constructor, does nothing.

Method Detail

isMutable

public boolean isMutable(File file)
Queries the versioning system for file mutability (write, delete, move). Versioning systems that keep files read-only in working copy can override this method to signal that such files are in fact mutable even if they appear read-only on local file system. When IDE eventually tries to delete or write to these files then the Versioning system should intercept these calls and make requested files writable on-demand.

Parameters:
file - a file to query
Returns:
true if the file is mutable (writable, deletable and movable), false otherwise
Since:
1.7

getAttribute

public Object getAttribute(File file,
                           String attrName)
Queries the versioning system for a files VCS specific attribute. At the momement the only supported attribute name is ProvidedExtensions.RemoteLocation

Parameters:
file - a file to get the attribute for
attrName - te attributes name
Returns:
the attributes value or null if not available
Since:
1.10

beforeDelete

public boolean beforeDelete(File file)
Notifies the interceptor that the file or folder is about to be deleted. The interceptor MUST NOT delete the file here.

Parameters:
file - a file or an empty folder to be deleted
Returns:
true if this interceptor wants to handle this operation (doDelete will be called), false otherwise

doDelete

public void doDelete(File file)
              throws IOException
Called if beforeDelete() returns true and delegates the delete operation to this interceptor. The interceptor may decide to either delete the file or leave it intact. In case it does not want to delete the file, it should just return without doing anything.

Parameters:
file - a file or an empty folder to delete; the interceptor will never be asked to delete a non-empty folder
Throws:
IOException - if the delete operation failed

afterDelete

public void afterDelete(File file)
Called after a file or folder is deleted. In case the file was deleted outside IDE, this is the only method called.

Parameters:
file - deleted file

beforeMove

public boolean beforeMove(File from,
                          File to)
Notifies the interceptor that the file or folder is about to be moved. The interceptor MUST NOT move the file here.

Parameters:
from - the file or folder to be moved
to - destination of the file being moved
Returns:
true if this interceptor wants to handle this operation (doMove will be called), false otherwise

doMove

public void doMove(File from,
                   File to)
            throws IOException
Called if beforeMove() returns true and delegates the move operation to this interceptor.

Parameters:
from - the file or folder to be moved
to - destination of the file being moved
Throws:
IOException - if the move operation failed

afterMove

public void afterMove(File from,
                      File to)
Called after a file or folder has beed moved. In case the file was moved outside IDE, this method is not called but a pair or afterDelete() / afterCreate() is called instead.

Parameters:
from - original location of the file
to - current location of the file

beforeCopy

public boolean beforeCopy(File from,
                          File to)
Notifies the interceptor that the file or folder is about to be copied. The interceptor MUST NOT copy the file here.

Parameters:
from - the file or folder to be copied
to - destination of the file being copied
Returns:
true if this interceptor wants to handle this operation (doCopy will be called), false otherwise
Since:
1.18

doCopy

public void doCopy(File from,
                   File to)
            throws IOException
Called if beforeCopy() returns true and delegates the copy operation to this interceptor.

Parameters:
from - the file or folder to be copied
to - destination of the file being copied
Throws:
IOException - if the copy operation failed
Since:
1.18

afterCopy

public void afterCopy(File from,
                      File to)
Called after a file or folder has been copied. In case the file was copied outside IDE, this method is not called and only afterCreate() is called instead.

Parameters:
from - original location of the file
to - current location of the file
Since:
1.18

beforeCreate

public boolean beforeCreate(File file,
                            boolean isDirectory)
Notifies the interceptor that the file or folder is about to be created. The interceptor MUST NOT create the file here. Beware: It may happen on some filesystems that the file will be ALREADY created.

Parameters:
file - file or folder to be created
Returns:
true if this interceptor wants to handle this operation (doCreate will be called), false otherwise

doCreate

public void doCreate(File file,
                     boolean isDirectory)
              throws IOException
Called if beforeCreate() returns true and delegates the create operation to this interceptor. Beware: It may happen on some filesystems that the file will be ALREADY created.

Parameters:
file - the file to create
isDirectory - true if the new file should be a directory, false otherwise
Throws:
IOException - if the create operation failed

afterCreate

public void afterCreate(File file)
Called after a new file or folder has beed created. In case the file was created outside IDE, this is the only method called.

Parameters:
file - the new file

afterChange

public void afterChange(File file)
Called after a file changed.

Parameters:
file - changed file

beforeChange

public void beforeChange(File file)
Called before a file is changed. Each series of beforeChange/afterChange events is preceded by at least one beforeEdit event.

Parameters:
file - to be changed file

beforeEdit

public void beforeEdit(File file)
Called before a file is about to enter Edit mode. In case the versioning system uses file locking this is the time when to check-out (edit) the file and make it read/write. CVS would execute 'cvs edit' here. If you do not (wish to) support automatic file check-out, do nothing here. Each series of beforeChange/afterChange events is preceded by at least one beforeEdit event.

Parameters:
file - file that was just locked and is expected to change

refreshRecursively

public long refreshRecursively(File dir,
                               long lastTimeStamp,
                               List<? super File> children)
Allows versioning system to exclude some children from recursive listening check. Also notifies the versioning whenever a refresh is required and allows the versiniong to provide special timestamp for a directory.

Default implementation of this method returns -1.

Parameters:
dir - the directory to check timestamp for
lastTimeStamp - the previously known timestamp or -1
children - add subfiles that shall be iterated into this array
Returns:
the timestamp that shall represent this directory, it will be compared with timestamps of all children and the newest one will be kept and next time passed as lastTimeStamp. Return 0 if the directory does not have any special timestamp. Return -1 if you are not providing any special implementation
Since:
1.17

org.netbeans.modules.versioning/1 1.32.0 1

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.