📄 ft_replicationmanager.cpp
字号:
ACE_THROW_SPEC ( (CORBA::SystemException))
{
this->register_fault_notifier_i (fault_notifier ACE_ENV_ARG_PARAMETER);
}
//private
void
TAO::FT_ReplicationManager::register_fault_notifier_i (
FT::FaultNotifier_ptr fault_notifier
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException))
{
if (CORBA::is_nil (fault_notifier))
{
ACE_ERROR ( (LM_ERROR,
ACE_TEXT (
"%T %n (%P|%t) - "
"Bad Fault Notifier object reference provided.\n")
));
ACE_THROW (CORBA::BAD_PARAM (
CORBA::SystemException::_tao_minor_code (
TAO_DEFAULT_MINOR_CODE,
EINVAL),
CORBA::COMPLETED_NO));
}
// Cache new Fault Notifier object reference.
this->fault_notifier_ = FT::FaultNotifier::_duplicate (fault_notifier);
// Re-initialize our consumer.
// Swallow any exception.
int result = 0;
ACE_TRY_NEW_ENV
{
//@@ should we check to see if a notifier is already registered, rather than
// simply "unregistering"?
result = this->fault_consumer_.fini (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
// Note if the fini failed, we ignore it. It may not have been registered in the first place.
// Create a fault analyzer.
TAO::FT_FaultAnalyzer * analyzer = 0;
ACE_NEW_NORETURN (
analyzer,
TAO::FT_ReplicationManagerFaultAnalyzer (this));
if (analyzer == 0)
{
ACE_ERROR ( (LM_ERROR,
ACE_TEXT (
"%T %n (%P|%t) - "
"Error creating FaultAnalyzer.\n"
)
));
result = -1;
}
if (result == 0)
{
result = this->fault_consumer_.init (
this->poa_.in (),
this->fault_notifier_.in (),
analyzer
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
ACE_TEXT (
"TAO::FT_ReplicationManager::register_fault_notifier_i: "
"Error reinitializing FT_FaultConsumer.\n")
);
result = -1;
}
ACE_ENDTRY;
if (result != 0)
{
ACE_ERROR ( (LM_ERROR,
ACE_TEXT (
"%T %n (%P|%t) - "
"Could not re-initialize FT_FaultConsumer.\n")
));
ACE_THROW (CORBA::INTERNAL (
CORBA::SystemException::_tao_minor_code (
TAO_DEFAULT_MINOR_CODE,
EINVAL),
CORBA::COMPLETED_NO));
}
}
// Returns the reference of the Fault Notifier.
//CORBA
FT::FaultNotifier_ptr
TAO::FT_ReplicationManager::get_fault_notifier (
ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException, FT::InterfaceNotFound))
{
if (CORBA::is_nil (this->fault_notifier_.in ()))
{
ACE_THROW_RETURN ( FT::InterfaceNotFound () , FT::FaultNotifier::_nil ());
}
return FT::FaultNotifier::_duplicate (this->fault_notifier_.in ());
}
// TAO-specific find factory registry
//CORBA
::PortableGroup::FactoryRegistry_ptr
TAO::FT_ReplicationManager::get_factory_registry (
const PortableGroup::Criteria & selection_criteria
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ( (CORBA::SystemException))
{
ACE_UNUSED_ARG (selection_criteria);
return this->factory_registry_.reference ();
}
// TAO-specific shutdown operation.
//public
void TAO::FT_ReplicationManager::shutdown (
ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ( (CORBA::SystemException))
{
this->quit_ = 1;
}
// Get the type_id associated with an object group.
//CORBA
char * TAO::FT_ReplicationManager::type_id (
PortableGroup::ObjectGroup_ptr object_group
ACE_ENV_ARG_DECL)
{
char * result = 0;
TAO::PG_Object_Group * group = 0;
if (this->group_factory_.find_group (object_group, group))
{
result = group->get_type_id ();
}
else
{
ACE_THROW_RETURN (PortableGroup::ObjectGroupNotFound (), 0);
}
return result;
}
//////////////////////////////////////////////////////
// PortableGroup::PropertyManager methods
//CORBA
void
TAO::FT_ReplicationManager::set_default_properties (
const PortableGroup::Properties & props
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableGroup::InvalidProperty,
PortableGroup::UnsupportedProperty))
{
this->properties_support_.set_default_properties (props ACE_ENV_ARG_PARAMETER);
//@@ validate properties?
}
//CORBA
PortableGroup::Properties *
TAO::FT_ReplicationManager::get_default_properties (
ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException))
{
return this->properties_support_.get_default_properties (
ACE_ENV_SINGLE_ARG_PARAMETER);
}
//CORBA
void
TAO::FT_ReplicationManager::remove_default_properties (
const PortableGroup::Properties & props
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException,
PortableGroup::InvalidProperty,
PortableGroup::UnsupportedProperty))
{
this->properties_support_.remove_default_properties (props
ACE_ENV_ARG_PARAMETER);
}
//CORBA
void
TAO::FT_ReplicationManager::set_type_properties (
const char *type_id,
const PortableGroup::Properties & overrides
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException,
PortableGroup::InvalidProperty,
PortableGroup::UnsupportedProperty))
{
this->properties_support_.set_type_properties (
type_id,
overrides
ACE_ENV_ARG_PARAMETER);
}
//CORBA
PortableGroup::Properties *
TAO::FT_ReplicationManager::get_type_properties (
const char *type_id
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException))
{
return this->properties_support_.get_type_properties (type_id
ACE_ENV_ARG_PARAMETER);
}
//CORBA
void
TAO::FT_ReplicationManager::remove_type_properties (
const char *type_id,
const PortableGroup::Properties & props
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException,
PortableGroup::InvalidProperty,
PortableGroup::UnsupportedProperty))
{
this->properties_support_.remove_type_properties (
type_id,
props
ACE_ENV_ARG_PARAMETER);
}
//CORBA
void
TAO::FT_ReplicationManager::set_properties_dynamically (
PortableGroup::ObjectGroup_ptr object_group,
const PortableGroup::Properties & overrides
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException,
PortableGroup::ObjectGroupNotFound,
PortableGroup::InvalidProperty,
PortableGroup::UnsupportedProperty))
{
TAO::PG_Object_Group * group = 0;
if (this->group_factory_.find_group (object_group, group))
{
group->set_properties_dynamically (overrides ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
}
else
{
ACE_THROW (PortableGroup::ObjectGroupNotFound ());
}
}
//CORBA
PortableGroup::Properties *
TAO::FT_ReplicationManager::get_properties (
PortableGroup::ObjectGroup_ptr object_group
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException,
PortableGroup::ObjectGroupNotFound))
{
PortableGroup::Properties_var result;
ACE_NEW_THROW_EX (result, PortableGroup::Properties(), CORBA::NO_MEMORY ());
TAO::PG_Object_Group * group = 0;
if (this->group_factory_.find_group (object_group, group))
{
group->get_properties (result);
}
else
{
ACE_THROW_RETURN (PortableGroup::ObjectGroupNotFound (), 0);
}
return result._retn();
}
//////////////////////////////////////////////////////
// FT::FTObjectGroupManager methods
/// Sets the primary member of a group.
//CORBA
PortableGroup::ObjectGroup_ptr
TAO::FT_ReplicationManager::set_primary_member (
PortableGroup::ObjectGroup_ptr object_group,
const PortableGroup::Location & the_location
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (
CORBA::SystemException
, PortableGroup::ObjectGroupNotFound
, PortableGroup::MemberNotFound
, FT::PrimaryNotSet
, FT::BadReplicationStyle
))
{
METHOD_ENTRY (TAO::FT_ReplicationManager::set_primary_member);
PortableGroup::ObjectGroup_var result = PortableGroup::ObjectGroup::_nil();
TAO::PG_Object_Group * group = 0;
if (this->group_factory_.find_group (object_group, group))
{
PortableGroup::TagGroupTaggedComponent tag_component;
TAO_FT_IOGR_Property prop (tag_component);
int sts = group->set_primary_member (&prop, the_location ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (PortableGroup::ObjectGroup::_nil ());
if (sts)
{
result = group->reference ();
}
else
{
ACE_THROW_RETURN (FT::PrimaryNotSet (), PortableGroup::ObjectGroup::_nil ());
}
}
else
{
ACE_THROW_RETURN (PortableGroup::ObjectGroupNotFound (), PortableGroup::ObjectGroup::_nil ());
}
METHOD_RETURN (TAO::FT_ReplicationManager::set_primary_member) result._retn ();
}
//CORBA
PortableGroup::ObjectGroup_ptr
TAO::FT_ReplicationManager::create_member (
PortableGroup::ObjectGroup_ptr object_group,
const PortableGroup::Location & the_location,
const char * type_id,
const PortableGroup::Criteria & the_criteria
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException,
PortableGroup::ObjectGroupNotFound,
PortableGroup::MemberAlreadyPresent,
PortableGroup::NoFactory,
PortableGroup::ObjectNotCreated,
PortableGroup::InvalidCriteria,
PortableGroup::CannotMeetCriteria))
{
PortableGroup::ObjectGroup_var result = PortableGroup::ObjectGroup::_nil();
TAO::PG_Object_Group * group = 0;
if (this->group_factory_.find_group (object_group, group))
{
group->create_member (the_location, type_id, the_criteria ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (PortableGroup::ObjectGroup::_nil ());
result = group->reference ();
}
else
{
if (TAO_debug_level > 0)
{
ACE_ERROR ( (LM_ERROR,
ACE_TEXT ("%T %n (%P|%t) - FT_ReplicationManager::create_member: unknown group\n")
));
}
ACE_THROW_RETURN (PortableGroup::ObjectGroupNotFound (), result._retn ());
}
return result._retn();
}
//CORBA
PortableGroup::ObjectGroup_ptr
TAO::FT_ReplicationManager::add_member (
PortableGroup::ObjectGroup_ptr object_group,
const PortableGroup::Location & the_location,
CORBA::Object_ptr member
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ( (CORBA::SystemException,
PortableGroup::ObjectGroupNotFound,
PortableGroup::MemberAlreadyPresent,
PortableGroup::ObjectNotAdded))
{
METHOD_ENTRY (TAO::FT_ReplicationManager::add_member);
PortableGroup::ObjectGroup_var result = PortableGroup::ObjectGroup::_nil ();
// Find the object group corresponding to this IOGR
TAO::PG_Object_Group * group = 0;
if (this->group_factory_.find_group (object_group, group))
{
group->add_member (
the_location,
member
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::Object::_nil ());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -