org.netbeans.modules.masterfs/2 2.38

org.netbeans.modules.masterfs.providers
Class ProvidedExtensions

java.lang.Object
  extended by org.netbeans.modules.masterfs.providers.ProvidedExtensions
All Implemented Interfaces:
InterceptionListener

public class ProvidedExtensions
extends Object
implements InterceptionListener

Encapsulate a group of individual factory methods that are responsible for creating objects of specific interfaces. If subclassed and provided by AnnotationProvider.getInterceptionListener() then individual instances will be called by MasterFileSystem There may exist more than one instance of ProvidedExtensions at a given moment and therefore there is defined for every method wheter will be called by MasterFileSystem for every present instance or just for the first one.

See Also:
ProvidedExtensions.IOHandler, InterceptionListener

Nested Class Summary
static interface ProvidedExtensions.DeleteHandler
           
static interface ProvidedExtensions.IOHandler
           
 
Constructor Summary
ProvidedExtensions()
          Default constructor
ProvidedExtensions(boolean providesCanWrite)
          Creates a new ProvidedExtensions.
 
Method Summary
 void beforeChange(FileObject fo)
           
 void beforeCopy(FileObject from, File to)
          Called by MasterFileSystem before FileObject is copied
 void beforeCreate(FileObject parent, String name, boolean isFolder)
           
 void beforeDelete(FileObject fo)
           
 void beforeMove(FileObject from, File to)
          Called by MasterFileSystem before FileObject is moved
 boolean canWrite(File f)
          Called by MasterFileSystem when FileObject is queried for writability with the canWrite() method.
 void copyFailure(FileObject from, File to)
          Called by MasterFileSystem after a FileObject copy failed
 void copySuccess(FileObject from, File to)
          Called by MasterFileSystem after FileObject was successfully copied
 void createdExternally(FileObject fo)
          Called by MasterFileSystem after FileObject was created externally
 void createFailure(FileObject parent, String name, boolean isFolder)
           
 void createSuccess(FileObject fo)
           
 void deletedExternally(FileObject fo)
          Called by MasterFileSystem after FileObject was deleted externally
 void deleteFailure(FileObject fo)
           
 void deleteSuccess(FileObject fo)
           
 void fileChanged(FileObject fo)
          Called by MasterFileSystem after FileObject was changed
 void fileLocked(FileObject fo)
           
 void fileUnlocked(FileObject fo)
           
 Object getAttribute(File file, String attrName)
          Called by MasterFileSystem when FileObject is queried for attribute and attribute's name starts with ProvidedExtensions prefix.
 ProvidedExtensions.IOHandler getCopyHandler(File from, File to)
          Return instance of ProvidedExtensions.IOHandler that is responsible for copying the file or null.
 ProvidedExtensions.DeleteHandler getDeleteHandler(File f)
           
 ProvidedExtensions.IOHandler getMoveHandler(File from, File to)
          Return instance of ProvidedExtensions.IOHandler that is responsible for moving the file or null.
 ProvidedExtensions.IOHandler getRenameHandler(File from, String newName)
           
 void moveFailure(FileObject from, File to)
          Called by MasterFileSystem after a FileObject move failed
 void moveSuccess(FileObject from, File to)
          Called by MasterFileSystem after FileObject was successfully
static
<T> T
priorityIO(Callable<T> run)
          Allows registered exceptions to execute some I/O priority action.
 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

ProvidedExtensions

public ProvidedExtensions(boolean providesCanWrite)
Creates a new ProvidedExtensions.

Parameters:
providesCanWrite - true if this instance is meant to determine a files #canWrite() value, otherwise false.
Since:
2.29

ProvidedExtensions

public ProvidedExtensions()
Default constructor

Method Detail

getCopyHandler

public ProvidedExtensions.IOHandler getCopyHandler(File from,
                                                   File to)
Return instance of ProvidedExtensions.IOHandler that is responsible for copying the file or null. Just the first non null instance of IOHandler is used by MasterFileSystem

Parameters:
from - file to be copied
to - target to copy this file to
Returns:
instance of ProvidedExtensions.IOHandler that is responsible for copying the file or null

getMoveHandler

public ProvidedExtensions.IOHandler getMoveHandler(File from,
                                                   File to)
