PreCache NetInjector Documentation Center : PreCache NetInjector API Reference

Java 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

java.lang.Object

--> com.precache.event.Proxy

Constructor

public Proxy(int channel,int pub)

Constructs a Proxy object for a specified channel and publisher.

channel —
the ID of the channel to be accessed

pub —
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.

Methods

Proxy inherits clone, equals, getClass, hashCode, notify, notifyAll, toString, and wait from class java.lang.Object

finalize

public void finalize()

Frees up resources associated with this object.

overrides —
finalize in class Object

publish

public void publish( Notification n)

Publishes a notification over the associated channel .

n —
the notification object to be published

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

subscribe

public SubscriptionHandle subscribe(arguments)

Registers a subscription for the associated channel.

The subscribe method may be invoked in a variety of ways.

public SubscriptionHandle subscribe(
String subjectFilter,
Subscriber sub,
Object closure)

public SubscriptionHandle subscribe(
String subjectFilter,
String exp,
Subscriber sub,
Object closure)

public SubscriptionHandle subscribe(
String subjectFilter,
Filter f,
Subscriber sub,
Object closure)

public SubscriptionHandle subscribe(
String subjectFilter,
Subscriber sub,
Object closure,
Subscriber ctrlSubscriber)

public SubscriptionHandle subscribe(
String subjectFilter,
String exp,
Subscriber sub,
Object closure,
Subscriber ctrlSubscriber)

public SubscriptionHandle subscribe(
String subjectFilter,
Filter f,
Subscriber sub,
Object closure,
Subscriber ctrlSubscriber)

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

exp —
a string filter to be applied to the attributes of notifications sent over the underlying channel; a null value sets the attribute filter to TRUE

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

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

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

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

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

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

subscribe throws an InvalidSubjectException if a valid filtered subject is not found.

ctrlSubscribe

public SubscriptionHandle ctrlSubscribe(arguments)

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

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

public SubscriptionHandle ctrlSubscribe(
String subjectFilter,
Subscriber sub,
Object closure)

public SubscriptionHandle ctrlSubscribe(
String subjectFilter,
String exp,
Subscriber sub,
Object closure)

public SubscriptionHandle ctrlSubscribe(
String subjectFilter,
Filter f,
Subscriber sub,
Object closure)

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

exp —
a string filter to be applied to the attributes of notifications sent over the underlying channel; a null value sets the attribute filter to TRUE

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

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

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

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.

ctrlSubscribe throws an InvalidSubjectException if a valid filtered subject is not found.

pause

public void pause( SubscriptionHandle sh)

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

Note: The operation is idempotent.

sh —
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

public void suspend( SubscriptionHandle sh)

Halts matching of notifications against a subscription.

Note: The operation is idempotent.

sh —
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

public void resume( SubscriptionHandle sh)

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.

sh —
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

public void unsubscribe( SubscriptionHandle sh)

Unregisters a subscription from a channel.

sh —
a handle for the subscription to be unsubscribed

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

ctrlUnsubscribe

public void ctrlUnsubscribe( SubscriptionHandle sh)

Unregisters a control subscription from a channel.

sh —
a handle for the subscription to be unsubscribed

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

getCtrlChannelInfo

public ChannelInfo getCtrlChannelInfo()

ChannelInfo objects contain attribute information for notifications.

returns —
the control ChannelInfo needed for constructing filters for system events (See, also, CtrlNotification.)

getChannelInfo

public ChannelInfo getChannelInfo()

ChannelInfo objects contain attribute information for notifications.

returns —

the ChannelInfo needed for constructing filters for data notifications

getFilterFactory

public 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

public FilterFactory getCtrlFilterFactory()

Creates an instance of the FilterFactory for creating Filter objects.

returns —

a FilterFactory object that can be used for building Filter objects for control notifications

load

public static Proxy load(
java.lang.String filename)
throws EventException

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

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

throws —
load throws an EventException if the state cannot be restored from the saved file

save

public void save(
java.lang.String filename)
throws EventException

Saves the current state of the Proxy object in a given file

filename —
The path of the file storing thesaved proxy state

throws —
save throws an EventException if the state cannot be saved in the given file.

getSubscriptions

public java.util.Vector getSubscriptions()

Retrieves a list of the existing subscriptions

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

setClientType

public static void setClientType(
int idChannel,
boolean bIsAllowedToPublish,
boolean bIsAllowedToSubscribe)
throws com.precache.channel. InvalidChannelException,
EventException

Specifies whether the client is allowed to subscribe and/or publish on a specific channel

idChannel —
the ID of the channel to be accessed

bIsAllowedToPublish —
when set to true it enables the application to publish on the given channel

bIsAllowedToSubscribe —
when set to true it enables the application to subscribe on the given channel

throws —
setClientType throws an InvalidChannelException if the specified channel ID is invalid, or if the operation cannot be performed on the given channel

setClientType throws an EventException if an invalid combionation of flags is used (such as (false,false))