Class COM.tolstoy.jconfig.FileRegistry
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.tolstoy.jconfig.FileRegistry

java.lang.Object
   |
   +----COM.tolstoy.jconfig.FileRegistry

public class FileRegistry
extends Object
This singleton returns the following information:
- the FileExtension's corresponding to a given FinderInfo
- the FinderInfo's corresponding to a given FileExtension
- applications whose name contain a given string
- applications associated with a given FileExtension
- applications associated with a given FinderInfo
You can also use this object to:
- launch a URL or file in a Web browser
- create and resolve aliases
- create AppFile's and DiskObject's
- enumerate the currently mounted volumes
- enumerate the user's active video monitors
- iterate over each record used to build the mappings database which maps FileExtension's to FinderInfo's and both of those to applications.
Note: Before using any method of this class, you must call the initialize method, as illustrated in the sample applications.

Variable Index

 o kGetAppsSearchLevel1
See the getApps() methods.
 o kGetAppsSearchLevel2
See the getApps() methods.
 o kGetAppsSearchLevel3
See the getApps() methods.
 o kGetProcessesIgnoreHidden
 o kGetProcessesIgnoreSystem
 o kInAndOutOnly
See the getDirection() method.
 o kInOnly
See the getDirection() method.
 o kMaximize
See the launchURL method.
 o kMinimize
See the launchURL method.
 o kMoveToBack
See the launchURL method.
 o kMoveToFront
See the launchURL method.
 o kOutOnly
See the getDirection() method.
 o kResolveAliasNoUI
See the createDiskObject and resolveAlias methods.
 o kResolveAliasUI
See the createDiskObject and resolveAlias methods.

Method Index

 o createAlias(DiskObject, File, int, int)
Creates an alias.
 o createAppFile(File)
Returns an AppFile created from a disk file.
 o createDiskObject(File, int)
Returns a DiskObject created from a java.io.File object.
 o findExtensions(FinderInfo, int)
Return an array containing FileExtension objects which correspond to the given FinderInfo object.
 o findFinderInfo(FileExtension, int)
Return an array containing FinderInfo objects which correspond to the given FileExtension object.
 o getApps(FileExtension, int, int)
Returns an array of applications which are associated with the given FileExtension object.
 o getApps(FinderInfo, int, int)
Returns an array of applications which are associated with the given FinderInfo object.
 o getApps(String, int, int)
Returns an array of applications whose name contains the string 'appName'.
 o getDirection()
Returns the direction flags.
 o getFileType(File)
Returns a FileType object representing the file type of a disk file.
 o getMainMonitor()
Returns the main video monitor.
 o getMonitors()
Returns a list of all the video monitors which are currently active.
 o getProcesses(int, int)
Returns an array of all the currently running processes, whether created using JConfig or not.
 o getVolumes()
Returns an array containing the current disk volumes.
 o initialize(File, int)
This method must be called before using any other method of this class.
 o isInited()
Returns whether this class has been initialized.
 o iterate(ConfigEntryVisitor)
For each entry in the mappings database, the 'visit()' method of the 'cev' argument is called.
 o launchURL(String, int, String[])
Launch the indicated URL.
 o resolveAlias(DiskAlias, int)
Returns a DiskObject created from an alias.
 o setDirection(int)
Sets the direction flags.

Variables

 o kInOnly
  public final static int kInOnly
See the getDirection() method.
 o kOutOnly
  public final static int kOutOnly
See the getDirection() method.
 o kInAndOutOnly
  public final static int kInAndOutOnly
See the getDirection() method.
 o kMoveToFront
  public final static int kMoveToFront
See the launchURL method.
 o kMoveToBack
  public final static int kMoveToBack
See the launchURL method.
 o kMinimize
  public final static int kMinimize
See the launchURL method.
 o kMaximize
  public final static int kMaximize
See the launchURL method.
 o kResolveAliasNoUI
  public final static int kResolveAliasNoUI
See the createDiskObject and resolveAlias methods.
 o kResolveAliasUI
  public final static int kResolveAliasUI
See the createDiskObject and resolveAlias methods.
 o kGetAppsSearchLevel1
  public final static int kGetAppsSearchLevel1
See the getApps() methods.
 o kGetAppsSearchLevel2
  public final static int kGetAppsSearchLevel2
See the getApps() methods.
 o kGetAppsSearchLevel3
  public final static int kGetAppsSearchLevel3
See the getApps() methods.
 o kGetProcessesIgnoreSystem
  public final static int kGetProcessesIgnoreSystem
 o kGetProcessesIgnoreHidden
  public final static int kGetProcessesIgnoreHidden

Methods

 o initialize
  public static void initialize(File curDir,
                                int creator)
This method must be called before using any other method of this class.
Parameters:
curDir - this must be the directory which contains the file 'jconfig.cfg', which contains configuration information. This directory must be writable; temporary files might be created in this directory.
creator - the creator value of the application using this package.
 o isInited
  public static boolean isInited()
Returns whether this class has been initialized. If initialization using the previous method failed, false is returned.
 o findExtensions
  public static FileExtension[] findExtensions(FinderInfo finfo,
                                               int maxToReturn)
Return an array containing FileExtension objects which correspond to the given FinderInfo object. The 'maxToReturn' argument is used as a hint only; the actual array size may be greater or less than this. If no extensions were found, null is returned.
 o findFinderInfo
  public static FinderInfo[] findFinderInfo(FileExtension ext,
                                            int maxToReturn)
