All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.chilldev.commons.jsonrpc.client.VersionAware Maven / Gradle / Ivy

Go to download

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.client;

import pl.chilldev.commons.jsonrpc.rpc.introspector.JsonRpcCall;

/**
 * Mixin for version-aware service client.
 */
public interface VersionAware
{
    /**
     * Version placeholder to use when no server is available.
     */
    String OFFLINE_VERSION = "OFFLINE";

    /**
     * Executed version request.
     *
     * @return Version returned by server.
     * @throws RpcCallException When remote call fails.
     */
    @JsonRpcCall
    String version();

    /**
     * Returns service version.
     *
     * @return Version string.
     */
    default String getVersion()
    {
        try {
            return this.version();
        } catch (RpcCallException error) {
            return VersionAware.OFFLINE_VERSION;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy