Search in sources :

Example 1 with SecModelLibrary

use of org.sireum.aadl.osate.securitymodel.secMF.SecModelLibrary in project osate-plugin by sireum.

the class SmfVisitor method getAllPackages.

private HashSet<SecModelLibrary> getAllPackages(Element root) {
    HashSet<SecModelLibrary> secLibs = new HashSet<SecModelLibrary>();
    // no need of seen set as the circular imports are not allowed
    HashSet<ModelUnit> seens = new HashSet();
    PackageSection ps = AadlUtil.getContainingPackageSection(((SystemInstance) root).getComponentClassifier());
    EList<ComponentImplementation> ais = AadlUtil.getAllComponentImpl();
    Set<ModelUnit> aps = ais.stream().flatMap(it -> AadlUtil.getContainingPackage(it).getPublicSection().getImportedUnits().stream()).collect(Collectors.toSet());
    Set<ModelUnit> worklist = aps;
    try {
        for (ModelUnit head : worklist) {
            seens.add(head);
            if (head != null && head instanceof AadlPackage) {
                secLibs.addAll(AnnexUtil.getAllActualAnnexLibraries((AadlPackage) head, SecMFPackage.eINSTANCE.getSecModelLibrary()).stream().map(al -> (SecModelLibrary) al).collect(Collectors.toList()));
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return secLibs;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) SmfTypeDef(org.sireum.aadl.osate.securitymodel.secMF.SmfTypeDef) AnnexUtil(org.osate.annexsupport.AnnexUtil) Element(org.osate.aadl2.Element) SMFDeclassification(org.sireum.aadl.osate.securitymodel.secMF.SMFDeclassification) ComponentImplementation(org.osate.aadl2.ComponentImplementation) Name(org.sireum.hamr.ir.Name) SecMFPackage(org.sireum.aadl.osate.securitymodel.secMF.SecMFPackage) HashSet(java.util.HashSet) AnnexLib(org.sireum.hamr.ir.AnnexLib) SmfDeclass(org.sireum.hamr.ir.SmfDeclass) Classifier(org.osate.aadl2.Classifier) Annex(org.sireum.hamr.ir.Annex) SmfClassification(org.sireum.hamr.ir.SmfClassification) SystemInstance(org.osate.aadl2.instance.SystemInstance) AadlUtil(org.osate.aadl2.modelsupport.util.AadlUtil) SecModelLibrary(org.sireum.aadl.osate.securitymodel.secMF.SecModelLibrary) SecModelSubclause(org.sireum.aadl.osate.securitymodel.secMF.SecModelSubclause) PackageSection(org.osate.aadl2.PackageSection) Set(java.util.Set) AadlPackage(org.osate.aadl2.AadlPackage) SMFClassification(org.sireum.aadl.osate.securitymodel.secMF.SMFClassification) Collectors(java.util.stream.Collectors) EList(org.eclipse.emf.common.util.EList) List(java.util.List) ModelUnit(org.osate.aadl2.ModelUnit) SmfType(org.sireum.hamr.ir.SmfType) AnnexSubclause(org.osate.aadl2.AnnexSubclause) NamedElement(org.osate.aadl2.NamedElement) AadlPackage(org.osate.aadl2.AadlPackage) SecModelLibrary(org.sireum.aadl.osate.securitymodel.secMF.SecModelLibrary) PackageSection(org.osate.aadl2.PackageSection) ModelUnit(org.osate.aadl2.ModelUnit) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 EList (org.eclipse.emf.common.util.EList)1 AadlPackage (org.osate.aadl2.AadlPackage)1 AnnexSubclause (org.osate.aadl2.AnnexSubclause)1 Classifier (org.osate.aadl2.Classifier)1 ComponentImplementation (org.osate.aadl2.ComponentImplementation)1 Element (org.osate.aadl2.Element)1 ModelUnit (org.osate.aadl2.ModelUnit)1 NamedElement (org.osate.aadl2.NamedElement)1 PackageSection (org.osate.aadl2.PackageSection)1 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)1 SystemInstance (org.osate.aadl2.instance.SystemInstance)1 AadlUtil (org.osate.aadl2.modelsupport.util.AadlUtil)1 AnnexUtil (org.osate.annexsupport.AnnexUtil)1 SMFClassification (org.sireum.aadl.osate.securitymodel.secMF.SMFClassification)1 SMFDeclassification (org.sireum.aadl.osate.securitymodel.secMF.SMFDeclassification)1 SecMFPackage (org.sireum.aadl.osate.securitymodel.secMF.SecMFPackage)1