org.openanzo.server.repository.update
Class ServerUpdatesProcessor

java.lang.Object
  extended by org.openanzo.serialization.handlers.HandlerAdapter
      extended by org.openanzo.server.repository.update.ServerUpdatesProcessor
All Implemented Interfaces:
IRepositoryHandler

public class ServerUpdatesProcessor
extends HandlerAdapter

ServerUpdatesProcessor handles updates sent from the client, and applies them to the server

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Constructor Summary
ServerUpdatesProcessor(RepositoryConnection repositoryConnection, UpdateResults updateResults)
          Create a new ServerUpdatesProcessor
 
Method Summary
 TransactionUpdateResults getCurrentTransactionUpdateResults()
           
 RepositoryConnection getRepositoryConnection()
           
 boolean handleAci(boolean addition, org.openrdf.model.URI namedGraph, org.openrdf.model.URI acl, org.openrdf.model.URI role, java.lang.Boolean canRead, java.lang.Boolean canUpdate, java.lang.Boolean canDelete, java.lang.Boolean canInsert, java.lang.Boolean canRemove, java.lang.Boolean canChangeAcl)
          Handle ACI message
 boolean handleAcl(boolean additions, org.openrdf.model.URI aclNode, boolean isTemplate)
          Handle ACL message
 boolean handleCommandEnd()
          Handle end of command message
 boolean handleCommandStart(java.lang.Long commandId, java.lang.String commandType, java.util.Set<IPrecondition> preconditions)
          Handle start of command message
 boolean handleCommandStart(java.lang.Long id, java.lang.String commandType, java.lang.String commandPreconditions)
          Handle start of command message
 boolean handleNamedGraph(boolean additions, org.openrdf.model.URI namedGraphUri, org.openrdf.model.URI metadataGraphUri, java.lang.Long revision, org.openrdf.model.URI aclNode, org.openrdf.model.URI createdBy, java.lang.Long modified, org.openrdf.model.URI lastModifiedBy)
          Handle NamedGraph message
 boolean handleNode(java.lang.Long id, org.openrdf.model.Value node)
          Handle Node message
 boolean handleRole(boolean additions, org.openrdf.model.URI roleNode)
          Handle role message
 boolean handleStatement(boolean additions, org.openrdf.model.URI graphUri, org.openrdf.model.Resource subject, org.openrdf.model.URI predicate, org.openrdf.model.Value object)
          Handle statement message
 boolean handleSubRoleOf(boolean additions, org.openrdf.model.URI roleNode, org.openrdf.model.URI parentRoleNode)
          Handle Role subrole of another role message
 boolean handleTransactionEnd()
          Handle end of transaction message
 boolean handleTransactionStart(java.lang.Long id, java.lang.Long timestamp)
          Handle start of transaction message
 boolean handleUser(boolean additions, org.openrdf.model.URI userNode, org.openrdf.model.URI defaultRoleNode, org.openrdf.model.URI defaultAclNode, java.lang.String userId, java.lang.String password)
          Handle user message
 boolean handleUserInRole(boolean additions, org.openrdf.model.URI userNode, org.openrdf.model.URI roleNode)
          Handle User in Role message
 void parse(boolean additions, java.util.Collection<org.openrdf.model.Statement> statements)
          Parse the contents of a graph into updates
 void read(java.io.InputStream inputStream)
          Read udpates from an InputStream
 
Methods inherited from class org.openanzo.serialization.handlers.HandlerAdapter
handleEndDocument, handleError, handleReset, handleStartDocument
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerUpdatesProcessor

public ServerUpdatesProcessor(RepositoryConnection repositoryConnection,
                              UpdateResults updateResults)
Create a new ServerUpdatesProcessor

Parameters:
repositoryConnection - RepositoryConnection to run queries and updates against
updateResults - UpdateResults to which updates are written
Method Detail

read

public void read(java.io.InputStream inputStream)
          throws AnzoException
Read udpates from an InputStream

Parameters:
inputStream - InputStream containing updates
Throws:
AnzoException

parse

public void parse(boolean additions,
                  java.util.Collection<org.openrdf.model.Statement> statements)
           throws AnzoException
Parse the contents of a graph into updates

Parameters:
additions - Does this Graph contain additions
statements - statements to parse
Throws:
AnzoException

