To use the Component Generator Tool you must define your component in a YAML file. Then you can run the component generator with the following parameters:
Code Block |
---|
|
localhost developer:~/workspace/pyScheduler/src 115 > create_acs_component --help
Usage: create_acs_component [OPTIONS] COMPONENT_YAML_PATH
Creates an ACS component from a YAML definition.
Options:
-l, --language [python|cpp|java]
Component's implementation language.
[default: python]
--version Show the version and exit.
--help Show this message and exit. |
For instance, for the Scheduler component:
Code Block |
---|
language | yml |
---|
title | scheduler.yml |
---|
|
working_dir: /home/developer/workspace
prefix: acsws
module: SCHEDULER_MODULE
component_name: Scheduler
functions:
- 'void start()'
- 'void stop()'
- 'long proposalUnderExecution()' |
Example output:
Code Block |
---|
|
localhost developer:~/workspace 105 > create_acs_component -l python scheduler.yml
2022-08-24 16:15:39 localhost.localdomain __main__[21561] INFO Loading component's YAML definition.
2022-08-24 16:15:39 localhost.localdomain __main__[21561] DEBUG Component's definition: {'working_dir': '/home/developer/workspace', 'prefix': 'acsws', 'module': 'SCHEDULER_MODULE', 'component_name': 'Scheduler', 'functions': ['void start()', 'void stop()', 'long proposalUnderExecution()']}
2022-08-24 16:15:39 localhost.localdomain __main__[21561] INFO Creating IDL's directories
\nCreating/checking Module directory
CREATED >>> |---idlScheduler
CREATED >>> |---bin
CREATED >>> |---include
CREATED >>> |---idl
CREATED >>> |---lib
CREATED >>> |---lib/endorsed
CREATED >>> |---lib/python
CREATED >>> |---lib/ACScomponents
CREATED >>> |---lib/python/site-packages
CREATED >>> |---man
CREATED >>> |---man/man1
CREATED >>> |---man/man2
CREATED >>> |---man/man3
CREATED >>> |---man/man4
CREATED >>> |---man/man5
CREATED >>> |---man/man6
CREATED >>> |---man/man7
CREATED >>> |---man/man8
CREATED >>> |---man/mann
CREATED >>> |---man/manl
CREATED >>> |---doc
CREATED >>> |---object
CREATED >>> |---LOGS
CREATED >>> |---test
CREATED >>> |---src
CREATED >>> |---rtai
CREATED >>> |---config
CREATED >>> |---config/CDB
CREATED >>> |---config/CDB/schemas
CREATED >>> |---ChangeLog
\nCopying Makefile template for WS code
\nCopying Makefile.mk template for WS code
\nCopying module.mk template for WS code
2022-08-24 16:15:39 localhost.localdomain __main__[21561] INFO Creating IDL's content
2022-08-24 16:15:39 localhost.localdomain __main__[21561] DEBUG IDL's content: #ifndef _SCHEDULER_IDL_
#define _SCHEDULER_IDL_
#pragma prefix "acsws"
#include <acscomponent.idl>
module SCHEDULER_MODULE {
interface Scheduler : ACS::ACSComponent {
void start();
void stop();
long proposalUnderExecution();
};
};
#endif
2022-08-24 16:15:39 localhost.localdomain __main__[21561] INFO Editing Makefile
2022-08-24 16:15:39 localhost.localdomain __main__[21561] INFO Adding component to CDB
2022-08-24 16:15:39 localhost.localdomain __main__[21561] DEBUG CDB's content: <?xml version="1.0" encoding="ISO-8859-1"?>
<Components xmlns="urn:schemas-cosylab-com:Components:1.0"
xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<e Name="PBEND_B_01" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="PBUMP_B_01" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="PBUMP_B_02" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_1" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_2" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_3" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_4" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_5" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_6" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_7" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_8" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_9" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_10" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_11" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_12" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_13" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_14" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_15" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_16" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_17" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="TEST_PS_18" Code="acsexmplPowerSupplyImpl"
Type="IDL:alma/PS/PowerSupply:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="MOUNT1" Code="acsexmplMountImpl"
Type="IDL:alma/MOUNT_ACS/Mount:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="MOUNT2" Code="acsexmplMountImpl"
Type="IDL:alma/MOUNT_ACS/Mount:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="MOUNT3" Code="acsexmplMountImpl"
Type="IDL:alma/MOUNT_ACS/Mount:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="MOUNT4" Code="acsexmplMountImpl"
Type="IDL:alma/MOUNT_ACS/Mount:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="MOUNT5" Code="acsexmplMountImpl"
Type="IDL:alma/MOUNT_ACS/Mount:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="MOUNT6" Code="acsexmplMountImpl"
Type="IDL:alma/MOUNT_ACS/Mount:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="LAMP1" Code="acsexmplLampImpl"
Type="IDL:alma/acsexmplLamp/Lamp:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="LAMPWHEEL1" Code="acsexmplLampWheelImpl"
Type="IDL:alma/acsexmplLampWheel/LampWheel:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="FILTERWHEEL1" Code="acsexmplFilterWheelImpl"
Type="IDL:alma/acsexmplFilterWheel/FilterWheel:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="CLOCK1" Code="acsclock"
Type="IDL:alma/acstime/Clock:1.0"
Container="bilboContainer"
Default="true" ImplLang="cpp" />
<e Name="TIMER1" Code="acstimer"
Type="IDL:alma/acstime/Timer:1.0"
Container="bilboContainer"
Default="true" ImplLang="cpp" />
<e Name="FRIDGE1" Code="acsexmplFridgeImpl"
Type="IDL:alma/FRIDGE/FridgeControl:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="HELLODEMO1" Code="alma.demo.HelloDemoImpl.HelloDemoHelper"
Type="IDL:alma/demo/HelloDemo:1.0"
Container="frodoContainer" ImplLang="java" />
<e Name="HELLOLAMP1" Code="alma.demo.LampAccessImpl.LampAccessHelper"
Type="IDL:alma/demo/LampAccess:1.0"
Container="frodoContainer" ImplLang="java" />
<e Name="LAMPACCESS1" Code="alma.demo.LampAccessImpl.LampAccessHelper"
Type="IDL:alma/demo/LampAccess:1.0"
Container="frodoContainer" ImplLang="java" />
<e Name="LAMPCALLBACK1" Code="alma.demo.LampCallbackImpl.LampCallbackHelper"
Type="IDL:alma/demo/LampCallback:1.0"
Container="frodoContainer" ImplLang="java" />
<e Name="XMLCOMP1" Code="alma.demo.XmlComponentImpl.XmlComponentHelper"
Type="IDL:alma/demo/XmlComponent:1.0"
Container="frodoContainer" ImplLang="java" />
<e Name="PYHELLODEMO1"
Code="demoImpl.HelloDemo"
Type="IDL:alma/demo/HelloDemo:1.0"
Container="aragornContainer" ImplLang="py" />
<e Name="ARCHIVE_IDENTIFIER"
Code="alma.archive.helpers.IdentifierHelper"
Type="IDL:alma/xmlstore/Identifier:1.0"
Container="frodoContainer"
Default="true" ImplLang="java" />
<e Name="ARCHIVE_CONNECTION"
Code="alma.archive.helpers.ArchiveConnectionHelper"
Type="IDL:alma/xmlstore/ArchiveConnection:1.0"
Container="frodoContainer"
Default="true" ImplLang="java" />
<e Name="ERRORCOMP_CPP"
Code="acsexmplErrorComponentImpl"
Type="IDL:alma/acsexmplErrorComponent/ErrorComponent:1.0"
Container="bilboContainer" ImplLang="cpp" />
<e Name="ERRORCOMP_JAVA"
Code="alma.acsexmplErrorComponent.ErrorComponentImpl.ErrorComponentHelper"
Type="IDL:alma/acsexmplErrorComponent/ErrorComponent:1.0"
Container="frodoContainer" ImplLang="java" />
<e Name="ERRORCOMP_PY"
Code="acsexmplErrorComponentImpl.ErrorComponent"
Type="IDL:alma/acsexmplErrorComponent/ErrorComponent:1.0"
Container="aragornContainer" ImplLang="py" />
<e Name="SchedulerPython"
Code="SCHEDULER_MODULEImpl.SchedulerImpl"
Type="IDL:acsws/SCHEDULER_MODULE/Scheduler:1.0"
Container="aragornContainer" ImplLang="py" />
</Components>
2022-08-24 16:15:39 localhost.localdomain create_python_component[21561] INFO Creating component's directories.
\nCreating/checking Module directory
CREATED >>> |---pyScheduler
CREATED >>> |---bin
CREATED >>> |---include
CREATED >>> |---idl
CREATED >>> |---lib
CREATED >>> |---lib/endorsed
CREATED >>> |---lib/python
CREATED >>> |---lib/ACScomponents
CREATED >>> |---lib/python/site-packages
CREATED >>> |---man
CREATED >>> |---man/man1
CREATED >>> |---man/man2
CREATED >>> |---man/man3
CREATED >>> |---man/man4
CREATED >>> |---man/man5
CREATED >>> |---man/man6
CREATED >>> |---man/man7
CREATED >>> |---man/man8
CREATED >>> |---man/mann
CREATED >>> |---man/manl
CREATED >>> |---doc
CREATED >>> |---object
CREATED >>> |---LOGS
CREATED >>> |---test
CREATED >>> |---src
CREATED >>> |---rtai
CREATED >>> |---config
CREATED >>> |---config/CDB
CREATED >>> |---config/CDB/schemas
CREATED >>> |---ChangeLog
\nCopying Makefile template for WS code
\nCopying Makefile.mk template for WS code
\nCopying module.mk template for WS code
2022-08-24 16:15:40 localhost.localdomain create_python_component[21561] INFO Creating component's content.
2022-08-24 16:15:40 localhost.localdomain create_python_component[21561] DEBUG Component's content: # Client stubs and definitions, such as structs, enums, etc.
import SCHEDULER_MODULE
# Skeleton infrastructure for server implementation
import SCHEDULER_MODULE__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 SchedulerImpl(SCHEDULER_MODULE__POA.Scheduler, ACSComponent, ContainerServices, ComponentLifecycle):
def __init__(self):
ACSComponent.__init__(self)
ContainerServices.__init__(self)
self._logger = self.getLogger()
def start(self):
raise NotImplementedError("This function should do something")
def stop(self):
raise NotImplementedError("This function should do something")
def proposalUnderExecution(self):
raise NotImplementedError("This function should do something")
2022-08-24 16:15:40 localhost.localdomain create_python_component[21561] INFO Editing Makefile |