com.genesyslab.omsdk.commons
Class OMSDKConnector

java.lang.Object
  extended bycom.genesyslab.omsdk.commons.OMSDKConnector

public abstract class OMSDKConnector
extends java.lang.Object

Entry point for the Open Media SDKs. Use this class to connect your application to servers, then to initialize your MIL or QIL factory.

Before connecting, first fill in an InitializationParameters object with connection parameters (port, host, and so on.) To create this object, specify InitializationServices according to the Java library to be connected: MIL or QIL.

The following code snippet creates an InitializationParameters object, using the InitializationServices available through the com.genesyslab.omsdk.mil.MILFactory class.

InitializationServices milInitServices = MILFactory.getInitializationServices();

InitializationParameters ip = new InitializationParameters(
    "ConfigServerPrimaryHost",
    "ConfigServerPrimaryPort",
    "back up port",
    "back up host",
    "ApplicationName",
    data.getReconnectionPeriod(),
    data.getReconnectionAttempts());
ip.addInitializationServices(milInitServices);

To connect, initialize the OM library by calling the OMSDKConnector.initialize() static method, as shown in the following code snippet.

OMSDKConnector.initialize(ip);
Then retrieve an instance to access open media common features.
OMSDKConnector connector = OMSDKConnector.getInstance();

Since:
7.1.008.00

Method Summary
static void addServiceListener(ServiceListener listener, ServiceType type)
          Adds a ServiceListener to the listener list for a specific type of internal service.
abstract  ApplicationInfo getApplicationInfo()
          Returns an ApplicationInfo object that contains the Configuration Layer's information about the current application.
static OMSDKConnector getInstance()
          Returns the OMSDKConnector instance.
abstract  ServiceInfo getServiceInfo(ServiceType type)
          Returns the ServiceInfo associated with the specified service type.
abstract  java.util.Set getServices()
          Returns the services.
static void initialize(InitializationParameters ip)
          Initializes the OMSDKConnector instance with the specified initialization parameters.
static boolean isShutdownHookEnabled()
          Returns the current status of the integrated shutdown hook.
static void release()
          Releases this instance and all the objects made available through this interface.
static void removeServiceListener(ServiceListener listener, ServiceType type)
          Removes the specified ServiceListener from the listener list for a specific type of internal service.
static void setShutdownHookEnabled(boolean enabled)
          Controls the usage of the integrated shutdown hook.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static OMSDKConnector getInstance()
Returns the OMSDKConnector instance.

Returns:
the OMSDKConnector instance.

initialize

public static void initialize(InitializationParameters ip)
                       throws InitializationException
Initializes the OMSDKConnector instance with the specified initialization parameters.

If the OMSDKConnector is already initialized:

Parameters:
ip - initialization parameters
Throws:
InitializationException - exception thrown if some internal service failed to initialize, or if initialization parameters are incorrect

release

public static void release()
Releases this instance and all the objects made available through this interface.


getServiceInfo

public abstract ServiceInfo getServiceInfo(ServiceType type)
                                    throws ServiceException
Returns the ServiceInfo associated with the specified service type.

Parameters:
type - the service type.
Returns:
ServiceInfo associated with the service type.
Throws:
ServiceException - exception thrown if the ServiceInfo cannot be retrieved, due to an internal error.

getServices

public abstract java.util.Set getServices()
                                   throws ServiceException
Returns the services.

Returns:
Set of ServiceType items.
Throws:
ServiceException - thrown if problems occured during information retrieval

getApplicationInfo

public abstract ApplicationInfo getApplicationInfo()
                                            throws ServiceException
Returns an ApplicationInfo object that contains the Configuration Layer's information about the current application.

Returns:
the application information.
Throws:
ServiceException - thrown if the request failed. To get specific reasons for this error, see the subclasses of RequestFailedException.
See Also:
InitializationParameters.getApplicationName()

setShutdownHookEnabled

public static void setShutdownHookEnabled(boolean enabled)
Controls the usage of the integrated shutdown hook.

If the shutdown hook is disabled, the user application should handle emergency shutdown.

Parameters:
enabled - true to enable the shutdown hook, false to disable it.

isShutdownHookEnabled

public static boolean isShutdownHookEnabled()
Returns the current status of the integrated shutdown hook.

Returns:
true if the shutdown hook is enabled.

addServiceListener

public static void addServiceListener(ServiceListener listener,
                                      ServiceType type)
Adds a ServiceListener to the listener list for a specific type of internal service.

Parameters:
listener - the listener to be added.
type - the service type to add the listener to.

removeServiceListener

public static void removeServiceListener(ServiceListener listener,
                                         ServiceType type)
Removes the specified ServiceListener from the listener list for a specific type of internal service.

Parameters:
listener - the listener to be removed.
type - the service type from which to remove the listener.