
pl.chilldev.commons.jsonrpc.rpc.handler.VersionHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-jsonrpc Show documentation
Show all versions of commons-jsonrpc Show documentation
Bridge library that helps building JSON-RPC daemons using Apache MINA and JSON-RPC 2.0 Base libraries.
The newest version!
/**
* This file is part of the ChillDev-Commons.
*
* @license http://mit-license.org/ The MIT license
* @copyright 2015 © by Rafał Wrzeszcz - Wrzasq.pl.
*/
package pl.chilldev.commons.jsonrpc.rpc.handler;
// dependencies and sub-modules
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
import pl.chilldev.commons.daemon.Package;
import pl.chilldev.commons.jsonrpc.daemon.ContextInterface;
import pl.chilldev.commons.jsonrpc.rpc.ReturningMethod;
/**
* General JSON-RPC version() call.
*
*
* Request params:
* none
*
*
*
* Response:
* string
(version)
*
*/
public class VersionHandler
implements
ReturningMethod
{
/**
* Application package data.
*/
private Package metadata;
/**
* Default version initialization.
*/
public VersionHandler()
{
this(Package.DEFAULT_PACKAGE);
}
/**
* Initializes version handler with given package metadata.
*
* @param metadata Package metadata.
*/
public VersionHandler(Package metadata)
{
this.metadata = metadata;
}
/**
* Handles request.
*
* @param request Request call.
* @param context Execution context.
* @return Call results.
*/
@Override
public Object process(JSONRPC2Request request, ContextInterface context)
{
return this.metadata.getVersion();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy