org.openrdf.sesame.sailimpl.omm.security
Class SecuritySail

java.lang.Object
  extended byorg.openrdf.sesame.sailimpl.omm.security.SecuritySail
All Implemented Interfaces:
RdfRepository, RdfSchemaRepository, RdfSchemaSource, RdfSource, Sail, SecurityServices, StackedSail, TableQueryResultListener, VersionManagement

public class SecuritySail
extends Object
implements RdfSchemaRepository, StackedSail, SecurityServices, VersionManagement, TableQueryResultListener

SecuritySail.java

Title: Knowledge Control System

Company: OntoText Lab. Sirma AI.

Version:
1.0 Security Sail's purpose is to provide a fine grained security filtering layer over an RDF repository (e.g. Sesame) in a stacked sails architecture.

TODO:

Author:
borislav popov

Field Summary
static String DROP_TABLE
          drop table statement
static String INSERT
          INSERT INTO statement
static String LITERALS_TABLE
          Name of table containing Literals.
static String NAMESPACES_TABLE
          Name of table containing Namespaces.
static String PATTERN_RESTRS_TABLE
          Name of table containing Pattern Restrictions.
static String QUERY_RESTRS_TABLE
          Name of table containing Query Restrictions.
static String RES_PROP_RESTRS_TABLE
          Name of table containing Resource Or Properties Restrictions.
static String RESOURCES_TABLE
          Name of table containing Resources.
static String RESTRICTIONS_TABLE
          Name of table containing Restrictions.
static String ROLES_HIERARCHY_TABLE
          Name of table containing Roles Hierarchy.
static String ROLES_RULES_TABLE
          Name of table containing Roles' Rules.
static String ROLES_TABLE
          Name of table containing Roles.
static String SECURITY_RULES_TABLE
          Name of table containing Security Rules.
static String SELECT
          select * from statement
static String USERS_ROLES_TABLE
          Name of table containing Users' roles.
static String USERS_RULES_TABLE
          Name of table containing Users' Rules.
static String USERS_TABLE
          Name of table containing Users.
static String VALUES
          VALUES part of statement
 
