org.myskua.sac.client
Class QsacSacClientImpl

java.lang.Object
  extended by org.myskua.sac.client.QsacSacClientImpl
All Implemented Interfaces:
SacClient

public class QsacSacClientImpl
extends java.lang.Object
implements SacClient

SAC client implementation to operate against a Quaestor-based QSAC.

Author:
Kona Andrews, SKUA Project, kea@roe.ac.uk
See Also:
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

METADATA_SUFFIX

protected static final java.lang.String METADATA_SUFFIX
Suffix expected by QSAC interface for metadata retrieves

See Also:
Constant Field Values

METADATA_POST_SUFFIX

protected static final java.lang.String METADATA_POST_SUFFIX
Suffix expected by QSAC interface for metadata posting

See Also:
Constant Field Values

SAC_ERROR_START

protected static final java.lang.String SAC_ERROR_START
Text at start of QSAC HTML-formatted error message

See Also:
Constant Field Values

SAC_ERROR_END

protected static final java.lang.String SAC_ERROR_END
Text at end of QSAC HTML-formatted error message

See Also:
Constant Field Values

CHANGESET_START

protected static final java.lang.String CHANGESET_START
Text at beginning of RDF/XML Talis changeset

See Also:
Constant Field Values

CHANGESET_END

protected static final java.lang.String CHANGESET_END
Text at end of RDF/XML Talis changeset

See Also:
Constant Field Values

CHANGESET_DELEGATE_TO_ADDITION_TEMPLATE

protected static final java.lang.String CHANGESET_DELEGATE_TO_ADDITION_TEMPLATE
Text body for RDF/XML Talis delegateTo addition changeset

See Also:
Constant Field Values

CHANGESET_DELEGATE_TO_DELETION_TEMPLATE

protected static final java.lang.String CHANGESET_DELEGATE_TO_DELETION_TEMPLATE
Text body for RDF/XML Talis delegateTo deletion changeset

See Also:
Constant Field Values

DELEGATE_TO_PLACEHOLDER

protected static final java.lang.String DELEGATE_TO_PLACEHOLDER
Placeholder string to be substituted by actual delegation URL

See Also:
Constant Field Values

model

protected Model model
Jena model for constructing Jena RDF Resources.

Constructor Detail

QsacSacClientImpl

public QsacSacClientImpl()
Method Detail

getMetaSacInfo

public java.lang.String getMetaSacInfo(java.lang.String metaSacEndpoint)
                                throws SacClientConnectionException,
                                       SacClientTargetException,
                                       SacClientException
MetaSAC method to return some HTML-formatted data about the MetaSAC. This might include a list of the available SACs, but its content is not formally specified.

Specified by:
getMetaSacInfo in interface SacClient
Parameters:
metaSacEndpoint - The URL of the endpoint of the MetaSAC whose information is to be extracted.
Returns:
A String containing HTML-formatted data about the MetaSAC.
Throws:
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.

deleteSac

public void deleteSac(java.lang.String sacEndpoint)
               throws SacClientConnectionException,
                      SacClientTargetException,
                      SacClientException
MetaSAC method to delete the SAC specified by the supplied SAC endpoint URL.

Specified by:
deleteSac in interface SacClient
Parameters:
sacEndpoint - The URL of the endpoint of the SAC to be deleted.
Throws:
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.

createSac

public java.lang.String createSac(java.lang.String metaSacEndpoint,
                                  java.lang.String sacName,
                                  java.lang.String sacMetadataXml)
                           throws SacClientConnectionException,
                                  SacClientTargetException,
                                  SacClientException
MetaSAC method to create a new SAC at the specified MetaSAC.

Specified by:
createSac in interface SacClient
Parameters:
metaSacEndpoint - 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.
Returns:
A String containing the URL of the created SAC.
Throws:
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.

createSac

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
MetaSAC method to create a new SAC at the specified MetaSAC.

Specified by:
createSac in interface SacClient
Parameters:
metaSacEndpoint - 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
Returns:
A String containing the URL of the created SAC.
Throws:
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.

getSacMetadata

public java.lang.String getSacMetadata(java.lang.String sacEndpoint)
                                throws SacClientConnectionException,
                                       SacClientTargetException,
                                       SacClientException
SAC method to retrieve any metadata associated with the SAC. Returns the metadata in RDF XML format.

Specified by:
getSacMetadata in interface SacClient
Parameters:
sacEndpoint - The URL of the SAC whose metadata is to be retrieved.
Returns:
A String containing the SAC Metadata in RDF XML format.
Throws:
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.

getSacMetadata

public java.lang.String getSacMetadata(java.lang.String sacEndpoint,
                                       java.lang.String mimeType)
                                throws SacClientConnectionException,
                                       SacClientTargetException,
                                       SacClientException
SAC method to retrieve any metadata associated with the SAC. Returns the metadata in the requested format.

Specified by:
getSacMetadata in interface SacClient
Parameters:
sacEndpoint - 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
Returns:
A String containing the SAC Metadata in the requested format.
Throws:
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.

getSacMetadataAsResource

public Resource getSacMetadataAsResource(java.lang.String sacEndpoint)
                                  throws SacClientException
SAC method to retrieve any metadata associated with the SAC. Returns the metadata in Jena Resource format.

Specified by:
getSacMetadataAsResource in interface SacClient
Parameters:
sacEndpoint - The URL of the SAC whose metadata is to be retrieved.
Returns:
A Jena Resource containing the SAC Metadata.
Throws:
SacClientException - if anything goes wrong, with an explanation of the problem in the exception message.

getSacContent

public java.lang.String getSacContent(java.lang.String sacEndpoint)
                               throws SacClientConnectionException,
                                      SacClientTargetException,
                                      SacClientException
SAC method to retrieve the content of a SAC. Returns the content in RDF XML format.

Specified by:
getSacContent in interface SacClient
Parameters:
sacEndpoint - The URL of the SAC whose content is to be retrieved.
Returns:
A String containing the entire SAC contents in RDF XML format.
Throws:
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.

getSacContent

public java.lang.String getSacContent(java.lang.String sacEndpoint,
                                      java.lang.String mimeType)
                               throws SacClientConnectionException,
                                      SacClientTargetException,
                                      SacClientException
SAC method to retrieve the content of a SAC. Returns the content in the requested format.

Specified by:
getSacContent in interface SacClient
Parameters:
sacEndpoint - 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
Returns:
A String containing the entire SAC contents in the requested format.
Throws:
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.

getSacContentAsResource

public Resource getSacContentAsResource(java.lang.String sacEndpoint)
                                 throws SacClientException
SAC method to retrieve the content of a SAC. Returns the content in Jena Resource format.

Specified by:
getSacContentAsResource in interface SacClient
Parameters:
sacEndpoint - The URL of the SAC whose content is to be retrieved.
Returns:
A Jena Resource containing the entire SAC contents.
Throws:
SacClientException - if anything goes wrong, with an explanation of the problem in the exception message.

addClaim

public java.lang.String addClaim(java.lang.String sacEndpoint,
                                 java.lang.String claimXmlString,
                                 java.lang.String mimeType)
                          throws SacClientConnectionException,
                                 SacClientTargetException,
                                 SacClientException
SAC method to add a new claim to a SAC. Returns the ID of the created claim (a URI by which the claim can be retrieved).

Specified by:
addClaim in interface SacClient
Parameters:
sacEndpoint - The URL of the SAC whose metadata is to be retrieved.
claimXmlString - The claim to be added to the SAC
mimeType - The type of the supplied claim This must be one of SacClient.RDF_XML_CONTENT, SacClient.RDF_TEXT_CONTENT, SacClient.TURTLE_CONTENT
Returns:
A String containing the URL of the created claim.
Throws:
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.

replaceClaim

public void replaceClaim(java.lang.String claimID,
                         java.lang.String claimXmlString,
                         java.lang.String mimeType)
                  throws SacClientConnectionException,
                         SacClientTargetException,
                         SacClientException
SAC method to replace a pre-existing claim. Returns the ID of the created claim (a URL by which the claim can be retrieved).

Specified by:
replaceClaim in interface SacClient
Parameters:
claimID - The ID (a URL) of the claim to be replaced.
claimXmlString - The claim to be added to the SAC
mimeType - The type of the supplied claim This must be one of SacClient.RDF_XML_CONTENT, SacClient.RDF_TEXT_CONTENT, SacClient.TURTLE_CONTENT
Throws:
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.

getClaim

public java.lang.String getClaim(java.lang.String claimID)
                          throws SacClientConnectionException,
                                 SacClientTargetException,
                                 SacClientException
SAC method to retrieve the claim at the specified URL. Returns the claim in RDF XML format.

Specified by:
getClaim in interface SacClient
Parameters:
claimID - The ID (a URL) of the claim to be retrieved.
Returns:
A String containing the retrieved claim.
Throws:
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.

getClaim

public java.lang.String getClaim(java.lang.String claimID,
                                 java.lang.String mimeType)
                          throws SacClientConnectionException,
                                 SacClientTargetException,
                                 SacClientException
SAC method to retrieve the claim at the specified URL. Returns the claim in the requested format.

Specified by:
getClaim in interface SacClient
Parameters:
claimID - 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
Returns:
A String containing the URL of the created claim.
Throws:
SacClientException - if anything goes wrong, with an explanation of the problem in the exception message.
SacClientConnectionException
SacClientTargetException

getClaimAsResource

public Resource getClaimAsResource(java.lang.String claimID)
                            throws SacClientException
SAC method to retrieve the claim at the specified URL. Returns the claim as a Jena Resource.

