public class QueryStorage extends Object
Modifier | Constructor and Description |
---|---|
protected |
QueryStorage(AppConfiguration appConfig)
Create a new object for accessing the store of user queries.
|
Modifier and Type | Method and Description |
---|---|
boolean |
askExists(HTTPRepository repository,
String queryName,
String userName) |
boolean |
canChange(URI query,
String currentUser)
Determines whether the user with the given userName is allowed to update
or delete the given query.
|
boolean |
canRead(URI query,
String currentUser)
Determines whether the user with the given userName is allowed to read the
given query.
|
boolean |
checkAccess(HTTPRepository repository)
Checks whether the current user/password credentials can really access the
current repository.
|
void |
deleteQuery(URI query,
String userName)
Delete the given query for the given user.
|
String |
getQueryText(HTTPRepository repository,
String owner,
String queryName)
Retrieves the specified query text.
|
static QueryStorage |
getSingletonInstance(AppConfiguration config) |
void |
saveQuery(HTTPRepository repository,
String queryName,
String userName,
boolean shared,
QueryLanguage queryLanguage,
String queryText,
boolean infer,
int rowsPerPage)
Save a query.
|
void |
selectSavedQueries(HTTPRepository repository,
String userName,
TupleResultBuilder builder)
Prepares a query to retrieve the queries accessible to the given user in
the given repository.
|
URI |
selectSavedQuery(HTTPRepository repository,
String owner,
String queryName)
Returns the URI for the saved query in the given repository with the given
name, owned by the given owner.
|
void |
shutdown() |
void |
updateQuery(URI query,
String userName,
boolean shared,
QueryLanguage queryLanguage,
String queryText,
boolean infer,
int rowsPerPage)
Update the entry for the given query.
|
protected QueryStorage(AppConfiguration appConfig) throws RepositoryException, IOException
appConfig
- the application configuration, for obtaining the data directoryRepositoryException
- if there is an issue creating the object to access the repositoryIOException
public static QueryStorage getSingletonInstance(AppConfiguration config) throws RepositoryException, IOException
RepositoryException
IOException
public void shutdown()
public boolean checkAccess(HTTPRepository repository) throws RepositoryException
repository
- the current repositoryRepositoryException
- if there is an issue closing the connectionpublic void saveQuery(HTTPRepository repository, String queryName, String userName, boolean shared, QueryLanguage queryLanguage, String queryText, boolean infer, int rowsPerPage) throws OpenRDFException
repository
- the repository the query is associated withqueryName
- the name for the queryuserName
- the user saving the queryshared
- whether the query is to be shared with other usersqueryLanguage
- the language, SeRQL or SPARQL, of the queryqueryText
- the actual query textinfer
- rowsPerPage
- rows to display per page, may be 0 (all), 10, 50, 100, or 200)OpenRDFException
public boolean canChange(URI query, String currentUser) throws RepositoryException, QueryEvaluationException, MalformedQueryException
query
- the node identifying the query of interestcurrentUser
- the user to check access forRepositoryException
QueryEvaluationException
MalformedQueryException
public boolean canRead(URI query, String currentUser) throws RepositoryException, QueryEvaluationException, MalformedQueryException
query
- the node identifying the query of interestcurrentUser
- the user to check access forRepositoryException
QueryEvaluationException
MalformedQueryException
public boolean askExists(HTTPRepository repository, String queryName, String userName) throws QueryEvaluationException, RepositoryException, MalformedQueryException
public void deleteQuery(URI query, String userName) throws RepositoryException, UpdateExecutionException, MalformedQueryException
query
- userName
- RepositoryException
UpdateExecutionException
MalformedQueryException
public void updateQuery(URI query, String userName, boolean shared, QueryLanguage queryLanguage, String queryText, boolean infer, int rowsPerPage) throws RepositoryException, UpdateExecutionException, MalformedQueryException
query
- the query to updateuserName
- the user nameshared
- whether to share with other usersqueryLanguage
- the query languagequeryText
- the text of the queryinfer
- rowsPerPage
- the rows per page to display of the queryRepositoryException
- if a problem occurs during the updateUpdateExecutionException
- if a problem occurs during the updateMalformedQueryException
- if a problem occurs during the updatepublic void selectSavedQueries(HTTPRepository repository, String userName, TupleResultBuilder builder) throws RepositoryException, MalformedQueryException, QueryEvaluationException, QueryResultHandlerException
repository
- that the saved queries run againstuserName
- that is requesting the saved queriesbuilder
- receives a list of all the saved queries against the given
repository and accessible to the given userRepositoryException
- if there's a problem connecting to the saved queries repositoryMalformedQueryException
- if the query is not legal SPARQLQueryEvaluationException
- if there is a problem while attempting to evaluate the queryQueryResultHandlerException
public URI selectSavedQuery(HTTPRepository repository, String owner, String queryName) throws OpenRDFException, BadRequestException
repository
- The repository the query is associated with.owner
- The user that saved the query.queryName
- The name given to the query.OpenRDFException
- if issues occur performing the necessary queries.BadRequestException
- if the the specified stored query doesn't existpublic String getQueryText(HTTPRepository repository, String owner, String queryName) throws OpenRDFException, BadRequestException
repository
- Repository that the saved query is associated with.owner
- The user that saved the query.queryName
- The name given to the saved query.OpenRDFException
- if a problem occurs accessing storageBadRequestException
- if the specified query doesn't existCopyright © 2001-2016 Aduna. All Rights Reserved.