Search in sources :

Example 1 with ReconnectionCallback

use of NotifyExt.ReconnectionCallback in project ACS by ACS-Community.

the class AcsNcReconnectionCallback method registerForReconnect.

/**
	 * Called by the event subscriber or supplier when connecting to the NC.
	 * Corba-activates this callback object using <code>services</code> and
	 * registers it with the NotifyService's {@link ReconnectionRegistry}.
	 * <p>
	 * @throws AcsJContainerServicesEx 
	 * @throws AcsJIllegalArgumentEx 
	 * @TODO: This call does not do anything if the <code>ecf == null</code>,
	 * which is also mentioned in comments in the calling code. 
	 * This should be cleaned up, e.g. checked if at all and under which circumstances
	 * this null can happen. 
	 */
public void registerForReconnect(ContainerServicesBase services, EventChannelFactory ecf) throws AcsJContainerServicesEx, AcsJIllegalArgumentEx {
    // TODO: This is strange...
    if (ecf == null) {
        return;
    }
    if (services == null) {
        AcsJIllegalArgumentEx ex = new AcsJIllegalArgumentEx();
        ex.setVariable("services");
        ex.setValue("null");
        throw ex;
    }
    this.services = services;
    ReconnectionRegistry registry = null;
    try {
        registry = ReconnectionRegistryHelper.narrow(ecf);
    } catch (BAD_PARAM ex) {
        // TODO: Or should we just return, same deal as above with ecf == null?
        AcsJIllegalArgumentEx ex2 = new AcsJIllegalArgumentEx(ex);
        ex2.setErrorDesc("The given EventChannelFactory is not a NotifyExt.ReconnectionRegistry. Make sure TAO extensions are used!");
        throw ex2;
    }
    ecf_ = ecf;
    ReconnectionCallback callback = ReconnectionCallbackHelper.narrow(services.activateOffShoot(this));
    callback_id_ = registry.register_callback(callback);
    id_is_valid_ = true;
}
Also used : ReconnectionCallback(NotifyExt.ReconnectionCallback) BAD_PARAM(org.omg.CORBA.BAD_PARAM) AcsJIllegalArgumentEx(alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx) ReconnectionRegistry(NotifyExt.ReconnectionRegistry)

Aggregations

ReconnectionCallback (NotifyExt.ReconnectionCallback)1 ReconnectionRegistry (NotifyExt.ReconnectionRegistry)1 AcsJIllegalArgumentEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)1 BAD_PARAM (org.omg.CORBA.BAD_PARAM)1