org.openanzo.server.repository
Class ModelServiceApi

java.lang.Object
  extended by org.openanzo.server.repository.ModelServiceApi
All Implemented Interfaces:
IServerService, IServerServiceMBean, ModelServiceApiMBean

public class ModelServiceApi
extends java.lang.Object
implements ModelServiceApiMBean, IServerService

API for the Model Service, which is intended to be wrapped by a Web Service or other transport and run as a server. The Model Service provides 'query' and 'update' (insert, update and delete) methods to the repository, a 'reset' method which clears the repository then populates it with the RDF passed to it and a 'replicate' method which returns the changes (deltas) to repository data since a user last replicated.

Author:
Joe Betz, Matthew Roy ( mroy@cambridgesemantics.com )

Field Summary
static java.lang.String HASH_ALGORITHM
          Hashing algorithm for passwords
 
Constructor Summary
ModelServiceApi(java.util.Properties properties)
          Create a new ModelServiceApi with given configuration properties
 
Method Summary
 void addInferredObject(java.lang.Long authenticatedUserId, org.openrdf.model.URI prop, org.openrdf.model.URI object, org.openrdf.model.URI inferredObject)
          Add an inferred object
 void addInferredObject(java.lang.String username, java.lang.String password, org.openrdf.model.URI prop, org.openrdf.model.URI object, org.openrdf.model.URI inferredObject)
          Add an inferred object
 void addInferredProperty(java.lang.Long authenticatedUserId, org.openrdf.model.URI prop, org.openrdf.model.URI inferredProperty)
          Add an inferred property
 void addInferredProperty(java.lang.String username, java.lang.String password, org.openrdf.model.URI prop, org.openrdf.model.URI inferredProperty)
          Add an inferred property
 java.lang.Long authenticate(java.lang.String username, java.lang.String password)
          Authenticate the username and password, and return user's ID
 java.lang.Long authenticate(java.lang.String username, java.lang.String password, RepositoryConnection connection)
          Authenticate the username and password, and return user's ID
 org.openrdf.model.URI authenticateUser(java.lang.Long authenticatedUserId, java.lang.String userName, java.lang.String password)
          Authenticate a username and password with server
 org.openrdf.model.URI authenticateUser(java.lang.String systemUser, java.lang.String systemPassword, java.lang.String userName, java.lang.String password)
          Authenticate a username and password with server
 void clearUserCacheForUser(java.lang.String username)
          Clear cache about given user's password and membership in admins
 void close()
          Close the service
 java.util.Collection<org.openrdf.model.Statement> findStatements(java.lang.Long authenticatedUserId, org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj, org.openrdf.model.Resource context, boolean inference)
          Find the set of statements that match the statement pattern
 void findStatements(java.lang.String username, java.lang.String password, org.openrdf.model.Resource subj, org.openrdf.model.URI pred, org.openrdf.model.Value obj, org.openrdf.model.Resource context, java.io.OutputStream outputStream, boolean inference)
          Find the set of statements that match the statement pattern
 IAuthenticationProvider getAuthenticationProvider()
          Get the authenticationProvider
 boolean getIsStarted()
          Determine if the service is started
 org.openrdf.model.URI getMetadataGraphUri(java.lang.Long authenticatedUserId, org.openrdf.model.URI namedGraphUri)
          Get the URI of the graph's metadata graph
 org.openrdf.model.URI getMetadataGraphUri(java.lang.String username, java.lang.String password, org.openrdf.model.URI namedGraphUri)
          Get the URI of the graph's metadata graph
 INamedGraphWithMetaData getNamedGraphRevision(java.lang.Long authenticatedUserId, org.openrdf.model.URI namedGraphUri, long revision)
          Get the contents of a NamedGraph at a given revision
 boolean getNamedGraphRevision(java.lang.String username, java.lang.String password, org.openrdf.model.URI namedGraphUri, long revision, java.io.OutputStream resultStream)
          Get the contents of a NamedGraph at a given revision
 long getNumberOfStoredNamedGraphs()
          Get the number of stored graphs in the repository
 long getNumberOfStoredStatements()
          Get the number of stored statements in the repository
 RepositoryConnectionPool getRepositoryConnectionPool()
          Get the ContainerConnectionPool for this ModelServiceApi
 boolean getResetDatabaseEnabled()
          Get if the server allows resets
 java.util.concurrent.locks.ReadWriteLock getResetLock()
          Get the resetLock
 java.util.Set<org.openrdf.model.URI> getRolesForGraph(java.lang.Long authenticatedUserId, org.openrdf.model.URI namedGraphUri)
          Get the set of roles that have permission to read the statements in this graph.
 java.util.Set<org.openrdf.model.URI> getRolesForGraph(java.lang.String username, java.lang.String password, org.openrdf.model.URI namedGraphUri)
          Get the set of roles that have permission to read the statements in this graph.
 java.util.Set<org.openrdf.model.URI> getRolesForUser(java.lang.Long authenticatedUserId, org.openrdf.model.URI userId)
          Get the set of roles to which a user belongs.
 java.util.Set<org.openrdf.model.URI> getRolesForUser(java.lang.String username, java.lang.String password, org.openrdf.model.URI userId)
          Get the set of roles to which a user belongs.
 org.openrdf.model.URI getServerURI()
          Get the URI for the server
 java.lang.String getServerURIString()
          Get the server's URI
 long getSize(java.lang.Long authenticatedUserId, org.openrdf.model.URI namedGraphUri)
          Return the number of triples in graph
 long getSize(java.lang.String username, java.lang.String password, org.openrdf.model.URI namedGraphUri)
          Return the number of statements in the graph
 java.lang.String[] getStoredNamedGraphs()
          Get the set of stored named graphs
 java.util.Set<org.openrdf.model.URI> getStoredNamedGraphs(java.lang.Long authenticatedUserId)
          Get the set of NamedGraphs stored on the server that the user has permission to see
 java.util.Set<org.openrdf.model.URI> getStoredNamedGraphs(java.lang.String username, java.lang.String password)
          Get the set of NamedGraphs stored on the server that the user has permission to see
 boolean getUseHardReset()
          Get if the server uses hard resets to clear database tables
 org.openrdf.model.URI getUserId(java.lang.String username)
          Get the user's URI in the system
 org.openrdf.model.URI getUserId(java.lang.String username, RepositoryConnection connection)
          Get the user's URI in the system
 java.util.Set<org.openrdf.model.URI> getUsersForGraph(java.lang.Long authenticatedUserId, org.openrdf.model.URI namedGraphUri)
          Get a set of users that have permission to read the statements in this graph Note:Only users in the sysAdmin role can call this method
 java.util.Set<org.openrdf.model.URI> getUsersForGraph(java.lang.String username, java.lang.String password, org.openrdf.model.URI namedGraphUri)
          Get a set of users that have permission to read the statements in this graph Note:Only users in the sysAdmin role can call this method
 org.openrdf.model.URI getUserUri(java.lang.Long authenticatedUserId, java.lang.String userId)
          Get the URI for the given userId
 org.openrdf.model.URI getUserUri(java.lang.String systemUser, java.lang.String systemPassword, java.lang.String userId)
          Get the URI for the given userId
 boolean isSystemUser(java.lang.Long authenticatedUserId, RepositoryConnection repositoryConnection)
          Is the given user a member of the sysAdmin role
 boolean isSystemUser(org.openrdf.model.URI userId, RepositoryConnection repositoryConnection)
          Is the given user a member of the sysAdmin role
 QueryResult query(java.lang.Long authenticatedUserId, java.util.Set<org.openrdf.model.URI> defaultNamedGraphs, java.util.Set<org.openrdf.model.URI> graphs, java.lang.String queryString, org.openrdf.model.URI baseUri)
          Run query on server
 int query(java.lang.String username, java.lang.String password, java.util.Set<org.openrdf.model.URI> defaultNamedGraphs, java.util.Set<org.openrdf.model.URI> graphs, java.lang.String queryString, org.openrdf.model.URI baseUri, java.io.OutputStream outputStream)
          Run query on server
 java.util.Collection<org.openrdf.model.Statement> queryIndex(java.lang.Long authenticatedUserId, java.lang.String queryString, int startIndex, int numResults)
          Run a query on the text indexer
 java.util.Collection<org.openrdf.model.Statement> queryIndex(java.lang.String username, java.lang.String password, java.lang.String queryString, int startIndex, int numResults)
          Run a query on the text indexer
 void registerMBean(javax.management.MBeanServer mbServer, javax.management.ObjectName parentObjectName)
          Register the service with the server's jmx server
 java.lang.Long replicate(java.lang.Long authenticatedUserId, java.util.Set<ITracker> trackers, java.util.Set<ITracker> newTrackers, java.lang.Long marker, IRepositoryHandler handler)
          For a given set of selector trackers serialized in RDF, finds statements that have been added and deleted since the time specified by the given marker and sends the additions and deletions to the IBocaHandler and returns the timestamp of the last transaction included in this replication
 java.lang.Long replicate(java.lang.String username, java.lang.String password, java.util.Set<ITracker> trackers, java.util.Set<ITracker> newTrackers, java.lang.Long marker, java.io.OutputStream resultStream)
          For a given set of selector trackers serialized in RDF, finds statements that have been added and deleted since the time specified by the given marker and writes the additions and deletions to outputstream and the timestamp of the last transaction included in this replication
 void reset(java.lang.Long authenticatedUserId, java.util.Collection<org.openrdf.model.Statement> statements)
          Removes all existing RDF from the repository and replaces it with the RDF in the graph
 void reset(java.lang.String username, java.lang.String password, java.io.InputStream stream)
          Removes all existing RDF from the repository and replaces it with the RDF in the stream.
 void resetDatabase()
          Removes all existing RDF from the repository and replaces it with the default data
 java.lang.Long runAsUser(org.openrdf.model.URI username, java.lang.Long serviceId, RepositoryConnection repositoryConnection)
          Run server operations as a given user.
 void setResetDatabaseEnabled(boolean resetEnabled)
          Set whether the server allows resets
 void setUseHardReset(boolean hardReset)
          Set whether or not the server uses hard resets to clear database tables
 void start()
          Start the service
 void stop()
          Stop the service
 UpdateResults update(java.lang.Long authenticatedUserId, ITransaction[] transactions)
          Update the server with changes
 UpdateResults update(java.lang.String username, java.lang.String password, java.io.InputStream stream, boolean returnResults, java.io.OutputStream outputStream)
          Update the server with changes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HASH_ALGORITHM

public static final java.lang.String HASH_ALGORITHM
Hashing algorithm for passwords

See Also:
Constant Field Values
Constructor Detail

ModelServiceApi

public ModelServiceApi(java.util.Properties properties)
                throws AnzoException
Create a new ModelServiceApi with given configuration properties

Parameters:
properties - Configuration properties
Throws:
AnzoException
Method Detail

registerMBean

public void registerMBean(javax.management.MBeanServer mbServer,
                          javax.management.ObjectName parentObjectName)
Description copied from interface: IServerService
Register the service with the server's jmx server

Specified by:
registerMBean in interface IServerService
Parameters:
mbServer - the jmx server
parentObjectName - the name under which this object will be registered

start

public void start()
Description copied from interface: IServerService
Start the service

Specified by:
start in interface IServerService
Specified by:
start in interface IServerServiceMBean

stop

public void stop()
Description copied from interface: IServerService
Stop the service

Specified by:
stop in interface IServerService
Specified by:
stop in interface IServerServiceMBean

close

public void close()
           throws AnzoException
Description copied from interface: IServerService
Close the service

Specified by:
close in interface IServerService
Throws:
AnzoException

getIsStarted

public boolean getIsStarted()
                     throws AnzoException
Description copied from interface: IServerService
Determine if the service is started

Specified by:
getIsStarted in interface IServerService
Specified by:
getIsStarted in interface IServerServiceMBean
Returns:
true if the service is started
Throws:
AnzoException

reset

public void reset(java.lang.String username,
                  java.lang.String password,
                  java.io.InputStream stream)
           throws AnzoException
Removes all existing RDF from the repository and replaces it with the RDF in the stream.

Parameters:
username - Username of user trying to execute reset
password - Password of user trying to execute reset
stream - Stream containing new system graph contents
Throws:
AnzoException
AnzoException

reset

public void reset(java.lang.Long authenticatedUserId,
                  java.util.Collection<org.openrdf.model.Statement> statements)
           throws AnzoException
Removes all existing RDF from the repository and replaces it with the RDF in the graph

Parameters:
authenticatedUserId - ID of authenticated user
statements - New contents for system graph
Throws:
AnzoException
AnzoException

resetDatabase

public void resetDatabase()
Removes all existing RDF from the repository and replaces it with the default data

Specified by:
resetDatabase in interface ModelServiceApiMBean

getSize

public long getSize(java.lang.Long authenticatedUserId,
                    org.openrdf.model.URI namedGraphUri)
             throws AnzoException
Return the number of triples in graph

Parameters:
authenticatedUserId - id of authenticated user for this session
namedGraphUri - URI of namedgraph
Returns:
Number of statements in namedgraph
Throws:
AnzoException

