Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
COSMOS Change Analyzer Build Instructions
Building Change Analyzer
NOTE: These instructions are valid until we are able to remove the dependency on Tuscany and can fully integrate the Change Analyzer with the COSMOS Tooling SPI. (updated on 14 August 2008)
Using Eclipse SDK 3.4.0…
- Checkout the org.eclipse.cosmos.me.deployment.sdd.runtime.ca project from :pserver:anonymous@dev.eclipse.org:/cvsroot/technology.
- Right click in the CVS Repositories perspective in Eclipse, and select Paste Connection. Then all you have to do is copy in the path above.
- Unzip the required jars from ChangeAnalyzer_Tuscany.zip:
com.ctc.wstx_3.2.1.jar javax.xml.stax_1.0.1.jar org.apache.tuscany.sdo.api_1.0.0.597192.jar org.apache.tuscany.sdo.impl_1.0.0.597192.jar org.apache.tuscany.sdo.lib_1.0.0.597192.jar org.apache.tuscany.sdo.tools_1.0.0.jar org.eclipse.emf.codegen_2.2.2.v200705141058.jar org.eclipse.emf.codegen.ecore_2.2.2.v200705141058.jar org.eclipse.emf.common_2.2.1.v200705141058.jar org.eclipse.emf.ecore_2.2.3.v200705141058.jar org.eclipse.emf.ecore.change_2.2.1.v200705141058.jar org.eclipse.emf.ecore.xmi_2.2.3.v200705141058.jar org.eclipse.xsd_2.2.3.v200705141058.jar sdd_das.jar sdd_sdo.jar spi.jar
- NOTE: Please contact Jason Losh (Jason.Losh@sas.com) to obtain the ChangeAnalyzer_Tuscany.zip file.
- Put these jars into a directory that you can reference later.
- Right click on org.eclipse.cosmos.me.deployment.sdd.runtime.ca project in Eclipse, select Build Path > Configure Build Path.
- On the Libraries tab, select all the variables listed, and click Remove.
- Then click Add External JARs….
- Select all the jars you unzipped earlier and click Open.
- Once they are all added to the list, you can click on OK.
- The project should start to build.
There are a few settings that you may want to change, especially if you are using JRE 1.5, so that you aren’t bombarded with duplicate warnings.
- In the main eclipse menu bar, click on Window > Preferences. When the Preferences dialog comes up on the left hand side select Java > Compiler > Errors/Warnings. The following changes are suggested:
- Under Potential programming problems, change the first item, Serializable class without serialVersionUID: to Ignore.
- Under Deprecated and restricted API, change the first item, Deprecated API: to Ignore.
- Under Generic types, change the first item, Unchecked generic type operation: and the second item, Usage of a raw type: to Ignore.
- Click Apply. The project should start to build again. When it’s finished you can click OK.
Running Change Analyzer
- First, you will need a SDD deployment descriptor and a SDD package descriptor. I took the shopping cart example from the Change Analyzer documentation and fixed it so it would validate. I had to point it to local copies of my SDD CL1 schemas because the official schema files do not have the right URL’s in them. I also had to add a couple of “id” attributes to the resource constraints.
- Next, create a ChangeAnalyzer.properties file, and include the following properties (make sure to use “/” for path separators):
SDD_INPUT_FILE=<Path to deployment descriptor xml> PKG_INPUT_FILE=<Path to package descriptor xml> OUTPUT_FILE_PATH=<Path to some directory where you want the output files to go> OPERATION=install
- There are two places in the code that you will need to update, so that you will be able to run from the repository successfully.
- In org.eclipse.cosmos.me.internal.deployment.sdd.runtime.core.ca.output.Output.java you need to update the copyFiles method to match the following:
/** * @param outputFilePath */ public void copyFiles(String outputFilePath) { // Source File String source = "/org.eclipse.cosmos.me.internal.deployment.sdd.resources.runtime.ca/plus.gif"; File f = new File(source); if(!f.exists()) { source = "/org/eclipse/cosmos/me/internal/deployment/sdd/resources/runtime/ca/plus.gif"; } String source1 = "/org.eclipse.cosmos.me.internal.deployment.sdd.resources.runtime.ca/minus.gif"; String source2 = "/org.eclipse.cosmos.me.internal.deployment.sdd.resources.runtime.ca/chg.css"; f = new File(source1); if(!f.exists()) { source1 = "/org/eclipse/cosmos/me/internal/deployment/sdd/resources/runtime/ca/minus.gif"; } f = new File(source2); if(!f.exists()) { source2 = "/org/eclipse/cosmos/me/internal/deployment/sdd/resources/runtime/ca/chg.css"; } // Destination File String dest = outputFilePath + "plus.gif"; String dest1 = outputFilePath + "minus.gif"; String dest2 = outputFilePath + "chg.css"; copyTo(source , dest); copyTo(source1 , dest1); copyTo(source2 , dest2); }
- You will also need to add an import java.io.File; statement to this file.
- In org.eclipse.cosmos.me.internal.deployment.sdd.runtime.ca.transformations.TransformImpl.java you need to update the transformToHtml method to match the following:
/** * Tranforms the xml file to html using the xsl * * @param outputFilePath - * output path where the generated XSL file should be present */ public void transformToHtml(String outputFilePath) { TransformerFactory tf = TransformerFactory.newInstance(); Transformer xsl; try { InputStream in = getClass().getResourceAsStream( "/org.eclipse.cosmos.me.internal.deployment.sdd.resources.runtime.ca/Output.xsl"); if(in == null) { in = getClass().getResourceAsStream( "/org/eclipse/cosmos/me/internal/deployment/sdd/resources/runtime/ca/Output.xsl"); } xsl = tf.newTransformer(new StreamSource(in)); xsl.transform((new StreamSource(outputFilePath.trim() + StringConstants.CA_XML_INPUT)), (new StreamResult( outputFilePath.trim() + StringConstants.CA_HTML_OUTPUT))); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } }
- Once these changes have been saved, in Eclipse go to Run > Debug Configurations and on the dialog that pops up, select the Arguments tab. Enter the path to the ChangeAnalyzer.properties file that you created earlier.
- You should also set a breakpoint on line 60 in org.eclipse.cosmos.me.internal.deployment.sdd.runtime.core.ca.changeanalyzer.ChangeAnalyzer.java, which will get the debugger to stop at the very beginning of the execution.
- You should now be able to use the Debugger button on the main Eclipse Toolbar to run the Change Analyzer in debug mode.