public final class MethodFactory
extends java.lang.Object
createMethodCall
can be
used on direct object references and also ones that are not Service
-related.
So it might be used as a general mechanism for creating a method description to
execute through the CallObject
interface, and therefore on a separate thread.
Constructor and Description |
---|
MethodFactory()
Creates a new instance of MethodFactory.
|
Modifier and Type | Method and Description |
---|---|
static MethodInfo |
createMethodCall(java.lang.String methodName,
java.lang.String returnType,
java.lang.Object serviceObj,
java.util.ArrayList<java.lang.Object> parameters,
PasswordHandler passwordHandler)
Automatically construct the RPC-XML/Reflection method call from the parameter values entered.
|
static MethodInfo |
createObjectCall(java.lang.String methodName,
java.lang.String returnType,
java.lang.Object objToInvoke,
java.util.ArrayList<java.lang.Object> parameters)
Automatically construct the Reflection method info from the parameter values entered.
|
static WsMethodInfo |
createRestCall(java.lang.String endpointAddress,
java.lang.String query)
Create and return a method info object for invoking a web service using the REST protocol.
|
static WsMethodInfo |
createSoapCall(java.lang.String operationName,
boolean setRtn,
boolean paramValues,
LicasWsdlModel wsdlModel)
Create and return a method info object for invoking a web service using the SOAP protocol.
|
static WsMethodInfo |
createSoapCall(java.lang.String webService,
java.lang.String operation,
java.lang.String endpointAddress,
java.lang.String soapActionUri,
java.lang.String namespace,
java.util.ArrayList<WsdlParamInfo> parameters,
boolean setRtn)
Create and return a method info object for invoking a web service using the SOAP protocol.
|
static void |
mapToParams(MethodInfo methodInfo,
java.util.ArrayList<java.lang.Object> paramList)
Map and set parameter instance values in the related info objects.
|
static java.lang.Object |
parseReply(java.lang.Object reply)
Parse the reply back into n Object and return.
|
public static MethodInfo createObjectCall(java.lang.String methodName, java.lang.String returnType, java.lang.Object objToInvoke, java.util.ArrayList<java.lang.Object> parameters) throws java.lang.Exception
Service
-derived. So any other object, when no passwords are required.methodName
- the name of the method to call.returnType
- the return type for the call.objToInvoke
- the reference to the object to invoke. This should probably be
a direct reference to the Object itself and not Service
-derived.parameters
- the parameter list for the method to call.java.lang.Exception
- any error.public static MethodInfo createMethodCall(java.lang.String methodName, java.lang.String returnType, java.lang.Object serviceObj, java.util.ArrayList<java.lang.Object> parameters, PasswordHandler passwordHandler) throws java.lang.Exception
serviceObj
would typically be a reference to a licas Service
-derived object,
but does not have to be.methodName
- the name of the method to call.returnType
- the return type for the call.serviceObj
- the reference to the service to call. This can either be
a URI description as an XML element or a direct reference Object.parameters
- the parameter list for the method to call.passwordHandler
- the passwords that are required to make the call.
If passwordHandler
is null
then passwords are not checked for, but
remote access to any Service
-derived object will require passwords.java.lang.Exception
- any error.public static WsMethodInfo createSoapCall(java.lang.String operationName, boolean setRtn, boolean paramValues, LicasWsdlModel wsdlModel) throws java.lang.Exception
operationName
- the name of the operation to call.setRtn
- true if set the return Object type.paramValues
- if true add the parameter values as WsdlParamInfo
objects.wsdlModel
- the wsdl model that stores the description.java.lang.Exception
- any error.public static WsMethodInfo createSoapCall(java.lang.String webService, java.lang.String operation, java.lang.String endpointAddress, java.lang.String soapActionUri, java.lang.String namespace, java.util.ArrayList<WsdlParamInfo> parameters, boolean setRtn) throws java.lang.Exception
webService
- the service name.operation
- the name of the operation to call.endpointAddress
- the server endpoint address.soapActionUri
- soap action uri type.namespace
- ontology namespace.parameters
- list of WsdlParamInfo
objects that store parameter types and values.setRtn
- true if set the return Object type.java.lang.Exception
- any error.public static WsMethodInfo createRestCall(java.lang.String endpointAddress, java.lang.String query) throws java.lang.Exception
endpointAddress
- the server endpoint address.query
- the full REST-style query.java.lang.Exception
- any error.public static void mapToParams(MethodInfo methodInfo, java.util.ArrayList<java.lang.Object> paramList)
1. If the ParamInfo
objects of this method do not have names assigned, then
assign the first parameter value in the list to each one.
2. If the ParamInfo
objects of this method do have names try to map to the name.
2.1. If the paramList is a list of KeyValue
objects, then the related name can be mapped.
2.2. If the paramList is a list of objects, then assign the first one again.
3. A null value, evaluated by ObjectHandler
.isNull
will not be added.
So if names are tagged, they can be replaced from any position in the list,
but if names are missing, the first available value must be used. Safest is to have
a paramList
of KeyValue
objects and each MethodInfo
parameter
also assigned an identical name.
methodInfo
- the method info that gets its parameter list updated.paramList
- list of parameters, preferably as KeyValue
objects so that
they can be mapped across properly.public static java.lang.Object parseReply(java.lang.Object reply) throws java.lang.Exception
reply
- the method reply in some form.java.lang.Exception
- any error.