getSize

public long getSize(java.lang.String username,
                    java.lang.String password,
                    org.openrdf.model.URI namedGraphUri)
             throws AnzoException
Return the number of statements in the graph

Parameters:
username - User for this session
password - Password for this session
namedGraphUri - URI of namedgraph
Returns:
Number of statements in the namedgraph
Throws:
AnzoException

getUsersForGraph

public java.util.Set<org.openrdf.model.URI> getUsersForGraph(java.lang.String username,
                                                             java.lang.String password,
                                                             org.openrdf.model.URI namedGraphUri)
                                                      throws AnzoException
Get a set of users that have permission to read the statements in this graph Note:Only users in the sysAdmin role can call this method

Parameters:
username - User for this session
password - Password for this session
namedGraphUri - URI of namedgraph
Returns:
the set of users that have permissions for the given graph
Throws:
AnzoException

getUsersForGraph

public java.util.Set<org.openrdf.model.URI> getUsersForGraph(java.lang.Long authenticatedUserId,
                                                             org.openrdf.model.URI namedGraphUri)
                                                      throws AnzoException
Get a set of users that have permission to read the statements in this graph Note:Only users in the sysAdmin role can call this method

Parameters:
authenticatedUserId - Userid of authenticated user for this session
namedGraphUri - URI of namedgraph
Returns:
the set of users that have permissions for the given graph
Throws:
AnzoException

getRolesForUser

public java.util.Set<org.openrdf.model.URI> getRolesForUser(java.lang.String username,
                                                            java.lang.String password,
                                                            org.openrdf.model.URI userId)
                                                     throws AnzoException
Get the set of roles to which a user belongs. Note:Only users in the sysAdmin role can call this method

Parameters:
username - User for this session
password - Password for this session
userId - URI of user
Returns:
the set of roles for the given user
Throws:
AnzoException

getRolesForUser

public java.util.Set<org.openrdf.model.URI> getRolesForUser(java.lang.Long authenticatedUserId,
                                                            org.openrdf.model.URI userId)
                                                     throws AnzoException
Get the set of roles to which a user belongs. Note:Only users in the sysAdmin role can call this method

Parameters:
authenticatedUserId - Userid of authenticated user for this session
userId - URI of user
Returns:
the set of roles for the given user
Throws:
AnzoException

getRolesForGraph

public java.util.Set<org.openrdf.model.URI> getRolesForGraph(java.lang.String username,
                                                             java.lang.String password,
                                                             org.openrdf.model.URI namedGraphUri)
                                                      throws AnzoException
Get the set of roles that have permission to read the statements in this graph. Note:Only users in the sysAdmin role can call this method

Parameters:
username - User for this session
password - Password for this session
namedGraphUri - URI of namedgraph
Returns:
the set of roles for the given graph
Throws:
AnzoException

getRolesForGraph

public java.util.Set<org.openrdf.model.URI> getRolesForGraph(java.lang.Long authenticatedUserId,
                                                             org.openrdf.model.URI namedGraphUri)
                                                      throws AnzoException
Get the set of roles that have permission to read the statements in this graph. Note:Only users in the sysAdmin role can call this method

Parameters:
authenticatedUserId - Userid of authenticated user for this session
namedGraphUri - URI of NamedGraph
Returns:
the set of roles for the given graph
Throws:
AnzoException

authenticateUser

public org.openrdf.model.URI authenticateUser(java.lang.String systemUser,
                                              java.lang.String systemPassword,
                                              java.lang.String userName,
                                              java.lang.String password)
                                       throws AnzoException
