Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run analysis on implementation #841

Closed
joeseibel opened this issue Jun 5, 2017 · 16 comments · Fixed by #2426
Closed

Run analysis on implementation #841

joeseibel opened this issue Jun 5, 2017 · 16 comments · Fixed by #2426
Assignees
Milestone

Comments

@joeseibel
Copy link
Contributor

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
Copy link
Contributor

lwrage commented Dec 22, 2017

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

@lwrage lwrage added backlog and removed next labels Feb 9, 2018
@lwrage lwrage added analyses analyses from plugins importance:medium labels Sep 21, 2018
@lwrage lwrage removed the backlog label Jul 9, 2019
@AaronGreenhouse
Copy link
Contributor

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

  • If the implementation is already instantiated, have the analysis run on that instance.
  • If the implementation is not already instantiated, instantiate it, and then run over the instance.

@AaronGreenhouse
Copy link
Contributor

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
Copy link
Contributor

lwrage commented Aug 4, 2020

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

@AaronGreenhouse
Copy link
Contributor

AaronGreenhouse commented Aug 10, 2020

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.

  • Takes a set of ComponentImplementations as input.
  • Tries to instantiate them.
  • Optionally shows the results in a dialog.
  • Communicates back (how?) the set of successfully instantiated and unsuccessfully instantiated components. Also indicates where the instance models are.

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
Copy link
Contributor

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

@AaronGreenhouse
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

AaronGreenhouse commented Aug 13, 2020

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
Copy link
Contributor

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

@AaronGreenhouse
Copy link
Contributor

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

  • org.osate.ui.definition.private.isAADLProject — private — Tests if the currently selected object (from a with expression) is an AADL project (or a closed project of any sort).
  • org.osate.ui.definition.private.isAADLFolder — private — Tests if the currently selected object (from a with expression) is a folder inside of an AADL project.
  • org.osate.ui.definition.private.isAAXLFile — private — Tests if the currently selected object (from a with expression) is an AAXL instance model file.
  • org.osate.ui.definition.private.isInstantiatableEObjectURIWrapper — private — Tests if the currently selected object (from a with expression) is an EObjectURIWrapper that can be adapted to an ComponentImplementation that can be instantiated. That is, one that is not a subprogram or subprogram group implementation. This is mean for testing the selection in the AADL Navigator view.
  • org.osate.ui.definition.private.isInstantiatableEObjectNode — private — Tests if the currently selected object (from a with expression) is an EObjectNode that can be adapted to an ComponentImplementation that can be instantiated. That is, one that is not a subprogram or subprogram group implementation. This is mean for testing the selection in the Outline view.
  • org.osate.ui.definition.public.instanceAnalysisCommandVisibility — public — Meant to be used in a visibleWhen expression. Tests if 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.
  • org.osate.ui.definition.public.instanceAnalysisCommandEnabled — public — Meant to be used in an enabledWhen expression. Tests if there are 1 or more selected objects and all of them of them are either a working set, AADL Project, folder in an AADL Project, an AAXL file, or an instantiatable component implementation.

@AaronGreenhouse
Copy link
Contributor

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

@AaronGreenhouse
Copy link
Contributor

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

@AaronGreenhouse
Copy link
Contributor

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

@AaronGreenhouse
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants