/**<p> Attaches an event handler to <code>comObject</code> for the source event interface of COM , identified by the * <code>sourceUUID</code>. The event listener is itself identified by <code>eventListener</code>. An exception will be raised if * <code>sourceUUID</code> is not supported by the COM Server. * </p> * * @param comObject object to which the listener will be attached. * @param sourceUUID <code>IID</code> of the call back interface. * @param eventListener <code>IJIComObject</code> obtained using {@link #buildObject(JISession, JILocalCoClass)} * @return string identifier for this connection, please save this for eventual release using {@link #detachEventHandler(IJIComObject, String)} * @throws JIException * @throws IllegalArgumentException if any parameter is <code>null</code> or <code>sourceUUID</code> is empty. */ public static String attachEventHandler(IJIComObject comObject,String sourceUUID,IJIComObject eventListener) throws JIException { return JIFrameworkHelper.attachEventHandler(comObject, sourceUUID, eventListener); } /**Detaches the event handler identified by <code>identifier</code> and associated with this <code>comObject</code>. This method
/**<p> Attaches an event handler to <code>comObject</code> for the source event interface of COM , identified by the * <code>sourceUUID</code>. The event listener is itself identified by <code>eventListener</code>. An exception will be raised if * <code>sourceUUID</code> is not supported by the COM Server. * </p> * * @param comObject object to which the listener will be attached. * @param sourceUUID <code>IID</code> of the call back interface. * @param eventListener <code>IJIComObject</code> obtained using {@link #buildObject(JISession, JILocalCoClass)} * @return string identifier for this connection, please save this for eventual release using {@link #detachEventHandler(IJIComObject, String)} * @throws JIException * @throws IllegalArgumentException if any parameter is <code>null</code> or <code>sourceUUID</code> is empty. */ public static String attachEventHandler(IJIComObject comObject,String sourceUUID,IJIComObject eventListener) throws JIException { return JIFrameworkHelper.attachEventHandler(comObject, sourceUUID, eventListener); } /**Detaches the event handler identified by <code>identifier</code> and associated with this <code>comObject</code>. This method
/** * <p> * Attaches an event handler to <code>comObject</code> for the source event * interface of COM , identified by the <code>sourceUUID</code>. The event * listener is itself identified by <code>eventListener</code>. An exception * will be raised if <code>sourceUUID</code> is not supported by the COM * Server. * </p> * * @param comObject * object to which the listener will be attached. * @param sourceUUID * <code>IID</code> of the call back interface. * @param eventListener * <code>IJIComObject</code> obtained using * {@link #buildObject(JISession, JILocalCoClass)} * @return string identifier for this connection, please save this for * eventual release using * {@link #detachEventHandler(IJIComObject, String)} * @throws JIException * @throws IllegalArgumentException * if any parameter is <code>null</code> or * <code>sourceUUID</code> is empty. */ public static String attachEventHandler ( final IJIComObject comObject, final String sourceUUID, final IJIComObject eventListener ) throws JIException { return JIFrameworkHelper.attachEventHandler ( comObject, sourceUUID, eventListener ); }
/** * Attach a new callback to the group * * @param callback * The callback to attach * @return The event handler information * @throws JIException */ public EventHandler attach ( final IOPCDataCallback callback ) throws JIException { final OPCDataCallback callbackObject = new OPCDataCallback (); callbackObject.setCallback ( callback ); // sync the callback object so that no calls get through the callback // until the callback information is set // If happens in some cases that the callback is triggered before // the method attachEventHandler returns. synchronized ( callbackObject ) { final String id = JIFrameworkHelper.attachEventHandler ( getCOMObject (), Constants.IOPCDataCallback_IID, JIObjectFactory.buildObject ( getCOMObject ().getAssociatedSession (), callbackObject.getCoClass () ) ); callbackObject.setInfo ( getCOMObject (), id ); } return callbackObject; }