Bees v0.5.0 API

bees.core.resource
Class Directory

java.lang.Object
  |
  +--bees.core.Capability
        |
        +--bees.core.resource.PathSpec
              |
              +--bees.core.resource.Directory
All Implemented Interfaces:
CapabilitySpec

public final class Directory
extends PathSpec

The Directory capability is used to designate a directory relative to a FileSystemRoot.


Field Summary
static PermissionSet DEFAULT_PERMISSIONS
          The default permissions given to new Directory capabilities.
static PermissionSet DEFAULT_RESTRICTED_PERMISSIONS
          A more restricted set of permissions for Directory capabilities.
static FilePermission DIRECTORY_CREATE_PERMISSION
          Permission for creating directories.
static FilePermission DIRECTORY_DELETE_PERMISSION
          Permission for deleting directories.
static FilePermission DIRECTORY_EXECUTE_PERMISSION
          Permission for opening directories.
static FilePermission DIRECTORY_LIST_PERMISSION
          Permission for listing directories.
static java.lang.String DIRECTORY_PREFIX
          The string used to prefix directory permission names.
static FilePermission FILE_CREATE_PERMISSION
          Permission for creating files.
static FilePermission FILE_DELETE_PERMISSION
          Permission for deleting files.
static FilePermission FILE_EXECUTE_PERMISSION
          Permission for opening files.
static FilePermission FILE_LIST_PERMISSION
          Permission for listing files.
static java.lang.String FILE_PREFIX
          The string used to prefix file permission names.
 
Fields inherited from class bees.core.Capability
DELETE_PERMISSION, id, INVALID_ID
 
Constructor Summary
Directory()
          Construct an empty Directory object.
 
Method Summary
 void delete(java.lang.String name)
          Delete a file/directory contained within this directory.
 Directory directory(java.lang.String name)
          Reference a directory contained within this directory
 Directory directory(java.lang.String name, PermissionSet ps)
          Reference a directory contained within this directory.
 Directory directory(java.lang.String name, PermissionSet ps, boolean create)
          Reference a directory or create a new one contained within this directory.
 File file(java.lang.String name)
          Reference a file contained within this directory.
 File file(java.lang.String name, PermissionSet ps)
          Reference a file contained within this directory.
 File file(java.lang.String name, PermissionSet ps, boolean create)
          Reference a file or create a new one contained within this directory.
protected  void fromBytes(byte[] flattened, CapabilityEnvelope[] sub)
          Bind this capability to the given object.
 java.lang.String[] list()
           
 PathSpec lookup(java.lang.String name)
          Lookup an object contained within this directory.
 void revoke()
          Revoke access to the capability.
 java.lang.String toString()
           
 
Methods inherited from class bees.core.resource.PathSpec
getFactory, specFromBytes, toBytes
 
Methods inherited from class bees.core.Capability
checkPermission, clear, clonePermission, deleteCapability, equals, fromBytes, revokedPermission, revokePermission, revokePermissions, valid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILE_PREFIX

public static final java.lang.String FILE_PREFIX
The string used to prefix file permission names.

FILE_CREATE_PERMISSION

public static final FilePermission FILE_CREATE_PERMISSION
Permission for creating files.

FILE_DELETE_PERMISSION

public static final FilePermission FILE_DELETE_PERMISSION
Permission for deleting files.

FILE_EXECUTE_PERMISSION

public static final FilePermission FILE_EXECUTE_PERMISSION
Permission for opening files.

FILE_LIST_PERMISSION

public static final FilePermission FILE_LIST_PERMISSION
Permission for listing files.

DIRECTORY_PREFIX

public static final java.lang.String DIRECTORY_PREFIX
The string used to prefix directory permission names.

DIRECTORY_CREATE_PERMISSION

public static final FilePermission DIRECTORY_CREATE_PERMISSION
Permission for creating directories.

DIRECTORY_DELETE_PERMISSION

public static final FilePermission DIRECTORY_DELETE_PERMISSION
Permission for deleting directories.

