|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openanzo.server.repository.rdb.RepositoryConnection
public class RepositoryConnection
Provides read access to all the data stored in the repository as a graph of RDF statements. Each RepositoryGraph also provides write access to the database via RDF updates and access to a cache of SQL prepared statements.
| Field Summary | |
|---|---|
ResourceCache<ACI> |
aciCache
Cache of ACI objects |
ResourceCache<NamedGraph> |
namedGraphCache
Cache of NamedGraph objects |
static int |
QUERY
ReadOnly Query type |
static int |
RO
ReadOnly type |
static int |
RW
ReadWrite type |
static java.lang.String |
TRANSACTION_SEQUENCE
Id of sequence for transactions |
| Constructor Summary | |
|---|---|
RepositoryConnection(org.apache.commons.pool.impl.GenericObjectPool connectionPool,
CacheProvider cacheProvider,
LiteralIndexer literalIndexer,
int type,
RepositoryConnectionConfiguration configuration,
java.sql.Connection connection)
Construct a new RepositoryConnection with given configuration properties. |
|
| Method Summary | |
|---|---|
void |
abort()
Abort database transaction |
void |
addInferredObject(org.openrdf.model.URI property,
org.openrdf.model.URI obj,
org.openrdf.model.URI inferredObj)
Add an inferred object |
void |
addInferredProperty(org.openrdf.model.URI property,
org.openrdf.model.URI inferredProperty)
Add an inferred property |
void |
begin()
Begin database transaction Note:Database already in transaction |
void |
beginTempTable()
Begin database transaction Note:Database already in transaction |
void |
clearCache()
Clear the cache objects in the RepositoryConnection |
void |
close()
Close the connection |
void |
commit()
Commit database transaction |
void |
endTempTable()
Commit database transaction |
java.util.Set<java.lang.String> |
getAllStoredNamedGraphs()
Get stored NamedGraphs |
java.util.HashMap<java.lang.Long,PrivilegeSet> |
getCachedACLPrivileges()
Get the cache of ACL privileges |
RepositoryConnectionConfiguration |
getConfiguration()
|
java.sql.Connection |
getConnection()
Retrieve the internal JDBC connection |
int |
getConnectionType()
Is the JDBC connection set to readOnly |
java.lang.String |
getContainerName()
Get the name of the container |
long |
getDefaultSystemGraphId()
Get the node ID for the default system graph's URI |
long |
getDefaultSystemMetaGraphId()
Get the node ID for the default system metadata graph's URI |
LiteralIndexer |
getLiteralIndexer()
|
static java.io.InputStream |
getLocationAsStream(java.lang.String location)
Convert a string to an InputStream |
org.openrdf.model.URI |
getMetadataGraphUri(org.openrdf.model.URI namedGraphUri,
java.lang.Long lastTransactionTime)
Get the URI for the NamedGraph's metadata graph |
boolean |
getNamedGraphRevision(org.openrdf.model.URI namedGraphUri,
java.lang.Long revision,
IRepositoryHandler handler)
Get the contents of a NamedGraph at a given revision, and pass the results to an IBocaHandler |
CompositeNodeLayout |
getNodeLayout()
Get the NodeLayout for this connection |
long |
getNumberOfStoredNamedGraphs()
Get total number of stored NamedGraphs |
long |
getNumberOfStoredStatements()
Get total number of stored Statements |
SQLCache |
getPreparedStatementCache()
Get the SQLCache for this connection |
ReplicationService |
getReplicationService()
Get this RepositoryConnection's ReplicationService |
java.util.Set<org.openrdf.model.URI> |
getRolesForGraph(org.openrdf.model.URI namedGraphUri)
Get the set of Roles that have permission to read the given graph |
java.util.Set<org.openrdf.model.URI> |
getRolesForUser(org.openrdf.model.URI user)
Get the set of Roles to which the given user is a member |
Sequence |
getSequence()
Get Sequence provider for this connection |
java.lang.Long |
getServerId()
Get the server ID for the server |
org.openrdf.model.URI |
getServerUri()
Get the unique id of this server instance |
long |
getSize(org.openrdf.model.URI namedGraphUri)
Get the size of a NamedGraph |
java.util.Set<org.openrdf.model.URI> |
getStoredNamedGraphs(java.lang.Long authenticatedUserId)
Get stored NamedGraphs that user can read |
java.lang.Long |
getUserId()
Get the current userId that this connection is bound |
java.util.Set<org.openrdf.model.URI> |
getUsersForGraph(java.lang.Long authenticatedUserId,
org.openrdf.model.URI graphUri)
Get the set of userIds that have read permission for the given NamedGraph |
boolean |
isClosed()
Is the JDBC connection closed |
boolean |
isLocked()
Is this connection currently locked |
boolean |
isReseting()
Is the database in the process of being reset |
boolean |
isReturned()
Has this connection been returned to the ContainerConnectionPool |
boolean |
isUserInRole(long userId,
org.openrdf.model.URI role)
Test to determine if a user is in a role |
void |
passivate()
Return this connection to its parent pool |
void |
reset(java.lang.Long id)
Server was reset |
void |
resetDatabase(boolean hardReset,
java.util.Collection<org.openrdf.model.Statement> statements)
Reset the database contents with the system graph data contained in the graph |
void |
resetDatabase(boolean hardReset,
java.io.InputStream stream)
Reset the database contents with the system graph data contained in the InputStream |
boolean |
runAskQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
java.util.Set<org.openrdf.model.URI> graphs,
java.lang.String query,
boolean current)
Run a Sparql ASK query |
java.util.Collection<StatementWrapper> |
runIndexQuery(java.lang.Long userId,
java.lang.String query,
int offset,
int limit)
Query the text indexer for a set of statements that match a text indexer query |
QueryResult |
runQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
java.util.Set<org.openrdf.model.URI> graphs,
java.lang.String query,
org.openrdf.model.URI baseUri)
Run a query on the server's data |
int |
runQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
java.util.Set<org.openrdf.model.URI> graphs,
java.lang.String query,
org.openrdf.model.URI baseUri,
java.io.OutputStream outputStream)
Run a query on the server's data |
void |
setReseting(boolean reseting)
Set if the database is in the process of being reset |
void |
setReturned(boolean returned)
Set if connection has been returned to the ContainerConnectionPool |
void |
setUserId(java.lang.Long userId)
Bind the connection to the given userId for all subsequent operations until userId is set to a new value, or set to null. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String TRANSACTION_SEQUENCE
public ResourceCache<ACI> aciCache
public ResourceCache<NamedGraph> namedGraphCache
public static final int RO
public static final int QUERY
public static final int RW
| Constructor Detail |
|---|
public RepositoryConnection(org.apache.commons.pool.impl.GenericObjectPool connectionPool,
CacheProvider cacheProvider,
LiteralIndexer literalIndexer,
int type,
RepositoryConnectionConfiguration configuration,
java.sql.Connection connection)
connectionPool - pool that this connection was taken fromcacheProvider - shared cache of node to id cachesliteralIndexer - literal indexer for queriestype - type of connection, QUERY vs WRITEconfiguration - configuration data for this connectionconnection - underlying jdbc connection| Method Detail |
|---|
public void setUserId(java.lang.Long userId)
userId - UserId to which connection is boundpublic java.lang.Long getUserId()
null if no userId setpublic void reset(java.lang.Long id)
IResetListener
reset in interface IResetListenerid - Server's id which was resetpublic SQLCache getPreparedStatementCache()
public CompositeNodeLayout getNodeLayout()
public java.sql.Connection getConnection()
public void close()
throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean isLocked()
public void begin()
public void abort()
public void commit()
public void beginTempTable()
public void endTempTable()
public long getSize(org.openrdf.model.URI namedGraphUri)
throws AnzoException
namedGraphUri - URI of NamedGraph
AnzoException - Throws an exception if graph not found or user does not have permission to read graph. Note: If user doesn't
have permission to see graph, unknown graph error is still thrown in order to prevent probing queries to
determine existing of graphs
public org.openrdf.model.URI getMetadataGraphUri(org.openrdf.model.URI namedGraphUri,
java.lang.Long lastTransactionTime)
throws AnzoException
namedGraphUri - URI of NamedGraphlastTransactionTime - Timestamp of last committed transaction, if null, query is run to find last transaction time
AnzoException - Throws an exception if graph not found or user does not have permission to read graph. Note: If user doesn't
have permission to see graph, unknown graph error is still thrown in order to prevent probing queries to
determine existing of graphs
public boolean isUserInRole(long userId,
org.openrdf.model.URI role)
throws AnzoException
userId - ID of userrole - Role to determine membership
AnzoException
public void addInferredProperty(org.openrdf.model.URI property,
org.openrdf.model.URI inferredProperty)
throws AnzoException
property - property to addinferredProperty - inferred property to add
AnzoException
public void addInferredObject(org.openrdf.model.URI property,
org.openrdf.model.URI obj,
org.openrdf.model.URI inferredObj)
throws AnzoException
property - property to addobj - object to addinferredObj - inferred object to add
AnzoException
public java.util.Set<org.openrdf.model.URI> getUsersForGraph(java.lang.Long authenticatedUserId,
org.openrdf.model.URI graphUri)
throws AnzoException
authenticatedUserId - userId of authenticated user for this sessiongraphUri - URI of NamedGraph to get users
AnzoException
public java.util.Set<org.openrdf.model.URI> getRolesForUser(org.openrdf.model.URI user)
throws AnzoException
user - URI of user to fetch roles
AnzoException
public java.util.Set<org.openrdf.model.URI> getRolesForGraph(org.openrdf.model.URI namedGraphUri)
throws AnzoException
namedGraphUri - URI of graph to fetch roles
AnzoException
public java.util.Set<org.openrdf.model.URI> getStoredNamedGraphs(java.lang.Long authenticatedUserId)
throws AnzoException
authenticatedUserId - userId of authenticated user for this session
AnzoException
public long getNumberOfStoredNamedGraphs()
throws AnzoException
AnzoException
public java.util.Set<java.lang.String> getAllStoredNamedGraphs()
throws AnzoException
AnzoException
public long getNumberOfStoredStatements()
throws AnzoException
AnzoExceptionpublic Sequence getSequence()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isReturned()
public void setReturned(boolean returned)
returned - public int getConnectionType()
public boolean isClosed()
public ReplicationService getReplicationService()
public void clearCache()
public void resetDatabase(boolean hardReset,
java.io.InputStream stream)
throws AnzoException
hardReset - if true, all tables will be dropped and recreated, instead of just clearing the contents of the existing
tablesstream - Stream containing the data to initialize the system graph
AnzoException
public void resetDatabase(boolean hardReset,
java.util.Collection<org.openrdf.model.Statement> statements)
hardReset - if true, all tables will be dropped and recreated, instead of just clearing the contents of the existing
tablesstatements - statements containing the data to initialize the system graphpublic boolean isReseting()
public void setReseting(boolean reseting)
reseting - Is datbase being reset
public boolean getNamedGraphRevision(org.openrdf.model.URI namedGraphUri,
java.lang.Long revision,
IRepositoryHandler handler)
throws AnzoException
namedGraphUri - URI of NamedGraphrevision - Revision to retrievehandler - Handler to which results are written
AnzoExceptionpublic org.openrdf.model.URI getServerUri()
public java.lang.Long getServerId()
public java.util.HashMap<java.lang.Long,PrivilegeSet> getCachedACLPrivileges()
public void passivate()
throws java.lang.Exception
java.lang.Exceptionpublic RepositoryConnectionConfiguration getConfiguration()
public int runQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
java.util.Set<org.openrdf.model.URI> graphs,
java.lang.String query,
org.openrdf.model.URI baseUri,
java.io.OutputStream outputStream)
throws AnzoException
defaultNamedGraphs - Set of NamedGraph URIs that are used as the default graphgraphs - Set of NamedGraph URIs that make up dataset's NamedGraph setquery - Text of querybaseUri - Base URI for resolving relative URIs in the query. May be null.outputStream - Stream on to which the results are written
AnzoException
public QueryResult runQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
java.util.Set<org.openrdf.model.URI> graphs,
java.lang.String query,
org.openrdf.model.URI baseUri)
throws AnzoException
defaultNamedGraphs - Set of NamedGraph URIs that are used as the default graphgraphs - Set of NamedGraph URIs that make up dataset's NamedGraph setquery - Text of querybaseUri - Base URI for resolving relative URIs in the query. May be null.
AnzoException
public boolean runAskQuery(java.util.Set<org.openrdf.model.URI> defaultNamedGraphs,
java.util.Set<org.openrdf.model.URI> graphs,
java.lang.String query,
boolean current)
throws AnzoException
defaultNamedGraphs - Set of NamedGraph URIs that are used as the default graphgraphs - Set of NamedGraph URIs that make up dataset's NamedGraph setquery - Text of querycurrent - Run against live data, or against last committed transaction
AnzoException
public java.util.Collection<StatementWrapper> runIndexQuery(java.lang.Long userId,
java.lang.String query,
int offset,
int limit)
throws AnzoException
userId - user id for the user that the query is run on behalfquery - query stringoffset - index of first result to returnlimit - maximum number of results to return
AnzoExceptionpublic LiteralIndexer getLiteralIndexer()
public long getDefaultSystemMetaGraphId()
public long getDefaultSystemGraphId()
public java.lang.String getContainerName()
public static java.io.InputStream getLocationAsStream(java.lang.String location)
throws AnzoException
location - Location of data to convert to an InputStream
AnzoException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||