Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleComponents.xml
linenumberstrue
collapsetrue
...
  <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.HelloComponentImpl.HelloComponentComponentHelper"
     Type="IDL:acsws/workshop/HelloComponent:1.0"
     Container="frodoContainer"
     ImplLang="java"/>
  <e Name="PY_HELLO_COMP"
     Code="workshopws.HelloComponentImpl"
     Type="IDL:acsws/workshop/HelloComponent:1.0"
     Container="aragornContainer"
     ImplLang="py"/>
...

...

Code Block
> getTemplateForDirectory MODROOT_WS pyHelloComp
> cd pyHelloComp/src
> mkdir workshop ws
> touch ws/__init__.py
> touch workshopws/HelloComponentImpl.py

We modify the Makefile for this component:

Code Block
titlepyHelloComponent/src/Makefile
...
PY_PACKAGEPACKAGES = workshopws
...

We fill the component code as follows:

Code Block
languagepy
titlepyHelloComponent/src/workshop/HelloComponentImpl.py
linenumberstrue
collapsetrue
#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>workshop__POA.HelloComponent, ACSComponent, ContainerServices, ComponentLifecycle):
    def __init__(self):
        ACSComponent.__init__(self)
        ContainerServices.__init__(self)
        self._logger = self.getLogger()
    def printHello(self):
            print("Just printing 'Hello World!'")

...