XML format

The Component-Watch projects are saved as XML. This XML is designed to be easily readable, modifiable and have a structure close to what you see in application.

This XML contains only the editable data (i.e. the content of the "Definition" tabs in the detail viewer), all the data generated during analysis (the classes, the relations, the jar list ...) are not saved and re-created at each analysis.

The XML data is described by a XML schema: ComponentWatch.xsd.

The 4 concepts appearing in the XML are the 4 editable objects of Component-Watch:

  • The project : represent the analysed application; it is the main object of the Component-Watch model, containing all the others.
  • The components : a component is a set of classes and can also define sub-components.
  • The rules : represent the rules applied on the project during the analysis.
  • The diagrams : A selection of components with hints to represent them graphically.

The project

The project is mapped to the main XML tag, the relevant part of the XML is:

        <?xml version="1.0" encoding="UTF-8"?>
        <project xmlns="componentwatch.sf.net/project/1.0" name="Self-analyse">
            <description>
                An example analysing the Component-Watch application itself
                to demonstrate how the tool can help to analyse and represent
                an application structure starting from scratch in 10 minutes.
            </description>
            <analysedClasses>
                <include>net.sf.*</include>
            </analysedClasses>
            <ignoredClasses>
                <include>java*</include>
                <exclude>java.swing.*</exclude>
            </ignoredClasses>
            <directoryClassLocation>
                <baseDirectory>/home/user/Component-Watch/lib</baseDirectory>
            </directoryClassLocation>
            <components>
               (...)
            </components>
            <rules>
               (...)
            </rules>
            <diagrams>
               (...)
            </diagrams>
        </project>      
        

If, in the project definition, you choose Maven as jar files location rather than Directory, then the <directoryClassLocation> element is replaced by a <mavenClassLocation> as following.

        (...)
            <mavenClassLocation>
                <rootProject>net.sf.componentwatch:component-watch-tool:1.0</rootProject>
                <ignoredMavenProjects>
                    <include>*sonatype*</include>
                </ignoredMavenProjects>
            </mavenClassLocation>
            (...)
            

The components

TODO: description

        (...)
                <component name="sfac-utils">
                    <description>
                        Component created from the Jar sfac-utils-0.6.jar
                    </description>
                    <classes>
                        <include>net.sf.sfac.*</include>
                        <exclude>net.sf.sfac.gui.*</exclude>
                        <exclude>net.sf.sfac.launcher.*</exclude>
                    </classes>
                </component>
            (...)
            

The rules

TODO: description

        (...)
                        <layersRule>
                                <shortDescription>Three-tier layering</shortDescription>
                                <longDescription>
                                        Each component must respect the general 3-tier layering of Web applications.
                                        The tiers enforce strict layering, meaning that the 'user interface' tier cannot directly access the 'data access' tier.
                                </longDescription>
                                <layerType>tier</layerType>
                                <layerNames>
                                        <layerName>user interface</layerName>
                                        <layerName>business-model</layerName>
                                        <layerName>data access</layerName>
                                </layerNames>
                                <strictLayering>true</strictLayering>
                        </layersRule>
            (...)
            

The diagrams

TODO: description

        (...)
                <diagram name="Silos and Layers">
                    <cellGroups>
                        <cellGroup name="Silos and layers" base="BOX">
                            <components>
                                <include>layer:*</include>
                                <include>silo:*</include>
                            </components>
                        </cellGroup>
                    </cellGroups>
                    <layout>
                        <cellLayout cellId="GUI" x="390" y="30" width="50" height="170"/>
                        <cellLayout cellId="External components" x="50" y="150" width="290" height="30"/>
                        <cellLayout cellId="Model" x="470" y="30" width="50" height="170"/>
                        <cellLayout cellId="Analysed libraries" x="50" y="100" width="290" height="30"/>
                        <cellLayout cellId="Component Watch" x="50" y="50" width="290" height="30"/>
                    </layout>
                </diagram>
            (...)