PreCache NetInjector Documentation Center : PreCache NetInjector API Reference

Java Classes

   







Notification

— the data for an event to be published


A Notification object stores information about a single event that is to be published over a channel.

The object stores the event's subject and the attribute values for the associated channel.

Hierarchy

java.lang.Object

--> com.precache.event.Notification

subclasses —
CtrlNotification

The lack of unsigned types in Java requires a policy for the mapping between Java types and the actual types of predefined attributes as determined by a channel notification type.

For adding discretionary attributes, the attribute type selected is the closest equivalent of the Java type used (e.g., attribute type PC_FLOAT has been selected for Java type float).

For getting discretionary attributes, a single method is provided, which returns the value in an Object whose true class depends on the actual type of the retrieved attribute.

attribute type
Java type
PC_CHAR
char
PC_UCHAR
char
PC_SHORT
short
PC_USHORT
int
PC_INT
int
PC_UINT
long
PC_LONG
long
PC_ULONG
long (does not support some values of type PC_ULONG)
PC_FLOAT
float
PC_DOUBLE
double
PC_BOOL
boolean
PC_STRING
string
PC_UCHARARRAY
char[]
PC_SHORTARRAY
short[]
PC_USHORTARRAY
int[]
PC_INTARRAY
int[]
PC_UINTARRAY
long[]
PC_LONGARRAY
long[]
PC_ULONGARRAY
long[] (does not support some values of type PC_ULONG)
PC_FLOATARRAY
float[]
PC_DOUBLEARRAY
double[]
PC_BOOLARRAY
boolean[]
PC_BYTEARRAY
byte[]

Constructors

Notification(Proxy p, string subject)

public Notification( Proxy p, string subject)

Constructs a Notification object with a partiucular subject string and associates this notification with a proxy.

p —
the proxy with which this object will be associated, providing access to a channel and validation against the channel's subject tree and notification type

subject —
a subject for the notification

throws —
Notification throws an InvalidSubjectException if the specified subject is invalid for the underlying channel.

Notification (Proxy p, string subject, string attrvals)

public Notification( Proxy p, string subject, string attrvals)

Constructs a Notification object with a partiucular subject string and attribute assignments and associates this notification with a Proxy.

p —
the proxy with which this object will be associated, providing access to a channel and validation against the channel's subject tree and notification type

subject —
a subject for the notification

attrvals —
a comma-separated sequences of attribute assignments of the form name=(type)value

throws —
Notification throws an InvalidSubjectException if the specified subject is invalid for the underlying channel

Notification throws an InvalidNotificationException if the specified attribute assignments are syntactically incorrect or are inconsistent with the notification type of the underlying channel.

Methods

Notification 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

subject

public string subject()

returns —
the subject of this notification

subjectMapping

public int[] subjectMapping()

returns —
the integer mapping of the subject associated with the notification

print

public void print()

Prints a text rendering of this object's contents on the standard output stream.

setPredefinedAttr by name

public void setPredefinedAttr(string name,type val)

Sets the value of a specified attribute of the notification, identified by its name.

name —
the name of the predefined attribute

type —
the data type of the attribute

val —
the value to be assigned to the attribute

throws —
setPredefinedAttr throws an InvalidNotificationException if the specified attribute is not a predefined attribute.

As delineated below, this method is overloaded on all allowed types for parameter val.

setPredefinedAttr(string name,char val)

setPredefinedAttr(string name,short val)

setPredefinedAttr(string name,int val)

setPredefinedAttr(string name,long val)

setPredefinedAttr(string name,float val)

setPredefinedAttr(string name,double val)

setPredefinedAttr(string name,boolean val)

setPredefinedAttr(string name,string val)

setPredefinedAttr(string name,char[] val)

setPredefinedAttr(string name,short[] val)

setPredefinedAttr(string name,int[] val)

setPredefinedAttr(string name,long[] val)

setPredefinedAttr(string name,float[] val)

setPredefinedAttr(string name,double[] val)

setPredefinedAttr(string name,boolean[] val)

setPredefinedAttr(string name,byte[] val)

setPredefinedAttr by position

public void setPredefinedAttr(int pos,type val)

Sets the value of a specified attribute of the notification, identified by its position.

Note: The position of an attribute is determined by the sequence of attributes set when the channel was configured by the NetInjector administrator.

pos —
the position (starting with 0) of the channel's predefined attribute

type —
the data type of the attribute

val —
the value to be assigned to the attribute

throws —
setPredefinedAttr throws an InvalidNotificationException if there is no predefined attribute in the specified position, or if the true class of the specified value is of an incompatible type for the specified attribute, as determined by the notification type of the underlying channel.

As delineated below, this method is overloaded on all allowed types for parameter val.

setPredefinedAttr(int pos,short val)

setPredefinedAttr(int pos,int val)

setPredefinedAttr(int pos,long val)

setPredefinedAttr(int pos,float val)

setPredefinedAttr(int pos,double val)

setPredefinedAttr(int pos,boolean val)

setPredefinedAttr(int pos,string val)

setPredefinedAttr(int pos,char[] val)

setPredefinedAttr(int pos,short[] val)

setPredefinedAttr(int pos,int[] val)

