|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.io.FileAccessRights
public final class FileAccessRights
Provides a means to define different group level access rights
to a file or directory. A FileAccessRights
consists of a
pathname and a set of actions valid for that pathname. Pathname is the
pathname of the file or directory granted the specified actions.
This package defines classes that extends the behavior of the
implementation of the java.io
package. By such, the
implementation of java.io
on a given platform that follows
this specification must enforce the access
model and rights defined in FileAccessRights
.
A pathname that ends in "/*
" (where "/
"
is the file separator character, File.separatorChar
)
indicates a directory and all the files contained in that directory.
A pathname that ends with "/-
" indicates a directory and
(recursively) all files and subdirectories contained in that directory.
The special pathname "<<ALL FILES>>
" matches
all files.
A pathname consisting of a single "*
" indicates all the
files in the current directory, while a pathname consisting of a single
"-
" indicates all the files in the current directory and
(recursively) all files and subdirectories contained in the current
directory. Current directory is following the same definition as
".
" by the Java.io.File
class.
The actions to be granted are passed to the constructor in a string containing a list of zero or more semicolon-separated set of flags. Three groups are defined and are mapped to the equivalent UNIX file permission groups: user, group and world. However interpretation of these groups are left to the implementation: other platforms like set top boxes may map the groups respectively to application, organization and world.
The action string is described by the following grammar (this definition also gives the canonical representation):
action ::= perm_set [';' perm_set [';' perm_set ] ] perm_set ::= read write execute read ::= 'r' | '-' | nil write ::= 'w' | '-' | nil execute ::= 'x' | '-' | nil
The order of the perm_set
s in an action
string
is respectively user, group and world
The access rights symbols are defined as follows:
r
w
x
-
nil
.rwx;rw-;r
"rw;rw;---
"rw;rw
"r;;
"r
";;rx
"rx;rx;rx
" allowing everybody to read and execute
that file.The canonical representation of file access rights is defined to be the minimal string representation:
As a consequence and because of the definition given in the Actions
section that an action
represents the access right given to
three groups that are included in each other, any access rights granted to
a larger group implies it is also granted to a lower group:
user
∈ group
∈ world
.
The following table lists different examples and their standardized canonical representation:
Access-Rights | Canonical | Description |
"r;w;x " |
"rwx;wx;x " |
Due to included group inheritance, every smaller group inherits from the rights of the larger group. |
";;rx " |
"rx;rx;rx " |
Access rights for world also apply to lower-ring
(smaller) groups. |
";r; " |
"r;r " |
Access rights for group also apply to
user . Moreover last semicolon is removed because there
are no access rights for world . |
";; " |
" " |
Semicolons are removed because there are no access right for any groups. |
FileProperties
Constructor Summary | |
---|---|
FileAccessRights(String path,
String actions)
Creates a new FileAccessRights object with the specified
actions. |
Method Summary | |
---|---|
String |
getActions()
Returns the "canonical string representation" of the actions. |
boolean |
implies(FileAccessRights other)
Checks if this FileAccessRights object "implies" the
specified access rights. |
String |
toString()
Returns a string describing the access rights. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileAccessRights(String path, String actions) throws NullPointerException
FileAccessRights
object with the specified
actions.
The path
and actions
follow the definition
described in the overview section
path
- The pathname of the file/directory.actions
- The action string.
NullPointerException
- if any of the argument is null
Method Detail |
---|
public boolean implies(FileAccessRights other)
FileAccessRights
object "implies" the
specified access rights.
More specifically, this method returns true
if:
other
is an instance of
FileAccessRights
,other
's actions are a proper subset of this object's
actions, andother
's pathname is implied by this object's
pathname.
For example, "/tmp/*
" implies
"/tmp/foo
", since "/tmp/*
" encompasses
the "/tmp
" directory and all files in that
directory, including the one named "foo
".
other
- The access rights to check against.
true
if the specified access rights are implied by
this object, false
if not.public String getActions()
public String toString()
getActions()
) in the following
format: '("ClassName" "name" "actions")'.
toString
in class Object
FileAccessRights
object.
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |