/** * @param mainInstance * @param existingModel * @param node * @return null, if no language support is available or no project could be created. * @throws TransformationException */ private ILangSupport configureLanguageSupport( InstanceSpecification mainInstance, Model existingModel, InstanceSpecification node) throws TransformationException { ILangSupport langSupport = LanguageSupport.getLangSupport(getTargetLanguage(mainInstance)); langSupport.resetConfigurationData(); String modelName = getModelName(existingModel, node); IProject genProject = ProjectManagement.getNamedProject(modelName); if ((genProject == null) || !genProject.exists()) { genProject = langSupport.createProject(modelName, getTargetOS(node)); if (genProject == null) { return null; } } else { langSupport.setProject(genProject); if ((generationOptions & GenerationOptions.REWRITE_SETTINGS) != 0) { langSupport.setSettings(getTargetOS(node)); } } return langSupport; }
private void deployNode( InstanceSpecification mainInstance, Model existingModel, Model tmpModel, InstanceSpecification newRootIS, EList<InstanceSpecification> nodes, int nodeIndex, InstanceSpecification node) throws TransformationException, InterruptedException { ModelManagement genModelManagement = createTargetModel(existingModel, MapUtil.rootModelName, false); Model generatedModel = genModelManagement.getModel(); // -------------------------------------------------------------------- checkProgressStatus(); // -------------------------------------------------------------------- // new model has name "root" and contains a package with the // existing model // Package originalRoot = genModel.createNestedPackage // (existingModel.getName ()); LazyCopier targetCopy = new LazyCopier(tmpModel, generatedModel, true, true); // TODO: distribution to nodes is currently not done. How // can it be realized with a copy filter ? targetCopy.preCopyListeners.add(FilterStateMachines.getInstance()); targetCopy.preCopyListeners.add(FilterRuleApplication.getInstance()); monitor.setTaskName( String.format(Messages.InstantiateDepPlan_InfoDeployingForNode, node.getName())); ILangSupport langSupport = configureLanguageSupport(mainInstance, existingModel, node); if (langSupport == null) { return; } Deploy deployment = new Deploy(targetCopy, langSupport, node, nodeIndex, nodes.size()); InstanceSpecification nodeRootIS = deployment.distributeToNode(newRootIS); TransformationUtil.updateDerivedInterfaces(nodeRootIS); // -------------------------------------------------------------------- checkProgressStatus(); // -------------------------------------------------------------------- removeDerivedInterfacesInRoot(generatedModel); CompImplTrafos.transform( deployment.getBootloader(), targetCopy, generatedModel, modelIsObjectOriented); // -------------------------------------------------------------------- checkProgressStatus(); // -------------------------------------------------------------------- destroyDeploymentPlanFolder(generatedModel); if (generateCode) { GenerateCode codeGenerator = new GenerateCode(langSupport.getProject(), langSupport, genModelManagement, monitor); boolean option = (generationOptions & GenerationOptions.ONLY_CHANGED) != 0; codeGenerator.generate(node, getTargetLanguage(mainInstance), option); } genModelManagement.dispose(); }