handleTransactionStart

public boolean handleTransactionStart(java.lang.Long id,
                                      java.lang.Long timestamp)
                               throws AnzoException
Description copied from interface: IRepositoryHandler
Handle start of transaction message

Specified by:
handleTransactionStart in interface IRepositoryHandler
Overrides:
handleTransactionStart in class HandlerAdapter
Parameters:
id - Id of transaction
timestamp - timestamp when transaction was committed
Returns:
Message handled successfully
Throws:
AnzoException

handleTransactionEnd

public boolean handleTransactionEnd()
                             throws AnzoException
Description copied from interface: IRepositoryHandler
Handle end of transaction message

Specified by:
handleTransactionEnd in interface IRepositoryHandler
Overrides:
handleTransactionEnd in class HandlerAdapter
Returns:
Message handled successfully
Throws:
AnzoException

handleCommandStart

public boolean handleCommandStart(java.lang.Long id,
                                  java.lang.String commandType,
                                  java.lang.String commandPreconditions)
                           throws AnzoException
Description copied from interface: IRepositoryHandler
Handle start of command message

Specified by:
handleCommandStart in interface IRepositoryHandler
Overrides:
handleCommandStart in class HandlerAdapter
Parameters:
id - Id of command
commandType - Type of command
commandPreconditions - Serialized graph representation of precondition for command
Returns:
Message handled successfully
Throws:
AnzoException

handleCommandStart

public boolean handleCommandStart(java.lang.Long commandId,
                                  java.lang.String commandType,
                                  java.util.Set<IPrecondition> preconditions)
                           throws AnzoException
Handle start of command message

Parameters:
commandId - Id of command
commandType - Type of command
preconditions - set of preconditions for command
Returns:
Message handled successfully
Throws:
AnzoException

handleCommandEnd

public boolean handleCommandEnd()
                         throws AnzoException
Description copied from interface: IRepositoryHandler
Handle end of command message

Specified by:
handleCommandEnd in interface IRepositoryHandler
Overrides:
handleCommandEnd in class HandlerAdapter
Returns:
Message handled successfully
Throws:
AnzoException

handleAci

public boolean handleAci(boolean addition,
                         org.openrdf.model.URI namedGraph,
                         org.openrdf.model.URI acl,
                         org.openrdf.model.URI role,
                         java.lang.Boolean canRead,
                         java.lang.Boolean canUpdate,
                         java.lang.Boolean canDelete,
                         java.lang.Boolean canInsert,
                         java.lang.Boolean canRemove,
                         java.lang.Boolean canChangeAcl)
                  throws AnzoException
Description copied from interface: IRepositoryHandler
Handle ACI message

Specified by:
handleAci in interface IRepositoryHandler
Overrides:
handleAci in class HandlerAdapter
Parameters:
addition - Is this message an addition or deletion
namedGraph - URI of NamedGraph that this ACI belongs
acl - URI of ACL
role - Role that this ACI affects
canRead - Can this role read the graph
canUpdate - Can this role add to the graph
canDelete - Can this role remove from the graph
canInsert - Can this role insert a new NamedGraph
canRemove - Can this role remove a NamedGraph
canChangeAcl - Can this role change the ACL properties
Returns:
Message handled successfully
Throws:
AnzoException

handleAcl

public boolean handleAcl(boolean additions,
                         org.openrdf.model.URI aclNode,
                         boolean isTemplate)
                  throws AnzoException
Description copied from interface: IRepositoryHandler
Handle ACL message

Specified by:
handleAcl in interface IRepositoryHandler
Overrides:
handleAcl in class HandlerAdapter
Parameters:
additions - Is this message an addition or deletion
aclNode - URI of ACL
isTemplate - Is this acl a template
Returns:
Message handled successfully
Throws:
AnzoException

handleNamedGraph

public boolean handleNamedGraph(boolean additions,
                                org.openrdf.model.URI namedGraphUri,
                                org.openrdf.model.URI metadataGraphUri,
                                java.lang.Long revision,
                                org.openrdf.model.URI aclNode,
                                org.openrdf.model.URI createdBy,
                                java.lang.Long modified,
                                org.openrdf.model.URI lastModifiedBy)
                         throws AnzoException