Constructor Summary
SecuritySail()
           
 
Method Summary
 void addListener(SailChangedListener listener)
           
 void addStatement(Resource subj, URI pred, Value obj)
          Adds a statament to the repository.
 void addUser(int id, String login, String password, String name)
          Adds an new user.
 String branchState(long stateUID)
          branch the repository at given state for further operations.
 void changeNamespacePrefix(String namespace, String prefix)
          Changes the prefix of a namespace.
 void clearRepository()
          Clears the repository.
 void commitTransaction()
          Commits a started transaction.
 void continueCounterIncrement()
          Coninue with the normal increment of the update counter on each modification made in the repository.
 Restriction createRestriction(int id, int type, String name, String description)
          Creates a new restriction.
 Role createRole(int id, String name, String description, Set parents)
          Creates a new Role in the repository.
 void endTableQueryResult()
          Indicates the end of a table-like query result.
 void endTuple()
          Indicates the end of a tuple/row.
 void error(QueryErrorType errType, String msg)
          Reports an error that has occurred during the query evaluation.
 void exportPolicy(RdfRepository repos)
          Exports the Security Policy to a Sail.
 Sail getBaseSail()
          Gets the base Sail that this Sail works on top of.
 StatementIterator getClasses()
          Gets all defined classes.
 StatementIterator getDirectSubClassOf(Resource subClass, Resource superClass)
          Gets all direct subClassOf relations with a specific sub- and/or superclass.
 StatementIterator getDirectSubPropertyOf(Resource subProperty, Resource superProperty)
          Gets all direct subPropertyOf relations with a specific sub- and/or superproperty.
 StatementIterator getDirectType(Resource anInstance, Resource aClass)
          Gets all direct type relations with a specific instance and/or class.
 StatementIterator getDomain(Resource prop, Resource domain)
          Gets all domain relations with a specific property and/or domain class.
 StatementIterator getExplicitStatements(Resource subj, URI pred, Value obj)
          Gets all explicitly added statements with a specific subject, predicate and/or object.
 LiteralIterator getLiterals(String label, String language, URI datatype)
          Gets all literals with a specific label, language and/or datatype.
 Map getMetaInfo(String subj, String pred, String obj)
          Retrieves the meta info associated with a statement.
 NamespaceIterator getNamespaces()
          Gets the prefix and name of all namespaces.
 StatementIterator getProperties()
          Gets all defined properties.
 StatementIterator getRange(Resource prop, Resource range)
          Gets all range relations with a specific property and/or range class.
 Resource getResource(int id)
          Gets a resource given its id
 int getResourceId(Resource res)
          Gets the id associated with a resource.
 Restriction getRestriction(int id)
          Gets restriction by id.
 Role getRole(int id)
          Gets the role given its id.
 Role getRole(String name)
          Gets the role given its name.
 Set getRoles()
          Retrive a set of the roles' ids.
 StatementIterator getStatements(Resource subj, URI pred, Value obj)
          Gets all statements with a specific subject, predicate and/or object.
 StatementIterator getSubClassOf(Resource subClass, Resource superClass)
          Gets all subClassOf relations with a specific sub- and/or superclass.
 StatementIterator getSubPropertyOf(Resource subProperty, Resource superProperty)
          Gets all subPropertyOf relations with a specific sub- and/or superproperty.
 StatementIterator getType(Resource anInstance, Resource aClass)
          Gets all type relations with a specific instance and/or class.
 Iterator getUpdateIds()
          Retrive list of all Updates of the repository.
 Map getUpdateMetaInfo(String updateId)
          Retrieves the meta info associated with an update.
 User getUser(int id)
          Gets a user, given it's id
 User getUser(String login)
          Retrieves a interface to an object that supports the User interface.
 Set getUsers()
          Retrieves a set of the users in the repository.
 ValueFactory getValueFactory()
          Gets a ValueFactory object that can be used to create URI-, blank node- and literal objects.
 Iterator getVersionIds()
          Retrieves an iterator over the version ids.
 Map getVersionMetaInfo(String versionId)
          Retrieves the meta info associated with a version .
 Iterator getVersions()
          Retrive list of all labeled states of the repository.
 boolean hasExplicitStatement(Resource subj, URI pred, Value obj)
          Checks if an explicitly added statement with a specific subject, predicate and/or object is present in the repository.
 boolean hasStatement(Resource subj, URI pred, Value obj)
          Checks whether some statement with a specific subject, predicate and/or object is present in the repository.
 void importPolicy(Graph graph)
          Imports the security policy given a Graph.
 void initialize(Map configParams)
          Initializes the Sail using a set of configuration parameters.
 boolean isClass(Resource resource)
          Checks whether the supplied resource represents a class.
 boolean isDirectSubClassOf(Resource subClass, Resource superClass)
          Checks whether one resource is a direct subclass of another.
 boolean isDirectSubPropertyOf(Resource subProperty, Resource superProperty)
          Checks whether one resource is a direct subproperty of another.
 boolean isDirectType(Resource anInstance, Resource aClass)
          Checks whether one resource is a direct instance of another.
 boolean isPausedCounterIncrement()
          Check if the update couter ss paused
 boolean isProperty(Resource resource)
          Checks whether the supplied resource represents a property.
 boolean isRepositoryAccessible(Right right)
          Checks the accessibility of a repository for a specified right.
 boolean isResourceAccessible(Resource res)
          Checks the accessibility of a resource according the security policy and the existence of a Read right over the resource.
 boolean isResourceAccessible(Resource res, Right right)
           
 boolean isSchemaAccessible(Right right)
          Checks the accessibility of a tracking for a specified right.
 boolean isStatementAccessible(Resource subj, URI pred, Value obj, Right right)
          Checks the accessibility of a statement according the security policy and a given right.
 boolean isStatementAccessible(Statement st, Right right)
          Checks the accessibility of a statement according the security policy and a given right.
 boolean isSubClassOf(Resource subClass, Resource superClass)
          Checks whether one resource is a subclass of another.
 boolean isSubPropertyOf(Resource subProperty, Resource superProperty)
          Checks whether one resource is a subproperty of another.
 boolean isType(Resource anInstance, Resource aClass)
          Checks whether one resource is an instance of another.
 boolean isValueAccessible(Value val)
          Checks the accessibility of a value according to the security policy.
 boolean isVersionTrackingAccessible()
          Checks if the user has access to the versioning and tracking sail.
 void labelCurrentState(String label)
          Create a labeled version of the curent repository state.
 void labelState(long stateUID, String label)
          Create a labeled version for a state of the repository assigning the necessary mata-information about that operation.
 void lockStatements(Iterator statementsList)
          Perform locking of statements in the repository
 Query optimizeQuery(Query qc)
          Gives the RdfSource the oportunity to optimize a Query to its specific storage model.
 void pauseCounterIncrement()
          Stop the increment of the update counter.
 void removeListener(SailChangedListener listener)
           
 void removeRole(int id)
          Removes user role from the repository.
 void removeRole(String name)
          Remove user role from the repository.
 int removeStatements(Resource subj, URI pred, Value obj)
          Removes data statements that match the (subject, predicate, object) pattern from the repository.
 void removeUser(String login)
          Removes a user given its login.
 void revertToState(long stateUID)
          Restore the repository to previous state removing all statements added after the value of the update counter and revive all remover ones.
 void setBaseSail(Sail baseSail)
          Sets the base Sail that this Sail will work on top of.
 void shutDown()
          Allow the SAIL to synchronize any stale data.
 void startTableQueryResult()
          Indicates the start of a table-like query result.
 void startTableQueryResult(String[] columnHeaders)
          Indicates the start of a table-like query result.
 void startTransaction()
          Starts a transaction.
 void startTuple()
          Indicates the start of a tuple/row.
 boolean transactionStarted()
          Checks whether a transaction has been started.
 void tupleValue(Value value)
          Delivers the next value in the current tuple/row.
 void unlockStatements(Iterator statementsList)
          Perform unlocking of statements in the repository
 void workWithState(long stateUID)
          Sets the repository to given statete for further read operations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USERS_TABLE

public static final String USERS_TABLE
Name of table containing Users.

See Also:
Constant Field Values

USERS_ROLES_TABLE

public static final String USERS_ROLES_TABLE
Name of table containing Users' roles.

See Also:
Constant Field Values

USERS_RULES_TABLE

public static final String USERS_RULES_TABLE
Name of table containing Users' Rules.

See Also:
Constant Field Values

ROLES_TABLE

public static final String ROLES_TABLE
Name of table containing Roles.

See Also:
Constant Field Values

ROLES_HIERARCHY_TABLE

public static final String ROLES_HIERARCHY_TABLE
Name of table containing Roles Hierarchy.

See Also:
Constant Field Values

ROLES_RULES_TABLE

public static final String ROLES_RULES_TABLE
Name of table containing Roles' Rules.

See Also:
Constant Field Values

SECURITY_RULES_TABLE

public static final String SECURITY_RULES_TABLE
Name of table containing Security Rules.

See Also:
Constant Field Values

RESTRICTIONS_TABLE

public static final String RESTRICTIONS_TABLE
Name of table containing Restrictions.

See Also:
Constant Field Values

RES_PROP_RESTRS_TABLE

public static final String RES_PROP_RESTRS_TABLE
Name of table containing Resource Or Properties Restrictions.

See Also:
Constant Field Values

PATTERN_RESTRS_TABLE

public static final String PATTERN_RESTRS_TABLE
Name of table containing Pattern Restrictions.

See Also:
Constant Field Values

QUERY_RESTRS_TABLE

public static final String QUERY_RESTRS_TABLE
Name of table containing Query Restrictions.

See Also:
Constant Field Values

RESOURCES_TABLE

public static final String RESOURCES_TABLE
Name of table containing Resources.

See Also:
Constant Field Values

LITERALS_TABLE

public static final String LITERALS_TABLE
Name of table containing Literals.

See Also:
Constant Field Values

NAMESPACES_TABLE

public static final String NAMESPACES_TABLE
Name of table containing Namespaces.

See Also:
Constant Field Values

DROP_TABLE

public static final String DROP_TABLE
drop table statement

See Also:
Constant Field Values

SELECT

public static final String SELECT
select * from statement

See Also:
Constant Field Values

INSERT

public static final String INSERT
INSERT INTO statement

See Also:
Constant Field Values

VALUES

public static final String VALUES
VALUES part of statement

See Also:
Constant Field Values
Constructor Detail

SecuritySail

public SecuritySail()
Method Detail

getExplicitStatements

public StatementIterator getExplicitStatements(Resource subj,
                                               URI pred,
                                               Value obj)
Description copied from interface: RdfSchemaSource
Gets all explicitly added statements with a specific subject, predicate and/or object. All of these parameters may be null to indicate wildcards.

Specified by:
getExplicitStatements in interface RdfSchemaSource
Parameters:
subj - subject of pattern
pred - predicate of pattern
obj - object of pattern
Returns:
iterator over statements
See Also:
RdfSource.getStatements(org.openrdf.model.Resource, org.openrdf.model.URI, org.openrdf.model.Value)

hasExplicitStatement

public boolean hasExplicitStatement(Resource subj,
                                    URI pred,
                                    Value obj)
Description copied from interface: RdfSchemaSource
Checks if an explicitly added statement with a specific subject, predicate and/or object is present in the repository. All of these parameters may be null to indicate wildcards.

Specified by:
hasExplicitStatement in interface RdfSchemaSource
Parameters:
subj - subject of statement
pred - predicate of statement
obj - object of statement
Returns:
boolean indicating if the specified statement is present.
See Also:
RdfSource.hasStatement(org.openrdf.model.Resource, org.openrdf.model.URI, org.openrdf.model.Value)

optimizeQuery

public Query optimizeQuery(Query qc)
Description copied from interface: RdfSource
Gives the RdfSource the oportunity to optimize a Query to its specific storage model.

Specified by:
optimizeQuery in interface RdfSource
Parameters:
qc - The Query to optimize.
Returns:
The optimized query.

getClasses

public StatementIterator getClasses()
Description copied from interface: RdfSchemaSource
Gets all defined classes.

Specified by:
getClasses in interface RdfSchemaSource
Returns:
A StatementIterator containing statements of the form (someClass, rdf:type, rdfs:Class).

isClass

public boolean isClass(Resource resource)
Description copied from interface: RdfSchemaSource
Checks whether the supplied resource represents a class.

Specified by:
isClass in interface RdfSchemaSource
Parameters:
resource - A resource
Returns:
true if resource is a class, false otherwise.

getProperties

public StatementIterator getProperties()
Description copied from interface: RdfSchemaSource
Gets all defined properties.

Specified by:
getProperties in interface RdfSchemaSource
Returns:
A StatementIterator containing statements of the form (someProperty, rdf:type, rdf:Property).

isProperty

public boolean isProperty(Resource resource)
Description copied from interface: RdfSchemaSource
Checks whether the supplied resource represents a property.

Specified by:
isProperty in interface RdfSchemaSource
Parameters:
resource - A resource
Returns:
true if resource is a property, false otherwise.

getSubClassOf

public StatementIterator getSubClassOf(Resource subClass,
                                       Resource superClass)
Description copied from interface: RdfSchemaSource
Gets all subClassOf relations with a specific sub- and/or superclass. Note that the subClassOf relation is reflexive: a class is implicitly always a subclass of itself.

