com.hp.hpl.jena.sparql.modify
Class UpdateProcessRemoteBase

java.lang.Object
  extended by com.hp.hpl.jena.sparql.modify.UpdateProcessRemoteBase
All Implemented Interfaces:
UpdateProcessor
Direct Known Subclasses:
UpdateProcessRemote, UpdateProcessRemoteForm

public abstract class UpdateProcessRemoteBase
extends Object
implements UpdateProcessor

Abstract base class for update processors that perform remote updates over HTTP


Field Summary
static Symbol HTTP_CONTEXT
          Symbol used to set a HttpContext which will be used for HTTP requests
 
Constructor Summary
UpdateProcessRemoteBase(UpdateRequest request, String endpoint, Context context)
          Creates a new remote update processor
 
Method Summary
 void addDefaultGraph(String defaultGraph)
          Adds a default graph
 void addNamedGraph(String namedGraph)
          Adds a named graph
 void addParam(String field, String value)
          Adds a custom parameter to the request
 HttpAuthenticator getAuthenticator()
          Gets the authenticator that has been set (if any)
 Context getContext()
          The properties associated with a query execution - implementation specific parameters This includes Java objects (so it is not an RDF graph).
 String getEndpoint()
          Gets the endpoint
 GraphStore getGraphStore()
          The dataset against which the query will execute.
 org.apache.http.protocol.HttpContext getHttpContext()
          Convenience method to get the HttpContext
 Params getParams()
          Gets the parameters for the execution
 String getQueryString()
          Gets the generated query string portion of the endpoint URL if applicable
 UpdateRequest getUpdateRequest()
          Gets the update request
 boolean isUsingAuthentication()
          Gets whether any authenticator has been set
 void setAuthentication(String username, char[] password)
          Sets authentication credentials for remote updates
 void setAuthenticator(HttpAuthenticator authenticator)
          Sets the authenticator to use
 void setDefaultGraphs(List<String> defaultGraphs)
          Sets the default graphs
 void setHttpContext(org.apache.http.protocol.HttpContext httpContext)
          Convenience method to set the HttpContext
 void setNamedGraphs(List<String> namedGraphs)
          Sets the named graphs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.update.UpdateProcessor
execute
 

Field Detail

HTTP_CONTEXT

public static final Symbol HTTP_CONTEXT
Symbol used to set a HttpContext which will be used for HTTP requests

Constructor Detail

UpdateProcessRemoteBase

public UpdateProcessRemoteBase(UpdateRequest request,
                               String endpoint,
                               Context context)
Creates a new remote update processor

Parameters:
request - Update request
endpoint - Update endpoint
context - Context
Method Detail

getGraphStore

public GraphStore getGraphStore()
Description copied from interface: UpdateProcessor
The dataset against which the query will execute. May be null, implying the there isn't a local GraphStore target for this UpdateProcessor.

Specified by:
getGraphStore in interface UpdateProcessor

getEndpoint

public String getEndpoint()
Gets the endpoint

Returns:
Endpoint URI

getQueryString

public String getQueryString()
Gets the generated query string portion of the endpoint URL if applicable

Generated string will not include leading ? so that consuming code can decide whether to add this themselves since the generated query string may be being used in addition to an existing query string.

Returns:
Generated query string

getParams

public Params getParams()
Gets the parameters for the execution

Returns:
Parameters

getUpdateRequest

public UpdateRequest getUpdateRequest()
Gets the update request

Returns:
Update request

addDefaultGraph

public void addDefaultGraph(String defaultGraph)
Adds a default graph

Parameters:
defaultGraph - Default Graph URI

addNamedGraph

public void addNamedGraph(String namedGraph)
Adds a named graph

Parameters:
namedGraph - Named Graph URi

addParam

public void addParam(String field,
                     String value)
Adds a custom parameter to the request

Parameters:
field - Field
value - Value

setDefaultGraphs

public void setDefaultGraphs(List<String> defaultGraphs)
Sets the default graphs

Parameters:
defaultGraphs - Default Graphs

setNamedGraphs

public void setNamedGraphs(List<String> namedGraphs)
Sets the named graphs

Parameters:
namedGraphs - Named Graphs

setHttpContext

public void setHttpContext(org.apache.http.protocol.HttpContext httpContext)
Convenience method to set the HttpContext

Parameters:
httpContext - HTTP Context

getHttpContext

public org.apache.http.protocol.HttpContext getHttpContext()
Convenience method to get the HttpContext

Returns:
HttpContext

getContext

public Context getContext()
Description copied from interface: UpdateProcessor
The properties associated with a query execution - implementation specific parameters This includes Java objects (so it is not an RDF graph). Keys should be URIs as strings. May be null (this implementation does not provide any configuration).

Specified by:
getContext in interface UpdateProcessor

setAuthentication

public void setAuthentication(String username,
                              char[] password)
Sets authentication credentials for remote updates

May be better to use setAuthenticator(HttpAuthenticator) as that allows for more complex authentication to be used

Parameters:
username - User name
password - Password

setAuthenticator

public void setAuthenticator(HttpAuthenticator authenticator)
Sets the authenticator to use

Note that you can globally set an authenticator via HttpOp.setDefaultAuthenticator(HttpAuthenticator) to avoid the need to set authentication on a per-request basis

Parameters:
authenticator - HTTP Authenticator

getAuthenticator

public HttpAuthenticator getAuthenticator()
Gets the authenticator that has been set (if any)

If no authenticator is used then the default authenticator will be used, this can be configured via the HttpOp.setDefaultAuthenticator(HttpAuthenticator) method.

Returns:
HTTP Authenticator if set, null otherwise

isUsingAuthentication

public boolean isUsingAuthentication()
Gets whether any authenticator has been set

Returns:
True if an authenticator has been set, false otherwise


Licenced under the Apache License, Version 2.0