Topic
  • 5 replies
  • Latest Post - ‏2013-10-21T07:08:27Z by benmalik
benmalik
benmalik
4 Posts

Pinned topic Absorbing Fragments programmatically and headless

‏2013-09-30T08:50:46Z |

Hi everybody,

we are trying to absorb model fragments in RSA 8.04 both headless and programmatically. The reason being, our developers should not have to worry about defragmenting a model before checking in the model to SVN.  IBM provided a sample code for a pluglet, which we used to write an Eclipse-Plugin which we can call from commandline. When invoked from the RSA GUI, the plugin works exactly like it should. But when called from commandline, the physical fragment files do not get deleted after absorption, and whats more, the resulting model file is larger (in file size) and after validation shows a lot of errors of the type: "Relationships must connect to correct semantic elements"

The plugin is called by this command:

java -jar "C:\Program Files\IBM\SDP\plugins\org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar" -application absorbPlugin.absorbPlugin

I assume the problems are caused by dependencies on RSA UI components or the workbench. Does anybody have experience with running RSA in a headless environment and especially doing manipulations on models?

Updated on 2013-10-07T14:46:31Z at 2013-10-07T14:46:31Z by benmalik
  • benmalik
    benmalik
    4 Posts
    ACCEPTED ANSWER

    Re: Absorbing Fragments programmatically and headless

    ‏2013-10-21T07:08:27Z  

    While headless programmatical absorbtion does not work, we found a workaround by opening RSA from commandline and executing the absorption code on startup.

    It is important to note that correct absorption will only work if you not only open the root model, but also open all model fragments by calling the openModelResource() method on them. Only then all fragments get absorbed correctly and references will point to the correct logical resources.

  • FXPanaget
    FXPanaget
    22 Posts

    Re: Absorbing Fragments programmatically and headless

    ‏2013-09-30T14:47:22Z  

    Hi Benjamin,

    Which version of RSA are you using and on which platform?

    The pluglet you are referencing is using the UMLModeler.absorbFragmentSilently(Resource, boolean) to reabsorb the fragment into its parent resource. UMLModeler is part of the ui packages so there might  indeed well be dependencies to the RSA UI.

    It is difficult without looking at your plugin code to verify that indeed the problem is due to the UI. The problem could be elsewhere. Are you getting error during the execution? The errors of the type: "Relationships must connect to correct semantic elements" sound like the references were not updated during the absorption. Can you share the plugin with us or with your IBM Rational support team?

    Else, I would advise you to have a look at the online help topics which give further information on the fragment absorption: Extending product function > Extending Rational Software Architect function > Extending the Rational modeling environment > Rational Modeling Platform Developer Guide > Programmer's Guide > Common extensibility activities > Model fragments (link for 7.5 infocenter) and Extending product function > Extending Rational Software Architect function > Extending the Rational modeling environment > Rational Modeling Platform Developer Guide > Examples Guide > UML Modeler Fragment Example (link for 7.5 infocenter)

    Regards,

    Francois

  • benmalik
    benmalik
    4 Posts

    Re: Absorbing Fragments programmatically and headless

    ‏2013-09-30T16:22:55Z  
    • FXPanaget
    • ‏2013-09-30T14:47:22Z

    Hi Benjamin,

    Which version of RSA are you using and on which platform?

    The pluglet you are referencing is using the UMLModeler.absorbFragmentSilently(Resource, boolean) to reabsorb the fragment into its parent resource. UMLModeler is part of the ui packages so there might  indeed well be dependencies to the RSA UI.

    It is difficult without looking at your plugin code to verify that indeed the problem is due to the UI. The problem could be elsewhere. Are you getting error during the execution? The errors of the type: "Relationships must connect to correct semantic elements" sound like the references were not updated during the absorption. Can you share the plugin with us or with your IBM Rational support team?

    Else, I would advise you to have a look at the online help topics which give further information on the fragment absorption: Extending product function > Extending Rational Software Architect function > Extending the Rational modeling environment > Rational Modeling Platform Developer Guide > Programmer's Guide > Common extensibility activities > Model fragments (link for 7.5 infocenter) and Extending product function > Extending Rational Software Architect function > Extending the Rational modeling environment > Rational Modeling Platform Developer Guide > Examples Guide > UML Modeler Fragment Example (link for 7.5 infocenter)

    Regards,

    Francois

    Hello Francois,

    I am running RSA 8.0.4 on Windows 7 x86. There are no errors shown during execution via command line.

    I pasted the plugin code on Pastebin for you to see: http://pastebin.com/rQ8tu80V

    As you can see, the plugin code varies only slightly from the original IBM Pluglet (which requires a selected model in the Package explorer, while our plugin opens a model by a given filepath). When running the plugin from RSA UI, it works flawlessly, but starting it via command line results in this strange behaviour.

    Something must go wrong, since the fragments are not deleted and references not updated correctly.

    Best regards,

    Ben

  • FXPanaget
    FXPanaget
    22 Posts

    Re: Absorbing Fragments programmatically and headless

    ‏2013-10-01T14:30:20Z  
    • benmalik
    • ‏2013-09-30T16:22:55Z

    Hello Francois,

    I am running RSA 8.0.4 on Windows 7 x86. There are no errors shown during execution via command line.

    I pasted the plugin code on Pastebin for you to see: http://pastebin.com/rQ8tu80V

    As you can see, the plugin code varies only slightly from the original IBM Pluglet (which requires a selected model in the Package explorer, while our plugin opens a model by a given filepath). When running the plugin from RSA UI, it works flawlessly, but starting it via command line results in this strange behaviour.

    Something must go wrong, since the fragments are not deleted and references not updated correctly.

    Best regards,

    Ben

    Hi Ben,

    I have made a quick test and I did see similar behavior. In my test the fragment files were indeed not deleted....  It would not surprise me if the deletion is more dependent on the UI  .. ( you could think of handling the deletion yourself).

    Else, I do not see a difference at the model level in term of it size or broken references. I did try a sample test so your scenario may be more complicated.

    Regards,

    Francois

     

  • benmalik
    benmalik
    4 Posts

    Re: Absorbing Fragments programmatically and headless

    ‏2013-10-01T14:49:36Z  
    • FXPanaget
    • ‏2013-10-01T14:30:20Z

    Hi Ben,

    I have made a quick test and I did see similar behavior. In my test the fragment files were indeed not deleted....  It would not surprise me if the deletion is more dependent on the UI  .. ( you could think of handling the deletion yourself).

    Else, I do not see a difference at the model level in term of it size or broken references. I did try a sample test so your scenario may be more complicated.

    Regards,

    Francois

     

    Hi Francois,

    Thank you for testing!

    Indeed that's what I thought I would be doing, just delete the fragments myself after they have been absorbed. But the bigger problems are indeed the broken references and file size. While I couldn't see a difference on a really small model, containing only 2-3 empty classes, on a big model (file size about 47MB) broken references are the result. 

    There must be a way to automatically invoke defragmentation of the model, but how?

    Best regards,

    Ben

    Updated on 2013-10-07T14:47:18Z at 2013-10-07T14:47:18Z by benmalik
  • benmalik
    benmalik
    4 Posts

    Re: Absorbing Fragments programmatically and headless

    ‏2013-10-21T07:08:27Z  

    While headless programmatical absorbtion does not work, we found a workaround by opening RSA from commandline and executing the absorption code on startup.

    It is important to note that correct absorption will only work if you not only open the root model, but also open all model fragments by calling the openModelResource() method on them. Only then all fragments get absorbed correctly and references will point to the correct logical resources.