|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.myskua.sac.client.QsacSacClientImpl
public class QsacSacClientImpl
SAC client implementation to operate against a Quaestor-based QSAC.
SacClient| Field Summary | |
|---|---|
protected static java.lang.String |
CHANGESET_DELEGATE_TO_ADDITION_TEMPLATE
Text body for RDF/XML Talis delegateTo addition changeset |
protected static java.lang.String |
CHANGESET_DELEGATE_TO_DELETION_TEMPLATE
Text body for RDF/XML Talis delegateTo deletion changeset |
protected static java.lang.String |
CHANGESET_END
Text at end of RDF/XML Talis changeset |
protected static java.lang.String |
CHANGESET_START
Text at beginning of RDF/XML Talis changeset |
protected static java.lang.String |
DELEGATE_TO_PLACEHOLDER
Placeholder string to be substituted by actual delegation URL |
protected static java.lang.String |
METADATA_POST_SUFFIX
Suffix expected by QSAC interface for metadata posting |
protected static java.lang.String |
METADATA_SUFFIX
Suffix expected by QSAC interface for metadata retrieves |
protected Model |
model
Jena model for constructing Jena RDF Resources. |
protected static java.lang.String |
SAC_ERROR_END
Text at end of QSAC HTML-formatted error message |
protected static java.lang.String |
SAC_ERROR_START
Text at start of QSAC HTML-formatted error message |
| Fields inherited from interface org.myskua.sac.client.SacClient |
|---|
CSV_CONTENT, RDF_TEXT_CONTENT, RDF_XML_CONTENT, SPARQL_CONTENT, SPARQL_RESULTS_CONTENT, TALIS_CHANGESET_CONTENT, TEXT_CONTENT, TSV_CONTENT, TURTLE_CONTENT |
| Constructor Summary | |
|---|---|
QsacSacClientImpl()
|
|
| Method Summary | |
|---|---|
java.lang.String |
addClaim(java.lang.String sacEndpoint,
java.lang.String claimXmlString,
java.lang.String mimeType)
SAC method to add a new claim to a SAC. |
void |
addDelegationTo(java.lang.String sacEndpoint,
java.lang.String toSacEndpoint)
SAC administration method to enable query forwarding (delegation) to a given SAC. |
void |
allowDelegationFrom(java.lang.String sacEndpoint,
java.lang.String fromSacEndpoint)
SAC administration method to enable query forwarding (delegation) to be accepted from a given SAC. |
java.lang.String |
createSac(java.lang.String metaSacEndpoint,
java.lang.String sacName,
java.lang.String sacMetadataXml)
MetaSAC method to create a new SAC at the specified MetaSAC. |
java.lang.String |
createSac(java.lang.String metaSacEndpoint,
java.lang.String sacName,
java.lang.String sacMetadata,
java.lang.String mimeType)
MetaSAC method to create a new SAC at the specified MetaSAC. |
void |
deleteClaim(java.lang.String claimID)
SAC method to delete the claim at the specified URL. |
void |
deleteSac(java.lang.String sacEndpoint)
MetaSAC method to delete the SAC specified by the supplied SAC endpoint URL. |
void |
denyDelegationFrom(java.lang.String sacEndpoint,
java.lang.String fromSacEndpoint)
SAC administration method to prevent query forwarding (delegation) from being accepted from a given SAC. |
void |
dropDelegationTo(java.lang.String sacEndpoint,
java.lang.String toSacEndpoint)
SAC administration method to disable query forwarding (delegation) to a given SAC. |
java.lang.String |
getClaim(java.lang.String claimID)
SAC method to retrieve the claim at the specified URL. |
java.lang.String |
getClaim(java.lang.String claimID,
java.lang.String mimeType)
SAC method to retrieve the claim at the specified URL. |
Resource |
getClaimAsResource(java.lang.String claimID)
SAC method to retrieve the claim at the specified URL. |
protected java.net.HttpURLConnection |
getConnection(java.lang.String endpointUrlString)
Helper method to open an HTTP connection to a specified endpoint. |
java.lang.String |
getMetaSacInfo(java.lang.String metaSacEndpoint)
MetaSAC method to return some HTML-formatted data about the MetaSAC. |
java.lang.String |
getSacContent(java.lang.String sacEndpoint)
SAC method to retrieve the content of a SAC. |
java.lang.String |
getSacContent(java.lang.String sacEndpoint,
java.lang.String mimeType)
SAC method to retrieve the content of a SAC. |
Resource |
getSacContentAsResource(java.lang.String sacEndpoint)
SAC method to retrieve the content of a SAC. |
protected java.lang.String |
getSacEndpoint(java.lang.String metaSacEndpoint,
java.lang.String sacName)
Helper method to construct the RESTful endpoint for a named SAC in a particular QSAC MetaSAC. |
protected java.lang.String |
getSacListingEndpoint(java.lang.String metaSacEndpoint)
Helper method to construct the RESTful endpoint for viewing QSAC MetaSAC contents. |
java.lang.String |
getSacMetadata(java.lang.String sacEndpoint)
SAC method to retrieve any metadata associated with the SAC. |
java.lang.String |
getSacMetadata(java.lang.String sacEndpoint,
java.lang.String mimeType)
SAC method to retrieve any metadata associated with the SAC. |
Resource |
getSacMetadataAsResource(java.lang.String sacEndpoint)
SAC method to retrieve any metadata associated with the SAC. |
protected java.lang.String |
readConnectionError(java.net.HttpURLConnection httpConnection)
Helper method to read any available error stream data from an open HTTP connection. |
protected java.lang.String |
readConnectionInput(java.net.HttpURLConnection httpConnection)
Helper method to read any available input stream from an open HTTP connection. |
void |
replaceClaim(java.lang.String claimID,
java.lang.String claimXmlString,
java.lang.String mimeType)
SAC method to replace a pre-existing claim. |
java.lang.String |
runQuery(java.lang.String sacEndpoint,
java.lang.String queryString,
java.lang.String mimeType)
SAC method to run a SPARQL query against the SAC at the specified URL, and return the results of this query in the specified format. |
protected java.lang.String |
tryForErrorMessage(java.net.HttpURLConnection httpConnection)
Helper method to read any available information from an open HTTP connection when an error has occurred. |
protected void |
updateSacMetadata(java.lang.String sacEndpoint,
java.lang.String changeset)
Helper method to submit changed SAC metadata. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String METADATA_SUFFIX
protected static final java.lang.String METADATA_POST_SUFFIX
protected static final java.lang.String SAC_ERROR_START
protected static final java.lang.String SAC_ERROR_END
protected static final java.lang.String CHANGESET_START
protected static final java.lang.String CHANGESET_END
protected static final java.lang.String CHANGESET_DELEGATE_TO_ADDITION_TEMPLATE
protected static final java.lang.String CHANGESET_DELEGATE_TO_DELETION_TEMPLATE
protected static final java.lang.String DELEGATE_TO_PLACEHOLDER
protected Model model
| Constructor Detail |
|---|
public QsacSacClientImpl()
| Method Detail |
|---|
public java.lang.String getMetaSacInfo(java.lang.String metaSacEndpoint)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
getMetaSacInfo in interface SacClientmetaSacEndpoint - The URL of the endpoint of the MetaSAC
whose information is to be extracted.
SacClientConnectionException - if a connection to
the MetaSAC cannot be established.
SacClientTargetException - if the MetaSAC does not exist
at the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public void deleteSac(java.lang.String sacEndpoint)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
deleteSac in interface SacClientsacEndpoint - The URL of the endpoint of the SAC to be deleted.
SacClientConnectionException - if a connection to
the MetaSAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String createSac(java.lang.String metaSacEndpoint,
java.lang.String sacName,
java.lang.String sacMetadataXml)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
createSac in interface SacClientmetaSacEndpoint - The URL of the endpoint of the MetaSAC
where the new SAC is to be created.sacName - The name that the new SAC should be given.sacMetadataXml - The metadata to describe the new SAC. This
must be in RDF XML format.
SacClientConnectionException - if a connection to
the MetaSAC cannot be established.
SacClientTargetException - if the MetaSAC does
not exist at the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String createSac(java.lang.String metaSacEndpoint,
java.lang.String sacName,
java.lang.String sacMetadata,
java.lang.String mimeType)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
createSac in interface SacClientmetaSacEndpoint - The URL of the endpoint of the MetaSAC
where the new SAC is to be created.sacName - The name that the new SAC should be given.sacMetadata - The metadata to describe the new SAC. This
must be in the format described by the mimeType parameter.mimeType - The type of the supplied SAC metadata.
This must be one of SacClient.RDF_XML_CONTENT,
SacClient.RDF_TEXT_CONTENT, SacClient.TURTLE_CONTENT
SacClientConnectionException - if a connection to
the MetaSAC cannot be established.
SacClientTargetException - if the MetaSAC does
not exist at the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String getSacMetadata(java.lang.String sacEndpoint)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
getSacMetadata in interface SacClientsacEndpoint - The URL of the SAC whose metadata is to be retrieved.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist
at the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String getSacMetadata(java.lang.String sacEndpoint,
java.lang.String mimeType)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
getSacMetadata in interface SacClientsacEndpoint - The URL of the SAC whose metadata is to be retrieved.mimeType - The type of the supplied SAC metadata.
This must be one of SacClient.RDF_XML_CONTENT,
SacClient.RDF_TEXT_CONTENT, SacClient.TURTLE_CONTENT
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist
at the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public Resource getSacMetadataAsResource(java.lang.String sacEndpoint)
throws SacClientException
getSacMetadataAsResource in interface SacClientsacEndpoint - The URL of the SAC whose metadata is to be retrieved.
SacClientException - if anything goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String getSacContent(java.lang.String sacEndpoint)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
getSacContent in interface SacClientsacEndpoint - The URL of the SAC whose content is to be retrieved.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String getSacContent(java.lang.String sacEndpoint,
java.lang.String mimeType)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
getSacContent in interface SacClientsacEndpoint - The URL of the SAC whose content is to be retrieved.mimeType - The type of the supplied SAC content.
This must be one of SacClient.RDF_XML_CONTENT,
SacClient.RDF_TEXT_CONTENT, SacClient.TURTLE_CONTENT
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public Resource getSacContentAsResource(java.lang.String sacEndpoint)
throws SacClientException
getSacContentAsResource in interface SacClientsacEndpoint - The URL of the SAC whose content is to be retrieved.
SacClientException - if anything goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String addClaim(java.lang.String sacEndpoint,
java.lang.String claimXmlString,
java.lang.String mimeType)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
addClaim in interface SacClientsacEndpoint - The URL of the SAC whose metadata is to be retrieved.claimXmlString - The claim to be added to the SACmimeType - The type of the supplied claim
This must be one of SacClient.RDF_XML_CONTENT,
SacClient.RDF_TEXT_CONTENT, SacClient.TURTLE_CONTENT
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public void replaceClaim(java.lang.String claimID,
java.lang.String claimXmlString,
java.lang.String mimeType)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
replaceClaim in interface SacClientclaimID - The ID (a URL) of the claim to be replaced.claimXmlString - The claim to be added to the SACmimeType - The type of the supplied claim
This must be one of SacClient.RDF_XML_CONTENT,
SacClient.RDF_TEXT_CONTENT, SacClient.TURTLE_CONTENT
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String getClaim(java.lang.String claimID)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
getClaim in interface SacClientclaimID - The ID (a URL) of the claim to be retrieved.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String getClaim(java.lang.String claimID,
java.lang.String mimeType)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
getClaim in interface SacClientclaimID - The ID (a URL) of the claim to be retrieved.mimeType - The desired format of the returned claim.
This must be one of SacClient.RDF_XML_CONTENT,
SacClient.RDF_TEXT_CONTENT, SacClient.TURTLE_CONTENT
SacClientException - if anything goes wrong, with an
explanation of the problem in the exception message.
SacClientConnectionException
SacClientTargetException
public Resource getClaimAsResource(java.lang.String claimID)
throws SacClientException
getClaimAsResource in interface SacClientclaimID - The ID (a URL) of the claim to be retrieved.
SacClientException - if anything goes wrong, with an
explanation of the problem in the exception message.
public void deleteClaim(java.lang.String claimID)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
deleteClaim in interface SacClientclaimID - The ID (a URL) of the claim to be deleted.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public java.lang.String runQuery(java.lang.String sacEndpoint,
java.lang.String queryString,
java.lang.String mimeType)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
runQuery in interface SacClientsacEndpoint - The URL of the endpoint of the SAC to be queried.mimeType - The desired return type of the results.
If the query is a Construct or Describe query, this must be one of
SacClient.RDF_XML_CONTENT, SacClient.RDF_TEXT_CONTENT,
SacClient.TURTLE_CONTENT.
If the query is a Select query, this must be one of
SacClient.TEXT_CONTENT, SacClient.SPARQL_RESULTS_CONTENT,
SacClient.CSV_CONTENT, SacClient.TSV_CONTENT.
If the query is an Ask query, this must be one of
SacClient.TEXT_CONTENT, SacClient.SPARQL_RESULTS_CONTENT,
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public void allowDelegationFrom(java.lang.String sacEndpoint,
java.lang.String fromSacEndpoint)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
allowDelegationFrom in interface SacClientsacEndpoint - The URL of the endpoint of the SAC to be administered.fromSacEndpoint - The URL of the endpoint of the SAC from which
delegation is to be accepted.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public void denyDelegationFrom(java.lang.String sacEndpoint,
java.lang.String fromSacEndpoint)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
denyDelegationFrom in interface SacClientsacEndpoint - The URL of the endpoint of the SAC to be administered.fromSacEndpoint - The URL of the endpoint of the SAC from which
delegation is to be rejected.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public void addDelegationTo(java.lang.String sacEndpoint,
java.lang.String toSacEndpoint)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
addDelegationTo in interface SacClientsacEndpoint - The URL of the endpoint of the SAC to be administered.toSacEndpoint - The URL of the endpoint of the SAC to be delegated
to.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
public void dropDelegationTo(java.lang.String sacEndpoint,
java.lang.String toSacEndpoint)
throws SacClientConnectionException,
SacClientTargetException,
SacClientException
dropDelegationTo in interface SacClientsacEndpoint - The URL of the endpoint of the SAC to be administered.toSacEndpoint - The URL of the endpoint of the SAC not to be
delegated to.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.protected java.lang.String getSacListingEndpoint(java.lang.String metaSacEndpoint)
metaSacEndpoint - The URL of the MetaSAC
protected java.lang.String getSacEndpoint(java.lang.String metaSacEndpoint,
java.lang.String sacName)
metaSacEndpoint - The URL of the MetaSACsacName - The name of the SAC
protected java.net.HttpURLConnection getConnection(java.lang.String endpointUrlString)
throws SacClientException,
java.net.MalformedURLException
endpointUrlString - The URL to be connected to
java.net.MalformedURLException - if the URL is bad
SacClientException - if the connection fails
protected java.lang.String readConnectionInput(java.net.HttpURLConnection httpConnection)
throws java.io.IOException
httpConnection - The HTTP connection to be read from
java.io.IOException - if the read fails
protected java.lang.String readConnectionError(java.net.HttpURLConnection httpConnection)
throws java.io.IOException
httpConnection - The HTTP connection to be read from
java.io.IOException - if the read failsprotected java.lang.String tryForErrorMessage(java.net.HttpURLConnection httpConnection)
httpConnection - The HTTP connection to be read from
protected void updateSacMetadata(java.lang.String sacEndpoint,
java.lang.String changeset)
throws SacClientException
sacEndpoint - The URL of the endpoint of the SAC to be administered.changeset - The Talis changeset containing the metadata change.
SacClientConnectionException - if a connection to
the SAC cannot be established.
SacClientTargetException - if the SAC does not exist at
the specified endpoint.
SacClientException - if anything else goes wrong, with an
explanation of the problem in the exception message.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||