public class RESTService extends TypedAtomicActor
The RESTService actor provides the user with a plug-in interface to execute any REST web service. Given a URL for the web service and type of the service GET or POST. It works with both type of servers implementing REST standards or not.
User shall provide all the parameters that server is expecting either through user configured ports or through actor defined paramInputPort. For the user defined port(s), port name is the parameter name and its value is parameter value. Parameters provided through actor defined paramInputPort should have name & value separated by = and each name value pair should be separated by a comma. Same thing holds true for actor defined fileInputPort, parameter name and the file path are separated by a = and name value pairs are separated by a user defined delimiter(default value is comma. This port is not read for the GET service.
Entity.ContainedObjectsIterator| Modifier and Type | Field and Description |
|---|---|
Parameter |
delimiter
The REST service method to use, either GET or POST.
|
TypedIOPort |
fileInputPort
Input file.
|
Parameter |
methodType
The REST service method to use, either GET or POST.
|
TypedIOPort |
outputPort
Output of REST service.
|
TypedIOPort |
paramInputPort
Input parameters to REST service.
|
PortParameter |
serviceSiteURL
The REST service URL.
|
_typesValid_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKSCOMPLETED, NOT_READY, STOP_ITERATING| Constructor and Description |
|---|
RESTService(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
executeGetMethod(java.util.List<NameValuePair> nvPairList,
java.lang.String serSiteURL) |
java.lang.String |
executePostMethod(java.util.List<NameValuePair> pmPairList,
java.util.List<NameValuePair> flPairList,
java.lang.String serSiteURL)
File & regular parameters are passed as two separate lists and they are
treated little differently.
|
void |
fire()
Sends the results as a String back after executing the appropriate
service.
|
java.util.List<NameValuePair> |
getCombinedPairList(java.util.List<NameValuePair> nmvlPairList) |
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspaceequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortListisFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminateaddInitializable, initialize, preinitialize, removeInitializable, wrapupdescription, getContainer, getDisplayName, getFullName, getName, getName, setNamegetDerivedLevel, getDerivedList, propagateValuepublic TypedIOPort outputPort
public TypedIOPort fileInputPort
public TypedIOPort paramInputPort
public PortParameter serviceSiteURL
public Parameter methodType
public RESTService(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container - The container.name - The name of this actor.IllegalActionException - If the actor cannot be contained by the proposed
container.NameDuplicationException - If the container already has an actor with this name.public void fire() throws IllegalActionException
fire in interface Executablefire in class AtomicActor<TypedIOPort>IllegalActionException - Not thrown in this base class.public java.lang.String executeGetMethod(java.util.List<NameValuePair> nvPairList, java.lang.String serSiteURL) throws IllegalActionException
pmPairList - List of the name and value parameters that user has provided
through paramInputPort. However in method this list is
combined with the user configured ports and the combined list
name value pair parameters are added to the service URL
separated by ampersand.nvPairList - List of the name and value parameters that user has providedIllegalActionExceptionpublic java.util.List<NameValuePair> getCombinedPairList(java.util.List<NameValuePair> nmvlPairList) throws IllegalActionException
nmvlPairList - NameValue pair List of the parameters user has provided
through paramInputPort as comma separated pairs. Pairs are
separated by '='.IllegalActionExceptionpublic java.lang.String executePostMethod(java.util.List<NameValuePair> pmPairList, java.util.List<NameValuePair> flPairList, java.lang.String serSiteURL) throws IllegalActionException
pmPairList - List of the name and value parameters that user has providedflPairList - List of the name and value (full file path)of file parameters.
It is essentially a list of files that user wishes to attach.IllegalActionException