JBoss.orgCommunity Documentation
In eXo Knowledge, data injectors are implemented as plugins attached to the org.exoplatform.services.bench.DataInjectorService service. This service is normally registered to the portal container as a general component and handled via RESTful requests.
To use this service, add the following dependency to the Classpath of the server:
<dependency>
<groupId>org.exoplatform.commons</groupId>
<artifactId>exo.platform.commons.component</artifactId>
<version>1.1.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
When you want to inject data for a specified product, you will have to implement a class which extends org.exoplatform.services.bench.DataInjector and register it to DataInjectorService as a plugin.
In which, methods need to be installed are:
public abstract class DataInjector extends BaseComponentPlugin {
/**
* get log object.
* @return
*/
public abstract Log getLog();
/**
* This function should be implemented to execute tasks that require to response data to client.
* <br>
* @param params query parameters of a HTTP GET request.
* @return object that can be serialized to JSON object.
* @throws Exception
*/
public abstract Object execute(HashMap<String , String> params) throws Exception;
/**
* This function should be implemented to inject data into the product.
* @param params parameters for injecting. They can be query parameters of a HTTP GET request.
* @throws Exception
*/
public abstract void inject(HashMap<String , String> params) throws Exception;
/**
* This function should be implemented to clear data that is injected before by {@link #inject()}.
* @param params parameters for rejecting. They can be query parameters of a HTTP GET request.
* @throws Exception
*/
public abstract void reject(HashMap<String , String> params) throws Exception;