Here is the API for the Jython Interface to the XCAT composition engine .
Running applications using the Jython Interface consists of the following steps:
Import the XCAT API for composition so that we can use XCAT composition engine. This does the start up work for us to be able to go ahead and create, connect, and execute components.
Create a component wrapper from the XML file for the component by using a call to the function createComponent . Note that this function only creates a dummy component and not a live instance of it.
Once a component wrapper is created, the machine on which the user wants to instantiate the component has to be specified. This is done by using the setMachineName function.
Along with the machine name, the creation mechanism used to create the component instance also has to be given using the setCreationMechanism function.
We are all set now to instantiate the component. This is done by calling the createInstance method. This method takes in the component wrapper as a parameter and creates an instance of the component.
Components can be made to talk to each other by connecting compatible ports. Port connects are done using calls to function connectPorts . This function takes in the handles to components and the names of the ports, and makes a connection between the ports of the components. Port connections can be made before or after we create instances of components. If they are made between dummy components, they are activated once the components are instantiated.
Now, we are all set to execute the composition. If the components are such that they need to be explicitly started up, then a start method can be invoked on the control port of the component, using the invokeMethodOnComponent function.
A sample Python script file that gives the code for composing a simple application is given in PythonDemo