Return instance of ProvidedExtensions.IOHandler that is responsible for moving the file or null. Just the first non null instance of IOHandler is used by MasterFileSystem

Parameters:
from - file to be moved
to - target to move this file to
Returns:
instance of ProvidedExtensions.IOHandler that is responsible for moving the file or null

getRenameHandler

public ProvidedExtensions.IOHandler getRenameHandler(File from,
                                                     String newName)

getDeleteHandler

public ProvidedExtensions.DeleteHandler getDeleteHandler(File f)

createSuccess

public void createSuccess(FileObject fo)
Specified by:
createSuccess in interface InterceptionListener

createFailure

public void createFailure(FileObject parent,
                          String name,
                          boolean isFolder)
Specified by:
createFailure in interface InterceptionListener

beforeCreate

public void beforeCreate(FileObject parent,
                         String name,
                         boolean isFolder)
Specified by:
beforeCreate in interface InterceptionListener

deleteSuccess

public void deleteSuccess(FileObject fo)
Specified by:
deleteSuccess in interface InterceptionListener

deleteFailure

public void deleteFailure(FileObject fo)
Specified by:
deleteFailure in interface InterceptionListener

beforeDelete

public void beforeDelete(FileObject fo)
Specified by:
beforeDelete in interface InterceptionListener

createdExternally

public void createdExternally(FileObject fo)
Called by MasterFileSystem after FileObject was created externally

Parameters:
fo - created file
Since:
2.27

deletedExternally

public void deletedExternally(FileObject fo)
Called by MasterFileSystem after FileObject was deleted externally

Parameters:
fo - deleted file
Since:
2.27

fileChanged

public void fileChanged(FileObject fo)
Called by MasterFileSystem after FileObject was changed

Parameters:
fo - changed file
Since:
2.27

beforeCopy

public void beforeCopy(FileObject from,
                       File to)
Called by MasterFileSystem before FileObject is copied

Parameters:
from - FileObject to be moved
to - File target to move this file to
Since:
2.28

copySuccess

public void copySuccess(FileObject from,
                        File to)
Called by MasterFileSystem after FileObject was successfully copied

Parameters:
from - FileObject to be moved
to - File target to move this file to
Since:
2.28

copyFailure

public void copyFailure(FileObject from,
                        File to)
Called by MasterFileSystem after a FileObject copy failed

Parameters:
from - FileObject to be moved
to - File target to move this file to
Since:
2.28

beforeMove

public void beforeMove(FileObject from,
                       File to)
Called by MasterFileSystem before FileObject is moved

Parameters:
from - FileObject to be moved
to - File target to move this file to
Since:
2.27

moveSuccess

public void moveSuccess(FileObject from,
                        File to)
Called by MasterFileSystem after FileObject was successfully

Parameters:
from - FileObject to be moved
to - File target to move this file to
Since:
2.27

moveFailure

public void moveFailure(FileObject from,
                        File to)
Called by MasterFileSystem after a FileObject move failed

Parameters:
from - FileObject to be moved
to - File target to move this file to
Since:
2.27

canWrite

public boolean canWrite(File f)
Called by MasterFileSystem when FileObject is queried for writability with the canWrite() method.

Parameters:
f - a file to query
Returns:
true if the file can be written to, deleted or moved, false otherwise
Since:
2.14

beforeChange

public void beforeChange(FileObject fo)

fileLocked

public void fileLocked(FileObject fo)
                throws IOException
Throws:
IOException

fileUnlocked

public void fileUnlocked(FileObject fo)

getAttribute

public Object getAttribute(File file,
                           String attrName)
Called by MasterFileSystem when FileObject is queried for attribute and attribute's name starts with ProvidedExtensions prefix.

Parameters:
attrName - name of attribute
Returns:
value of attribute

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 interated 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:
2.23

priorityIO

public static <T> T priorityIO(Callable<T> run)
                    throws Exception
Allows registered exceptions to execute some I/O priority action. This will stop all other "idle I/O" operations (like background refresh after window is activated).

Parameters:
callable - the Callable to run
Throws:
Exception - the exception thrown by the callable
Since:
2.35

org.netbeans.modules.masterfs/2 2.38

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