com.ssh.sft
Class AbstractPolicy

java.lang.Object
  extended bycom.ssh.sft.AbstractPolicy
All Implemented Interfaces:
Policies.All, Policies.Copy, Policies.CopyDir, Policies.Dir, Policies.MoveDir, Policies.Remove, Policies.RemoveDir

public class AbstractPolicy
extends Object
implements Policies.All

A default implementation for policies.


Constructor Summary
AbstractPolicy()
           
 
Method Summary
 void complete(Location loc, SftException ex)
           
 boolean createDir(Location dir)
           
 boolean enterDir(Directory dir)
          Invoked when a directory is about to be entered and its contents are to be processed.
 CharConversion fromSource(File src)
           
 void leaveDir(Directory dir)
          Invoked when the recursive processing of a directory has finished.
 void list(File file)
           
 boolean overwrite(File src, File dst)
          Invoked when an existing file is about to be overwritten.
 boolean remove(File file)
          Invoked when a file is about to be removed.
 boolean removeDir(Directory dir)
           
 boolean start(File src, Location dst)
          Invoked when a file copy operation from src to dst is started.
 CharConversion toDest(Location dst)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPolicy

public AbstractPolicy()
Method Detail

start

public boolean start(File src,
                     Location dst)
Description copied from interface: Policies.Copy
Invoked when a file copy operation from src to dst is started.

Specified by:
start in interface Policies.Copy
Parameters:
src - the path to copy from
dst - the path to copy to
Returns:
true if the operation may proceed, false otherwise

overwrite

public boolean overwrite(File src,
                         File dst)
Description copied from interface: Policies.Copy
Invoked when an existing file is about to be overwritten.

Specified by:
overwrite in interface Policies.Copy
Parameters:
src - the path to the file that is about to overwrite
dst - the path to the file that is about to be overwritten
Returns:
true if overwriting is allowed, false otherwise

fromSource

public CharConversion fromSource(File src)
Specified by:
fromSource in interface Policies.Copy

toDest

public CharConversion toDest(Location dst)
Specified by:
toDest in interface Policies.Copy

remove

public boolean remove(File file)
Description copied from interface: Policies.Remove
Invoked when a file is about to be removed.

Specified by:
remove in interface Policies.Remove
Parameters:
file - The file to be removed
Returns:
true if the file may be removed, false otherwise

enterDir

public boolean enterDir(Directory dir)
Description copied from interface: Policies.Dir
Invoked when a directory is about to be entered and its contents are to be processed.

Specified by:
enterDir in interface Policies.Dir
Parameters:
dir - the directory to be entered
Returns:
true if the directory should be entered, false otherwise

leaveDir

public void leaveDir(Directory dir)
Description copied from interface: Policies.Dir
Invoked when the recursive processing of a directory has finished. This is only a notification.

Specified by:
leaveDir in interface Policies.Dir
Parameters:
dir - the directory that is left

list

public void list(File file)
Specified by:
list in interface Policies.Dir

complete

public void complete(Location loc,
                     SftException ex)
              throws SftException
Specified by:
complete in interface Policies.Dir
Throws:
SftException

createDir

public boolean createDir(Location dir)
Specified by:
createDir in interface Policies.CopyDir

removeDir

public boolean removeDir(Directory dir)
Specified by:
removeDir in interface Policies.RemoveDir