private HashSet determineLayerInListOfCategories(ListOfPackageCategories loc) { HashSet layers = new HashSet(); // Enumeration keys = architecturalLayerMapping.getMappings().keys(); Enumeration keys = architecturalLayerMappingTable.keys(); while (keys.hasMoreElements()) { String layer = (String) keys.nextElement(); // System.out.print ( "layer " + layer ); ArchitecturalLayerMapping alMapping = architecturalLayerMappingTable.get(layer); Iterator itAlTe = alMapping.getTechStackEntityListValues().iterator(); while (itAlTe.hasNext()) { TechStackEntity tse = (TechStackEntity) itAlTe.next(); if (loc.contains(tse.getName())) { // layers.add((String) architecturalLayerMapping.getMappings().get(key)); layers.add(layer); // layers.add((String) architecturalLayerMappingTable.get(key)); // System.out.println ( " ..added" ); } else { // System.out.println ( " ..failed" ); } } } return layers; }
public void checkVariableType(TypeSpecification typDef, TypeBody declarationType) throws JselException, ClassNotFoundException { boolean foundAnyCategory = false; Iterator it = this.architecturalLayerMappingTable.values().iterator(); while (it.hasNext() && !foundAnyCategory) { ArchitecturalLayerMapping alm = (ArchitecturalLayerMapping) it.next(); Iterator stackEnum = alm.getTechStackEntityListValues().iterator(); while (stackEnum.hasNext() && !foundAnyCategory) { TechStackEntity tse = (TechStackEntity) stackEnum.next(); foundAnyCategory = iterateThroughVarDefSearchStrings( tse.getVariableMapping(), typDef, tse.getName(), declarationType); } } if (foundAnyCategory) { // THIS means, I have a dam clue about this var } else { if (nonTrivialTypeFilter(typDef)) { unknownVariableList.add(typDef.getName()); } } }
public void init() throws HammurapiException { try { InputStream inspectorStream; if (mappingConfigurationPath != null) { inspectorStream = new FileInputStream(this.mappingConfigurationPath); } else if (mappingConfigurationUrl != null) { inspectorStream = new URL(mappingConfigurationUrl).openStream(); } else if (mappingConfigurationResource != null) { inspectorStream = getClass().getClassLoader().getResourceAsStream(mappingConfigurationResource); if (inspectorStream == null) { throw new HammurapiException("Resource not found: " + mappingConfigurationResource); } } else { String className = getClass().getName(); int idx = className.lastIndexOf('.'); String rName = (idx == -1 ? className : className.substring(idx + 1)) + ".xml"; inspectorStream = getClass().getResourceAsStream(rName); if (inspectorStream == null) { throw new HammurapiException("Default mappig not found: " + rName); } } DomArchitecturalMappingSource source = new DomArchitecturalMappingSource(inspectorStream); this.architecturalLayerMappingTable = source.loadLayerMappings(); this.complexityMappingTable = source.loadComplexityMapping(); Enumeration enumAlm = architecturalLayerMappingTable.elements(); while (enumAlm.hasMoreElements()) { ArchitecturalLayerMapping alm = (ArchitecturalLayerMapping) enumAlm.nextElement(); Enumeration stackEnum = alm.getTechStackEntityList().elements(); while (stackEnum.hasMoreElements()) { TechStackEntity te = (TechStackEntity) stackEnum.nextElement(); for (int i = 0; i < te.getExtensionMapping().size(); i++) { // System.out.println( (String)te.getExtensionMapping().elementAt(i) + " >-> "+ // te.getName()); this.extensionMap.put((String) te.getExtensionMapping().elementAt(i), te.getName()); } } } Collection almList = architecturalLayerMappingTable.values(); Iterator it = almList.iterator(); while (it.hasNext()) { // for( int i=0; i<almList.size(); i++){ // ArchitecturalLayerMapping alm = // (ArchitecturalLayerMapping)architecturalLayerMappingTable.get((String)it.next()); ArchitecturalLayerMapping alm = (ArchitecturalLayerMapping) it.next(); // allTechStackEntitiesSet.addAll(alm.getTechStackEntityListValues()); Collection clte = alm.getTechStackEntityListValues(); Iterator itClte = clte.iterator(); while (itClte.hasNext()) { TechStackEntity te = (TechStackEntity) itClte.next(); allTechStackEntitiesTable.put(te.getName(), te); } } } catch (IOException e) { throw new HammurapiException("Cannot load mapping configuration: " + e, e); } }