nyla.solutions.commas.json.JsonBridge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nyla.solutions.commas Show documentation
Show all versions of nyla.solutions.commas Show documentation
Command pattern implementation for building services.
The newest version!
package nyla.solutions.commas.json;
import java.io.Serializable;
import java.util.Map;
import nyla.solutions.commas.Command;
import nyla.solutions.commas.CommasBridge;
import nyla.solutions.commas.CommasConstants;
import nyla.solutions.commas.ContentType;
import nyla.solutions.core.data.Envelope;
import nyla.solutions.core.util.Config;
import nyla.solutions.global.json.JSON;
/**
*
* The JSON Bridge will provide a way for JSON based applications to call commands.
* The JSON Bridge can be executed from a Java based client application.
*
* The JSON Bridge will allow a Adapter to simply pass the data represented as JSON to the JSON Bridge. It uses the Grid Enterprise Data Integration to plug-in custom JSON transformation. This custom transformation will convert the JSON to and from grid Java objects.
* Design Benefits
* - Allows JSON client applications to use existing JSON data to make function calls
* - Minimized changes needed to the clients for data changes
* - Reuses the Command bridge design pattern
*
* @author Gregory Green
* @author Rick Farmer
*
*/
public class JsonBridge extends CommasBridge
{
/**
* Execute a JSON based function
* @param functionName the function to execute
* @param json the JSON file
* @return the JSON result
*/
public static String executeCommand(String commandName, String jsonText)
{
//Create envelope
Envelope env = new Envelope();
constructAuthIdentity(env,actor);
env.setPayload(jsonText);
Map