Authenticate a username and password with server

Parameters:
systemUser - Username of user running authentication call
systemPassword - Password of user running authentication call
userName - Username to authenticate
password - Password to authenticate
Returns:
the URI of the authenticated user
Throws:
AnzoException

authenticateUser

public org.openrdf.model.URI authenticateUser(java.lang.Long authenticatedUserId,
                                              java.lang.String userName,
                                              java.lang.String password)
                                       throws AnzoException
Authenticate a username and password with server

Parameters:
authenticatedUserId - Userid of authenticated user for this session
userName - Username to authenticate
password - Password to authenticate
Returns:
the URI of the authenticated user
Throws:
AnzoException

getUserUri

public org.openrdf.model.URI getUserUri(java.lang.String systemUser,
                                        java.lang.String systemPassword,
                                        java.lang.String userId)
                                 throws AnzoException
Get the URI for the given userId

Parameters:
systemUser - Username of user running authentication call
systemPassword - Password of user running authentication call
userId - userId to find
Returns:
the URI for the given userId
Throws:
AnzoException

getUserUri

public org.openrdf.model.URI getUserUri(java.lang.Long authenticatedUserId,
                                        java.lang.String userId)
                                 throws AnzoException
Get the URI for the given userId

Parameters:
authenticatedUserId - Userid of authenticated user for this session
userId - userId to find
Returns:
the URI for the given userId
Throws:
AnzoException

getStoredNamedGraphs

public java.util.Set<org.openrdf.model.URI> getStoredNamedGraphs(java.lang.String username,
                                                                 java.lang.String password)
                                                          throws AnzoException
Get the set of NamedGraphs stored on the server that the user has permission to see

Parameters:
username - User for this session
password - Password for this session
Returns:
the set of NamedGraphs stored on the server that the user has permission to see
Throws:
AnzoException

getStoredNamedGraphs

public java.util.Set<org.openrdf.model.URI> getStoredNamedGraphs(java.lang.Long authenticatedUserId)
                                                          throws AnzoException
Get the set of NamedGraphs stored on the server that the user has permission to see

Parameters:
authenticatedUserId - Userid of authenticated user for this session
Returns:
the set of NamedGraphs stored on the server that the user has permission to see
Throws:
AnzoException

getMetadataGraphUri

public org.openrdf.model.URI getMetadataGraphUri(java.lang.Long authenticatedUserId,
                                                 org.openrdf.model.URI namedGraphUri)
                                          throws AnzoException
Get the URI of the graph's metadata graph

Parameters:
authenticatedUserId - Userid of authenticated user for this session
namedGraphUri - URI of namedgraph
Returns:
the URI of the graph's metadata graph
Throws:
AnzoException

getMetadataGraphUri

public org.openrdf.model.URI getMetadataGraphUri(java.lang.String username,
                                                 java.lang.String password,
                                                 org.openrdf.model.URI namedGraphUri)
                                          throws AnzoException
Get the URI of the graph's metadata graph

Parameters:
username - User for this session
password - Password for this session
namedGraphUri - URI of namedgraph
Returns:
the URI of the graph's metadata graph
Throws:
AnzoException

update

public UpdateResults update(java.lang.String username,
                            java.lang.String password,
                            java.io.InputStream stream,
                            boolean returnResults,
                            java.io.OutputStream outputStream)
                     throws AnzoException
Update the server with changes

Parameters:
username - User for this session
password - Password for this session
stream - Stream containing changes
returnResults - Return results of update to caller
outputStream - Outputstream to which results are written
Returns:
the results of updating the server
Throws:
AnzoException

update

public UpdateResults update(java.lang.Long authenticatedUserId,
                            ITransaction[] transactions)
                     throws AnzoException
Update the server with changes

Parameters:
authenticatedUserId - Userid of authenticated user for this session
transactions - Set of ITransactions to commit on server
Returns:
the results of updating the server
Throws:
AnzoException

findStatements

public java.util.Collection<org.openrdf.model.Statement> findStatements(java.lang.Long authenticatedUserId,
                                                                        org.openrdf.model.Resource subj,
                                                                        org.openrdf.model.URI pred,
                                                                        org.openrdf.model.Value obj,
                                                                        org.openrdf.model.Resource context,
                                                                        boolean inference)
                                                                 throws AnzoException
