OSB_LIB::RecordStreamInfo Class Reference

Collaboration diagram for OSB_LIB::RecordStreamInfo:

Collaboration graph
[legend]
List of all members.

Detailed Description

This contains the information about the record stream.

Definition at line 195 of file recordstream.h.

Public Types

Public Member Functions

Read access to the members.
Modify data members:
Database operations.

Private Member Functions

Private Attributes

Friends

Classes


Member Typedef Documentation

typedef Id<RecordStreamInfo> OSB_LIB::RecordStreamInfo::Oid

Unique object identifier for RecordStream.

Definition at line 201 of file recordstream.h.


Constructor & Destructor Documentation

OSB_LIB::RecordStreamInfo::RecordStreamInfo ( const Oid oid = Oid()  )  [explicit]

Default constructor with optional object id.

It default initializes all POD data members and sets

OSB_LIB::RecordStreamInfo::RecordStreamInfo ( const RecordSource::Oid rsId,
RecordStream::Type  type,
RecordStream::Media  media,
const std::string &  filename = "" 
)

Constructor with record source id.

Parameters:
rsId Record source of the stream.
type Type of the stream.
media Media of the stream.
filename Filename of the stream.
Exceptions:
OsbException if filename is too long
(see database table definition for maximum length).
If type is stError or stFilter, status_ is set to rsManual. In all other cases status_ is set to rsReady.

If the filename is not supplied it will be generated during insertion to the database.

OSB_LIB::RecordStreamInfo::RecordStreamInfo ( const std::string &  format,
ModuleId  generator,
RecordStream::Type  type,
RecordStream::Media  media,
const std::string &  filename = "" 
)

Constructor with record source info.

Parameters:
format Format of the output generated.
generator Generator of record streams of this source.
type Type of the stream.
media Media of the stream.
filename Filename of the stream.
Exceptions:
OsbException if filename is too long
(see database table definition for maximum length).
If type is stError or stFilter, status_ is set to rsManual. In all other cases status_ is set to rsReady.

If the filename is not supplied it will be generated during insertion to the database.


Member Function Documentation

ObjectStatus OSB_LIB::RecordStreamInfo::checkObjVs ( const OSB_DB::Session session,
bool  doThrow = false 
) const

Check if the record stream was modified in the database.

Parameters:
session Database session to use.
doThrow Throw if the stream was modified or deleted from the database since it was read last time.
Returns:
The object status of the stream (objBusy is not applicable).

void OSB_LIB::RecordStreamInfo::clear (  ) 

Clear the record stream information.

After the fuction returns, the status of the record stream information is as if constructed with source id, type and media.

long OSB_LIB::RecordStreamInfo::curRecords (  )  const [inline]

Returns the number of current records to be processing.

Definition at line 307 of file recordstream.h.

References curRecords_.

long OSB_LIB::RecordStreamInfo::errorRecords (  )  const [inline]

Returns the number of error records.

Definition at line 311 of file recordstream.h.

References errorRecords_.

const std::string& OSB_LIB::RecordStreamInfo::filename (  )  const [inline]

Returns the filename where the record streams are stored.

Definition at line 293 of file recordstream.h.

References filename_.

long OSB_LIB::RecordStreamInfo::filteredRecords (  )  const [inline]

Returns the number of filtered records.

Definition at line 309 of file recordstream.h.

References filteredRecords_.

const DateTime& OSB_LIB::RecordStreamInfo::firstRecord (  )  const [inline]

Returns the timestamp of the first record.

Definition at line 297 of file recordstream.h.

References firstRecord_.

bool OSB_LIB::RecordStreamInfo::getNext ( const OSB_DB::Session session,
const ModuleId  processor,
const std::string &  format = std::string(""),
RecordStream::Status  status = RecordStream::rsReady 
)

Read the next record stream based on record source format.

This will read the next record stream from the database based on record source format, module and record stream status. If there is no records it will return as false.

Parameters:
session Database session to use.
format Record source format to use.
processor Module which is going to process the record stream.
status Status for the record stream requested.
Returns:
true if there is any record stream read, else false.

bool OSB_LIB::RecordStreamInfo::getNext ( const OSB_DB::Session session,
const ModuleId  processor,
const RecordSource::Oid srcId,
RecordStream::Status  status = RecordStream::rsReady 
)

Read the next record stream based on record source id.

This will read the next record stream from the database based on record source id, module and record stream status. If there is no records it will return as false.

Parameters:
session Database session to use.
processor Module which is going to process the stream.
srcId Record source id, if not set all streams for processor are taken into consideration.
status Status for the record stream requested.
Returns:
true if there is any record stream read, else false.

bool OSB_LIB::RecordStreamInfo::insert ( const OSB_DB::Session session  ) 

Insert the record stream object into the database.

Insert the record stream into the database. In case of success the function sets oid_, seqNo_ and -if empty- filename_.

Parameters:
session Database session to use.
Exceptions:
OsbException in case of a database error.
InvalidSource 
Returns:
True if object inserted successfully else false.

const DateTime& OSB_LIB::RecordStreamInfo::lastRecord (  )  const [inline]

Returns the timestamp of the last record.

Definition at line 299 of file recordstream.h.

References lastRecord_.

void OSB_LIB::RecordStreamInfo::lock ( const OSB_DB::Session session  )  [private]

Lock the record stream in the database.

Parameters:
session Database session to use.
Exceptions:
ObjectModified 
ObjectDeleted 

long OSB_LIB::RecordStreamInfo::noRecords (  )  const [inline]

Returns number of records in the stream.

Definition at line 295 of file recordstream.h.

References noRecords_.

const Oid& OSB_LIB::RecordStreamInfo::oid (  )  const [inline]

Returns the unique object identifier of the record stream.

Definition at line 289 of file recordstream.h.

References oid_.

void OSB_LIB::RecordStreamInfo::onErrorRecord (  ) 

Count the number of error records in the record stream.

void OSB_LIB::RecordStreamInfo::onFilteredRecord (  ) 

Count the number of filtered records in the record stream.

void OSB_LIB::RecordStreamInfo::onNewRecord ( const DateTime ts  ) 

Set the first and/or last record.

Increments noRecords_ and curRecords_ and adjusts the time-stamp of the stream's first and last record.

Parameters:
ts Timestamp of the new record, ignored if not set.

const Oid& OSB_LIB::RecordStreamInfo::originStreamId (  )  const [inline]

Returns the origin stream id.

Definition at line 301 of file recordstream.h.

References originStreamId_.

bool OSB_LIB::RecordStreamInfo::read ( const OSB_DB::Session session  ) 

Read the record stream from the database.

Parameters:
session Database session to use.
Returns:
true if the record stream and source could be read from the database (see below), else false.
If the object id is set the function first gets the stream information.
Then, in all cases, source_ is read from the database.

const RecordSource& OSB_LIB::RecordStreamInfo::recordSource (  )  const [inline]

Returns the record source id for this record stream.

Definition at line 315 of file recordstream.h.

References source_.

bool OSB_LIB::RecordStreamInfo::remove ( const OSB_DB::Session session  ) 

Remove the record stream object from the database.

This will remove the record stream from the database. Before calling this function the object id should be assigned to identify the object from the database.

Parameters:
session Database session to use.
Exceptions:
OsbException if the stream can not be locked in database (see lock()).
Returns:
True if object deleted successfully else false.

void OSB_LIB::RecordStreamInfo::resetTimeStamps (  ) 

bool OSB_LIB::RecordStreamInfo::save ( const OSB_DB::Session session  ) 

Save the record stream object into the database.

Inserts a new record stream into the database if origin stream of current record stream is not of error type, else re-uses origin stream and update origin stream in the database.

Note:
The second case typically occurs during reprocessing of error cdrs.
Parameters:
session Database session to use.
Exceptions:
OsbException 
  • if status_ is not valid.
  • in case of a database error.
Returns:
True if object is saved successfully else false.

long OSB_LIB::RecordStreamInfo::seqNo (  )  const [inline]

Returns the sequence for the record source for this stream.

Definition at line 291 of file recordstream.h.

References seqNo_.

void OSB_LIB::RecordStreamInfo::setCurRecords ( long  curRecords  ) 

Set the number of current records to be processed.

void OSB_LIB::RecordStreamInfo::setErrorRecords ( long  errorRecords  ) 

Set the number of error records.

void OSB_LIB::RecordStreamInfo::setFilteredRecords ( long  filteredRecords  ) 

Set the number of filtered records.

void OSB_LIB::RecordStreamInfo::setNoRecords ( long  noRecords  ) 

Set the number of records in the stream.

void OSB_LIB::RecordStreamInfo::setObjVs ( const RecordStreamInfo rhs  ) 

Get the object version from another record stream.

Parameters:
rhs Record stream who's information must be overwritten in the database.
Exceptions:
InvalidOid if the object id is not set or not the same for both streams.
Attention:
Use this function only to overwrite the information written to the database by rhs.

void OSB_LIB::RecordStreamInfo::setOriginStreamId ( const Oid orgStreamId  ) 

Set the origin stream id for this record stream.

bool OSB_LIB::RecordStreamInfo::setProcessing ( const OSB_DB::Session session  ) 

Mark the record stream as currenctly being processed.

To change the status of the record stream its status in the database must be rsReady.
If the function returns true, the status in the database and status_ is rsProcessing.

