Information
We are currently investigating an issue with the editor of some pages. Please save your work and avoid to create new pages until this banner is gone.
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
... <e Name="CPP_HELLO_COMP" Code="HelloComponentImpl" Type="IDL:acsws/workshop/HelloComponent:1.0" Container="bilboContainer" ImplLang="cpp"/> <e Name="JAVA_HELLO_COMP" Code="acsws.workshop.HelloComponentHelper" Type="IDL:acsws/workshop/HelloComponent:1.0" Container="frodoContainer" ImplLang="java"/> <e Name="PY_HELLO_COMP" Code="pyHelloComponentImplworkshop.HelloComponentImpl" Type="IDL:acsws/workshop/HelloComponent:1.0" Container="aragornContainer" ImplLang="py"/> ... |
The above configuration is assuming that we're going to use the default 3 containers.
Code Block |
---|
> getTemplateForDirectory MODROOT_WS pyHelloComp
> cd pyHelloComp/src
> mkdir workshop
> touch workshop/HelloComponentImpl.py |
We modify the Makefile for this component:
Code Block | ||
---|---|---|
| ||
...
PY_PACKAGE = workshop
... |
We fill the component code as follows:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#Client stubs and definitions, such as structs, enums, etc.
import workshop
#Skeleton infrastructure for server implementation
import workshop__POA
#Base component implementation
from Acspy.Servants.ACSComponent import ACSComponent
#Services provided by the container to the component
from Acspy.Servants.ContainerServices import ContainerServices
#Basic component lifecycle (initialize, execute, cleanUp and aboutToAbort methods)
from Acspy.Servants.ComponentLifecycle import ComponentLifecycle
class HelloComponentImpl(<Module>__POA.HelloComponent, ACSComponent, ContainerServices, ComponentLifecycle):
def __init__(self):
ACSComponent.__init__(self)
ContainerServices.__init__(self)
self._logger = self.getLogger()
def printHello():
print("Just printing 'Hello World!'") |
We create the needed directories:
...