com.pcbsys.nirvana.base.nChannelAttributes Class Reference

This class is a container for the attributes necessary to create/find a Nirvana channel. More...

Inherits SortedObject, and fExternalable.

Public Member Functions

String getFullName () throws IllegalStateException
 Gets the full name of a channel, including the realm path if set. More...
 
int getMaxEvents ()
 Gets the maximum number of events the channel can contain. More...
 
String getName ()
 Gets the channel name. More...
 
nRealm getRealm ()
 Gets the realm this channel exists within. More...
 
int getSize ()
 Gets the object's size in bytes. More...
 
long getTTL ()
 Gets the Time To Live (TTL) value for each event contained in the channel. More...
 
int getType ()
 Gets the channel type. More...
 
long getUniqueId ()
 Gets the Unique ID value for the channel. More...
 
boolean isExternal ()
 Gets the isExternal flag to find out if the channel is marked as external. More...
 
 nChannelAttributes ()
 Default constructor.
 
 nChannelAttributes (nChannelAttributes attr)
 Default constructor.
 
 nChannelAttributes (String _name, int _maxEvents, long _ttl, int _type) throws nIllegalArgumentException
 Constructs a nChannelAttributes object with the values specified. More...
 
 nChannelAttributes (String _name, int _maxEvents, long _ttl, int _type, nRealm _realm) throws nIllegalArgumentException
 Constructs a nChannelAttributes object with the values specified. More...
 
void readExternal (fEventInputStream ois) throws IOException
 Reads the object from an external Event InputStream. More...
 
void regenerateUniqueId ()
 Generates a new unique ID for a given channel. More...
 
void setMaxEvents (int value) throws nIllegalArgumentException
 Sets the maximum number of events the channel can contain. More...
 
void setName (String channelName) throws nIllegalArgumentException
 Set the channel name for this channel attribute object. More...
 
void setRealm (nRealm _realm)
 Sets the realm the channel exists within, marking the channel as external. More...
 
void setTTL (long value) throws nIllegalArgumentException
 Sets the Time To Live (TTL) value in milliseconds for each event contained in the channel. More...
 
void setType (int aType) throws nIllegalArgumentException
 Sets the type of channel. More...
 
void setUniqueId (long id)
 Sets the Unique ID value for the channel. More...
 
void writeExternal (fEventOutputStream oos) throws IOException
 Writes the object to an external Event OutputStream. More...
 

Protected Attributes

boolean isClusterWide = false
 This flag is deprecated since 10.11, but we keep it for backward-compatibility reasons.
 

Detailed Description

This class is a container for the attributes necessary to create/find a Nirvana channel.

Constructor & Destructor Documentation

com.pcbsys.nirvana.base.nChannelAttributes.nChannelAttributes ( String  _name,
int  _maxEvents,
long  _ttl,
int  _type 
) throws nIllegalArgumentException

Constructs a nChannelAttributes object with the values specified.

Parameters
_nameA string specifying the channel name
_maxEventsAn int specifying the maximum number of events this channel can contain (i.e. the capacity)
_ttlA long value specifying the Time To Live (TTL) in milliseconds for events published in this channel (i.e. the age)
_typeAn int specifying the channel type. Valid values are nConstants.CHAN_RELIABLE or nConstants.CHAN_PERSISTIENT
com.pcbsys.nirvana.base.nChannelAttributes.nChannelAttributes ( String  _name,
int  _maxEvents,
long  _ttl,
int  _type,
nRealm  _realm 
) throws nIllegalArgumentException

Constructs a nChannelAttributes object with the values specified.

Parameters
_nameA string specifying the channel name
_maxEventsAn int specifying the maximum number of events this channel can contain (i.e. the capacity)
_ttlA long value specifying the Time To Live (TTL) in milliseconds for events published in this channel (i.e. the age)
_typeAn int specifying the channel type. Valid values are nConstants.CHAN_RELIABLE or nConstants.CHAN_PERSISTENT
_realmA nRealm object specifying the realm this channel exists within

Member Function Documentation

String com.pcbsys.nirvana.base.nChannelAttributes.getFullName ( ) throws IllegalStateException

Gets the full name of a channel, including the realm path if set.

Returns
A string specifying the full name of a channel.
Deprecated:
Please use getName() instead
int com.pcbsys.nirvana.base.nChannelAttributes.getMaxEvents ( )

