osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
36 stars 8 forks source link

Run analysis on implementation #841

Closed joeseibel closed 3 years ago

joeseibel commented 7 years ago

For analyses that operate on the instance model, it should be possible to run them on an implementation. The analysis should automatically generate the instance before running the analysis. This request came up during the AADL standards committee meeting.

lwrage commented 6 years ago

We need to find a generic solution that can be added to all existing instance model based analyses.

AaronGreenhouse commented 4 years ago

Going to experiment with this using the bus load analysis which was written with a new action handler, and the flow latency analysis, which was written the old way.

It sounds like people want to be able to invoke an analysis on a component implementation, and then have one of the following things happen

AaronGreenhouse commented 4 years ago

Work with the new bus load analysis first.

I need to

  1. Update the plugin.xml so that the command is active for component implementations (basically anything that can be instantiated) (see the instantiation commands).
  2. Update the kick off job to find all the component implementations
  3. For each component implementation determine if it already has an instantiation. IF so, add it to the regular list of aaxl files to process. If not, we need to add it to a new list of files to be instantiated.
  4. Instantiate the necessary files. If there is some kind of failure report it, otherwise add the instantiated file to the list of aaxl files to process.
  5. Process the aaxl files as usual.
lwrage commented 4 years ago

Running an analysis on an implementation should always create a fresh instance model.

AaronGreenhouse commented 4 years ago

First thing I need to do is modify the InstantiationHandler to extract an "instantiation engine" class (probably really a Job) that can be used in multiple contexts, including the InstantiationHandler.

Should be abstracted to both instantiate and reinstantiate engines.

End result should be .internal.. We want to use this in a few places, but no reason a 3rd-party should if we get the abstract handlers right.

AaronGreenhouse commented 4 years ago

Adding this to the 3rd-party API epic because it relates to fixing up the abstract handlers for OSATE analyses.

AaronGreenhouse commented 4 years ago

Created org.osate.ui.internal.instantiate.AbstractInstantiationEngine, and then org.osate.ui.internal.instantiate.InstantiationEngine and org.osate.ui.internal.instantiate.ReinstantiationEngine. These replace AbstractMultiJobHandler, which is now @deprecated (it never should have been public).

The instantiate and reinstantiate handlers have been updated to use the engines.

AaronGreenhouse commented 4 years ago

Okay, back to updating NewBusLoadAnalyisHandler. I need to

  1. Update the plugin.xml so that the command is active for component implementations (basically anything that can be instantiated) (see the instantiation commands).
  2. Update the kick off job to find all the component implementations.
  3. Use the instantiation engine to instantiate the component implementations.
  4. Add the successfully instantiated models to the list of aaxl files to process.
  5. Process the aaxl files as usual.
AaronGreenhouse commented 4 years ago

Updated NewAbstractAaxlHandler to find all the ComponentImplementations in the UI selection and pass them to the instantiation engine. This was pretty easy now that we have the engine.

It was more work to update the plugin.xml so that the bus load analysis command is available in the outline view and navigator view on component implementations. The command is not available on aadl files. I could do so easily, but I think that would be very confusing.

AaronGreenhouse commented 4 years ago

API Issue Should make a template in the plugin.xml that bundles up the activation/enablement patterns for commands that operate on instance models. I forgot right now what Eclipse calls these things, but I know we have one already lying around for something else.

This is the definition extension point

AaronGreenhouse commented 4 years ago

Should update the old AaxlReadOnlyHandlerAsJob so that the old commands can benefit, but this class will be replaced in the future.

AaronGreenhouse commented 4 years ago