Specified by:
getSubClassOf in interface RdfSchemaSource
Parameters:
subClass - The subclass of the relations that should be returned, or null if relations with any subclass should be returned.
superClass - The superclass of the relations that should be returned, or null if relations with any superclass should be returned.
Returns:
A StatementIterator containing statements of the form (someSubClass, rdfs:subClassOf, someSuperClass).

getDirectSubClassOf

public StatementIterator getDirectSubClassOf(Resource subClass,
                                             Resource superClass)
Description copied from interface: RdfSchemaSource
Gets all direct subClassOf relations with a specific sub- and/or superclass. A class A is a direct subclass of class B if there is no class C such that A is a subclass of C and C is a subclass of B.

Specified by:
getDirectSubClassOf in interface RdfSchemaSource
Parameters:
subClass - The subclass of the relations that should be returned, or null if relations with any subclass should be returned.
superClass - The superclass of the relations that should be returned, or null if relations with any superclass should be returned.
Returns:
A StatementIterator containing statements of the form (someSubClass, rdfs:subClassOf, someSuperClass).

isSubClassOf

public boolean isSubClassOf(Resource subClass,
                            Resource superClass)
Description copied from interface: RdfSchemaSource
Checks whether one resource is a subclass of another.

Specified by:
isSubClassOf in interface RdfSchemaSource
Parameters:
subClass - A class
superClass - A class
Returns:
true if subClass is a subclass of superClass, false otherwise.

isDirectSubClassOf

public boolean isDirectSubClassOf(Resource subClass,
                                  Resource superClass)
Description copied from interface: RdfSchemaSource
Checks whether one resource is a direct subclass of another.

Specified by:
isDirectSubClassOf in interface RdfSchemaSource
Parameters:
subClass - A class
superClass - A class
Returns:
true if subClass is a direct subclass of superClass, false otherwise.

getSubPropertyOf

public StatementIterator getSubPropertyOf(Resource subProperty,
                                          Resource superProperty)
Description copied from interface: RdfSchemaSource
Gets all subPropertyOf relations with a specific sub- and/or superproperty. Note that the subPropertyOf relation is reflexive: a property is implicitly always a subproperty of itself.

Specified by:
getSubPropertyOf in interface RdfSchemaSource
Parameters:
subProperty - The subproperty of the relations that should be returned, or null if relations with any subproperty should be returned.
superProperty - The superproperty of the relations that should be returned, or null if relations with any superproperty should be returned.
Returns:
A StatementIterator containing statements of the form (someSubProperty, rdfs:subPropertyOf, someSuperProperty).

getDirectSubPropertyOf

public StatementIterator getDirectSubPropertyOf(Resource subProperty,
                                                Resource superProperty)
Description copied from interface: RdfSchemaSource
Gets all direct subPropertyOf relations with a specific sub- and/or superproperty. A property A is a direct subproperty of property B if there is no property C such that A is a subproperty of C and C is a subproperty of B.

Specified by:
getDirectSubPropertyOf in interface RdfSchemaSource
Parameters:
subProperty - The subproperty of the relations that should be returned, or null if relations with any subproperty should be returned.
superProperty - The superproperty of the relations that should be returned, or null if relations with any superproperty should be returned.
Returns:
A StatementIterator containing statements of the form (someSubProperty, rdfs:subPropertyOf, someSuperProperty).

isSubPropertyOf

public boolean isSubPropertyOf(Resource subProperty,
                               Resource superProperty)
Description copied from interface: RdfSchemaSource
Checks whether one resource is a subproperty of another.

Specified by:
isSubPropertyOf in interface RdfSchemaSource
Parameters:
subProperty - A property
superProperty - A property
Returns:
true if subProperty is a subproperty of superProperty, false otherwise.

isDirectSubPropertyOf

public boolean isDirectSubPropertyOf(Resource subProperty,
                                     Resource superProperty)
Description copied from interface: RdfSchemaSource
Checks whether one resource is a direct subproperty of another.

Specified by:
isDirectSubPropertyOf in interface RdfSchemaSource
Parameters:
subProperty - A property
superProperty - A property
Returns:
true if subProperty is a direct subproperty of superProperty, false otherwise.

getDomain

public StatementIterator getDomain(Resource prop,
                                   Resource domain)
Description copied from interface: RdfSchemaSource
Gets all domain relations with a specific property and/or domain class.

Specified by:
getDomain in interface RdfSchemaSource
Parameters:
prop - The property of the relations that should be returned, or null if relations with any property should be returned.
domain - The domain of the relations that should be returned, or null if relations with any domain should be returned.
Returns:
A StatementIterator containing statements of the form (someProperty, rdfs:domain, someClass).

getRange

public StatementIterator getRange(Resource prop,
                                  Resource range)
Description copied from interface: RdfSchemaSource
Gets all range relations with a specific property and/or range class.

Specified by:
getRange in interface RdfSchemaSource
Parameters:
prop - The property of the relations that should be returned, or null if relations with any property should be returned.
range - The range of the relations that should be returned, or null if relations with any range should be returned.
Returns:
A StatementIterator containing statements of the form (someProperty, rdfs:range, someClass).

getType

public StatementIterator getType(Resource anInstance,
                                 Resource aClass)
