Troubleshooting
Problem
It is not possible to use the RhapsodyCL tool to open project list files (*.rplx).
For example, run the following command:
RhapsodyCL -cmd=open ProjectList.rplx
While RhapsodyCL appears to open the file, only the active project is opened. No plug-ins can be run from the active project and it is not possible to switch active project from the projects in the project list file (*.rlpx).
Environment
More information on configuring the Rhapsody API can be found here:
Resolving The Problem
The solution is to use the Rhapsody API and ignore RhapsodyCL altogether.
The execution steps are:
1) Create a new runtime process that runs rhapsody.exe in "hiddenui" mode.
2) Wait for Rhapsody to connect
3) Open the project list file (*.rplx)
4) Get list of projects
5) Set the active project
6) Run user code on active project
7) Close the runtime process.
import java.io.IOException;
import java.util.List;
import com.telelogic.rhapsody.core.IRPApplication;
import com.telelogic.rhapsody.core.IRPProject;
import com.telelogic.rhapsody.core.RhapsodyAppServer;
public class Test {
private static Process rhpProces;
private static IRPApplication rhpApp;
public static void main(String[] args) {
// 1) Create a new runtime process that runs rhapsody.exe in "hiddenui" mode.
try {
rhpProces = Runtime.getRuntime().exec("rhapsody -hiddenui");
}
catch (IOException e)
{
e.printStackTrace();
}
// 2) Wait for Rhapsody to connect
while (rhpApp == null)
{
try
{
System.out.println("waiting for Rhapsody...");
Thread.sleep(1000);
rhpApp = RhapsodyAppServer.getActiveRhapsodyApplication();
}
catch (Exception e)
{
e.printStackTrace();
}
}
System.out.println("connected to Rhapsody " + rhpApp.version());
try
{
// 3) Open the project list file (*.rplx)
rhpApp.openProject("C:\\Users\\chris\\Desktop\\workspace\\PluginTest\\Projects.rplx");
// 4) Get list of projects
List<IRPProject> listOfProjects = rhpApp.getProjects().toList();
System.out.println("Opened project list....active project: " + rhpApp.activeProject().getName());
System.out.println("\nIterating Project List:\n============================");
for(IRPProject thisProject: listOfProjects)
{
System.out.println("\nMaking this project active: " + thisProject.getName());
// 5) Set the active project
thisProject.becomeActiveProject();
// 6) Run user code on active project
System.out.println("Active project: " + rhpApp.activeProject().getName());
}
System.out.println("\nFinished Iterating list. Current active project: " + rhpApp.activeProject().getName());
}
catch(Exception e)
{
e.printStackTrace();
}
// 7) Close the runtime process.
rhpProces.destroy();
System.out.println("Rhapsody process terminated");
}
}
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB59","label":"Sustainability Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"ARM Category":[{"code":"a8m50000000Cja2AAC","label":"Rhapsody->Tools->CommandLine"}],"ARM Case Number":"TS005863234","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
ibm16462563