Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ulu.view.sys.fs
Class FileShaper  view FileShaper download FileShaper.java

java.lang.Object
  extended byulu.ut.ProcessorImpl
      extended byulu.view.ShaperImpl
          extended byulu.view.sys.fs.FileShaper
All Implemented Interfaces:
ulu.view.Handler, ulu.ut.Processor, ulu.view.Shaper

public class FileShaper
extends ulu.view.ShaperImpl
implements ulu.view.Handler

A shaper for a file in a filesystem, base class to be extended for DirShaper and ZipFileShaper and others. Based upon the old FileItem, this is a clear case of composition favouring inheritance, giving less repetition of code and a more extendable structure.


Field Summary
(package private)  boolean allowParentDiscovery
          whether to allow the file to automatically 'discover' its parent directory by calling File.getParent().
(package private)  java.io.File file
          the file or directory being exposed
static java.lang.String REGISTER_FILE_TYPES
          name for the registry lookup that handles filetypes
private static ulu.ut.Registry.Register specialreg
          register of special file types
static java.lang.String TYPENAME_FILE
          default type name for an ordinary file
static java.lang.String TYPENAME_FOLDER
          default type name for a filesystem folder
 
Fields inherited from class ulu.ut.ProcessorImpl
active, swallow
 
Constructor Summary
FileShaper()
           
 
Method Summary
(package private)  void addChildFiles(ulu.view.View v, java.io.File[] children)
          generic helper for adding child files
 java.io.File getFile()
          get the file used by this Shaper to shape its objects
 ulu.view.View getParentView()
          looks for parent directory if no parent specified
static SpecialFileShaper getSpecialShaper(java.io.File f)
          get the special shaper that matches a file
 java.lang.Object invoke(ulu.view.UMethod u)
          implementation of Handler
 boolean isAllowParentDiscovery()
          test whether this FileItem is allowed to automatically discover a parent directory if no parent View is assigned to it
 void modify(ulu.view.Item i)
          implementation of Shaper
 void populate(ulu.view.Item it)
          populate a directory with its child views
(package private)  void populateRoots(ulu.view.Item it)
          populate root(s) of directory tree - returns number of roots
 void setAllowParentDiscovery(boolean b)
          set whether this Item can automatically discover parent directory and wrap it in Unc FileItem if it has no explicitly defined parent View
 void setFile(java.io.File f)
          set the file used by this Shaper to shape its objects.
 
Methods inherited from class ulu.view.ShaperImpl
process
 
Methods inherited from class ulu.ut.ProcessorImpl
isActive, isSwallowing, setActive, setSwallowing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPENAME_FILE

public static final java.lang.String TYPENAME_FILE
default type name for an ordinary file

See Also:
Constant Field Values

TYPENAME_FOLDER

public static final java.lang.String TYPENAME_FOLDER
default type name for a filesystem folder

See Also:
Constant Field Values

file

java.io.File file
the file or directory being exposed


allowParentDiscovery

boolean allowParentDiscovery
whether to allow the file to automatically 'discover' its parent directory by calling File.getParent(). In some situations, this is good, in others we will only want to expose a selected corner of the filesystem to unc


REGISTER_FILE_TYPES

public static final java.lang.String REGISTER_FILE_TYPES
name for the registry lookup that handles filetypes

See Also:
Constant Field Values

specialreg

private static ulu.ut.Registry.Register specialreg
register of special file types

Constructor Detail

FileShaper

public FileShaper()
Method Detail

getFile

public java.io.File getFile()
get the file used by this Shaper to shape its objects


setFile

public void setFile(java.io.File f)
             throws java.io.FileNotFoundException
set the file used by this Shaper to shape its objects. Setting it to null will result in a Shaper that populates an Item with all known roots of the local filesystem (e.g. '/' under unix, and 'a:\', 'b:\', 'c:\' etc. under Windows)


isAllowParentDiscovery

public boolean isAllowParentDiscovery()
test whether this FileItem is allowed to automatically discover a parent directory if no parent View is assigned to it


setAllowParentDiscovery

public void setAllowParentDiscovery(boolean b)
set whether this Item can automatically discover parent directory and wrap it in Unc FileItem if it has no explicitly defined parent View


modify

public void modify(ulu.view.Item i)
implementation of Shaper

Specified by:
modify in interface ulu.view.Shaper

getParentView

public ulu.view.View getParentView()
looks for parent directory if no parent specified


invoke

public java.lang.Object invoke(ulu.view.UMethod u)
implementation of Handler

Specified by:
invoke in interface ulu.view.Handler

populate

public void populate(ulu.view.Item it)
populate a directory with its child views


populateRoots

void populateRoots(ulu.view.Item it)
populate root(s) of directory tree - returns number of roots


addChildFiles

void addChildFiles(ulu.view.View v,
                   java.io.File[] children)
generic helper for adding child files


getSpecialShaper

public static SpecialFileShaper getSpecialShaper(java.io.File f)
get the special shaper that matches a file