Sun OpenSSO Enterprise 8.0 Developer's Guide

Setting Properties in AMConfig.properties

There are three ways to set properties in AMConfig.properties. The following sections contain more information.

Setting Properties Using a Text Editor

You can set properties in AMConfig.properties by editing the file with a text editor. Each property is defined as:

property-name=property-value

Setting Properties Using the Java API

You can set properties programmatically using the com.iplanet.am.util.SystemProperties class. For example:


Example 14–1 Setting Client SDK Properties Programmatically


import com.iplanet.am.util.SystemProperties;
import java.util.Properties;
public static void main(String[] args) {
        // To initialize a set of properties
        Properties props = new Properties();
        props.setProperty(”com.iplanet.am.naming.url’, 
        ”http://sample.com/opensso/namingservice’);
        props.setProperty(”com.sun.identity.agents.app.username’, ”URLAccessAgent’);
        props.setProperty(”com.iplanet.am.service.password’, ”11111111’);
        SystemProperties.initializeProperties(props) ;

        // To initialize a single property
        SystemProperties.initializeProperties(“com.iplanet.am.naming.url’, 
        ”http://sample.com/opensso/namingservice’);
    // Application specific code ...
}
          

Setting Properties at Run Time

To set a value to a particular property at run time, declare the JVM option using the following format:

-Dproperty-name=property-value