PreCache NetInjector Documentation Center : PreCache NetInjector API Reference

C++ Classes

   







Proxy

— connectivity to a channel


A Proxy object provides connectivity to a channel and validation of notifications against the channel's Notification type.

Proxy publishes notifications for the channel's subjects and delivers matching notifications to subscriber's via subscriber callbacks.

Hierarchy

precache::util:: Serializable

      --> precache::event::Proxy

Constructor

Proxy(
PC_UINT idChannel,
PC_UINT idClient)
throw(InvalidChannelException,
precache::util::ThreadException, EventException)

Constructs a Proxy object for a specified channel and publisher.

idChannel —
the ID of the channel to be accessed

idClient —
the ID of the application using this object

throws —
Proxy throws an InvalidChannelException if the specified channel ID is invalid, or if the specified publisher ID is not allowed to access the channel.

Destructor

~Proxy()

Frees up resources allocated to this object.

Methods

Publish

void Publish(
const Notification& rkNotification) throw(InvalidNotificationException)

Publishes a notification over the associated channel.

rkNotification —
the Notification object to be delivered

throws —
Proxy throws an InvalidNotificationException if the Notification object is incomplete or otherwise invalid for publication over the channel.

Subscribe

SubscriptionHandle Subscribe(arguments) throw( InvalidFilterException,
InvalidSubjectException)

Registers a subscription for the associated channel.

This method may be invoked in several ways, providing a wide range of return values and facilitating finely-tuned filtering.

The various implementations of this method, and their variables, are listed below.

SubscriptionHandle Subscribe(
const PCSmallString& rkstrSubjectFilter,
Subscriber* pSubcriber,
void* pClosure,
Subscriber* pCtrlSubscriber = PC_NULL)

SubscriptionHandle Subscribe(
const PCSmallString& rkstrSubjectFilter,
const PC_CHAR* kszAttrFilter,
Subscriber* pSubcriber,
void* pClosure,
Subscriber* pCtrlSubscriber = PC_NULL)

SubscriptionHandle Subscribe(
const PCSmallString& rkstrSubjectFilter,
Filter* pAttrFilter,
Subscriber* pSubcriber,
void* pClosure,
Subscriber* pCtrlSubscriber = PC_NULL)

pClosure —
an object passed to the callback method to identify which subscription was matched by a notification

pCtrlSubscriber —
An optional Subscriber class used to deliver control messages associated with a subscription

pAttrFilter —
an object filter to be applied to the attributes of notifications sent over the channel; a null value sets the attribute filter to TRUE

pSubscriber —
a Subscriber object that implements a callback method for receiving matching notifications for the registered subscription

rkstrSubjectFilter —
a filter to be applied to the subject of notifications sent over the channel

kszAttrFilter —
a string filter to be applied to the attributes of notifications sent over the channel; a null value sets the attribute filter to true

returns —
a SubscriptionHandle object identifying the registered subscription for other operations

throws —
Subscribe throws an InvalidFilterException if a problem was encountered attempting to register the subscription with the channel.

Subscribe throws an InvalidSubjectException if the specified subject filter is syntactically incorrect or invalid for the channel.

CtrlSubscribe

SubscriptionHandle CtrlSubscribe(arguments) throw( InvalidFilterException,
InvalidSubjectException)

The ctrlSubscribe method registers a subscription for internal system-level events. (See, also, CtrlNotification.)

This method may be invoked in several ways, providing a range of return values and facilitating finely-tuned filtering.

CtrlSubscribe throws an InvalidSubjectException if the specified subject filter is syntactically incorrect or invalid for the channel.

The implementations of this method, and their variables, are listed below.

SubscriptionHandle CtrlSubscribe(
const PCSmallString& rkstrSubjectFilter,
Subscriber* pSubcriber,
void* pClosure)

SubscriptionHandle CtrlSubscribe(
const PCSmallString& rkstrSubjectFilter,
const PC_CHAR* kszAttrFilter,
Subscriber* pSubcriber,
void* pClosure)

SubscriptionHandle CtrlSubscribe(
const PCSmallString& rkstrSubjectFilter,
Filter* pAttrFilter,
Subscriber* pSubcriber,
void* pClosure)

pClosure —
an object passed to the callback method to identify which subscription was matched by a notification

pSubscriber —
a Subscriber object that implements a callback method for receiving matching notifications for the registered subscription

pAttrFilter —
an object filter to be applied to the attributes of notifications sent over the channel; a null value sets the attribute filter to TRUE

rkstrSubjectFilter —
a filter to be applied to the subject of notifications sent over the underlying channel

kszAttrFilter —
a string filter to be applied to the attributes of notifications sent over the channel; a null value sets the attribute filter to true

returns —
a SubscriptionHandle object identifying the registered subscription for other operations

