Tuesday, September 29, 2009

3.4.8 Feature: Exporting project.xml

A much requested feature has been implemented for 3.4.8, project.xml export, both from the command line via ProjectBuilder and via the GUI using Workbench.

Most ControlTier users manage their project model using XML files that define the resources that comprise their application and their environment. The ProjectBuilder module provides a command to upload these XML files to the ControlTier server webapp, Workbench. Up until 3.4.8, Workbench did not provide a direct interface to export the same data back to XML. This was particularly annoying when a project model was setup using the GUI interface of Workbench.

Here's a resource model from one of the examples:


To export that data from Workbench click on the "simpleTomcat" object and in the toolbar you will notice an XML icon. Click that icon and the browser will be directed to a page that contains the project.xml.



The same can be done from the command line via the ProjectBuilder command, find-objects.
Below, the find-objects command is used to lookup the same "simpleTomcat" object and the exported model data saved to the file: /tmp/simpleTomcat.xml


$ ctl -p demo -m ProjectBuilder -c find-objects -- -type Service -name simpleTomcat -out /tmp/simpleTomcat.xml
Results stored in file: /tmp/simpleTomcat.xml


Here's the the content of /tmp/simpleTomcat.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project PUBLIC "-//ControlTier Software Inc.//DTD Project Document 1.0//EN" "project.dtd">

<project>
<setting type="Port" name="simpleTomcat-connector" description="The connector port used by Tomcat" settingValue="18080" settingType="TCP"/>
<setting type="ServiceSpawn" name="simpleTomcat" description="Whether to spawn separate process for the start script" settingValue="false" settingType=""/>
<setting type="ServiceStartScript" name="simpleTomcat" description="The script used by startService" settingValue="/Users/alexh/ctier/examples/service-package-deployment/start.sh" settingType="script"/>
<setting type="ServiceStopScript" name="simpleTomcat" description="The script used by stopService" settingValue="/Users/alexh/ctier/examples/service-package-deployment/stop.sh" settingType="script"/>
<setting type="ServiceIsDownScript" name="simpleTomcat" description="The script used by assertServicesIsDown" settingValue="/Users/alexh/ctier/examples/service-package-deployment/isdown.xml" settingType="script"/>
<setting type="ServiceIsUpScript" name="simpleTomcat" description="The script used by assertServicesIsUp" settingValue="/Users/alexh/ctier/examples/service-package-deployment/isup.xml" settingType="script"/>
<package type="war" name="simple-123.war" description="A simple webapp" filename="simple-123.war" filetype="war" base="simple" version="123" release="" arch="noarch" buildtime="123" vendor="" restart="false" installroot="${env.CTIER_ROOT}/examples/service-package-deployment/apache-tomcat-5.5.28/webapps" repoUrl="http://strongbad:8080/jackrabbit/repository/workbench/pkgs/demo/war/wars/simple-123.war" releasetag="" installrank="2"/>
<deployment type="Service" name="simpleTomcat" description="The Tomcat deployment." basedir="/Users/alexh/ctier/examples/service-package-deployment/apache-tomcat-5.5.28" installRoot="/Users/alexh/ctier/examples/service-package-deployment/apache-tomcat-5.5.28" startuprank="">
<resources>
<resource name="simpleTomcat" type="ServiceIsDownScript"/>
<resource name="simpleTomcat" type="ServiceIsUpScript"/>
<resource name="simpleTomcat" type="ServiceStopScript"/>
<resource name="simple-123.war" type="war"/>
<resource name="simpleTomcat" type="ServiceStartScript"/>
<resource name="simpleTomcat-connector" type="Port"/>
<resource name="simpleTomcat" type="ServiceSpawn"/>
</resources>
<referrers replace="false">
<resource name="strongbad.local" type="Node"/>
</referrers>
</deployment>
</project>

With the XML exported to a file, it can be checked into a source code repository and later uploaded to the server again.

No comments: