Package io.openraven.magpie.api
Class MagpieEnvelope
- java.lang.Object
-
- io.openraven.magpie.api.MagpieEnvelope
-
public class MagpieEnvelope extends Object
A Jackson-serializable envelope that is passed from layer to layer via plugin emitters and acceptors.- Author:
- Jason Nichols (jason@openraven.com)
-
-
Constructor Summary
Constructors Constructor Description MagpieEnvelope()MagpieEnvelope(Session session, List<String> pluginPath, com.fasterxml.jackson.databind.node.ObjectNode contents)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContentClass()com.fasterxml.jackson.databind.node.ObjectNodegetContents()Map<String,String>getMetadata()List<String>getPluginPath()The pluginPath list represents this envelope's path through the Magpie framework.SessiongetSession()static MagpieEnvelopeof(MagpieEnvelope current, String pluginId, com.fasterxml.jackson.databind.node.ObjectNode contents)IntermediatePluginimplementations should use this static factory method to create a new envelope that derives from an existing envelope.voidsetContentClass(String contentClass)voidsetContents(com.fasterxml.jackson.databind.node.ObjectNode contents)voidsetMetadata(Map<String,String> metadata)voidsetPluginPath(List<String> pluginPath)voidsetSession(Session session)
-
-
-
Method Detail
-
of
public static MagpieEnvelope of(MagpieEnvelope current, String pluginId, com.fasterxml.jackson.databind.node.ObjectNode contents)
IntermediatePluginimplementations should use this static factory method to create a new envelope that derives from an existing envelope. This ensures the continuity of the envelops pluginPath.- Parameters:
current- The currently received envelope that the plugin is processing.pluginId- The ID of the current plugincontents- The contents (preferably JSON) to be passed downstream to the next layer.- Returns:
- The newly derived envelope.
-
getSession
public Session getSession()
-
setSession
public void setSession(Session session)
-
getPluginPath
public List<String> getPluginPath()
The pluginPath list represents this envelope's path through the Magpie framework. Each plugin that operates on data should append it's ID to the ordered list. This allows downstream plugins to make decisions based on expected schemas for upstream plugins or sub-services.- Returns:
-
getContents
public com.fasterxml.jackson.databind.node.ObjectNode getContents()
-
setContents
public void setContents(com.fasterxml.jackson.databind.node.ObjectNode contents)
-
getContentClass
public String getContentClass()
-
setContentClass
public void setContentClass(String contentClass)
-
-