Note:
Immediately after calling this member the caller should commit (or rollback) the database changes.
Parameters:
session Database session to use.
Exceptions:
OsbException if the stream can not be locked in database (see lock()).
Returns:
True if status changed successfully in the database else false.

void OSB_LIB::RecordStreamInfo::setStatus ( RecordStream::Status  status  ) 

Set the status for this record stream.

RecordStream::Status OSB_LIB::RecordStreamInfo::status (  )  const [inline]

Returns the status of this record stream.

Definition at line 313 of file recordstream.h.

References status_.

RecordStream::Media OSB_LIB::RecordStreamInfo::streamMedia (  )  const [inline]

Returns the stream media.

Definition at line 305 of file recordstream.h.

References media_.

RecordStream::Type OSB_LIB::RecordStreamInfo::streamType (  )  const [inline]

Returns the stream type.

Definition at line 303 of file recordstream.h.

References type_.

bool OSB_LIB::RecordStreamInfo::update ( const OSB_DB::Session session  ) 

Update the record stream object in the database.

This will update the record stream in the database. Before calling this function all the attributes and object id should be set.

Parameters:
session Database session to use.
Exceptions:
OsbException 
  • if status_ is not valid.
  • if the stream can not be locked in database (see lock()).
Returns:
True if object updated successfully else false.

bool OSB_LIB::RecordStreamInfo::updateStatus ( const OSB_DB::Session session  ) 

Update the status of the record stream in the database.

Parameters:
session Database session to use.
Exceptions:
OsbException 
  • if status_ is not valid.
  • if the stream can not be locked in database (see lock()).
Returns:
True if the status was updated, else false.
This member must be called only if the caller owns the record stream in the database, typically during the creation of a stream or after a successful call to setProcessing.


Friends And Related Function Documentation

friend struct OSB_DB::RecordStreamGw [friend]

This will access all the private members.

Definition at line 197 of file recordstream.h.


Member Data Documentation

long OSB_LIB::RecordStreamInfo::curRecords_ [private]

Number of records to be processing.

Definition at line 584 of file recordstream.h.

Referenced by curRecords().

long OSB_LIB::RecordStreamInfo::errorRecords_ [private]

Number of error records.

Definition at line 588 of file recordstream.h.

Referenced by errorRecords().

std::string OSB_LIB::RecordStreamInfo::filename_ [private]

Filename of the record stream.

The suggested format is BASENAMEiii.ssssss, where iii is the record source id and ssssss is the sequence number.

Definition at line 570 of file recordstream.h.

Referenced by filename().

long OSB_LIB::RecordStreamInfo::filteredRecords_ [private]

Number of records to be filtered.

Definition at line 586 of file recordstream.h.

Referenced by filteredRecords().

DateTime OSB_LIB::RecordStreamInfo::firstRecord_ [private]

Timestamp of the first record.

Definition at line 574 of file recordstream.h.

Referenced by firstRecord().

DateTime OSB_LIB::RecordStreamInfo::lastRecord_ [private]

Timestamp of the last record.

Definition at line 576 of file recordstream.h.

Referenced by lastRecord().

RecordStream::Media OSB_LIB::RecordStreamInfo::media_ [private]

Media of the stream (e.g. file,tcpip sockets).

Definition at line 582 of file recordstream.h.

Referenced by streamMedia().

long OSB_LIB::RecordStreamInfo::noRecords_ [private]

Number of records in the record stream.

Definition at line 572 of file recordstream.h.

Referenced by noRecords().

long OSB_LIB::RecordStreamInfo::objVs_ [private]

Object version for concurrency control.

Definition at line 560 of file recordstream.h.

Oid OSB_LIB::RecordStreamInfo::oid_ [private]

Unique object identifier for the record stream.

Definition at line 558 of file recordstream.h.

Referenced by oid().

Oid OSB_LIB::RecordStreamInfo::originStreamId_ [private]

Record stream id of the origin stream.

Definition at line 578 of file recordstream.h.

Referenced by originStreamId().

long OSB_LIB::RecordStreamInfo::seqNo_ [private]

Running sequence number for the record source.

Definition at line 562 of file recordstream.h.

Referenced by seqNo().

RecordSource OSB_LIB::RecordStreamInfo::source_ [private]

Record source informations.

Definition at line 592 of file recordstream.h.

Referenced by recordSource().

RecordStream::Status OSB_LIB::RecordStreamInfo::status_ [private]

Status of the record stream.

Definition at line 590 of file recordstream.h.

Referenced by status().

RecordStream::Type OSB_LIB::RecordStreamInfo::type_ [private]

Type of stream (e.g. incoming, regular, error, filter).

Definition at line 580 of file recordstream.h.

Referenced by streamType().


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:16:03 2006 for OSB Library by  doxygen 1.4.7