throws —
CtrlSubscribe throws an InvalidFilterException if a problem was encountered in attempting to register the subscription with the channel.

Pause

void Pause(
SubscriptionHandle& rhSubscription) throw( InvalidSubscriptionHandleException)

Halts delivery of matching notifications to the callback associated with a subscription.

Note: The operation is idempotent.

rhSubscription —
a handle for the subscription to be paused

throws —
Pause throws an InvalidSubscriptionHandleException if the SubscriptionHandle does not identify a subscription currently registered with this object.

Suspend

void Suspend(
SubscriptionHandle& rhSubscription) throw(InvalidSubscriptionHandleException)

Halts matching of notifications against a subscription.

Note: The operation is idempotent.

rhSubscription —
a handle for the subscription to be suspended

throws —
Suspend throws an InvalidSubscriptionHandleException if the SubscriptionHandle does not identify a subscription currently registered with this object.

Resume

void Resume(
SubscriptionHandle& rhSubscription) throw( InvalidSubscriptionHandleException)

Resumes matching and delivery of notifications against a previously paused or suspended subscription, including notifications received while the subscription was paused.

Note: The operation is idempotent.

rhSubscription —
a handle for the subscription to be resumed

throws —
Suspend throws an InvalidSubscriptionHandleException if the SubscriptionHandle does not identify a subscription currently registered with this object.

Unsubscribe

void Unsubscribe(
SubscriptionHandle& rhSubscription) throw( InvalidSubscriptionHandleException)

Unregisters a subscription from a channel.

rhSubscription —
a handle for the subscription to be unsubscribed

throws —
Unsubscribe throws an InvalidSubscriptionHandleException if the SubscriptionHandle does not identify a subscription currently registered with this object.

CtrlUnsubscribe

void CtrlUnsubscribe(
SubscriptionHandle& rhSubscription) throw(InvalidSubscriptionHandleException)

Unregisters a subscription from a channel.

rhSubscription —
a handle for the subscription to be unsubscribed

throws —
CtrlUnsubscribe throws an InvalidSubscriptionHandleException if the SubscriptionHandle does not identify a subscription currently registered with this object.

GetCtrlChannelInfo

ChannelInfo* GetCtrlChannelInfo() const

ChannelInfo objects contain attribute information for notifications.

returns —
the ChannelInfo needed for the data channel underlying this object.

GetChannelInfo

ChannelInfo* GetChannelInfo() const

ChannelInfo objects contain attribute information for notifications.

returns —

the ChannelInfo needed for the data channel underlying this object.

GetFilterFactory

FilterFactory* GetFilterFactory()

Creates an instance of the FilterFactory for creating Filter objects.

returns —

a FilterFactory object that can be used for building Filter objects for data Notifications

GetCtrlFilterFactory

FilterFactory* GetCtrlFilterFactory()

Creates an instance of the FilterFactory for creating Filter objects.

hSubscription —
The subscription handle for which data is retrieved

unMinutes —
the number of minutes into the past from which cached notifications are to be retrieved

returns —

a FilterFactory object that can be used for building Filter objects for Control Notifications

Save

void Save(
const PC_CHAR* filename) throw(precache::util::SerializationException)

Saves the current state of the Proxy object in a given file. The subscribe and closure objects must be serializable.

filename —
The path of the file where the proxy state would be saved

throws —
Save throws a SerializationException is thrown if the state cannot be saved in the given file.

Load

static Proxy* Load(
PC_STRING filename) throw(precache::util::SerializationException)

Creates a Proxy object based on the state information stored in a file.

filename —
The path to the file containing the proxy state supposed to be restored in the new object

throws —
Load throws a SerializationException if the state cannot be restored from the given file.

GetPredefinedAttrNames

void GetPredefinedAttrNames(
rgstrNames_t &rgstrAttrNames)

Retrieves a list of predefined attributes names

rgstrNames_t —
the data type of the return

rgstrAttrNames —
A string array containing the names of the predefined attributes

The position of each attribute name in the array is the same with the attribute position in the channel configuration.

GetPredefinedAttrTypes

Retrieves a list of predefined attributes types.

void GetPredefinedAttrTypes(
rgAttrTypeCode_t &rgAttrTypeCode)

rgAttrTypeCode_t —
the data type of the return

rgAttrTypeCode —
An array containing the type codes of the predefined attributes

The position of each attribute type code in the array is the same with the attribute position in the channel configuration.

SetStorageFileName

void SetStorageFileName(
PC_STRING szFileName)

Defines the file name where the proxy state should be stored upon shutdown.

szFileName —
The paths to the file where the proxy state should be saved

List

List <SubscriptionHandle> GetSubscriptions()

Retrieves a list of the existing subscriptions.

returns —
the list of subscriptions handles of all the subsriptions currently associated with a proxy