Set the Client Mode

This mode specifies which kind of EJB the ServiceLocator should attempt to retrieve from JNDI. In local mode, the ServiceLocator attempts to retrieve EJB local home interfaces and beans. In remote mode, the ServiceLocator attempts to retrieve EJB remote home interfaces and Beans. The two supported modes are defined the constants LOCAL and REMOTE on the ServiceLocator class. REMOTE is used by default if no other mode is specified. Each instance of ServiceLocator can function in only one mode.

Example 4-2 Setting the Client Mode

// Configure an Instance of ServiceLocator
// Configure an Instance of ServiceLocator
Properties properties = new Properties();
properties.setProperty(ServiceLocator.CLIENT_MODE, ServiceLocator.LOCAL);
ServiceLocator serviceLocator = ServiceLocator.getInstance(properties);
serviceLocator.login(username, password);
// Retrieve a service
RimService rimService = serviceLocator.getRimService();