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.
-
kGetAppsSearchLevel1
-
See the getApps() methods.
-
kGetAppsSearchLevel2
-
See the getApps() methods.
-
kGetAppsSearchLevel3
-
See the getApps() methods.
-
kGetProcessesIgnoreHidden
-
-
kGetProcessesIgnoreSystem
-
-
kInAndOutOnly
- See the getDirection() method.
-
kInOnly
- See the getDirection() method.
-
kMaximize
- See the launchURL method.
-
kMinimize
- See the launchURL method.
-
kMoveToBack
- See the launchURL method.
-
kMoveToFront
- See the launchURL method.
-
kOutOnly
- See the getDirection() method.
-
kResolveAliasNoUI
- See the createDiskObject and resolveAlias methods.
-
kResolveAliasUI
- See the createDiskObject and resolveAlias methods.
-
createAlias(DiskObject, File, int, int)
- Creates an alias.
-
createAppFile(File)
- Returns an AppFile created from a disk file.
-
createDiskObject(File, int)
- Returns a DiskObject created from a java.io.File object.
-
findExtensions(FinderInfo, int)
- Return an array containing FileExtension objects which correspond to the given FinderInfo
object.
-
findFinderInfo(FileExtension, int)
- Return an array containing FinderInfo objects which correspond to the given FileExtension
object.
-
getApps(FileExtension, int, int)
- Returns an array of applications which are associated with the given FileExtension object.
-
getApps(FinderInfo, int, int)
- Returns an array of applications which are associated with the given FinderInfo object.
-
getApps(String, int, int)
- Returns an array of applications whose name contains the string 'appName'.
-
getDirection()
- Returns the direction flags.
-
getFileType(File)
- Returns a FileType object representing the file type of a disk file.
-
getMainMonitor()
-
Returns the main video monitor.
-
getMonitors()
-
Returns a list of all the video monitors which are currently active.
-
getProcesses(int, int)
-
Returns an array of all the currently running processes, whether created using JConfig
or not.
-
getVolumes()
- Returns an array containing the current disk volumes.
-
initialize(File, int)
- This method must be called before using any other method of this class.
-
isInited()
- Returns whether this class has been initialized.
-
iterate(ConfigEntryVisitor)
- For each entry in the mappings database, the 'visit()' method of the 'cev' argument is called.
-
launchURL(String, int, String[])
- Launch the indicated URL.
-
resolveAlias(DiskAlias, int)
- Returns a DiskObject created from an alias.
-
setDirection(int)
- Sets the direction flags.
kInOnly
public final static int kInOnly
- See the getDirection() method.
kOutOnly
public final static int kOutOnly
- See the getDirection() method.
kInAndOutOnly
public final static int kInAndOutOnly
- See the getDirection() method.
kMoveToFront
public final static int kMoveToFront
- See the launchURL method.
kMoveToBack
public final static int kMoveToBack
- See the launchURL method.
kMinimize
public final static int kMinimize
- See the launchURL method.
kMaximize
public final static int kMaximize
- See the launchURL method.
kResolveAliasNoUI
public final static int kResolveAliasNoUI
- See the createDiskObject and resolveAlias methods.
kResolveAliasUI
public final static int kResolveAliasUI
- See the createDiskObject and resolveAlias methods.
kGetAppsSearchLevel1
public final static int kGetAppsSearchLevel1
- See the getApps() methods.
kGetAppsSearchLevel2
public final static int kGetAppsSearchLevel2
- See the getApps() methods.
kGetAppsSearchLevel3
public final static int kGetAppsSearchLevel3
- See the getApps() methods.
kGetProcessesIgnoreSystem
public final static int kGetProcessesIgnoreSystem
kGetProcessesIgnoreHidden
public final static int kGetProcessesIgnoreHidden
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.
isInited
public static boolean isInited()
- Returns whether this class has been initialized. If initialization using the previous method
failed, false is returned.
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.
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.
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.
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.
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.
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.
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.
getVolumes
public static DiskVolume[] getVolumes()
- Returns an array containing the current disk volumes. Returns null if an error occurs.
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.
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.
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
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.
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
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.
setDirection
public static void setDirection(int dir)
- Sets the direction flags. See the getDirection() method.
getMonitors
public static Monitor[] getMonitors()
- Returns a list of all the video monitors which are currently active.
getMainMonitor
public static Monitor getMainMonitor()
- Returns the main video monitor.
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