Package org.lockss.ws
Class BaseServiceImpl
java.lang.Object
org.lockss.spring.base.BaseSpringApiServiceImpl
org.lockss.ws.BaseServiceImpl
- All Implemented Interfaces:
LockssConfigurableService
- Direct Known Subclasses:
AuControlServiceImpl,ContentConfigurationServiceImpl,ContentServiceImpl,DaemonStatusServiceImpl,ExportServiceImpl,HasherServiceImpl,ImportServiceImpl
Base class for the various SOAP web service implementations.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.lockss.spring.base.BaseSpringApiServiceImpl
BaseSpringApiServiceImpl.MapMessageListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longstatic final longstatic final longstatic final Stringstatic final StringConnection timeout.static final StringRead timeout.static final StringRepository namespace.static final Stringprotected longprotected Stringprotected org.springframework.web.client.RestTemplateFields inherited from class org.lockss.spring.base.BaseSpringApiServiceImpl
DEFAULT_CONFIG_WAIT_TIME, DEFAULT_READY_WAIT_TIME, JMS_BOTH, JMS_RECEIVE, JMS_SEND, jmsConsumer, jmsProducer, PARAM_CONFIG_WAIT_TIME, PARAM_READY_WAIT_TIME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> org.springframework.http.ResponseEntity<String>callRestServiceEndpoint(String serviceUrl, String endPointPath, Map<String, String> uriVariables, Map<String, String> queryParams, org.springframework.http.HttpMethod httpMethod, T body, String exceptionMessage) Makes a call to a REST service endpoint.protected <T> org.springframework.http.ResponseEntity<String>callRestServiceUri(String uriString, Map<String, String> uriVariables, Map<String, String> queryParams, org.springframework.http.HttpMethod httpMethod, org.springframework.http.HttpHeaders requestHeaders, T body, String exceptionMessage) Makes a call to a REST service URI.protected <T> org.springframework.http.ResponseEntity<String>callRestServiceUri(String uriString, Map<String, String> uriVariables, Map<String, String> queryParams, org.springframework.http.HttpMethod httpMethod, T body, String exceptionMessage) Makes a call to a REST service URI.protected org.springframework.http.HttpHeadersprotected LongProvides the configured connection timeout in milliseconds.protected <T> org.lockss.util.rest.multipart.MultipartResponsegetMultipartResponse(String serviceUrl, String endPointPath, Map<String, String> uriVariables, Map<String, String> queryParams, org.springframework.http.HttpHeaders requestHeaders, org.springframework.http.HttpMethod httpMethod, T body) Makes a call to a REST service endpoint that returns a multipart response.protected LongProvides the configured read timeout in milliseconds.protected static StringProvides the requestor IP of the current SOAP request messageprotected org.lockss.util.rest.repo.RestLockssRepositoryProvides access to the REST Repository service.protected org.lockss.app.ServiceBindinggetServiceBinding(org.lockss.app.ServiceDescr sd) getServiceEndpoint(org.lockss.app.ServiceDescr sd) protected static StringProvides the Authorization header in the current SOAP request message, if any.protected static String[]Provides the credentials in the current SOAP request message, if any.protected static StringBuilderseparatedString(Collection c, String separatorFirst, String separatorInner, String separatorLast, StringBuilder sb) Concatenate elements of collection into string, adding separators, delimiting each elementvoidsetConfig(org.lockss.config.Configuration newConfig, org.lockss.config.Configuration prevConfig, org.lockss.config.Configuration.Differences changedKeys) Methods inherited from class org.lockss.spring.base.BaseSpringApiServiceImpl
configMgrCreated, getClassName, getConfigWaitTime, getJMSManager, getPluginManager, getReadyWaitTime, getRunningLockssDaemon, getStateManager, getWaitTime, jmsSetUpDone, jsonResponse, receiveMessage, registerConfigCallback, setUpJms, setUpJms, setUpJms, stopJms, stringResponse, waitConfig, waitConfig, waitReady, waitReady
-
Field Details
-
PREFIX
- See Also:
-
PARAM_REPO_NAMESPACE
Repository namespace.- See Also:
-
DEFAULT_REPO_NAMESPACE
-
PARAM_CONNECTION_TIMEOUT
Connection timeout.- See Also:
-
DEFAULT_CONNECTION_TIMEOUT
public static final long DEFAULT_CONNECTION_TIMEOUT- See Also:
-
PARAM_READ_TIMEOUT
Read timeout.- See Also:
-
DEFAULT_READ_TIMEOUT
public static final long DEFAULT_READ_TIMEOUT- See Also:
-
restTemplate
@Autowired protected org.springframework.web.client.RestTemplate restTemplate -
connectionTimeout
protected long connectionTimeout -
readTimeout
protected long readTimeout -
repoNamespace
-
-
Constructor Details
-
BaseServiceImpl
public BaseServiceImpl()
-
-
Method Details
-
getServiceBinding
protected org.lockss.app.ServiceBinding getServiceBinding(org.lockss.app.ServiceDescr sd) -
getServiceEndpoint
-
getConnectionTimeout
Provides the configured connection timeout in milliseconds.- Returns:
- a Long with the configured connection timeout in milliseconds.
-
getReadTimeout
Provides the configured read timeout in milliseconds.- Returns:
- a Long with the configured read timeout in milliseconds.
-
getAuthHeaders
protected org.springframework.http.HttpHeaders getAuthHeaders() -
getSoapRequestAuthorizationHeader
Provides the Authorization header in the current SOAP request message, if any.- Returns:
- a String with the Authorization header.
-
getRequestorIpAddress
Provides the requestor IP of the current SOAP request message- Returns:
- a String with the requestor IP.
-
getRestLockssRepository
protected org.lockss.util.rest.repo.RestLockssRepository getRestLockssRepository() throws MalformedURLExceptionProvides access to the REST Repository service.- Returns:
- a RestLockssRepository that allows access to the REST Repository service.
- Throws:
MalformedURLException- if there are problems with the REST Repository service URL.
-
getSoapRequestCredentials
Provides the credentials in the current SOAP request message, if any.- Returns:
- a String[] with the credentials.
-
callRestServiceEndpoint
protected <T> org.springframework.http.ResponseEntity<String> callRestServiceEndpoint(String serviceUrl, String endPointPath, Map<String, String> uriVariables, Map<String, throws org.lockss.util.rest.exception.LockssRestExceptionString> queryParams, org.springframework.http.HttpMethod httpMethod, T body, String exceptionMessage) Makes a call to a REST service endpoint.- Parameters:
serviceUrl- A String with the URL of the service.endPointPath- A String with the URI path to the endpoint.uriVariables- A Map<String, String> with any variables to be interpolated in the URI.queryParams- A Map<String, String> with any query parameters.httpMethod- An HttpMethod with HTTP method used to make the call to the REST service.body- A T with the contents of the body to be included with the request, if any.exceptionMessage- A String with the message to be returned with any exception.- Returns:
- a ResponseEntity
with the response from the REST service. - Throws:
org.lockss.util.rest.exception.LockssRestException- if any problems arise in the call to the REST service.
-
callRestServiceUri
protected <T> org.springframework.http.ResponseEntity<String> callRestServiceUri(String uriString, Map<String, String> uriVariables, Map<String, throws org.lockss.util.rest.exception.LockssRestExceptionString> queryParams, org.springframework.http.HttpMethod httpMethod, T body, String exceptionMessage) Makes a call to a REST service URI.- Parameters:
uriString- A String with the URI of the request to the REST service.uriVariables- A Map<String, String> with any variables to be interpolated in the URI.queryParams- A Map<String, String> with any query parameters.httpMethod- An HttpMethod with HTTP method used to make the call to the REST service.body- A T with the contents of the body to be included with the request, if any.exceptionMessage- A String with the message to be returned with any exception.- Returns:
- a ResponseEntity
with the response from the REST service. - Throws:
org.lockss.util.rest.exception.LockssRestException- if any problems arise in the call to the REST service.
-
callRestServiceUri
protected <T> org.springframework.http.ResponseEntity<String> callRestServiceUri(String uriString, Map<String, String> uriVariables, Map<String, throws org.lockss.util.rest.exception.LockssRestExceptionString> queryParams, org.springframework.http.HttpMethod httpMethod, org.springframework.http.HttpHeaders requestHeaders, T body, String exceptionMessage) Makes a call to a REST service URI.- Parameters:
uriString- A String with the URI of the request to the REST service.uriVariables- A Map<String, String> with any variables to be interpolated in the URI.queryParams- A Map<String, String> with any query parameters.httpMethod- An HttpMethod with HTTP method used to make the call to the REST service.requestHeaders- An HttpHeaders with HTTP request headers used to make the call to the REST service.body- A T with the contents of the body to be included with the request, if any.exceptionMessage- A String with the message to be returned with any exception.- Returns:
- a ResponseEntity
with the response from the REST service. - Throws:
org.lockss.util.rest.exception.LockssRestException- if any problems arise in the call to the REST service.
-
getMultipartResponse
protected <T> org.lockss.util.rest.multipart.MultipartResponse getMultipartResponse(String serviceUrl, String endPointPath, Map<String, String> uriVariables, Map<String, throws IOException, javax.mail.MessagingExceptionString> queryParams, org.springframework.http.HttpHeaders requestHeaders, org.springframework.http.HttpMethod httpMethod, T body) Makes a call to a REST service endpoint that returns a multipart response.- Parameters:
serviceUrl- A String with the URL of the service.endPointPath- A String with the URI path to the endpoint.uriVariables- A Map<String, String> with any variables to be interpolated in the URI.queryParams- A Map<String, String> with any query parameters.requestHeaders- An HttpHeaders with HTTP request headers used to make the call to the REST service.httpMethod- An HttpMethod with HTTP method used to make the call to the REST service.body- A T with the contents of the body to be included with the request, if any.- Returns:
- a MultipartResponse with the response from the REST service.
- Throws:
org.lockss.util.rest.exception.LockssRestException- if any problems arise in the call to the REST service.IOExceptionjavax.mail.MessagingException
-
separatedString
protected static StringBuilder separatedString(Collection c, String separatorFirst, String separatorInner, String separatorLast, StringBuilder sb) Concatenate elements of collection into string, adding separators, delimiting each element- Parameters:
c- - Collection of object (on which toString() will be called)separatorFirst- - String to place before first elementseparatorInner- - String with which to separate elementsseparatorLast- - String to place after last elementsb- - StringBuilder to write result into- Returns:
- sb
-
setConfig
public void setConfig(org.lockss.config.Configuration newConfig, org.lockss.config.Configuration prevConfig, org.lockss.config.Configuration.Differences changedKeys) - Specified by:
setConfigin interfaceLockssConfigurableService
-