org.openanzo.serialization
Class XMLNodeWriter

java.lang.Object
  extended by org.openanzo.serialization.XMLNodeWriter
All Implemented Interfaces:
IRepositoryHandler

public class XMLNodeWriter
extends java.lang.Object
implements IRepositoryHandler

Provides XML serialization of transport messages.

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Constructor Summary
XMLNodeWriter(java.io.OutputStream out)
          New XMLNodeWriter that writes to out
 
Method Summary
 boolean handleAci(boolean addition, java.lang.Long namedGraph, java.lang.Long acl, java.lang.Long 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)
          Write ACI data to stream
 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 addition, java.lang.Long acl, boolean isTemplate)
          Write ACL data to stream
 boolean handleAcl(boolean addition, org.openrdf.model.URI acl, boolean isTemplate)
          Handle ACL message
 boolean handleCommandEnd()
          Handle end of command message
 boolean handleCommandStart(java.lang.Long commandId, java.lang.String commandType, java.lang.String commandPreReq)
          Handle start of command message
 boolean handleEndDocument()
          Handle end of document message
 boolean handleError(int errorNumber, int errorSubNumber, java.lang.String... errorMessageArgs)
          Handle an error message
 boolean handleNamedGraph(boolean addition, java.lang.Long graph, java.lang.Long metaGraph, java.lang.Long revision, java.lang.Long aclTemplate, java.lang.Long createdBy, java.lang.Long modified, java.lang.Long lastModifiedBy)
          Write NamedGraph data to stream
 boolean handleNamedGraph(boolean addition, org.openrdf.model.URI graph, org.openrdf.model.URI metaGraph, java.lang.Long revision, org.openrdf.model.URI aclTemplate, 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 value)
          Handle Node message
 boolean handleReset()
          Handle reset message
 boolean handleRole(boolean addition, java.lang.Long role)
          Write Role data to stream
 boolean handleRole(boolean addition, org.openrdf.model.URI role)
          Handle role message
 boolean handleStartDocument()
          Handle start of document message
 boolean handleStatement(boolean addition, java.lang.Long graphId, java.lang.Long subj, java.lang.Long prop, java.lang.Long obj)
          Write statement to outputSream
 boolean handleStatement(boolean addition, org.openrdf.model.URI graphId, org.openrdf.model.Resource subj, org.openrdf.model.URI prop, org.openrdf.model.Value obj)
          Handle statement message
 boolean handleSubRoleOf(boolean addition, java.lang.Long role, java.lang.Long parentRole)
          Write SubRole data to stream
 boolean handleSubRoleOf(boolean addition, org.openrdf.model.URI role, org.openrdf.model.URI parentRole)
          Handle Role subrole of another role message
 boolean handleTransactionEnd()
          Handle end of transaction message
 boolean handleTransactionStart(java.lang.Long transactionId, java.lang.Long transactionTimestamp)
          Handle start of transaction message
 boolean handleUser(boolean addition, java.lang.Long user, java.lang.Long defaultRole, java.lang.Long defaultAclTemplate, java.lang.String userId, java.lang.String password)
          Write statement to outputSream
 boolean handleUser(boolean addition, org.openrdf.model.URI user, org.openrdf.model.URI defaultRole, org.openrdf.model.URI defaultAclTemplate, java.lang.String userId, java.lang.String password)
          Handle user message
 boolean handleUserInRole(boolean addition, java.lang.Long user, java.lang.Long role)
          Write UserInRole data to stream
 boolean handleUserInRole(boolean addition, org.openrdf.model.URI user, org.openrdf.model.URI role)
          Handle User in Role message
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLNodeWriter

public XMLNodeWriter(java.io.OutputStream out)
New XMLNodeWriter that writes to out

Parameters:
out - Stream to which output is written
Method Detail

handleNode

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

Specified by:
handleNode in interface IRepositoryHandler
Parameters:
id - ID of node
value - Value of node
Returns:
Message handled successfully
Throws:
AnzoException

handleStartDocument

public boolean handleStartDocument()
                            throws AnzoException
Description copied from interface: IRepositoryHandler
Handle start of document message

Specified by:
handleStartDocument in interface IRepositoryHandler
Returns:
Message handled successfully
Throws:
AnzoException

handleEndDocument

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

Specified by:
handleEndDocument in interface IRepositoryHandler
Returns:
Message handled successfully
Throws:
AnzoException

handleTransactionStart

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

Specified by:
handleTransactionStart in interface IRepositoryHandler
Parameters:
transactionId - Id of transaction
transactionTimestamp - 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
Returns:
Message handled successfully
Throws:
AnzoException

handleCommandStart

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

Specified by:
handleCommandStart in interface IRepositoryHandler
Parameters:
commandId - Id of command
commandType - Type of command
commandPreReq - Serialized graph representation of precondition 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
Returns:
Message handled successfully
Throws:
AnzoException

handleStatement

public boolean handleStatement(boolean addition,
                               org.openrdf.model.URI graphId,
                               org.openrdf.model.Resource subj,
                               org.openrdf.model.URI prop,
                               org.openrdf.model.Value obj)
                        throws AnzoException
Description copied from interface: IRepositoryHandler
Handle statement message

Specified by:
handleStatement in interface IRepositoryHandler
Parameters:
addition - Is this a statement addition or deletion
graphId - URI of NamedGraph that statement belongs to
subj - Subject value
prop - Predicate value
obj - Object value
Returns:
Message handled successfully
Throws:
AnzoException

handleStatement

