Write cartridge in 10 steps
This article tells you how to write an andromda cartridge in 10 different steps, using a simple cartridge to generate a build script similar to ant from the UML development model. This is why the cartridge tutorial is called "Andromeda-deployment ".
New cartridge task
Written by Matthias Bohlen
Tuesday, 21 March 2006
Let's take a look at the test model that cartridge will handle:
In this figure, you can see four important model element types:
L node: the box that the workpiece can be deployed (usually a machine, such as a server)
L component: Logical Block of software with a defined interface
L artifact: The physical block of the software, such as the JAR file conforming to the Component Interface (in UML, it is "manifest ")
L package: shells around some classes.
The idea behind this model is that the workpiece contains packages and is deployed on nodes. The package contains the classes to be compiled before being packaged into the workpiece.
You can do more from such a model, but this will make this cartridge more complicated for a tutorial. From this model, cartridge generates two types of files:
L a build script like ant (for each node)
L simple reports, components, artifacts, and packages to be deployed to nodes (one report for each model)
From the above model, this new cartridge will generate the following output:
Build. xml:
<Project name = "org. andromda. Cartridges. Deployment. sampledeployment. appserver1" default = "deploy"> <Target name = "compile"> <Javac package = "org. andromda. Cartridges. Deployment. sampledeployment. mybackendservices"/> <Javac package = "org. andromda. Cartridges. Deployment. sampledeployment. mywebapp"/> <Javac package = "org. andromda. Cartridges. Deployment. sampledeployment. mywebapp2"/> </Target> <Target name = "deploy" depends = "compile"> <Jar name = "mybackendcomponents. Jar"> <Package name = "org. andromda. Cartridges. Deployment. sampledeployment. mybackendservices"/> </Jar> <Jar name = "mywebcomponents. Jar"> <Package name = "org. andromda. Cartridges. Deployment. sampledeployment. mywebapp"/> <Package name = "org. andromda. Cartridges. Deployment. sampledeployment. mywebapp2"/> </Jar> </Target> </Project> |
Now, ant experts will say that this is not a valid ant file. No, no. This is a fake goods!
The following is another file to be generated:
<Deployment-report generation-date = "Fri Feb 17 10:12:33 cet2006"> <Node name = "appserver1"> <Component name = "backendcomponent"> <Artifact name = "mybackendcomponents. Jar"> <Package name = "org. andromda. Cartridges. Deployment. sampledeployment. mybackendservices"> </Package> </Artifact> </Component> <Component name = "webcomponent"> <Artifact name = "mywebcomponents. Jar"> <Package name = "org. andromda. Cartridges. Deployment. sampledeployment. mywebapp"> </Package> <Package name = "org. andromda. Cartridges. Deployment. sampledeployment. mywebapp2"> </Package> </Artifact> </Component> </Node> </Deployment-Report> |
The following describes the design of each step in the cartridge development process.