public class StorageServiceClient extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
private static long |
DEFAULT_MAX_WAITING_TIME
The default maximum amount of time in millisecond the client is waiting
for a response = 60000Lms.
|
private static org.slf4j.Logger |
LOGGER |
private RabbitRpcClient |
rpcClient
RPC client that is used for the communication.
|
| Constructor and Description |
|---|
StorageServiceClient(RabbitRpcClient rpcClient)
Constructor creating a StorageServiceClient using the given
RabbitRpcClient. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static StorageServiceClient |
create(com.rabbitmq.client.Connection connection)
Creates a StorageServiceClient using the given RabbitMQ
Connection. |
boolean |
sendAskQuery(String query)
Sends the given ASK query to the storage service and returns a boolean
value or throws an Exception if an error occurs, the service needs too
much time to respond or the response couldn't be parsed.
|
org.apache.jena.rdf.model.Model |
sendConstructQuery(String query)
Sends the given CONSTRUCT query to the storage service and returns a
Model value or null if an error occurs, the service
needs too much time to respond or the response couldn't be parsed. |
org.apache.jena.rdf.model.Model |
sendDescribeQuery(String query)
Sends the given DESCRIBE query to the storage service and returns a
Model value or null if an error occurs, the service
needs too much time to respond or the response couldn't be parsed. |
boolean |
sendInsertQuery(org.apache.jena.rdf.model.Model model,
String graphURI)
Inserts the given model into the storage and returns
true if
the query is successful or false if an error occurs or the
service needs too much time to respond. |
org.apache.jena.query.ResultSet |
sendSelectQuery(String query)
Sends the given SELECT query to the storage service and returns a
ResultSet value or null if an error occurs, the
service needs too much time to respond or the response couldn't be
parsed. |
boolean |
sendUpdateQuery(String query)
Sends the given UPDATE query to the storage service and returns
true if the query is successful or false if an
error occurs or the service needs too much time to respond. |
private static final org.slf4j.Logger LOGGER
private static final long DEFAULT_MAX_WAITING_TIME
private RabbitRpcClient rpcClient
public StorageServiceClient(RabbitRpcClient rpcClient)
RabbitRpcClient.rpcClient - RPC client that is used for the communicationpublic static StorageServiceClient create(com.rabbitmq.client.Connection connection) throws IOException
Connection.connection - RabbitMQ connection used for the communicationIOException - if a problem occurs during the creation of the queues or the
consumer.public boolean sendAskQuery(String query) throws Exception
query - ASK queryfalse if an error occursException - if no response has been received or the response couldn't be
parsed.public org.apache.jena.rdf.model.Model sendConstructQuery(String query)
Model value or null if an error occurs, the service
needs too much time to respond or the response couldn't be parsed.query - CONSTRUCT querynullpublic org.apache.jena.rdf.model.Model sendDescribeQuery(String query)
Model value or null if an error occurs, the service
needs too much time to respond or the response couldn't be parsed.query - DESCRIBE querynullpublic org.apache.jena.query.ResultSet sendSelectQuery(String query)
ResultSet value or null if an error occurs, the
service needs too much time to respond or the response couldn't be
parsed.query - SELECT querynullpublic boolean sendUpdateQuery(String query)
true if the query is successful or false if an
error occurs or the service needs too much time to respond.query - UPDATE querypublic boolean sendInsertQuery(org.apache.jena.rdf.model.Model model,
String graphURI)
true if
the query is successful or false if an error occurs or the
service needs too much time to respond.model - RDF model containing triples that should be insertedgraphURI - URI of the graph in which the model should be insertedpublic void close()
throws IOException
Closes the internal rpcClient instance.
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2017–2018. All rights reserved.