Description copied from interface: RdfSchemaSource
Gets all type relations with a specific instance and/or class.

Specified by:
getType in interface RdfSchemaSource
Parameters:
anInstance - The instance of the relations that should be returned, or null if relations with any instance should be returned.
aClass - The class of the relations that should be returned, or null if relations with any class should be returned.
Returns:
A StatementIterator containing statements of the form (someInstance, rdf:type, someClass).

getDirectType

public StatementIterator getDirectType(Resource anInstance,
                                       Resource aClass)
Description copied from interface: RdfSchemaSource
Gets all direct type relations with a specific instance and/or class.

Specified by:
getDirectType in interface RdfSchemaSource
Parameters:
anInstance - The instance of the relations that should be returned, or null if relations with any instance should be returned.
aClass - The class of the relations that should be returned, or null if relations with any class should be returned.
Returns:
A StatementIterator containing statements of the form (someInstance, rdf:type, someClass).

isType

public boolean isType(Resource anInstance,
                      Resource aClass)
Description copied from interface: RdfSchemaSource
Checks whether one resource is an instance of another.

Specified by:
isType in interface RdfSchemaSource
Parameters:
anInstance - An instance
aClass - A class
Returns:
true if anInstance is a instance of aClass, false otherwise.

isDirectType

public boolean isDirectType(Resource anInstance,
                            Resource aClass)
Description copied from interface: RdfSchemaSource
Checks whether one resource is a direct instance of another.

Specified by:
isDirectType in interface RdfSchemaSource
Parameters:
anInstance - An instance
aClass - A class
Returns:
true if anInstance is a direct instance of aClass, false otherwise.

getLiterals

public LiteralIterator getLiterals(String label,
                                   String language,
                                   URI datatype)
Description copied from interface: RdfSchemaSource
Gets all literals with a specific label, language and/or datatype.

Specified by:
getLiterals in interface RdfSchemaSource
Parameters:
label - The label of the literals that should be returned, or null if literals with any label should be returned.
language - The language of the literals that should be returned, or null if literals with any language should be returned.
datatype - The datatype of the literals that should be returned, or null if literals with any datatype should be returned.
Returns:
A LiteralIterator containing literals that match the specified pattern.

startTransaction

public void startTransaction()
Description copied from interface: RdfRepository
Starts a transaction. A transaction needs to be started before data can be added to or removed from the repository.

Specified by:
startTransaction in interface RdfRepository

commitTransaction

public void commitTransaction()
Description copied from interface: RdfRepository
Commits a started transaction. A transaction needs to be commited to be guaranteed that data has been added to, or removed from the repository.

Specified by:
commitTransaction in interface RdfRepository

transactionStarted

public boolean transactionStarted()
Description copied from interface: RdfRepository
Checks whether a transaction has been started.

Specified by:
transactionStarted in interface RdfRepository
Returns:
true if a transaction has been started, false otherwise.

addStatement

public void addStatement(Resource subj,
                         URI pred,
                         Value obj)
                  throws SailUpdateException
Description copied from interface: RdfRepository
Adds a statament to the repository. You must start a transaction before this method can be used.

Specified by:
addStatement in interface RdfRepository
Parameters:
subj - subject of statement
pred - predicate of statement
obj - object of statement
Throws:
SailUpdateException - If the statement could not be added.
See Also:
RdfRepository.startTransaction()

removeStatements

public int removeStatements(Resource subj,
                            URI pred,
                            Value obj)
                     throws SailUpdateException
Description copied from interface: RdfRepository
Removes data statements that match the (subject, predicate, object) pattern from the repository. All three parameters may be null to indicate wildcards. You must start a transaction before this method can be used.

Specified by:
removeStatements in interface RdfRepository
Parameters:
subj - subject of statement
pred - predicate of statement
obj - object of statement
Returns:
the number of statements that have been removed.
Throws:
SailUpdateException - If the statement(s) could not be removed.
See Also:
RdfRepository.startTransaction()

clearRepository

public void clearRepository()
                     throws SailUpdateException
Description copied from interface: RdfRepository
Clears the repository. After the repository was cleared, it will be in the same state as after initialization. You must start a transaction before this method can be used.

Specified by:
clearRepository in interface RdfRepository
Throws:
SailUpdateException - If the repository could not be cleared (for example when a transaction was not started first).

changeNamespacePrefix

public void changeNamespacePrefix(String namespace,
                                  String prefix)
                           throws SailUpdateException
Description copied from interface: RdfRepository
Changes the prefix of a namespace. The new prefix must be unique in the repository; it is not allowed to be associated with any other namespace. You must start a transaction before this method can be used.

Specified by:
changeNamespacePrefix in interface RdfRepository
Parameters:
namespace - The namespace for which the associated prefix should be changed.
prefix - The new prefix.
Throws:
SailUpdateException - If the namespace prefix could not be changed, for example when no transaction was started.

getValueFactory

public ValueFactory getValueFactory()
Description copied from interface: RdfSource
Gets a ValueFactory object that can be used to create URI-, blank node- and literal objects.

Specified by:
getValueFactory in interface RdfSource
Returns:
a ValueFactory object for this RdfSource instance.

getStatements

public StatementIterator getStatements(Resource subj,
                                       URI pred,
                                       Value obj)
Description copied from interface: RdfSource
Gets all statements with a specific subject, predicate and/or object. All three parameters may be null to indicate wildcards.

Specified by:
getStatements in interface RdfSource
Parameters:
subj - subject of pattern
pred - predicate of pattern
obj - object of pattern
Returns:
iterator over statements

hasStatement

public boolean hasStatement(Resource subj,
                            URI pred,
                            Value obj)
Description copied from interface: RdfSource
Checks whether some statement with a specific subject, predicate and/or object is present in the repository. All three parameters may be null to indicate wildcards.

Specified by:
hasStatement in interface RdfSource
Parameters:
subj - subject of statement
pred - predicate of statement
obj - object of statement
Returns:
boolean indicating if specified statement is present

getNamespaces

public NamespaceIterator getNamespaces()
Description copied from interface: RdfSource
Gets the prefix and name of all namespaces.

Specified by:
getNamespaces in interface RdfSource
Returns:
iterator over namespaces

initialize

public void initialize(Map configParams)
                throws SailInitializationException
Description copied from interface: Sail
Initializes the Sail using a set of configuration parameters. The relevant names and values of the parameters are determined by the implementation of the interface.

Specified by:
initialize in interface Sail
Parameters:
configParams - A set a configuration parameters.
Throws:
SailInitializationException - If the Sail could not be initialized.

shutDown

public void shutDown()
Description copied from interface: Sail
Allow the SAIL to synchronize any stale data. The SAIL can assume that shutDown() is called before an application is stopped.

Specified by:
shutDown in interface Sail

setBaseSail

public void setBaseSail(Sail baseSail)
Description copied from interface: StackedSail
Sets the base Sail that this Sail will work on top of. This method will be called before the initialize() method is called.

Specified by:
setBaseSail in interface StackedSail

getBaseSail

public Sail getBaseSail()
Description copied from interface: StackedSail
Gets the base Sail that this Sail works on top of.

Specified by:
getBaseSail in interface StackedSail

labelState

public void labelState(long stateUID,
                       String label)
Description copied from interface: VersionManagement
Create a labeled version for a state of the repository assigning the necessary mata-information about that operation.

Specified by:
labelState in interface VersionManagement
Parameters:
stateUID - the update counter of a particular repository state
label - the label to assign NOTE: This method can throw a security exception if the request is made on behalf of the user with insufficent rights to create versions

labelCurrentState

public void labelCurrentState(String label)
Description copied from interface: VersionManagement
Create a labeled version of the curent repository state. NOTE: This method can throw a security exception if the request is made on behalf of the user with insufficent rights to create versions

Specified by:
labelCurrentState in interface VersionManagement

revertToState

public void revertToState(long stateUID)
Description copied from interface: VersionManagement
Restore the repository to previous state removing all statements added after the value of the update counter and revive all remover ones.

Specified by:
revertToState in interface VersionManagement
Parameters:
stateUID - the update counter of a particular repository state NOTE: This method can throw a security exception if the request is made on behalf of the user with insufficent rights to revert the repository

branchState

public String branchState(long stateUID)
Description copied from interface: VersionManagement
branch the repository at given state for further operations.

Specified by:
branchState in interface VersionManagement
Parameters:
stateUID - the update counter of a particular repository state
Returns:
the id of the repository

workWithState

public void workWithState(long stateUID)
Description copied from interface: VersionManagement
Sets the repository to given statete for further read operations.

Specified by:
workWithState in interface VersionManagement
Parameters:
stateUID - the update counter of a particular repository state

getVersions

public Iterator getVersions()
Description copied from interface: VersionManagement
Retrive list of all labeled states of the repository.

Specified by:
getVersions in interface VersionManagement
Returns:
a list of Versin interfaces for each labeled state of the repository

lockStatements

public void lockStatements(Iterator statementsList)
Description copied from interface: VersionManagement
Perform locking of statements in the repository

Specified by:
lockStatements in interface VersionManagement
Parameters:
statementsList - list of statemensts to lock

unlockStatements

public void unlockStatements(Iterator statementsList)
Description copied from interface: VersionManagement
Perform unlocking of statements in the repository

Specified by:
unlockStatements in interface VersionManagement
Parameters:
statementsList - list of statemensts to unlock

getUpdateIds

public Iterator getUpdateIds()
Description copied from interface: VersionManagement
Retrive list of all Updates of the repository.

Specified by:
getUpdateIds in interface VersionManagement
Returns:
a list of Updates of the repository

pauseCounterIncrement

public void pauseCounterIncrement()
Description copied from interface: VersionManagement
Stop the increment of the update counter. Usefull for a kind of batch updates or adding a distinct daml coinstructs at once.

Specified by:
pauseCounterIncrement in interface VersionManagement

continueCounterIncrement

public void continueCounterIncrement()
Description copied from interface: VersionManagement
Coninue with the normal increment of the update counter on each modification made in the repository.

Specified by:
continueCounterIncrement in interface VersionManagement

isPausedCounterIncrement

public boolean isPausedCounterIncrement()
Description copied from interface: VersionManagement
Check if the update couter ss paused

