This sample demonstrates how to programmatically obtain the list of registered categories and properties. Currently, the names of the registered categories and properties can be obtained. For each category, the instances of that category can be obtained, and the property values in each instance can be obtained.
To retrieve information about the categories, properties, and instances, select the API Samples > Properties Information action.
For each category that is registered, the name of the category, the properties in the category, and any instances of the category are displayed in the standard output associated with the workbench. This can be found in the DOS window from which the workbench was started, or in the Console view of the hosting workbench in the case of the runtime workbench.
ZOSPropertyGroupManager manager = ZOSPropertyGroupManager.getZOSPropertyGroupManager(); // Retrieve registered categories List<ICategory> categories = manager.getCategories();
It starts by using the ZOSPropertyGroupManager class, obtained using the getZOSPropertyGroupManager method of the ZOSPropertyGroupManager class, to retrieve the ICategory objects representing the registered categories. The registered categories can also be obtained by using the ( LocalPropertyGroupManager) class, since both managers share the same Eclipse extension point to register properties.
for (ICategory category : categories) {
System.out.println("---------------");
System.out.println("Category: " + category.getName());
// Retrieve registered properties for this category.
List<IPropertyInfo> infos = category.getPropertyInformation();
for (IPropertyInfo info : infos) {
System.out.println(" Property: " + info.getName());
}
// Retrieve category instances for each registered category, and print
// the properties and values for each instance.
List<ICategoryInstance> instances = category.getInstances();
for (ICategoryInstance instance : instances) {
System.out.println(" Instance: ");
List<IProperty> properties = instance.getProperties();
for (IProperty property : properties) {
System.out.println(" ----");
System.out.println(" Property name: " + property.getName());
System.out.println(" Property value: " + property.getValue());
}
}
Each category has a name and enables retrieval of IPropertyInfo objects, which have the names of the registered properties for that category.
Each category enables retrieval of ICategoryInstance objects, which hold property values. Finally, the IProperty objects retrieved from a ICategoryInstance object have the name of the property and the property value.
<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.listProperties"
class="com.ibm.ftt.api.samples.resources.ListPropertiesAction"
style="push" menubarPath=
"com.ibm.ftt.api.samples.apiMenu/com.ibm.ftt.api.samples.apiMenu.resourcesAPI"
id="com.ibm.ftt.api.samples.listPropertiesAction"/>
......
</actionSet>
</extension>