com.almende.eve.protocol.jsonrpc.JSONRpcProtocolBuilder Maven / Gradle / Ivy
The newest version!
/*
* Copyright: Almende B.V. (2014), Rotterdam, The Netherlands
* License: The Apache Software License, Version 2.0
*/
package com.almende.eve.protocol.jsonrpc;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.almende.eve.capabilities.AbstractCapabilityBuilder;
import com.almende.eve.capabilities.handler.Handler;
import com.almende.eve.protocol.auth.Authorizor;
import com.almende.util.TypeUtil;
import com.almende.util.uuid.UUID;
/**
* The Class JSONRpcProtocolBuilder.
*/
public class JSONRpcProtocolBuilder extends
AbstractCapabilityBuilder {
private static final Logger LOG = Logger.getLogger(JSONRpcProtocolBuilder.class
.getName());
private static final TypeUtil> TYPEUTIL = new TypeUtil>() {};
private static final Map INSTANCES = new HashMap();
/*
* (non-Javadoc)
* @see
* com.almende.eve.capabilities.CapabilityService#get(com.fasterxml.jackson.
* databind
* .JsonNode, com.almende.eve.capabilities.handler.Handler, java.lang.Class)
*/
@Override
public JSONRpcProtocol build() {
JSONRpcProtocolConfig config = new JSONRpcProtocolConfig(getParams());
String id = config.getId();
if (id == null) {
id = new UUID().toString();
LOG.warning("Parameter 'id' is required for JSONRpcProtocol. (giving temporary name: "
+ id + ")");
}
JSONRpcProtocol result;
if (INSTANCES.containsKey(id)) {
result = INSTANCES.get(id);
final Handler
© 2015 - 2025 Weber Informatics LLC | Privacy Policy