NamedEventManager.java
/*
** Module : NamedEventManager.java
** Abstract : provides a publish/subscribe mechanism for interprogram linkage
**
** Copyright (c) 2007-2022, Golden Code Development Corporation.
**
** -#- -I- --Date-- --JPRM-- -----------------------------------Description-----------------------------------
** 001 GES 20070221 @32210 Created initial version which provides a publish/subscribe mechanism
** for interprogram linkage.
** 002 CA 20130130 Added APIs to support all possible parameters for PUBLISH, SUBSCRIBE
** and UNSUBSCRIBE.
** 003 CA 20170228 Added PUBLISH/SUBSCRIBE/UNSUBSCRIBE extensions for global support
** and for external applications.
** 004 GES 20171206 Update javadoc to match changes to silent error mode.
** 005 CA 20190219 Changes from adding class event support.
** 006 CA 20190903 Added GLOBAL support for SUBSCRIBE/UNSUBSCRIBE (cross-session messaging).
** 007 CA 20220106 PUBLISH arguments must be evaluated only if the subscription is found.
*/
/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Affero General Public License for more details.
**
** You may find a copy of the GNU Affero GPL version 3 at the following
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
**
** Additional terms under GNU Affero GPL version 3 section 7:
**
** Under Section 7 of the GNU Affero GPL version 3, the following additional
** terms apply to the works covered under the License. These additional terms
** are non-permissive additional terms allowed under Section 7 of the GNU
** Affero GPL version 3 and may not be removed by you.
**
** 0. Attribution Requirement.
**
** You must preserve all legal notices or author attributions in the covered
** work or Appropriate Legal Notices displayed by works containing the covered
** work. You may not remove from the covered work any author or developer
** credit already included within the covered work.
**
** 1. No License To Use Trademarks.
**
** This license does not grant any license or rights to use the trademarks
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
** of Golden Code Development Corporation. You are not authorized to use the
** name Golden Code, FWD, or the names of any author or contributor, for
** publicity purposes without written authorization.
**
** 2. No Misrepresentation of Affiliation.
**
** You may not represent yourself as Golden Code Development Corporation or FWD.
**
** You may not represent yourself for publicity purposes as associated with
** Golden Code Development Corporation, FWD, or any author or contributor to
** the covered work, without written authorization.
**
** 3. No Misrepresentation of Source or Origin.
**
** You may not represent the covered work as solely your work. All modified
** versions of the covered work must be marked in a reasonable way to make it
** clear that the modified work is not originating from Golden Code Development
** Corporation or FWD. All modified versions must contain the notices of
** attribution required in this license.
*/
package com.goldencode.p2j.util;
import java.util.function.*;
/**
* Provides a publish/subscribe mechanism for interprogram linkage. This
* corresponds to the following language statements in Progress 4GL. Actual
* implementation of each statement resides in specific
* {@link ProcedureManager} APIs.
* <p>
* <pre>
* PUBLISH {@link ProcedureManager#publish}
* SUBSCRIBE {@link ProcedureManager#subscribe}
* {@link ProcedureManager#subscribeAnywhere}
* UNSUBSCRIBE {@link ProcedureManager#unsubscribe}
* {@link ProcedureManager#unsubscribeAll}
* </pre>
*/
public class NamedEventManager
{
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
*/
public static void publishGlobal(String event, handle publisher)
{
publishGlobal(new character(event), publisher, null, null);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
*/
public static void publishGlobal(character event, handle publisher)
{
publishGlobal(event, publisher, null, null);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
* @param modes
* The mode for each parameter, encoded in a string. When
* <code>null</code>, the parameter modes will not be checked
* against the procedure definition.
* @param param
* The parameters passed to the subscriber. May be
* <code>null</code> to represent no parameters.
*/
public static void publishGlobal(String event, handle publisher, String modes, Supplier<Object[]> param)
{
publishGlobal(new character(event), publisher, modes, param);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
* @param modes
* The mode for each parameter, encoded in a string. When
* <code>null</code>, the parameter modes will not be checked
* against the procedure definition.
* @param param
* The parameters passed to the subscriber. May be
* <code>null</code> to represent no parameters.
*/
public static void publishGlobal(character event, handle publisher, String modes, Supplier<Object[]> param)
{
ProcedureManager.publish(false, true, event, publisher, modes, param);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
*/
public static void publish(String event, handle publisher)
{
publish(new character(event), publisher);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
*/
public static void publish(character event, handle publisher)
{
publish(event, publisher, null);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
* @param param
* The parameters passed to the subscriber. May be
* <code>null</code> to represent no parameters.
*/
public static void publish(String event, handle publisher, Supplier<Object[]> param)
{
publish(new character(event), publisher, param);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
* @param param
* The parameters passed to the subscriber. May be
* <code>null</code> to represent no parameters.
*/
public static void publish(character event, handle publisher, Supplier<Object[]> param)
{
publish(new character(event), publisher, null, param);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
* @param modes
* The mode for each parameter, encoded in a string. When
* <code>null</code>, the parameter modes will not be checked
* against the procedure definition.
* @param param
* The parameters passed to the subscriber. May be
* <code>null</code> to represent no parameters.
*/
public static void publish(String event, handle publisher, String modes, Supplier<Object[]> param)
{
publish(new character(event), publisher, modes, param);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. Must not be <code>null</code>.
* @param modes
* The mode for each parameter, encoded in a string. When
* <code>null</code>, the parameter modes will not be checked
* against the procedure definition.
* @param param
* The parameters passed to the subscriber. May be
* <code>null</code> to represent no parameters.
*/
public static void publish(character event, handle publisher, String modes, Supplier<Object[]> param)
{
ProcedureManager.publish(false, event, publisher, modes, param);
}
/**
* Create a new subscription to the given event for a specified program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to a Progress 4GL internal
* procedure name created from the given event name.
* @param event
* The name of the event which is being published.
*/
public static void subscribe(handle subscriber, String event)
{
subscribe(subscriber, new character(event));
}
/**
* Create a new subscription to the given event for a specified program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to a Progress 4GL internal
* procedure name created from the given event name.
* @param event
* The name of the event which is being published.
*/
public static void subscribe(handle subscriber, character event)
{
subscribe(subscriber, event, null);
}
/**
* Create a new subscription to the given event for a specified program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to a Progress 4GL internal
* procedure name created from the given event name.
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the named event will only
* cause a notification if the event source matches this handle.
* <code>null</code> represents the <code>ANYWHERE</code> option
* which means that the events will not be filtered by source.
*/
public static void subscribe(handle subscriber,
String event,
handle publisher)
{
subscribe(subscriber, new character(event), publisher);
}
/**
* Create a new subscription to the given event for a specified program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to a Progress 4GL internal
* procedure name created from the given event name.
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the named event will only
* cause a notification if the event source matches this handle.
* <code>null</code> represents the <code>ANYWHERE</code> option
* which means that the events will not be filtered by source.
*/
public static void subscribe(handle subscriber,
character event,
handle publisher)
{
subscribe(subscriber, event, publisher, (character) null);
}
/**
* Create a new subscription to the given event for a specified program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the named event will only
* cause a notification if the event source matches this handle.
* <code>null</code> represents the <code>ANYWHERE</code> option
* which means that the events will not be filtered by source.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribe(handle subscriber,
String event,
handle publisher,
String method)
{
subscribe(subscriber,
new character(event),
publisher,
new character(method));
}
/**
* Create a new subscription to the given event for a specified program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the named event will only
* cause a notification if the event source matches this handle.
* <code>null</code> represents the <code>ANYWHERE</code> option
* which means that the events will not be filtered by source.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribe(handle subscriber,
String event,
handle publisher,
character method)
{
subscribe(subscriber, new character(event), publisher, method);
}
/**
* Create a new subscription to the given event for a specified program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the named event will only
* cause a notification if the event source matches this handle.
* <code>null</code> represents the <code>ANYWHERE</code> option
* which means that the events will not be filtered by source.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribe(handle subscriber,
character event,
handle publisher,
String method)
{
subscribe(subscriber, event, publisher, new character(method));
}
/**
* Create a new subscription to the given event for a specified program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the named event will only
* cause a notification if the event source matches this handle.
* <code>null</code> represents the <code>ANYWHERE</code> option
* which means that the events will not be filtered by source.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribe(handle subscriber,
character event,
handle publisher,
character method)
{
ProcedureManager.subscribe(false, subscriber, event, publisher, method, null);
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
*/
public static void subscribeAnywhere(handle subscriber, String event)
{
subscribeAnywhere(subscriber, new character(event));
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
*/
public static void subscribeAnywhere(handle subscriber, character event)
{
subscribeAnywhere(subscriber, event, (character) null);
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribeAnywhere(handle subscriber,
String event,
String method)
{
subscribeAnywhere(subscriber,
new character(event),
new character(method));
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribeAnywhere(handle subscriber,
character event,
String method)
{
subscribeAnywhere(subscriber, event, new character(method));
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribeAnywhere(handle subscriber,
String event,
character method)
{
subscribeAnywhere(subscriber, new character(event), method);
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribeAnywhere(handle subscriber,
character event,
character method)
{
ProcedureManager.subscribeAnywhere(false, subscriber, event, method);
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
*/
public static void subscribeGlobal(handle subscriber, String event)
{
subscribeGlobal(subscriber, new character(event));
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
*/
public static void subscribeGlobal(handle subscriber, character event)
{
subscribeGlobal(subscriber, event, (character) null);
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribeGlobal(handle subscriber, String event, String method)
{
subscribeGlobal(subscriber, new character(event), new character(method));
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribeGlobal(handle subscriber, character event, String method)
{
subscribeGlobal(subscriber, event, new character(method));
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribeGlobal(handle subscriber, String event, character method)
{
subscribeGlobal(subscriber, new character(event), method);
}
/**
* Create a new subscription to the given event for any program.
* This program will receive a call-back when the event is published.
*
* @param subscriber
* The program to notify when the specified event is published.
* Must not be <code>null</code>. The specified program must
* have a method that corresponds to the given Progress 4GL
* internal procedure name (<code>method</code>).
* @param event
* The name of the event which is being published.
* @param method
* The Progress 4GL internal procedure name which will be
* translated into a method name and invoked on the
* <code>subscriber</code> instance.
*/
public static void subscribeGlobal(handle subscriber, character event, character method)
{
ProcedureManager.subscribeAnywhere(true, subscriber, event, method);
}
/**
* Create a new subscription to the given event for a specified external resource.
* This resource will receive a notification when the event is published.
*
* @param global
* Flag indicating if the subscription is for global (cross-session) events.
* @param subscriber
* The resource to notify when the specified event is published. If <code>null</code>,
* a {@link ExternalResource} will be built and its ID return.
* @param event
* The name of the event which is being published.
* @param publisher
* The handle representing the program or resource that is the source of the event.
* If specified, the named event will only cause a notification if the event source
* matches this handle. <code>null</code> represents the <code>ANYWHERE</code> option
* which means that the events will not be filtered by source.
*
* @return The subscriber's ID.
*/
public static handle subscribeExternal(boolean global,
handle subscriber,
String event,
handle publisher)
{
return ProcedureManager.subscribeExternal(global, subscriber, event, publisher);
}
/**
* Delete a subscription to the given event for the specified external resource. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param global
* Flag indicating if the search is done in the global (cross-session) event register.
* @param subscriber
* The resource whose subscription is to be deleted. Must not be <code>null</code>.
* @param event
* The name of the event which is being published. If this is <code>null</code>, then
* subscriptions to all events will be deleted.
* @param publisher
* The procedure or resource handle representing the source of the event.
* If specified, the subscription will only be deleted if the event source matches
* this handle. <code>null</code> represents the <code>ALL</code> option which means
* that the events will not be filtered by source. When <code>null</code>, it means
* that the publisher was not set.
*/
public static void unsubscribeExternal(boolean global,
handle subscriber,
String event,
handle publisher)
{
ProcedureManager.unsubscribeExternal(global, subscriber, event, publisher);
}
/**
* Notify all subscribers (to the given event) that the event has occurred. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>PUBLISH</code>
* statement is executed with a default NO-ERROR clause.
* <p>
* All processing is done with silent error mode implicitly enabled.
* <p>
* The subscriptions are fired in the order they were subscribed. Although 4GL
* documentation specifically states, that "If a named event has multiple subscribers,
* the order in which the AVM notifies subscribers is undefined.", the actual
* 4GL implementation (OpenEdge 10.2B) does fire the events in the order the subscriptions
* get subscribed.
*
* @param event
* The name of the event which is being published.
* @param publisher
* The procedure or resource handle representing the program that is the source of
* the event. Must not be <code>null</code>.
* @param args
* The parameters passed to the subscriber. May be <code>null</code> to represent no
* parameters. When <code>null</code>, it means that no parameters were specified for
* this call.
*/
public static void publishExternal(String event, handle publisher, String[] args)
{
ProcedureManager.publishExternal(event, publisher, args);
}
/**
* Delete a subscription to the given event for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
* @param event
* The name of the event which is being published. If this is
* <code>null</code>, then subscriptions to all events will be
* deleted.
*/
public static void unsubscribe(handle subscriber, String event)
{
unsubscribe(subscriber, new character(event));
}
/**
* Delete a subscription to the given event for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
* @param event
* The name of the event which is being published. If this is
* <code>null</code>, then subscriptions to all events will be
* deleted.
*/
public static void unsubscribe(handle subscriber, character event)
{
unsubscribe(subscriber, event, null);
}
/**
* Delete a subscription to the given event for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
* @param event
* The name of the event which is being published. If this is
* <code>null</code>, then subscriptions to all events will be
* deleted.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the subscription will only
* be deleted if the event source matches this handle.
* <code>null</code> represents the <code>ALL</code> option
* which means that the events will not be filtered by source.
*/
public static void unsubscribe(handle subscriber, String event, handle publisher)
{
unsubscribe(subscriber, new character(event), publisher);
}
/**
* Delete a subscription to the given event for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
* @param event
* The name of the event which is being published. If this is
* <code>null</code>, then subscriptions to all events will be
* deleted.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the subscription will only
* be deleted if the event source matches this handle.
* <code>null</code> represents the <code>ALL</code> option
* which means that the events will not be filtered by source.
*/
public static void unsubscribe(handle subscriber, character event, handle publisher)
{
ProcedureManager.unsubscribe(false, subscriber, event, publisher, null);
}
/**
* Delete a subscription to ALL events for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
*/
public static void unsubscribeAll(handle subscriber)
{
unsubscribeAll(subscriber, null);
}
/**
* Delete a subscription to ALL events for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
* @param publisher
* The procedure handle representing the program that is the
* source of the event. If specified, the subscription will only
* be deleted if the event source matches this handle.
* <code>null</code> represents the <code>ALL</code> option
* which means that the events will not be filtered by source.
*/
public static void unsubscribeAll(handle subscriber, handle publisher)
{
ProcedureManager.unsubscribeAll(false, subscriber, publisher);
}
/**
* Delete a subscription to the given event for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
* @param event
* The name of the event which is being published. If this is
* <code>null</code>, then subscriptions to all events will be
* deleted.
*/
public static void unsubscribeGlobal(handle subscriber, String event)
{
unsubscribeGlobal(subscriber, new character(event));
}
/**
* Delete a subscription to the given event for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
* @param event
* The name of the event which is being published. If this is
* <code>null</code>, then subscriptions to all events will be
* deleted.
*/
public static void unsubscribeGlobal(handle subscriber, character event)
{
ProcedureManager.unsubscribe(true, subscriber, event, null, null);
}
/**
* Delete a subscription to ALL events for the specified program. This method is
* executed in a {@link ErrorManager#silent} bracket, as the <code>UNSUBSCRIBE</code>
* statement is executed with a default NO-ERROR clause.
*
* @param subscriber
* The program whose subscription is to be deleted. Must not
* be <code>null</code>.
*/
public static void unsubscribeAllGlobal(handle subscriber)
{
ProcedureManager.unsubscribeAll(true, subscriber, null);
}
}