Skip to content

Latest commit

 

History

History
231 lines (139 loc) · 20.6 KB

README.md

File metadata and controls

231 lines (139 loc) · 20.6 KB

cim-compare

image
[GitHub Repo]

Command line tool for generating CIM model comparison reports. For an example report visit comparison-report.html.

CIM Model Comparison Report Utility

cim-compare generates model comparison reports between two points in time. A link to the latest release can be found at the end of this README.

The term “destination” is used to describe some current version (or latest working copy) of a CIM model that is to be the target of the comparison. The term “baseline” is used to describe the historical model against which the “destination” model is to be compared to determine what has changed.

Enterprise Architect (Corporate Edition and above) has the capability to perform these model comparisons; however, the feature is not generally useful as results are only exportable as XML files that are not easily human readable.

The output generated by cim-compare results in a self-contained HTML comparison report of all changes between a “baseline” and “destination” model. The report is viewable in most standard browsers such as Firefox, Chrome, Edge, IE, etc. and provides the ability to search for specific CIM classes within the report.

Reports use colors to visually indicate changes to packages, classes, attributes, generalizations, and associations. New items are shown in green, deleted items in red, items that have moved location within the model appear as yellow, blue represents items that were changed in some way, and violet indicates items that are unchanged.

As illustrated next, UML diagrams that have been added, removed or modified can also be included in comparison reports. To include diagrams refer to the command line procedures described further down.

Command Line Usage

The cim-compare utility has three possible command-line options to produce comparison reports as described next.

Option #1: Enterprise Architect .EAP Baseline and Destination Models as Inputs

The preferred usage is to provide two Enterprise Architect .eap files for the "baseline" and "destination" input files. Using .eap files eliminates the need to manually export XMI and diagrams from EA (refer to "Enterprise Architect XMI Export Procedures").

The command-line usage for this option takes the following form:

java -jar cim-compare-1.2.2.jar <baseline-model-eap-file> <destination-model-eap-file> [<output-directory-or-html-file>] [--package=<package-name>] [--minimal] [--include-diagrams] [--image-type=<image-file-extension>] [--zip]

Parameter Details:

<baseline-model-eap-file> (Required): An Enterprise Architect baseline .eap model file. When not specified as an absolute file path the location is assumed to be the directory cim-compare is being executed from.

<destination-model-eap-file> (Required): An Enterprise Architect destination .eap model file. When not specified as an absolute file path the location is assumed to be the directory cim-compare is being executed from.

[<output-directory-or-html-file>] (Optional): An output directory or an output HTML file. In the case where a directory is specified but does not exist it will be created. The same is true for the parent directory of a specified HTML file if it does not exist. When an HTML file is provided it may be specified as an absolute file path or as the simple name of an HTML file to be generated. If this command line option is not specified then cim-compare will generate an HTML file whose name is derived from the two input files.

[--package=<package-name>] (Optional): The root package within the models from which to start the comparison report from. Appearing at the end of the command-line after file and directory specifications, when specified the package must exist in both the baseline and destination models (e.g. --package=IEC61970, --package=IEC61968, --package=IEC62325, --package=TC57CIM, etc.) and be specified with two leading dashes (--). Note that when no IEC package name is specified that the report is generated from the root package in the models.

[--minimal] (Optional): When specified cim-compare will exclude all "Identical" packages, classes, attributes, links, diagrams, etc. from the generated report. This is useful when it is necessary to perform detailed analysis of only the most concise set of changes between models.

[--include-diagrams] (Optional): Indicates that diagram images should also be exported from EA along with the XMI exports. The type of images to be exported should also be provided using the --image-type option. When not specified the image type will default to JPG.

[--image-type=<image-file-extension>] (Optional): The type of diagrams to be exported from EA (i.e. JPG, GIF, PNG, BMP, or EMF). This can be skipped for JPG images as JPG is used as the default value when the option is not specified. This command line option is only used when --include-diagrams also appears on the command line.

[--zip] (Optional): When specified cim-compare will package up the generated report and any associated diagrams into a single ZIP archive. It is most often utilized for packaging the report when diagram images are included and can help simplify distribution.

Note that in the following command line examples whenever a directory or file path contains spaces it is specified within quotes.

Command Line Examples:
java -jar cim-compare-1.2.2.jar "C:\exports\15v33.eap" "C:\exports\CIM16v26a.eap" "C:\"
java -jar cim-compare-1.2.2.jar "C:\exports\15v33.eap" "C:\exports\CIM16v26a.eap" --package=IEC61970 --minimal
java -jar cim-compare-1.2.2.jar CIM15v33.eap CIM16v26a.eap C:\ --minimal
java -jar cim-compare-1.2.2.jar CIM15v33.eap CIM16v26a.eap C:\ --minimal --include-diagrams --zip
java -jar cim-compare-1.2.2.jar CIM15v33.eap CIM16v26a.eap C:\CIM15v33_CIM16v26a_ComparisonReport.html
java -jar cim-compare-1.2.2.jar CIM15v33.eapx CIM16v26a.eapx CIM15v33_CIM16v26a_ComparisonReport.html --minimal
java -jar cim-compare-1.2.2.jar CIM15v33.eap CIM16v26a.eap --package=IEC62325 --minimal --include-diagrams --image-type=GIF --zip
IMPORTANT:
To utilize cim-compare to process Enterprise Architect models (.eap files) the following steps
are also required depending on the version of Java being used. Note that on a 64-bit machine it is
recommended to use 64-bit Java. The DLL files referenced are those shipped with EA and located in
the Sparx install directory at:  <Windows program files>/Sparx Systems/EA/Java API

64-bit Java:
Copy the file SSJavaCOM64.dll located in the EA installation folder to:

  <Windows folder>/System32 (on a 64-bit machine).

32-bit Java:
Copy the file SSJavaCom.dll located in the EA installation folder to:

  <Windows folder>/System32 (on a 32-bit machine) or to <Windows folder>/SysWOW64 (on a 64-bit machine).

Option #2: XMI Baseline and Destination Models as Inputs

The second usage is to directly specify two XMI 1.1 compliant files representing the "baseline" and “destination” models exported as described later in "Enterprise Architect XMI Export Procedures". In this scenario the command-line usage takes the following form:

java -jar cim-compare-1.2.2.jar <baseline-model-xmi-file> <destination-model-xmi-file> [<output-directory-or-html-file>] [--package=<package-name>] [--minimal] [--include-diagrams] [--image-type=<image-file-extension>] [--zip]

Parameter Details:

<baseline-model-xmi-file> (Required): An XMI 1.1 compliant baseline model file exported from EA. When not specified as an absolute file path the location of the file is assumed to be the directory the utility is being executed from.

<destination-model-xmi-file> (Required): An XMI 1.1 compliant destination model file exported from EA. When not specified as an absolute file path the location of the file is assumed to be the directory the utility is being executed from.

[<output-directory-or-html-file>] (Optional): An output directory or an output HTML file. In the case where a directory is specified but does not exist it will be created. The same is true for the parent directory of a specified HTML file if it does not exist. When an HTML file is provided it may be specified as an absolute file path or as the simple name of an HTML file to be generated. If this command line option is not specified then cim-compare will generate an HTML file whose name is derived from the two input files.

[--package=<package-name>] (Optional): The root package within the models from which to start the comparison report from. Appearing at the end of the command-line after file and directory specifications, when specified the package must exist in both the baseline and destination models (e.g. --package=IEC61970, --package=IEC61968, --package=IEC62325, --package=TC57CIM, etc.) and be specified with two leading dashes (--). Note that when no IEC package name is specified that the report is generated from the root package in the models.

[--minimal] (Optional): When specified cim-compare will exclude all "identical" packages, classes, attributes, links, diagrams, etc. from the generated report. This is useful when it is necessary to perform detailed analysis of only the most concise set of changes between models.

[--include-diagrams] (Optional): When specified cim-compare indicates that diagram images should be included in the generated comparison report. Note that if the types of diagrams to be included are not JPG files then the --image-type option must also be used in tandem. When this option does not appear on the command line no diagrams will be included in the report.

IMPORTANT: this command line option does not automatically export diagrams as performed in usage Option #1. Rather the expectation is that they be exported as part of manual exports of XMI baseline and destination models from EA and that images are hosted in folders named <output directory>/Image-baseline and <output directory>/Image-destination respectively. This must be done prior to running cim-compare. Refer to the "Enterprise Architect XMI Export Procedures" in this README for further details.