setPredefinedAttr(int pos,long[] val)

setPredefinedAttr(int pos,float[] val)

setPredefinedAttr(int pos,double[] val)

setPredefinedAttr(int pos,boolean[] val)

setPredefinedAttr(int pos,byte[] val)

getPredefinedAttrTYPE by name

public type getPredefinedAttrRETURN_TYPE(string name)

Retrieves the value of a specified attribute of the notification, identified by its name.

name —
the name of the predefined attribute

type —
the data type of the attribute

returns —
the value of a predefined attribute of this object, identified by its name

throws —
getPredefinedAttrTYPE throws an InvalidNotificationException if the specified name is not the name of a predefined attribute

getPredefinedAttrChar is replicated on all allowed data types, with the TYPE forming the suffix of the method name.

char getPredefinedAttrChar(string name)

short getPredefinedAttrShort(string name)

int getPredefinedAttrInt(string name)

long getPredefinedAttrLong(string name)

float getPredefinedAttrFloat(string name)

double getPredefinedAttrDouble(string name)

boolean getPredefinedAttrBoolean(string name)

string getPredefinedAttrString(string name)

char[] getPredefinedAttrCharArray(string name)

short[] getPredefinedAttrShortArray(string name)

int[] getPredefinedAttrIntArray(string name)

long[] getPredefinedAttrLongArray(string name)

float[] getPredefinedAttrFloatArray(string name)

double[] getPredefinedAttrDoubleArray(string name)

boolean[] getPredefinedAttrBooleanArray(string name)

byte[] getPredefinedAttrByteArray(string name)

getPredefinedAttrTYPE by position

public type getPredefinedAttrTYPE(int pos)

Retrieves the value of a specified attribute of the notification, identified by its position.

Note: The position of an attribute is determined by the sequence of attributes set when the channel was configured by the NetInjector administrator.

pos —
the position (starting with 0) of the channel's predefined attribute

type —
the data type of the attribute

returns —
the value of a predefined attribute of this object, identified by its position

throws —
getPredefinedAttrTYPE throws an InvalidNotificationException if there is no predefined attribute in the specified position

getPredefinedAttrTYPE is replicated on all allowed return types, with the TYPE forming the suffix of the method name.

short getPredefinedAttrShort(int pos)

int getPredefinedAttrInt(int pos)

long getPredefinedAttrLong(int pos)

float getPredefinedAttrFloat(int pos)

double getPredefinedAttrDouble(int pos)

boolean getPredefinedAttrBoolean(int pos)

string getPredefinedAttrString(int pos)

char[] getPredefinedAttrCharArray(int pos)

short[] getPredefinedAttrShortArray(int pos)

int[] getPredefinedAttrIntArray(int pos)

long[] getPredefinedAttrLongArray(int pos)

float[] getPredefinedAttrFloatArray(int pos)

double[] getPredefinedAttrDoubleArray(int pos)

boolean[] getPredefinedAttrBooleanArray(int pos)

byte[] getPredefinedAttrByteArray(int pos)

addDiscretionaryAttr

Sets the value of a discretionary attribute of the notification.

public void addDiscretionaryAttr(string name,type val)

name —
the name of the discretionary attribute whose value is to be set

type —
the data type of the attribute

val —
the value to be assigned to the attribute

throws —
addDiscretionaryAttr throws an InvalidNotificationException if the specified attribute name belongs to a predefined attribute, or if the specified type ID is invalid, or if the true class of the specified value is incompatible with the specified type ID.

As delineated below, addDiscretionaryAttr is overloaded on all allowed types for parameter val.

addDiscretionaryAttr(string name,char val)

addDiscretionaryAttr(string name,short val)

addDiscretionaryAttr(string name,int val)

addDiscretionaryAttr(string name,long val)

addDiscretionaryAttr(string name,float val)

addDiscretionaryAttr(string name,double val)

addDiscretionaryAttr(string name,boolean val)

addDiscretionaryAttr(string name,string val)

addDiscretionaryAttr(string name,char[] val)

addDiscretionaryAttr(string name,short[] val)

addDiscretionaryAttr(string name,int[] val)

addDiscretionaryAttr(string name,long[] val)

addDiscretionaryAttr(string name,float[] val)

addDiscretionaryAttr(string name,double[] val)

addDiscretionaryAttr(string name,boolean[] val)

addDiscretionaryAttr(string name,byte[] val)

getDiscretionaryAttr

public Object getDiscretionaryAttr(string name)

Retrieves the value of a discretionary attribute of the notification.

name —
the name of the discretionary attribute whose value is to be returned

returns —
the value of the specified attribute; the true class of the returned object is dependent upon the actual type of the attribute value

throws —
getDiscretionaryAttr throws an InvalidNotificationException if the specified name is not the name of a discretionary attribute

DiscretionaryAttrNames

public string[] DiscretionaryAttrNames()

Lists all discretionary attributes by name.

returns —
a sequence of the names of all discretionary attributes of this object in the order in which those attributes were added

isDiscretionaryAttr

public boolean isDiscretionaryAttr(string name)

Indicates whether the object has a discretionary attribute of a particular name.

name —
the discretionary attribute name to check

returns —
true if name is the name of a discretionary attribute of this object; otherwise false