Search in sources :

Example 1 with ModuleService

use of io.nuls.core.module.service.ModuleService in project nuls by nuls-io.

the class SystemResource method startModule.

@POST
@Path("/module/load")
@Produces(MediaType.APPLICATION_JSON)
public RpcResult startModule(@FormParam("moduleName") String moduleName, @FormParam("moduleClass") String moduleClass) {
    // todo change the params to a form entity
    RpcResult result = null;
    do {
        ModuleService service = ModuleService.getInstance();
        AssertUtil.canNotEmpty(service, "System module service error!");
        try {
            service.startModule(moduleName, moduleClass);
        } catch (IllegalAccessException e) {
            Log.error(e);
            break;
        } catch (InstantiationException e) {
            Log.error(e);
            break;
        } catch (ClassNotFoundException e) {
            Log.error(e);
            break;
        }
        result = RpcResult.getSuccess();
    } while (false);
    return result;
}
Also used : ModuleService(io.nuls.core.module.service.ModuleService) RpcResult(io.nuls.rpc.entity.RpcResult)

Aggregations

ModuleService (io.nuls.core.module.service.ModuleService)1 RpcResult (io.nuls.rpc.entity.RpcResult)1