[--image-type=<image-file-extension>] (Optional / Conditionally Required): Indicates the type of images (i.e. JPG, GIF, PNG, BMP, or EMF) referenced in the report. Conditionally required when the --include-diagrams option is used and the diagram are not JPG image files. When not specified the default image type of JPG is used. This command line option is only relevant when --include-diagrams also appears on the command line.

[--zip] (Optional): When specified cim-compare will package up the generated report and any associated diagrams into a single ZIP archive. It is most often utilized for packaging the report when diagram images are included and can help simplify distribution.

Note that in the following command line examples whenever a directory or file path contains spaces it is specified within quotes.

Command Line Examples:
java -jar cim-compare-1.2.2.jar "C:\XMI exports\15v33.xmi" "C:\XMI exports\CIM16v26a.xmi" "C:\"
java -jar cim-compare-1.2.2.jar "C:\XMI exports\15v33.xmi" "C:\XMI exports\CIM16v26a.xmi" --package=IEC61970 --minimal
java -jar cim-compare-1.2.2.jar CIM15v33.xmi CIM16v26a.xmi C:\ --minimal
java -jar cim-compare-1.2.2.jar CIM15v33.xmi CIM16v26a.xmi C:\ --minimal --include-diagrams --image-type=gif --zip
java -jar cim-compare-1.2.2.jar CIM15v33.xmi CIM16v26a.xmi C:\CIM15v33_CIM16v26a_ComparisonReport.html
java -jar cim-compare-1.2.2.jar CIM15v33.xmi CIM16v26a.xmi CIM15v33_CIM16v26a_ComparisonReport.html --minimal
java -jar cim-compare-1.2.2.jar CIM15v33.xmi CIM16v26a.xmi CIM15v33_CIM16v26a_ComparisonReport.html --package=IEC62325 --include-diagrams --image-type=JPG --zip

Option #3: EA Model Comparison Logs as Input

The third option is by specifying an EA model comparison log file as input on the command line. In order to perform this option it is first required that a comparison XML log file be generated from within Enterprise Architect. Refer to the EA Comparison Log Procedures for detailed information on generating XML Compare Logs from within Enterprise Architect. It is important to note that EA does not support comparisons of UML diagrams and therefore diagrams are not supported as part of reports generated using Option #3.

This particular usage takes the following form:

java -jar cim-compare-1.2.2.jar <comparison-results-xml-file> [<output-directory-or-html-file>] [--package=<package-name>] [--minimal] [--zip]

Parameter Details:

<comparison-results-xml-file> (Required): The model comparison file. When not specified as an absolute file path the location of the file is assumed to be the directory the utility is being executed in.

[<output-directory-or-html-file>] (Optional): An output directory or an output HTML file. In the case where a directory is specified but does not exist it will be created. The same is true for the parent directory of a specified HTML file if it does not exist. When an HTML file is provided it may be specified as an absolute file path or as the simple name of an HTML file to be generated. If this command line option is not specified then cim-compare will generate an HTML file whose name is derived from the two input files.

[--package=<package-name>] (Optional): The root package to compare and generate the comparison report on. Appearing at the end of the command-line after file and directory specifications, the package must exist in both the baseline and destination models (e.g. --package=IEC61970, --package=IEC61968, --package=IEC62325, --package=TC57CIM, etc.) and be specified with two leading dashes (--). Note that when no IEC package name is specified that the report is generated from the root package in the models.

[--minimal] (Optional): When specified cim-compare will exclude all "Identical" packages, classes, attributes, links, diagrams, etc. from the generated report. This is useful when it is necessary to perform detailed analysis of only the most concise set of changes between models.

[--zip] (Optional): When specified cim-compare will package up the generated report into a single ZIP archive. Note that since this option #3 does not support diagram comparisons only the report itself will be included in the archive.

Again, in the following command line examples, directory or file paths containing spaces are specified within quotes.

