Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

alma::acs::nc::Helper Class Reference

Inheritance diagram for alma::acs::nc::Helper:

Inheritance graph
[legend]
Collaboration diagram for alma::acs::nc::Helper:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Helper (ContainerServicesBase services) throws AcsJException
ContainerServicesBase getContainerServices ()
NamingContext getNamingService ()
ChannelProperties getChannelProperties ()
String getNotificationFactoryNameForChannel (String channelName)
String getNotificationFactoryNameForChannel (String channelName, String domainName)

Protected Member Functions

NamingContext getNamingServiceInitial () throws AcsJException
EventChannel getNotificationChannel (String channelName, String channelKind, 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
final Map< String, Long > channelConfigProblems = new HashMap<String Long>()

Static Private Attributes

final String m_nameJavaProp = "ORBInitRef.NameService"

Detailed Description

This class provides methods useful to both supplier and consumer objects.


Constructor & Destructor Documentation

alma::acs::nc::Helper::Helper ContainerServicesBase  services  )  throws AcsJException [inline]
 

Creates a new instance of Helper, which includes resolving the naming service.

Parameters:
services A reference to the ContainerServices
Exceptions:
AcsJException Generic ACS exception will be thrown if anything in this class is broken.


Member Function Documentation

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

Returns:
Reference to the newly created channel.
Parameters:
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.
Exceptions:
AcsJException Standard ACS Java exception.
NameMapError ( check in TAO code what this means!)
NameAlreadyUsed thrown if the channel of this name already exists.

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.

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!

Parameters:
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
Exceptions:
AcsJException Thrown when the channel isn't registered with the Naming Service.
Warning:
this method assumes

ChannelProperties alma::acs::nc::Helper::getChannelProperties  )  [inline]
 

Provides access to the information about the channel contained within the ACS CDB

Returns:
This class's channel properties member.

ContainerServicesBase alma::acs::nc::Helper::getContainerServices  )  [inline]
 

Returns a reference to the Container Services which are provided by a container or client.

Returns:
A valid reference to the ContainerServices instance.

NamingContext alma::acs::nc::Helper::getNamingService  )  [inline]
 

Returns a reference to the Naming Service.

Returns:
Valid reference to the Naming Service.

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.

Returns:
Valid reference to the Naming Service.
Exceptions:
AcsJException Thrown when there's a bad corbaloc given for the Naming Service or the reference cannot be narrowed.
See also:
getNamingService()

EventChannel alma::acs::nc::Helper::getNotificationChannel String  channelName,
String  channelKind,
String  notifyFactoryName
throws AcsJException [inline, protected]
 

This method gets a reference to the event channel. If it is not already registered with the naming service, it is created.

Returns:
Reference to the event channel specified by channelName.
Parameters:
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.
Exceptions:
AcsJException Standard ACS Java exception.

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".

Parameters:
channelName name of the channel.
domainName name of the domain, null if undefined.
Returns:
notification channel factory name.

String alma::acs::nc::Helper::getNotificationFactoryNameForChannel String  channelName  )  [inline]
 

Get notification channel factory name for given channel.

Parameters:
channelName name of the channel.
Returns:
notification channel factory name.


Member Data Documentation

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.

DAOProxy alma::acs::nc::Helper::channelsDAO [private]
 

final CDBAccess alma::acs::nc::Helper::m_cdbAccess [private]
 

final ChannelProperties alma::acs::nc::Helper::m_channelProperties [private]
 

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.

final NamingContext alma::acs::nc::Helper::m_nContext [private]
 

In a running system, there can be only one reference to the Naming Service. remove nulling this ref in ./ACSLaser/baciPropsTest/test/alma/acs/alarmsystem/test/BACITest.java: Helper.m_nContext = null; ./ACSLaser/laser-source/test/alma/lasersource/test/SendTest.java: Helper.m_nContext = null; ./ACSLaser/laser-source/test/alma/lasersource/test/SourceStressTest.java: Helper.m_nContext = null;

final ContainerServicesBase alma::acs::nc::Helper::m_services [private]
 


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:54:29 2009 for ACS Java API by doxygen 1.3.8