WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:PythonPrototype
Description:
Id:PythonPrototype
Category:accessor prototype

PythonPrototype is an accessor that must be instantiated from a prototype. You must instantiate the prototype in your module to create an accessor that can receive requests.

Parameters

The PythonPrototype prototype has the following initialisation parameters:

NameRulesTypingDefaultDescription
scriptMandatoryIdentifier or XML(none)
Python program to execute
grammarMandatoryXML(none)
An identifier grammar definition.
verbsOptionalStringSOURCE
comma separated list of supported verbs
privateOptionalBooleanfalse
If included this parameter will mark the endpoint as private and it will not be exposed outside module.
idOptionalStringnull
An identifier for created logical endpoint, if omitted a unique auto-generated value it will be used.
fromRepresentationAny quantityStringnull
used when creating transreptor
toRepresentationAny quantityStringnull
used when creating transreptor
metaOptionalXMLnull(no description available)

Here is an auto-generated example of how to instantiate an instance of PythonPrototype:

<accessor>
  <prototype>PythonPrototype</prototype>
  <script>Python program to execute</script>
  <grammar>an identifier grammar definition</grammar>
</accessor>
Import Requirements

To use PythonPrototype accessor prototype you must import the module urn:org:netkernel:lang:python:

<import>
  <uri>urn:org:netkernel:lang:python</uri>
</import>

The Python language prototype is an alternate way of using the python functionality to the runtime. The prototype allows the instantiation of a python implemented endpoint within your application without the need to [map requests to it. This has benefits of compactness and the ability to implement transreptors.

Verbs

The comma separate list of verbs defines which verbs will be supported by the instantiated python accessor. This defaults to just "SOURCE". See the mapper verbs document for examples of how to set this string.

The runtime contains documentation on how to differentiate handling of different verbs.

Example

Here's how to declare an Accessor using the PythonPrototype with script res:/test/helloworld.py

Then create a static resource containing your python script:

// Python code to implement simple transreptor
primary = context.sourcePrimary(java.lang.Object)
rep = new org.ten60.netkernel.lang.python.test.MyRep(primary)
context.createResponseFrom(rep)