public class FileSystemOps
extends java.lang.Object
This supports some common global variables that are called built-in functions in Progress but which take no parameters, not even empty parenthesis. These variables are read-only (they cannot be assigned).
A partial implementation of the FILE-INFO
system handle is
available but only the FILE-NAME
and FILE-SIZE
attributes are supported.
The following is the list of supported Progress 4GL features:
Progress Variable Java Equivalent --------------------- ---------------------- os-errorgetLastError()
os-drivesgetRootList()
os-getenvgetProperty(com.goldencode.p2j.util.character)
Language Statement Java Equivalent --------------------- ---------------------- os-appendappend(com.goldencode.p2j.util.character, com.goldencode.p2j.util.character)
os-copycopy(com.goldencode.p2j.util.character, com.goldencode.p2j.util.character)
os-create-dirmkdir(java.lang.String[])
os-deletedelete(java.lang.String[], boolean)
os-renamerename(com.goldencode.p2j.util.character, com.goldencode.p2j.util.character)
Function Java Equivalent --------------------- ---------------------- membermember(java.lang.String)
searchsearchPath(com.goldencode.p2j.util.character)
System Handle:Attribute Java Equivalent ------------------------- ---------------------- file-info:file-create-datefileInfoGetCreationDate()
(get) file-info:file-create-timefileInfoGetCreationTime()
(get) file-info:file-mod-datefileInfoGetModDate()
(get) file-info:file-mod-timefileInfoGetModTime()
(get) file-info:file-nameinitFileInfo(com.goldencode.p2j.util.character)
(set) file-info:file-namegetFileName()
(get) file-info:file-sizefileInfoGetSize()
(get) file-info:file-typefileInfoGetType()
(get) file-info:full-pathnamefileInfoGetFullPath()
(get) file-info:pathnamefileInfoGetPathName()
(get)
This class implements the Progress interface/semantic. However the actual
implementation of this function is provided by a network object that
implements the FileSystem
interface. This means that the actual
operations occur on the remote node associated with this user's session.
Please see FileSystemDaemon
and the RemoteObject
in
the net
package.
Modifier and Type | Class and Description |
---|---|
private static class |
FileSystemOps.ContextContainer
Simple container that stores and returns a context-local instance of
the global work area.
|
private static class |
FileSystemOps.WorkArea
Stores global data relating to the state of the current context.
|
Modifier and Type | Field and Description |
---|---|
private static FileSystemOps.ContextContainer |
work
Stores context-local state variables.
|
Constructor and Description |
---|
FileSystemOps() |
Modifier and Type | Method and Description |
---|---|
static void |
append(character src,
character tar)
Appends the specified source file to the end of the target file.
|
static void |
append(character src,
java.lang.String tar)
Appends the specified source file to the end of the target file.
|
static void |
append(java.lang.String src,
character tar)
Appends the specified source file to the end of the target file.
|
static void |
append(java.lang.String src,
java.lang.String tar)
Appends the specified source file to the end of the target file.
|
static handle |
asHandle()
Get a the instance for the FILE-INFO system handle.
|
static void |
copy(character src,
character tar)
Copies the specified source file to or over the target file.
|
static void |
copy(character src,
java.lang.String tar)
Copies the specified source file to or over the target file.
|
static void |
copy(java.lang.String src,
character tar)
Copies the specified source file to or over the target file.
|
static void |
copy(java.lang.String src,
java.lang.String tar)
Copies the specified source file to or over the target file.
|
static void |
delete(java.lang.String[] list,
boolean recursive)
Deletes each of the directories or files specified.
|
static date |
fileInfoGetCreationDate()
If the current file information data structures are initialized, return
the file's creation date, otherwise return the
unknown value . |
static integer |
fileInfoGetCreationTime()
If the current file information data structures are initialized, return
the file's creation time (in seconds from midnight), otherwise
return the
unknown value . |
static character |
fileInfoGetFullPath()
If the current file information data structures are initialized, return
the absolute (canonicalized) path name, otherwise return the
unknown value . |
static date |
fileInfoGetModDate()
If the current file information data structures are initialized, return
the file's last modification date, otherwise return the
unknown value . |
static integer |
fileInfoGetModTime()
If the current file information data structures are initialized, return
the file's last modification time (in seconds from midnight), otherwise
return the
unknown value . |
static character |
fileInfoGetPathName()
If the current file information data structures are initialized, return
the absolute or relative path name, otherwise return the
unknown value . |
static integer |
fileInfoGetSize()
If the current file information data structures are initialized, return
the file's size, otherwise return the
unknown value . |
static character |
fileInfoGetType()
If the current file information data structures are initialized, return
a string with characters that specify attributes about the file,
otherwise return the
unknown value . |
static character |
getFileName()
If the current file information data structures are initialized, return
the file name, otherwise return the
unknown value . |
static integer |
getLastError()
Get the error code of the last operating system operation.
|
static character |
getProperty(character key)
Get the system property (user-defined properties can be specified at the Java command line)
associated with the passed key.
|
static character |
getProperty(java.lang.String key)
Get the system property (user-defined properties can be specified at the Java command line)
associated with the passed key.
|
static character |
getResourceType()
Get the type of its associated handle.
|
static character |
getRootList()
Get the comma-separated list of filesystem roots (drive letters on
platforms that support the concept, otherwise returns the equivalent
of the empty string).
|
static java.lang.Long |
id()
Get this resource's ID.
|
static void |
id(long id)
Set this resource's ID.
|
static void |
init()
Push the PROPATH values to the client side.
|
static void |
initFileInfo(character name)
Search for the specified file and initialize the related data
structures if found.
|
static void |
initFileInfo(java.lang.String name)
Search for the specified file and initialize the related data
structures if found.
|
static character |
member(character filename)
Parses a reference to a member of an ABL r-code library and returns the simple member name.
|
static character |
member(java.lang.String filename)
Parses a reference to a member of an ABL r-code library and returns the simple member name.
|
static void |
mkdir(java.lang.String[] dirs)
Creates each of the directories requested, if it doesn't exist and all
path segments up to the last segment do exist.
|
static void |
readOnlyError(java.lang.String attribute)
API needed to implement read-only attribute assignment (a 4GL
"feature").
|
static void |
rename(character src,
character tar)
Renames (and moves if the path is different) the specified source file
to the target filename (and path).
|
static void |
rename(character src,
java.lang.String tar)
Renames (and moves if the path is different) the specified source file
to the target filename (and path).
|
static void |
rename(java.lang.String src,
character tar)
Renames (and moves if the path is different) the specified source file
to the target filename (and path).
|
static void |
rename(java.lang.String src,
java.lang.String tar)
Renames (and moves if the path is different) the specified source file
to the target filename (and path).
|
static character |
searchPath(character filename)
Search each directory listed in the
EnvironmentOps.getSearchPath() for the given file. |
static character |
searchPath(java.lang.String filename)
Search each directory listed in the
EnvironmentOps.getSearchPath() for the given file. |
static void |
setLastError(int err)
Sets the error code of the last operating system operation.
|
(package private) static void |
setSearchPath(java.lang.String[] pathList,
boolean caseSens)
Sets the Progress search path on the TARGET P2J system which is used for
the Progress compatible environment.
|
static boolean |
unknown()
Implementation for the
WrappedResource.unknown() API. |
static boolean |
valid()
Implementation for the
WrappedResource.valid() API. |
private static FileSystemOps.ContextContainer work
public static handle asHandle()
StaticProxy.obtain(Class, Class[])
, using the
CommonFileInfo
interface and its methods implemented by these
classes: FileSystemOps
.public static java.lang.Long id()
public static void id(long id)
This is a no-op for system handles.
id
- The resource's ID.public static boolean valid()
WrappedResource.valid()
API.public static boolean unknown()
WrappedResource.unknown()
API.public static void init()
public static void readOnlyError(java.lang.String attribute)
attribute
- The attribute's name.handle.readOnlyError(handle, String)
public static integer getLastError()
public static void setLastError(int err)
err
- The Progress-compatible error code.public static void initFileInfo(character name)
name
is unknown
or not found,
the current data structures are cleared.name
- Relative or absolute filename to obtain information on.public static void initFileInfo(java.lang.String name)
EnvironmentOps.getSearchPath()
. If name
is
unknown
or not found, the current data structures are
cleared.name
- Relative or absolute filename to obtain information on.public static character getFileName()
unknown value
.unknown value
if the data structures were never
initialized.public static character fileInfoGetPathName()
unknown value
. If the specified file name was absolute,
then an absolute pathname will be returned. Otherwise the relative
path that was found via searchPath(com.goldencode.p2j.util.character)
will be returned.unknown value
if the data structures were never
initialized or if initialization failed.public static character fileInfoGetFullPath()
unknown value
.unknown value
if the data structures were
never initialized or if initialization failed.public static integer fileInfoGetSize()
unknown value
.unknown value
if the data structures were never
initialized or if initialization failed.public static character fileInfoGetType()
unknown value
.
One of the following mutually exclusive characters will be present:
Character Meaning --------- ----------------------------- D directory F file X unknown
There is no support for "S" (UNIX special devices) or "M" (procedure library members) at this time.
One or more of the following characters will be present:
Character Meaning --------- ----------------------------- H hidden R readable W writable
There is no support for "L" (UNIX symbolic links) or "P" (pipes) at this time.
unknown value
if the data structures were
never initialized or if initialization failed.public static date fileInfoGetModDate()
unknown value
.unknown value
if the data structures were
never initialized or if initialization failed.public static integer fileInfoGetModTime()
unknown value
.unknown value
if the data structures were never initialized or if
initialization failed.public static date fileInfoGetCreationDate()
unknown value
.unknown value
at this time.public static integer fileInfoGetCreationTime()
unknown value
.unknown value
at this time.public static character getRootList()
public static character getProperty(character key)
unknown
value is returned.unknown
if the property does not exist.public static character getProperty(java.lang.String key)
unknown
value is returned.unknown
if the property does not exist.public static void append(character src, character tar)
getLastError()
can be used to retrieve the error code.src
- The name of the source file. Must NOT be a directory name.tar
- The name of the target file. If this is a directory name or
if this is a non-existent filename, this method is converted
into a copy operation.public static void append(character src, java.lang.String tar)
getLastError()
can be used to retrieve the error code.src
- The name of the source file. Must NOT be a directory name.tar
- The name of the target file. If this is a directory name or
if this is a non-existent filename, this method is converted
into a copy operation.public static void append(java.lang.String src, character tar)
getLastError()
can be used to retrieve the error code.src
- The name of the source file. Must NOT be a directory name.tar
- The name of the target file. If this is a directory name or
if this is a non-existent filename, this method is converted
into a copy operation.public static void append(java.lang.String src, java.lang.String tar)
getLastError()
can be used to retrieve the error code.src
- The name of the source file. Must NOT be a directory name.tar
- The name of the target file. If this is a directory name or
if this is a non-existent filename, this method is converted
into a copy operation.public static void copy(character src, character tar)
getLastError()
can be used to
retrieve the error code.src
- The name of the source file. Must NOT be a directory name.tar
- The name of the target file. If this is a directory name,
the source file name will be used as the target file in
the directory given.public static void copy(character src, java.lang.String tar)
getLastError()
can be used to
retrieve the error code.src
- The name of the source file. Must NOT be a directory name.tar
- The name of the target file. If this is a directory name,
the source file name will be used as the target file in
the directory given.public static void copy(java.lang.String src, character tar)
getLastError()
can be used to
retrieve the error code.src
- The name of the source file. Must NOT be a directory name.tar
- The name of the target file. If this is a directory name,
the source file name will be used as the target file in
the directory given.public static void copy(java.lang.String src, java.lang.String tar)
getLastError()
can be used to
retrieve the error code.src
- The name of the source file. Must NOT be a directory name.tar
- The name of the target file. If this is a directory name,
the source file name will be used as the target file in
the directory given.public static void mkdir(java.lang.String[] dirs)
getLastError()
can be used to retrieve
the error code.dirs
- The list of directories to create.public static void delete(java.lang.String[] list, boolean recursive)
recursive
flag is true
. If any error occurs,
no exception will be thrown, the deletion process just continues. The
getLastError()
can be used to retrieve the error code.list
- The list of files and directories to delete.recursive
- Recursively decend through all subdirectories, deleting the entire subtree.public static void rename(character src, character tar)
getLastError()
can be used to
retrieve the error code.src
- The name of the source file or directory.tar
- The name of the target file or directory. If this is a
directory name for a directory that already exists and the
source
is a file, then the source file name will
be used as the target file in the directory given.public static void rename(character src, java.lang.String tar)
getLastError()
can be used to
retrieve the error code.src
- The name of the source file or directory.tar
- The name of the target file or directory. If this is a
directory name for a directory that already exists and the
source
is a file, then the source file name will
be used as the target file in the directory given.public static void rename(java.lang.String src, character tar)
getLastError()
can be used to
retrieve the error code.src
- The name of the source file or directory.tar
- The name of the target file or directory. If this is a
directory name for a directory that already exists and the
source
is a file, then the source file name will
be used as the target file in the directory given.public static void rename(java.lang.String src, java.lang.String tar)
getLastError()
can be used to
retrieve the error code.src
- The name of the source file or directory.tar
- The name of the target file or directory. If this is a
directory name for a directory that already exists and the
source
is a file, then the source file name will
be used as the target file in the directory given.public static character searchPath(character filename)
EnvironmentOps.getSearchPath()
for the given file.
If the file system object exists and is a file, then the filename is returned. If the path
contains an empty string or a '.', then the current directory is searched, otherwise only
the listed directories are searched.
Special processing is provided in case the original Progress code was checking for the
availability of an external procedure. In this case the filename is checked using the
SourceNameMapper.convertName(java.lang.String)
method. If such the Java class exists, its legacy
filename is returned. This will "fake" the converted code into thinking that the external
procedure this still exists.
filename
- The absolute or relative filename for which to search.unknown value
is returned.public static character searchPath(java.lang.String filename)
EnvironmentOps.getSearchPath()
for the given file.
If the file system object exists and is a file, then the filename is returned. If the path
contains an empty string or a '.', then the current directory is searched, otherwise only
the listed directories are searched.
Special processing is provided in case the original Progress code was checking for the
availability of an external procedure. In this case the filename is checked using the
SourceNameMapper.convertName(java.lang.String)
method. If such the Java class exists, its legacy
filename is returned. This will "fake" the converted code into thinking that the external
procedure this still exists.
filename
- The absolute or relative filename for which to search.unknown value
is returned.public static character member(java.lang.String filename)
filename
- Pathname of the file in the r-code library.path-name<<member-name>>
, where path-name
is
the pathname of a library and member-name
is the name of a file within
the library, and returns member-name
.public static character member(character filename)
filename
- Pathname of the file in the r-code library.path-name<<member-name>>
, where path-name
is
the pathname of a library and member-name
is the name of a file within
the library, and returns member-name
.public static character getResourceType()
static void setSearchPath(java.lang.String[] pathList, boolean caseSens)
pathList
- The array of directory names to set.caseSens
- Logical value representing the legacy file system being
case-sensitive or not.