Find the set of statements that match the statement pattern

Parameters:
authenticatedUserId - Userid of authenticated user for this session
subj - Subject resource to match, or wildcard if null
pred - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
context - Context values to match, or wildcard if null
inference - should results include inferred statements
Returns:
the set of statements that match the statement pattern
Throws:
AnzoException

findStatements

public void findStatements(java.lang.String username,
                           java.lang.String password,
                           org.openrdf.model.Resource subj,
                           org.openrdf.model.URI pred,
                           org.openrdf.model.Value obj,
                           org.openrdf.model.Resource context,
                           java.io.OutputStream outputStream,
                           boolean inference)
                    throws AnzoException
Find the set of statements that match the statement pattern

Parameters:
username - User for this session
password - Password for this session
subj - Subject resource to match, or wildcard if null
pred - Predicate uri to match, or wildcard if null
obj - Object value to match, or wildcard if null
context - Context values to match, or wildcard if null
outputStream - outputStream to which results are written
inference - should results include inferred statements *
Throws:
AnzoException

query

public int query(java.lang.String username,
                 java.lang.String password,
                 java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
                 java.util.Set<org.openrdf.model.URI> graphs,
                 java.lang.String queryString,
                 org.openrdf.model.URI baseUri,
                 java.io.OutputStream outputStream)
          throws AnzoException
Run query on server

Parameters:
username - User for this session
password - Password for this session
defaultNamedGraphs - Set of NamedGraph URIs that make up the dataset's default set
graphs - Set of NamedGraph URIs that make up dataset's NamedGraph set
queryString - Query string to execute
baseUri - Base URI for resolving relative URIs in the query. May be null.
outputStream - outputStream to which results are written
Returns:
the type of query results
Throws:
AnzoException

query

public QueryResult query(java.lang.Long authenticatedUserId,
                         java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
                         java.util.Set<org.openrdf.model.URI> graphs,
                         java.lang.String queryString,
                         org.openrdf.model.URI baseUri)
                  throws AnzoException
Run query on server

Parameters:
authenticatedUserId - Userid of authenticated user for this session
defaultNamedGraphs - Set of NamedGraph URIs that make up the dataset's default set
graphs - Set of NamedGraph URIs that make up dataset's NamedGraph set
queryString - Query string to execute
baseUri - Base URI for resolving relative URIs in the query. May be null.
Returns:
results of query
Throws:
AnzoException

replicate

public java.lang.Long replicate(java.lang.String username,
                                java.lang.String password,
                                java.util.Set<ITracker> trackers,
                                java.util.Set<ITracker> newTrackers,
                                java.lang.Long marker,
                                java.io.OutputStream resultStream)
                         throws AnzoException
For a given set of selector trackers serialized in RDF, finds statements that have been added and deleted since the time specified by the given marker and writes the additions and deletions to outputstream and the timestamp of the last transaction included in this replication

Parameters:
username - User for this session
password - Password for this session
trackers - Set of existing selector trackers.
newTrackers - Set of new selector trackers.
marker - Time of last replication
resultStream - OutputStream to which results are written
Returns:
The timestamp of the last transaction included in this replication
Throws:
AnzoException

replicate

public java.lang.Long replicate(java.lang.Long authenticatedUserId,
                                java.util.Set<ITracker> trackers,
                                java.util.Set<ITracker> newTrackers,
                                java.lang.Long marker,
                                IRepositoryHandler handler)
                         throws AnzoException
For a given set of selector trackers serialized in RDF, finds statements that have been added and deleted since the time specified by the given marker and sends the additions and deletions to the IBocaHandler and returns the timestamp of the last transaction included in this replication

Parameters:
authenticatedUserId - Userid of authenticated user for this session
trackers - Set of existing selector trackers.
newTrackers - Set of new selector trackers.
marker - Time of last replication
handler - IBocaHandler to handle results of replication
Returns:
The timestamp of the last transaction included in this replication
Throws:
AnzoException

queryIndex

public java.util.Collection<org.openrdf.model.Statement> queryIndex(java.lang.String username,
                                                                    java.lang.String password,
                                                                    java.lang.String queryString,
                                                                    int startIndex,
                                                                    int numResults)
                                                             throws AnzoException