Specified by:
isPausedCounterIncrement in interface VersionManagement
Returns:
true if the updateCouter is paused, flase otherwise

getVersionIds

public Iterator getVersionIds()
Description copied from interface: VersionManagement
Retrieves an iterator over the version ids.

Specified by:
getVersionIds in interface VersionManagement
Returns:
an iterator over the version ids

getMetaInfo

public Map getMetaInfo(String subj,
                       String pred,
                       String obj)
Description copied from interface: VersionManagement
Retrieves the meta info associated with a statement.

Specified by:
getMetaInfo in interface VersionManagement
Parameters:
subj - the subject of the statement
pred - the predicate of the statement
obj - the object of the statement
Returns:
a map of meta info keys vs meta info values

getUpdateMetaInfo

public Map getUpdateMetaInfo(String updateId)
Description copied from interface: VersionManagement
Retrieves the meta info associated with an update.

Specified by:
getUpdateMetaInfo in interface VersionManagement
Parameters:
updateId - the id of the update
Returns:
a map of meta info keys vs meta info values

getVersionMetaInfo

public Map getVersionMetaInfo(String versionId)
Description copied from interface: VersionManagement
Retrieves the meta info associated with a version .

Specified by:
getVersionMetaInfo in interface VersionManagement
Parameters:
versionId - the id of the update
Returns:
a map of meta info keys vs meta info values

getResourceId

public int getResourceId(Resource res)
                  throws SecurityException
Description copied from interface: SecurityServices
Gets the id associated with a resource.

Specified by:
getResourceId in interface SecurityServices
Parameters:
res - a resource
Returns:
the id of the resource, if found
Throws:
SecurityException - if something goes wrong with the execution of the method

getResource

public Resource getResource(int id)
Description copied from interface: SecurityServices
Gets a resource given its id

Specified by:
getResource in interface SecurityServices
Parameters:
id - the id of the resource
Returns:
the resource with the specified id

isVersionTrackingAccessible

public boolean isVersionTrackingAccessible()
Description copied from interface: SecurityServices
Checks if the user has access to the versioning and tracking sail.

Specified by:
isVersionTrackingAccessible in interface SecurityServices
Returns:
true if the user has assiogned rule with a repository restriction and history right set to true, otherwise - false.

isSchemaAccessible

public boolean isSchemaAccessible(Right right)
Description copied from interface: SecurityServices
Checks the accessibility of a tracking for a specified right.

Specified by:
isSchemaAccessible in interface SecurityServices
Parameters:
right - the right to be checked
Returns:
true if the schema is accessible with the given right, otherwise - false.

isRepositoryAccessible

public boolean isRepositoryAccessible(Right right)
Description copied from interface: SecurityServices
Checks the accessibility of a repository for a specified right.

Specified by:
isRepositoryAccessible in interface SecurityServices
Parameters:
right - the right to be checked
Returns:
true if the repository is accessible with the given right, otherwise - false.

isStatementAccessible

public boolean isStatementAccessible(Resource subj,
                                     URI pred,
                                     Value obj,
                                     Right right)
Description copied from interface: SecurityServices
Checks the accessibility of a statement according the security policy and a given right.

Specified by:
isStatementAccessible in interface SecurityServices
Parameters:
subj - the subject of the statement
pred - the predicate of the statement
obj - the object of the statement
right - the right which is being checked for this statement
Returns:
true if the statement is accessible with the given right, otherwise - false.

isStatementAccessible

public boolean isStatementAccessible(Statement st,
                                     Right right)
Description copied from interface: SecurityServices
Checks the accessibility of a statement according the security policy and a given right.

Specified by:
isStatementAccessible in interface SecurityServices
Parameters:
st - The statement.
right - the right which is being checked for this statement
Returns:
true if the statement is accessible with the given right, otherwise - false.

isValueAccessible

public boolean isValueAccessible(Value val)
Description copied from interface: SecurityServices
Checks the accessibility of a value according to the security policy.

Specified by:
isValueAccessible in interface SecurityServices
Parameters:
val - the value to be checked
Returns:
true if the value is accessible through a read right, otherwise - false

isResourceAccessible

public boolean isResourceAccessible(Resource res,
                                    Right right)

isResourceAccessible

public boolean isResourceAccessible(Resource res)
Description copied from interface: SecurityServices
Checks the accessibility of a resource according the security policy and the existence of a Read right over the resource.

Specified by:
isResourceAccessible in interface SecurityServices
Parameters:
res - the resource
Returns:
true if the resource is accessible, otherwise - false.

addUser

public void addUser(int id,
                    String login,
                    String password,
                    String name)
Description copied from interface: SecurityServices
Adds an new user.

Specified by:
addUser in interface SecurityServices
Parameters:
id - user's id
login - user's login
password - user's password
name - user's name

removeUser

public void removeUser(String login)
Description copied from interface: SecurityServices
Removes a user given its login.

Specified by:
removeUser in interface SecurityServices
Parameters:
login - the login of the user to be removed.

getUsers

public Set getUsers()
Description copied from interface: SecurityServices
Retrieves a set of the users in the repository. Each element of the list is a String containing the user's login.

Specified by:
getUsers in interface SecurityServices
Returns:
set of the users logins.

getUser

