Getting the list of systems
This sample demonstrates how you can programmatically obtain the list of system objects that are currently defined. Through a system object, you can obtain basic properties such as the name, the IP address, and the connection status of the system.
Sample scenario
To retrieve information about z/OS® systems, select the API Samples > Systems Information. action.
For each system that is defined, the name, IP address, and connection status are displayed in the standard output that is associated with the workbench. This information can be found in the Console view of the workbench.

Retrieving the system list and obtaining system properties
The following code snippet from
the ListSystemsAction class contains the core of
the sample.
Object [] systemReferences = PhysicalSystemRegistryFactory.
getSingleton().getSystems(IPopulatorConstants.MVSFiles);
for (int i = 0; i < systemReferences.length; i++) {
if (systemReferences[i] instanceof IOSImage) {
IOSImage system = (IOSImage) systemReferences[i];
System.out.println("----------");
System.out.println("System " + i + ": " +
system.getName());
System.out.println("IP address = " +
system.getIpAddress());
if (system.isConnected()) {
System.out.println("System is currently connected.");
} else {
System.out.println(
"System is not currently connected.");
}
}
}First, it uses the PhysicalSystemRegistry class,
obtained from the getSingleton method of the PhysicalSystemRegistryFactory class,
to retrieve the IOSImage objects that represent the MVS™ subsystems that are defined in
the workspace. Then, it iterates through each of the subsystems and
prints the following information:
- Name of the connection (
getName) - IP address of the connection (
getIpAddress) - Connection status (
isConnected)
<extension
id="com.ibm.ftt.api.samples.actionSets"
name="%apiSample.actionSets"
point="org.eclipse.ui.actionSets">
<actionSet label="com.ibm.ftt.api.samples.actionSet1"
description="Action set for the API samples"
visible="true"
id="com.ibm.ftt.api.samples.actionSet1">
<menu label="%apiMenu.title"
id="com.ibm.ftt.api.samples.apiMenu">
<separator name="com.ibm.ftt.api.samples.apiMenu.resourcesAPI"/>
</menu>
<action label="%apiMenu.samples.listSystems"
class="com.ibm.ftt.api.samples.resources.ListSystemsAction"
style="push" menubarPath=
"com.ibm.ftt.api.samples.apiMenu/com.ibm.ftt.api.samples.apiMenu.resourcesAPI"
id="com.ibm.ftt.api.samples.listSystemsAction"/>
......
</actionSet>
</extension>