29 System Settings API

This chapter provides an overview of System Settings API and describes the use cases using this API.

This chapter contains the following sections:

29.1 Overview

Within the Oracle Enterprise Repository's System Settings section administrators can configure the basic operations and enable/disable specific features. The System Settings API provides a mechanism to query these system settings.

Note:

Users are allowed only to query the system settings for values, the system settings cannot be set or modified through REX.

To query the system settings, the following package import(s) are required:

import com.flashline.registry.openapi.entity.SettingValue;
import com.flashline.registry.openapi.entity.AuthToken;
import com.flashline.registry.openapi.query.SystemSettingsCriteria;

Reserved Methods

The systemSettingsAddBundle method is reserved for future use and is not intended for general use.

29.2 Use Cases

This section describes the use cases using the System Settings API. It contains the following topics:

29.2.1 Use Case: Query for System Settings

Description

Query for system settings in REX.

Sample code is as follows:

package com.flashline.sample.systemsettingsapi;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import com.flashline.registry.openapi.base.OpenAPIException;
import com.flashline.registry.openapi.entity.AuthToken;
import com.flashline.registry.openapi.entity.SettingValue;
import com.flashline.registry.openapi.query.SystemSettingsCriteria;
import com.flashline.registry.openapi.service.v300.FlashlineRegistry;
import
 com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator;
public class SystemSettings {
  public static void main(String pArgs[]) throws OpenAPIException,
 RemoteException,
      ServiceException {
    try {
      ///////////////////////////////////////////////////////////
      // Connect to Oracle Enterprise Repository
      ///////////////////////////////////////////////////////////
      URL lURL = null;
      lURL = new URL(pArgs[0]);
      FlashlineRegistry repository = new
 FlashlineRegistryServiceLocator().getFlashlineRegistry(lURL);
      // //////////////////////////////
      // Authenticate with OER
      // //////////////////////////////
      AuthToken authToken = repository.authTokenCreate(pArgs[1],pArgs[2]);
      // //////////////////////////////
      // Set Application Token on AuthToken object.  This is supplied by OER
      //authToken.setApplicationToken("TokenString");
      // //////////////////////////////////////
      //Read all available system settings
      //Create an empty Criteria object.  No criteria returns all settings.
      SystemSettingsCriteria lCriteria = new SystemSettingsCriteria();
      lCriteria.setNameCriteria("enterprise.defaults.displayname.field");
      SettingValue[] lValues = repository.systemSettingsQuery(authToken,
 lCriteria);
      for (int i=0;i<lValues.length;i++) {
        SettingValue lValue = lValues[i];
        System.out.println("Setting Name: " + lValue.getDescriptor().getName());
        System.out.println("Setting Value: " + lValue.getValue());
      }
      // /////////////////////////////////////
      //Read a specific setting
      lCriteria.setNameCriteria("cmee.server.companyname");
      lValues = repository.systemSettingsQuery(authToken, lCriteria);
      for (int i=0;i<lValues.length;i++) {
        SettingValue lValue = lValues[i];
        System.out.println("Setting Name: " + lValue.getDescriptor().getName());
        System.out.println("Setting Value: " + lValue.getValue());
      }
      // /////////////////////////////////////
      //Read a specific section
      lCriteria.setSectionCriteria("general");
      lValues = repository.systemSettingsQuery(authToken, lCriteria);
      for (int i=0;i<lValues.length;i++) {
        SettingValue lValue = lValues[i];
        System.out.println("Setting Name: " + lValue.getDescriptor().getName());
        System.out.println("Setting Value: " + lValue.getValue());
      }
    } catch (OpenAPIException lEx) {
      System.out.println("ServerCode = " + lEx.getServerErrorCode());
      System.out.println("Message    = " + lEx.getMessage());
      System.out.println("StackTrace:");
      lEx.printStackTrace();
    } catch (RemoteException lEx) {
      lEx.printStackTrace();
    } catch (ServiceException lEx) {
      lEx.printStackTrace();
    } catch (MalformedURLException lEx) {
      lEx.printStackTrace();
    }
  }
}