public boolean handleStatement(boolean addition,
                               java.lang.Long graphId,
                               java.lang.Long subj,
                               java.lang.Long prop,
                               java.lang.Long obj)
                        throws AnzoException
Write statement to outputSream

Parameters:
addition - flags if this is an addition or deletion
graphId - id of NamedGraph
subj - id of subject
prop - id of property
obj - id of object
Returns:
true if statement handled ok
Throws:
AnzoException - if there was an error writing statement to stream

handleUser

public boolean handleUser(boolean addition,
                          org.openrdf.model.URI user,
                          org.openrdf.model.URI defaultRole,
                          org.openrdf.model.URI defaultAclTemplate,
                          java.lang.String userId,
                          java.lang.String password)
                   throws AnzoException
Description copied from interface: IRepositoryHandler
Handle user message

Specified by:
handleUser in interface IRepositoryHandler
Parameters:
addition - Is this message an addition or deletion
user - User value
defaultRole - Default role for this user
defaultAclTemplate - 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

handleUser

public boolean handleUser(boolean addition,
                          java.lang.Long user,
                          java.lang.Long defaultRole,
                          java.lang.Long defaultAclTemplate,
                          java.lang.String userId,
                          java.lang.String password)
                   throws AnzoException
Write statement to outputSream

Parameters:
addition - flags if this is an addition or deletion
user - id of user
defaultRole - id of defaultRole
defaultAclTemplate - id of defaultAclTemplate
userId - of user
password - of user
Returns:
true if user handled ok
Throws:
AnzoException - if there was an error writing user to stream

handleUserInRole

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

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

handleUserInRole

public boolean handleUserInRole(boolean addition,
                                java.lang.Long user,
                                java.lang.Long role)
                         throws AnzoException
Write UserInRole data to stream

Parameters:
addition - flags if this is an addition or deletion
user - id of user
role - id of role
Returns:
true if handled successfully
Throws:
AnzoException - if there was an error writing data to stream

handleRole

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

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

handleRole

public boolean handleRole(boolean addition,
                          java.lang.Long role)
                   throws AnzoException
Write Role data to stream

Parameters:
addition - flags if this is an addition or deletion
role - id of role
Returns:
true if handled successfully
Throws:
AnzoException - if there was an error writing data to stream

handleSubRoleOf

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

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

handleSubRoleOf

public boolean handleSubRoleOf(boolean addition,
                               java.lang.Long role,
                               java.lang.Long parentRole)
                        throws AnzoException
Write SubRole data to stream

Parameters:
addition - flags if this is an addition or deletion
role - id of role
parentRole - if of parentRole
Returns:
true if handled successfully
Throws:
AnzoException - if there was an error writing data to stream

handleNamedGraph

public boolean handleNamedGraph(boolean addition,
                                org.openrdf.model.URI graph,
                                org.openrdf.model.URI metaGraph,
                                java.lang.Long revision,
                                org.openrdf.model.URI aclTemplate,
                                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
Parameters:
addition - Is this message an addition or deletion
graph - URI of NamedGraph
metaGraph - URI of NamedGraph's metadata graph
revision - Revision value of NamedGraph
aclTemplate - 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

handleNamedGraph

public boolean handleNamedGraph(boolean addition,
                                java.lang.Long graph,
                                java.lang.Long metaGraph,
                                java.lang.Long revision,
                                java.lang.Long aclTemplate,
                                java.lang.Long createdBy,
                                java.lang.Long modified,
                                java.lang.Long lastModifiedBy)
                         throws AnzoException
Write NamedGraph data to stream

Parameters:
addition - flags if this is an addition or deletion
graph - id of graph
metaGraph - id of metadata graph
revision - revision of NamedGraph
aclTemplate - id of aclTemplate
createdBy - if of user that created graph
modified - timestamp when graph was modified
lastModifiedBy - id of user that last modified graph
Returns:
true if handled successfully
Throws:
AnzoException - if there was an error writing data to stream

handleAcl

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

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

handleAcl

public boolean handleAcl(boolean addition,
                         java.lang.Long acl,
                         boolean isTemplate)
                  throws AnzoException
Write ACL data to stream

Parameters:
addition - flags if this is an addition or deletion
acl - id of acl
isTemplate - flags if this is a template ACL
Returns:
true if handled successfully
Throws:
AnzoException - if there was an error writing data to stream

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
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

handleAci

public boolean handleAci(boolean addition,
                         java.lang.Long namedGraph,
                         java.lang.Long acl,
                         java.lang.Long 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
Write ACI data to stream

Parameters:
addition - flags if this is an addition or deletion
namedGraph - id of graph
acl - id of ACL
role - id of role
canRead - true if canRead
canUpdate - true if canUpdate
canDelete - true if canDelete
canInsert - true if canInsert
canRemove - true if canRemove
canChangeAcl - true if canChangeAcl
Returns:
true if handled successfully
Throws:
AnzoException - if there was an error writing data to stream

handleError

public boolean handleError(int errorNumber,
                           int errorSubNumber,
                           java.lang.String... errorMessageArgs)
                    throws AnzoException
Description copied from interface: IRepositoryHandler
Handle an error message

Specified by:
handleError in interface IRepositoryHandler
Parameters:
errorNumber - Major error code
errorSubNumber - Minor error code
errorMessageArgs - Arguments to error message
Returns:
Message handled successfully
Throws:
AnzoException

handleReset

public boolean handleReset()
Description copied from interface: IRepositoryHandler
Handle reset message

Specified by:
handleReset in interface IRepositoryHandler
Returns:
Message handled successfully


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