All Categories Class Hierarchy This Category Previous Indexes
Publish_Subscribe Class CATVpmPubSubUsrManager
CATVpmPubSubUsrManager
public class CATVpmPubSubUsrManager
Publish/Subscribe management class.
Role: This class provides services for querying, subscribing to,
and publishing Publish/Subscribe events.
A manager caches data in memory as long as it is not asked to synchronize or
to write its contents into the database.
Objects identifiers:
- subscribers are referred to by their user name.
- publishers are referred to by their name when actions (50 bytes max.), and
by a fixed-length 50 byte identifier, defined as follows, when BOM
objects, made up as follows:
- 8 byte long database name (must always be "CATCON ")
- 8 byte long environment name
- 18 byte long table name
- 8 byte long $COID
- 8 byte long $COMPID
environment and table names must be padded with white spaces when shorter
than the corresponding field length.
Method Index
- o
IsSubscriber(char* const,char* const,char* const,char*&)
- Checks for existing subscriptions.
- o
PublishEvent(char* const,char* const,char* const,char*&)
- Publishes an event.
- o
Subscribe(char* const,char* const,char* const,CATVpmPSActionType,char* const,char* const,char* const,char* const,char*&)
- Subscribes to an event.
- o
UnSubscribe(char* const,char* const,char* const,CATVpmPSActionType,char* const,char* const,char*&)
- Unsubscribes from an event.
- o
UnSubscribe(char* const,char* const,char* const,char*&)
- Unsubscribes from an event.
Methods
o IsSubscriber
| public static int IsSubscriber( | const char* const | iSubscriberOID, |
| const char* const | iEvent, |
| const char* const | iPublisherOID, |
| char*& | oErrorMessage) |
-
Checks for existing subscriptions.
Role: Checks if a subscription exists for a given subscriber,
event and publisher.
- Parameters:
-
- iSubscriberOID
- ID of the subscriber (e.g. VPM user) for which to subscription was
created.
- iEvent
- Name of the event that was subscribed to.
- iPublisherOID
- ID of the publisher (e.g. object) for which the event was subscribed
to.
- oErrorMessage
- Internal error message when -6 is returned (null otherwise).
Memory de-allocation (using the delete[] operator) is the
responsibility of the calling method.
- Returns:
- 1 if one or several subscriptions exist,
0 if no subscription exists,
-1 if access to Publish/Subscribe is not authorized by security,
-2 if database connection is not opened,
-3 if internal publish/subscribe manager cannot be found,
-4 if any input argument is null,
-5 if the input event name doesn't refer to any existing event,
-6 if an internal error occured.
o PublishEvent
| public static int PublishEvent( | const char* const | iEvent, |
| const char* const | iPublisherOID, |
| const char* const | iPublisherNickname, |
| char*& | oErrorMessage) |
-
Publishes an event.
Role: Trigger all the subscriptions created on a particular event
for a given publisher object.
Typically, VPM publishes the event PART.promote when a user promotes
- Parameters:
-
- iEvent
- Name of the event to publish.
- iPublisherOID
- Publishing object.
- iPublisherNickname
- Publisher nickname.
- oErrorMessage
- Internal error message when -6 is returned (null otherwise).
Memory de-allocation (using the delete[] operator) is the
responsibility of the calling method.
- Returns:
- 0 if successful,
-1 if access to Publish/Subscribe is not authorized by security,
-2 if database connection is not opened,
-3 if internal publish/subscribe manager cannot be found,
-4 if any input argument is null,
-5 if the input event name doesn't refer to any existing event,
-6 if an internal error occured.
o Subscribe
| public static int Subscribe( | const char* const | iSubscriberOID, |
| const char* const | iEvent, |
| const char* const | iPublisherOID, |
| const CATVpmPSActionType | iActionType, |
| const char* const | iAction, |
| const char* const | iActionData, |
| const char* const | iSubscriberNickname, |
| const char* const | iPublisherNickname, |
| char*& | oErrorMessage) |
-
Subscribes to an event.
Role: Creates, for a given subscriber, a new subscription to an
event on an object (or publisher). An optional action, executed when
the event is published, can be provided.
- Parameters:
-
- iSubscriberOID
- ID of the subscriber (e.g. VPM user) for which to subscription is to
be created.
- iEvent
- Name of the event to subscribe to.
- iPublisherOID
- ID of the publisher (e.g. object) for which the event is subscribed
to.
- iActionType
- Type of the optional associated action to be executed when the event
is published. @see CATVpmPSActionType for available types.
- iAction
- Optional action (e.g. shell command) to be executed when the event is
published.
- iActionData
- Data provided as an argument to the action when the latter is
executed.
- iSubscriberNickname
- Nickname of the subscribing user (e-mail address, for example).
- iPublisherNickname
- Nickname of the publisher object.
- oErrorMessage
- Internal error message when -6 is returned.
Memory de-allocation (using the delete[] operator) is the
responsibility of the calling method.
- Returns:
- 0 if successful,
-1 if access to Publish/Subscribe is not authorized by security,
-2 if database connection is not opened,
-3 if internal publish/subscribe manager cannot be found,
-4 if any input argument is null,
-5 if the input event name doesn't refer to any existing event,
-6 if an internal error occured,
-7 when subscriber is beyond the sphere of influence of the current
VPM user.
o UnSubscribe
| public static int UnSubscribe( | const char* const | iSubscriberOID, |
| const char* const | iEvent, |
| const char* const | iPublisherOID, |
| const CATVpmPSActionType | iActionType, |
| const char* const | iAction, |
| const char* const | iActionData, |
| char*& | oErrorMessage) |
-
Unsubscribes from an event.
Role: Deletes an existing subscription, identified by its
subscriber, event, publisher and action.
- Parameters:
-
- iSubscriberOID
- ID of the subscriber (e.g. VPM user) for which to subscription was
created.
- iEvent
- Name of the event to unsubscribe from.
- iPublisherOID
- ID of the publisher (e.g. object) for which the event was subscribed
bed to.
- iActionType
- Type of the action associated to the subscription.
- iAction
- Action associated to the subscription.
- iActionData
- Data of the action associated to the subscription.
- oErrorMessage
- Internal error message when -6 is returned (null otherwise).
Memory de-allocation (using the delete[] operator) is the
responsibility of the calling method.
- Returns:
- 0 if successful,
-1 if access to Publish/Subscribe is not authorized by security,
-2 if database connection is not opened,
-3 if internal publish/subscribe manager cannot be found,
-4 if any input argument is null,
-5 if the input event name doesn't refer to any existing event,
-6 if an internal error occured,
-7 when the subscriber is beyond thesphere of influence of the
current VPM user.
-8 if the subscription couldn't be found.
o UnSubscribe
| public static int UnSubscribe( | const char* const | iSubscriberOID, |
| const char* const | iEvent, |
| const char* const | iPublisherOID, |
| char*& | oErrorMessage) |
-
Unsubscribes from an event.
Role: Deletes all existing subscriptions, regarless of their
associated action.
- Parameters:
-
- iSubscriberOID
- ID of the subscriber (e.g. VPM user) for which to subscription was
created.
- iEvent
- Name of the event to unsubscribe from.
- iPublisherOID
- ID of the publisher (e.g. object) for which the event was subscribed
to.
- oErrorMessage
- Internal error message when -6 is returned (null otherwise).
Memory de-allocation (using the delete[] operator) is the
responsibility of the calling method.
- Returns:
- 0 if successful,
-1 if access to Publish/Subscribe is not authorized by security,
-2 if database connection is not opened,
-3 if internal publish/subscribe manager cannot be found,
-4 if any input argument is null,
-5 if the input event name doesn't refer to any existing event,
-6 if an internal error occured,
-7 when the subscriber is beyond thesphere of influence of the
current VPM user.
-8 if the subscription couldn't be found.
This object is included in the file: CATVpmPubSubUsrManager.h
If needed, your Imakefile.mk should include the module: VPMPR0PUBSUB