You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Create component

cd ~/workspace
getTemplateForDirectory MODROOT_WS pyHelloComp
cd pyHelloComp/src
mkdir ws
touch ws/__init__.py
touch ws/HelloComponentImpl.py
vim Makefile

We modify the Makefile for this component:

pyHelloComp/src/Makefile
...
PY_PACKAGES = ws
...

We fill the component code as follows:

vim ws/HelloComponentImpl.py
pyHelloComp/src/ws/HelloComponentImpl.py
# 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(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!'")
        return "Hello World!"

Compile component

export INTROOT=~/workspace/introot
export PYTHONPATH=$INTROOT/lib/python/site-packages:/alma/ACS-2021OCT/ACSSW/lib/python/site-packages
make all install
  • No labels