com.cisco.ipphone.sdk
Class RisProvider

java.lang.Object
  extended by com.cisco.ipphone.sdk.RisProvider
All Implemented Interfaces:
IPAddressProviderIF

public class RisProvider
extends java.lang.Object
implements IPAddressProviderIF

The RisProvider class provides a simple Java "wrapper" around the CUCM RIS realtime API. This implementation of the IPAddressProviderIF interface caches IP address information and automatically refreshes the information at the specified interval. The initial loading of IP addresses from the DeviceListX API is performed by the calling thread of the RisProvider constructor - this ensures that the provider is ready for requests as soon as the constructor method returns. Subsequent updates are handled automatically by the RisProvider class using a Timer thread. The refresh logic is designed so that the calling thread will always return immediately - it will never block while waiting for the device list to be updated (except for the initial load as stated above).
Note: This class is for sample application purposes only - a fully-functional production application would make more efficient use of the RIS API capabilities, as needed by the application.

See Also:
IPAddressProviderIF

Field Summary
static int DEFAULT_INTERVAL
           
static int MAX_DEVICES
           
 
Constructor Summary
RisProvider(java.lang.String callManager, java.lang.String callManagerUserId, java.lang.String callManagerPassword)
          Equivalent to calling: IPAddressProvider(callManager, callManagerUserId, callManagerPassword, false, IPAddressProvider.DEFAULT_INTERVAL);
RisProvider(java.lang.String callManager, java.lang.String callManagerUserId, java.lang.String callManagerPassword, boolean useHttps)
          Equivalent to calling: IPAddressProvider(callManager, callManagerUserId, callManagerPassword, useHttps, IPAddressProvider.DEFAULT_INTERVAL);
RisProvider(java.lang.String callManager, java.lang.String callManagerUserId, java.lang.String callManagerPassword, boolean useHttps, int refreshInterval)
          Creates a new RisProvider and immediately loads the IP address table
 
Method Summary
 java.util.HashMap getAllIPAddresses()
          This method retrieves all of the current active IP addresses of devices.
 java.lang.String getIPAddress(Phone phone)
          This method retrieves the current active IP address of the specified Phone.
 java.lang.String[] getIPAddresses(Phone[] phones)
          This method retrieves the current active IP addresses of the specified Phones.
 Phone getPhone(java.lang.String ipAddress)
          This method does the inverse of the other methods - it accepts an IP address as a parameter and searches for the Phone currently using that address.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INTERVAL

public static final int DEFAULT_INTERVAL
See Also:
Constant Field Values

MAX_DEVICES

public static final int MAX_DEVICES
See Also:
Constant Field Values
Constructor Detail

RisProvider

public RisProvider(java.lang.String callManager,
                   java.lang.String callManagerUserId,
                   java.lang.String callManagerPassword)
Equivalent to calling: IPAddressProvider(callManager, callManagerUserId, callManagerPassword, false, IPAddressProvider.DEFAULT_INTERVAL);

Parameters:
callManager - String
callManagerUserId - String
callManagerPassword - String

RisProvider

public RisProvider(java.lang.String callManager,
                   java.lang.String callManagerUserId,
                   java.lang.String callManagerPassword,
                   boolean useHttps)
Equivalent to calling: IPAddressProvider(callManager, callManagerUserId, callManagerPassword, useHttps, IPAddressProvider.DEFAULT_INTERVAL);

Parameters:
callManager - String
callManagerUserId - String
callManagerPassword - String
useHttps - boolean

RisProvider

public RisProvider(java.lang.String callManager,
                   java.lang.String callManagerUserId,
                   java.lang.String callManagerPassword,
                   boolean useHttps,
                   int refreshInterval)
Creates a new RisProvider and immediately loads the IP address table

Parameters:
callManager - String Hostname or IP address of the CallManager server hosting the DeviceListX API
callManagerUserId - String The UserId used to authenticate to the CallManager for CCMAdmin access
callManagerPassword - String The password of the above UserId
useHttps - boolean If 'true' then https is used rather than http (Note: https is required for CallManager 4.1)
refreshInterval - int Interval in seconds to refresh the IP address data
Method Detail

getPhone

public Phone getPhone(java.lang.String ipAddress)
This method does the inverse of the other methods - it accepts an IP address as a parameter and searches for the Phone currently using that address.

Specified by:
getPhone in interface IPAddressProviderIF
Parameters:
ipAddress - a String containing the current IP address of the requested Phone
Returns:
the Phone currently using the specified IP address or null if the address could not be found

getIPAddress

public java.lang.String getIPAddress(Phone phone)
This method retrieves the current active IP address of the specified Phone.

Specified by:
getIPAddress in interface IPAddressProviderIF
Parameters:
phone - the Phone for which an IP address is requested
Returns:
a String containing the IP address of the Phone in dotted-decimal format. If the Phone is not found, null will be returned.

getIPAddresses

public java.lang.String[] getIPAddresses(Phone[] phones)
This method retrieves the current active IP addresses of the specified Phones.

Specified by:
getIPAddresses in interface IPAddressProviderIF
Parameters:
phones - an Array of Phones for which IP addresses are requested
Returns:
an Array of Strings containing the IP addresses of the requested Phones in dotted-decimal format. The returned array will always be the same length as the phones[] supplied as an argument. For any phones not found, the corresponding array element will contain null.

getAllIPAddresses

public java.util.HashMap getAllIPAddresses()
This method retrieves all of the current active IP addresses of devices.

Specified by:
getAllIPAddresses in interface IPAddressProviderIF
Returns:
a HashMap which contains all of the deviceNames (the HashMap keys) and their IP addresses (the HashMap values)

main

public static void main(java.lang.String[] args)