Package q_impress.pmi.lib.tasks

Examples of q_impress.pmi.lib.tasks.TaskException


    return true;
  }

  @Override
  public Map<String, AbstractResource> execute() throws TaskException {
    if (canExecute() == false) throw new TaskException(this, "Task parameters are not valid.");
   
    // check the validity of prism resources
    checkPrismResources();
   
    ByteArrayOutputStream prismModelStream = new ByteArrayOutputStream();
    ByteArrayOutputStream prismPropsStream = new ByteArrayOutputStream();
    try {
      AtopTranslator translator = new AtopTranslator(umlResource.getResourceSet(), umlResource.loadResource(),
          sourceActivityName, modelType, prismModelStream, prismPropsStream);
     
      translator.translate();
     
      writeToResources(prismModelStream, prismPropsStream);
    } catch (ResourceException e) {
      throw new TaskException(this, "Unable to execute translation", e);
    } catch (TranslationException e) {
      throw new TaskException(this, "Unable to execute translation", e);
    } finally {
      try {
        prismModelStream.close();
        prismPropsStream.close();
      } catch (IOException e) {
View Full Code Here


 
  private void checkPrismResources() throws TaskException {
    try {
      prismModelResource.getFile();
    } catch (ResourceException e) {
      throw new TaskException(this, "Invalid location for PRISM model", e);
    }
   
    try {
      prismPropertiesResource.getFile();
    } catch (ResourceException e) {
      throw new TaskException(this, "Invalid location for PRISM properties", e);
    }
  }
View Full Code Here

    try {
      IFile tempFile = prismModelResource.getFile();
      if (!tempFile.exists()) tempFile.create(inStream, false, null);
      else tempFile.setContents(inStream, IFile.NONE, null);
    } catch (ResourceException e) {
      throw new TaskException(this, "Invalid location for PRISM model", e);
    } catch (CoreException e) {
      throw new TaskException(this, "Unable to save PRISM model", e);
    } finally {
      try {
        inStream.close();
      } catch (IOException e) {
        assert false;
      }
    }
   
    inStream = new ByteArrayInputStream(propsStream.toByteArray());
    try {
      IFile tempFile = prismPropertiesResource.getFile();
      if (!tempFile.exists()) tempFile.create(inStream, false, null);
      else tempFile.setContents(inStream, IFile.NONE, null);
    } catch (ResourceException e) {
      throw new TaskException(this, "Invalid location for PRISM properties", e);
    } catch (CoreException e) {
      throw new TaskException(this, "Unable to save PRISM properties", e);
    } finally {
      try {
        inStream.close();
      } catch (IOException e) {
        assert false;
View Full Code Here

    return true;
  }

  @Override
  public Map<String, AbstractResource> execute() throws TaskException {
    if (canExecute() == false) throw new TaskException(this, "Task parameters are not valid.");

    // check the validity of jmt resources
    checkJmtResources();
   
    ByteArrayOutputStream jmtStream = new ByteArrayOutputStream();
    try {
      JmtTranslator translator = new JmtTranslator(umlResource.getResourceSet(), umlResource.loadResource(),
          activityNames, jmtStream);
     
      translator.translate();
     
      writeToResources(jmtStream);
    } catch (ResourceException e) {
      throw new TaskException(this, "Unable to execute translation", e);
    } catch (TranslationException e) {
      throw new TaskException(this, "Unable to execute translation", e);
    } finally {
      try {
        jmtStream.close();
      } catch (IOException e) {
        assert false;
View Full Code Here

 
  private void checkJmtResources() throws TaskException {
    try {
      jmtResource.getFile();
    } catch (ResourceException e) {
      throw new TaskException(this, "Invalid location for PRISM model", e);
    }
  }
View Full Code Here

    try {
      IFile tempFile = jmtResource.getFile();
      if (!tempFile.exists()) tempFile.create(inStream, false, null);
      else tempFile.setContents(inStream, IFile.NONE, null);
    } catch (ResourceException e) {
      throw new TaskException(this, "Invalid location for PRISM model", e);
    } catch (CoreException e) {
      throw new TaskException(this, "Unable to save PRISM model", e);
    } finally {
      try {
        inStream.close();
      } catch (IOException e) {
        assert false;
View Full Code Here

TOP

Related Classes of q_impress.pmi.lib.tasks.TaskException

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.