org.exist.fluent
Class NamedResource.MetadataFacet

java.lang.Object
  extended by org.exist.fluent.NamedResource.MetadataFacet
Direct Known Subclasses:
Document.MetadataFacet
Enclosing class:
NamedResource

public abstract static class NamedResource.MetadataFacet
extends Object

The metadata facet of a named resource. Allows access to and manipulation of various aspects of a resource's metadata, including its permissions and various timestamps. NOTE: The permissions part of the interface is at a bare minimum right now, until I gather more use cases and flesh it out.


Method Summary
 void changePermissions(String instructions)
          Change the permissions of the underlying resource.
abstract  Date creationDate()
          Return the time at which this resource was originally created.
 String group()
          Return the group who has privileged access to this resource for purposes of permission management.
 void group(String group)
          Set the group that will have privileged access to this resource for purposes of permission management.
 boolean hasPermission(char who, char what)
          Return whether the given subject has the given permission.
 String owner()
          Return the user who owns this resource for purposes of permission management.
 void owner(String owner)
          Set the owner of this resource for purposes of permission management.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

creationDate

public abstract Date creationDate()
Return the time at which this resource was originally created.

Returns:
the creation date of this resource

owner

public String owner()
Return the user who owns this resource for purposes of permission management.

Returns:
the owner of this resource

owner

public void owner(String owner)
Set the owner of this resource for purposes of permission management.

Parameters:
owner - the new owner of this resource

group

public String group()
Return the group who has privileged access to this resource for purposes of permission management.

Returns:
the owning group of this resource

group

public void group(String group)
Set the group that will have privileged access to this resource for purposes of permission management.

Parameters:
group - the new owning group of this resource

hasPermission

public boolean hasPermission(char who,
                             char what)
Return whether the given subject has the given permission. The "who" character refers to subjects as follows: The "what" character refers to the permissions to check:

Parameters:
who - the subject to check for permission
what - the access right to check for
Returns:
true if the given subject has the given permission, false otherwise

changePermissions

public void changePermissions(String instructions)
Change the permissions of the underlying resource. The format of the instructions is based upon that of the Unix chmod command: one or more letters representing the subject to modify, followed by an operation sign, followed by zero or more letters representing the permissions to modify. The subject and permission letters are the ones listed for hasPermission(char, char), except that the 'a' subject cannot be mixed with any of the other ones. If multiple subjects or permissions are listed, they must be listed in the canonical order shown. The operation signs are: You can combine multiple such subjects/operation/permissions segments by separating them with commas (no spaces); they will be processed in the given order, so late segments can override the effects of earlier ones. Some examples:

Parameters:
instructions - an instruction string encoding the desired changes to the permissions

toString

public String toString()
Overrides:
toString in class Object


Copyright (C) All rights reserved.