Thursday, June 4, 2015

Add/Update C-APP artifacts manually

For artifacts such as BPMN/ Human Task, building Capp files from developer studio is not yet supported. Therefore we need to add these artifacts manually. So the best option is to create a Capp from Wso2 developer studio with BPEL artifacts, and manually make the changes.

supposing that your Capp file is TestPro_1.0.0.car,
(Terminal commands are given in brackets.

1. Convert test1.car to test1.zip (mv TestPro_1.0.0.car TestPro_1.0.0.zip)
2. Unzip the folder.
3. Supposing the folder structure is like below.
     
4. 'artifacts.xml' content should register Hello2_1.0.0 folder within TestPro like below.

<?xml version="1.0" encoding="UTF-8"?>
<artifacts>
    <artifact name="TestPro" version="1.0.0" type="carbon/application">
         <dependency artifact="Hello2" version="1.0.0" include="true" serverRole="BusinessProcessServer"/>
    </artifact>
</artifacts>

5.  Structure inside Hello2_1.0.0 should look like below.  This is where you can add your BPMN artifact. (If you created a bpel artifact based Capp file there will be a zipped folder of bpel artifacts. You can remove that and add your BPMN artifacts here. )

6. 'artifact.xml' content should register the BPMN artifact dependency within Hello2 folder like below.

<?xml version="1.0" encoding="UTF-8"?>
<artifact name="Hello2" version="1.0.0" type="bpmn/artifact" serverRole="BusinessProcessServer">
    <file>VacationRequest.bar</file>
</artifact>

7. Go to TestPro_1.0.0 folder location from the terminal and zip everything inside it.
   ( zip -r TestPro_1.0.0.zip * )

8.  Rename it back to .car.   (mv TestPro_1.0.0.zip TestPro_1.0.0.car )

You could follow the same pattern for human task artifact based Capp files as well. Only difference would be instead of a .bar file, human task artifacts need to be zipped just like BPEL artifacts.

Supposing you need to add multiple BPMN artifacts to a Capp file , you need to convert the car to zip and include as below.



 Now your 'artifacts.xml' needs to register both folders.

<?xml version="1.0" encoding="UTF-8"?>
<artifacts>
    <artifact name="TestPro" version="1.0.0" type="carbon/application">
        <dependency artifact="Hello3" version="1.0.0" include="true" serverRole="BusinessProcessServer"/>
         <dependency artifact="Hello2" version="1.0.0" include="true" serverRole="BusinessProcessServer"/>
    </artifact>
</artifacts>

So inside Hello3 folder, you will have your second bpmn artifact  (.bar file) and make sure to register it inside artifact.xml as before. (Make sure that the artifact name is now Hello3 )



<?xml version="1.0" encoding="UTF-8"?>
<artifact name="Hello3" version="1.0.0" type="bpmn/artifact" serverRole="BusinessProcessServer">
    <file>Hello3-1.0.0.bar</file>
</artifact>

Make sure the highlighted properties are double checked, else on deployment of the Capp you will get an error stating that some of the dependencies are missing .

No comments:

Post a Comment