Run a query on the text indexer

Parameters:
username - User for this session
password - Password for this session
queryString - String containing query text
startIndex - offset into query results to return
numResults - the number of query results to return
Returns:
the results of running a query on the text indexer
Throws:
AnzoException

queryIndex

public java.util.Collection<org.openrdf.model.Statement> queryIndex(java.lang.Long authenticatedUserId,
                                                                    java.lang.String queryString,
                                                                    int startIndex,
                                                                    int numResults)
                                                             throws AnzoException
Run a query on the text indexer

Parameters:
authenticatedUserId - Userid of authenticated user for this session
queryString - String containing query text
startIndex - offset into query results to return
numResults - the number of query results to return
Returns:
the results of running a query on the text indexer
Throws:
AnzoException

authenticate

public java.lang.Long authenticate(java.lang.String username,
                                   java.lang.String password)
Authenticate the username and password, and return user's ID

Parameters:
username - User for this session
password - Password for this session
Returns:
User's id

authenticate

public java.lang.Long authenticate(java.lang.String username,
                                   java.lang.String password,
                                   RepositoryConnection connection)
Authenticate the username and password, and return user's ID

Parameters:
username - User for this session
password - Password for this session
connection - RepositoryConnection to run query against
Returns:
User's id

getUserId

public org.openrdf.model.URI getUserId(java.lang.String username)
Get the user's URI in the system

Parameters:
username - The user's ID
Returns:
User's URI

getUserId

public org.openrdf.model.URI getUserId(java.lang.String username,
                                       RepositoryConnection connection)
Get the user's URI in the system

Parameters:
username - The user's ID
connection - RepositoryConnection to run query against
Returns:
User's URI

runAsUser

public java.lang.Long runAsUser(org.openrdf.model.URI username,
                                java.lang.Long serviceId,
                                RepositoryConnection repositoryConnection)
                         throws AnzoException
Run server operations as a given user. Note: Only users in sysAdmin role can runAs another user

Parameters:
username - User to run service as
serviceId - userid of the authenticated user for this session
repositoryConnection - RepositoryConnection to run queries against
Returns:
the ID
Throws:
AnzoException

isSystemUser

public boolean isSystemUser(org.openrdf.model.URI userId,
                            RepositoryConnection repositoryConnection)
                     throws AnzoException
Is the given user a member of the sysAdmin role

Parameters:
userId - User to verify membership in sysadmin role
repositoryConnection - RepositoryConnection to run queries against
Returns:
true if the given user is in the syadmin role
Throws:
AnzoException

isSystemUser

public boolean isSystemUser(java.lang.Long authenticatedUserId,
                            RepositoryConnection repositoryConnection)
                     throws AnzoException
Is the given user a member of the sysAdmin role

Parameters:
authenticatedUserId - verify the ids membership in sysadmin role
repositoryConnection - RepositoryConnection to run queries against
Returns:
true if the given user is in the syadmin role
Throws:
AnzoException

getNamedGraphRevision

public INamedGraphWithMetaData getNamedGraphRevision(java.lang.Long authenticatedUserId,
                                                     org.openrdf.model.URI namedGraphUri,
                                                     long revision)
                                              throws AnzoException
Get the contents of a NamedGraph at a given revision

Parameters:
authenticatedUserId - userId of authenticated user for this session
namedGraphUri - URI of namedgraphNode
revision - Revision of NamedGraph to retrieve
Returns:
the contents of a NamedGraph at a given revision
Throws:
AnzoException

getNamedGraphRevision

public boolean getNamedGraphRevision(java.lang.String username,
                                     java.lang.String password,
                                     org.openrdf.model.URI namedGraphUri,
                                     long revision,
                                     java.io.OutputStream resultStream)
                              throws AnzoException
Get the contents of a NamedGraph at a given revision

Parameters:
username - User for this session
password - Password for this session
namedGraphUri - URI of namedgraph
revision - Revision of NamedGraph to retrieve
resultStream - Outputstream to which results are written
Returns:
true
Throws:
AnzoException

addInferredObject

public void addInferredObject(java.lang.Long authenticatedUserId,
                              org.openrdf.model.URI prop,
                              org.openrdf.model.URI object,
                              org.openrdf.model.URI inferredObject)
                       throws AnzoException
Add an inferred object

Parameters:
authenticatedUserId - authenticated user id
prop - property to add
object - object to add
inferredObject - inferred object to add
Throws:
AnzoException

addInferredObject

public void addInferredObject(java.lang.String username,
                              java.lang.String password,
                              org.openrdf.model.URI prop,
                              org.openrdf.model.URI object,
                              org.openrdf.model.URI inferredObject)
                       throws AnzoException
Add an inferred object

Parameters:
username - User for this session
password - Password for this session
prop - property to add
object - object to add
inferredObject - inferred object to add
Throws:
AnzoException

addInferredProperty

public void addInferredProperty(java.lang.Long authenticatedUserId,
                                org.openrdf.model.URI prop,
                                org.openrdf.model.URI inferredProperty)
                         throws AnzoException
Add an inferred property

Parameters:
authenticatedUserId - authenticated user id
prop - property to add
inferredProperty - inferred property to add
Throws:
AnzoException

addInferredProperty

public void addInferredProperty(java.lang.String username,
                                java.lang.String password,
                                org.openrdf.model.URI prop,
                                org.openrdf.model.URI inferredProperty)
                         throws AnzoException
Add an inferred property

Parameters:
username - User for this session
password - Password for this session
prop - property to add
inferredProperty - inferred property to add
Throws:
AnzoException

getRepositoryConnectionPool

public RepositoryConnectionPool getRepositoryConnectionPool()
Get the ContainerConnectionPool for this ModelServiceApi

Returns:
the ContainerConnectionPool for this ModelServiceApi

clearUserCacheForUser

public void clearUserCacheForUser(java.lang.String username)
Clear cache about given user's password and membership in admins

Parameters:
username - User for this session

getStoredNamedGraphs

public java.lang.String[] getStoredNamedGraphs()
Description copied from interface: ModelServiceApiMBean
Get the set of stored named graphs

Specified by:
getStoredNamedGraphs in interface ModelServiceApiMBean
Returns:
the set of stored named graphs

getNumberOfStoredNamedGraphs

public long getNumberOfStoredNamedGraphs()
Description copied from interface: ModelServiceApiMBean
Get the number of stored graphs in the repository

Specified by:
getNumberOfStoredNamedGraphs in interface ModelServiceApiMBean
Returns:
the number of stored graphs in the repository

getNumberOfStoredStatements

public long getNumberOfStoredStatements()
Description copied from interface: ModelServiceApiMBean
Get the number of stored statements in the repository

Specified by:
getNumberOfStoredStatements in interface ModelServiceApiMBean
Returns:
the number of stored statements in the repository

getServerURI

public org.openrdf.model.URI getServerURI()
Get the URI for the server

Returns:
the URI for the server

getServerURIString

public java.lang.String getServerURIString()
Description copied from interface: ModelServiceApiMBean
Get the server's URI

Specified by:
getServerURIString in interface ModelServiceApiMBean
Returns:
the server's URI

getResetDatabaseEnabled

public boolean getResetDatabaseEnabled()
Get if the server allows resets

Specified by:
getResetDatabaseEnabled in interface ModelServiceApiMBean
Returns:
true if the server allows resets

setResetDatabaseEnabled

public void setResetDatabaseEnabled(boolean resetEnabled)
Set whether the server allows resets

Specified by:
setResetDatabaseEnabled in interface ModelServiceApiMBean
Parameters:
resetEnabled - whether the server allows resets

getUseHardReset

public boolean getUseHardReset()
Get if the server uses hard resets to clear database tables

Specified by:
getUseHardReset in interface ModelServiceApiMBean
Returns:
true if the server uses hard resets to clear database tables

setUseHardReset

public void setUseHardReset(boolean hardReset)
Set whether or not the server uses hard resets to clear database tables

Specified by:
setUseHardReset in interface ModelServiceApiMBean
Parameters:
hardReset - whether or not the server uses hard resets to clear database tables

getAuthenticationProvider

public IAuthenticationProvider getAuthenticationProvider()
Get the authenticationProvider

Returns:
the authenticationProvider

getResetLock

public java.util.concurrent.locks.ReadWriteLock getResetLock()
Get the resetLock

Returns:
the resetLock


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