public class ServiceInvoker extends Object
ServiceDescriptor
.
This class divides the input
ServiceParam
s defined by the
ServiceDescriptor
into three different categories
according to how their values are acquired at service invocation time:
The DataLink-1.0 standard is not very explicit about this distinction, but the above division appears(?) to be the consensus of the standard authors. This does not however prevent service invocations filling these parameter values differently than according to the above outline. For instance, users may be given the option to change the values of fixed or row parameters for a given invocation.
Constructor and Description |
---|
ServiceInvoker(ServiceDescriptor descriptor,
StarTable resultTable)
Attempts to construct an invoker based on
a service descriptor and an associated results table.
|
Modifier and Type | Method and Description |
---|---|
URL |
completeUrl(Map<ServiceParam,String> paramMap)
Assembles an invocation URL from the base URL of this service and any
name-value pairs supplied in a given map.
|
Map<ServiceParam,String> |
getFixedParamMap()
Returns a parameter-value map for the fixed parameters.
|
ServiceParam[] |
getFixedParams()
Returns the 'fixed' parameters of this service.
|
Map<ServiceParam,String> |
getRowParamMap(Object[] row)
Constructs a parameter-value map for the row parameters
at a given table row.
|
ServiceParam[] |
getRowParams()
Returns the 'row' parameters of this service.
|
ServiceDescriptor |
getServiceDescriptor()
Returns this invoker's service descriptor.
|
URL |
getUrl(Object[] row,
Map<ServiceParam,String> userParamMap)
Assembles an invocation URL from the base URL of this service,
the values of any row parameters corresponding to a supplied
table row, and any additional parameters supplied explicitly.
|
ServiceParam[] |
getUserParams()
Returns the 'user' parameters of this service.
|
public ServiceInvoker(ServiceDescriptor descriptor, StarTable resultTable) throws MalformedURLException, IOException
descriptor
- service descriptorresultTable
- result table corresponding to the descriptorMalformedURLException
- if the descriptor's accessUrl is no goodIOException
- if the descriptor references a column that is
not present in the result tablepublic ServiceDescriptor getServiceDescriptor()
public ServiceParam[] getRowParams()
public ServiceParam[] getFixedParams()
public ServiceParam[] getUserParams()
public Map<ServiceParam,String> getFixedParamMap()
public Map<ServiceParam,String> getRowParamMap(Object[] row)
row
- a row of cell values from this invoker's tablepublic URL completeUrl(Map<ServiceParam,String> paramMap)
?n1=v1&n2=v2
".paramMap
- map representing parameter values to be
appended to this service's base URLpublic URL getUrl(Object[] row, Map<ServiceParam,String> userParamMap)
This utility method calls the methods
getRowParamMap
,
getFixedParamMap
and
completeUrl
.
row
- table rowuserParamMap
- additional non-'row' parameter-value pairs,
usually corresponding to the 'user' parametersCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.