org.wso2.carbon.dataservices.task
Class DataTaskContext

java.lang.Object
  extended by org.wso2.carbon.dataservices.task.DataTaskContext

public class DataTaskContext
extends Object

This class represents a context class used in data tasks.


Constructor Summary
DataTaskContext(int tid)
           
 
Method Summary
 org.apache.axiom.om.OMElement accessResource(String serviceName, String resourcePath, Map<String,org.wso2.carbon.dataservices.core.engine.ParamValue> params, String accessMethod)
          Accesses a data services resource.
 boolean checkServices(String... services)
          Checks if the given services are available.
 Map<String,String> getDataTaskProperties()
           
 void invokeOperation(String serviceName, String operationName, List<Map<String,org.wso2.carbon.dataservices.core.engine.ParamValue>> batchParams)
          Invokes a batch data service operation
 org.apache.axiom.om.OMElement invokeOperation(String serviceName, String operationName, Map<String,org.wso2.carbon.dataservices.core.engine.ParamValue> params)
          Invokes a single data service operation.
 void setDataServicesUser(String username, String password)
          Sets the Carbon user for the current thread of execution.
 void setDataTaskProperties(Map<String,String> dataTaskProperties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataTaskContext

public DataTaskContext(int tid)
Method Detail

checkServices

public boolean checkServices(String... services)
Checks if the given services are available.

Parameters:
services - An array of service names to be checked
Returns:
Returns true if all the given services are available

invokeOperation

public org.apache.axiom.om.OMElement invokeOperation(String serviceName,
                                                     String operationName,
                                                     Map<String,org.wso2.carbon.dataservices.core.engine.ParamValue> params)
                                              throws org.wso2.carbon.dataservices.core.DataServiceFault
Invokes a single data service operation.

Parameters:
serviceName - The name of the data service
operationName - The data service operation name
params - The parameters to be passed into the operation
Returns:
The result from the service call, if any available, or returns null, if it is an in-only operation
Throws:
org.wso2.carbon.dataservices.core.DataServiceFault - If an error occurs in the service invocation

invokeOperation

public void invokeOperation(String serviceName,
                            String operationName,
                            List<Map<String,org.wso2.carbon.dataservices.core.engine.ParamValue>> batchParams)
                     throws org.wso2.carbon.dataservices.core.DataServiceFault
Invokes a batch data service operation

Parameters:
serviceName - The name of the data service
operationName - The data service batch operation name
batchParams - The batch parameters to be passed into the operation
Throws:
org.wso2.carbon.dataservices.core.DataServiceFault - If an error occurs in the service invocation

accessResource

public org.apache.axiom.om.OMElement accessResource(String serviceName,
                                                    String resourcePath,
                                                    Map<String,org.wso2.carbon.dataservices.core.engine.ParamValue> params,
                                                    String accessMethod)
                                             throws org.wso2.carbon.dataservices.core.DataServiceFault
Accesses a data services resource.

Parameters:
serviceName - The name of the data service
resourcePath - The resource path used to access the resource
params - The parameters passed into the resource access
accessMethod - The HTTP access method
Returns:
The result from the resource access, if any available, or else null
Throws:
org.wso2.carbon.dataservices.core.DataServiceFault - If an error occurs in the service invocation

setDataServicesUser

public void setDataServicesUser(String username,
                                String password)
                         throws org.wso2.carbon.dataservices.core.DataServiceFault
Sets the Carbon user for the current thread of execution.

Parameters:
username - The username
password - The password
Throws:
org.wso2.carbon.dataservices.core.DataServiceFault - If an error occurs in the service invocation

getDataTaskProperties

public Map<String,String> getDataTaskProperties()

setDataTaskProperties

public void setDataTaskProperties(Map<String,String> dataTaskProperties)


Copyright © 2015 WSO2. All rights reserved.