Description copied from interface: IRepositoryHandler
Handle NamedGraph message

Specified by:
handleNamedGraph in interface IRepositoryHandler
Overrides:
handleNamedGraph in class HandlerAdapter
Parameters:
additions - Is this message an addition or deletion
namedGraphUri - URI of NamedGraph
metadataGraphUri - URI of NamedGraph's metadata graph
revision - Revision value of NamedGraph
aclNode - URI of ACL that this NamedGraph uses
createdBy - User that created the NamedGraph
modified - When graph was last modified
lastModifiedBy - Who last modified graph
Returns:
Message handled successfully
Throws:
AnzoException

handleNode

public boolean handleNode(java.lang.Long id,
                          org.openrdf.model.Value node)
Description copied from interface: IRepositoryHandler
Handle Node message

Specified by:
handleNode in interface IRepositoryHandler
Overrides:
handleNode in class HandlerAdapter
Parameters:
id - ID of node
node - Value of node
Returns:
Message handled successfully

handleRole

public boolean handleRole(boolean additions,
                          org.openrdf.model.URI roleNode)
                   throws AnzoException
Description copied from interface: IRepositoryHandler
Handle role message

Specified by:
handleRole in interface IRepositoryHandler
Overrides:
handleRole in class HandlerAdapter
Parameters:
additions - Is this message an addition or deletion
roleNode - Role added or deleted
Returns:
Message handled successfully
Throws:
AnzoException

handleStatement

public boolean handleStatement(boolean additions,
                               org.openrdf.model.URI graphUri,
                               org.openrdf.model.Resource subject,
                               org.openrdf.model.URI predicate,
                               org.openrdf.model.Value object)
                        throws AnzoException
Description copied from interface: IRepositoryHandler
Handle statement message

Specified by:
handleStatement in interface IRepositoryHandler
Overrides:
handleStatement in class HandlerAdapter
Parameters:
additions - Is this a statement addition or deletion
graphUri - URI of NamedGraph that statement belongs to
subject - Subject value
predicate - Predicate value
object - Object value
Returns:
Message handled successfully
Throws:
AnzoException

handleSubRoleOf

public boolean handleSubRoleOf(boolean additions,
                               org.openrdf.model.URI roleNode,
                               org.openrdf.model.URI parentRoleNode)
                        throws AnzoException
Description copied from interface: IRepositoryHandler
Handle Role subrole of another role message

Specified by:
handleSubRoleOf in interface IRepositoryHandler
Overrides:
handleSubRoleOf in class HandlerAdapter
Parameters:
additions - Is this message an addition or deletion
roleNode - Role value
parentRoleNode - Parent role to which role is a subrole
Returns:
Message handled successfully
Throws:
AnzoException

handleUser

public boolean handleUser(boolean additions,
                          org.openrdf.model.URI userNode,
                          org.openrdf.model.URI defaultRoleNode,
                          org.openrdf.model.URI defaultAclNode,
                          java.lang.String userId,
                          java.lang.String password)
                   throws AnzoException
Description copied from interface: IRepositoryHandler
Handle user message

Specified by:
handleUser in interface IRepositoryHandler
Overrides:
handleUser in class HandlerAdapter
Parameters:
additions - Is this message an addition or deletion
userNode - User value
defaultRoleNode - Default role for this user
defaultAclNode - URI for the default ACL template for this user
userId - UserId for this user
password - Password for this user
Returns:
Message handled successfully
Throws:
AnzoException

handleUserInRole

public boolean handleUserInRole(boolean additions,
                                org.openrdf.model.URI userNode,
                                org.openrdf.model.URI roleNode)
                         throws AnzoException
Description copied from interface: IRepositoryHandler
Handle User in Role message

Specified by:
handleUserInRole in interface IRepositoryHandler
Overrides:
handleUserInRole in class HandlerAdapter
Parameters:
additions - Is this message an addition or deletion
userNode - User value
roleNode - Role user is being added to or deleted from
Returns:
Message handled successfully
Throws:
AnzoException

getCurrentTransactionUpdateResults

public TransactionUpdateResults getCurrentTransactionUpdateResults()
Returns:
the currentTransactionUpdateResults

getRepositoryConnection

public RepositoryConnection getRepositoryConnection()
Returns:
the repositoryConnection


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