Package org.destecs.core.simulationengine.model

Examples of org.destecs.core.simulationengine.model.DeModelConfig


  }

  private ModelConfig getDeModelConfig(IProject project2, int port)
  {
    final IDestecsProject p = (IDestecsProject) project2.getAdapter(IDestecsProject.class);
    final DeModelConfig model = new DeModelConfig();
    model.logVariables.addAll(logVariablesVdm);
    if (!model.logVariables.isEmpty())
    {
      model.logFile = new File(outputFolder, "VdmVariables.csv").getAbsolutePath();
    }
    model.arguments.put(DeModelConfig.LOAD_OUTPUT_DIR, outputFolder.getAbsolutePath());
    model.arguments.put(DeModelConfig.LOAD_REPLACE, deReplacePattern);
    model.arguments.put(DeModelConfig.LOAD_DEBUG_PORT, String.valueOf(port));
    model.arguments.put(DeModelConfig.LOAD_BASE_DIR, p.getVdmModelFolder().getLocation().toFile().getAbsolutePath());

    try
    {
      if (!configuration.getAttribute(IDebugConstants.DESTECS_LAUNCH_CONFIG_DE_RT_VALIDATION, false))
      {
        model.arguments.put(DeModelConfig.LOAD_SETTING_DISABLE_RT_VALIDATOR, "true");
      }
    } catch (CoreException e)
    {
      DestecsDebugPlugin.logError("Could not get realtime check option from launch configuration", e);
    }

    if (deArchitectureFile != null && deArchitectureFile.exists())
    {
      StringBuffer architecture = new StringBuffer();
      StringBuffer deploy = new StringBuffer();
      try
      {
        BufferedReader in = new BufferedReader(new FileReader(deArchitectureFile));
        String str;
        boolean inArch = false;
        boolean inDeploy = false;
        while ((str = in.readLine()) != null)
        {
          str = str.trim();
          if (str.startsWith("-- ## Architecture ## --"))
          {
            inArch = true;
            inDeploy = false;
          }
          if (str.startsWith("-- ## Deployment ## --"))
          {
            inDeploy = true;
            inArch = false;
          }

          if (inArch)
          {
            architecture.append(str);
            architecture.append("\n");
          }
          if (inDeploy)
          {
            deploy.append(str);
            deploy.append("\n");
          }
        }
        in.close();
      } catch (IOException e)
      {
      }
      model.arguments.put(DeModelConfig.LOAD_ARCHITECTURE, architecture.toString());
      model.arguments.put(DeModelConfig.LOAD_DEPLOY, deploy.toString());

    }

    final IContentType vdmrtFileContentType = Platform.getContentTypeManager().getContentType(IDebugConstants.VDMRT_CONTENT_TYPE_ID);

    try
    {
      if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_PRE_CHECKS, true))// vdmProject.hasPrechecks())
      {
        model.arguments.put(DeModelConfig.LOAD_SETTING_DISABLE_PRE, "true");
      }
      if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_POST_CHECKS, true))// vdmProject.hasPostchecks())
      {
        model.arguments.put(DeModelConfig.LOAD_SETTING_DISABLE_POST, "true");
      }
      if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_INV_CHECKS, true))// vdmProject.hasInvchecks())
      {
        model.arguments.put(DeModelConfig.LOAD_SETTING_DISABLE_INV, "true");
      }
      if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_DTC_CHECKS, true))// vdmProject.hasDynamictypechecks())
      {
        model.arguments.put(DeModelConfig.LOAD_SETTING_DISABLE_DYNAMIC_TC, "true");
      }
      if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_MEASURE_CHECKS, true))// vdmProject.hasMeasurechecks())
      {
        model.arguments.put(DeModelConfig.LOAD_SETTING_DISABLE_MEASURE, "true");
      }
      if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_LOG_RT, true))// vdmProject.hasMeasurechecks())
      {
        model.arguments.put(DeModelConfig.LOAD_SETTING_DISABLE_RT_LOG, "true");
      }
      if (!configuration.getAttribute(IDebugConstants.VDM_LAUNCH_CONFIG_GENERATE_COVERAGE, true))// vdmProject.hasMeasurechecks())
      {
        model.arguments.put(DeModelConfig.LOAD_SETTING_DISABLE_COVERAGE, "true");
      }

      project2.accept(new IResourceVisitor()
      {

        public boolean visit(IResource resource) throws CoreException
        {
          if (resource instanceof IFile
              && resource.getFileExtension() != null
              && resource.getFileExtension().equals(DeModelConfig.LOAD_LINK))
          {
            model.arguments.put(DeModelConfig.LOAD_LINK, resource.getLocation().toFile().getAbsolutePath());
          }
          return true;
        }
      });

      p.getVdmModelFolder().accept(new IResourceVisitor()
      {

        public boolean visit(IResource resource) throws CoreException
        {
          if (vdmrtFileContentType.isAssociatedWith(resource.getName()))
          {
            model.addSpecFile(resource.getLocation().toFile());
          }
          return true;
        }
      });
      return model;
View Full Code Here


    {
      engine = new SimulationEngine(new File(base, "configuration\\contract.csc"));
    }

    engine.setDeSimulationLauncher(new VdmRtLauncher());
    engine.setDeModel(new DeModelConfig(new File(base, "model_de")));
    engine.setDeEndpoint(new URL("http://127.0.0.1:8080/xmlrpc"));

    engine.setCtSimulationLauncher(new Clp20SimLauncher());
    engine.setCtModel(new CtModelConfig(new File(new File(base, "model_ct"), ctModelName)));
    engine.setCtEndpoint(new URL("http://localhost:1580"));
View Full Code Here

TOP

Related Classes of org.destecs.core.simulationengine.model.DeModelConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.