Specified by:
getClaimAsResource in interface SacClient
Parameters:
claimID - The ID (a URL) of the claim to be retrieved.
Returns:
A Jena Resource containing the retrieved claim.
Throws:
SacClientException - if anything goes wrong, with an explanation of the problem in the exception message.

deleteClaim

public void deleteClaim(java.lang.String claimID)
                 throws SacClientConnectionException,
                        SacClientTargetException,
                        SacClientException
SAC method to delete the claim at the specified URL.

Specified by:
deleteClaim in interface SacClient
Parameters:
claimID - The ID (a URL) of the claim to be deleted.
Throws:
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.

runQuery

public java.lang.String runQuery(java.lang.String sacEndpoint,
                                 java.lang.String queryString,
                                 java.lang.String mimeType)
                          throws SacClientConnectionException,
                                 SacClientTargetException,
                                 SacClientException
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.

Specified by:
runQuery in interface SacClient
Parameters:
sacEndpoint - 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,
Returns:
A String containing the query results in the requested format.
Throws:
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.

allowDelegationFrom

public void allowDelegationFrom(java.lang.String sacEndpoint,
                                java.lang.String fromSacEndpoint)
                         throws SacClientConnectionException,
                                SacClientTargetException,
                                SacClientException
SAC administration method to enable query forwarding (delegation) to be accepted from a given SAC.

Specified by:
allowDelegationFrom in interface SacClient
Parameters:
sacEndpoint - 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.
Throws:
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.

denyDelegationFrom

public void denyDelegationFrom(java.lang.String sacEndpoint,
                               java.lang.String fromSacEndpoint)
                        throws SacClientConnectionException,
                               SacClientTargetException,
                               SacClientException
SAC administration method to prevent query forwarding (delegation) from being accepted from a given SAC.

Specified by:
denyDelegationFrom in interface SacClient
Parameters:
sacEndpoint - 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.
Throws:
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.

addDelegationTo

public void addDelegationTo(java.lang.String sacEndpoint,
                            java.lang.String toSacEndpoint)
                     throws SacClientConnectionException,
                            SacClientTargetException,
                            SacClientException
SAC administration method to enable query forwarding (delegation) to a given SAC.

Specified by:
addDelegationTo in interface SacClient
Parameters:
sacEndpoint - The URL of the endpoint of the SAC to be administered.
toSacEndpoint - The URL of the endpoint of the SAC to be delegated to.
Throws:
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.

dropDelegationTo

public void dropDelegationTo(java.lang.String sacEndpoint,
                             java.lang.String toSacEndpoint)
                      throws SacClientConnectionException,
                             SacClientTargetException,
                             SacClientException
SAC administration method to disable query forwarding (delegation) to a given SAC.

Specified by:
dropDelegationTo in interface SacClient
Parameters:
sacEndpoint - 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.
Throws:
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.

getSacListingEndpoint

protected java.lang.String getSacListingEndpoint(java.lang.String metaSacEndpoint)
Helper method to construct the RESTful endpoint for viewing QSAC MetaSAC contents.

Parameters:
metaSacEndpoint - The URL of the MetaSAC
Returns:
A String containing the target endpoint

getSacEndpoint

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. QSAC MetaSAC contents.

Parameters:
metaSacEndpoint - The URL of the MetaSAC
sacName - The name of the SAC
Returns:
A String containing the target endpoint

getConnection

protected java.net.HttpURLConnection getConnection(java.lang.String endpointUrlString)
                                            throws SacClientException,
                                                   java.net.MalformedURLException
Helper method to open an HTTP connection to a specified endpoint.

Parameters:
endpointUrlString - The URL to be connected to
Returns:
An open HttpURLConnection to the specified endpoint
Throws:
java.net.MalformedURLException - if the URL is bad
SacClientException - if the connection fails

readConnectionInput

protected java.lang.String readConnectionInput(java.net.HttpURLConnection httpConnection)
                                        throws java.io.IOException
Helper method to read any available input stream from an open HTTP connection.

Parameters:
httpConnection - The HTTP connection to be read from
Returns:
A String containing any data read from the connection
Throws:
java.io.IOException - if the read fails

readConnectionError

protected java.lang.String readConnectionError(java.net.HttpURLConnection httpConnection)
                                        throws java.io.IOException
Helper method to read any available error stream data from an open HTTP connection.

Parameters:
httpConnection - The HTTP connection to be read from
Returns:
A String containing any error data read from the connection
Throws:
java.io.IOException - if the read fails

tryForErrorMessage

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.

Parameters:
httpConnection - The HTTP connection to be read from
Returns:
A String containing any information read from the connection

updateSacMetadata

protected void updateSacMetadata(java.lang.String sacEndpoint,
                                 java.lang.String changeset)
                          throws SacClientException
Helper method to submit changed SAC metadata.

Parameters:
sacEndpoint - The URL of the endpoint of the SAC to be administered.
changeset - The Talis changeset containing the metadata change.
Throws:
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.