

Public Member Functions | |
| Helper (ContainerServicesBase services) throws AcsJException | |
| ContainerServicesBase | getContainerServices () |
| NamingContext | getNamingService () |
| EventChannel | getNotificationChannel (EventChannelFactory ecf) |
| EventChannel | getNotificationChannel (String channelName, String channelKind, String notifyFactoryName) throws AcsJException |
| ChannelProperties | getChannelProperties () |
| String | getNotificationFactoryNameForChannel (String channelName) |
| String | getNotificationFactoryNameForChannel (String channelName, String domainName) |
| HashMap< String, Double > | getEventHandlerTimeoutMap (String channelName) |
| EventChannelFactory | getNotifyFactory () |
Protected Member Functions | |
| NamingContext | getNamingServiceInitial () throws AcsJException |
| void | initializeNotifyFactory (String notifyFactoryName) throws AcsJException |
| EventChannel | createNotificationChannel (String channelName, String channelKind, String notifyFactoryName) throws AcsJException, NameAlreadyUsed, NameMapError |
| EventChannel | createNotifyChannel_internal (EventChannelFactory notifyFactory, Property[] initial_qos, Property[] initial_admin, String channelName, IntHolder channelIdHolder) throws UnsupportedAdmin, NameAlreadyUsed, UnsupportedQoS, NameMapError |
| void | destroyNotificationChannel (String channelName, String channelKind, EventChannel channelRef) throws AcsJException |
Protected Attributes | |
| final Logger | m_logger |
Private Attributes | |
| final NamingContext | m_nContext |
| final ContainerServicesBase | m_services |
| final ChannelProperties | m_channelProperties |
| final CDBAccess | m_cdbAccess |
| DAOProxy | channelsDAO |
| int | channelId |
| EventChannelFactory | notifyFactory |
| final Map< String, Long > | channelConfigProblems = new HashMap<String, Long>() |
| String | channelName |
Static Private Attributes | |
| static final String | m_nameJavaProp = "ORBInitRef.NameService" |
This class provides methods useful to both supplier and consumer objects.
| alma::acs::nc::Helper::Helper | ( | ContainerServicesBase | services | ) | throws AcsJException [inline] |
Creates a new instance of Helper, which includes resolving the naming service.
| services | A reference to the ContainerServices |
| AcsJException | Generic ACS exception will be thrown if anything in this class is broken. |
References getContainerServices(), alma::acs::container::ContainerServicesBase::getLogger(), getNamingServiceInitial(), m_cdbAccess, m_channelProperties, m_logger, m_nContext, m_services, com::cosylab::cdb::client::CDBAccess::setDAL(), and alma::ACSErrTypeCommon::wrappers::AcsJBadParameterEx::setReason().
| EventChannel alma::acs::nc::Helper::createNotificationChannel | ( | String | channelName, | |
| String | channelKind, | |||
| String | notifyFactoryName | |||
| ) | throws AcsJException, NameAlreadyUsed, NameMapError [inline, protected] |
Tries to create a notification channel (using quality of service and administrative properties specified by configQofS() and configAdminProps() respectively). If this succeeds, then registers this channel with the naming service.
Should only be invoked when the channel that this supplier or consumer is attempting to connect to does not exist. However even with prior check for the existence of this channel, a race condition with other suppliers or consumers can lead to multiple attempts to create the same channel, which will result in NameAlreadyUsed exception.
Design note: Currently the TAO notification extensions are used to synch channel creation with other clients by supplying the channel name to the factory. If we want to use only standard NC factories then we'd have to implement our own locking mechanisms in all ACS consumer and supplier classes, see http://jira.alma.cl/browse/COMP-2808
| channelName | Name of the channel to create. | |
| channelKind | Kind of the channel as registered with the CORBA naming service. | |
| notifyFactoryName | Name of the notification service as registered with the CORBA naming service. |
| AcsJException | Standard ACS Java exception. | |
| NameMapError | ( check in TAO code what this means!) | |
| NameAlreadyUsed | thrown if the channel of this name already exists. |
References alma::ACSErrTypeCommon::wrappers::AcsJCORBAProblemEx::AcsJCORBAProblemEx(), channelId, channelName, alma::acs::nc::ChannelProperties::configAdminProps(), alma::acs::nc::ChannelProperties::configQofS(), createNotifyChannel_internal(), getNamingService(), initializeNotifyFactory(), m_channelProperties, m_logger, notifyFactory, and alma::ACSErrTypeCommon::wrappers::AcsJCORBAProblemEx::setInfo().
Referenced by getNotificationChannel().
| EventChannel alma::acs::nc::Helper::createNotifyChannel_internal | ( | EventChannelFactory | notifyFactory, | |
| Property[] | initial_qos, | |||
| Property[] | initial_admin, | |||
| String | channelName, | |||
| IntHolder | channelIdHolder | |||
| ) | throws UnsupportedAdmin, NameAlreadyUsed, UnsupportedQoS, NameMapError [inline, protected] |
Broken out from createNotificationChannel(String, String, String) to give tests better control about the timing when this call to the event factory is made.
Reimplemented in alma::acs::nc::HelperTest::HelperWithChannelCreationSynch.
References channelName, gov::sandia::NotifyMonitoringExt::EventChannelFactoryOperations::create_named_channel(), and notifyFactory.
Referenced by createNotificationChannel().
| void alma::acs::nc::Helper::destroyNotificationChannel | ( | String | channelName, | |
| String | channelKind, | |||
| EventChannel | channelRef | |||
| ) | throws AcsJException [inline, protected] |
Destroys the channel and unregisters it from the naming service. ONLY USE THIS METHOD IF YOU KNOW FOR CERTAIN THERE IS ONLY ONE SUPPLIER FOR THE CHANNEL!!! Use this method with extreme caution as it's likely to become deprecated in future versions of ACS!
| channelName | name of the channel as registered int the CORBA notification service | |
| channelKind | Kind of the channel as registered with the CORBA naming service. | |
| channelRef | reference to the channel being destroyed |
| AcsJException | Thrown when the channel isn't registered with the Naming Service. |
References channelName, getNamingService(), and m_logger.
Referenced by alma::acs::nc::ConsumerWithComponentClientTestCaseTest::channelDown(), alma::acs::nc::SimpleSupplier::destroyNotificationChannel(), alma::acs::nc::HelperTest::testConcurrentChannelCreation(), alma::acs::nc::HelperTest::testConcurrentChannelRetrieval(), and alma::acs::nc::HelperTest::testCreateChannel().
| ChannelProperties alma::acs::nc::Helper::getChannelProperties | ( | ) | [inline] |
Provides access to the information about the channel contained within the ACS CDB
References m_channelProperties.
Referenced by alma::acs::nc::Consumer::Consumer(), alma::acs::nc::refactored::NCPublisher::NCPublisher(), alma::acs::nc::SimpleSupplier::reconnect(), alma::acs::nc::refactored::NCPublisher::reconnect(), alma::acs::nc::Consumer::reconnect(), and alma::acs::nc::SimpleSupplier::SimpleSupplier().
| ContainerServicesBase alma::acs::nc::Helper::getContainerServices | ( | ) | [inline] |
Returns a reference to the Container Services which are provided by a container or client.
References m_services.
Referenced by alma::acs::nc::Consumer::disconnect(), getNamingServiceInitial(), and Helper().
| HashMap<String, Double> alma::acs::nc::Helper::getEventHandlerTimeoutMap | ( | String | channelName | ) | [inline] |
The following returns a map where each key is the name of an event and the value is the maximum amount of time (in floating point seconds) an event receiver has to process the event before a warning message is logged.
| channelName | name of the channel |
References alma::acs::container::ContainerServicesBase::getCDB(), m_logger, and m_services.
| NamingContext alma::acs::nc::Helper::getNamingService | ( | ) | [inline] |
Returns a reference to the Naming Service.
References m_nContext.
Referenced by alma::acs::nc::HelperTest::assertChannel(), createNotificationChannel(), destroyNotificationChannel(), getNotificationChannel(), initializeNotifyFactory(), alma::acs::nc::ConsumerWithComponentClientTestCaseTest::namingBindingsContain(), and alma::acs::nc::HelperTest::setUp().
| NamingContext alma::acs::nc::Helper::getNamingServiceInitial | ( | ) | throws AcsJException [inline, protected] |
Retrieves and returns a reference to the Naming Service. This code belongs to the constructor and should only be called from there.
This method is protected to support unit tests, otherwise it would be private.
: The dependence of NC libs on the NamingService should be expressed in a less hidden form than using a property, which leads to dangerous runtime-only failures if missing. It would already be an improvement if we would obtain the NamingService reference from AdvancedContainerServices#getORB(). A more radical change would be to integrate the NC classes into the ContainerServices.
| AcsJException | Thrown when there's a bad corbaloc given for the Naming Service or the reference cannot be narrowed. |
References alma::acs::container::AdvancedContainerServices::corbaObjectFromString(), alma::acs::container::ContainerServicesBase::getAdvancedContainerServices(), getContainerServices(), m_nameJavaProp, and alma::ACSErrTypeCommon::wrappers::AcsJBadParameterEx::setReason().
Referenced by Helper().
| EventChannel alma::acs::nc::Helper::getNotificationChannel | ( | String | channelName, | |
| String | channelKind, | |||
| String | notifyFactoryName | |||
| ) | throws AcsJException [inline] |
This method gets a reference to the event channel. If it is not already registered with the naming service, it is created.
Make "protected" again once we no longer have NC classes in separate subpackge "refactored".
| channelName | Name of the event channel registered with the CORBA Naming Service | |
| channelKind | Kind of the channel as registered with the CORBA naming service ("channels"). | |
| notifyFactoryName | Name of the notification service as registered with the CORBA naming service. |
| AcsJException | Standard ACS Java exception. |
References channelName, createNotificationChannel(), getNamingService(), initializeNotifyFactory(), m_logger, and alma::ACSErrTypeCommon::wrappers::AcsJGenericErrorEx::setErrorDesc().
| EventChannel alma::acs::nc::Helper::getNotificationChannel | ( | EventChannelFactory | ecf | ) | [inline] |
References channelId.
Referenced by alma::acs::nc::ConsumerWithComponentClientTestCaseTest::channelUp(), alma::acs::nc::Consumer::Consumer(), alma::acs::nc::refactored::NCPublisher::NCPublisher(), alma::acs::nc::SimpleSupplier::reconnect(), alma::acs::nc::refactored::NCPublisher::reconnect(), alma::acs::nc::Consumer::reconnect(), and alma::acs::nc::SimpleSupplier::SimpleSupplier().
| String alma::acs::nc::Helper::getNotificationFactoryNameForChannel | ( | String | channelName, | |
| String | domainName | |||
| ) | [inline] |
Gets the notification channel factory name for the given channel/domain.
Tries to use the optional mapping from the CDB, otherwise uses "NotifyEventChannelFactory".
| channelName | name of the channel. | |
| domainName | name of the domain, null if undefined. |
References channelConfigProblems, channelsDAO, com::cosylab::cdb::client::CDBAccess::createDAO(), com::cosylab::cdb::client::DAOProxy::get_string(), com::cosylab::cdb::client::DAOProxy::get_string_seq(), m_cdbAccess, and m_logger.
| String alma::acs::nc::Helper::getNotificationFactoryNameForChannel | ( | String | channelName | ) | [inline] |
Get notification channel factory name for given channel.
| channelName | name of the channel. |
Referenced by alma::demo::test::client::NotificationServiceConfigurationTest::doSomeStuff(), alma::acs::nc::SimpleSupplier::getNotificationFactoryName(), alma::acs::nc::refactored::NCPublisher::getNotificationFactoryName(), alma::acs::nc::Consumer::getNotificationFactoryName(), alma::acs::nc::HelperTest::testConcurrentChannelCreation(), alma::acs::nc::HelperTest::testConcurrentChannelRetrieval(), and alma::acs::nc::HelperTest::testCreateChannel().
| EventChannelFactory alma::acs::nc::Helper::getNotifyFactory | ( | ) | [inline] |
| void alma::acs::nc::Helper::initializeNotifyFactory | ( | String | notifyFactoryName | ) | throws AcsJException [inline, protected] |
References alma::ACSErrTypeCommon::wrappers::AcsJCORBAProblemEx::AcsJCORBAProblemEx(), getNamingService(), m_logger, notifyFactory, alma::ACSErrTypeCommon::wrappers::AcsJCORBAProblemEx::setInfo(), and alma::ACSErrTypeCORBA::wrappers::AcsJNarrowFailedEx::setNarrowType().
Referenced by createNotificationChannel(), and getNotificationChannel().
final Map<String, Long> alma::acs::nc::Helper::channelConfigProblems = new HashMap<String, Long>() [private] |
Map that's used similar to a log repeat guard, because the OMC was flooded with NC config problem logs (as of 2008-03-06).
key = channel name; value = timestamp in ms when config error was found for the given channel.
Referenced by getNotificationFactoryNameForChannel().
int alma::acs::nc::Helper::channelId [private] |
Referenced by createNotificationChannel(), and getNotificationChannel().
String alma::acs::nc::Helper::channelName [private] |
Referenced by alma::acs::nc::HelperTest::HelperWithChannelCreationSynch::createNotificationChannel(), createNotificationChannel(), alma::acs::nc::HelperTest::HelperWithChannelCreationSynch::createNotifyChannel_internal(), createNotifyChannel_internal(), destroyNotificationChannel(), alma::acs::nc::HelperTest::HelperWithChannelCreationSynch::getNotificationChannel(), and getNotificationChannel().
DAOProxy alma::acs::nc::Helper::channelsDAO [private] |
Referenced by getNotificationFactoryNameForChannel().
final CDBAccess alma::acs::nc::Helper::m_cdbAccess [private] |
Referenced by getNotificationFactoryNameForChannel(), and Helper().
final ChannelProperties alma::acs::nc::Helper::m_channelProperties [private] |
Referenced by createNotificationChannel(), getChannelProperties(), and Helper().
final Logger alma::acs::nc::Helper::m_logger [protected] |
final String alma::acs::nc::Helper::m_nameJavaProp = "ORBInitRef.NameService" [static, private] |
Java property name for the CORBA Naming Service corbaloc. This property is set in the acsstartup :: acsStartJava.
: Check if we can eliminate this property if we use something similar as in jmanager's com.cosylab.acs.maci.plug.NamingServiceRemoteDirectory.
Referenced by getNamingServiceInitial().
final NamingContext alma::acs::nc::Helper::m_nContext [private] |
In a running system, there can be only one reference to the Naming Service.
Referenced by getNamingService(), and Helper().
final ContainerServicesBase alma::acs::nc::Helper::m_services [private] |
Referenced by getContainerServices(), getEventHandlerTimeoutMap(), and Helper().
1.6.2