Added definitionsextenstion points to org.osate.ui plugin to simplify command visibility and enablement for commands execute analysis over an instance model.

       <!-- open AADL project or any closed project -->
       <definition id="org.osate.ui.definition.private.isAADLProject">
          <and>
             <instanceof value="org.eclipse.core.resources.IProject" />
             <or>
                <test
                    property="org.eclipse.core.resources.projectNature"
                    value="org.osate.core.aadlnature" />
                <not>
                   <test property="org.eclipse.core.resources.open" />
                </not>
             </or>
          </and>
       </definition>

       <!-- folder in an AADL project -->
       <definition id="org.osate.ui.definition.private.isAADLFolder">
          <and>
             <instanceof value="org.eclipse.core.resources.IFolder" />
             <test
                   property="org.eclipse.core.resources.projectNature"
                   value="org.osate.core.aadlnature" />
             </and>
       </definition>

       <!-- Instance model file -->
       <definition id="org.osate.ui.definition.private.isAAXLFile">
          <adapt
                type="org.eclipse.core.resources.IFile">
             <test
                   property="org.eclipse.core.resources.contentTypeId"
                   value="org.osate.core.instanceModelFile">
             </test>
          </adapt>
       </definition>

       <!-- Instantiatable ComponentImplementation as an EObjectURIWrapper (navigator view) -->
       <definition id="org.osate.ui.definition.private.isInstantiatableEObjectURIWrapper">
          <adapt
                type="org.osate.aadl2.modelsupport.EObjectURIWrapper">
             <and>
                <test
                      property="org.osate.aadl2.modelsupport.wrapperSuperType"
                      value="ComponentImplementation"
                      forcePluginActivation="true">
                </test>
                <not>
                   <test
                         property="org.osate.aadl2.modelsupport.wrapperSuperType"
                         value="SubprogramImplementation"
                         forcePluginActivation="true">
                   </test>
                </not>
                <not>
                   <test
                         property="org.osate.aadl2.modelsupport.wrapperSuperType"
                         value="SubprogramGroupImplementation"
                         forcePluginActivation="true">
                    </test>
                 </not>
              </and>
           </adapt>
       </definition>

       <!-- Instantiatable ComponentImplementation as an EObjectURIWrapper (outline view) -->
       <definition id="org.osate.ui.definition.private.isInstantiatableEObjectNode">
          <adapt
                type="org.eclipse.xtext.ui.editor.outline.impl.EObjectNode">
             <and>
                <test
                      property="org.osate.ui.superType"
                      value="ComponentImplementation"
                      forcePluginActivation="true">
                </test>
                <not>
                   <test
                         property="org.osate.ui.superType"
                         value="SubprogramImplementation"
                         forcePluginActivation="true">
                   </test>
                </not>
                <not>
                   <test
                         property="org.osate.ui.superType"
                         value="SubprogramGroupImplementation"
                         forcePluginActivation="true">
                   </test>
                </not>
             </and>
          </adapt>
       </definition>

       <!-- For visibleWhen: Be visible when there are 1 or more selected objects and AT LEAST ONE of them
            is a working set, AADL Project, folder in an AADL Project, an AAXL file, or an instantiatable
            component implementation. -->
       <definition id="org.osate.ui.definition.public.instanceAnalysisCommandVisibility">
          <with
                variable="selection">
             <and>
                <count
                      value="+">
                </count>
                <iterate
                      ifEmpty="false"
                      operator="or">
                   <or>
                      <!-- Working set -->
                      <instanceof value="org.eclipse.ui.IWorkingSet" />

                      <reference definitionId="org.osate.ui.definition.private.isAADLProject"/>
                      <reference definitionId="org.osate.ui.definition.private.isAADLFolder"/>
                      <reference definitionId="org.osate.ui.definition.private.isAAXLFile"/>
                      <reference definitionId="org.osate.ui.definition.private.isInstantiatableEObjectURIWrapper"/>
                      <reference definitionId="org.osate.ui.definition.private.isInstantiatableEObjectNode"/>
                   </or>
                </iterate>
             </and>
          </with>
       </definition> 

       <!-- For enabledWhen: Be enabled when there are 1 or more selected objects and ALL OF THEM are one of
            working set, AADL Project, folder in an AADL Project, an AAXL file, or an instantiatable
            component implementation. -->
       <definition id="org.osate.ui.definition.public.instanceAnalysisCommandEnabled">
          <with
                variable="selection">
             <and>
                <count
                      value="+">
                </count>
                <iterate
                      ifEmpty="false"
                      operator="and">
                   <or>
                      <!-- Working set -->
                      <instanceof value="org.eclipse.ui.IWorkingSet" />

                      <reference definitionId="org.osate.ui.definition.private.isAADLProject"/>
                      <reference definitionId="org.osate.ui.definition.private.isAADLFolder"/>
                      <reference definitionId="org.osate.ui.definition.private.isAAXLFile"/>
                      <reference definitionId="org.osate.ui.definition.private.isInstantiatableEObjectURIWrapper"/>
                      <reference definitionId="org.osate.ui.definition.private.isInstantiatableEObjectNode"/>
                   </or>
                </iterate>
             </and>
          </with>
       </definition> 

Private definitions are meant to be used internally to define public definitions. Public definitions are to be part of the 3rd party API and should be documented. The above has

AaronGreenhouse commented 4 years ago

Updated the instantiate and reinstantiate commands to use the new definitions.

AaronGreenhouse commented 4 years ago

Added "Reinstantiate" to the instance editor and instance outline view context menus.

AaronGreenhouse commented 4 years ago

Added Bus load analysis to the instance editor and instance outline view context menus. Updated the NewAbstractAaxlHandler to deal with SystemInstance selections.

AaronGreenhouse commented 4 years ago

Cleaned up <visibleWhen> and <enabledWhen> clauses in all the plugin.xml files to make better use of definitions. Added a few more private ones. Added another public one:

       <!-- For enabledWhen: Be enabled when we are in the AADL Perspective -->
       <definition id="org.osate.ui.definition.public.inAadlPerspective">
          <with
                variable="activeWorkbenchWindow.activePerspective">
             <equals
                   value="org.osate.ui.perspective.AadlPerspective">
             </equals>
          </with>
       </definition>

This is used by toolbar commands.