Return an array containing FinderInfo objects which correspond to the given FileExtension object. The 'maxToReturn' argument is used as a hint only; the actual array size may be greater or less than this. If no FinderInfo objects were found, null is returned.
 o getApps
  public static AppFile[] getApps(String appName,
                                  int maxToReturn,
                                  int flags)
Returns an array of applications whose name contains the string 'appName'. Case is ignored; whether the argument matches a whole word or not is ignored. If no applications are found, null is returned.
Parameters:
appName - the string to search for.
maxToReturn - indicates the maximum number of AppFiles to return. NOTE: this is used as a hint only; the actual array size may be greater or less than this.
flags - the lower two bits of this int indicate the level of searching which should be performed. 0 indicates only standard searching; the values 'kGetAppsSearchLevel1', 'kGetAppsSearchLevel2', and 'kGetAppsSearchLevel3' indicate increasing levels of searching should be performed. The remaining bits of this int are reserved, and should be set to zero.
 o getApps
  public static AppFile[] getApps(FinderInfo finfo,
                                  int maxToReturn,
                                  int flags)
Returns an array of applications which are associated with the given FinderInfo object. See the preceding method for details on the arguments.
 o getApps
  public static AppFile[] getApps(FileExtension ext,
                                  int maxToReturn,
                                  int flags)
Returns an array of applications which are associated with the given FileExtension object. See the preceding method for details on the arguments.
 o iterate
  public static int iterate(ConfigEntryVisitor cev)
For each entry in the mappings database, the 'visit()' method of the 'cev' argument is called. Returns 0 if no error occured.
 o launchURL
  public static int launchURL(String url,
                              int flags,
                              String preferredBrowsers[])
Launch the indicated URL. See the Internet Config documentation for more information. Returns 0 if no error occured. 'url' must be a fully qualified URL in quoted-printable form.
Parameters:
flags - one of the following values: 0, kMoveToFront, kMoveToBack, kMinimize, or kMaximize
preferredBrowsers - a list of the browsers which should be tried to use to open the URL, in order of preference.
On Mac, each String should be exactly four characters long, and represents a creator code, i.e., { "MSIE", "MOS!" }. This argument will be ignored if Internet Config is installed and properly configured, because Internet Config is given first chance to launch the URL in the user-specified browser.
On Windows, each String represents the name of a DDE server which will be searched for, i.e., { "IEXPLORER", "NETSCAPE" }. This argument will be ignored if one of the indicated servers is not running ( i.e., with the previous example, if both IE and Netscape aren't running, this argument will be ignored. )
This argument may be null.
 o getVolumes
  public static DiskVolume[] getVolumes()
Returns an array containing the current disk volumes. Returns null if an error occurs.
 o createAppFile
  public static AppFile createAppFile(File fl) throws FileNotFoundException, DiskFileException
Returns an AppFile created from a disk file. The file must exist, and be an application.
Parameters:
fl - the file from which to create the object.
 o createDiskObject
  public static DiskObject createDiskObject(File fl,
                                            int flags) throws FileNotFoundException, DiskFileException
Returns a DiskObject created from a java.io.File object. The returned DiskObject may represent a file, a directory, a drive, or an alias.
Parameters:
fl - the file from which to create the object.
flags - if this is 0, aliases will not be resolved. Otherwise, set this to kResolveAliasUI if interaction with the user is permissible, or to kResolveAliasNoUI if interaction with the user is not permissible.
 o createAlias
  public static int createAlias(DiskObject target,
                                File newAlias,
                                int creator,
                                int flags) throws FileNotFoundException, DiskFileException
Creates an alias. Returns zero if no error occured, non-zero otherwise. Note that both files must already exist; the newAlias argument will be overwritten with the new alias.
Parameters:
target - the target to which the alias will point
newAlias - the new alias
creator - the creator value which will be given the new alias
flags - reserved; set to zero
 o resolveAlias
  public static DiskObject resolveAlias(DiskAlias da,
                                        int flags) throws FileNotFoundException, DiskFileException
Returns a DiskObject created from an alias. The returned DiskObject may be represent a file, a directory, or a drive.
Parameters:
da - the alias from which to create the object.
flags - must be either kResolveAliasUI if interaction with the user is permissible, or kResolveAliasNoUI if interaction with the user is not permissible.
 o getFileType
  public static FileType getFileType(File fl) throws FileNotFoundException, DiskFileException
Returns a FileType object representing the file type of a disk file. The file must exist.
Parameters:
fl - the file
 o getDirection
  public static int getDirection()
Returns the direction flags. This is one of four values: 0, kInOnly, kOutOnly, and kInAndOutOnly; these correspond to the check boxes in 'inbound only' and 'outbound only' in the dialog used to edit the Internet Config file mapping database. The default value is 0: no flags are set.
 o setDirection
  public static void setDirection(int dir)
Sets the direction flags. See the getDirection() method.
 o getMonitors
  public static Monitor[] getMonitors()
Returns a list of all the video monitors which are currently active.
 o getMainMonitor
  public static Monitor getMainMonitor()
Returns the main video monitor.
 o getProcesses
  public static AppProcess[] getProcesses(int maxToReturn,
                                          int flags)
Returns an array of all the currently running processes, whether created using JConfig or not.

All Packages  Class Hierarchy  This Package  Previous  Next  Index