Main Page Cookbook/Overview ImageMeister the jcprops file Licensing Binary Installation & Configuration [ Win · Mac · Nix · OSX ] Changes Public API Source Code Main Page Java [ Common · Win · Mac · Nix ] Native Code [ Common · Win · Mac · Nix ] Manifest Native Code Overviews [ Common · Win · Mac · Nix · Strings ] Macros [ General · Native Macros ] Walkthroughs [ Java only · Java and native ] Building [ Win · Mac · Nix · OSX ] Distribution Issues

    All Packages  This Package  Class Hierarchy  Class Search  Index

Class com.jconfig.FileRegistry

    java.lang.Object
       |
       +----com.jconfig.FileRegistry

Summary

    public class  FileRegistry
         extends java.lang.Object
    {
              // Fields 16
         public static final int ALIAS_NO_UI;
         public static final int ALIAS_UI;
         public static final int APP_MOVE_MAXIMIZE;
         public static final int APP_MOVE_MINIMIZE;
         public static final int APP_MOVE_TOBACK;
         public static final int APP_MOVE_TOFRONT;
         public static final int GETAPPS_SEARCH1;
         public static final int GETAPPS_SEARCH2;
         public static final int GETAPPS_SEARCH3;
         public static final int GETPROCESSES_IGNORE_HIDDEN;
         public static final int GETPROCESSES_IGNORE_SYSTEM;
         public static final int INANDOUT_ONLY;
         public static final int IN_ONLY;
         public static final int OUT_ONLY;
         private static final String copyrightString;
         private static FileRegistryI delegate;

              // Constructors 1
         private FileRegistry();

              // Methods 24
         public static int createAlias(DiskObject, File, int, int) throws FileNotFoundException, DiskFileException;
         public static AppFile createAppFile(File) throws FileNotFoundException, DiskFileException;
         public static DiskObject createDiskObject(File, int) throws FileNotFoundException, DiskFileException;
         public static FileExtension[] findExtensions(FinderInfo, int);
         public static FinderInfo[] findFinderInfo(FileExtension, int);
         public static AppFile[] getApps(FileExtension, int, int);
         public static AppFile[] getApps(FinderInfo, int, int);
         public static AppFile[] getApps(String, int, int);
         public static FileRegistryI getDelegate();
         public static int getDirection();
         public static FileSystem[] getFileSystems(int, int);
         public static FileType getFileType(File) throws FileNotFoundException, DiskFileException;
         public static Monitor getMainMonitor();
         public static Monitor[] getMonitors();
         public static PlatformInfoI getPlatformInfo();
         public static AppProcess[] getProcesses(int, int);
         public static DiskVolume[] getVolumes();
         public static void initialize(File, int);
         public static boolean isInited();
         public static int iterate(ConfigEntryVisitor);
         public static int launchURL(String, int, String[]);
         public static DiskObject resolveAlias(DiskAlias, int) throws FileNotFoundException, DiskFileException;
         public static void setDelegate(FileRegistryI);
         public static void setDirection(int);

    }

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.

Author:
  Copyright (c) 1997-2002 Samizdat Productions. All Rights Reserved.

Fields

### · copyrightString | Summary | Top

       private static final String copyrightString

### · delegate | Summary | Top

       private static FileRegistryI delegate

### · IN_ONLY | Summary | Top

       public static final int IN_ONLY

> See the getDirection() method.

### · OUT_ONLY | Summary | Top

       public static final int OUT_ONLY

> See the getDirection() method.

### · INANDOUT_ONLY | Summary | Top

       public static final int INANDOUT_ONLY

> See the getDirection() method.

### · APP_MOVE_TOFRONT | Summary | Top

       public static final int APP_MOVE_TOFRONT

> See the launchURL method.

### · APP_MOVE_TOBACK | Summary | Top

       public static final int APP_MOVE_TOBACK

> See the launchURL method.

### · APP_MOVE_MINIMIZE | Summary | Top

       public static final int APP_MOVE_MINIMIZE

> See the launchURL method.

### · APP_MOVE_MAXIMIZE | Summary | Top

       public static final int APP_MOVE_MAXIMIZE

> See the launchURL method.

### · ALIAS_NO_UI | Summary | Top

       public static final int ALIAS_NO_UI

> See the createDiskObject and resolveAlias methods.

### · ALIAS_UI | Summary | Top

       public static final int ALIAS_UI

> See the createDiskObject and resolveAlias methods.

### · GETAPPS_SEARCH1 | Summary | Top

       public static final int GETAPPS_SEARCH1

> See the getApps() methods.

### · GETAPPS_SEARCH2 | Summary | Top

       public static final int GETAPPS_SEARCH2

> See the getApps() methods.

### · GETAPPS_SEARCH3 | Summary | Top

       public static final int GETAPPS_SEARCH3

> See the getApps() methods.

### · GETPROCESSES_IGNORE_SYSTEM | Summary | Top

       public static final int GETPROCESSES_IGNORE_SYSTEM