public User getUser(String login)
Description copied from interface: SecurityServices
Retrieves a interface to an object that supports the User interface.

Specified by:
getUser in interface SecurityServices
Parameters:
login - the user's login
Returns:
the user object represented by the param login, or null if no such user login.

getUser

public User getUser(int id)
Description copied from interface: SecurityServices
Gets a user, given it's id

Specified by:
getUser in interface SecurityServices
Parameters:
id - the user's id
Returns:
the user object represented by the param id, or null if no such user id.

createRole

public Role createRole(int id,
                       String name,
                       String description,
                       Set parents)
Description copied from interface: SecurityServices
Creates a new Role in the repository.

Specified by:
createRole in interface SecurityServices
Parameters:
id - the id of the role
name - the name of the role to be created
description - the desctiption of the role to be created
parents - Set of parent roles to inherit permissions from.
Returns:
the created Role

removeRole

public void removeRole(String name)
Description copied from interface: SecurityServices
Remove user role from the repository.

Specified by:
removeRole in interface SecurityServices
Parameters:
name - the name of the role to be removed

removeRole

public void removeRole(int id)
Description copied from interface: SecurityServices
Removes user role from the repository.

Specified by:
removeRole in interface SecurityServices
Parameters:
id - the id of the role to be removed

getRoles

public Set getRoles()
Description copied from interface: SecurityServices
Retrive a set of the roles' ids.

Specified by:
getRoles in interface SecurityServices
Returns:
set of the roles' ids

getRole

public Role getRole(String name)
Description copied from interface: SecurityServices
Gets the role given its name.

Specified by:
getRole in interface SecurityServices
Parameters:
name - the name of the role.
Returns:
the role that corresponds to the given name, or null if there is no such known name.

getRole

public Role getRole(int id)
Description copied from interface: SecurityServices
Gets the role given its id.

Specified by:
getRole in interface SecurityServices
Parameters:
id - the id of the role.
Returns:
the role that corresponds to the given id, or null if there is no such known id.

createRestriction

public Restriction createRestriction(int id,
                                     int type,
                                     String name,
                                     String description)
                              throws NullParameterException
Description copied from interface: SecurityServices
Creates a new restriction.

Specified by:
createRestriction in interface SecurityServices
Parameters:
id -
type - type of the restriction
name -
description -
Returns:
the creaed restriction
Throws:
NullParameterException - if a parameter is null.

getRestriction

public Restriction getRestriction(int id)
Description copied from interface: SecurityServices
Gets restriction by id.

Specified by:
getRestriction in interface SecurityServices
Parameters:
id -
Returns:
the restriction corresponding to the given id.

exportPolicy

public void exportPolicy(RdfRepository repos)
Exports the Security Policy to a Sail. To be used with an In-Memory sail for example (org.openrdf.sesame.sail.memory.RdfRepository).

Specified by:
exportPolicy in interface SecurityServices
Parameters:
repos - the RdfRepository to export to

importPolicy

public void importPolicy(Graph graph)
Imports the security policy given a Graph.

Specified by:
importPolicy in interface SecurityServices
Parameters:
graph - the Graph to read the security policy from

startTableQueryResult

public void startTableQueryResult()
                           throws IOException
Description copied from interface: TableQueryResultListener
Indicates the start of a table-like query result.

Specified by:
startTableQueryResult in interface TableQueryResultListener
Throws:
IOException

startTableQueryResult

public void startTableQueryResult(String[] columnHeaders)
                           throws IOException
Description copied from interface: TableQueryResultListener
Indicates the start of a table-like query result. The supplied columnHeaders are an indication of the values that are in a specific column. For example, a query select A, B from * .... could have column headers A and B.

Specified by:
startTableQueryResult in interface TableQueryResultListener
Throws:
IOException

endTableQueryResult

public void endTableQueryResult()
                         throws IOException
Description copied from interface: TableQueryResultListener
Indicates the end of a table-like query result.

Specified by:
endTableQueryResult in interface TableQueryResultListener
Throws:
IOException

startTuple

public void startTuple()
                throws IOException
Description copied from interface: TableQueryResultListener
Indicates the start of a tuple/row.

Specified by:
startTuple in interface TableQueryResultListener
Throws:
IOException

endTuple

public void endTuple()
              throws IOException
Description copied from interface: TableQueryResultListener
Indicates the end of a tuple/row.

Specified by:
endTuple in interface TableQueryResultListener
Throws:
IOException

tupleValue

public void tupleValue(Value value)
                throws IOException
Description copied from interface: TableQueryResultListener
Delivers the next value in the current tuple/row.

Specified by:
tupleValue in interface TableQueryResultListener
Parameters:
value - The next value in the current tuple/row.
Throws:
IOException

error

public void error(QueryErrorType errType,
                  String msg)
           throws IOException
Description copied from interface: TableQueryResultListener
Reports an error that has occurred during the query evaluation.

Specified by:
error in interface TableQueryResultListener
Parameters:
errType - The type of error.
msg - A message describing the error.
Throws:
IOException

addListener

public void addListener(SailChangedListener listener)
Specified by:
addListener in interface RdfRepository

removeListener

public void removeListener(SailChangedListener listener)
Specified by:
removeListener in interface RdfRepository


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.