DIRECTORY_EXECUTE_PERMISSION

public static final FilePermission DIRECTORY_EXECUTE_PERMISSION
Permission for opening directories.

DIRECTORY_LIST_PERMISSION

public static final FilePermission DIRECTORY_LIST_PERMISSION
Permission for listing directories.

DEFAULT_PERMISSIONS

public static final PermissionSet DEFAULT_PERMISSIONS
The default permissions given to new Directory capabilities.

DEFAULT_RESTRICTED_PERMISSIONS

public static final PermissionSet DEFAULT_RESTRICTED_PERMISSIONS
A more restricted set of permissions for Directory capabilities.
Constructor Detail

Directory

public Directory()
Construct an empty Directory object.
Method Detail

fromBytes

protected void fromBytes(byte[] flattened,
                         CapabilityEnvelope[] sub)
                  throws java.lang.Exception
Description copied from class: Capability
Bind this capability to the given object.
Overrides:
fromBytes in class Capability
See Also:
Capability.fromBytes(byte[], CapabilityEnvelope[])

revoke

public void revoke()
Description copied from class: Capability
Revoke access to the capability.
Overrides:
revoke in class PathSpec
See Also:
Capability.revoke()

list

public java.lang.String[] list()
Returns:
A list of files/directories contained within this directory. Note: If a file doesn't have a "list" permission it will not in the returned array.

lookup

public PathSpec lookup(java.lang.String name)
                throws java.io.IOException
Lookup an object contained within this directory.
Parameters:
name - The name of the file or directory to lookup.
Returns:
If the path resolves to a directory, then a Directory capability is returned, otherwise a File is returned.
Throws:
java.io.IOException - if the file could not be found or there was another problem.

directory

public Directory directory(java.lang.String name,
                           PermissionSet ps,
                           boolean create)
                    throws java.io.IOException
Reference a directory or create a new one contained within this directory.
Parameters:
name - The name of the directory.
ps - The set of permissions to give the Directory capability.
create - True if the directory should be created, false otherwise.
Returns:
A new Directory capability.
Throws:
java.io.IOException - if the directory could not be found or if there was a problem creating the directory.

directory

public Directory directory(java.lang.String name,
                           PermissionSet ps)
                    throws java.io.IOException
Reference a directory contained within this directory.
Parameters:
name - The name of the directory.
ps - The set of permissions to give the Directory capability.
Returns:
A new Directory capability.
Throws:
java.io.IOException - if the directory could not be found.

directory

public Directory directory(java.lang.String name)
                    throws java.io.IOException
Reference a directory contained within this directory
Parameters:
name - The name of the directory.
Returns:
A new Directory capability with the default set of permissions.
Throws:
java.io.IOException - if the directory could not be found.

file

public File file(java.lang.String name,
                 PermissionSet ps,
                 boolean create)
          throws java.io.IOException
Reference a file or create a new one contained within this directory.
Parameters:
name - The name of the file.
ps - The set of permissions to give the file capability.
create - True if the file should be created, false otherwise.
Returns:
A new File capability.
Throws:
java.io.IOException - if the file could not be found or if there was a problem creating the file.

file

public File file(java.lang.String name,
                 PermissionSet ps)
          throws java.io.IOException
Reference a file contained within this directory.
Parameters:
name - The name of the file.
ps - The set of permissions to give the file capability.
Returns:
A new File capability.
Throws:
java.io.IOException - if the file could not be found.

file

public File file(java.lang.String name)
          throws java.io.IOException
Reference a file contained within this directory.
Parameters:
name - The name of the file.
Returns:
A new File capability with the default set of permissions.
Throws:
java.io.IOException - if the file could not be found.

delete

public void delete(java.lang.String name)
Delete a file/directory contained within this directory.
Parameters:
name - The name of the file/directory to delete.

toString

public java.lang.String toString()
Overrides:
toString in class PathSpec
See Also:
Object.toString()

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/