> See the getProcesses() methods.

### · GETPROCESSES_IGNORE_HIDDEN | Summary | Top

       public static final int GETPROCESSES_IGNORE_HIDDEN

> See the getProcesses() methods.

Constructors

### · FileRegistry | Summary | Top

       private FileRegistry()

Methods

### · initialize | Summary | Top

       public static void initialize(File curDir,
                                     int creator)

> This method must be called before using any other method of this class.

> Parameter | Description
> curDir | this must be the directory which contains the files 'jconfig.cfg' and 'jcfactrz.txt', both of which are supplied with this distribution. IMPORTANT: If 'curDir' does not contain both 'jconfig.cfg' and 'jcfactrz.txt', JConfig will not be properly initialized, and only a limited set of functionality will be provided. In this case, JConfig will output a message saying that FileRegistryPlain has been loaded. If this occurs, check that the 'curDir' directory contains both these files. This directory must be writable; temporary files might be created in this directory.
> creator | the creator value of the application using this package.

### · setDelegate | Summary | Top

       public static void setDelegate(FileRegistryI fri)

> Sets the object to which all other calls are delegated.

### · getDelegate | Summary | Top

       public static FileRegistryI getDelegate()

> Returns the object to which all other calls are delegated.

### · isInited | Summary | Top

       public static boolean isInited()

> Returns whether this class has been initialized. If initialization using the previous method failed, false is returned.

### · getPlatformInfo | Summary | Top

       public static PlatformInfoI getPlatformInfo()

> Indicates which platform we're running on.

> Returns:
>   a PlatformInfoI object containing information on the current platform/VM

### · findExtensions | Summary | Top

       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.

### · findFinderInfo | Summary | Top

       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.

### · getApps | Summary | Top

       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.

> Parameter | Description
> 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 'GETAPPS_SEARCH1', 'GETAPPS_SEARCH2', and 'GETAPPS_SEARCH3' indicate increasing levels of searching should be performed. The remaining bits of this int are reserved, and should be set to zero.

### · getApps | Summary | Top

       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.

### · getApps | Summary | Top

       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.

### · iterate | Summary | Top

       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.

### · launchURL | Summary | Top

       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.

> Parameter | Description
> flags | one of the following values: 0, APP_MOVE_TOFRONT, APP_MOVE_TOBACK, APP_MOVE_MINIMIZE, or APP_MOVE_MAXIMIZE
> 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", "NSShell" }. 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.

### · getVolumes | Summary | Top

       public static DiskVolume[] getVolumes()

> Returns an array containing the current disk volumes. Returns null if an error occurs.

### · createAppFile | Summary | Top

       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.

> Parameter | Description
> fl | the file from which to create the object.

### · createDiskObject | Summary | Top

       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.

> Parameter | Description
> fl | the file from which to create the object.
> flags | if this is 0, aliases will not be resolved. Otherwise, set this to ALIAS_UI if interaction with the user is permissible, or to ALIAS_NO_UI if interaction with the user is not permissible.

### · createAlias | Summary | Top

       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.

> Parameter | Description
> target | the target to which the alias will point
> newAlias | the new alias
> creator | reserved; set to zero
> flags | reserved; set to zero

### · resolveAlias | Summary | Top

       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.

> Parameter | Description
> da | the alias from which to create the object.
> flags | must be either ALIAS_UI if interaction with the user is permissible, or ALIAS_NO_UI if interaction with the user is not permissible.

### · getFileType | Summary | Top

       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.

> Parameter | Description
> fl | the file

### · getDirection | Summary | Top

       public static int getDirection()

> Returns the direction flags. This is one of four values: 0, IN_ONLY, OUT_ONLY, and INANDOUT_ONLY; 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.

### · setDirection | Summary | Top

       public static void setDirection(int dir)

> Sets the direction flags. See the getDirection() method.

### · getMonitors | Summary | Top

       public static Monitor[] getMonitors()

> Returns a list of all the video monitors which are currently active.

### · getMainMonitor | Summary | Top

       public static Monitor getMainMonitor()

> Returns the main video monitor.

### · getProcesses | Summary | Top

       public static AppProcess[] getProcesses(int maxToReturn,
                                               int flags)

> Returns an array of all the currently running processes, whether created using JConfig or not. Returns null if an error occurs.

> Parameter | Description
> maxToReturn | the maximum number of processes to return. This is a hint only.
> flags | either 0, or GETPROCESSES_IGNORE_SYSTEM and/or GETPROCESSES_IGNORE_HIDDEN

### · getFileSystems | Summary | Top

       public static FileSystem[] getFileSystems(int maxToReturn,
                                                 int flags)

> Returns an array of all the currently mounted FileSystems. If this information cannot be determined, returns null.

> Parameter | Description
> maxToReturn | the maximum number of file system to return. The actual number returned may be more than this amount.
> flags | reserved; set to zero

    All Packages  This Package  Class Hierarchy  Class Search  Index

Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7