Gets the maximum number of events the channel can contain.

(i.e. the capacity)

Returns
An int specifying the maximum number of events this channel can currently contain (i.e. the current capacity)
String com.pcbsys.nirvana.base.nChannelAttributes.getName ( )

Gets the channel name.

Returns
A string specifying the name value of the channel
nRealm com.pcbsys.nirvana.base.nChannelAttributes.getRealm ( )

Gets the realm this channel exists within.

Returns
an nRealm object specifying the realm this channel exists within
int com.pcbsys.nirvana.base.nChannelAttributes.getSize ( )

Gets the object's size in bytes.

Returns
An int specifying the object's size in bytes
long com.pcbsys.nirvana.base.nChannelAttributes.getTTL ( )

Gets the Time To Live (TTL) value for each event contained in the channel.

Returns
A long specifying the current TTL value in milliseconds for the channel
int com.pcbsys.nirvana.base.nChannelAttributes.getType ( )

Gets the channel type.

Returns
An int specifying the channel type. Valid values are nConstants.CHAN_RELIABLE or nConstants.CHAN_PERSISTIENT
long com.pcbsys.nirvana.base.nChannelAttributes.getUniqueId ( )

Gets the Unique ID value for the channel.

Returns
A long specifying the current Unique ID value for the channel
boolean com.pcbsys.nirvana.base.nChannelAttributes.isExternal ( )

Gets the isExternal flag to find out if the channel is marked as external.

Returns
A boolean specifying whether this channel is external or not
void com.pcbsys.nirvana.base.nChannelAttributes.readExternal ( fEventInputStream  ois) throws IOException

Reads the object from an external Event InputStream.

Parameters
oisAn Event InputStream containing the externalised object
Exceptions
IOExceptionis thrown if in IO error occurs while reading of the stream found in the CLASSPATH
void com.pcbsys.nirvana.base.nChannelAttributes.regenerateUniqueId ( )

Generates a new unique ID for a given channel.

When in a clustered environment, we must use the ID sent by the master. In that case, slaves do not generate their own IDs in order to avoid potential channel ID mismatches. For example, if a master is migrated from an older version and a slave is added to a cluster, we could be using two different algorithms to generate channel IDs and end up with channel ID mismatch in the cluster. To avoid that, we try to always use the channel ID sent by the master as part of the Recovery process.

void com.pcbsys.nirvana.base.nChannelAttributes.setMaxEvents ( int  value) throws nIllegalArgumentException

Sets the maximum number of events the channel can contain.

(i.e. the capacity)

Parameters
valueAn int specifying the max number of events
void com.pcbsys.nirvana.base.nChannelAttributes.setName ( String  channelName) throws nIllegalArgumentException

Set the channel name for this channel attribute object.

If the channel begins with '/', a realm path is also created and the channel is marked as external.

Parameters
channelNameA string specifying the name of the channel for this channel attribute object.
void com.pcbsys.nirvana.base.nChannelAttributes.setRealm ( nRealm  _realm)

Sets the realm the channel exists within, marking the channel as external.

If the realm is not set, it is implied that the channel exists within the realm you have a session to and use this object.

Parameters
_realmAn nRealm object specifying the realm the channel exists within
void com.pcbsys.nirvana.base.nChannelAttributes.setTTL ( long  value) throws nIllegalArgumentException

Sets the Time To Live (TTL) value in milliseconds for each event contained in the channel.

Parameters
valueA long specifying the new TTL value in milliseconds
void com.pcbsys.nirvana.base.nChannelAttributes.setType ( int  aType) throws nIllegalArgumentException

Sets the type of channel.

Parameters
aTypeAn int specifying the channel type. Valid values are nConstants.CHAN_RELIABLE or nConstants.CHAN_PERSISTIENT
void com.pcbsys.nirvana.base.nChannelAttributes.setUniqueId ( long  id)

Sets the Unique ID value for the channel.

Parameters
idA long specifying the new unique id value
void com.pcbsys.nirvana.base.nChannelAttributes.writeExternal ( fEventOutputStream  oos) throws IOException

Writes the object to an external Event OutputStream.

Parameters
oosAn event outputstream containing the externalised object
Exceptions
IOExceptionis thrown if an IO error occurs while writing to the stream