title: Rational software Architect - Load custom transformation file from other local workspace and execute
body: <p>We are using Rational Software Architect to model and generate java artifacts.
  As of now, we are running the transformation one by one manually.</p>
  
  <p>Our requirement now here is to automate the transformation. I mean want to run the multiple transformation together and log the error if its any.</p>
  
  <p>I have tried to run a transformation from below code. But when I run it, it shows me an error: </p>
  
  <p><strong>I'm trying to load service.tc which is not present in current workspace.</strong> </p>
  
  <pre><code>    IPath path = new Path("**D://RSA_NewWorkSpace//UML_MODEL_POC/service.tc**"); 
  
      IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); 
      System.out.println("file &gt;&gt; "+file); 
  
      ITransformConfig config = TransformConfigUtil.loadConfiguration(file); 
  
      System.out.println("inside testExecute 3 config &gt;&gt; "+config); 
  
      IStatus status = TransformController.getInstance().execute(config, null, false, null); 
  
      System.out.println("status &gt;&gt; "+status);
  </code></pre>
  
  <p>Error : </p>
  
  <pre><code>file &gt;&gt; L/RSA_NewWorkSpace/UML_MODEL_POC/service.tc 
  
  IOException &gt;&gt;java.io.FileNotFoundException: The transformation configuration file /RSA_NewWorkSpace/UML_MODEL_POC/service.tc does not exist. Verify the correct file path was specified. 
  </code></pre>
  
  <p>Is it possible to refer the transformation file from other workspace (instead of current workspace) and load and execute?</p>
  
  <p>I m trying to load the transformation file from <em>D://RSA_NewWorkSpace//UML_MODEL_POC/service.tc.</em></p>
  
  <hr>
  
  <p><strong>Below is the latest code which i have been trying to load the transformation file (service.tc) from outside workspace as well as SOP</strong> </p>
  
  <p>for.e.g Workspace directory structure</p>
  
  <p>D:\RSA_NewWorkSpace\UML_MODEL_POC\ . project</p>
  
  <p>D:\RSA_NewWorkSpace\UML_MODEL_POC\service.tc</p>
  
  <p>I'm getting <strong>config is null</strong> . Could you please help me how to get value for config.</p>
  
  <p>public static void obtainLink() {</p>
  
  <pre><code>    try {
  
          String projectName = "UML_MODEL_POC";
  
          IProject project = getIProject(getWorkspaceFullPath() + IPath.SEPARATOR + projectName,projectName);
  
          IFile linkFile = project.getFile("service.tc");
  
          if(linkFile.exists())
  
              linkFile.refreshLocal(1, null); 
  
          else {
  
              createLink(project, linkFile);
  
          }
  
          **ITransformConfig config = TransformConfigUtil.loadConfiguration(linkFile);**
  
          IStatus status = TransformController.getInstance().execute(config, null, false, null);
  
          System.out.println("status &gt;&gt; "+status);
  
  
      }
  
      catch(Exception e) {
  
          throw new WrappedException(e);
  
      }
  
  }
  </code></pre>
  
  <p>public static IProject getIProject(String projectFullPath, String projectName) {</p>
  
  <p>IProjectDescription description;</p>
  
  <pre><code>        try {
  
              File projectFile = new File(projectFullPath + IPath.SEPARATOR +  ".project");
  
              if (projectFile.exists()) {
  
                  description = ResourcesPlugin.getWorkspace().loadProjectDescription(new Path(getWorkspaceFullPath() + IPath.SEPARATOR + projectName + IPath.SEPARATOR +  ".project"));
  
                  IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
  
                  return project;
  
              } 
  
          } catch (CoreException e) {
  
              MessageDialog.openError(null, "Project already exists", "Issue when trying to add project \"" + projectName + "\" to workspace.");
              e.printStackTrace();
          }
  
          return null;
  
      }
  </code></pre>
  
  <p>public static String getWorkspaceFullPath() {</p>
  
  <pre><code>        return ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
  
      }
  </code></pre>
  
  <p><strong>SOP:</strong></p>
  
  <p>project = P/UML_MODEL_POC</p>
  
  <p>linkFile = L/UML_MODEL_POC/service.tc</p>
  
  <p>config = null</p>
  
  <p>status = Status CANCEL: unknown code=1  null</p>