summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Log
diff options
context:
space:
mode:
authordhanvey <dhanvey@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-09-28 17:02:18 +0000
committerdhanvey <dhanvey@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-09-28 17:02:18 +0000
commitd90edd4f5244f2a4762d83ac5e5139b68c613da0 (patch)
tree93919d174aa496b311b2767583e8676a4506fe93 /TAO/orbsvcs/orbsvcs/Log
parent7174e60931c683eb6f1718430b2d18f9fd1de816 (diff)
downloadATCD-d90edd4f5244f2a4762d83ac5e5139b68c613da0.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Log')
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.cpp27
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.h17
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/BasicLog_i.cpp48
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/BasicLog_i.h18
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/EventLogFactory_i.cpp240
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/EventLogFactory_i.h141
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/EventLogNotification.cpp47
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/EventLogNotification.h75
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/EventLog_i.cpp193
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/EventLog_i.h158
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/Iterator_i.cpp10
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/Iterator_i.h7
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp56
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h12
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/LogNotification.cpp342
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/LogNotification.h187
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/LogRecordStore.cpp43
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/LogRecordStore.h23
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/LogRecordStore_persist.cpp223
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/LogRecordStore_persist.h155
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.cpp37
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.h37
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp1392
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.h110
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/Log_i.cpp563
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/Log_i.h141
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/NotifyLogFactory_i.cpp456
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/NotifyLogFactory_i.h263
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp78
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.h96
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/NotifyLog_i.cpp471
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/NotifyLog_i.h287
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp197
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/PersistStore.h121
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/RTEventLogFactory_i.cpp289
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/RTEventLogFactory_i.h132
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/RTEventLogNotification.cpp78
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/RTEventLogNotification.h78
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/RTEventLog_i.cpp215
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/RTEventLog_i.h157
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/eventlog_export.h37
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/log_export.h5
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/notifylog_export.h37
-rw-r--r--TAO/orbsvcs/orbsvcs/Log/rteventlog_export.h37
44 files changed, 7023 insertions, 313 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.cpp b/TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.cpp
index bad0af39eea..3571f29a62b 100644
--- a/TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.cpp
@@ -1,4 +1,4 @@
-// $Id$
+/* -*- C++ -*- $Id$ */
#include "orbsvcs/Log/BasicLogFactory_i.h"
#include "ace/Auto_Ptr.h"
@@ -44,12 +44,12 @@ BasicLogFactory_i::activate (PortableServer::POA_ptr poa
}
DsLogAdmin::BasicLog_ptr
-BasicLogFactory_i::create (DsLogAdmin::LogFullAction full_action,
+BasicLogFactory_i::create (DsLogAdmin::LogFullActionType full_action,
CORBA::ULongLong max_rec_size,
- DsLogAdmin::LogId_out id
+ DsLogAdmin::LogId_out id//,
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
- DsLogAdmin::NoResources
+ DsLogAdmin::InvalidLogFullAction
))
{
// Get an id for this Log.
@@ -58,24 +58,30 @@ BasicLogFactory_i::create (DsLogAdmin::LogFullAction full_action,
DsLogAdmin::BasicLog_ptr basiclog =
this->create_with_id (this->max_id_,
full_action,
- max_rec_size
+ max_rec_size//,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (DsLogAdmin::BasicLog::_nil ());
// Set the id to return..
id = this->max_id_;
+
+ // Store the id in the LogIdList.
+ CORBA::ULong len = logid_list_.length();
+ logid_list_.length(len+1);
+ logid_list_[len] = id;
+
return basiclog;
}
DsLogAdmin::BasicLog_ptr
BasicLogFactory_i::create_with_id (DsLogAdmin::LogId id,
- DsLogAdmin::LogFullAction full_action,
+ DsLogAdmin::LogFullActionType full_action,
CORBA::ULongLong max_size
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((
CORBA::SystemException,
- DsLogAdmin::NoResources,
- DsLogAdmin::LogIdAlreadyExists
+ DsLogAdmin::LogIdAlreadyExists,
+ DsLogAdmin::InvalidLogFullAction
))
{
// Make sure the id not used up.
@@ -111,8 +117,11 @@ BasicLogFactory_i::create_with_id (DsLogAdmin::LogId id,
basic_log_i->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (DsLogAdmin::BasicLog::_nil ());
+ // widening a BasicLog_var to a Log_var
+ DsLogAdmin::Log_var log = DsLogAdmin::BasicLog::_duplicate(basic_log.in ());
+
// Add to the Hash table..
- if (hash_map_.bind (id, basic_log) == -1)
+ if (hash_map_.bind (id, log) == -1)
ACE_THROW_RETURN (CORBA::INTERNAL (),
DsLogAdmin::BasicLog::_nil ());
diff --git a/TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.h b/TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.h
index 355c599ae36..07ec4d59ae0 100644
--- a/TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.h
+++ b/TAO/orbsvcs/orbsvcs/Log/BasicLogFactory_i.h
@@ -1,5 +1,6 @@
/* -*- C++ -*- */
// $Id$
+
// ============================================================================
// = LIBRARY
// orbsvcs
@@ -11,7 +12,8 @@
// Implements the Factory for BasicLog Objects.
//
// = AUTHOR
-// Matthew Braun (mjb2@cs.wustl.edu) and Pradeep Gore <pradeep@cs.wustl.edu>
+// Matthew Braun <mjb2@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
//
// ============================================================================
@@ -21,6 +23,7 @@
#include "orbsvcs/DsLogAdminS.h"
#include "orbsvcs/Log/LogMgr_i.h"
+#include "orbsvcs/Log/BasicLog_i.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -55,25 +58,25 @@ public:
// Activate this servant with the POA passed in.
DsLogAdmin::BasicLog_ptr
- create (DsLogAdmin::LogFullAction full_action,
+ create (DsLogAdmin::LogFullActionType full_action,
CORBA::ULongLong max_size,
DsLogAdmin::LogId_out id
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
- DsLogAdmin::NoResources
+ DsLogAdmin::InvalidLogFullAction
));
// Allows clients to create new BasicLog objects. Raises
// DsLogAdmin::NoResources and DsLogAdmin::InvalidThreshold
DsLogAdmin::BasicLog_ptr
create_with_id (DsLogAdmin::LogId id,
- DsLogAdmin::LogFullAction full_action,
- CORBA::ULongLong max_size
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size//,
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((
CORBA::SystemException,
- DsLogAdmin::NoResources,
- DsLogAdmin::LogIdAlreadyExists
+ DsLogAdmin::LogIdAlreadyExists,
+ DsLogAdmin::InvalidLogFullAction
));
// Same as create (), but allows clients to specify the id.
diff --git a/TAO/orbsvcs/orbsvcs/Log/BasicLog_i.cpp b/TAO/orbsvcs/orbsvcs/Log/BasicLog_i.cpp
index d5cb57712cd..37c55ea75ef 100644
--- a/TAO/orbsvcs/orbsvcs/Log/BasicLog_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/Log/BasicLog_i.cpp
@@ -1,4 +1,4 @@
-// $Id$
+/* -*- C++ -*- $Id$ */
#include "orbsvcs/Log/BasicLog_i.h"
#include "orbsvcs/Log/LogMgr_i.h"
@@ -6,10 +6,10 @@
BasicLog_i::BasicLog_i (LogMgr_i &logmgr_i,
DsLogAdmin::LogMgr_ptr factory,
DsLogAdmin::LogId id,
- DsLogAdmin::LogFullAction log_full_action,
+ DsLogAdmin::LogFullActionType log_full_action,
CORBA::ULongLong max_size,
ACE_Reactor *reactor)
- : Log_i (factory, id, log_full_action, max_size, reactor),
+ : Log_i (factory, id, 0, log_full_action, max_size, reactor),
logmgr_i_(logmgr_i)
{
// No-Op.
@@ -20,6 +20,48 @@ BasicLog_i::~BasicLog_i ()
// No-Op.
}
+DsLogAdmin::Log_ptr
+BasicLog_i::copy (DsLogAdmin::LogId &id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ DsLogAdmin::BasicLogFactory_var basicLogFactory =
+ DsLogAdmin::BasicLogFactory::_narrow (factory_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsLogAdmin::BasicLogFactory::_nil ());
+
+ DsLogAdmin::BasicLog_var log =
+ basicLogFactory->create (DsLogAdmin::halt, 0, id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsLogAdmin::BasicLog::_nil ());
+
+ // Copy the attributes from the log.
+ this->copy_attributes (log.in () ACE_ENV_ARG_PARAMETER);
+
+ return log._retn ();
+
+}
+
+DsLogAdmin::Log_ptr
+BasicLog_i::copy_with_id (DsLogAdmin::LogId id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ DsLogAdmin::BasicLogFactory_var basicLogFactory =
+ DsLogAdmin::BasicLogFactory::_narrow (factory_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsLogAdmin::BasicLogFactory::_nil ());
+
+ DsLogAdmin::BasicLog_var log =
+ basicLogFactory->create_with_id (id, DsLogAdmin::halt, 0
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsLogAdmin::BasicLog::_nil ());
+
+ // Copy the attributes from the log.
+ this->copy_attributes (log.in () ACE_ENV_ARG_PARAMETER);
+
+ return log._retn ();
+
+}
+
void
BasicLog_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
diff --git a/TAO/orbsvcs/orbsvcs/Log/BasicLog_i.h b/TAO/orbsvcs/orbsvcs/Log/BasicLog_i.h
index 3ac2e12b5f7..f0be1b9d41a 100644
--- a/TAO/orbsvcs/orbsvcs/Log/BasicLog_i.h
+++ b/TAO/orbsvcs/orbsvcs/Log/BasicLog_i.h
@@ -12,7 +12,9 @@
// Implementation of the DsLogAdmin::BasicLog interface.
//
// = AUTHOR
-// Matthew Braun (mjb2@cs.wustl.edu) and Pradeep Gore <pradeep@cs.wustl.edu>
+// Matthew Braun <mjb2@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
+// D A Hanvey <d.hanvey@qub.ac.uk>
//
// ============================================================================
@@ -20,7 +22,7 @@
#define TLS_BASICLOG_I_H
#include "ace/pre.h"
-#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/DsLogAdminS.h"
#include "orbsvcs/Log/Log_i.h"
#include "log_export.h"
@@ -56,7 +58,7 @@ public:
BasicLog_i (LogMgr_i &logmgr_i,
DsLogAdmin::LogMgr_ptr factory,
DsLogAdmin::LogId id,
- DsLogAdmin::LogFullAction log_full_action = DsLogAdmin::wrap,
+ DsLogAdmin::LogFullActionType log_full_action = DsLogAdmin::wrap,
CORBA::ULongLong max_size = 0,
ACE_Reactor *reactor = ACE_Reactor::instance ());
// Constructor
@@ -64,6 +66,16 @@ public:
~BasicLog_i ();
// Destructor.
+ virtual DsLogAdmin::Log_ptr copy (DsLogAdmin::LogId &id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Duplicate the log.
+
+ virtual DsLogAdmin::Log_ptr copy_with_id (DsLogAdmin::LogId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Duplicate the log specifying an id.
+
void
destroy (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
diff --git a/TAO/orbsvcs/orbsvcs/Log/EventLogFactory_i.cpp b/TAO/orbsvcs/orbsvcs/Log/EventLogFactory_i.cpp
new file mode 100644
index 00000000000..f4b345711d5
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/EventLogFactory_i.cpp
@@ -0,0 +1,240 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/EventLogFactory_i.h"
+#include "ace/Auto_Ptr.h"
+#include "orbsvcs/Log/LogNotification.h"
+#include "orbsvcs/Log/EventLogNotification.h"
+
+EventLogFactory_i::EventLogFactory_i (void)
+{
+ TAO_CEC_Default_Factory::init_svcs ();
+
+ PortableServer::POA_var defPOA = this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_CEC_EventChannel_Attributes attr (defPOA.in (), defPOA.in ());
+
+ ACE_NEW_THROW_EX (impl,
+ TAO_CEC_EventChannel (attr),
+ CORBA::NO_MEMORY ());
+ ACE_TRY_CHECK;
+
+ impl->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+EventLogFactory_i::~EventLogFactory_i()
+{
+ // No-Op.
+}
+
+CosEventChannelAdmin::EventChannel_ptr
+EventLogFactory_i::init (PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL)
+{
+ ACE_UNUSED_ARG (poa);
+
+ ACE_ASSERT (!CORBA::is_nil (this->poa_.in ()));
+
+ CosEventChannelAdmin::EventChannel_var ec_return;
+
+ auto_ptr <TAO_CEC_EventChannel> ec (impl);
+ ACE_TRY_CHECK;
+
+ PortableServer::ObjectId_var oid = this->poa_->activate_object ( ec.get ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ec.release ();
+
+ CORBA::Object_var obj =
+ this->poa_->id_to_reference (oid.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ec_return = CosEventChannelAdmin::EventChannel::_narrow (obj.in ());
+
+ return ec_return._retn ();
+}
+
+DsEventLogAdmin::EventLogFactory_ptr
+EventLogFactory_i::activate (PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL)
+{
+ this->poa_ = poa;
+ this->event_channel_ = init (this->poa_.in ());
+
+ this->consumer_admin_ = this->event_channel_->for_consumers(ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ ACE_NEW_THROW_EX (this->notifier_,
+ EventLogNotification(this->event_channel_.in ()),
+ CORBA::NO_MEMORY ());
+
+ DsEventLogAdmin::EventLogFactory_var v_return;
+
+ PortableServer::ObjectId_var oid =
+ poa->activate_object (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ CORBA::Object_var obj =
+ poa->id_to_reference (oid.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ // narrow and store the result..
+ this->log_mgr_ =
+ DsLogAdmin::LogMgr::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ v_return =
+ DsEventLogAdmin::EventLogFactory::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsEventLogAdmin::EventLogFactory::_nil ());
+
+ return v_return._retn ();
+}
+
+DsEventLogAdmin::EventLog_ptr
+EventLogFactory_i::create (
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_rec_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds,
+ DsLogAdmin::LogId_out id
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold
+ ))
+{
+ // Get an id for this Log.
+ this->max_id_++;
+
+ DsEventLogAdmin::EventLog_ptr eventlog =
+ this->create_with_id (this->max_id_,
+ full_action,
+ max_rec_size,
+ thresholds//,
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsEventLogAdmin::EventLog::_nil ());
+
+ // Set the id to return..
+ id = this->max_id_;
+
+ // Store the id in the LogIdList.
+ CORBA::ULong len = logid_list_.length();
+ logid_list_.length(len+1);
+ logid_list_[len] = id;
+
+ return eventlog;
+}
+
+DsEventLogAdmin::EventLog_ptr
+EventLogFactory_i::create_with_id (
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds//,
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogIdAlreadyExists,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold
+ ))
+{
+ ACE_UNUSED_ARG (thresholds);
+
+ // Make sure the id not used up.
+ if (hash_map_.find (id) == 0)
+ ACE_THROW_RETURN (DsLogAdmin::LogIdAlreadyExists (),
+ DsEventLogAdmin::EventLog::_nil ());
+
+ DsEventLogAdmin::EventLog_var event_log;
+ // Object to return.
+
+ EventLog_i* event_log_i;
+
+ ACE_NEW_THROW_EX (event_log_i,
+ EventLog_i (*this,
+ this->log_mgr_.in (),
+ this,
+ this->notifier_,
+ id,
+ full_action,
+ max_size
+ ),
+ CORBA::NO_MEMORY ());
+
+ ACE_CHECK_RETURN (event_log._retn ());
+
+ auto_ptr<EventLog_i> event_log_auto (event_log_i);
+ // just in case the activation fails.
+
+ event_log_i->init (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (event_log._retn ());
+
+ //dhanvey
+ //initialise the LogConsumer object
+ event_log_i->activate();
+
+ // Register with the poa
+ event_log = event_log_i->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (event_log._retn ());
+
+ event_log_i->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsEventLogAdmin::EventLog::_nil ());
+
+ // widening a BasicLog_var to a Log_var.
+ DsLogAdmin::Log_var log = DsEventLogAdmin::EventLog::_duplicate(event_log.in ());
+
+ // Add to the Hash table..
+ if (hash_map_.bind (id, log) == -1)
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ DsEventLogAdmin::EventLog::_nil ());
+
+ // All is well, release the reference.
+ event_log_auto.release ();
+
+ notifier_->object_creation (ACE_static_cast(DsLogAdmin::Log*, log.in ()), id);
+
+ return event_log._retn ();
+}
+
+CosEventChannelAdmin::ProxyPushSupplier_ptr
+EventLogFactory_i::obtain_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->obtain_push_supplier();
+}
+
+CosEventChannelAdmin::ProxyPullSupplier_ptr
+EventLogFactory_i::obtain_pull_supplier (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+
+{
+ return consumer_admin_->obtain_pull_supplier();
+}
+
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class auto_ptr <EventLog_i>;
+template class ACE_Auto_Basic_Ptr<EventLog_i>;
+
+#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate auto_ptr <EventLog_i>
+#pragma instantiate ACE_Auto_Event_Ptr <EventLog_i>
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Log/EventLogFactory_i.h b/TAO/orbsvcs/orbsvcs/Log/EventLogFactory_i.h
new file mode 100644
index 00000000000..18c5e1adb11
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/EventLogFactory_i.h
@@ -0,0 +1,141 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// EventLogFactory_i.h
+//
+// = DESCRIPTION
+// Implements the Factory for EventLog Objects.
+//
+// = AUTHOR
+// Rob Ruff <rruff@scires.com>
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_EVENTLOGFACTORY_I_H
+#define TLS_EVENTLOGFACTORY_I_H
+
+#include "orbsvcs/DsEventLogAdminS.h"
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/Log/LogMgr_i.h"
+#include "orbsvcs/CosEvent/CEC_ConsumerAdmin.h"
+#include "orbsvcs/CosEvent/CEC_EventChannel.h"
+#include "orbsvcs/CosEvent/CEC_Default_Factory.h"
+#include "EventLog_i.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+
+class EventLog_i;
+class EventLogNotification;
+
+class TAO_EventLog_Export EventLogFactory_i :
+public POA_DsEventLogAdmin::EventLogFactory,
+public LogMgr_i
+
+{
+ // = TITLE
+ // EventLogFactory_i
+ // = DESCRIPTION
+ // Implementation of the EventLogFactory interface.
+ //
+public:
+ //= Initialization and termination code.
+ EventLogFactory_i (void);
+ // Ctor
+
+ ~EventLogFactory_i ();
+ // Dtor
+
+ CosEventChannelAdmin::EventChannel_ptr
+ init (PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL);
+
+ DsEventLogAdmin::EventLogFactory_ptr
+ activate (PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL);
+ // Activate this servant with the POA passed in.
+
+ DsEventLogAdmin::EventLog_ptr create (
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds,
+ DsLogAdmin::LogId_out id
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold
+ ));
+
+ // Allows clients to create new BasicLog objects. Raises
+ // DsLogAdmin::NoResources and DsLogAdmin::InvalidThreshold
+ DsEventLogAdmin::EventLog_ptr create_with_id (
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogIdAlreadyExists,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold
+ ));
+ // Same as create (), but allows clients to specify the id.
+
+ CosEventChannelAdmin::ProxyPushSupplier_ptr obtain_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosEventChannelAdmin::ProxyPullSupplier_ptr obtain_pull_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ protected:
+ DsLogAdmin::LogMgr_var log_mgr_;
+ // Our object ref. after <active>ation.
+
+ TAO_CEC_EventChannel *impl;
+ // The event channel used for log generated events.
+
+ EventLogNotification* notifier_;
+ // The object used for log generated events.
+
+ CosEventChannelAdmin::EventChannel_var event_channel_;
+ // EventChannel used to obtain the ConsumerAdmin.
+
+ CosEventChannelAdmin::ConsumerAdmin_var consumer_admin_;
+ // The ConsumerAdmin that the EventLogFactory supports.
+
+ PortableServer::POA_var poa_;
+ // POA.
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TLS_EVENTLOGFACTORY_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/EventLogNotification.cpp b/TAO/orbsvcs/orbsvcs/Log/EventLogNotification.cpp
new file mode 100644
index 00000000000..625be86575e
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/EventLogNotification.cpp
@@ -0,0 +1,47 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/LogNotification.h"
+#include "orbsvcs/Log/EventLogNotification.h"
+#include "orbsvcs/Time_Utilities.h"
+#include "tao/debug.h"
+
+EventLogNotification::EventLogNotification (CosEventChannelAdmin::EventChannel_ptr ec)
+: LogNotification (), event_channel_ (CosEventChannelAdmin::EventChannel::_duplicate (ec))
+{
+ obtain_proxy_consumer ();
+}
+
+EventLogNotification::~EventLogNotification (void)
+{
+ // No-Op.
+}
+
+void
+EventLogNotification::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->consumer_->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+EventLogNotification::obtain_proxy_consumer()
+{
+ CosEventChannelAdmin::SupplierAdmin_var supplier_admin =
+ event_channel_->for_suppliers ();
+
+ consumer_ = supplier_admin->obtain_push_consumer ();
+
+ CosEventComm::PushSupplier_var supplier =
+ this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ consumer_->connect_push_supplier (supplier.in());
+}
+
+void
+EventLogNotification::send_notification (const CORBA::Any& any )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ consumer_->push (any);
+}
+
+
diff --git a/TAO/orbsvcs/orbsvcs/Log/EventLogNotification.h b/TAO/orbsvcs/orbsvcs/Log/EventLogNotification.h
new file mode 100644
index 00000000000..a1e1f49489b
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/EventLogNotification.h
@@ -0,0 +1,75 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// EventLogNotification_i.h
+//
+// = DESCRIPTION
+// Implementation of Log generated events for EventLog.
+//
+// = AUTHOR
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_EVENT_LOG_NOTIFICATION_H
+#define TLS_EVENT_LOG_NOTIFICATION_H
+#include "ace/pre.h"
+
+#include "orbsvcs/CosEvent/CEC_ConsumerAdmin.h"
+#include "orbsvcs/CosEvent/CEC_EventChannel.h"
+#include "orbsvcs/DsEventLogAdminS.h"
+#include "orbsvcs/CosEvent/CEC_Default_Factory.h"
+#include "orbsvcs/CosEventCommS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+class TAO_EventLog_Export EventLogNotification : public LogNotification,
+ POA_CosEventComm::PushSupplier
+{
+ // = TITLE
+ // Used to forward log generated events to a logging server
+ //
+ // = DESCRIPTION
+ // This implementation attempts to conform to the telecom
+ // logging specification.
+
+public:
+ // = Initialization and Termination
+ EventLogNotification (CosEventChannelAdmin::EventChannel_ptr);
+ // Constructor.
+
+ ~EventLogNotification (void);
+ // Destructor.
+
+ virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // The skeleton methods.
+
+protected:
+ // = Helper methods
+
+ void obtain_proxy_consumer ();
+
+ virtual void send_notification (const CORBA::Any& any ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Send the event on the event channel.
+
+private:
+ CORBA::ORB_var orb_;
+ // The ORB.
+
+ CosEventChannelAdmin::EventChannel_var event_channel_;
+ // The event channel we connect to.
+
+ CosEventChannelAdmin::ProxyPushConsumer_var consumer_;
+ // The ProxyPushConsumer used to connect to the event channel.
+};
+#include "ace/post.h"
+#endif /* TLS_EVENT_LOG_NOTIFICATION_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/EventLog_i.cpp b/TAO/orbsvcs/orbsvcs/Log/EventLog_i.cpp
new file mode 100644
index 00000000000..77b5521ebb5
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/EventLog_i.cpp
@@ -0,0 +1,193 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/EventLog_i.h"
+#include "orbsvcs/Log/LogMgr_i.h"
+#include "orbsvcs/Log/LogNotification.h"
+
+LogConsumer::LogConsumer (EventLog_i *log)
+: log_ (log)
+{
+ // No-Op.
+}
+
+LogConsumer::~LogConsumer (void)
+{
+ // No-Op.
+}
+
+void
+LogConsumer::connect (CosEventChannelAdmin::ConsumerAdmin_ptr consumer_admin)
+{
+ // Connect to the event channel.
+ CosEventComm::PushConsumer_var myself = this->_this ();
+ this->supplier_proxy_ = consumer_admin->obtain_push_supplier ();
+ this->supplier_proxy_->connect_push_consumer (myself.in());
+}
+
+void
+LogConsumer::push (const CORBA::Any& data ACE_ENV_ARG_DECL)
+ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ))
+{
+ // create a record list...
+ DsLogAdmin::RecordList recList (1);
+ recList.length (1);
+
+ recList [0].info = data;
+
+ // log the RecordList.
+ this->log_->write_recordlist (recList ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+}
+
+void
+LogConsumer::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ this->supplier_proxy_->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+
+EventLog_i::EventLog_i (LogMgr_i &logmgr_i,
+ DsLogAdmin::LogMgr_ptr factory,
+ EventLogFactory_i *event_log_factory,
+ LogNotification *log_notifier,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType log_full_action,
+ CORBA::ULongLong max_size,
+ ACE_Reactor *reactor)
+ : Log_i (factory, id, log_notifier, log_full_action, max_size, reactor),
+ logmgr_i_(logmgr_i)
+{
+ ACE_UNUSED_ARG (event_log_factory);
+
+ ACE_ENV_SINGLE_ARG_DECL
+
+ // Create an instance of the event channel.
+ PortableServer::POA_var poa = this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ TAO_CEC_EventChannel_Attributes attr (poa.in(), poa.in());
+
+ ACE_NEW_THROW_EX (this->event_channel_,
+ TAO_CEC_EventChannel(attr),
+ CORBA::NO_MEMORY ());
+}
+
+EventLog_i::~EventLog_i ()
+{
+ // No-Op.
+}
+
+
+DsLogAdmin::Log_ptr
+EventLog_i::copy (DsLogAdmin::LogId &id)
+ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Duplicate the log.
+ DsEventLogAdmin::EventLogFactory_var eventLogFactory =
+ DsEventLogAdmin::EventLogFactory::_narrow (factory_.in ());
+
+ DsEventLogAdmin::EventLog_var log =
+ eventLogFactory->create (DsLogAdmin::halt, 0, thresholds_, id);
+
+ copy_attributes (log.in ());
+
+ return log._retn ();
+
+}
+
+DsLogAdmin::Log_ptr
+EventLog_i::copy_with_id (DsLogAdmin::LogId id)
+ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Duplicate the log supplying the log id.
+ DsEventLogAdmin::EventLogFactory_var eventLogFactory =
+ DsEventLogAdmin::EventLogFactory::_narrow (factory_.in ());
+
+ DsEventLogAdmin::EventLog_var log =
+ eventLogFactory->create_with_id (id, DsLogAdmin::halt, 0, thresholds_);
+
+ copy_attributes (log.in ());
+
+ return log._retn ();
+
+}
+
+
+void
+EventLog_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Send event to indicate the log has been deleted.
+ notifier_->object_deletion (logid_);
+
+ // Remove ourselves from the list of logs.
+ this->logmgr_i_.remove (this->logid_); // check for error?
+
+ // Deregister with POA.
+ PortableServer::POA_var poa =
+ this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::ObjectId_var id =
+ poa->servant_to_id (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ poa->deactivate_object (id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+
+
+}
+
+void
+EventLog_i::activate (void)
+{
+ ACE_ENV_SINGLE_ARG_DECL
+
+ CosEventChannelAdmin::ConsumerAdmin_var consumer_admin =
+ this->event_channel_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ // Create the PushConsumer that will log the events.
+ this->my_log_consumer_ = new LogConsumer (this);
+ this->my_log_consumer_->connect (consumer_admin.in ());
+}
+
+
+CosEventChannelAdmin::ConsumerAdmin_ptr
+EventLog_i::for_consumers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->for_consumers(ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CosEventChannelAdmin::SupplierAdmin_ptr
+EventLog_i::for_suppliers (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->for_suppliers(ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+EventLog_i::write_recordlist (const DsLogAdmin::RecordList & list//,
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ DsLogAdmin::LogFull,
+ DsLogAdmin::LogLocked
+ ))
+{
+ Log_i::write_recordlist (list ACE_ENV_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/orbsvcs/Log/EventLog_i.h b/TAO/orbsvcs/orbsvcs/Log/EventLog_i.h
new file mode 100644
index 00000000000..43e99286be2
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/EventLog_i.h
@@ -0,0 +1,158 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// EventLog_i.h
+//
+// = DESCRIPTION
+// Implementation of the DsLogAdmin::EventLog interface.
+//
+// = AUTHOR
+// Rob Ruff <rruff@scires.com>
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_EVENTLOG_I_H
+#define TLS_EVENTLOG_I_H
+
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/DsEventLogAdminS.h"
+#include "orbsvcs/Log/Log_i.h"
+#include "orbsvcs/CosEvent/CEC_EventChannel.h"
+
+#include "eventlog_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class LogMgr_i;
+class EventLog_i;
+class EventLogFactory_i;
+
+// Bug in MSVC 5, See KB article Q167350
+#if defined (_MSC_VER) && (_MSC_VER == 1100)
+using DsLogAdmin::wrap;
+#endif /* (_MSC_VER) && (_MSC_VER == 1100) */
+
+
+class LogConsumer : public virtual POA_CosEventComm::PushConsumer
+{
+ public:
+ LogConsumer (EventLog_i *log);
+ ~LogConsumer (void);
+
+ void
+ connect (CosEventChannelAdmin::ConsumerAdmin_ptr consumer_admin);
+
+ private:
+ void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ void push (const CORBA::Any& data ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+
+ CosEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_;
+
+ EventLog_i *log_;
+};
+
+
+class EventLog_i : public Log_i,
+ public POA_DsEventLogAdmin::EventLog,
+ public virtual PortableServer::RefCountServantBase
+{
+ // = TITLE
+ // EventLog_i
+ // = DESCRIPTION
+ // The class supports the <destroy> method to destroy the Log.
+ //
+public:
+ // = Initialization and Termination.
+ EventLog_i (LogMgr_i &logmgr_i,
+ DsLogAdmin::LogMgr_ptr factory,
+ EventLogFactory_i *event_log_factory,
+ LogNotification *log_notifier,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType log_full_action = DsLogAdmin::wrap,
+ CORBA::ULongLong max_size = 0,
+ ACE_Reactor *reactor = ACE_Reactor::instance ());
+ // Constructor
+
+ ~EventLog_i ();
+ // Destructor.
+
+ virtual DsLogAdmin::Log_ptr copy (DsLogAdmin::LogId &id)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Duplicate the log.
+
+ virtual DsLogAdmin::Log_ptr copy_with_id (DsLogAdmin::LogId id)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Duplicate the log specifying an id.
+
+ void
+ destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Destroy the log object and all contained records.
+
+ void
+ activate (void);
+
+ CosEventChannelAdmin::ConsumerAdmin_ptr
+ for_consumers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ // The CosEventChannelAdmin::EventChannel interface.
+
+ CosEventChannelAdmin::SupplierAdmin_ptr
+ for_suppliers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ // The CosEventChannelAdmin::EventChannel interface.
+
+ void write_recordlist (const DsLogAdmin::RecordList & list
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogFull,
+ DsLogAdmin::LogLocked
+ ));
+ // Used to write records to the log.
+
+
+ protected:
+ LogMgr_i &logmgr_i_;
+ // Used to access the hash map that holds all the Logs created.
+
+ private:
+ TAO_CEC_EventChannel *event_channel_;
+ // The Event Channel that the log uses.
+
+ LogConsumer *my_log_consumer_;
+ // The PushConsumer that consumes the events and stores them
+ // in the log.
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TLS_EVENTLOG_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/Iterator_i.cpp b/TAO/orbsvcs/orbsvcs/Log/Iterator_i.cpp
index 6dcc28fc61c..3fd4443d474 100644
--- a/TAO/orbsvcs/orbsvcs/Log/Iterator_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/Log/Iterator_i.cpp
@@ -1,4 +1,4 @@
-// $Id$
+/* -*- C++ -*- $Id$ */
#include "Iterator_i.h"
#include "orbsvcs/Log/Log_Constraint_Interpreter.h"
@@ -52,7 +52,7 @@ Iterator_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
DsLogAdmin::RecordList*
Iterator_i::get (CORBA::ULong position,
- CORBA::ULong how_many
+ CORBA::ULong how_many//,
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidParam))
@@ -75,7 +75,7 @@ Iterator_i::get (CORBA::ULong position,
TAO_Log_Constraint_Interpreter interpreter (constraint_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
-
+
// Sequentially iterate over all the records and pick the ones that
// meet the constraints.
@@ -106,10 +106,10 @@ Iterator_i::get (CORBA::ULong position,
}
// Use an evaluator.
- TAO_Log_Constraint_Evaluator evaluator (hash_entry->int_id_);
+ TAO_Log_Constraint_Visitor visitor (hash_entry->int_id_);
// Does it match the constraint?
- if (interpreter.evaluate (evaluator) == 1)
+ if (interpreter.evaluate (visitor) == 1)
{
(*rec_list)[count] = hash_entry->int_id_;
// copy the log record.
diff --git a/TAO/orbsvcs/orbsvcs/Log/Iterator_i.h b/TAO/orbsvcs/orbsvcs/Log/Iterator_i.h
index 4655da02a4d..6b2405341e0 100644
--- a/TAO/orbsvcs/orbsvcs/Log/Iterator_i.h
+++ b/TAO/orbsvcs/orbsvcs/Log/Iterator_i.h
@@ -1,6 +1,6 @@
/* -*- C++ -*- */
-
// $Id$
+
// ============================================================================
//
// = LIBRARY
@@ -13,7 +13,8 @@
// Implementation of the DsLogAdmin::Iterator interface.
//
// = AUTHOR
-// Matthew Braun (mjb2@cs.wustl.edu) and Pradeep Gore <pradeep@cs.wustl.edu>
+// Matthew Braun <mjb2@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
//
// ============================================================================
@@ -57,7 +58,7 @@ public:
//Destructor
DsLogAdmin::RecordList* get (CORBA::ULong position,
- CORBA::ULong how_many
+ CORBA::ULong how_many//,
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidParam));
diff --git a/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp b/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp
index fae15c930bd..f0be3bfbc1b 100644
--- a/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp
@@ -1,4 +1,4 @@
-// $Id$
+/* -*- C++ -*- $Id$ */
#include "LogMgr_i.h"
@@ -41,9 +41,8 @@ LogMgr_i::list_logs (ACE_ENV_SINGLE_ARG_DECL)
{
iter.next (hash_entry);
iter.advance ();
-
(*list)[i] =
- DsLogAdmin::BasicLog::_duplicate (hash_entry->int_id_.in ());
+ DsLogAdmin::Log::_duplicate (hash_entry->int_id_.in ());
}
return list;
@@ -56,12 +55,12 @@ LogMgr_i::find_log (DsLogAdmin::LogId id
CORBA::SystemException
))
{
- DsLogAdmin::BasicLog_var v_return;
+ DsLogAdmin::Log_var v_return;
if (hash_map_.find (id,
v_return) == -1)
{
- return DsLogAdmin::BasicLog::_nil ();
+ return DsLogAdmin::Log::_nil ();
}
else
{
@@ -72,10 +71,8 @@ LogMgr_i::find_log (DsLogAdmin::LogId id
// of scope, it too will release the object ref.we don't want this.
// we want the ref. count to remain what it was.
// So we increment the ref. count here.
-
- DsLogAdmin::BasicLog::_duplicate (v_return.in ());
-
- return DsLogAdmin::BasicLog::_duplicate (v_return.in ());
+ DsLogAdmin::Log::_duplicate (v_return.in ());
+ return DsLogAdmin::Log::_duplicate (v_return.in ());
// This duplicate is to obey rules of returning obj. refs.
// don't get confused!
}
@@ -87,8 +84,13 @@ LogMgr_i::list_logs_by_id (ACE_ENV_SINGLE_ARG_DECL)
CORBA::SystemException
))
{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
- //@@ Later: We need to maintain a sorted list of logids to do this efficiently.
+ DsLogAdmin::LogIdList* ret_val;
+ ACE_NEW_THROW_EX (ret_val,
+ DsLogAdmin::LogIdList (this->logid_list_),
+ CORBA::NO_MEMORY ());
+ ACE_CHECK_RETURN (0);
+
+ return ret_val;
}
int
@@ -99,24 +101,24 @@ LogMgr_i::remove (DsLogAdmin::LogId id)
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Hash_Map_Entry<DsLogAdmin::LogId,DsLogAdmin::BasicLog_var>;
-template class ACE_Hash_Map_Manager<DsLogAdmin::LogId,DsLogAdmin::BasicLog_var,TAO_SYNCH_MUTEX>;
-template class ACE_Hash_Map_Manager_Ex<DsLogAdmin::LogId, DsLogAdmin::BasicLog_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>;
-template class ACE_Hash_Map_Iterator<DsLogAdmin::LogId,DsLogAdmin::BasicLog_var,TAO_SYNCH_MUTEX>;
-template class ACE_Hash_Map_Iterator_Ex<DsLogAdmin::LogId, DsLogAdmin::BasicLog_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>;
-template class ACE_Hash_Map_Iterator_Base_Ex<DsLogAdmin::LogId, DsLogAdmin::BasicLog_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>;
-template class ACE_Hash_Map_Reverse_Iterator<DsLogAdmin::LogId,DsLogAdmin::BasicLog_var,TAO_SYNCH_MUTEX>;
-template class ACE_Hash_Map_Reverse_Iterator_Ex<DsLogAdmin::LogId, DsLogAdmin::BasicLog_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Entry<DsLogAdmin::LogId,DsLogAdmin::Log_var>;
+template class ACE_Hash_Map_Manager<DsLogAdmin::LogId,DsLogAdmin::Log_var,TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Manager_Ex<DsLogAdmin::LogId, DsLogAdmin::Log_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Iterator<DsLogAdmin::LogId,DsLogAdmin::Log_var,TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Iterator_Ex<DsLogAdmin::LogId, DsLogAdmin::Log_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Iterator_Base_Ex<DsLogAdmin::LogId, DsLogAdmin::Log_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Reverse_Iterator<DsLogAdmin::LogId,DsLogAdmin::Log_var,TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<DsLogAdmin::LogId, DsLogAdmin::Log_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Hash_Map_Entry<DsLogAdmin::LogId,DsLogAdmin::BasicLog_var>
-#pragma instantiate ACE_Hash_Map_Manager<DsLogAdmin::LogId,DsLogAdmin::BasicLog_var,TAO_SYNCH_MUTEX>
-#pragma instantiate ACE_Hash_Map_Manager_Ex<DsLogAdmin::LogId, DsLogAdmin::BasicLog_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>
-#pragma instantiate ACE_Hash_Map_Iterator<DsLogAdmin::LogId,DsLogAdmin::BasicLog_var,TAO_SYNCH_MUTEX>
-#pragma instantiate ACE_Hash_Map_Iterator_Ex<DsLogAdmin::LogId, DsLogAdmin::BasicLog_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>
-#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<DsLogAdmin::LogId, DsLogAdmin::BasicLog_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator<DsLogAdmin::LogId,DsLogAdmin::BasicLog_var,TAO_SYNCH_MUTEX>
-#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<DsLogAdmin::LogId, DsLogAdmin::BasicLog_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Entry<DsLogAdmin::LogId,DsLogAdmin::Log_var>
+#pragma instantiate ACE_Hash_Map_Manager<DsLogAdmin::LogId,DsLogAdmin::Log_var,TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<DsLogAdmin::LogId, DsLogAdmin::Log_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator<DsLogAdmin::LogId,DsLogAdmin::Log_var,TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<DsLogAdmin::LogId, DsLogAdmin::Log_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<DsLogAdmin::LogId, DsLogAdmin::Log_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator<DsLogAdmin::LogId,DsLogAdmin::Log_var,TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<DsLogAdmin::LogId, DsLogAdmin::Log_var, ACE_Hash<DsLogAdmin::LogId>, ACE_Equal_To<DsLogAdmin::LogId>, TAO_SYNCH_MUTEX>
#endif /* ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA */
diff --git a/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h b/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h
index 537e794f3b3..353f3854b11 100644
--- a/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h
+++ b/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h
@@ -12,7 +12,9 @@
// Implementation of the LogManager i,e DsLogAdmin::LogMgr interface.
//
// = AUTHOR
-// Matthew Braun (mjb2@cs.wustl.edu) and Pradeep Gore <pradeep@cs.wustl.edu>
+// Matthew Braun <mjb2@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
+// D A Hanvey <d.hanvey@qub.ac.uk>
//
// ============================================================================
@@ -21,7 +23,8 @@
#include "ace/pre.h"
#include "orbsvcs/DsLogAdminS.h"
-#include "orbsvcs/Log/BasicLog_i.h"
+#include "orbsvcs/Log/Log_i.h"
+
#include "log_export.h"
class TAO_Log_Export LogMgr_i : public virtual POA_DsLogAdmin::LogMgr
@@ -66,7 +69,7 @@ public:
protected:
typedef ACE_Hash_Map_Manager <DsLogAdmin::LogId,
- DsLogAdmin::BasicLog_var,TAO_SYNCH_MUTEX> HASHMAP;
+ DsLogAdmin::Log_var,TAO_SYNCH_MUTEX> HASHMAP;
// Define the HASHMAP.
HASHMAP hash_map_;
@@ -74,6 +77,9 @@ protected:
DsLogAdmin::LogId max_id_;
// The Max id assigned so far.
+
+ DsLogAdmin::LogIdList logid_list_;
+ // A list of the current log ids.
};
#include "ace/post.h"
#endif /* TLS_LOGMGR_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/LogNotification.cpp b/TAO/orbsvcs/orbsvcs/Log/LogNotification.cpp
new file mode 100644
index 00000000000..60f018dcb6c
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/LogNotification.cpp
@@ -0,0 +1,342 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/LogNotification.h"
+#include "orbsvcs/Time_Utilities.h"
+#include "tao/debug.h"
+
+LogNotification::LogNotification (void)
+{
+ // No-Op.
+}
+
+LogNotification::~LogNotification (void)
+{
+ // No-Op.
+}
+
+void
+LogNotification::object_creation (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_UNUSED_ARG (log);
+
+ CORBA::Any any;
+ DsLogNotification::ObjectCreation event;
+
+ // The log id.
+ event.id = id;
+
+ TimeBase::TimeT current_time;
+ ACE_Time_Value now = ACE_OS::gettimeofday ();
+ ORBSVCS_Time::Time_Value_to_TimeT(current_time, now);
+
+ event.time = current_time;
+
+ any <<= event;
+
+ send_notification (any);
+}
+
+void
+LogNotification::object_deletion (DsLogAdmin::LogId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any any;
+ DsLogNotification::ObjectDeletion event;
+
+ event.id = id;
+
+ TimeBase::TimeT current_time;
+ ACE_Time_Value now = ACE_OS::gettimeofday ();
+ ORBSVCS_Time::Time_Value_to_TimeT(current_time, now);
+
+ // Time object deleted.
+ event.time = current_time;
+
+ any <<= event;
+
+ send_notification (any);
+}
+
+void
+LogNotification::processing_error_alarm (CORBA::ULong error_num,
+ const char* error_string
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any any;
+ DsLogNotification::ProcessingErrorAlarm event;
+
+ event.error_num = error_num;
+ event.error_string = CORBA::string_dup (error_string);
+
+ any <<= event;
+
+ send_notification (any);
+}
+
+void
+LogNotification::attribute_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogNotification::AttributeType type,
+ CORBA::Any oldValue,
+ CORBA::Any newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any any;
+ DsLogNotification::AttributeValueChange event;
+
+ event.logref = log;
+ event.id = id;
+
+ TimeBase::TimeT current_time;
+ ACE_Time_Value now = ACE_OS::gettimeofday ();
+ ORBSVCS_Time::Time_Value_to_TimeT(current_time, now);
+
+ event.time = current_time;
+
+ // The attribute type e.g. logFullAction, maxLogSize etc.
+ event.type = type;
+ event.old_value = oldValue;
+ event.new_value = newValue;
+
+ any <<= event;
+
+ send_notification (any);
+}
+
+void
+LogNotification::capacity_alarm_threshold_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ const DsLogAdmin::CapacityAlarmThresholdList& oldValue,
+ const DsLogAdmin::CapacityAlarmThresholdList& newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any oldV, newV;
+ oldV <<= oldValue;
+ newV <<= newValue;
+
+ attribute_value_change (log, id, DsLogNotification::capacityAlarmThreshold,
+ oldV, newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::log_full_action_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ CORBA::ULong oldValue,
+ CORBA::ULong newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any oldV, newV;
+ oldV <<= oldValue;
+ newV <<= newValue;
+
+ attribute_value_change (log, id, DsLogNotification::logFullAction,
+ oldV, newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::max_log_size_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ CORBA::ULongLong oldValue,
+ CORBA::ULongLong newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any oldV, newV;
+ oldV <<= oldValue;
+ newV <<= newValue;
+
+ attribute_value_change (log, id, DsLogNotification::maxLogSize,
+ oldV, newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::start_time_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::TimeT oldValue,
+ DsLogAdmin::TimeT newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any oldV, newV;
+ oldV <<= oldValue;
+ newV <<= newValue;
+
+ attribute_value_change (log, id, DsLogNotification::startTime,
+ oldV, newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::stop_time_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::TimeT oldValue,
+ DsLogAdmin::TimeT newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any oldV, newV;
+ oldV <<= oldValue;
+ newV <<= newValue;
+
+ attribute_value_change (log, id, DsLogNotification::stopTime,
+ oldV, newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::week_mask_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ const DsLogAdmin::WeekMask& oldValue,
+ const DsLogAdmin::WeekMask& newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any oldV, newV;
+ oldV <<= oldValue;
+ newV <<= newValue;
+
+ attribute_value_change (log, id, DsLogNotification::weekMask,
+ oldV, newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::max_record_life_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ CORBA::ULong oldValue,
+ CORBA::ULong newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any oldV, newV;
+ oldV <<= oldValue;
+ newV <<= newValue;
+
+ attribute_value_change (log, id, DsLogNotification::maxRecordLife,
+ oldV, newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::quality_of_service_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ const DsLogAdmin::QoSList& oldValue,
+ const DsLogAdmin::QoSList& newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any oldV, newV;
+ oldV <<= oldValue;
+ newV <<= newValue;
+
+ attribute_value_change (log, id, DsLogNotification::qualityOfService,
+ oldV, newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::state_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogNotification::StateType type,
+ CORBA::Any newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_UNUSED_ARG (log);
+
+ CORBA::Any any;
+ DsLogNotification::StateChange event;
+
+ // The log id.
+ event.id = id;
+
+ TimeBase::TimeT current_time;
+ ACE_Time_Value now = ACE_OS::gettimeofday ();
+ ORBSVCS_Time::Time_Value_to_TimeT(current_time, now);
+ event.time = current_time;
+
+ // Administrative, Operational or Forwarding state.
+ event.type = type;
+
+ event.new_value = newValue;
+
+ any <<= event;
+
+ send_notification (any);
+}
+
+void
+LogNotification::administrative_state_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::AdministrativeState newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any newV;
+ newV <<= newValue;
+
+ state_change (log, id, DsLogNotification::administrativeState,
+ newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::operational_state_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::OperationalState newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any newV;
+ newV <<= newValue;
+
+ state_change (log, id, DsLogNotification::operationalState,
+ newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::forwarding_state_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::ForwardingState newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any newV;
+ newV <<= newValue;
+
+ state_change (log, id, DsLogNotification::forwardingState,
+ newV ACE_ENV_ARG_PARAMETER);
+}
+
+void
+LogNotification::threshold_alarm (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::Threshold crossedValue,
+ DsLogAdmin::Threshold observedValue,
+ DsLogNotification::PerceivedSeverityType severity
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_UNUSED_ARG (log);
+
+ CORBA::Any any;
+ DsLogNotification::ThresholdAlarm event;
+
+ event.id = id;
+
+ TimeBase::TimeT current_time;
+ ACE_Time_Value now = ACE_OS::gettimeofday ();
+ ORBSVCS_Time::Time_Value_to_TimeT(current_time, now);
+ event.time = current_time;
+
+ event.crossed_value = crossedValue;
+ event.observed_value = observedValue;
+ event.perceived_severity = severity;
+
+ any <<= event;
+
+ send_notification (any);
+}
+
diff --git a/TAO/orbsvcs/orbsvcs/Log/LogNotification.h b/TAO/orbsvcs/orbsvcs/Log/LogNotification.h
new file mode 100644
index 00000000000..979ec8e49c4
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/LogNotification.h
@@ -0,0 +1,187 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// LogNotification_i.h
+//
+// = DESCRIPTION
+// Implementation of the DsLogAdmin::LogNotification interface.
+//
+// = AUTHOR
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_LOG_NOTIFICATION_H
+#define TLS_LOG_NOTIFICATION_H
+#include "ace/pre.h"
+
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/DsLogAdminC.h"
+
+//#include "orbsvcs/DsEventLogAdminS.h"
+//#include "orbsvcs/DsEventLogAdminC.h"
+#include "orbsvcs/DsLogNotificationS.h"
+#include "orbsvcs/DsLogNotificationC.h"
+
+#include "log_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+class TAO_Log_Export LogNotification
+{
+ // = TITLE
+ // Used to forward log generated events to a logging server
+ //
+ // = DESCRIPTION
+ // This implementation attempts to conform to the telecom
+ // logging specification.
+
+public:
+ // = Initialization and Termination
+ LogNotification (void);
+ // Constructor.
+
+ virtual ~LogNotification (void);
+ // Destructor.
+
+ void object_creation (DsLogAdmin::Log_ptr log, DsLogAdmin::LogId id
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Event generated when a new log is created.
+
+ void object_deletion (DsLogAdmin::LogId id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Event generated when a new log is deleted.
+
+ void processing_error_alarm (CORBA::ULong error_num, const char* error_string
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Event generated.
+
+ void attribute_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogNotification::AttributeType type,
+ CORBA::Any oldValue,
+ CORBA::Any newValue ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void capacity_alarm_threshold_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ const DsLogAdmin::CapacityAlarmThresholdList& oldValue,
+ const DsLogAdmin::CapacityAlarmThresholdList& newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void log_full_action_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ CORBA::ULong oldValue,
+ CORBA::ULong newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void max_log_size_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ CORBA::ULongLong oldValue,
+ CORBA::ULongLong newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void start_time_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::TimeT oldValue,
+ DsLogAdmin::TimeT newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void stop_time_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::TimeT oldValue,
+ DsLogAdmin::TimeT newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void week_mask_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ const DsLogAdmin::WeekMask& oldValue,
+ const DsLogAdmin::WeekMask& newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void max_record_life_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ CORBA::ULong oldValue,
+ CORBA::ULong newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void quality_of_service_value_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ const DsLogAdmin::QoSList& oldValue,
+ const DsLogAdmin::QoSList& newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // AttributeValueChange event generation method.
+
+ void state_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogNotification::StateType type,
+ CORBA::Any newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // StateChange event generation method.
+
+ void administrative_state_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::AdministrativeState newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // StateChange event generation method.
+
+ void operational_state_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::OperationalState newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // StateChange event generation method.
+
+ void forwarding_state_change (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::ForwardingState newValue
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // StateChange event generation method.
+
+ void threshold_alarm (DsLogAdmin::Log_ptr log,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::Threshold crossedValue,
+ DsLogAdmin::Threshold observedValue,
+ DsLogNotification::PerceivedSeverityType severity
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // StateChange event generation method.
+
+ // = Helper methods
+
+ virtual void send_notification (const CORBA::Any& any ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException)){ACE_UNUSED_ARG (any);};
+ // Method overriden by by event-aware logging services to cause
+ // a notification event to be sent.
+};
+#include "ace/post.h"
+#endif /* TLS_LOG_NOTIFICATION_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/LogRecordStore.cpp b/TAO/orbsvcs/orbsvcs/Log/LogRecordStore.cpp
index 1d1b824065b..f32b47be622 100644
--- a/TAO/orbsvcs/orbsvcs/Log/LogRecordStore.cpp
+++ b/TAO/orbsvcs/orbsvcs/Log/LogRecordStore.cpp
@@ -1,16 +1,16 @@
-// $Id$
-
+/* -*- C++ -*- $Id$ */
#include "orbsvcs/Time_Utilities.h"
#include "orbsvcs/Log/LogRecordStore.h"
#include "orbsvcs/Log/Log_Constraint_Interpreter.h"
#include "orbsvcs/Log/Log_Constraint_Visitors.h"
-
LogRecordStore::LogRecordStore (CORBA::ULongLong max_size,
+ DsLogAdmin::LogId logid,
CORBA::ULong max_rec_list_len)
: maxid_ (0),
max_size_ (max_size),
+ logid_ (logid),
current_size_ (0),
num_records_ (0),
max_rec_list_len_ (max_rec_list_len)
@@ -25,7 +25,7 @@ LogRecordStore::~LogRecordStore (void)
int
LogRecordStore::open (void)
-{
+{
return rec_hash_.open ();
}
@@ -67,7 +67,8 @@ int
LogRecordStore::log (DsLogAdmin::LogRecord &rec)
{
// Check if we are allowed to write...
- if (max_size_ !=0 && current_size_ >= max_size_)
+
+ if (max_size_ !=0 && (current_size_ + sizeof (rec)) >= max_size_)
return 1; // return code for log rec. full
// Initialize a couple of fields first...
@@ -78,7 +79,6 @@ LogRecordStore::log (DsLogAdmin::LogRecord &rec)
ORBSVCS_Time::Time_Value_to_TimeT(rec.time,ACE_OS::gettimeofday());
-
// First, bind the id to the LogRecord in the hash_map
if (this->rec_hash_.bind (rec.id, rec) != 0)
{
@@ -134,17 +134,40 @@ LogRecordStore::remove (DsLogAdmin::RecordId id)
this->current_size_ =
this->current_size_ - sizeof (rec);
// TODO: return ids to a reuse list.
+
return 0;
}
int
LogRecordStore::purge_old_records (void)
{
- // TBD:
- // Delete 5% of the old records.
- return -1;
+ CORBA::ULongLong num_records_to_purge = (this->num_records_) * ( (CORBA::ULongLong) 5 / (CORBA::ULongLong)100 );
+
+ if (num_records_to_purge < 1)
+ num_records_to_purge = 1;
+
+ LOG_RECORD_STORE_ITER iter (rec_hash_);
+ LOG_RECORD_HASH_MAP_ENTRY *hash_entry;
+ CORBA::ULong count = 0; // count of matches found.
+
+ if (num_records_to_purge > 0 )
+ {
+ for (CORBA::ULong i = 0; i < num_records_to_purge; ++i)
+ {
+ if (iter.next (hash_entry) == -1 || iter.advance () == -1)
+ {
+ break;
+ }
+
+ if (this->remove (hash_entry->int_id_.id) == 0)
+ count++;
+ }
+ }
+ return count;
}
+
+
LogRecordStore::LOG_RECORD_STORE&
LogRecordStore::get_storage (void)
{
@@ -165,6 +188,7 @@ template class ACE_Hash_Map_Iterator_Base_Ex<DsLogAdmin::RecordId, DsLogAdmin::L
template class ACE_Hash_Map_Reverse_Iterator<DsLogAdmin::RecordId,DsLogAdmin::LogRecord,ACE_Null_Mutex>;
template class ACE_Hash_Map_Reverse_Iterator_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>;
+template class ACE_Equal_To<DsLogAdmin::RecordId>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
@@ -180,5 +204,6 @@ ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Reverse_Iterator<DsLogAdmin::RecordId,DsLogAdmin::LogRecord,ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>
+#pragma instantiate ACE_Equal_To<DsLogAdmin::RecordId>
#endif /* ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA */
diff --git a/TAO/orbsvcs/orbsvcs/Log/LogRecordStore.h b/TAO/orbsvcs/orbsvcs/Log/LogRecordStore.h
index ff8ffd3fa89..974ecd7891e 100644
--- a/TAO/orbsvcs/orbsvcs/Log/LogRecordStore.h
+++ b/TAO/orbsvcs/orbsvcs/Log/LogRecordStore.h
@@ -4,17 +4,19 @@
// ============================================================================
//
// = LIBRARY
-// orbsvcs
+// orbsvcs
//
// = FILENAME
-// LogRecordStore.h
+// LogRecordStore.h
//
// = DESCRIPTION
-// This file declares the tools used to provide the store of
-// DsLogAdmin::LogRecords for the Telecom Logging_Service
+// This file declares the tools used to provide the store of
+// DsLogAdmin::LogRecords for the Telecom Logging_Service
//
// = AUTHORS
-// Matthew Braun (mjb2@cs.wustl.edu) and Pradeep Gore <pradeep@cs.wustl.edu>
+// Matthew Braun <mjb2@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
+// D A Hanvey <d.hanvey@qub.ac.uk>
//
// ============================================================================
@@ -49,6 +51,7 @@ class TAO_Log_Export LogRecordStore
// = Initialization and termination methods
LogRecordStore (CORBA::ULongLong max_size = 0,
+ DsLogAdmin::LogId logid = 0,
CORBA::ULong max_rec_list_len
= LOG_DEFAULT_MAX_REC_LIST_LEN);
// Constructor
@@ -114,9 +117,6 @@ class TAO_Log_Export LogRecordStore
// @@ return a const ref? we don't want anyone to modify the storage.
protected:
- LogRecordStore::LOG_RECORD_HASH_MAP rec_hash_;
- // The hash of LogRecord ids to LogRecord 's
-
DsLogAdmin::RecordId maxid_;
// Assigned to a new RecordId and then incremented
// @@ Should I have a list of reclaimed id's for when records are
@@ -125,6 +125,9 @@ class TAO_Log_Export LogRecordStore
CORBA::ULongLong max_size_;
// The maximum size of the log.
+ DsLogAdmin::LogId logid_;
+ // The log id to which this LogRecordStore relates.
+
CORBA::ULongLong current_size_;
// The current size (in bytes) of the log
@@ -133,6 +136,10 @@ class TAO_Log_Export LogRecordStore
CORBA::ULong max_rec_list_len_;
// The max size of the record list returned in a query.
+
+ LogRecordStore::LOG_RECORD_HASH_MAP rec_hash_;
+ // The hash of LogRecord ids to LogRecord 's
+
};
#include "ace/post.h"
diff --git a/TAO/orbsvcs/orbsvcs/Log/LogRecordStore_persist.cpp b/TAO/orbsvcs/orbsvcs/Log/LogRecordStore_persist.cpp
new file mode 100644
index 00000000000..48d6b330693
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/LogRecordStore_persist.cpp
@@ -0,0 +1,223 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Time_Utilities.h"
+#include "orbsvcs/Log/LogRecordStore.h"
+#include "orbsvcs/Log/Log_Constraint_Interpreter.h"
+#include "orbsvcs/Log/Log_Constraint_Visitors.h"
+
+LogRecordStore::LogRecordStore (CORBA::ULongLong max_size,
+ DsLogAdmin::LogId logid,
+ CORBA::ULong max_rec_list_len)
+ : maxid_ (0),
+ max_size_ (max_size),
+ logid_ (logid),
+ current_size_ (0),
+ num_records_ (0),
+ max_rec_list_len_ (max_rec_list_len),
+ persist_store_ (max_size)
+{
+ //No-Op.
+}
+
+LogRecordStore::~LogRecordStore (void)
+{
+ // No-Op.
+}
+
+int
+LogRecordStore::open (void)
+{
+ // Open the persistent store supplying a filename.
+ sprintf (this->file_name_, "%s.%d", PERSISTENT_LOG_FILE_NAME, logid_);
+
+ if (this->persist_store_.open (this->file_name_) ==-1)
+ ACE_THROW (CORBA::UNKNOWN ());
+
+ return rec_hash_.open ();
+}
+
+int
+LogRecordStore::close (void)
+{
+ // Close the persistent store.
+ if (this->persist_store_.close() == -1)
+ ACE_THROW (CORBA::UNKNOWN ());
+
+ // Close the hash
+ return rec_hash_.close ();
+}
+
+// TODO: make these inline ..
+CORBA::ULongLong
+LogRecordStore::get_max_size (void)
+{
+ return max_size_;
+}
+
+void
+LogRecordStore::set_max_size (CORBA::ULongLong size)
+{
+ this->max_size_ = size;
+}
+
+CORBA::ULongLong
+LogRecordStore::get_current_size (void)
+{
+ return this->current_size_;
+}
+
+CORBA::ULongLong
+LogRecordStore::get_n_records (void)
+{
+ return this->num_records_;
+}
+
+// inline ...
+
+int
+LogRecordStore::log (DsLogAdmin::LogRecord &rec)
+{
+ // Check if we are allowed to write...
+
+ if (max_size_ !=0 && (current_size_ + sizeof (rec)) >= max_size_)
+ return 1; // return code for log rec. full
+
+ // Initialize a couple of fields first...
+ // ACE emulation of U Long Long (for platforms that don't have one)
+ // does not define postfix operators
+ rec.id = ++maxid_;
+ // TODO: Reuse ids by keeping a list.
+
+ ORBSVCS_Time::Time_Value_to_TimeT(rec.time,ACE_OS::gettimeofday());
+
+ // First, bind the id to the LogRecord in the hash_map
+ if (this->rec_hash_.bind (rec.id, rec) != 0)
+ {
+ #if defined (ACE_LACKS_LONGLONG_T)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "LogRecordStore (%P|%t):Failed to bind %Q in the hash map\n",
+ ACE_U64_TO_U32(rec.id)),
+ -1);
+ #else
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "LogRecordStore (%P|%t):Failed to bind %Q in the hash map\n",
+ rec.id),
+ -1);
+ #endif
+ }
+
+ // Increment the number of records in the log
+ ++(this->num_records_);
+ this->current_size_ =
+ this->current_size_ + sizeof (rec);
+
+ if (this->persist_store_.log (rec) == -1)
+ ACE_THROW (CORBA::UNKNOWN ());
+
+ return 0;
+}
+
+int
+LogRecordStore::retrieve (DsLogAdmin::RecordId id, DsLogAdmin::LogRecord &rec)
+{
+ int retval = rec_hash_.find (id, rec);
+ return retval;
+}
+
+int
+LogRecordStore::update (DsLogAdmin::LogRecord &rec)
+{
+ if (rec_hash_.unbind (rec.id, rec) != 0)
+ {
+ return -1;
+ }
+
+ return rec_hash_.bind (rec.id, rec);
+}
+
+int
+LogRecordStore::remove (DsLogAdmin::RecordId id)
+{
+ DsLogAdmin::LogRecord rec;
+ if (rec_hash_.unbind (id, rec) != 0)
+ {
+ return -1;
+ }
+
+ --(this->num_records_);
+ this->current_size_ =
+ this->current_size_ - sizeof (rec);
+ // TODO: return ids to a reuse list.
+
+ return 0;
+}
+
+int
+LogRecordStore::purge_old_records (void)
+{
+ CORBA::ULongLong num_records_to_purge = (this->num_records_) * ( (CORBA::ULongLong) 5 / (CORBA::ULongLong)100 );
+
+ if (num_records_to_purge < 1)
+ num_records_to_purge = 1;
+
+ LOG_RECORD_STORE_ITER iter (rec_hash_);
+ LOG_RECORD_HASH_MAP_ENTRY *hash_entry;
+ CORBA::ULong count = 0; // count of matches found.
+
+ if (num_records_to_purge > 0 )
+ {
+ for (CORBA::ULong i = 0; i < num_records_to_purge; ++i)
+ {
+ if (iter.next (hash_entry) == -1 || iter.advance () == -1)
+ {
+ break;
+ }
+
+ if (this->remove (hash_entry->int_id_.id) == 0)
+ count++;
+ }
+ }
+ return count;
+}
+
+
+
+LogRecordStore::LOG_RECORD_STORE&
+LogRecordStore::get_storage (void)
+{
+ return rec_hash_;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class ACE_Hash_Map_Entry<DsLogAdmin::RecordId,DsLogAdmin::LogRecord>;
+template class ACE_Hash_Map_Manager<DsLogAdmin::RecordId,DsLogAdmin::LogRecord,ACE_Null_Mutex>;
+template class ACE_Hash_Map_Manager_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord,
+ ACE_Hash<DsLogAdmin::RecordId>, ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator<DsLogAdmin::RecordId,DsLogAdmin::LogRecord,ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
+ ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Iterator_Base_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
+ ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>;
+template class ACE_Hash_Map_Reverse_Iterator<DsLogAdmin::RecordId,DsLogAdmin::LogRecord,ACE_Null_Mutex>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
+ ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>;
+template class ACE_Equal_To<DsLogAdmin::RecordId>;
+
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate ACE_Hash_Map_Entry<DsLogAdmin::RecordId,DsLogAdmin::LogRecord>
+#pragma instantiate ACE_Hash_Map_Manager<DsLogAdmin::RecordId,DsLogAdmin::LogRecord,ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
+ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator<DsLogAdmin::RecordId,DsLogAdmin::LogRecord,ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
+ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
+ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator<DsLogAdmin::RecordId,DsLogAdmin::LogRecord,ACE_Null_Mutex>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<DsLogAdmin::RecordId, DsLogAdmin::LogRecord, ACE_Hash<DsLogAdmin::RecordId>,
+ACE_Equal_To<DsLogAdmin::RecordId>, ACE_Null_Mutex>
+#pragma instantiate ACE_Equal_To<DsLogAdmin::RecordId>
+
+#endif /* ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA */
diff --git a/TAO/orbsvcs/orbsvcs/Log/LogRecordStore_persist.h b/TAO/orbsvcs/orbsvcs/Log/LogRecordStore_persist.h
new file mode 100644
index 00000000000..08f7d281601
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/LogRecordStore_persist.h
@@ -0,0 +1,155 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// LogRecordStore.h
+//
+// = DESCRIPTION
+// This file declares the tools used to provide the store of
+// DsLogAdmin::LogRecords for the Telecom Logging_Service
+//
+// = AUTHORS
+// Matthew Braun <mjb2@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef LOG_RECORD_STORE_H
+#define LOG_RECORD_STORE_H
+#include "ace/pre.h"
+
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/DsLogAdminC.h"
+#include "ace/Containers.h"
+#include "ace/Hash_Map_Manager.h"
+#include "log_export.h"
+#include "PersistStore.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define PERSISTENT_LOG_FILE_NAME "LOG.DATA"
+
+#define LOG_DEFAULT_MAX_REC_LIST_LEN 30
+
+class TAO_Log_Export LogRecordStore
+{
+ // = TITLE
+ // A container class for storing DsLogAdmin::LogRecord *'s
+ //
+ // = Description
+ // This implementation uses an ACE_RB_Tree and and ACE_Hash_Map
+ // internally to store the pointers. Permits fast searches by id
+ // and iteration, while allowing for ring-buffer like wrapping of
+ // entries. Other features include searching by time ranges.
+ // @@ pradeep: The ACE_RB_Tree will come later.
+ public:
+ // = Initialization and termination methods
+
+ LogRecordStore (CORBA::ULongLong max_size = 0,
+ DsLogAdmin::LogId logid = 0,
+ CORBA::ULong max_rec_list_len
+ = LOG_DEFAULT_MAX_REC_LIST_LEN);
+ // Constructor
+
+ ~LogRecordStore (void);
+ // Destructor
+
+ int open (void);
+ // Initialization.
+
+ int close (void);
+ // Close the record store.
+
+ // = LogRecordStore status methods
+
+ CORBA::ULongLong get_max_size (void);
+ // Get the current set value of the max size of the log data.
+
+ void set_max_size (CORBA::ULongLong size);
+ // Set the max size of log data. size == 0, => infinite.
+
+ CORBA::ULongLong get_current_size (void);
+ // Gets the current size of the log data.
+
+ CORBA::ULongLong get_n_records (void);
+ // Get the number of records in the log right now.
+
+ // = Record logging, retrieval, update and removal methods
+
+ int log (DsLogAdmin::LogRecord &rec);
+ // Insert rec into storage. Returns 0 on success -1 on failure and 1
+ // if the log is full
+
+ int retrieve (DsLogAdmin::RecordId id, DsLogAdmin::LogRecord &rec);
+ // Set rec to the pointer to the LogRecord with the given
+ // id. Returns 0 on success, -1 on failure
+
+ int update (DsLogAdmin::LogRecord &rec);
+ // update into storage. Returns 0 on success -1 on failure
+
+ int remove (DsLogAdmin::RecordId id);
+ // Remove the record with id <id> from the LogRecordStore. Returns 0 on
+ // success, -1 on failure.
+
+ int purge_old_records (void);
+ // Deletes "old" records from the store.
+
+ typedef ACE_Hash_Map_Manager <DsLogAdmin::RecordId,
+ DsLogAdmin::LogRecord, ACE_Null_Mutex> LOG_RECORD_HASH_MAP;
+ typedef ACE_Hash_Map_Iterator <DsLogAdmin::RecordId,
+ DsLogAdmin::LogRecord, ACE_Null_Mutex> LOG_RECORD_HASH_MAP_ITER;
+ typedef ACE_Hash_Map_Entry <DsLogAdmin::RecordId,
+ DsLogAdmin::LogRecord> LOG_RECORD_HASH_MAP_ENTRY;
+ // Defines macros to represent the hash that maps ids to
+ // DsLogAdmin::LogRecords.
+
+ typedef LOG_RECORD_HASH_MAP_ITER LOG_RECORD_STORE_ITER;
+ typedef LOG_RECORD_HASH_MAP LOG_RECORD_STORE;
+ // Don't want to be tied to hash maps!.
+
+ LogRecordStore::LOG_RECORD_STORE& get_storage (void);
+ // Get the underlying storage.
+ // @@ return a const ref? we don't want anyone to modify the storage.
+ protected:
+
+ DsLogAdmin::RecordId maxid_;
+ // Assigned to a new RecordId and then incremented
+ // @@ Should I have a list of reclaimed id's for when records are
+ // deleted?
+
+ CORBA::ULongLong max_size_;
+ // The maximum size of the log.
+
+ DsLogAdmin::LogId logid_;
+ // The log id to which this LogRecordStore relates.
+
+ CORBA::ULongLong current_size_;
+ // The current size (in bytes) of the log
+
+ CORBA::ULongLong num_records_;
+ // The current number of records in the log
+
+ CORBA::ULong max_rec_list_len_;
+ // The max size of the record list returned in a query.
+
+ PersistStore persist_store_;
+ // The persistence storage
+
+ LogRecordStore::LOG_RECORD_HASH_MAP rec_hash_;
+ // The hash of LogRecord ids to LogRecord 's
+
+ char file_name_[256];
+ // Persistent log file name.
+
+};
+
+#include "ace/post.h"
+#endif /*LOG_RECORD_STORE_H*/
diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.cpp b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.cpp
index fab4cc4fd1c..05d53a7aae7 100644
--- a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.cpp
+++ b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.cpp
@@ -1,30 +1,30 @@
-// $Id$
+/* -*- C++ -*- $Id$ */
#include "Log_Constraint_Interpreter.h"
#include "Log_Constraint_Visitors.h"
-TAO_Log_Constraint_Interpreter::
-TAO_Log_Constraint_Interpreter(const char* constraints
- ACE_ENV_ARG_DECL)
+ACE_RCSID(Log, Log_Constraint_Interpreter, "$Id$")
+
+TAO_Log_Constraint_Interpreter::TAO_Log_Constraint_Interpreter (
+ const char *constraints
+ ACE_ENV_ARG_DECL
+ )
ACE_THROW_SPEC ((DsLogAdmin::InvalidConstraint,
CORBA::NO_MEMORY))
{
- if (TAO_Interpreter::is_empty_string (constraints))
+ if (TAO_ETCL_Interpreter::is_empty_string (constraints))
{
+ // Root is deleted in the TAO_Interpreter's destructor.
ACE_NEW_THROW_EX (this->root_,
- TAO_Literal_Constraint ((CORBA::Boolean) 1),
+ TAO_ETCL_Literal_Constraint ((CORBA::Boolean) 1),
CORBA::NO_MEMORY ());
ACE_CHECK;
}
else
- {
- if (this->build_tree (constraints) != 0)
- ACE_THROW (DsLogAdmin::InvalidConstraint ());
-
- // @@ pradeep: Don't know exactly how the validator works in the
- // Trader so the validater visitor is not used here.
- /* if (validator.validate (this->root_) == -1)
- ACE_THROW (CosTrading::IllegalConstraint (constraints));*/
+ {
+ // root_ is set in this base class call.
+ if (TAO_ETCL_Interpreter::build_tree (constraints) != 0)
+ ACE_THROW (DsLogAdmin::InvalidConstraint ());
}
}
@@ -33,7 +33,12 @@ TAO_Log_Constraint_Interpreter::~TAO_Log_Constraint_Interpreter (void)
}
CORBA::Boolean
-TAO_Log_Constraint_Interpreter::evaluate (TAO_Constraint_Evaluator& evaluator)
+TAO_Log_Constraint_Interpreter::evaluate (
+ TAO_Log_Constraint_Visitor &evaluator
+ )
{
- return evaluator.evaluate_constraint (this->root_);
+ CORBA::Boolean retval =
+ evaluator.evaluate_constraint (this->root_);
+
+ return retval;
}
diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.h b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.h
index 40d89d023cd..c4736403f52 100644
--- a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.h
+++ b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Interpreter.h
@@ -1,43 +1,52 @@
/* -*- C++ -*- */
// $Id$
-// ========================================================================
+// ==========================================================================
//
// = LIBRARY
-// orbsvcs
+// orbsvcs
//
// = FILENAME
-// Log_Constraint_Interpreter.h
+// Log_Constraint_Interpreter.h
+//
+// = DESCRIPTION
+//
//
// = AUTHOR
-// Pradeep Gore <pradeep@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
+// D A Hanvey <d.hanvey@qub.ac.uk>
//
-// ========================================================================
+// ==========================================================================
#ifndef TAO_LOG_CONSTRAINT_INTERPRETER_H
#define TAO_LOG_CONSTRAINT_INTERPRETER_H
+
#include "ace/pre.h"
+#include "orbsvcs/ETCL/ETCL_Interpreter.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "orbsvcs/orbsvcs/Trader/Constraint_Nodes.h"
-#include "orbsvcs/orbsvcs/Trader/Constraint_Visitors.h"
-#include "orbsvcs/orbsvcs/Trader/Interpreter.h"
-#include "orbsvcs/orbsvcs/DsLogAdminC.h"
+#include "orbsvcs/ETCL/ETCL_Constraint.h"
+#include "orbsvcs/DsLogAdminC.h"
#include "log_export.h"
-class TAO_Constraint_Evaluator;
+class TAO_Log_Constraint_Visitor;
-class TAO_Log_Export TAO_Log_Constraint_Interpreter : public TAO_Interpreter
+class TAO_Log_Export TAO_Log_Constraint_Interpreter
+ : public TAO_ETCL_Interpreter
{
//
// = TITLE
// TAO_Log_Constraint_Interpreter
//
// = DESCRIPTION
- // "TCL" Interpreter for the Log queries.
+ // "ETCL" Interpreter for the Log queries.
public:
// = Initialization and termination methods.
TAO_Log_Constraint_Interpreter (const char* constraints
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((DsLogAdmin::InvalidConstraint,
CORBA::NO_MEMORY));
// This constructor builds an expression tree representing the
@@ -48,7 +57,7 @@ public:
~TAO_Log_Constraint_Interpreter (void);
// Destructor
- CORBA::Boolean evaluate (TAO_Constraint_Evaluator& evaluator);
+ CORBA::Boolean evaluate (TAO_Log_Constraint_Visitor &evaluator);
// Returns true if the constraint is evaluated successfully by
// the evaluator.
};
diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp
index eb42cad258d..316d50bd3b8 100644
--- a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp
+++ b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp
@@ -1,72 +1,1384 @@
+/* -*- C++ -*- */
// $Id$
#include "Log_Constraint_Visitors.h"
+#include "orbsvcs/ETCL/ETCL_Constraint.h"
+#include "orbsvcs/ETCL/ETCL_y.h"
+#include "tao/DynamicAny/DynArray_i.h"
+#include "tao/DynamicAny/DynSequence_i.h"
+#include "tao/DynamicAny/DynStruct_i.h"
+#include "tao/DynamicAny/DynUnion_i.h"
+#include "tao/DynamicAny/DynEnum_i.h"
+#include "tao/DynamicAny/DynAnyFactory.h"
+TAO_Log_Constraint_Visitor::TAO_Log_Constraint_Visitor (DsLogAdmin::LogRecord &rec)
+:rec_ (rec)
+{
+ ACE_CString name1 = (ACE_CString)"id";
+ ACE_CString name2 = (ACE_CString)"time";
+ ACE_CString name3 = (ACE_CString)"info";
+
+ CORBA::Any *value = 0;
+ ACE_NEW_THROW_EX (value, CORBA::Any, CORBA::NO_MEMORY ());
+
+#if defined (ACE_LACKS_LONGLONG_T)
+ *value <<= ACE_U64_TO_U32 (this->rec_.id)
+#else
+ *value <<= ACE_static_cast (ACE_UINT32, (this->rec_.id));
+#endif
+ if (value != 0)
+ {
+ this->property_lookup_.bind (
+ name1, value
+ );
+ }
+
+ CORBA::Any *value2 = 0;
+ ACE_NEW_THROW_EX (value2, CORBA::Any, CORBA::NO_MEMORY ());
+
+#if defined (ACE_LACKS_LONGLONG_T)
+ *value2 <<= ACE_U64_TO_U32 (this->rec_.time)
+#else
+ *value2 <<= ACE_static_cast (ACE_UINT32, (this->rec_.time));
+#endif
+ if (value2 != 0)
+ {
+ this->property_lookup_.bind (
+ name2, value2
+ );
+ }
+
+ CORBA::Any *value3 = 0;
+ ACE_NEW_THROW_EX (value3, CORBA::Any, CORBA::NO_MEMORY ());
+
+ *value3 <<= this->rec_.info;
-TAO_Log_Constraint_Evaluator::
-TAO_Log_Constraint_Evaluator (DsLogAdmin::LogRecord &rec)
- :rec_ (rec)
+ if (value3 != 0)
+ {
+ this->property_lookup_.bind (
+ name3, value3
+ );
+ }
+}
+
+CORBA::Boolean
+TAO_Log_Constraint_Visitor::evaluate_constraint (
+ TAO_ETCL_Constraint* root
+ )
{
- // why do this?
- this->props_.close ();
- this->props_.open ();
+ CORBA::Boolean result = 0;
+ this->queue_.reset ();
- TAO_String_Hash_Key name = (const char*) "id";
- this->props_.bind (name, 0);
+ // Evaluate the constraint in root_;
+ if (root != 0)
+ {
+ if ((root->accept (this) == 0) &&
+ (! this->queue_.is_empty ()))
+ {
+ TAO_ETCL_Literal_Constraint top;
+ this->queue_.dequeue_head (top);
+ result = (CORBA::Boolean) top;
+ }
+ }
- name = (const char*) "time";
- this->props_.bind (name, 1);
+ // If a property couldn't be evaluated we must return 0.
+ return result;
+}
+int
+TAO_Log_Constraint_Visitor::visit_literal (
+ TAO_ETCL_Literal_Constraint *literal
+ )
+{
+ this->queue_.enqueue_head (*literal);
+ return 0;
}
int
-TAO_Log_Constraint_Evaluator::
-visit_property (TAO_Property_Constraint* literal)
+TAO_Log_Constraint_Visitor::visit_identifier (TAO_ETCL_Identifier *ident)
{
- int return_value = -1, prop_index = 0;
- // Handle case where property is not, in fact, mapped to a value
- TAO_String_Hash_Key prop_name ((const char*) literal->name ());
+ int return_value = -1;
+ const char *name = ident->value ();
+ ACE_CString key (name, 0, 0);
- if (this->props_.find (prop_name, prop_index) == 0)
+ CORBA::Any *any = 0;
+
+ if (this->property_lookup_.find (key, any) == 0)
{
- ACE_DECLARE_NEW_CORBA_ENV;
+ if (any != 0)
+ {
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (any));
+ return_value = 0;
+ }
+ }
+
+ return return_value;
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_union_value (
+ TAO_ETCL_Union_Value *union_value
+ )
+{
+ switch (union_value->sign ())
+ {
+ case 0:
+ this->queue_.enqueue_head (*union_value->string ());
+ break;
+ case -1:
+ this->queue_.enqueue_head (-(*union_value->integer ()));
+ break;
+ case 1:
+ this->queue_.enqueue_head (*union_value->integer ());
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
- CORBA::Any *value = 0;
- // Retrieve the value of the property from the Property_Evaluator
- ACE_TRY
+int
+TAO_Log_Constraint_Visitor::visit_union_pos (
+ TAO_ETCL_Union_Pos *union_pos
+ )
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ if (union_pos->union_value ()->accept (this) == 0)
{
- // value = this->prop_eval_.property_value (prop_index ACE_ENV_ARG_PARAMETER);
- ACE_NEW_THROW_EX (value,
- CORBA::Any,
- CORBA::NO_MEMORY ());
+ TAO_ETCL_Literal_Constraint disc_val;
+ this->queue_.dequeue_head (disc_val);
+
+ TAO_DynUnion_i dyn_union;
+ dyn_union.init (this->current_member_.in ()
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
- #if defined (ACE_LACKS_LONGLONG_T)
- if (prop_index == 0)
- *value <<= ACE_U64_TO_U32 (this->rec_.id);
- else
- *value <<= ACE_U64_TO_U32 (this->rec_.time);
- #else
+ CORBA::TypeCode_var tc = this->current_member_->type ();
+
+ switch (disc_val.expr_type ())
+ {
+ case TAO_ETCL_INTEGER:
+ case TAO_ETCL_SIGNED:
+ case TAO_ETCL_UNSIGNED:
+ {
+ CORBA::Any disc_any;
+ CORBA::TypeCode_var disc_tc =
+ tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ CORBA::TCKind disc_kind =
+ TAO_DynAnyFactory::unalias (disc_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ switch (disc_kind)
+ {
+ case CORBA::tk_boolean:
+ disc_any <<= CORBA::Any::from_boolean ((CORBA::Boolean) disc_val);
+ break;
+ case CORBA::tk_short:
+ disc_any <<= (CORBA::Short) ((CORBA::Long) disc_val);
+ break;
+ case CORBA::tk_ushort:
+ disc_any <<= (CORBA::UShort) ((CORBA::ULong) disc_val);
+ break;
+ case CORBA::tk_long:
+ disc_any <<= (CORBA::Long) disc_val;
+ break;
+ case CORBA::tk_ulong:
+ disc_any <<= (CORBA::ULong) disc_val;
+ break;
+ case CORBA::tk_enum:
+ {
+ TAO_OutputCDR cdr;
+ cdr.write_ulong ((CORBA::ULong) disc_val);
+ disc_any._tao_replace (disc_tc.in (),
+ TAO_ENCAP_BYTE_ORDER,
+ cdr.begin ());
+ break;
+ }
+ // @@@ (JP) I don't think ETCL handles 64-bit
+ // integers at this point, and I also think that
+ // chars and/or wchars will just come out in the
+ // constraint as (w)strings of length 1.
+ case CORBA::tk_longlong:
+ case CORBA::tk_ulonglong:
+ case CORBA::tk_char:
+ case CORBA::tk_wchar:
+ default:
+ return -1;
+ }
+
+ DynamicAny::DynAny_var dyn_any =
+ TAO_DynAnyFactory::make_dyn_any (disc_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ dyn_union.set_discriminator (dyn_any.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ DynamicAny::DynAny_var u_member =
+ dyn_union.member (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ this->current_member_ =
+ u_member->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ break;
+ }
+ case TAO_ETCL_STRING:
+ {
+ const char *name = (const char *) disc_val;
+ CORBA::ULong count =
+ tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
- if (prop_index == 0)
- *value <<= ACE_static_cast (ACE_UINT32, (this->rec_.id));
- else
- *value <<= ACE_static_cast (ACE_UINT32, (this->rec_.time));
- #endif
+ const char *member_name = 0;
+ CORBA::ULong i = 0;
+
+ for (i = 0; i < count; ++i)
+ {
+ member_name = tc->member_name (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (ACE_OS::strcmp (name, member_name) == 0)
+ {
+ break;
+ }
+ }
+
+ // If there's no match, member_label will throw
+ // CORBA::TypeCode::Bounds and the catch block will
+ // return -1;
+ this->current_member_ = tc->member_label (i
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ break;
+ }
+ // The TAO_ETCL_Union_Value that was put on the queue
+ // shouldn't have any other type.
+ default:
+ return -1;
+ }
+
+ TAO_ETCL_Constraint *nested = union_pos->component ();
+
+ // If there's no nested component, then we just want the
+ // union member value on the queue. Otherwise, we want
+ // the member value in current_member_ while we visit
+ // the nested component.
+ if (nested == 0)
+ {
+ TAO_ETCL_Literal_Constraint lit (this->current_member_);
+ this->queue_.enqueue_head (lit);
+ return 0;
+ }
+ else
+ {
+ return nested->accept (this);
+ }
}
- ACE_CATCHANY
+ else
{
return -1;
}
- ACE_ENDTRY;
- // ACE_CHECK_RETURN (-1);
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ ACE_NOTREACHED (return 0);
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_component_pos (
+ TAO_ETCL_Component_Pos *pos
+ )
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ // If we are here (from visit_component) the Any containing the
+ // component as found in property_lookup_ will be in current_member_.
+ CORBA::TypeCode_var tc = this->current_member_->type ();
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ DynamicAny::DynAny_var member;
+ CORBA::Boolean success = 0;
+ CORBA::ULong slot = (CORBA::ULong) *pos->integer ();
+
+ switch (kind)
+ {
+ case CORBA::tk_enum:
+ {
+ TAO_DynEnum_i dyn_enum;
+ dyn_enum.init (this->current_member_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ success = dyn_enum.seek (slot
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (success == 0)
+ {
+ return -1;
+ }
+
+ member =
+ dyn_enum.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ break;
+ }
+ case CORBA::tk_struct:
+ {
+ TAO_DynStruct_i dyn_struct;
+ dyn_struct.init (this->current_member_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ success = dyn_struct.seek (slot
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (success == 0)
+ {
+ return -1;
+ }
+
+ member = dyn_struct.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ break;
+ }
+ // @@@ (JP) I think enums and structs are the only two cases handled
+ // by Component_Pos, since arrays and sequences are handled by
+ // Component_Array, and unions are handled by Union_Pos.
+ default:
+ return -1;
+ }
+
+ CORBA::Any_var value = member->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_ETCL_Constraint *comp = pos->component ();
+
+ if (comp == 0)
+ {
+ TAO_ETCL_Literal_Constraint result (value);
+ this->queue_.enqueue_head (result);
+ return 0;
+ }
+ else
+ {
+ this->current_member_ = value._retn ();
+ return comp->accept (this);
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ ACE_NOTREACHED (return 0);
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_component_assoc (
+ TAO_ETCL_Component_Assoc *assoc
+ )
+{
+ // @@@ (JP) The spec reserves this type of constraint for NVLists.
+ // Since NVLists don't have type codes or Any operators, there's
+ // no way that TAO can put one into the event's filterable data.
+ // However, from the looks of the ETCL grammar, I believe that a
+ // contruct like 'exist $(foo)' is legal, and is in effect using
+ // the event's filterable data as one big NVList. It is
+ // equivalent to '$.foo'. I've implemented this method on that
+ // basis, while keeping in mind that a clearer interpretation of
+ // the spec may come along someday.
+
+ const char *name = assoc->identifier ()->value ();
+ ACE_CString key (name, 0, 0);
+ CORBA::Any *any = 0;
+
+ if (this->property_lookup_.find (key, any) != 0
+ || any == 0)
+ {
+ return -1;
+ }
+
+ TAO_ETCL_Constraint *comp = assoc->component ();
+
+ if (comp == 0)
+ {
+ TAO_ETCL_Literal_Constraint result (any);
+ this->queue_.enqueue_head (result);
+ return 0;
+ }
+ else
+ {
+ CORBA::Any *any_ptr = 0;
+ ACE_NEW_RETURN (any_ptr,
+ CORBA::Any (*any),
+ -1);
+ this->current_member_ = any_ptr;
+ return comp->accept (this);
+ }
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_component_array (
+ TAO_ETCL_Component_Array *array
+ )
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ // If we are here (from visit_component) the Any containing the
+ // component as found in property_lookup_ will be in current_member_.
+ CORBA::TypeCode_var tc = this->current_member_->type ();
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ DynamicAny::DynAny_var member;
+ CORBA::Boolean success = 0;
+ CORBA::ULong slot = (CORBA::ULong) *array->integer ();
+
+ switch (kind)
+ {
+ case CORBA::tk_array:
+ {
+ TAO_DynEnum_i dyn_array;
+ dyn_array.init (this->current_member_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ success = dyn_array.seek (slot
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (success == 0)
+ {
+ return -1;
+ }
+
+ member = dyn_array.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ break;
+ }
+ case CORBA::tk_sequence:
+ {
+ TAO_DynStruct_i dyn_sequence;
+ dyn_sequence.init (this->current_member_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ success = dyn_sequence.seek (slot
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (success == 0)
+ {
+ return -1;
+ }
+
+ member =
+ dyn_sequence.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ break;
+ }
+ // Enums and sequences are the only two cases handled
+ // by Component_Array.
+ default:
+ return -1;
+ }
+
+ CORBA::Any_var value = member->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_ETCL_Constraint *comp = array->component ();
+
+ if (comp == 0)
+ {
+ TAO_ETCL_Literal_Constraint result (value);
+ this->queue_.enqueue_head (result);
+ return 0;
+ }
+ else
+ {
+ this->current_member_ = value._retn ();
+ return comp->accept (this);
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ ACE_NOTREACHED (return 0);
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_special (TAO_ETCL_Special *special)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::TypeCode_var tc = this->current_member_->type ();
- if (value != 0)
+ switch (special->type ())
+ {
+ case TAO_ETCL_LENGTH:
+ {
+ // If the TCKind is not a sequence or an array, the
+ // call to length() will raise an exception, and the
+ // catch block will return -1;
+ CORBA::ULong length = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_ETCL_Literal_Constraint lit (length);
+ this->queue_.enqueue_head (lit);
+ return 0;
+ }
+ case TAO_ETCL_DISCRIMINANT:
+ {
+ // If the TCKind is not a union, the
+ // call to init() will raise an exception, and the
+ // catch block will return -1;
+ TAO_DynUnion_i dyn_union;
+ dyn_union.init (this->current_member_.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ DynamicAny::DynAny_var disc =
+ dyn_union.get_discriminator (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::Any_var disc_any = disc->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_ETCL_Literal_Constraint lit (disc_any);
+ this->queue_.enqueue_head (lit);
+ return 0;
+ }
+ case TAO_ETCL_TYPE_ID:
+ {
+ const char *name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_ETCL_Literal_Constraint lit (name);
+ this->queue_.enqueue_head (lit);
+ return 0;
+ }
+ case TAO_ETCL_REPOS_ID:
+ {
+ const char *id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_ETCL_Literal_Constraint lit (id);
+ this->queue_.enqueue_head (lit);
+ return 0;
+ }
+ default:
+ return -1;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ ACE_NOTREACHED (return 0);
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_component (
+ TAO_ETCL_Component *component
+ )
+{
+ // If this component has no sub-component, only an identifier,
+ // then we just visit the identifier, which puts a literal on
+ // the queue to be handled upon returning from this method call.
+ // If there is a sub-component, we store the literal's value
+ // in our member _var for possible examination at a more
+ // nested level, and visit the sub-component.
+
+ TAO_ETCL_Constraint *nested = component->component ();
+ int result = component->identifier ()->accept (this);
+
+ if (nested == 0 || result != 0)
+ {
+ return result;
+ }
+ else
+ {
+ TAO_ETCL_Literal_Constraint id;
+ this->queue_.dequeue_head (id);
+ CORBA::Any *any_ptr = 0;
+ ACE_NEW_RETURN (any_ptr,
+ CORBA::Any (*(const CORBA::Any *) id),
+ -1);
+ this->current_member_ = any_ptr;
+ return nested->accept (this);
+ }
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_dot (TAO_ETCL_Dot *dot)
+{
+ // If we are here, we know we're headed for a more nested
+ // level, so we just visit it, there's nothing else in this
+ // constraint.
+ return dot->component ()->accept (this);
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_eval (TAO_ETCL_Eval *eval)
+{
+ // Nothing to do but visit the contained component.
+ return eval->component ()->accept (this);
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_default (TAO_ETCL_Default *def)
+{
+ TAO_ETCL_Constraint *comp = def->component ();
+
+ if (comp == 0)
+ {
+ return -1;
+ }
+
+ if (comp->accept (this) != 0)
+ {
+ return -1;
+ }
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::TypeCode_var tc = this->current_member_->type ();
+
+ // If the current member is not a union, this call will
+ // throw BadKind and the catch block will return -1.
+ CORBA::Long default_index = tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // No default index.
+ if (default_index == -1)
+ {
+ TAO_ETCL_Literal_Constraint result ((CORBA::Boolean) 0);
+ this->queue_.enqueue_head (result);
+ return 0;
+ }
+
+ // Okay, there's a default index, but is it active?
+
+ TAO_ETCL_Literal_Constraint disc;
+ this->queue_.dequeue_head (disc);
+ TAO_ETCL_Literal_Constraint default_index_value (default_index);
+ return (disc == default_index_value);
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ ACE_NOTREACHED (return 0);
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_exist (TAO_ETCL_Exist *exist)
+{
+ TAO_ETCL_Constraint *component = exist->component ();
+
+ if (component->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint top;
+
+ this->queue_.dequeue_head (top);
+
+ const char *value = (const char *) top;
+ ACE_CString key (value, 0, 0);
+
+ CORBA::Boolean result = (this->property_lookup_.find (key) == 0);
+
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+
+ return 0;
+ }
+
+ return -1;
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_unary_expr (
+ TAO_ETCL_Unary_Expr *unary_expr
+ )
+{
+ TAO_ETCL_Constraint *subexpr = unary_expr->subexpr ();
+
+ if (subexpr->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint subexpr_result;
+ CORBA::Boolean result = 0;
+ int op_type = unary_expr->type ();
+
+ switch (op_type)
+ {
+ case TAO_ETCL_NOT:
+ this->queue_.dequeue_head (subexpr_result);
+ result = ! (CORBA::Boolean) subexpr_result;
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ return 0;
+ case TAO_ETCL_MINUS:
+ // The leading '-' was parsed separately, so we have to pull
+ // the literal constraint off the queue, apply the class' own
+ // unary minus operator, and put it back.
+ this->queue_.dequeue_head (subexpr_result);
+ this->queue_.enqueue_head (-subexpr_result);
+ return 0;
+ case TAO_ETCL_PLUS:
+ // Leave the literal constraint on the queue. The leading
+ // '+' was just syntactic sugar - no action is necessary.
+ return 0;
+ default:
+ // The parser should never construct a TAO_ETCL_Unary_Constraint
+ // behind any operators except the above three.
+ return -1;
+ }
+ }
+
+ return -1;
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_binary_expr (
+ TAO_ETCL_Binary_Expr *binary_expr
+ )
+{
+
+ // Evaluate the constraint
+ int bin_op_type = binary_expr->type ();
+
+ switch (bin_op_type)
+ {
+ case TAO_ETCL_OR:
+ return this->visit_or (binary_expr);
+ case TAO_ETCL_AND:
+ return this->visit_and (binary_expr);
+ case TAO_ETCL_LT:
+ case TAO_ETCL_LE:
+ case TAO_ETCL_GT:
+ case TAO_ETCL_GE:
+ case TAO_ETCL_EQ:
+ case TAO_ETCL_NE:
+ case TAO_ETCL_PLUS:
+ case TAO_ETCL_MINUS:
+ case TAO_ETCL_MULT:
+ case TAO_ETCL_DIV:
+ return this->visit_binary_op (binary_expr,
+ bin_op_type);
+ case TAO_ETCL_TWIDDLE:
+ return this->visit_twiddle (binary_expr);
+ case TAO_ETCL_IN:
+ return this->visit_in (binary_expr);
+ default:
+ return -1;
+ }
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_or (
+ TAO_ETCL_Binary_Expr *binary
+ )
+{
+ int return_value = -1;
+ CORBA::Boolean result = 0;
+ TAO_ETCL_Constraint *lhs = binary->lhs ();
+
+ if (lhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint lhs_result;
+ this->queue_.dequeue_head (lhs_result);
+ result = (CORBA::Boolean) lhs_result;
+
+ // Short-circuiting OR.
+ if (result == 0)
+ {
+ TAO_ETCL_Constraint *rhs = binary->rhs ();
+
+ if (rhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint rhs_result;
+ this->queue_.dequeue_head (rhs_result);
+ result = (CORBA::Boolean) rhs_result;
+ return_value = 0;
+ }
+ }
+ else
+ {
+ return_value = 0;
+ }
+ }
+
+ if (return_value == 0)
+ {
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ }
+
+ return return_value;
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_and (
+ TAO_ETCL_Binary_Expr *binary
+ )
+{
+ int return_value = -1;
+ CORBA::Boolean result = 0;
+ TAO_ETCL_Constraint *lhs = binary->lhs ();
+
+ if (lhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint lhs_result;
+ this->queue_.dequeue_head (lhs_result);
+ result = (CORBA::Boolean) lhs_result;
+
+ // Short-circuiting AND.
+ if (result == 1)
+ {
+ TAO_ETCL_Constraint *rhs = binary->rhs ();
+
+ if (rhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint rhs_result;
+ this->queue_.dequeue_head (rhs_result);
+ result = (CORBA::Boolean) rhs_result;
+ return_value = 0;
+ }
+ }
+ else
{
- this->queue_.enqueue_head (TAO_Literal_Constraint (value));
return_value = 0;
}
}
+ if (return_value == 0)
+ {
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ }
+
return return_value;
}
+
+int
+TAO_Log_Constraint_Visitor::visit_binary_op (
+ TAO_ETCL_Binary_Expr *binary,
+ int op_type
+ )
+{
+ int return_value = -1;
+ TAO_ETCL_Constraint *lhs = binary->lhs ();
+ CORBA::Boolean result = 0;
+
+ // Evaluate the constraint
+ // Perform an operation on the results of evaluating the left and
+ // right branches of this subtree.
+ if (lhs->accept (this) == 0)
+ {
+
+ // Evaluate the constraint
+ TAO_ETCL_Literal_Constraint left_operand;
+ this->queue_.dequeue_head (left_operand);
+ TAO_ETCL_Constraint *rhs = binary->rhs ();
+
+ if (rhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint right_operand;
+ this->queue_.dequeue_head (right_operand);
+ return_value = 0;
+
+ switch (op_type)
+ {
+ case TAO_ETCL_LT:
+ result = left_operand < right_operand;
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ break;
+ case TAO_ETCL_LE:
+ result = left_operand <= right_operand;
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ break;
+ case TAO_ETCL_GT:
+ result = left_operand > right_operand;
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ break;
+ case TAO_ETCL_GE:
+ result = left_operand >= right_operand;
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ break;
+ case TAO_ETCL_EQ:
+ result = left_operand == right_operand;
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ break;
+ case TAO_ETCL_NE:
+ result = left_operand != right_operand;
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ break;
+ case TAO_ETCL_PLUS:
+ this->queue_.enqueue_head (left_operand + right_operand);
+ break;
+ case TAO_ETCL_MINUS:
+ this->queue_.enqueue_head (left_operand - right_operand);
+ break;
+ case TAO_ETCL_MULT:
+ this->queue_.enqueue_head (left_operand * right_operand);
+ break;
+ case TAO_ETCL_DIV:
+ this->queue_.enqueue_head (left_operand / right_operand);
+ break;
+ default:
+ return_value = -1;
+ }
+ }
+ }
+
+ return return_value;
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_twiddle (
+ TAO_ETCL_Binary_Expr *binary
+ )
+{
+ int return_value = -1;
+ TAO_ETCL_Constraint *lhs = binary->lhs ();
+
+ // Determine if the left operand is a substring of the right.
+ if (lhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint left;
+ this->queue_.dequeue_head (left);
+ TAO_ETCL_Constraint *rhs = binary->rhs ();
+
+ if (rhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint right;
+ this->queue_.dequeue_head (right);
+ CORBA::Boolean result =
+ (ACE_OS::strstr ((const char *) left,
+ (const char *) right) != 0);
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ return_value = 0;
+ }
+ }
+
+ return return_value;
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_in (
+ TAO_ETCL_Binary_Expr *binary
+ )
+{
+ int return_value = -1;
+ TAO_ETCL_Constraint *lhs = binary->lhs ();
+
+ // Determine if the left operand is contained in the right.
+
+ if (lhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint left;
+ this->queue_.dequeue_head (left);
+
+ TAO_ETCL_Constraint *rhs = binary->rhs ();
+
+ if (rhs->accept (this) == 0)
+ {
+ TAO_ETCL_Literal_Constraint bag;
+ this->queue_.dequeue_head (bag);
+
+ if (bag.expr_type () == TAO_ETCL_COMPONENT)
+ {
+ const CORBA::Any *component = (const CORBA::Any *) bag;
+ CORBA::TCKind kind = CORBA::tk_null;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::TypeCode_var tc = component->type ();
+ kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ return return_value;
+ }
+ ACE_ENDTRY;
+
+ CORBA::Boolean result = 0;
+
+ switch (kind)
+ {
+ case CORBA::tk_sequence:
+ result = this->sequence_does_contain (component,
+ left);
+ break;
+ case CORBA::tk_array:
+ result = this->array_does_contain (component,
+ left);
+ break;
+ case CORBA::tk_struct:
+ result = this->struct_does_contain (component,
+ left);
+ break;
+ case CORBA::tk_union:
+ result = this->union_does_contain (component,
+ left);
+ break;
+ case CORBA::tk_any:
+ result = this->any_does_contain (component,
+ left);
+ break;
+ default:
+ return return_value;
+ }
+
+ this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
+ return_value = 0;
+ }
+ }
+ }
+
+ return return_value;
+}
+
+int
+TAO_Log_Constraint_Visitor::visit_preference (
+ TAO_ETCL_Preference *
+ )
+{
+ // According to OMG 00-06-20 section 2.4.1, the Notification Service
+ // does not use the preference operators. The method must be here
+ // because it is called by the ETCL node, which may be used by other
+ // CORBA services that do use the preference operators.
+ return -1;
+}
+
+CORBA::Boolean
+TAO_Log_Constraint_Visitor::sequence_does_contain (
+ const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item
+ )
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::TypeCode_var type = any->type ();
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // The literal and the array elements must be
+ // of the same simple type.
+ CORBA::Boolean match = this->simple_type_match (item.expr_type (),
+ kind);
+
+ if (match == 0)
+ {
+ return 0;
+ }
+
+ TAO_DynSequence_i dyn_seq;
+ dyn_seq.init (*any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ DynamicAny::AnySeq_var any_seq =
+ dyn_seq.get_elements (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::ULong length = any_seq->length ();
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ TAO_ETCL_Literal_Constraint element (&any_seq[i]);
+
+ if (item == element)
+ {
+ return 1;
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ return 0;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+CORBA::Boolean
+TAO_Log_Constraint_Visitor::array_does_contain (
+ const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item
+ )
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::TypeCode_var type = any->type ();
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (type.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // The literal and the array elements must be
+ // of the same simple type.
+ CORBA::Boolean match = this->simple_type_match (item.expr_type (),
+ kind);
+
+ if (match == 0)
+ {
+ return 0;
+ }
+
+ TAO_DynArray_i dyn_array;
+ dyn_array.init (*any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ DynamicAny::AnySeq_var any_seq =
+ dyn_array.get_elements (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::ULong length = any_seq->length ();
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ TAO_ETCL_Literal_Constraint element (&any_seq[i]);
+
+ if (item == element)
+ {
+ return 1;
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ return 0;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+CORBA::Boolean
+TAO_Log_Constraint_Visitor::struct_does_contain (
+ const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item
+ )
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_DynStruct_i dyn_struct;
+ dyn_struct.init (*any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ DynamicAny::NameValuePairSeq_var members =
+ dyn_struct.get_members (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::ULong length = members->length ();
+ CORBA::TypeCode_var tc;
+ CORBA::TCKind kind;
+
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ tc = members[i].value.type ();
+ kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // The literal and the struct member must be
+ // of the same simple type.
+ CORBA::Boolean match = this->simple_type_match (item.expr_type (),
+ kind);
+
+ if (match == 0)
+ {
+ continue;
+ }
+
+ TAO_ETCL_Literal_Constraint element (&members[i].value);
+
+ if (item == element)
+ {
+ return 1;
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ return 0;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+CORBA::Boolean
+TAO_Log_Constraint_Visitor::union_does_contain (
+ const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item
+ )
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ TAO_DynUnion_i dyn_union;
+ dyn_union.init (*any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ DynamicAny::DynAny_var cc =
+ dyn_union.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::Any_var member = cc->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::TypeCode_var tc = member->type ();
+ CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // The literal and the union member must be
+ // of the same simple type.
+ CORBA::Boolean match = this->simple_type_match (item.expr_type (),
+ kind);
+
+ if (match == 0)
+ {
+ return 0;
+ }
+
+ TAO_ETCL_Literal_Constraint element (&member.inout ());
+
+ return (item == element);
+ }
+ ACE_CATCHANY
+ {
+ return 0;
+ }
+ ACE_ENDTRY;
+
+ ACE_NOTREACHED (return 0);
+}
+
+CORBA::Boolean
+TAO_Log_Constraint_Visitor::any_does_contain (
+ const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item
+ )
+{
+ const CORBA::Any *result = 0;
+
+ *any >>= result;
+
+ TAO_ETCL_Literal_Constraint element (ACE_const_cast (CORBA::Any *,
+ result));
+
+ return (item == element);
+}
+
+CORBA::Boolean
+TAO_Log_Constraint_Visitor::simple_type_match (int expr_type,
+ CORBA::TCKind tc_kind)
+{
+ switch (expr_type)
+ {
+ case TAO_ETCL_STRING:
+ if (tc_kind != CORBA::tk_string)
+ {
+ return 0;
+ }
+ case TAO_ETCL_DOUBLE:
+ if (tc_kind != CORBA::tk_double
+ && tc_kind != CORBA::tk_float)
+ {
+ return 0;
+ }
+ case TAO_ETCL_INTEGER:
+ case TAO_ETCL_SIGNED:
+ if (tc_kind != CORBA::tk_short
+ && tc_kind != CORBA::tk_long
+ && tc_kind != CORBA::tk_longlong)
+ {
+ return 0;
+ }
+ case TAO_ETCL_UNSIGNED:
+ if (tc_kind != CORBA::tk_ushort
+ && tc_kind != CORBA::tk_ulong
+ && tc_kind != CORBA::tk_ulonglong)
+ {
+ return 0;
+ }
+ case TAO_ETCL_BOOLEAN:
+ if (tc_kind != CORBA::tk_boolean)
+ {
+ return 0;
+ }
+ default:
+ return 0;
+ }
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class ACE_Hash_Map_Manager<ACE_CString, CORBA::Any*, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Manager_Ex<ACE_CString, CORBA::Any *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Entry <ACE_CString, CORBA::Any*>;
+template class ACE_Hash_Map_Iterator<ACE_CString, CORBA::Any*, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Iterator_Ex<ACE_CString, CORBA::Any *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, CORBA::Any *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Reverse_Iterator<ACE_CString, CORBA::Any*, TAO_SYNCH_MUTEX>;
+template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, CORBA::Any *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, TAO_SYNCH_MUTEX>;
+template class ACE_Node<TAO_ETCL_Literal_Constraint>;
+template class ACE_Unbounded_Queue<TAO_ETCL_Literal_Constraint>;
+template class ACE_Unbounded_Queue_Iterator<TAO_ETCL_Literal_Constraint>;
+
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate ACE_Hash_Map_Manager<ACE_CString, CORBA::Any*, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, CORBA::Any *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Entry <ACE_CString, CORBA::Any*>
+#pragma instantiate ACE_Hash_Map_Iterator<ACE_CString, CORBA::Any*, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, CORBA::Any *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, CORBA::Any *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator<ACE_CString, CORBA::Any*, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, CORBA::Any *, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, TAO_SYNCH_MUTEX>
+#pragma instantiate ACE_Node<TAO_ETCL_Literal_Constraint>
+#pragma instantiate ACE_Unbounded_Queue<TAO_ETCL_Literal_Constraint>
+#pragma instantiate ACE_Unbounded_Queue_Iterator<TAO_ETCL_Literal_Constraint>
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.h b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.h
index 00677bfb9d5..d3987329168 100644
--- a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.h
+++ b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.h
@@ -1,40 +1,116 @@
+/* -*- C++ -*- */
// $Id$
-// ========================================================================
+// ==========================================================================
//
// = LIBRARY
-// orbsvcs
+// orbsvcs
//
// = FILENAME
-// Log_Constraint_Visitors.h
+// Log_Constraint_Visitors.h
+//
+// = DESCRIPTION
+//
//
// = AUTHOR
-// Pradeep Gore <pradeep@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
+// Jeff Parsons <parsons@cs.wustl.edu>
+// D A Hanvey <d.hanvey@qub.ac.uk>
//
-// ========================================================================
+// ==========================================================================
+
+#ifndef LOG_CONSTRAINT_VISITORS_H
+#define LOG_CONSTRAINT_VISITORS_H
-#ifndef TAO_LOG_CONSTRAINT_VISITOR_H
-#define TAO_LOG_CONSTRAINT_VISITOR_H
#include "ace/pre.h"
+#include "ace/Hash_Map_Manager.h"
-#include "orbsvcs/orbsvcs/Trader/Constraint_Visitors.h"
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "orbsvcs/ETCL/ETCL_Constraint_Visitor.h"
#include "orbsvcs/DsLogAdminC.h"
#include "log_export.h"
-class TAO_Log_Export TAO_Log_Constraint_Evaluator : public TAO_Constraint_Evaluator
+class TAO_ETCL_Constraint;
+class TAO_ETCL_Literal_Constraint;
+class TAO_Log_Property_Constraint;
+
+class TAO_Log_Export TAO_Log_Constraint_Visitor
+ : public TAO_ETCL_Constraint_Visitor
{
- public:
- TAO_Log_Constraint_Evaluator (DsLogAdmin::LogRecord &rec);
+public:
+ TAO_Log_Constraint_Visitor (DsLogAdmin::LogRecord &rec);
// Constructor.
- virtual int visit_property (TAO_Property_Constraint* literal);
+ CORBA::Boolean evaluate_constraint (TAO_ETCL_Constraint *root);
+ // Returns 1 if the offer satisfies the constraint
+ // represented by the the expression tree rooted at <root>, 0 if it
+ // doesn't. If an error occurs during process, the traversal
+ // automatically fails.
+
+ // The overridden methods.
+ int visit_literal (TAO_ETCL_Literal_Constraint *);
+ int visit_identifier (TAO_ETCL_Identifier *);
+ int visit_union_value (TAO_ETCL_Union_Value *);
+ int visit_union_pos (TAO_ETCL_Union_Pos *);
+ int visit_component_pos (TAO_ETCL_Component_Pos *);
+ int visit_component_assoc (TAO_ETCL_Component_Assoc *);
+ int visit_component_array (TAO_ETCL_Component_Array *);
+ int visit_special (TAO_ETCL_Special *);
+ int visit_component (TAO_ETCL_Component *);
+ int visit_dot (TAO_ETCL_Dot *);
+ int visit_eval (TAO_ETCL_Eval *);
+ int visit_default (TAO_ETCL_Default *);
+ int visit_exist (TAO_ETCL_Exist *);
+ int visit_unary_expr (TAO_ETCL_Unary_Expr *);
+ int visit_binary_expr (TAO_ETCL_Binary_Expr *);
+ int visit_preference (TAO_ETCL_Preference *);
+
+private:
+ // Sub-methods for visit_binary_expr().
+ int visit_or (TAO_ETCL_Binary_Expr *);
+ int visit_and (TAO_ETCL_Binary_Expr *);
+ int visit_twiddle (TAO_ETCL_Binary_Expr *);
+ int visit_in (TAO_ETCL_Binary_Expr *);
+ int visit_binary_op (TAO_ETCL_Binary_Expr *binary_expr,
+ int op_type);
+
+ // These use dynamic anys look inside the ETCL component.
+ CORBA::Boolean sequence_does_contain (const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item);
+ CORBA::Boolean array_does_contain (const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item);
+ CORBA::Boolean struct_does_contain (const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item);
+ CORBA::Boolean union_does_contain (const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item);
+ CORBA::Boolean any_does_contain (const CORBA::Any *any,
+ TAO_ETCL_Literal_Constraint &item);
+
+ // Utility function to compare a TAO_ETCL_Literal_Constraint type
+ // and a type code.
+ CORBA::Boolean simple_type_match (int expr_type,
+ CORBA::TCKind tc_kind);
+
+private:
+ ACE_Hash_Map_Manager <ACE_CString,
+ CORBA::Any*,
+ TAO_SYNCH_MUTEX>
+ property_lookup_;
+ // Used to lookup property name and values.
+
+ ACE_Unbounded_Queue <TAO_ETCL_Literal_Constraint> queue_;
+ // The result of a non_boolean operation.
+
+ CORBA::Any_var current_member_;
+ // Holder for a value found in property_lookup_ or for a
+ // nested type within that value.
- private:
DsLogAdmin::LogRecord &rec_;
- // TAO_Property_Evaluator prop_eval_;
- // Utility with which to evaluate the properties of an offer, be
- // they dyanmic or static.
+ // Local LogRecord
};
#include "ace/post.h"
-#endif /* TAO_LOG_CONSTRAINT_VISITOR_H */
+#endif /* LOG_CONSTRAINT_VISITORS_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_i.cpp b/TAO/orbsvcs/orbsvcs/Log/Log_i.cpp
index 079c05691b8..2c012c6e432 100644
--- a/TAO/orbsvcs/orbsvcs/Log/Log_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/Log/Log_i.cpp
@@ -1,9 +1,10 @@
-// $Id$
+/* -*- C++ -*- $Id$ */
#include "orbsvcs/Log/Log_i.h"
#include "orbsvcs/Log/Iterator_i.h"
#include "orbsvcs/Log/Log_Constraint_Interpreter.h"
#include "orbsvcs/Log/Log_Constraint_Visitors.h"
+#include "orbsvcs/Time_Utilities.h"
#include "tao/debug.h"
@@ -11,7 +12,8 @@
Log_i::Log_i (DsLogAdmin::LogMgr_ptr factory,
DsLogAdmin::LogId id,
- DsLogAdmin::LogFullAction log_full_action,
+ LogNotification *log_notifier,
+ DsLogAdmin::LogFullActionType log_full_action,
CORBA::ULongLong max_size,
ACE_Reactor *reactor)
: factory_ (DsLogAdmin::LogMgr::_duplicate (factory)),
@@ -21,11 +23,19 @@ Log_i::Log_i (DsLogAdmin::LogMgr_ptr factory,
forward_state_ (DsLogAdmin::off),
op_state_ (DsLogAdmin::disabled),
reactor_ (reactor),
- recordstore_ (max_size),
+ recordstore_ (max_size, id),
max_rec_list_len_ (LOG_DEFAULT_MAX_REC_LIST_LEN)
{
avail_status_.off_duty = 0;
avail_status_.log_full = 0;
+ interval_.start = 0;
+ interval_.stop = 0;
+ this->notifier_ = log_notifier;
+ this->max_record_life_ = 0;
+ this->current_threshold_ = 0;
+ this->thresholds_.length(1);
+ this->thresholds_[0] = 100;
+
}
void
@@ -60,7 +70,7 @@ Log_i::id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
}
DsLogAdmin::QoSList*
-Log_i::get_qos (ACE_ENV_SINGLE_ARG_DECL)
+Log_i::get_log_qos (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
DsLogAdmin::QoSList* ret_val;
@@ -72,12 +82,19 @@ Log_i::get_qos (ACE_ENV_SINGLE_ARG_DECL)
}
void
-Log_i::set_qos (const DsLogAdmin::QoSList &qos
+Log_i::set_log_qos (const DsLogAdmin::QoSList &qos
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::UnsupportedQoS))
{
// validate supported properties..
+
+ // implement after persistence is added.
+ DsLogAdmin::QoSList* old_qos;
+ old_qos = get_log_qos (ACE_ENV_SINGLE_ARG_PARAMETER);
+ CORBA::Boolean change = false;
+
+
for (CORBA::ULong i = 0; i < qos.length (); i++)
{
DsLogAdmin::QoSType qostype = qos[i];
@@ -97,6 +114,12 @@ Log_i::set_qos (const DsLogAdmin::QoSList &qos
// store this list.
this->qoslist_ = qos;
+
+ if (notifier_ && change)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->quality_of_service_value_change (log.in (), logid_, ACE_static_cast(const DsLogAdmin::QoSList,*old_qos),
+ qos ACE_ENV_ARG_PARAMETER);
+ }
}
CORBA::ULong
@@ -111,11 +134,21 @@ Log_i::set_max_record_life (CORBA::ULong life
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // life is in seconds.
- // @@ TODO: Need to iterate over all records in storage to timeout all
- // those outside the lifetime....
- max_record_life_ = life;
- ACE_THROW (CORBA::NO_IMPLEMENT ());
+ CORBA::ULong old_life;
+ old_life = this->get_max_record_life (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ if (life == old_life)
+ return;
+
+ this->max_record_life_ = life;
+
+ remove_old_records ();
+
+ if (notifier_)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->max_record_life_value_change (log.in (), logid_, old_life,
+ life ACE_ENV_ARG_PARAMETER);
+ }
}
CORBA::ULongLong
@@ -132,23 +165,31 @@ Log_i::set_max_size (CORBA::ULongLong size
DsLogAdmin::InvalidParam))
{
// size == 0 => infinite size.
- if (size == 0)
+ CORBA::ULongLong old_size;
+ old_size = get_max_size (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ if ((size != 0) && (size < this->recordstore_.get_current_size ()))
{
- this->recordstore_.set_max_size (size);
+ ACE_THROW (DsLogAdmin::InvalidParam ());
}
else
- if (size < this->recordstore_.get_current_size ())
- {
- ACE_THROW (DsLogAdmin::InvalidParam ());
- }
- else
+ {
this->recordstore_.set_max_size (size);
+ if (notifier_ && old_size != size)
+ {
+ DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->max_log_size_value_change (log.in (), logid_, old_size,
+ size ACE_ENV_ARG_PARAMETER);
+ }
+ }
}
CORBA::ULongLong
Log_i::get_current_size (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
-{
+{
+ remove_old_records ();
+
return this->recordstore_.get_current_size ();
}
@@ -156,10 +197,12 @@ CORBA::ULongLong
Log_i::get_n_records (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ remove_old_records ();
+
return this->recordstore_.get_n_records ();
}
-DsLogAdmin::LogFullAction
+DsLogAdmin::LogFullActionType
Log_i::get_log_full_action (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
@@ -167,11 +210,21 @@ Log_i::get_log_full_action (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
}
void
-Log_i::set_log_full_action (DsLogAdmin::LogFullAction action
+Log_i::set_log_full_action (DsLogAdmin::LogFullActionType action
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ DsLogAdmin::LogFullActionType old_action;
+ old_action = get_log_full_action (ACE_ENV_SINGLE_ARG_PARAMETER);
+
log_full_action_ = action;
+
+ if (notifier_ && action != old_action)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->log_full_action_value_change (log.in (), logid_, old_action,
+ action ACE_ENV_ARG_PARAMETER);
+ }
+
}
DsLogAdmin::AdministrativeState
@@ -186,7 +239,14 @@ Log_i::set_administrative_state (DsLogAdmin::AdministrativeState state
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ if (this->admin_state_ == state)
+ return;
+
this->admin_state_ = state;
+ if (notifier_)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->administrative_state_change (log.in (), logid_, state ACE_ENV_ARG_PARAMETER);
+ }
}
DsLogAdmin::ForwardingState
@@ -201,7 +261,13 @@ Log_i::set_forwarding_state (DsLogAdmin::ForwardingState state
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ if (this->forward_state_ == state)
+ return;
this->forward_state_ = state;
+ if (notifier_)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->forwarding_state_change (log.in (), logid_, state ACE_ENV_ARG_PARAMETER);
+ }
}
DsLogAdmin::OperationalState
@@ -225,25 +291,47 @@ Log_i::set_interval (const DsLogAdmin::TimeInterval &interval
DsLogAdmin::InvalidTime,
DsLogAdmin::InvalidTimeInterval))
{
- //@@ TODO: validate the time.
- // modify the timer settings to the new values.
+
+ if (interval.start != 0)
+ {
+ if (interval.start >= interval.stop)
+ ACE_THROW (DsLogAdmin::InvalidTimeInterval ());
+ }
+ DsLogAdmin::TimeT old_start_time;
+ DsLogAdmin::TimeT old_stop_time;
+ old_start_time = interval_.start;
+ old_stop_time = interval_.stop;
+
+ if (interval.start == old_start_time && interval.stop == old_stop_time)
+ return;
+
this->interval_ = interval;
- ACE_THROW (CORBA::NO_IMPLEMENT ());
+
+ if (notifier_)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ if (interval.start != old_start_time)
+ notifier_->start_time_value_change (log.in (), logid_, old_start_time,
+ interval.start ACE_ENV_ARG_PARAMETER);
+
+ if (interval.stop != old_stop_time)
+ notifier_->stop_time_value_change (log.in (), logid_, old_stop_time,
+ interval.stop ACE_ENV_ARG_PARAMETER);
+ }
}
DsLogAdmin::AvailabilityStatus
Log_i::get_availability_status (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- // TODO:
- // "on duty" => "enabled" AND "unlocked" AND current time within log
- // duration time AND current time within log scheduling times.
if (this->op_state_ == DsLogAdmin::enabled
&& this->admin_state_ == DsLogAdmin::unlocked
&& this->scheduled () == 1)
{
this->avail_status_.off_duty = 0; // "on duty"
+
}
+ else
+ this->avail_status_.off_duty = 1;
// The log_full flag is set by the write operations.
return this->avail_status_;
}
@@ -269,11 +357,21 @@ Log_i::set_capacity_alarm_thresholds (const
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidThreshold))
{
- // @@ TODO: validate thresholds
- // How do we implement thresholds in DsLogAdmin !?
- // According to the spec, the log must "notify" when threshold
- // conditions are reached.we need to be an Event Channel to do that. // now what!?
+
+ if (!validate_capacity_alarm_thresholds (threshs))
+ ACE_THROW (DsLogAdmin::InvalidThreshold ());
+
+ DsLogAdmin::CapacityAlarmThresholdList old_threshs;
+ old_threshs = thresholds_;
+
this->thresholds_ = threshs;
+
+ if (notifier_)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->capacity_alarm_threshold_value_change (log.in (), logid_, old_threshs,
+ threshs ACE_ENV_ARG_PARAMETER);
+ }
+
}
DsLogAdmin::WeekMask*
@@ -297,9 +395,79 @@ Log_i::set_week_mask (const DsLogAdmin::WeekMask &masks
DsLogAdmin::InvalidTimeInterval,
DsLogAdmin::InvalidMask))
{
- // @@ TODO: validate masks.
- // Activate various timers to trigger appropriate acition.
- this->weekmask_ = masks;
+ for (CORBA::ULong i = 0; i < masks.length (); ++i)
+ {
+ if (masks[i].days > (DsLogAdmin::Sunday +
+ DsLogAdmin::Monday +
+ DsLogAdmin::Tuesday +
+ DsLogAdmin::Wednesday +
+ DsLogAdmin::Thursday +
+ DsLogAdmin::Friday +
+ DsLogAdmin::Saturday)
+ )
+ ACE_THROW (DsLogAdmin::InvalidMask ());
+
+ for (CORBA::ULong j = 0; j < masks[i].intervals.length (); ++j)
+ {
+ if (masks[i].intervals[j].start.hour > 23 ||
+ masks[i].intervals[j].start.minute > 59 ||
+ masks[i].intervals[j].stop.hour > 23 ||
+ masks[i].intervals[j].stop.minute > 59)
+ ACE_THROW (DsLogAdmin::InvalidTime ());
+
+ if (masks[i].intervals[j].stop.hour <
+ masks[i].intervals[j].start.hour)
+ ACE_THROW (DsLogAdmin::InvalidTimeInterval ());
+
+ if (masks[i].intervals[j].stop.hour ==
+ masks[i].intervals[j].start.hour &&
+ masks[i].intervals[j].stop.minute <=
+ masks[i].intervals[j].start.minute)
+ ACE_THROW (DsLogAdmin::InvalidTimeInterval ());
+
+ }
+ }
+
+ DsLogAdmin::WeekMask old_masks;
+ old_masks = weekmask_;
+
+ DsLogAdmin::TimeInterval temp_interval;
+ CORBA::ULong count = 0;
+ weekly_intervals_.length(100);
+
+ // convert the weekmask into a sequence of time intervals.
+ for (CORBA::ULong i = 0; i < masks.length (); ++i)
+ {
+ for (CORBA::ULong j = 0; j < masks[i].intervals.length (); ++j)
+ {
+ for (int d = 0; d < 7; ++d)
+ { if ( (1 << d) & masks[i].days)
+ {
+ temp_interval.start = CORBA::ULongLong ((d * 3600* 24) +
+ (masks[i].intervals[j].start.hour * 3600) +
+ (masks[i].intervals[j].start.minute * 60)) * 10000000; ;
+
+ temp_interval.stop = CORBA::ULongLong ((d * 3600* 24) +
+ (masks[i].intervals[j].stop.hour * 3600) +
+ (masks[i].intervals[j].stop.minute * 60)) * 10000000;
+
+ weekly_intervals_[count] = temp_interval;
+ ++count;
+
+ }
+ }
+
+ }
+ }
+ weekly_intervals_.length (count);
+
+ //TODO: SORT AND CLEAN
+
+ if (notifier_)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->week_mask_value_change (log.in (), logid_, old_masks,
+ masks ACE_ENV_ARG_PARAMETER);
+ }
}
DsLogAdmin::RecordList*
@@ -310,6 +478,8 @@ Log_i::query_i (const char *constraint,
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidConstraint))
{
+ remove_old_records ();
+
// Use an Interpreter to build an expression tree.
TAO_Log_Constraint_Interpreter interpreter (constraint
ACE_ENV_ARG_PARAMETER);
@@ -318,6 +488,7 @@ Log_i::query_i (const char *constraint,
// Sequentially iterate over all the records and pick the ones that
// meet the constraints.
+
// get the underlying storage.
LogRecordStore::LOG_RECORD_STORE &store =
this->recordstore_.get_storage ();
@@ -326,6 +497,7 @@ Log_i::query_i (const char *constraint,
LogRecordStore::LOG_RECORD_HASH_MAP_ITER iter (store);
CORBA::ULong len = store.current_size ();
+
// How many entries?
// Iterate over and populate the list.
@@ -354,7 +526,7 @@ Log_i::query_i (const char *constraint,
}
// Use an evaluator.
- TAO_Log_Constraint_Evaluator evaluator (hash_entry->int_id_);
+ TAO_Log_Constraint_Visitor evaluator (hash_entry->int_id_);
// Does it match the constraint?
if (interpreter.evaluate (evaluator) == 1)
@@ -401,6 +573,7 @@ Log_i::query_i (const char *constraint,
ACE_CHECK_RETURN (rec_list);
}
+
return rec_list;
}
@@ -434,8 +607,8 @@ Log_i::retrieve (DsLogAdmin::TimeT from_time,
ACE_THROW_SPEC ((CORBA::SystemException))
{
// Decide between forward vs backward retrieval.
- ACE_TCHAR constraint[32];
- ACE_TCHAR uint64_formating[32];
+ char constraint[32];
+ char uint64_formating[32];
#if defined (ACE_LACKS_LONGLONG_T)
ACE_OS::sprintf (uint64_formating,
@@ -446,12 +619,15 @@ Log_i::retrieve (DsLogAdmin::TimeT from_time,
#endif
if (how_many >= 0)
- ACE_OS::sprintf (constraint, ACE_LIB_TEXT("time >= %s"), uint64_formating);
+ ACE_OS::sprintf (constraint, "time >= %s", uint64_formating);
else
- ACE_OS::sprintf (constraint, ACE_LIB_TEXT("time < %s"), uint64_formating);
+ {
+ ACE_OS::sprintf (constraint, "time < %s", uint64_formating);
+ how_many = -(how_many);
+ }
DsLogAdmin::RecordList* rec_list =
- this->query_i (ACE_TEXT_ALWAYS_CHAR(constraint),
+ this->query_i (constraint,
iter_out,
how_many
ACE_ENV_ARG_PARAMETER);
@@ -467,6 +643,8 @@ Log_i::match_i (const char *constraint,
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidConstraint))
{
+ remove_old_records ();
+
// Use an Interpreter to build an expression tree.
TAO_Log_Constraint_Interpreter interpreter (constraint
ACE_ENV_ARG_PARAMETER);
@@ -494,7 +672,7 @@ Log_i::match_i (const char *constraint,
break;
}
// Use an evaluator.
- TAO_Log_Constraint_Evaluator evaluator (hash_entry->int_id_);
+ TAO_Log_Constraint_Visitor evaluator (hash_entry->int_id_);
// Does it match the constraint?
if (interpreter.evaluate (evaluator) == 1)
@@ -545,6 +723,8 @@ Log_i::delete_records (const char *grammar,
this->match_i (constraint, 1 ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (count);
+ this->reset_capacity_alarm_threshold();
+
return count;
}
@@ -554,6 +734,8 @@ Log_i::delete_records_by_id (const
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ remove_old_records ();
+
CORBA::ULong numdone (0);
for (CORBA::ULong i = 0; i < ids.length (); i++)
@@ -563,6 +745,15 @@ Log_i::delete_records_by_id (const
numdone++;
}
}
+ if (numdone > 0)
+ {
+ if (this->get_current_size () < this->get_max_size ())
+ {
+ avail_status_.log_full = 0;
+ }
+ }
+
+ this->reset_capacity_alarm_threshold();
return numdone;
}
@@ -588,15 +779,13 @@ Log_i::write_records (const DsLogAdmin::Anys &records
}
void
-Log_i::write_recordlist (const DsLogAdmin::RecordList &reclist
+Log_i::write_recordlist (const DsLogAdmin::RecordList &reclist//,
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::LogFull,
DsLogAdmin::LogLocked))
{
- // Check the operational status.
- if (this->op_state_ == DsLogAdmin::disabled)
- return; // return without a squeak.
+ remove_old_records ();
// Check if the log is on duty
// @@ Wait for Comittee ruling on the proper behavior
@@ -604,33 +793,41 @@ Log_i::write_recordlist (const DsLogAdmin::RecordList &reclist
this->get_availability_status (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
+
+ // Log is not available for writing. Throw specific reason why.
if (avail_stat.off_duty == 1)
{
+
// why are we off duty? investigate ...
// Check if the log is full.
- if (avail_stat.log_full == 1)
+ if (avail_stat.log_full == 1 && this->log_full_action_ == DsLogAdmin::halt)
+ {
ACE_THROW (DsLogAdmin::LogFull (0));
+ }
else // Check the administrative state.
if (this->admin_state_ == DsLogAdmin::locked)
ACE_THROW (DsLogAdmin::LogLocked ());
else
+ if (this->op_state_ == DsLogAdmin::disabled)
+ ACE_THROW (DsLogAdmin::LogDisabled ());
return; // we are not scheduled at this time.
}
CORBA::Short num_written (0);
DsLogAdmin::LogRecord record;
-
+
for (CORBA::ULong i = 0; i < reclist.length (); i++)
- {
+ {
// Check if the log is full.
- if (avail_status_.log_full == 1)
- {
+ if (avail_status_.log_full == 1 && this->log_full_action_ == DsLogAdmin::halt )
+ {
ACE_THROW (DsLogAdmin::LogFull (num_written));
}
else
{
// retval == 1 => log store reached max size.
record = reclist[i]; // can't avoid this copy, reclist is const.
+
int retval = this->recordstore_.log (record);
if (retval == 1)
{
@@ -639,10 +836,11 @@ Log_i::write_recordlist (const DsLogAdmin::RecordList &reclist
if (this->log_full_action_ == DsLogAdmin::halt)
avail_status_.log_full = 1;
else // the policy is to wrap. for this we need to delete
- // a few records. let the record store decide how many.
+ { // a few records. let the record store decide how many.
+
if (this->recordstore_.purge_old_records () == -1)
ACE_THROW (CORBA::PERSIST_STORE ());
-
+ }
// Now, we want to attempt to write the same record again
// so decrement the index to balance the inc. in the for loop.
--i;
@@ -654,8 +852,9 @@ Log_i::write_recordlist (const DsLogAdmin::RecordList &reclist
ACE_THROW (CORBA::PERSIST_STORE ());
} // else
- this->check_threshold_list ();
+ this->check_capacity_alarm_threshold ();
} // for
+
}
void
@@ -666,6 +865,7 @@ Log_i::set_record_attribute (DsLogAdmin::RecordId id,
DsLogAdmin::InvalidRecordId,
DsLogAdmin::InvalidAttribute))
{
+ remove_old_records ();
// TODO: validate attributes here.
DsLogAdmin::LogRecord rec;
@@ -692,11 +892,23 @@ Log_i::set_records_attribute (const char *grammar,
DsLogAdmin::InvalidConstraint,
DsLogAdmin::InvalidAttribute))
{
- ACE_UNUSED_ARG (grammar);
- ACE_UNUSED_ARG (constraint);
- ACE_UNUSED_ARG (attr_list);
+ remove_old_records ();
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+ DsLogAdmin::Iterator_var iter_out;
+
+
+ DsLogAdmin::RecordList_var rec_list =
+ this->query (grammar,
+ constraint,
+ iter_out
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (rec_list);
+
+ for (CORBA::ULong i = 0; i < rec_list->length (); ++i)
+ {
+ this->set_record_attribute (rec_list[i].id, attr_list ACE_ENV_ARG_PARAMETER);
+ }
+ return rec_list->length ();
}
DsLogAdmin::NVList*
@@ -705,6 +917,8 @@ Log_i::get_record_attribute (DsLogAdmin::RecordId id
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidRecordId))
{
+ remove_old_records ();
+
DsLogAdmin::LogRecord rec;
if (this->recordstore_.retrieve (id, rec) == -1)
{
@@ -721,26 +935,6 @@ Log_i::get_record_attribute (DsLogAdmin::RecordId id
return nvlist;
}
-// @@ These two methods are non-trivial. Let's hold off on them for a while
-DsLogAdmin::Log_ptr
-Log_i::copy (DsLogAdmin::LogId_out id
- ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException))
-{
- ACE_UNUSED_ARG (id);
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
-}
-
-DsLogAdmin::Log_ptr
-Log_i::copy_with_id (DsLogAdmin::LogId id
- ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException,
- DsLogAdmin::LogIdAlreadyExists))
-{
- ACE_UNUSED_ARG (id);
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
-}
-
// @@ Should I just raise the exception?
void
Log_i::flush (ACE_ENV_SINGLE_ARG_DECL)
@@ -752,19 +946,75 @@ Log_i::flush (ACE_ENV_SINGLE_ARG_DECL)
// just have this map to its sync method
}
-void
-Log_i::check_threshold_list (void)
+
+bool
+Log_i::validate_capacity_alarm_thresholds (
+ const DsLogAdmin::CapacityAlarmThresholdList & threshs
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
- // TBD: Anyways we can't notify from DsLogAdmin.
- // Finish this when we use the CosEC.
- return;
+ for (CORBA::ULong i = 0; i < threshs.length (); i++)
+ if (threshs[i] > 100)
+ return false;
+
+ if (threshs.length () != 0)
+ for (CORBA::ULong i = 0; i < threshs.length () - 1; i++)
+ if (threshs[i] >= threshs[i +1])
+ return false;
+
+ return true;
}
CORBA::Boolean
-Log_i::scheduled (void)
+Log_i::scheduled (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
- // TBD: lie for now.
- return 1;
+ TimeBase::TimeT current_time;
+ ACE_Time_Value now = ACE_OS::gettimeofday ();
+ ORBSVCS_Time::Time_Value_to_TimeT(current_time, now);
+
+ if ((current_time >= interval_.start) &&
+ ((current_time <= interval_.stop) || (interval_.stop == 0)) )
+ {
+ if (weekly_intervals_.length () > 0)
+ {
+ TimeBase::TimeT current_time;
+ ACE_Time_Value now = ACE_OS::gettimeofday ();
+ ORBSVCS_Time::Time_Value_to_TimeT(current_time, now);
+
+ // work out when sunday is in nanoseconds.
+ timeval t;
+ t = (timeval) now;
+ struct tm *sunday;
+
+ sunday = ACE_OS::localtime (&t.tv_sec);
+
+ sunday->tm_sec = 0;
+ sunday->tm_min = 0;
+ sunday->tm_hour = 0;
+ sunday->tm_mday -= sunday->tm_wday;
+
+ t.tv_sec = ACE_OS::mktime (sunday) ;
+ t.tv_usec = 0;
+
+ TimeBase::TimeT nano_sunday = (CORBA::ULongLong)t.tv_sec * 10000000;
+
+ for (CORBA::ULong i = 0; i < weekly_intervals_.length (); ++i)
+ {
+ if (current_time >= (weekly_intervals_[i].start + nano_sunday) &&
+ current_time <= (weekly_intervals_[i].stop + nano_sunday))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ else
+ return true;
+ }
+ else
+ return false;
+
}
void
@@ -778,3 +1028,148 @@ Log_i::check_grammar (const char* grammar
if (ACE_OS::strcmp (grammar, QUERY_LANG_SUPPORTED_BY_LOG) != 0)
ACE_THROW (DsLogAdmin::InvalidGrammar ());
}
+
+void
+Log_i::copy_attributes (DsLogAdmin::Log_ptr log)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ remove_old_records ();
+
+ log->set_log_full_action (get_log_full_action ());
+ log->set_max_size (get_max_size ());
+ log->set_log_qos (ACE_static_cast(const DsLogAdmin::QoSList, *get_log_qos ()));
+ log->set_max_record_life (get_max_record_life ());
+ log->set_administrative_state (get_administrative_state ());
+ log->set_forwarding_state (get_forwarding_state ());
+ log->set_interval (get_interval ());
+ log->set_capacity_alarm_thresholds (ACE_static_cast(const DsLogAdmin::CapacityAlarmThresholdList, *get_capacity_alarm_thresholds ()));
+ log->set_week_mask (ACE_static_cast(const DsLogAdmin::WeekMask, *get_week_mask ()));
+
+}
+
+void
+Log_i::remove_old_records (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+
+ TimeBase::TimeT time;
+ ORBSVCS_Time::Time_Value_to_TimeT(time,ACE_OS::gettimeofday());
+
+ TimeBase::TimeT purge_time = time - this->max_record_life_;
+
+ CORBA::ULongLong p_time = (CORBA::ULongLong)purge_time;
+
+ static char out[256] = "";
+
+ double temp1 =
+# if defined (ACE_CONFIG_WIN32_H)
+ ACE_static_cast(double, ACE_static_cast (CORBA::LongLong, p_time));
+# else
+ p_time;
+# endif /* ACE_CONFIG_WIN32_H */
+
+ ACE_OS::sprintf (out, "time > %.0f", temp1);
+
+ // Use an Interpreter to build an expression tree.
+ TAO_Log_Constraint_Interpreter interpreter (out
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ // Get the underlying storage.
+ LogRecordStore::LOG_RECORD_STORE &store =
+ this->recordstore_.get_storage ();
+
+ // Create an iterator
+ LogRecordStore::LOG_RECORD_STORE_ITER iter (store);
+
+ CORBA::ULong len = store.current_size ();
+ // How many entries?
+
+ // Iterate over and populate the list.
+ LogRecordStore::LOG_RECORD_HASH_MAP_ENTRY *hash_entry;
+
+ CORBA::ULong count = 0; // count of matches found.
+
+ for (CORBA::ULong i = 0; i < len; ++i)
+ {
+ if (iter.next (hash_entry) == -1 || iter.advance () == -1)
+ {
+ break;
+ }
+ // Use an evaluator.
+ TAO_Log_Constraint_Visitor evaluator (hash_entry->int_id_);
+
+ // Does it match the constraint?
+ if (interpreter.evaluate (evaluator) == 1)
+ {
+ if (this->recordstore_.remove (hash_entry->int_id_.id) == 0)
+ count++;
+ }
+ }
+ this->reset_capacity_alarm_threshold();
+}
+
+
+void
+Log_i::check_capacity_alarm_threshold (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ remove_old_records ();
+
+ CORBA::LongLong max_size = this->recordstore_.get_max_size ();
+ if (max_size != 0 && this->thresholds_.length() > 0)
+ {
+ CORBA::LongLong current_size = this->recordstore_.get_current_size();
+ CORBA::UShort percent = (CORBA::UShort) (((double)current_size * 100) /
+ (double) max_size);
+
+ while (current_threshold_ < this->thresholds_.length() &&
+ this->thresholds_[this->current_threshold_] <= percent)
+ {
+ DsLogNotification::PerceivedSeverityType severity =
+ percent == 100 ? DsLogNotification::critical :
+ DsLogNotification::minor;
+
+ if (notifier_)
+ { DsLogAdmin::Log_var log = DsLogAdmin::Log::_duplicate(this->_this());
+ notifier_->threshold_alarm (log.in (), logid_,
+ this->thresholds_[this->current_threshold_],
+ (CORBA::UShort) percent,
+ severity ACE_ENV_ARG_PARAMETER);
+ }
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG((LM_DEBUG,"threshold of %d breached\n",
+ this->thresholds_[this->current_threshold_]));
+ }
+
+ ++this->current_threshold_;
+ }
+
+ if (this->current_threshold_ == this->thresholds_.length() &&
+ this->log_full_action_ != DsLogAdmin::halt)
+ {
+ this->current_threshold_ = 0;
+ }
+ }
+}
+
+void
+Log_i::reset_capacity_alarm_threshold (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::LongLong max_size = this->recordstore_.get_max_size ();
+ if (max_size != 0 && this->thresholds_.length() > 0)
+ {
+ CORBA::LongLong current_size = this->recordstore_.get_current_size();
+ CORBA::UShort percent = (CORBA::UShort) (((double)current_size * 100) /
+ (double) max_size);
+
+ this->current_threshold_ = 0;
+
+ while (current_threshold_ < this->thresholds_.length() &&
+ this->thresholds_[this->current_threshold_] <= percent)
+ ++this->current_threshold_;
+ }
+}
diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_i.h b/TAO/orbsvcs/orbsvcs/Log/Log_i.h
index 8bc620fc876..ed59f85f16f 100644
--- a/TAO/orbsvcs/orbsvcs/Log/Log_i.h
+++ b/TAO/orbsvcs/orbsvcs/Log/Log_i.h
@@ -12,7 +12,9 @@
// Implementation of the DsLogAdmin::Log interface.
//
// = AUTHOR
-// Matthew Braun (mjb2@cs.wustl.edu) and Pradeep Gore <pradeep@cs.wustl.edu>
+// Matthew Braun <mjb2@cs.wustl.edu>
+// Pradeep Gore <pradeep@cs.wustl.edu>
+// D A Hanvey <d.hanvey@qub.ac.uk>
//
// ============================================================================
@@ -21,6 +23,7 @@
#include "ace/pre.h"
#include "orbsvcs/Log/LogRecordStore.h"
+#include "orbsvcs/Log/LogNotification.h"
#include "orbsvcs/DsLogAdminS.h"
#include "ace/Reactor.h"
#include "log_export.h"
@@ -47,7 +50,8 @@ public:
// = Initialization and Termination
Log_i (DsLogAdmin::LogMgr_ptr factory,
DsLogAdmin::LogId id,
- DsLogAdmin::LogFullAction log_full_action = DsLogAdmin::wrap,
+ LogNotification *log_notifier,
+ DsLogAdmin::LogFullActionType log_full_action = DsLogAdmin::wrap,
CORBA::ULongLong max_size = 0,
ACE_Reactor *reactor = ACE_Reactor::instance ());
// Constructor.
@@ -61,19 +65,18 @@ public:
// = DsLogAdmin::Log methods
DsLogAdmin::LogMgr_ptr my_factory (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
- // Return the factory of the log
+ // Return the factory of the log.
DsLogAdmin::LogId id (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
- // Return the id of the log
+ // Return the id of the log.
DsLogAdmin::QoSList*
- get_qos (ACE_ENV_SINGLE_ARG_DECL)
+ get_log_qos (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
+ // Get the list of the QoS properties supported by the log.
- // Get the list of the QoS properties supported by the log
-
- void set_qos (const DsLogAdmin::QoSList & qos
+ void set_log_qos (const DsLogAdmin::QoSList & qos
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::UnsupportedQoS));
@@ -82,22 +85,22 @@ public:
CORBA::ULong
get_max_record_life (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
- // Get the record life in seconds (0 infinite)
+ // Get the record life in seconds (0 infinite).
void
set_max_record_life (CORBA::ULong life
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
- // Set the record life in seconds (0 infinite)
+ // Set the record life in seconds (0 infinite).
CORBA::ULongLong
get_max_size (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
- // Get the maximum size in octets
+ // Get the maximum size in octets.
void
set_max_size (CORBA::ULongLong size
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidParam));
// Set the maximum size in octets.
@@ -110,18 +113,18 @@ public:
CORBA::ULongLong
get_n_records (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
- // Return the number of records in the log
+ // Return the number of records in the log.
- DsLogAdmin::LogFullAction
+ DsLogAdmin::LogFullActionType
get_log_full_action (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
- // Get the action to be taken when the log reaches its maximum size
+ // Get the action to be taken when the log reaches its maximum size.
void
- set_log_full_action (DsLogAdmin::LogFullAction action
- ACE_ENV_ARG_DECL)
+ set_log_full_action (DsLogAdmin::LogFullActionType action
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
- // Set the action to be taken when the log reaches its maximum size
+ // Set the action to be taken when the log reaches its maximum size.
DsLogAdmin::AdministrativeState
get_administrative_state (ACE_ENV_SINGLE_ARG_DECL)
@@ -130,7 +133,7 @@ public:
void
set_administrative_state (DsLogAdmin::AdministrativeState state
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
// Set the administrative state of the log.
@@ -159,7 +162,7 @@ public:
void
set_interval (const DsLogAdmin::TimeInterval & interval
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidTime,
DsLogAdmin::InvalidTimeInterval));
@@ -176,7 +179,7 @@ public:
// Get the capacity alarm threshold
void
- set_capacity_alarm_thresholds
+ set_capacity_alarm_thresholds
(const DsLogAdmin::CapacityAlarmThresholdList & threshs
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
@@ -195,7 +198,7 @@ public:
void
set_week_mask (const DsLogAdmin::WeekMask & masks
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidTime,
DsLogAdmin::InvalidTimeInterval,
@@ -204,9 +207,9 @@ public:
DsLogAdmin::RecordList*
query (const char * grammar,
- const char * c,
- DsLogAdmin::Iterator_out i
- ACE_ENV_ARG_DECL)
+ const char * c,
+ DsLogAdmin::Iterator_out i
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidGrammar,
DsLogAdmin::InvalidConstraint));
@@ -215,17 +218,17 @@ public:
DsLogAdmin::RecordList*
retrieve (DsLogAdmin::TimeT from_time,
- CORBA::Long how_many,
- DsLogAdmin::Iterator_out i
- ACE_ENV_ARG_DECL)
+ CORBA::Long how_many,
+ DsLogAdmin::Iterator_out i
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
// Retrieve <how_many> records from time <from_time> using iterator
// <i>.
CORBA::ULong
match (const char * grammar,
- const char * c
- ACE_ENV_ARG_DECL)
+ const char * c
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidGrammar,
DsLogAdmin::InvalidConstraint));
@@ -233,8 +236,8 @@ public:
CORBA::ULong
delete_records (const char * grammar,
- const char * c
- ACE_ENV_ARG_DECL)
+ const char * c
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidGrammar,
DsLogAdmin::InvalidConstraint));
@@ -242,14 +245,14 @@ public:
CORBA::ULong
delete_records_by_id (const DsLogAdmin::RecordIdList & ids
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
// Delete records matching ids in <ids>
void
write_records (const DsLogAdmin::Anys & records
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::LogFull,
DsLogAdmin::LogLocked));
@@ -257,7 +260,7 @@ public:
void
write_recordlist (const DsLogAdmin::RecordList & list
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::LogFull,
DsLogAdmin::LogLocked));
@@ -266,8 +269,8 @@ public:
void
set_record_attribute (DsLogAdmin::RecordId id,
- const DsLogAdmin::NVList & attr_list
- ACE_ENV_ARG_DECL)
+ const DsLogAdmin::NVList & attr_list
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidRecordId,
DsLogAdmin::InvalidAttribute));
@@ -275,9 +278,9 @@ public:
CORBA::ULong
set_records_attribute (const char * grammar,
- const char * c,
- const DsLogAdmin::NVList & attr_list
- ACE_ENV_ARG_DECL)
+ const char * c,
+ const DsLogAdmin::NVList & attr_list
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidGrammar,
DsLogAdmin::InvalidConstraint,
@@ -287,27 +290,12 @@ public:
DsLogAdmin::NVList*
get_record_attribute (DsLogAdmin::RecordId id
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
DsLogAdmin::InvalidRecordId));
// Get the attributes of the record with id <id>. Raises
// DsLogAdmin::InvalidRecordId
- DsLogAdmin::Log_ptr
- copy (DsLogAdmin::LogId_out id
- ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException));
-
- // Copy the log on which the operation was invoked.
-
- DsLogAdmin::Log_ptr
- copy_with_id (DsLogAdmin::LogId id
- ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException,
- DsLogAdmin::LogIdAlreadyExists));
- // Copy the log on which the operation was invoked and assign it the
- // given id.
-
void
flush (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
@@ -315,6 +303,12 @@ public:
// Causes all pending events to be written to storage. Raises
// DsLogAdmin::UnsupportedQos
+ static bool validate_capacity_alarm_thresholds (
+ const DsLogAdmin::CapacityAlarmThresholdList & threshs
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Check that valid threshold values have been given.
+
protected:
// = Helper methods
@@ -336,17 +330,31 @@ protected:
DsLogAdmin::InvalidGrammar));
// Throws DsLogAdmin::InvalidGrammar if we don't support this grammar.
- void check_threshold_list (void);
- // This method checks to see if any threshold limit is reached.
-
- CORBA::Boolean scheduled (void);
+ CORBA::Boolean scheduled (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
// Tells if the Log is scheduled to run now.
+ void copy_attributes (DsLogAdmin::Log_ptr log ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Copy the attributes of the log being passed.
+
+ void remove_old_records (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Remove records that have exceeded max_record_life_.
+
+ void check_capacity_alarm_threshold (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Check if threshold reached.
+
+ void reset_capacity_alarm_threshold (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Reset capacity alarm threshold.
+
// = Data Members
DsLogAdmin::LogMgr_var factory_;
// The factory of the log
- DsLogAdmin::LogFullAction log_full_action_;
+ DsLogAdmin::LogFullActionType log_full_action_;
// The action to take if the log reaches max capacity
DsLogAdmin::LogId logid_;
@@ -374,9 +382,15 @@ protected:
// The list of points at which the log should generate events
// indicating approaching full capacity
+ CORBA::ULong current_threshold_;
+ // The next capacity alarm threshold.
+
DsLogAdmin::WeekMask weekmask_;
// The days of the week that the log should be operational
+ TAO_Unbounded_Sequence<DsLogAdmin::TimeInterval> weekly_intervals_;
+ // A Sequence of the weekly intervals when the log is in operation.
+
DsLogAdmin::QoSList qoslist_;
// The QoS list of the log
@@ -388,6 +402,9 @@ protected:
CORBA::ULong max_rec_list_len_;
// Max count to return in queries.
+
+ LogNotification* notifier_;
+ // For sending Log Generated events.
};
#include "ace/post.h"
#endif /* TLS_LOG_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/NotifyLogFactory_i.cpp b/TAO/orbsvcs/orbsvcs/Log/NotifyLogFactory_i.cpp
new file mode 100644
index 00000000000..b480f20e14c
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/NotifyLogFactory_i.cpp
@@ -0,0 +1,456 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/NotifyLogFactory_i.h"
+#include "ace/Auto_Ptr.h"
+#include "orbsvcs/Log/LogNotification.h"
+#include "orbsvcs/Log/NotifyLogNotification.h"
+
+const char *ior_output_file = "ec.ior";
+
+NotifyLogFactory_i::NotifyLogFactory_i (void)
+{
+ // No-Op.
+}
+
+NotifyLogFactory_i::NotifyLogFactory_i (CosNotifyChannelAdmin::EventChannelFactory_ptr ecf ACE_ENV_ARG_DECL)
+: notify_factory_ (ecf)
+{
+ CosNotifyChannelAdmin::ChannelID id;
+ CosNotifyChannelAdmin::AdminID adminID = 0;
+ CosNotification::QoSProperties initial_qos;
+ CosNotification::AdminProperties initial_admin;
+
+ this->event_channel_ =
+ this->notify_factory_->create_channel (initial_qos,
+ initial_admin,
+ id
+ ACE_ENV_ARG_PARAMETER);
+
+ this->consumer_admin_ = this->event_channel_->new_for_consumers(CosNotifyChannelAdmin::OR_OP, adminID);
+
+ CosNotification::EventTypeSeq added(1);
+ CosNotification::EventTypeSeq removed (0);
+ added.length (1);
+ removed.length (0);
+
+ added[0].domain_name = CORBA::string_dup ("*");
+ added[0].type_name = CORBA::string_dup ("*");
+
+ this->consumer_admin_->subscription_change (added, removed ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_NEW_THROW_EX (this->notifier_,
+ NotifyLogNotification(this->event_channel_.in ()),
+ CORBA::NO_MEMORY ());
+}
+
+NotifyLogFactory_i::~NotifyLogFactory_i()
+{
+ // No-Op.
+}
+
+DsNotifyLogAdmin::NotifyLogFactory_ptr
+NotifyLogFactory_i::activate (PortableServer::POA_ptr poa//,
+ ACE_ENV_ARG_DECL)
+{
+ DsNotifyLogAdmin::NotifyLogFactory_var v_return;
+
+ PortableServer::ObjectId_var oid =
+ poa->activate_object (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ CORBA::Object_var obj =
+ poa->id_to_reference (oid.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ // narrow and store the result..
+ this->log_mgr_ =
+ DsLogAdmin::LogMgr::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ v_return =
+ DsNotifyLogAdmin::NotifyLogFactory::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsNotifyLogAdmin::NotifyLogFactory::_nil ());
+
+ return v_return._retn ();
+}
+
+DsNotifyLogAdmin::NotifyLog_ptr
+NotifyLogFactory_i::create (
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_rec_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds,
+ const CosNotification::QoSProperties & initial_qos,
+ const CosNotification::AdminProperties & initial_admin,
+ DsLogAdmin::LogId_out id//,
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold,
+ CosNotification::UnsupportedQoS,
+ CosNotification::UnsupportedAdmin
+ ))
+{
+ // Get an id for this Log.
+ this->max_id_++;
+
+ DsNotifyLogAdmin::NotifyLog_ptr notifylog =
+ this->create_with_id (this->max_id_,
+ full_action,
+ max_rec_size,
+ thresholds,
+ initial_qos,
+ initial_admin
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsNotifyLogAdmin::NotifyLog::_nil ());
+
+ // Set the id to return..
+ id = this->max_id_;
+
+ // Store the id in the LogIdList.
+ CORBA::ULong len = logid_list_.length();
+ logid_list_.length(len+1);
+ logid_list_[len] = id;
+
+ return notifylog;
+}
+
+DsNotifyLogAdmin::NotifyLog_ptr
+NotifyLogFactory_i::create_with_id (
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds,
+ const CosNotification::QoSProperties & initial_qos,
+ const CosNotification::AdminProperties & initial_admin
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogIdAlreadyExists,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold,
+ CosNotification::UnsupportedQoS,
+ CosNotification::UnsupportedAdmin
+ ))
+{
+ ACE_UNUSED_ARG (initial_qos);
+
+ ACE_UNUSED_ARG (initial_admin);
+
+ ACE_UNUSED_ARG (thresholds);
+
+ // Make sure the id not used up.
+ if (hash_map_.find (id) == 0)
+ ACE_THROW_RETURN (DsLogAdmin::LogIdAlreadyExists (),
+ DsNotifyLogAdmin::NotifyLog::_nil ());
+
+ DsNotifyLogAdmin::NotifyLog_var notify_log;
+ // Object to return.
+
+ NotifyLog_i* notify_log_i;
+
+ ACE_NEW_THROW_EX (notify_log_i,
+ NotifyLog_i (*this,
+ this->log_mgr_.in (),
+ this,
+ this->notify_factory_.in (),
+ this->notifier_,
+ id,
+ full_action,
+ max_size
+ ),
+ CORBA::NO_MEMORY ());
+
+ ACE_CHECK_RETURN (notify_log._retn ());
+
+ auto_ptr<NotifyLog_i> notify_log_auto (notify_log_i);
+ // just in case the activation fails.
+
+ notify_log_i->init (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (notify_log._retn ());
+
+ //initialise the LogConsumer object
+ notify_log_i->activate();
+
+ // Register with the poa
+ notify_log = notify_log_i->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (notify_log._retn ());
+
+ notify_log_i->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (DsNotifyLogAdmin::NotifyLog::_nil ());
+
+ // widening a BasicLog_var to a Log_var.
+ DsLogAdmin::Log_var log = DsNotifyLogAdmin::NotifyLog::_duplicate(notify_log.in ());
+
+ // Add to the Hash table..
+ if (hash_map_.bind (id, log) == -1)
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ DsNotifyLogAdmin::NotifyLog::_nil ());
+
+ // All is well, release the reference.
+ notify_log_auto.release ();
+ notifier_->object_creation (ACE_static_cast(DsLogAdmin::Log*, log.in ()), id);
+ return notify_log._retn ();
+}
+
+CosNotifyChannelAdmin::AdminID
+NotifyLogFactory_i::MyID (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->MyID();
+}
+
+CosNotifyChannelAdmin::EventChannel_ptr
+NotifyLogFactory_i::MyChannel (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ throw CORBA_NO_IMPLEMENT();
+}
+
+CosNotifyChannelAdmin::InterFilterGroupOperator
+NotifyLogFactory_i::MyOperator (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->MyOperator();
+}
+
+CosNotifyFilter::MappingFilter_ptr
+NotifyLogFactory_i::priority_filter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->priority_filter();
+}
+
+void
+NotifyLogFactory_i::priority_filter (CosNotifyFilter::MappingFilter_ptr filter ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ consumer_admin_->priority_filter(filter);
+}
+
+CosNotifyFilter::MappingFilter_ptr
+NotifyLogFactory_i::lifetime_filter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->lifetime_filter();
+}
+
+void
+NotifyLogFactory_i::lifetime_filter (CosNotifyFilter::MappingFilter_ptr filter ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ consumer_admin_->lifetime_filter(filter);
+}
+
+CosNotifyChannelAdmin::ProxyIDSeq*
+NotifyLogFactory_i::pull_suppliers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->pull_suppliers();
+}
+
+CosNotifyChannelAdmin::ProxyIDSeq*
+NotifyLogFactory_i::push_suppliers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->push_suppliers();
+}
+
+CosNotifyChannelAdmin::ProxySupplier_ptr
+NotifyLogFactory_i::get_proxy_supplier (
+ CosNotifyChannelAdmin::ProxyID proxy_id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::ProxyNotFound,
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->get_proxy_supplier(proxy_id);
+}
+
+CosNotifyChannelAdmin::ProxySupplier_ptr
+NotifyLogFactory_i::obtain_notification_pull_supplier (
+ CosNotifyChannelAdmin::ClientType ctype,
+ CosNotifyChannelAdmin::ProxyID& proxy_id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::AdminLimitExceeded,
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->obtain_notification_pull_supplier(ctype, proxy_id);
+}
+
+CosNotifyChannelAdmin::ProxySupplier_ptr
+NotifyLogFactory_i::obtain_notification_push_supplier (
+ CosNotifyChannelAdmin::ClientType ctype,
+ CosNotifyChannelAdmin::ProxyID& proxy_id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::AdminLimitExceeded,
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->obtain_notification_push_supplier(ctype, proxy_id);
+}
+
+
+
+
+CosEventChannelAdmin::ProxyPushSupplier_ptr
+NotifyLogFactory_i::obtain_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->obtain_push_supplier();
+}
+
+
+
+CosEventChannelAdmin::ProxyPullSupplier_ptr
+NotifyLogFactory_i::obtain_pull_supplier (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+
+{
+ return consumer_admin_->obtain_pull_supplier();
+}
+
+void
+NotifyLogFactory_i::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ // No-Op.
+}
+
+//CosNotifyComm::NotifySubscribe
+void
+NotifyLogFactory_i::subscription_change (const CosNotification::EventTypeSeq& added,
+ const CosNotification::EventTypeSeq& removed
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyComm::InvalidEventType,
+ CORBA::SystemException
+ ))
+{
+ consumer_admin_->subscription_change(added, removed);
+}
+
+CosNotification::QoSProperties*
+NotifyLogFactory_i::get_qos (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->get_qos();
+}
+
+void
+NotifyLogFactory_i::set_qos (const CosNotification::QoSProperties& qos ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedQoS,
+ CORBA::SystemException
+ ))
+{
+ consumer_admin_->set_qos(qos);
+}
+
+void
+NotifyLogFactory_i::validate_qos (const CosNotification::QoSProperties& required_qos,
+ CosNotification::NamedPropertyRangeSeq_out available_qos
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedQoS,
+ CORBA::SystemException
+ ))
+{
+ consumer_admin_->validate_qos(required_qos, available_qos);
+}
+
+CosNotifyFilter::FilterID
+NotifyLogFactory_i::add_filter (CosNotifyFilter::Filter_ptr filter ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->add_filter(filter);
+}
+
+void
+NotifyLogFactory_i::remove_filter (CosNotifyFilter::FilterID id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ consumer_admin_->remove_filter(id);
+}
+
+CosNotifyFilter::Filter_ptr
+NotifyLogFactory_i::get_filter (CosNotifyFilter::FilterID id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyFilter::FilterNotFound,
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->get_filter(id);
+}
+
+CosNotifyFilter::FilterIDSeq*
+NotifyLogFactory_i::get_all_filters (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->get_all_filters();
+}
+
+void
+NotifyLogFactory_i::remove_all_filters (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ consumer_admin_->remove_all_filters();
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class auto_ptr <NotifyLog_i>;
+template class ACE_Auto_Basic_Ptr<NotifyLog_i>;
+
+#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate auto_ptr <NotifyLog_i>
+#pragma instantiate ACE_Auto_Notify_Ptr <NotifyLog_i>
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Log/NotifyLogFactory_i.h b/TAO/orbsvcs/orbsvcs/Log/NotifyLogFactory_i.h
new file mode 100644
index 00000000000..5789ea42d86
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/NotifyLogFactory_i.h
@@ -0,0 +1,263 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// NotifyLogFactory_i.h
+//
+// = DESCRIPTION
+// Implements the Factory for NotifyLog Objects.
+//
+// = AUTHOR
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_NOTIFYLOGFACTORY_I_H
+#define TLS_NOTIFYLOGFACTORY_I_H
+
+#include "orbsvcs/DsNotifyLogAdminS.h"
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/Log/LogMgr_i.h"
+#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h"
+#include "NotifyLog_i.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class NotifyLog_i;
+class NotifyLogNotification;
+
+class TAO_NotifyLog_Export NotifyLogFactory_i :
+ public POA_DsNotifyLogAdmin::NotifyLogFactory,
+ public LogMgr_i
+{
+ // = TITLE
+ // EventLogFactory_i
+ // = DESCRIPTION
+ // Implementation of the EventLogFactory interface.
+ //
+public:
+ //= Initialization and termination code.
+ NotifyLogFactory_i (void);
+ // Ctor
+
+ NotifyLogFactory_i (CosNotifyChannelAdmin::EventChannelFactory_ptr ecf ACE_ENV_ARG_DECL);
+
+ ~NotifyLogFactory_i ();
+ // Dtor
+
+ DsNotifyLogAdmin::NotifyLogFactory_ptr
+ activate (PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL);
+ // Activate this servant with the POA passed in.
+
+ DsNotifyLogAdmin::NotifyLog_ptr create (
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds,
+ const CosNotification::QoSProperties & initial_qos,
+ const CosNotification::AdminProperties & initial_admin,
+ DsLogAdmin::LogId_out id//,
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold,
+ CosNotification::UnsupportedQoS,
+ CosNotification::UnsupportedAdmin
+ ));
+
+ DsNotifyLogAdmin::NotifyLog_ptr create_with_id (
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds,
+ const CosNotification::QoSProperties & initial_qos,
+ const CosNotification::AdminProperties & initial_admin
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogIdAlreadyExists,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold,
+ CosNotification::UnsupportedQoS,
+ CosNotification::UnsupportedAdmin
+ ));
+ // Same as create (), but allows clients to specify the id.
+
+
+ CosNotifyChannelAdmin::AdminID MyID (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::EventChannel_ptr MyChannel (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::InterFilterGroupOperator MyOperator (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyFilter::MappingFilter_ptr priority_filter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ void priority_filter (CosNotifyFilter::MappingFilter_ptr ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyFilter::MappingFilter_ptr lifetime_filter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ void lifetime_filter (CosNotifyFilter::MappingFilter_ptr ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::ProxyIDSeq* pull_suppliers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ CosNotifyChannelAdmin::ProxyIDSeq* push_suppliers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::ProxySupplier_ptr get_proxy_supplier (
+ CosNotifyChannelAdmin::ProxyID proxy_id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::ProxyNotFound,
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::ProxySupplier_ptr obtain_notification_pull_supplier (
+ CosNotifyChannelAdmin::ClientType ctype,
+ CosNotifyChannelAdmin::ProxyID& proxy_id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::AdminLimitExceeded,
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::ProxySupplier_ptr obtain_notification_push_supplier (
+ CosNotifyChannelAdmin::ClientType ctype,
+ CosNotifyChannelAdmin::ProxyID& id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::AdminLimitExceeded,
+ CORBA::SystemException
+ ));
+
+ // might just work
+ CosEventChannelAdmin::ProxyPushSupplier_ptr obtain_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosEventChannelAdmin::ProxyPullSupplier_ptr obtain_pull_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ void destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ //CosNotifyComm::NotifySubscribe
+ void subscription_change (const CosNotification::EventTypeSeq& added,
+ const CosNotification::EventTypeSeq& removed
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyComm::InvalidEventType,
+ CORBA::SystemException
+ ));
+
+ //CosNotification::QoSAdmin
+ CosNotification::QoSProperties* get_qos (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ void set_qos (const CosNotification::QoSProperties& ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedQoS,
+ CORBA::SystemException
+ ));
+ void validate_qos (const CosNotification::QoSProperties&,
+ CosNotification::NamedPropertyRangeSeq_out
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedQoS,
+ CORBA::SystemException
+ ));
+
+ //CosNotifyFilter::FilterAdmin
+ CosNotifyFilter::FilterID add_filter (CosNotifyFilter::Filter_ptr ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ void remove_filter (CosNotifyFilter::FilterID ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ CosNotifyFilter::Filter_ptr get_filter (CosNotifyFilter::FilterID ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyFilter::FilterNotFound,
+ CORBA::SystemException
+ ));
+ CosNotifyFilter::FilterIDSeq* get_all_filters (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ void remove_all_filters (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+protected:
+ DsLogAdmin::LogMgr_var log_mgr_;
+ // Our object ref. after <active>ation.
+
+ CosNotifyChannelAdmin::ChannelID channel_id_;
+
+ CosNotifyChannelAdmin::EventChannel_var event_channel_;
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+
+ CosEventChannelAdmin::EventChannel_var es_event_channel_;
+
+ CosEventChannelAdmin::ConsumerAdmin_var es_consumer_admin_;
+
+ NotifyLogNotification* notifier_;
+
+ CosNotifyChannelAdmin::EventChannelFactory_var notify_factory_;
+
+ PortableServer::POA_var poa_;
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TLS_NOTIFYLOGFACTORY_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp b/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp
new file mode 100644
index 00000000000..5092f791477
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.cpp
@@ -0,0 +1,78 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/LogNotification.h"
+#include "orbsvcs/Log/NotifyLogNotification.h"
+#include "orbsvcs/Time_Utilities.h"
+#include "tao/debug.h"
+
+NotifyLogNotification::NotifyLogNotification (CosNotifyChannelAdmin::EventChannel_ptr ec)
+: LogNotification (), event_channel_ (CosNotifyChannelAdmin::EventChannel::_duplicate (ec))
+{
+
+ CosNotifyComm::PushSupplier_var objref =
+ this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ ACE_ASSERT (!CORBA::is_nil (objref.in ()));
+
+ CosNotifyChannelAdmin::AdminID adminID;
+ CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin =
+ this->event_channel_->new_for_suppliers (CosNotifyChannelAdmin::OR_OP, adminID);
+
+ ACE_ASSERT (!CORBA::is_nil (supplier_admin.in ()));
+
+ CosNotifyChannelAdmin::ProxyConsumer_var proxyconsumer =
+ supplier_admin->obtain_notification_push_consumer (CosNotifyChannelAdmin::ANY_EVENT, proxy_consumer_id_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (proxyconsumer.in ()));
+
+ // narrow
+ this->proxy_consumer_ =
+ CosNotifyChannelAdmin::ProxyPushConsumer::_narrow (proxyconsumer.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ()));
+
+ proxy_consumer_->connect_any_push_supplier (objref.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+NotifyLogNotification::~NotifyLogNotification (void)
+{
+ // No-Op.
+}
+
+void
+NotifyLogNotification::send_notification (const CORBA::Any& any)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ this->proxy_consumer_->push (any);
+}
+
+void
+NotifyLogNotification::subscription_change
+ (const CosNotification::EventTypeSeq & /*added*/,
+ const CosNotification::EventTypeSeq & /*removed */
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType
+ ))
+{
+ //No-Op.
+}
+
+void
+NotifyLogNotification::disconnect_push_supplier
+ (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ ACE_ASSERT (!CORBA::is_nil (this->proxy_consumer_.in ()));
+
+ this->proxy_consumer_->disconnect_push_consumer(ACE_ENV_SINGLE_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.h b/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.h
new file mode 100644
index 00000000000..4f18e3125df
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/NotifyLogNotification.h
@@ -0,0 +1,96 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// NotifyLogNotification_i.h
+//
+// = DESCRIPTION
+// Implementation of Log generated events for NotifyLog.
+//
+// = AUTHOR
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_NOTIFY_LOG_NOTIFICATION_H
+#define TLS_NOTIFY_LOG_NOTIFICATION_H
+#include "ace/pre.h"
+
+#include "orbsvcs/DsNotifyLogAdminS.h"
+#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h"
+#include "orbsvcs/Notify/Notify_EventChannel_i.h"
+#include "orbsvcs/CosEventCommS.h"
+#include "orbsvcs/CosNotifyChannelAdminS.h"
+#include "orbsvcs/CosNotifyCommC.h"
+#include "orbsvcs/CosNamingC.h"
+
+#include "notifylog_export.h"
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+class TAO_NotifyLog_Export NotifyLogNotification : public LogNotification,
+ public POA_CosNotifyComm::PushSupplier, public PortableServer::RefCountServantBase
+{
+ // = TITLE
+ // Used to forward log generated events to a logging server
+ //
+ // = DESCRIPTION
+ // This implementation attempts to conform to the telecom
+ // logging specification.
+
+public:
+ // = Initialization and Termination
+ NotifyLogNotification (CosNotifyChannelAdmin::EventChannel_ptr);
+ // Constructor.
+
+ ~NotifyLogNotification (void);
+ // Destructor.
+
+protected:
+ // = Helper methods
+ // = Data members
+ CosNotifyChannelAdmin::ProxyPushConsumer_var proxy_consumer_;
+ // The proxy that we are connected to.
+
+ CosNotifyChannelAdmin::ProxyID proxy_consumer_id_;
+ // This supplier's id.
+
+ // = NotifySubscribe
+ virtual void subscription_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType
+ ));
+
+ // = StructuredPushSupplier method
+ virtual void disconnect_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual void send_notification (const CORBA::Any& any)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+ // Send the event on the event channel.
+
+
+private:
+ CORBA::ORB_var orb_;
+
+ CosNotifyChannelAdmin::EventChannel_var event_channel_;
+};
+#include "ace/post.h"
+#endif /* TLS_NOTIFY_LOG_NOTIFICATION_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/NotifyLog_i.cpp b/TAO/orbsvcs/orbsvcs/Log/NotifyLog_i.cpp
new file mode 100644
index 00000000000..b325a37ec8f
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/NotifyLog_i.cpp
@@ -0,0 +1,471 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/NotifyLog_i.h"
+#include "orbsvcs/Log/LogMgr_i.h"
+#include "orbsvcs/Log/LogNotification.h"
+
+#define CA_FILTER "threshold > 10"
+#define TCL_GRAMMAR "TCL"
+
+LogConsumer::LogConsumer (NotifyLog_i *log)
+: log_ (log)
+{
+ // No-Op.
+}
+
+LogConsumer::~LogConsumer (void)
+{
+ // No-Op.
+}
+
+void
+LogConsumer::connect (CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin)
+{
+ // Activate the consumer with the default_POA_
+ CosNotifyComm::StructuredPushConsumer_var objref =
+ this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ CosNotifyChannelAdmin::ProxySupplier_var proxysupplier =
+ consumer_admin->obtain_notification_push_supplier (CosNotifyChannelAdmin::STRUCTURED_EVENT, proxy_supplier_id_ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (proxysupplier.in ()));
+
+ // narrow
+ this->proxy_supplier_ =
+ CosNotifyChannelAdmin::StructuredProxyPushSupplier::
+ _narrow (proxysupplier.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (proxy_supplier_.in ()));
+
+ proxy_supplier_->connect_structured_push_consumer (objref.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+}
+
+void
+LogConsumer::disconnect (ACE_ENV_SINGLE_ARG_DECL)
+{
+ this->proxy_supplier_->
+ disconnect_structured_push_supplier(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+LogConsumer::offer_change
+ (const CosNotification::EventTypeSeq & /*added*/,
+ const CosNotification::EventTypeSeq & /*removed*/
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType
+ ))
+{
+ // No-Op.
+}
+
+void
+LogConsumer::push_structured_event
+ (const CosNotification::StructuredEvent & notification
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ))
+{
+ CORBA::Long val;
+
+ notification.remainder_of_body >>= val;
+
+ CORBA::Any any;
+
+ any <<= val;
+
+ // create a record list...
+ DsLogAdmin::RecordList recList (1);
+ recList.length (1);
+
+ recList [0].info = any;
+
+ this->log_->write_recordlist (recList ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+LogConsumer::disconnect_structured_push_consumer
+ (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ // No-Op.
+}
+
+NotifyLog_i::NotifyLog_i (LogMgr_i &logmgr_i,
+ DsLogAdmin::LogMgr_ptr factory,
+ NotifyLogFactory_i *notify_log_factory,
+ CosNotifyChannelAdmin::EventChannelFactory_ptr ecf,
+ LogNotification *log_notifier,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType log_full_action,
+ CORBA::ULongLong max_size,
+ ACE_Reactor *reactor)
+ : Log_i (factory, id, log_notifier, log_full_action, max_size, reactor),
+ logmgr_i_(logmgr_i), notify_factory_ (CosNotifyChannelAdmin::EventChannelFactory::_duplicate (ecf))
+{
+ ACE_UNUSED_ARG (notify_log_factory);
+
+ ACE_ENV_SINGLE_ARG_DECL
+
+ CosNotifyChannelAdmin::ChannelID channel_id;
+
+ CosNotification::QoSProperties initial_qos;
+ CosNotification::AdminProperties initial_admin;
+
+
+ ACE_ASSERT (!CORBA::is_nil (this->notify_factory_.in ()));
+
+ this->event_channel_ =
+ this->notify_factory_->create_channel (initial_qos,
+ initial_admin,
+ channel_id
+ ACE_ENV_ARG_PARAMETER);
+}
+
+NotifyLog_i::~NotifyLog_i ()
+{
+ // No-Op.
+}
+
+DsLogAdmin::Log_ptr
+NotifyLog_i::copy (DsLogAdmin::LogId &id)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ DsNotifyLogAdmin::NotifyLogFactory_var notifyLogFactory =
+ DsNotifyLogAdmin::NotifyLogFactory::_narrow (factory_.in ());
+
+ CosNotification::QoSProperties* qos = get_qos ();
+ CosNotification::AdminProperties* admin = get_admin ();
+
+ DsNotifyLogAdmin::NotifyLog_var log =
+ notifyLogFactory->create (DsLogAdmin::halt, 0, thresholds_, ACE_static_cast(const CosNotification::QoSProperties, *qos),
+ ACE_static_cast(const CosNotification::AdminProperties, *admin), id);
+
+ copy_attributes (log.in ());
+
+ return log._retn ();
+}
+
+DsLogAdmin::Log_ptr
+NotifyLog_i::copy_with_id (DsLogAdmin::LogId id)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ DsNotifyLogAdmin::NotifyLogFactory_var notifyLogFactory =
+ DsNotifyLogAdmin::NotifyLogFactory::_narrow (factory_.in ());
+
+ CosNotification::QoSProperties* qos = get_qos ();
+ CosNotification::AdminProperties* admin = get_admin ();
+
+ DsNotifyLogAdmin::NotifyLog_var log =
+ notifyLogFactory->create_with_id (id, DsLogAdmin::halt, 0, thresholds_, ACE_static_cast(const CosNotification::QoSProperties, *qos),
+ ACE_static_cast(const CosNotification::AdminProperties, *admin));
+
+ copy_attributes (log.in ());
+
+ return log._retn ();
+}
+
+
+void
+NotifyLog_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ notifier_->object_deletion (logid_);
+ // Remove ourselves from the list of logs.
+ this->logmgr_i_.remove (this->logid_); // check for error?
+
+ // Deregister with POA.
+ PortableServer::POA_var poa =
+ this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::ObjectId_var id =
+ poa->servant_to_id (this//,
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ poa->deactivate_object (id.in ()//,
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+NotifyLog_i::activate (void)
+{
+ ACE_ENV_SINGLE_ARG_DECL
+
+ CosNotifyChannelAdmin::AdminID adminid = 0;
+ CosNotifyChannelAdmin::InterFilterGroupOperator ifgop =
+ CosNotifyChannelAdmin::OR_OP;
+
+ this->consumer_admin_ =
+ this->event_channel_->new_for_consumers (ifgop, adminid ACE_ENV_ARG_PARAMETER);
+ ACE_ASSERT (!CORBA::is_nil (consumer_admin_.in ()));
+
+ CosNotifyFilter::FilterFactory_var ffact =
+ this->event_channel_->default_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // setup a filter at the consumer admin
+ CosNotifyFilter::Filter_var ca_filter =
+ ffact->create_filter (TCL_GRAMMAR ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (!CORBA::is_nil (ca_filter.in ()));
+
+ CosNotifyFilter::ConstraintExpSeq constraint_list (1);
+ constraint_list.length (1);
+
+ constraint_list[0].event_types.length (0);
+ constraint_list[0].constraint_expr = CORBA::string_dup (CA_FILTER);
+
+ ca_filter->add_constraints (constraint_list ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ consumer_admin_->add_filter (ca_filter.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ // Setup the CA to receive all type of events
+ CosNotification::EventTypeSeq added(1);
+ CosNotification::EventTypeSeq removed (0);
+ added.length (1);
+ removed.length (0);
+
+ added[0].domain_name = CORBA::string_dup ("*");
+ added[0].type_name = CORBA::string_dup ("*");
+
+ this->consumer_admin_->subscription_change (added, removed ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_NEW_THROW_EX (this->my_log_consumer_,
+ LogConsumer (this),
+ CORBA::NO_MEMORY ());
+
+ this->my_log_consumer_->connect (this->consumer_admin_.in ());
+}
+
+//IDL to C++
+CosNotifyFilter::Filter_ptr
+NotifyLog_i::get_filter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ //TODO: need to add impl
+ //dummy impl to get it to compile
+ CosNotifyFilter::Filter_ptr filter;
+ return filter;
+}
+
+void
+NotifyLog_i::set_filter (CosNotifyFilter::Filter_ptr filter ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ ACE_UNUSED_ARG (filter);
+
+ //TODO: need to add impl
+}
+
+CosNotifyChannelAdmin::EventChannelFactory_ptr
+NotifyLog_i::MyFactory (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ //TODO: need to add impl
+ //dummy impl to compile
+ CosNotifyChannelAdmin::EventChannelFactory_ptr ecf;
+ return ecf;
+}
+
+CosNotifyChannelAdmin::ConsumerAdmin_ptr
+NotifyLog_i::default_consumer_admin (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->default_consumer_admin();
+}
+
+CosNotifyChannelAdmin::SupplierAdmin_ptr
+NotifyLog_i::default_supplier_admin (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->default_supplier_admin();
+}
+
+CosNotifyFilter::FilterFactory_ptr
+NotifyLog_i::default_filter_factory (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->default_filter_factory();
+}
+
+CosNotifyChannelAdmin::ConsumerAdmin_ptr
+NotifyLog_i::new_for_consumers (CosNotifyChannelAdmin::InterFilterGroupOperator op,
+ CosNotifyChannelAdmin::AdminID& id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->new_for_consumers(op,id);
+}
+
+CosNotifyChannelAdmin::SupplierAdmin_ptr
+NotifyLog_i::new_for_suppliers (CosNotifyChannelAdmin::InterFilterGroupOperator op,
+ CosNotifyChannelAdmin::AdminID& id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->new_for_suppliers(op,id);
+}
+
+CosNotifyChannelAdmin::ConsumerAdmin_ptr
+NotifyLog_i::get_consumeradmin (CosNotifyChannelAdmin::AdminID id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::AdminNotFound,
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->get_consumeradmin(id);
+}
+
+CosNotifyChannelAdmin::SupplierAdmin_ptr
+NotifyLog_i::get_supplieradmin (CosNotifyChannelAdmin::AdminID id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::AdminNotFound,
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->get_supplieradmin(id);
+}
+
+CosNotifyChannelAdmin::AdminIDSeq*
+NotifyLog_i::get_all_consumeradmins (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->get_all_consumeradmins();
+}
+
+CosNotifyChannelAdmin::AdminIDSeq*
+NotifyLog_i::get_all_supplieradmins (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->get_all_supplieradmins();
+}
+
+CosNotification::AdminProperties*
+NotifyLog_i::get_admin (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->get_admin();
+}
+
+void
+NotifyLog_i::set_admin (const CosNotification::AdminProperties& admin ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedAdmin,
+ CORBA::SystemException
+ ))
+{
+ this->event_channel_->set_admin(admin);
+}
+
+CosNotification::QoSProperties*
+NotifyLog_i::get_qos (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ //need to add merging of QoS from Log_i and EventChannel_i
+ CosNotification::QoSProperties* temp;
+ return temp;
+}
+
+void
+NotifyLog_i::set_qos (const CosNotification::QoSProperties& qos ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedQoS,
+ CORBA::SystemException
+ ))
+{
+ ACE_UNUSED_ARG (qos);
+
+ //TODO: need to add later
+}
+
+void
+NotifyLog_i::validate_qos (const CosNotification::QoSProperties& required_qos,
+ CosNotification::NamedPropertyRangeSeq_out available_qos ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedQoS,
+ CORBA::SystemException
+ ))
+{
+ ACE_UNUSED_ARG (required_qos);
+
+ ACE_UNUSED_ARG (available_qos);
+
+ //TODO: need to add later
+}
+
+CosEventChannelAdmin::ConsumerAdmin_ptr
+NotifyLog_i::for_consumers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->for_consumers(ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+CosEventChannelAdmin::SupplierAdmin_ptr
+NotifyLog_i::for_suppliers (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->for_suppliers(ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+NotifyLog_i::write_recordlist (const DsLogAdmin::RecordList & list//,
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ DsLogAdmin::LogFull,
+ DsLogAdmin::LogLocked
+ ))
+{
+ Log_i::write_recordlist (list ACE_ENV_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/orbsvcs/Log/NotifyLog_i.h b/TAO/orbsvcs/orbsvcs/Log/NotifyLog_i.h
new file mode 100644
index 00000000000..5491849c90d
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/NotifyLog_i.h
@@ -0,0 +1,287 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// NotifyLog_i.h
+//
+// = DESCRIPTION
+// Implementation of the DsNotifyLogAdmin::NotifyLog interface.
+//
+// = AUTHOR
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_NOTIFYLOG_I_H
+#define TLS_NOTIFYLOG_I_H
+
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/DsNotifyLogAdminS.h"
+#include "orbsvcs/Log/Log_i.h"
+#include "orbsvcs/Notify/Notify_EventChannel_i.h"
+
+#include "notifylog_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class LogMgr_i;
+class NotifyLog_i;
+class NotifyLogFactory_i;
+
+// Bug in MSVC 5, See KB article Q167350
+#if defined (_MSC_VER) && (_MSC_VER == 1100)
+using DsLogAdmin::wrap;
+#endif /* (_MSC_VER) && (_MSC_VER == 1100) */
+
+class LogConsumer : public virtual POA_CosNotifyComm::StructuredPushConsumer,
+ public PortableServer::RefCountServantBase
+{
+public:
+ LogConsumer (NotifyLog_i *log);
+
+ void connect (CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin ACE_ENV_ARG_DECL);
+
+ virtual void disconnect (ACE_ENV_SINGLE_ARG_DECL);
+
+protected:
+ virtual ~LogConsumer (void);
+
+ // = NotifyPublish method
+ virtual void offer_change (
+ const CosNotification::EventTypeSeq & added,
+ const CosNotification::EventTypeSeq & removed
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosNotifyComm::InvalidEventType
+ ));
+
+ // = StructuredPushSupplier methods
+ virtual void push_structured_event (
+ const CosNotification::StructuredEvent & notification
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ CosEventComm::Disconnected
+ ));
+
+ virtual void disconnect_structured_push_consumer (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxy_supplier_;
+
+ CosNotifyChannelAdmin::ProxyID proxy_supplier_id_;
+
+ NotifyLog_i *log_;
+};
+
+class NotifyLog_i : public Log_i,
+ public POA_DsNotifyLogAdmin::NotifyLog,
+ public virtual PortableServer::RefCountServantBase
+{
+ // = TITLE
+ // EventLog_i
+ // = DESCRIPTION
+ // The class supports the <destroy> method to destroy the Log.
+ //
+public:
+ // = Initialization and Termination.
+ NotifyLog_i (LogMgr_i &logmgr_i,
+ DsLogAdmin::LogMgr_ptr factory,
+ NotifyLogFactory_i *notify_log_factory,
+ CosNotifyChannelAdmin::EventChannelFactory_ptr ecf,
+ LogNotification *log_notifier,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType log_full_action = DsLogAdmin::wrap,
+ CORBA::ULongLong max_size = 0,
+ ACE_Reactor *reactor = ACE_Reactor::instance ());
+ // Constructor
+
+ ~NotifyLog_i ();
+ // Destructor.
+
+ virtual DsLogAdmin::Log_ptr copy (DsLogAdmin::LogId &id)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual DsLogAdmin::Log_ptr copy_with_id (DsLogAdmin::LogId id)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ void
+ destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Destroy the log object and all contained records.
+
+ void
+ activate (void);
+
+ //IDL to C++
+ CosNotifyFilter::Filter_ptr
+ get_filter (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ void set_filter (CosNotifyFilter::Filter_ptr filter)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::EventChannelFactory_ptr
+ MyFactory (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::ConsumerAdmin_ptr
+ default_consumer_admin (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::SupplierAdmin_ptr
+ default_supplier_admin (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyFilter::FilterFactory_ptr
+ default_filter_factory (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::ConsumerAdmin_ptr
+ new_for_consumers (CosNotifyChannelAdmin::InterFilterGroupOperator op,
+ CosNotifyChannelAdmin::AdminID& id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::SupplierAdmin_ptr
+ new_for_suppliers (CosNotifyChannelAdmin::InterFilterGroupOperator op,
+ CosNotifyChannelAdmin::AdminID& id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::ConsumerAdmin_ptr
+ get_consumeradmin (CosNotifyChannelAdmin::AdminID id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::AdminNotFound,
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::SupplierAdmin_ptr
+ get_supplieradmin (CosNotifyChannelAdmin::AdminID id ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotifyChannelAdmin::AdminNotFound,
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::AdminIDSeq*
+ get_all_consumeradmins (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotifyChannelAdmin::AdminIDSeq*
+ get_all_supplieradmins (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosNotification::AdminProperties*
+ get_admin (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ void set_admin (const CosNotification::AdminProperties& admin ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedAdmin,
+ CORBA::SystemException
+ ));
+
+ CosNotification::QoSProperties*
+ get_qos (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ void set_qos (const CosNotification::QoSProperties& ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedQoS,
+ CORBA::SystemException
+ ));
+
+ void validate_qos (const CosNotification::QoSProperties&,
+ CosNotification::NamedPropertyRangeSeq_out ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CosNotification::UnsupportedQoS,
+ CORBA::SystemException
+ ));
+
+ CosEventChannelAdmin::ConsumerAdmin_ptr
+ for_consumers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ CosEventChannelAdmin::SupplierAdmin_ptr
+ for_suppliers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ void write_recordlist (const DsLogAdmin::RecordList & list
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogFull,
+ DsLogAdmin::LogLocked
+ ));
+
+protected:
+ LogMgr_i &logmgr_i_;
+ // Used to access the hash map that holds all the Logs created.
+
+private:
+ LogConsumer *my_log_consumer_;
+
+ CosNotifyChannelAdmin::EventChannel_var event_channel_;
+
+ CosNotifyChannelAdmin::ChannelID channelID_;
+
+ CosNotifyChannelAdmin::EventChannelFactory_var notify_factory_;
+
+ CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin_;
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TLS_NOTIFYLOG_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp b/TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp
new file mode 100644
index 00000000000..de761361190
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/PersistStore.cpp
@@ -0,0 +1,197 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Time_Utilities.h"
+#include "PersistStore.h"
+
+PersistStore::PersistStore (CORBA::ULongLong max_size,
+ CORBA::ULong max_rec_list_len)
+ : maxid_ (0),
+ max_size_ (max_size),
+ current_size_ (0),
+ num_records_ (0),
+ max_rec_list_len_ (max_rec_list_len)
+{
+ // No-Op.
+}
+
+PersistStore::~PersistStore (void)
+{
+ // No-Op.
+}
+
+int
+PersistStore::open (const char * file_name)
+{
+ // Open the persistent log file for writing.
+ this->write_persistent_file_ = ACE_OS::open (file_name,
+ O_RDWR | O_CREAT | O_TRUNC,
+ ACE_DEFAULT_FILE_PERMS);
+
+ if (ACE_static_cast(int,this->write_persistent_file_) == -1) {
+ perror ("open:write");
+ return -1;
+ }
+
+ // Open the persistnet log file for reading.
+ this->read_persistent_file_ = ACE_OS::open (file_name,
+ O_RDONLY);
+
+ if (ACE_static_cast(int,this->write_persistent_file_) == -1) {
+ perror ("open:read");
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+PersistStore::close (void)
+{
+ ACE_OS::close (this->write_persistent_file_);
+
+ return ACE_OS::close (this->read_persistent_file_);
+}
+
+// TODO: make these inline ..
+CORBA::ULongLong
+PersistStore::get_max_size (void)
+{
+ return max_size_;
+}
+
+void
+PersistStore::set_max_size (CORBA::ULongLong size)
+{
+ this->max_size_ = size;
+}
+
+CORBA::ULongLong
+PersistStore::get_current_size (void)
+{
+ return this->current_size_;
+}
+
+CORBA::ULongLong
+PersistStore::get_n_records (void)
+{
+ return this->num_records_;
+}
+
+// inline ...
+
+int
+PersistStore::log (DsLogAdmin::LogRecord &rec)
+{
+ CORBA::TypeCode_ptr tc;
+ ACE_Message_Block *mb;
+ struct PersistentData data;
+ char *rd_ptr;
+
+ // Check if we are allowed to write...
+ if (max_size_ !=0 && current_size_ >= max_size_)
+ return 1; // return code for log rec. full
+
+ // Acquire the mutex so that no other client can write to the log
+ write_lock_.acquire();
+
+ // Initialize a couple of fields first...
+ // ACE emulation of U Long Long (for platforms that don't have one)
+ // does not define postfix operators
+ rec.id = ++maxid_;
+
+ ORBSVCS_Time::Time_Value_to_TimeT(rec.time,ACE_OS::gettimeofday());
+
+ // Extract the typecode and message block from the record.
+ tc = rec.info.type ();
+ mb = rec.info._tao_get_cdr (); // TAO extension
+ data.byte_order = rec.info._tao_byte_order ();
+
+ // Get a pointer to the actual data in the ACE_Message_Block.
+ rd_ptr = mb->rd_ptr ();
+
+ // Get the size of the actual data in the ACE_Message_Block.
+ data.mb_size = mb->length ();
+
+ // Store the first chunk of persistent data.
+ // Get the kind of the CORBA::Any stored in the record.
+ data.id = rec.id;
+ data.time = rec.time;
+ data.kind = tc->kind ();
+
+ // Write the first block of information to the file.
+ ACE_OS::write (this->write_persistent_file_, (void*)&data, sizeof (PersistentData));
+ this->current_size_ += sizeof (PersistentData);
+
+ // Write the typecode to the file.
+ ACE_OS::write (this->write_persistent_file_, (void*) tc, sizeof (CORBA::TypeCode));
+ this->current_size_ += sizeof (CORBA::TypeCode);
+
+ // Write the actual message block data to the file.
+ ACE_OS::write (this->write_persistent_file_, (void*) rd_ptr, data.mb_size);
+ this->current_size_ += data.mb_size;
+
+ // Unlock the mutex
+ write_lock_.release();
+
+ // Increment the number of records in the log
+ ++(this->num_records_);
+
+ // Debug print: # of records and current size in bytes
+// cout << "Log now has " << this->num_records_ ;
+// cout << " records using " << this->current_size_ << " bytes" << endl;
+
+ return 0;
+}
+
+int
+PersistStore::retrieve (DsLogAdmin::RecordId id, DsLogAdmin::LogRecord &rec)
+{
+ CORBA::TypeCode_var tc;
+ char *mb_data = NULL;
+ int retval = -1;
+ struct PersistentData data;
+
+ // Move to the beginning of the file.
+ ACE_OS::lseek (this->read_persistent_file_, 0, SEEK_SET);
+
+ while (read (ACE_static_cast(int,this->write_persistent_file_),
+ (void*) &data,
+ sizeof (PersistentData)) > 0)
+ {
+ tc = new CORBA::TypeCode (data.kind);
+
+ read (ACE_static_cast(int,this->write_persistent_file_), (void*) tc.in (), sizeof (CORBA::TypeCode));
+
+ mb_data = new char[data.mb_size];
+ read (ACE_static_cast(int,this->write_persistent_file_), (void*) mb_data, data.mb_size);
+
+ // Check to see if this id matches.
+ if (id == data.id)
+ {
+ // Create the message block.
+ ACE_Message_Block mb2 (mb_data, data.mb_size);
+
+ // Set the write pointer
+ mb2.wr_ptr (data.mb_size);
+
+ rec.id = id;
+ rec.time = data.time;
+ rec.info = CORBA::Any (tc.in (), 0, data.byte_order, &mb2);
+
+ retval = 1;
+ break;
+ }
+ }
+
+ return retval;
+}
+
+unsigned short
+PersistStore::get_percentage_full (void)
+{
+ // If the log size is unlimited, return 0
+ if (this->max_size_ == 0)
+ return 0;
+
+ return (100*this->current_size_/this->max_size_);
+}
diff --git a/TAO/orbsvcs/orbsvcs/Log/PersistStore.h b/TAO/orbsvcs/orbsvcs/Log/PersistStore.h
new file mode 100644
index 00000000000..eee4a06b1bd
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/PersistStore.h
@@ -0,0 +1,121 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// PersistStore.h
+//
+// = DESCRIPTION
+// This flat file demonstrates basic persistence.
+//
+//
+// = AUTHORS
+// Rob Ruff <rruff@scires.com>
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef PERSIST_STORE_H
+#define PERSIST_STORE_H
+
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/DsLogAdminC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#define PERSIST_LOG_DEFAULT_MAX_REC_LIST_LEN 250
+
+struct PersistentData
+{
+ DsLogAdmin::RecordId id;
+ DsLogAdmin::TimeT time;
+ CORBA::TCKind kind;
+ int byte_order;
+ size_t mb_size;
+};
+
+class TAO_Log_Export PersistStore
+{
+ // = TITLE
+ // A class for storing DsLogAdmin::LogRecord *'s
+ //
+ // = Description
+ // This implementation is to serve for illustration purposes.
+
+ public:
+ // = Initialization and termination methods
+
+ PersistStore (CORBA::ULongLong max_size = 0,
+ CORBA::ULong max_rec_list_len
+ = PERSIST_LOG_DEFAULT_MAX_REC_LIST_LEN);
+ // Constructor
+
+ ~PersistStore (void);
+ // Destructor
+
+ int open (const char * file_name);
+ // Initialization.
+
+ int close (void);
+ // Close the record store.
+
+ // = LogRecordStore status methods
+
+ CORBA::ULongLong get_max_size (void);
+ // Get the current set value of the max size of the log data.
+
+ void set_max_size (CORBA::ULongLong size);
+ // Set the max size of log data. size == 0, => infinite.
+
+ CORBA::ULongLong get_current_size (void);
+ // Gets the current size of the log data.
+
+ CORBA::ULongLong get_n_records (void);
+ // Get the number of records in the log right now.
+
+ // = Record logging, retrieval, update and removal methods
+
+ int log (DsLogAdmin::LogRecord &rec);
+ // Insert rec into storage. Returns 0 on success -1 on failure and 1
+ // if the log is full
+
+ int retrieve (DsLogAdmin::RecordId id, DsLogAdmin::LogRecord &rec);
+ // Set rec to the pointer to the LogRecord with the given
+ // id. Returns 0 on success, -1 on failure
+
+ unsigned short get_percentage_full (void);
+ // Return the percentage of the max space that is currently being used,
+ // If size is infinite, return 0.
+
+ protected:
+
+ DsLogAdmin::RecordId maxid_;
+ // Assigned to a new RecordId and then incremented
+
+ CORBA::ULongLong max_size_;
+ // The maximum size of the log.
+
+ CORBA::ULongLong current_size_;
+ // The current size (in bytes) of the log
+
+ CORBA::ULongLong num_records_;
+ // The current number of records in the log
+
+ CORBA::ULong max_rec_list_len_;
+ // The max size of the record list returned in a query.
+
+ ACE_HANDLE write_persistent_file_;
+ ACE_HANDLE read_persistent_file_;
+ // The file descriptor for the persistent log storage file.
+
+ ACE_Mutex write_lock_;
+ // Lock the log operation
+};
+
+#endif /*PERSIST_STORE_H*/
diff --git a/TAO/orbsvcs/orbsvcs/Log/RTEventLogFactory_i.cpp b/TAO/orbsvcs/orbsvcs/Log/RTEventLogFactory_i.cpp
new file mode 100644
index 00000000000..921f338b032
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/RTEventLogFactory_i.cpp
@@ -0,0 +1,289 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/RTEventLogFactory_i.h"
+#include "ace/Auto_Ptr.h"
+#include "orbsvcs/Log/LogNotification.h"
+#include "orbsvcs/Log/RTEventLogNotification.h"
+#include "orbsvcs/Event/EC_ConsumerAdmin.h"
+#include "orbsvcs/Event/EC_ProxySupplier.h"
+#include "orbsvcs/Event/EC_ProxyConsumer.h"
+#include "orbsvcs/Event/EC_Event_Channel.h"
+#include "orbsvcs/ESF/ESF_Peer_Workers.h"
+#include "orbsvcs/ESF/ESF_Peer_Admin.h"
+#include "orbsvcs/ESF/ESF_Shutdown_Proxy.h"
+#include "orbsvcs/Event/EC_ConsumerAdmin.h"
+#include "orbsvcs/Event_Utilities.h"
+#include "orbsvcs/Sched/Config_Scheduler.h"
+#include "orbsvcs/Event/Module_Factory.h"
+#include "orbsvcs/Event/Event_Channel.h"
+#include "orbsvcs/Event/EC_Default_Factory.h"
+#include "orbsvcs/Event/EC_Event_Channel.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "orbsvcs/Event/EC_ConsumerAdmin.i"
+#endif /* __ACE_INLINE__ */
+
+RTEventLogFactory_i::RTEventLogFactory_i (void)
+: poa_ (PortableServer::POA::_nil ()),
+naming_ (CosNaming::NamingContext::_nil ())
+{
+ // No-Op.
+}
+
+RTEventLogFactory_i::~RTEventLogFactory_i()
+{
+ // No-Op.
+}
+
+int
+RTEventLogFactory_i::init (PortableServer::POA_ptr poa,
+ const char* child_poa_name,
+ CosNaming::NamingContext_ptr naming
+ ACE_ENV_ARG_DECL)
+{
+ if (CORBA::is_nil (poa))
+ return -1;
+
+ this->naming_ = CosNaming::NamingContext::_duplicate (naming);
+ // Save the naming context.
+
+ // Create a UNIQUE_ID and USER_ID policy because we want the POA
+ // to detect duplicates for us.
+ PortableServer::IdUniquenessPolicy_var idpolicy =
+ poa->create_id_uniqueness_policy (PortableServer::UNIQUE_ID
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ PortableServer::IdAssignmentPolicy_var assignpolicy =
+ poa->create_id_assignment_policy (PortableServer::USER_ID
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Create a PolicyList
+ CORBA::PolicyList policy_list;
+ policy_list.length (0);
+// TODO : Problem with these policies.
+/* policy_list [0] =
+ PortableServer::IdUniquenessPolicy::_duplicate (idpolicy.in ());
+ policy_list [1] =
+ PortableServer::IdAssignmentPolicy::_duplicate (assignpolicy.in ());
+*/
+ PortableServer::POAManager_ptr manager =
+ poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ // @@ Pradeep : TODO - find a way to destroy the policy_list if we return here.
+
+ // Create the child POA.
+ this->poa_ = poa->create_POA (child_poa_name,
+ manager,
+ policy_list
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK_RETURN (-1);
+
+ idpolicy->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ assignpolicy->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ //this->poa_ = PortableServer::POA::_duplicate (poa);
+ // uncomment this if we want to use the parent poa for some reason.
+
+ PortableServer::POA_var defPOA = this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ TAO_EC_Event_Channel_Attributes attr (defPOA.in (), defPOA.in ());
+
+ this->impl = 0;
+ ACE_NEW_THROW_EX (impl,
+ TAO_EC_Event_Channel (attr),
+ CORBA::NO_MEMORY ());
+ ACE_TRY_CHECK;
+
+ auto_ptr <TAO_EC_Event_Channel> ec (impl);
+
+ impl->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableServer::ObjectId_var oidec = poa_->activate_object (ec.get ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ec.release ();
+
+ CORBA::Object_var objec =
+ poa_->id_to_reference (oidec.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->event_channel_ = RtecEventChannelAdmin::EventChannel::_narrow (objec.in ());
+
+
+ this->consumer_admin_ = this->event_channel_->for_consumers(ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ ACE_NEW_THROW_EX (this->notifier_,
+ RTEventLogNotification(this->event_channel_.in ()),
+ CORBA::NO_MEMORY ());
+ return 0;
+}
+
+RTEventLogAdmin::EventLogFactory_ptr
+RTEventLogFactory_i::activate (PortableServer::POA_ptr poa//,
+ ACE_ENV_ARG_DECL)
+{
+ RTEventLogAdmin::EventLogFactory_var v_return;
+
+ PortableServer::ObjectId_var oid =
+ poa->activate_object (this//,
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ CORBA::Object_var obj =
+ poa->id_to_reference (oid.in ()//,
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ // narrow and store the result..
+ this->log_mgr_ =
+ DsLogAdmin::LogMgr::_narrow (obj.in ()//,
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (v_return._retn ());
+
+ v_return =
+ RTEventLogAdmin::EventLogFactory::_narrow (obj.in ()//,
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (RTEventLogAdmin::EventLogFactory::_nil ());
+
+ return v_return._retn ();
+}
+
+RTEventLogAdmin::EventLog_ptr
+RTEventLogFactory_i::create (
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_rec_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds,
+ DsLogAdmin::LogId_out id//,
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold
+ ))
+{
+ // Get an id for this Log.
+ this->max_id_++;
+
+ RTEventLogAdmin::EventLog_ptr eventlog =
+ this->create_with_id (this->max_id_,
+ full_action,
+ max_rec_size,
+ thresholds//,
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (RTEventLogAdmin::EventLog::_nil ());
+
+ // Set the id to return..
+ id = this->max_id_;
+
+ // Store the id in the LogIdList.
+ CORBA::ULong len = logid_list_.length();
+ logid_list_.length(len+1);
+ logid_list_[len] = id;
+
+ return eventlog;
+}
+
+RTEventLogAdmin::EventLog_ptr
+RTEventLogFactory_i::create_with_id (
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds//,
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogIdAlreadyExists,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold
+ ))
+{
+ ACE_UNUSED_ARG (thresholds);
+
+ // Make sure the id not used up.
+ if (hash_map_.find (id) == 0)
+ ACE_THROW_RETURN (DsLogAdmin::LogIdAlreadyExists (),
+ RTEventLogAdmin::EventLog::_nil ());
+
+ RTEventLogAdmin::EventLog_var event_log;
+ // Object to return.
+
+ RTEventLog_i* event_log_i;
+
+ ACE_NEW_THROW_EX (event_log_i,
+ RTEventLog_i (*this,
+ this->log_mgr_.in (),
+ this,
+ this->notifier_,
+ id,
+ full_action,
+ max_size
+ ),
+ CORBA::NO_MEMORY ());
+
+ ACE_CHECK_RETURN (event_log._retn ());
+
+ auto_ptr<RTEventLog_i> event_log_auto (event_log_i);
+ // just in case the activation fails.
+
+ event_log_i->init (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (event_log._retn ());
+
+ //initialise the LogConsumer object
+ event_log_i->activate();
+
+ // Register with the poa
+ event_log = event_log_i->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (event_log._retn ());
+
+ event_log_i->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (RTEventLogAdmin::EventLog::_nil ());
+
+ // widening a BasicLog_var to a Log_var.
+ DsLogAdmin::Log_var log = RTEventLogAdmin::EventLog::_duplicate(event_log.in ());
+
+ // Add to the Hash table..
+ if (hash_map_.bind (id, log) == -1)
+ ACE_THROW_RETURN (CORBA::INTERNAL (),
+ RTEventLogAdmin::EventLog::_nil ());
+
+ // All is well, release the reference.
+ event_log_auto.release ();
+
+ notifier_->object_creation (ACE_static_cast(DsLogAdmin::Log*, log.in ()), id);
+
+ return event_log._retn ();
+}
+
+RtecEventChannelAdmin::ProxyPushSupplier_ptr
+RTEventLogFactory_i::obtain_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return consumer_admin_->obtain_push_supplier();
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class auto_ptr <RTEventLog_i>;
+template class ACE_Auto_Basic_Ptr<RTEventLog_i>;
+
+#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate auto_ptr <RTEventLog_i>
+#pragma instantiate ACE_Auto_Event_Ptr <RTEventLog_i>
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/Log/RTEventLogFactory_i.h b/TAO/orbsvcs/orbsvcs/Log/RTEventLogFactory_i.h
new file mode 100644
index 00000000000..511d7a956a6
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/RTEventLogFactory_i.h
@@ -0,0 +1,132 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// RTEventLogFactory_i.h
+//
+// = DESCRIPTION
+// Implements the Factory for RTEventLog Objects.
+//
+// = AUTHOR
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_RTEVENTLOGFACTORY_I_H
+#define TLS_RTEVENTLOGFACTORY_I_H
+
+#include "orbsvcs/RTEventLogAdminS.h"
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/Log/LogMgr_i.h"
+#include "orbsvcs/RtecEventChannelAdminS.h"
+#include "orbsvcs/RtecSchedulerS.h"
+#include "RTEventLog_i.h"
+#include "orbsvcs/CosNamingC.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+#include "rteventlog_export.h"
+
+class RTEventLog_i;
+class RTEventLogNotification;
+
+class TAO_RTEventLog_Export RTEventLogFactory_i :
+ public POA_RTEventLogAdmin::EventLogFactory,
+ public LogMgr_i
+{
+ // = TITLE
+ // EventLogFactory_i
+ // = DESCRIPTION
+ // Implementation of the EventLogFactory interface.
+ //
+public:
+ //= Initialization and termination code.
+ RTEventLogFactory_i (void);
+ // Ctor
+
+ ~RTEventLogFactory_i ();
+ // Dtor
+
+ int
+ init (PortableServer::POA_ptr poa,
+ const char* child_poa_name,
+ CosNaming::NamingContext_ptr naming = CosNaming::NamingContext::_nil ()
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+
+ RTEventLogAdmin::EventLogFactory_ptr
+ activate (PortableServer::POA_ptr poa
+ ACE_ENV_ARG_DECL);
+ // Activate this servant with the POA passed in.
+
+ RTEventLogAdmin::EventLog_ptr create (
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds,
+ DsLogAdmin::LogId_out id
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold
+ ));
+
+ RTEventLogAdmin::EventLog_ptr create_with_id (
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType full_action,
+ CORBA::ULongLong max_size,
+ const DsLogAdmin::CapacityAlarmThresholdList & thresholds
+ ACE_ENV_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogIdAlreadyExists,
+ DsLogAdmin::InvalidLogFullAction,
+ DsLogAdmin::InvalidThreshold
+ ));
+ // Same as create (), but allows clients to specify the id.
+
+ RtecEventChannelAdmin::ProxyPushSupplier_ptr obtain_push_supplier (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+protected:
+ DsLogAdmin::LogMgr_var log_mgr_;
+
+ TAO_EC_Event_Channel *impl;
+ // The event channel used for log generated events.
+
+ RTEventLogNotification* notifier_;
+
+ RtecEventChannelAdmin::EventChannel_var event_channel_;
+
+ RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin_;
+
+ PortableServer::POA_var poa_;
+ // The POA with which we activate all the EventLogs.
+
+ CosNaming::NamingContext_var naming_;
+ // The naming context to use.
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TLS_RTEVENTLOGFACTORY_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/RTEventLogNotification.cpp b/TAO/orbsvcs/orbsvcs/Log/RTEventLogNotification.cpp
new file mode 100644
index 00000000000..aea7510defe
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/RTEventLogNotification.cpp
@@ -0,0 +1,78 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/LogNotification.h"
+#include "orbsvcs/Log/RTEventLogNotification.h"
+#include "orbsvcs/Time_Utilities.h"
+#include "tao/debug.h"
+#include "orbsvcs/orbsvcs/Event_Utilities.h"
+#include "orbsvcs/RtecEventChannelAdminC.h"
+#include "orbsvcs/Event_Service_Constants.h"
+#include "orbsvcs/ESF/ESF_Peer_Workers.h"
+#include "orbsvcs/ESF/ESF_Peer_Admin.h"
+#include "orbsvcs/ESF/ESF_Shutdown_Proxy.h"
+#include "orbsvcs/Event/EC_ProxySupplier.h"
+#include "orbsvcs/Event/EC_Dispatching.h"
+#include "orbsvcs/Event/EC_Filter_Builder.h"
+#include "orbsvcs/Event/EC_QOS_Info.h"
+#include "orbsvcs/Event/EC_Event_Channel.h"
+#include "orbsvcs/Event/EC_Scheduling_Strategy.h"
+#include "orbsvcs/Event/EC_ConsumerControl.h"
+#include "orbsvcs/ESF/ESF_RefCount_Guard.h"
+#include "orbsvcs/ESF/ESF_Proxy_RefCount_Guard.h"
+
+RTEventLogNotification::RTEventLogNotification (RtecEventChannelAdmin::EventChannel_ptr ec)
+: LogNotification (), event_channel_ (RtecEventChannelAdmin::EventChannel::_duplicate (ec))
+{
+ obtainProxyConsumer ();
+}
+
+RTEventLogNotification::~RTEventLogNotification (void)
+{
+ // No-Op.
+}
+
+void
+RTEventLogNotification::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // No-Op.
+}
+
+void
+RTEventLogNotification::obtainProxyConsumer()
+{
+ RtecEventChannelAdmin::SupplierAdmin_var supplier_admin =
+ event_channel_->for_suppliers();
+
+ consumer_ = supplier_admin->obtain_push_consumer();
+
+ RtecEventComm::PushSupplier_var supplier =
+ this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ // Simple publication, but usually the helper classes in
+ // $TAO_ROOT/orbsvcs/Event_Utils.h are a better way to do this.
+ RtecEventChannelAdmin::SupplierQOS qos;
+ qos.publications.length (1);
+ RtecEventComm::EventHeader& h0 =
+ qos.publications[0].event.header;
+ h0.type = ACE_ES_EVENT_UNDEFINED; // first free event type
+ h0.source = 1; // first free event source
+
+ consumer_->connect_push_supplier (supplier.in(), qos);
+}
+
+void
+RTEventLogNotification::send_notification (const CORBA::Any& any)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ RtecEventComm::EventSet event (1);
+ event.length (1);
+ event[0].header.type = ACE_ES_EVENT_UNDEFINED;
+ event[0].header.source = 1;
+ event[0].header.ttl = 1;
+ event[0].data.any_value <<= any;
+
+ consumer_->push(event);
+}
+
+
diff --git a/TAO/orbsvcs/orbsvcs/Log/RTEventLogNotification.h b/TAO/orbsvcs/orbsvcs/Log/RTEventLogNotification.h
new file mode 100644
index 00000000000..c895eaeef0c
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/RTEventLogNotification.h
@@ -0,0 +1,78 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// RTEventLogNotification_i.h
+//
+// = DESCRIPTION
+// Implementation of Log generated events for RTEventLog.
+//
+// = AUTHOR
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_RTEVENT_LOG_NOTIFICATION_H
+#define TLS_RTEVENT_LOG_NOTIFICATION_H
+#include "ace/pre.h"
+
+#include "orbsvcs/Event/EC_ConsumerAdmin.h"
+#include "orbsvcs/Event/EC_Event_Channel.h"
+#include "orbsvcs/RTEventLogAdminS.h"
+#include "orbsvcs/Event/EC_Default_Factory.h"
+#include "orbsvcs/RtecEventCommS.h"
+#include "orbsvcs/Event/EC_ProxySupplier.h"
+#include "orbsvcs/Event/EC_ProxyConsumer.h"
+
+#include "rteventlog_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+class TAO_RTEventLog_Export RTEventLogNotification : public LogNotification,
+ POA_RtecEventComm::PushSupplier
+{
+ // = TITLE
+ // Used to forward log generated events to a logging server
+ //
+ // = DESCRIPTION
+ // This implementation attempts to conform to the telecom
+ // logging specification.
+
+public:
+ // = Initialization and Termination
+ RTEventLogNotification (RtecEventChannelAdmin::EventChannel_ptr);
+ // Constructor.
+
+ ~RTEventLogNotification (void);
+ // Destructor.
+
+ virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // The skeleton methods.
+
+
+protected:
+ // = Helper methods
+
+ void obtainProxyConsumer ();
+
+ virtual void send_notification (const CORBA::Any& any)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Send the event on the event channel.
+
+
+private:
+ CORBA::ORB_var orb_;
+
+ RtecEventChannelAdmin::EventChannel_var event_channel_;
+
+ RtecEventChannelAdmin::ProxyPushConsumer_var consumer_;
+};
+#include "ace/post.h"
+#endif /* TLS_RTEVENT_LOG_NOTIFICATION_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/RTEventLog_i.cpp b/TAO/orbsvcs/orbsvcs/Log/RTEventLog_i.cpp
new file mode 100644
index 00000000000..b91be58a68f
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/RTEventLog_i.cpp
@@ -0,0 +1,215 @@
+/* -*- C++ -*- $Id$ */
+
+#include "orbsvcs/Log/RTEventLog_i.h"
+#include "orbsvcs/Log/LogMgr_i.h"
+#include "orbsvcs/Log/LogNotification.h"
+#include "orbsvcs/orbsvcs/Event_Utilities.h"
+
+#include "orbsvcs/Event/EC_Event_Channel.h"
+#include "orbsvcs/Event/EC_Default_Factory.h"
+#include "orbsvcs/Event/EC_Dispatching.h"
+#include "orbsvcs/Event/EC_ConsumerAdmin.h"
+#include "orbsvcs/Event/EC_SupplierAdmin.h"
+#include "orbsvcs/Event/EC_Timeout_Generator.h"
+#include "orbsvcs/Event/EC_ObserverStrategy.h"
+#include "orbsvcs/Event/EC_ConsumerControl.h"
+#include "orbsvcs/Event/EC_SupplierControl.h"
+#include "ace/Dynamic_Service.h"
+
+LogConsumer::LogConsumer (RTEventLog_i *log)
+: log_ (log)
+{
+ // No-Op.
+}
+
+LogConsumer::~LogConsumer (void)
+{
+ // No-Op.
+}
+
+void
+LogConsumer::connect (RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin)
+{
+ RtecEventComm::PushConsumer_var myself = this->_this ();
+ this->supplier_proxy_ = consumer_admin->obtain_push_supplier ();
+
+ ACE_ConsumerQOS_Factory qos;
+ qos.start_disjunction_group (1);
+ qos.insert_type (ACE_ES_EVENT_ANY,
+ 0);
+ this->supplier_proxy_->connect_push_consumer (myself.in(), qos.get_ConsumerQOS ());
+}
+
+void
+LogConsumer::push (const RtecEventComm::EventSet& events ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // create a record list...
+ DsLogAdmin::RecordList recList (1);
+ recList.length (1);
+
+ recList [0].info <<= events;
+
+ this->log_->write_recordlist (recList ACE_ENV_ARG_PARAMETER);
+
+ ACE_CHECK;
+
+}
+
+void
+LogConsumer::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->supplier_proxy_->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+RTEventLog_i::RTEventLog_i (LogMgr_i &logmgr_i,
+ DsLogAdmin::LogMgr_ptr factory,
+ RTEventLogFactory_i *event_log_factory,
+ LogNotification *log_notifier,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType log_full_action,
+ CORBA::ULongLong max_size,
+ ACE_Reactor *reactor)
+ : Log_i (factory, id, log_notifier, log_full_action, max_size, reactor),
+ logmgr_i_(logmgr_i)
+{
+ ACE_UNUSED_ARG (event_log_factory);
+
+ ACE_ENV_SINGLE_ARG_DECL
+
+ PortableServer::POA_var poa = this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ TAO_EC_Event_Channel_Attributes attr (poa.in(), poa.in());
+
+ ACE_NEW_THROW_EX (this->event_channel_,
+ TAO_EC_Event_Channel(attr),
+ CORBA::NO_MEMORY ());
+}
+
+RTEventLog_i::~RTEventLog_i ()
+{
+ // No-Op.
+}
+
+
+DsLogAdmin::Log_ptr
+RTEventLog_i::copy (DsLogAdmin::LogId &id)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ RTEventLogAdmin::EventLogFactory_var eventLogFactory =
+ RTEventLogAdmin::EventLogFactory::_narrow (factory_.in ());
+
+ RTEventLogAdmin::EventLog_var log =
+ eventLogFactory->create (DsLogAdmin::halt, 0, thresholds_, id);
+
+ copy_attributes (log.in ());
+
+ return log._retn ();
+
+}
+
+DsLogAdmin::Log_ptr
+RTEventLog_i::copy_with_id (DsLogAdmin::LogId id)
+ ACE_THROW_SPEC ((DsLogAdmin::LogIdAlreadyExists, CORBA::SystemException))
+{
+ RTEventLogAdmin::EventLogFactory_var eventLogFactory =
+ RTEventLogAdmin::EventLogFactory::_narrow (factory_.in ());
+
+ RTEventLogAdmin::EventLog_var log =
+ eventLogFactory->create_with_id (id, DsLogAdmin::halt, 0, thresholds_);
+
+ copy_attributes (log.in ());
+
+ return log._retn ();
+}
+
+void
+RTEventLog_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+
+ notifier_->object_deletion (logid_);
+
+ // Remove ourselves from the list of logs.
+ this->logmgr_i_.remove (this->logid_); // check for error?
+
+ // Deregister with POA.
+ PortableServer::POA_var poa =
+ this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+
+ PortableServer::ObjectId_var id =
+ poa->servant_to_id (this
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ poa->deactivate_object (id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+RTEventLog_i::activate (void)
+{
+ ACE_ENV_SINGLE_ARG_DECL
+
+ RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin =
+ this->event_channel_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ this->my_log_consumer_ = new LogConsumer (this);
+ this->my_log_consumer_->connect (consumer_admin.in ());
+}
+
+RtecEventChannelAdmin::ConsumerAdmin_ptr
+RTEventLog_i::for_consumers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return this->event_channel_->for_consumers(ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+RtecEventChannelAdmin::SupplierAdmin_ptr
+RTEventLog_i::for_suppliers (
+ ACE_ENV_SINGLE_ARG_DECL
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ return this->event_channel_->for_suppliers(ACE_ENV_SINGLE_ARG_PARAMETER);
+}
+
+void
+RTEventLog_i::write_recordlist (const DsLogAdmin::RecordList & list//,
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ DsLogAdmin::LogFull,
+ DsLogAdmin::LogLocked
+ ))
+{
+ Log_i::write_recordlist (list ACE_ENV_ARG_PARAMETER);
+}
+
+RtecEventChannelAdmin::Observer_Handle
+RTEventLog_i::append_observer (
+ RtecEventChannelAdmin::Observer_ptr observer
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR,
+ RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER))
+{
+ return this->observer_strategy_->append_observer (observer ACE_ENV_ARG_PARAMETER);
+}
+
+void
+RTEventLog_i::remove_observer (
+ RtecEventChannelAdmin::Observer_Handle handle
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR,
+ RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER))
+{
+ this->observer_strategy_->remove_observer (handle ACE_ENV_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/orbsvcs/Log/RTEventLog_i.h b/TAO/orbsvcs/orbsvcs/Log/RTEventLog_i.h
new file mode 100644
index 00000000000..0900ed0d573
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/RTEventLog_i.h
@@ -0,0 +1,157 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+// = LIBRARY
+// orbsvcs
+//
+// = FILENAME
+// RTEventLog_i.h
+//
+// = DESCRIPTION
+// Implementation of the RTLogAdmin::EventLog interface.
+//
+// = AUTHOR
+// D A Hanvey <d.hanvey@qub.ac.uk>
+//
+// ============================================================================
+
+#ifndef TLS_RTEVENTLOG_I_H
+#define TLS_RTEVENTLOG_I_H
+
+#include "orbsvcs/DsLogAdminS.h"
+#include "orbsvcs/RTEventLogAdminS.h"
+#include "orbsvcs/Log/Log_i.h"
+#include "orbsvcs/Event/EC_Event_Channel.h"
+#include "orbsvcs/orbsvcs/Event/EC_Factory.h"
+#include "orbsvcs/orbsvcs/Event/EC_Defaults.h"
+
+#include "rteventlog_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+class LogMgr_i;
+class RTEventLog_i;
+class RTEventLogFactory_i;
+
+// Bug in MSVC 5, See KB article Q167350
+#if defined (_MSC_VER) && (_MSC_VER == 1100)
+using DsLogAdmin::wrap;
+#endif /* (_MSC_VER) && (_MSC_VER == 1100) */
+
+class LogConsumer : public virtual POA_RtecEventComm::PushConsumer
+{
+public:
+ LogConsumer (RTEventLog_i *log);
+ ~LogConsumer (void);
+
+ void
+ connect (RtecEventChannelAdmin::ConsumerAdmin_ptr consumer_admin);
+
+private:
+ void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ void push (const RtecEventComm::EventSet& events ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_;
+
+ RTEventLog_i *log_;
+};
+
+class TAO_RTEventLog_Export RTEventLog_i : public Log_i,
+ public POA_RTEventLogAdmin::EventLog,
+ public virtual PortableServer::RefCountServantBase
+{
+ // = TITLE
+ // EventLog_i
+ // = DESCRIPTION
+ // The class supports the <destroy> method to destroy the Log.
+ //
+public:
+ // = Initialization and Termination.
+ RTEventLog_i (LogMgr_i &logmgr_i,
+ DsLogAdmin::LogMgr_ptr factory,
+ RTEventLogFactory_i *event_log_factory,
+ LogNotification *log_notifier,
+ DsLogAdmin::LogId id,
+ DsLogAdmin::LogFullActionType log_full_action = DsLogAdmin::wrap,
+ CORBA::ULongLong max_size = 0,
+ ACE_Reactor *reactor = ACE_Reactor::instance ());
+ // Constructor
+
+ ~RTEventLog_i ();
+ // Destructor.
+
+ virtual DsLogAdmin::Log_ptr copy (DsLogAdmin::LogId &id)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual DsLogAdmin::Log_ptr copy_with_id (DsLogAdmin::LogId id)
+ ACE_THROW_SPEC ((DsLogAdmin::LogIdAlreadyExists, CORBA::SystemException));
+
+ void
+ destroy (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Destroy the log object and all contained records.
+
+ void
+ activate (void);
+
+ RtecEventChannelAdmin::ConsumerAdmin_ptr
+ for_consumers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ RtecEventChannelAdmin::SupplierAdmin_ptr
+ for_suppliers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual RtecEventChannelAdmin::Observer_Handle
+ append_observer (RtecEventChannelAdmin::Observer_ptr
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR,
+ RtecEventChannelAdmin::EventChannel::CANT_APPEND_OBSERVER));
+ virtual void
+ remove_observer (RtecEventChannelAdmin::Observer_Handle
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR,
+ RtecEventChannelAdmin::EventChannel::CANT_REMOVE_OBSERVER));
+
+
+ void write_recordlist (const DsLogAdmin::RecordList & list
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ DsLogAdmin::LogFull,
+ DsLogAdmin::LogLocked
+ ));
+
+ protected:
+ LogMgr_i &logmgr_i_;
+ // Used to access the hash map that holds all the Logs created.
+ private:
+ TAO_EC_Event_Channel *event_channel_;
+
+ LogConsumer *my_log_consumer_;
+
+ /// The observer strategy
+ TAO_EC_ObserverStrategy *observer_strategy_;
+};
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* TLS_RTEVENTLOG_I_H */
diff --git a/TAO/orbsvcs/orbsvcs/Log/eventlog_export.h b/TAO/orbsvcs/orbsvcs/Log/eventlog_export.h
new file mode 100644
index 00000000000..2b21d1f4463
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/eventlog_export.h
@@ -0,0 +1,37 @@
+/* -*- C++ -*- $Id$ */
+// generate_export_file.pl,v 1.8 2001/03/04 09:16:29 nanbor Exp
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_EVENTLOG_EXPORT_H
+#define TAO_EVENTLOG_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_EVENTLOG_HAS_DLL)
+# define TAO_EVENTLOG_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_EVENTLOG_HAS_DLL */
+
+#if !defined (TAO_EVENTLOG_HAS_DLL)
+# define TAO_EVENTLOG_HAS_DLL 1
+#endif /* ! TAO_EVENTLOG_HAS_DLL */
+
+#if defined (TAO_EVENTLOG_HAS_DLL) && (TAO_EVENTLOG_HAS_DLL == 1)
+# if defined (TAO_EVENTLOG_BUILD_DLL)
+# define TAO_EventLog_Export ACE_Proper_Export_Flag
+# define TAO_EVENTLOG_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_EVENTLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_EVENTLOG_BUILD_DLL */
+# define TAO_EventLog_Export ACE_Proper_Import_Flag
+# define TAO_EVENTLOG_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_EVENTLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_EVENTLOG_BUILD_DLL */
+#else /* TAO_EVENTLOG_HAS_DLL == 1 */
+# define TAO_EventLog_Export
+# define TAO_EVENTLOG_SINGLETON_DECLARATION(T)
+# define TAO_EVENTLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_EVENTLOG_HAS_DLL == 1 */
+
+#endif /* TAO_EVENTLOG_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/orbsvcs/orbsvcs/Log/log_export.h b/TAO/orbsvcs/orbsvcs/Log/log_export.h
index ca24dcc7abd..97ea3366e3e 100644
--- a/TAO/orbsvcs/orbsvcs/Log/log_export.h
+++ b/TAO/orbsvcs/orbsvcs/Log/log_export.h
@@ -1,6 +1,5 @@
-
-// -*- C++ -*-
-// $Id$
+/* -*- C++ -*- $Id$ */
+// log_export.h,v 1.2 2000/10/10 22:16:02 nanbor Exp
// Definition for Win32 Export directives.
// This file is generated automatically by generate_export_file.pl
// ------------------------------
diff --git a/TAO/orbsvcs/orbsvcs/Log/notifylog_export.h b/TAO/orbsvcs/orbsvcs/Log/notifylog_export.h
new file mode 100644
index 00000000000..c9f1d99ef4e
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/notifylog_export.h
@@ -0,0 +1,37 @@
+/* -*- C++ -*- $Id$ */
+// generate_export_file.pl,v 1.8 2001/03/04 09:16:29 nanbor Exp
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_NOTIFYLOG_EXPORT_H
+#define TAO_NOTIFYLOG_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_NOTIFYLOG_HAS_DLL)
+# define TAO_NOTIFYLOG_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_NOTIFYLOG_HAS_DLL */
+
+#if !defined (TAO_NOTIFYLOG_HAS_DLL)
+# define TAO_NOTIFYLOG_HAS_DLL 1
+#endif /* ! TAO_NOTIFYLOG_HAS_DLL */
+
+#if defined (TAO_NOTIFYLOG_HAS_DLL) && (TAO_NOTIFYLOG_HAS_DLL == 1)
+# if defined (TAO_NOTIFYLOG_BUILD_DLL)
+# define TAO_NotifyLog_Export ACE_Proper_Export_Flag
+# define TAO_NOTIFYLOG_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_NOTIFYLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_NOTIFYLOG_BUILD_DLL */
+# define TAO_NotifyLog_Export ACE_Proper_Import_Flag
+# define TAO_NOTIFYLOG_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_NOTIFYLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_NOTIFYLOG_BUILD_DLL */
+#else /* TAO_NOTIFYLOG_HAS_DLL == 1 */
+# define TAO_NotifyLog_Export
+# define TAO_NOTIFYLOG_SINGLETON_DECLARATION(T)
+# define TAO_NOTIFYLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_NOTIFYLOG_HAS_DLL == 1 */
+
+#endif /* TAO_NOTIFYLOG_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/orbsvcs/orbsvcs/Log/rteventlog_export.h b/TAO/orbsvcs/orbsvcs/Log/rteventlog_export.h
new file mode 100644
index 00000000000..9ad106e8d33
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Log/rteventlog_export.h
@@ -0,0 +1,37 @@
+/* -*- C++ -*- $Id$ */
+// generate_export_file.pl,v 1.8 2001/03/04 09:16:29 nanbor Exp
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef TAO_RTEVENTLOG_EXPORT_H
+#define TAO_RTEVENTLOG_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_RTEVENTLOG_HAS_DLL)
+# define TAO_RTEVENTLOG_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_RTEVENTLOG_HAS_DLL */
+
+#if !defined (TAO_RTEVENTLOG_HAS_DLL)
+# define TAO_RTEVENTLOG_HAS_DLL 1
+#endif /* ! TAO_RTEVENTLOG_HAS_DLL */
+
+#if defined (TAO_RTEVENTLOG_HAS_DLL) && (TAO_RTEVENTLOG_HAS_DLL == 1)
+# if defined (TAO_RTEVENTLOG_BUILD_DLL)
+# define TAO_RTEventLog_Export ACE_Proper_Export_Flag
+# define TAO_RTEVENTLOG_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_RTEVENTLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_RTEVENTLOG_BUILD_DLL */
+# define TAO_RTEventLog_Export ACE_Proper_Import_Flag
+# define TAO_RTEVENTLOG_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_RTEVENTLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_RTEVENTLOG_BUILD_DLL */
+#else /* TAO_RTEVENTLOG_HAS_DLL == 1 */
+# define TAO_RTEventLog_Export
+# define TAO_RTEVENTLOG_SINGLETON_DECLARATION(T)
+# define TAO_RTEVENTLOG_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_RTEVENTLOG_HAS_DLL == 1 */
+
+#endif /* TAO_RTEVENTLOG_EXPORT_H */
+
+// End of auto generated file.