Command Line Examples:
java -jar cim-compare-1.2.2.jar "C:\CIM XMI Exports\CIM15v33_CIM16v26a_EA_Comparison_Report.xml" "C:\Reports"
java -jar cim-compare-1.2.2.jar CIM15v33_CIM16v26a_EA_Comparison_Report.xml "C:\Comparison Reports" --minimal
java -jar cim-compare-1.2.2.jar CIM15v33_CIM16v26a_EA_Comparison_Report.xml "C:\Comparison Reports" --package=IEC61968 --include-diagrams
java -jar cim-compare-1.2.2.jar CIM15v33_CIM16v26a_EA_Comparison_Report.xml ComparisonReport_CIM15v33_CIM16v26a.html
java -jar cim-compare-1.2.2.jar CIM15v33_CIM16v26a_EA_Comparison_Report.xml
java -jar cim-compare-1.2.2.jar CIM15v33_CIM16v26a_EA_Comparison_Report.xml --package=IEC61970
java -jar cim-compare-1.2.2.jar CIM15v33_CIM16v26a_EA_Comparison_Report.xml --package=IEC61970 --minimal
java -jar cim-compare-1.2.2.jar CIM15v33_CIM16v26a_EA_Comparison_Report.xml --package=IEC61970 --minimal --zip

Enterprise Architect XMI Export Procedures

The procedure to perform an export of EA baseline and destination models as XMI 1.1 compliant files is as follows (screenshots taken from EA v15.1):

  1. In Enterprise Architect load the “baseline” (or older) model and select the top-level package of the model as shown.

  1. Once selected, choose the Publish menu and then the “Other Formats…” menu.

  1. The dialog box shown next will be presented to allow selection of the specific settings to use for export. Select the “UML 1.3 (XMI 1.1)” XML export type. This is the only export format supported for cim-compare comparison reports. It is important that the "Unisys/Rose Format" option not be checked. Finally, the inclusion of UML diagrams in the comparison report can optionally be selected at this time. This is done by additionally checking the "Export Diagrams" and "Generate Diagram Images" check boxes along with the selection of an image type (e.g. JPG, GIF, PNG, etc.) to export the diagrams in. Note that when including UML diagrams as part of the export EA will automatically create a directory called "Images" and export all image files into that directory. Note that when exporting an image type other than JPG the --image-type command line option described in the "Command Line Usage" section must be used.

  2. Finish out by selecting a target directory along with a file name for the "Filename" field.

  3. Click the Export button. Note that at this point it will take a while for the export to complete.

  4. If UML diagrams were included then upon completion of the export you should navigate to the export directory and rename the diagrams directory from "Images" to "Images-baseline". The naming convention is important and must match what is indicated here including case-sensitivity.

  5. Now close out of the baseline model load the destination model into EA and perform Steps 1 through 6 again but this time be sure to enter a different name into the "Filename" field for the destination XMI file to be exported. Upon completion the destination model's "Images" directory should be renamed to "Images-destination".

  6. The result should be a final export directory containing two images directories (i.e. "Images-baseline" and "Images-destination" containing the baseline and destination diagrams respectively) and two distinct XMI files to be used as input on the command line to cim-compare.

Java Technical Requirements

cim-compare ships as a fully self-contained executable jar file with no external dependencies. It has been tested and confirmed to run successfully using Java 1.8 through Java 12.

Given the large file sizes consumed and produced by the utility, OutOfMemory exceptions occur if the default heap size is used. The following guidelines should be followed:

For a 32-bit JRE it is recommended to specify a max heap size of at least 1G (i.e. 1024m) resources permitting. With a 1G heap size the execution will typically run a little slower. Note that the maximum theoretical heap limit for a 32-bit JVM is 4G. However, due to various additional constraints such as available swap, kernel address space usage, memory fragmentation, and VM overhead, in practice the limit can be much lower. On most modern 32-bit Windows systems the maximum heap size will range from 1.4G to 1.6G.

java -mx1024m -jar cim-compare-1.2.2.jar iec61970cim16v26a.xmi iec61970cim17v16.xmi D:\reports

For 64 bit JREs it is recommended that the maximum heap size be increased to at least 2G (i.e. 2048m) if available. It has been observed that 2G is usually sufficient to handle the largest CIM files one might encounter.

java -mx2048m -jar cim-compare-1.2.2.jar iec61970cim16v26a.xmi iec61970cim17v16.xmi D:\reports

Latest Release

  • 1.2.2

    • The latest release is available at cim-compare-1.2.2.
    • Information on features and/or fixes for the release can be found here.

License

Distributed under the MIT license. See LICENSE for more information.