org.openanzo.server.repository.structures
Class ACI

java.lang.Object
  extended by org.openanzo.server.repository.structures.ACI
All Implemented Interfaces:
Batchable, CachableResource

public class ACI
extends java.lang.Object
implements Batchable, CachableResource

Provides read and write access to an Access Control Item stored in the repository. Each access control item provides the follwing privileges to a role of user: read - statements in NamedGraph visible
add - add statements to NamedGraph
delete - delete statements in NamedGraph
insertNamedGraph - create a new NamedGraph
deleteNamedGraph - delete a NamedGraph
changeNamedGraphAcls - change the acl properties of a NamedGraph
Access Control Items (or ACIs) are an internal data structure and are grouped together to form access control lists (ACLs). AccessControl data is cached in memory and is not persisted to the repository until commit is called or a batch commit (via the Batchable interface) is performed.

Author:
Joe Betz, Matthew Roy ( mroy@cambridgesemantics.com )
See Also:
Batchable, ACL

Nested Class Summary
static class ACI.Factory
          Static factory to create ACI objects
 
Nested classes/interfaces inherited from interface org.openanzo.jdbc.utils.batchable.Batchable
Batchable.BatchGroup, Batchable.BatchOperation, Batchable.BatchOperationSet, Batchable.NullBatch
 
Field Summary
 
Fields inherited from interface org.openanzo.jdbc.utils.batchable.Batchable
EMPTY_BATCH
 
Method Summary
 void commit()
          Commit the changes to this ACI to the database
 void copyTo(ACI aci, boolean setId)
          Copy all the permissions and the role for this ACI to another ACI.
static ACI createACI(RepositoryConnection repositoryConnection, java.lang.Long id)
          Creates an AccessControl item, if the id is already in use in the repository then a ModelServiceException is thrown.
 java.lang.Long getAclId()
          Get the ID of the ACL that this aci belongs
 java.lang.Long getId()
          Get the id of this ACI
 java.lang.Long getModified()
          Get the timestamp when the ACI was modified
 java.lang.Long getRoleId()
          Get the role that this ACI affects
 org.openrdf.model.URI getURI()
          Get the URI of this ACI
 boolean hasPrivilege(Privilege privilege)
          Does this ACI contain the provided privilege
 boolean isStored()
          Is ACI stored in DB already
 java.util.List<Batchable.BatchOperation> listBatchOperations()
          Get the current list of batch operations for this object
static ACI loadACI(RepositoryConnection repositoryConnection, java.lang.Long id)
          Given an AccessControl item's unique id, attempts to load it from repository.
 void remove()
          Remove this ACI from DB
 void setACL(ACL acl)
          Set the ACL that this aci belongs
 void setAclId(java.lang.Long id)
          Set the ID of the ACL that this aci belongs
 void setModified(java.lang.Long modified)
          Set the timestamp when the ACI was modified
 void setPrivilege(Privilege privilege, boolean value)
          Set the privilege in this ACI to the provided value
 void setRole(Role role)
          Set the role that this aci affects
 void setRoleId(java.lang.Long roleId)
          Set the role that this aci affects
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadACI

public static ACI loadACI(RepositoryConnection repositoryConnection,
                          java.lang.Long id)
                   throws AnzoException
Given an AccessControl item's unique id, attempts to load it from repository.

Parameters:
repositoryConnection - The repository to load from.
id - The AccessControl item's unique id.
Returns:
The loaded AccessControl item.
Throws:
AnzoException - Thrown if the AccessControl item was not found or if an error occured during object construction.

createACI

public static ACI createACI(RepositoryConnection repositoryConnection,
                            java.lang.Long id)
                     throws AnzoException
Creates an AccessControl item, if the id is already in use in the repository then a ModelServiceException is thrown. The AccessControl item is not stored in the repository until it is committed.

Parameters:
repositoryConnection - The repository where the AccessControl item will be stored.
id - ID of the AccessControl item.
Returns:
The created AccessControl item.
Throws:
AnzoException

isStored

public boolean isStored()
Is ACI stored in DB already

Specified by:
isStored in interface CachableResource
Returns:
Is data object persisted in repository

remove

public void remove()
Remove this ACI from DB


hasPrivilege

public boolean hasPrivilege(Privilege privilege)
                     throws AnzoException
Does this ACI contain the provided privilege

Parameters:
privilege -
Returns:
true if this ACI contains the provided privilege
Throws:
AnzoException

setPrivilege

public void setPrivilege(Privilege privilege,
                         boolean value)
                  throws AnzoException
Set the privilege in this ACI to the provided value

Parameters:
privilege - privilege which is getting set
value - the privilege in this ACI to the provided value
Throws:
AnzoException

getRoleId

public java.lang.Long getRoleId()
                         throws AnzoException
Get the role that this ACI affects

Returns:
the id of the role that this ACI affects
Throws:
AnzoException

setRoleId

public void setRoleId(java.lang.Long roleId)
               throws AnzoException
Set the role that this aci affects

Parameters:
roleId - the ID of the role that this aci affects
Throws:
AnzoException

setRole

public void setRole(Role role)
             throws AnzoException
Set the role that this aci affects

Parameters:
role - role for this ACI
Throws:
AnzoException

getModified

public java.lang.Long getModified()
                           throws AnzoException
Get the timestamp when the ACI was modified

Returns:
the timestamp when the ACI was modified
Throws:
AnzoException

setModified

public void setModified(java.lang.Long modified)
                 throws AnzoException
Set the timestamp when the ACI was modified

Parameters:
modified -
Throws:
AnzoException

getAclId

public java.lang.Long getAclId()
                        throws AnzoException
Get the ID of the ACL that this aci belongs

Returns:
the ID of the ACL that this aci belongs
Throws:
AnzoException

setAclId

public void setAclId(java.lang.Long id)
              throws AnzoException
Set the ID of the ACL that this aci belongs

Parameters:
id - the ID of the ACL that this aci belongs
Throws:
AnzoException

setACL

public void setACL(ACL acl)
            throws AnzoException
Set the ACL that this aci belongs

Parameters:
acl - the ACL that this aci belongs
Throws:
AnzoException

getId

public java.lang.Long getId()
                     throws AnzoException
Get the id of this ACI

Specified by:
getId in interface CachableResource
Returns:
the id of this ACI
Throws:
AnzoException

getURI

public org.openrdf.model.URI getURI()
Get the URI of this ACI

Specified by:
getURI in interface CachableResource
Returns:
URI of the data object

commit

public void commit()
            throws RdbException
Commit the changes to this ACI to the database

Throws:
RdbException

listBatchOperations

public java.util.List<Batchable.BatchOperation> listBatchOperations()
Description copied from interface: Batchable
Get the current list of batch operations for this object

Specified by:
listBatchOperations in interface Batchable
Returns:
the current list of batch operations for this object

copyTo

public void copyTo(ACI aci,
                   boolean setId)
            throws AnzoException
Copy all the permissions and the role for this ACI to another ACI. Helpful since ACIs are immutable.

Parameters:
aci - ACI to copy privileges into
setId - Set destination aci's acl to this aci's aclId
Throws:
AnzoException


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.