alma::acs::nc::AnyAide Class Reference

Collaboration diagram for alma::acs::nc::AnyAide:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AnyAide (ContainerServicesBase cs)
Any arrayToCorbaAny (Object objs) throws AcsJException
Any doubleArrayToCorbaAny (double[] doubles)
Any floatArrayToCorbaAny (float[] floats)
Any intArrayToCorbaAny (int[] ints)
Any stringArrayToCorbaAny (String[] strings)
Any objectToCorbaAny (Object obj) throws AcsJException
Any complexObjectToCorbaAny (IDLEntity obj) throws AcsJException
Object corbaAnyToObject (Any any)
Object complexAnyToObject (Any any)

Protected Member Functions

Any internalArrayToCorbaAny (Object objs) throws AcsJException
String corbaStructToJavaClass (String id, boolean isNestedStruct) throws IllegalArgumentException

Private Attributes

final ContainerServicesBase m_containerServices
final Logger m_logger

Detailed Description

Intended to be used as an aide to developers working with CORBA anys. If there's some method you think should be added to this class to ease developers' lives, please send this suggestion to the alma-sw-common@nrao.edu or acs-discuss@nrao.edu mailing lists.

make package-private once we no longer have a separate "refactored" subpackage.

Author:
dfugate
Version:
$Id$

Constructor & Destructor Documentation

alma::acs::nc::AnyAide::AnyAide ( ContainerServicesBase  cs  )  [inline]

Standard constructor.

Parameters:
cs Container services reference of the component.

References alma::acs::container::ContainerServicesBase::getLogger(), m_containerServices, and m_logger.


Member Function Documentation

Any alma::acs::nc::AnyAide::arrayToCorbaAny ( Object  objs  )  throws AcsJException [inline]

Converts an array of simple type instances to a CORBA any.

Parameters:
objs An array of CORBA simple types supported by BACI. For example, double[], string[], etc.
Returns:
A CORBA any with the array of simple types.
Exceptions:
AcsJException Thrown when the array type is not supported.
Deprecated:
use one of the type-safe methods such as doubleArrayToCorbaAny(double[]). This method will be removed. HSO-20061221: It actually seems that this method is never used outside of this package. Probably it was more useful before we got the restriction that only IDL-defined structs can be sent as event data Thus we could also have the replacement methods like doubleArrayToCorbaAny with less than public visibility. (an inferred rule which I have not seen stated clearly).

References internalArrayToCorbaAny().

Object alma::acs::nc::AnyAide::complexAnyToObject ( Any  any  )  [inline]

Extracts from a Corba Any the embedded user-defined event data. The returned data can be either

  1. a class implementing IDLEntity if an IDL-defined struct was sent, or
  2. an array of IDL-defined structs

Other non-IDL defined classes or primitive types are not allowed as event data (not totally sure but it seems like that, HSO 2006-12).

Parameters:
any CORBA Any containing a complex, user-defined object within it
Returns:
the CORBA Any parameter converted to an object of the corresponding Java type, or null if the conversion failed.

References corbaStructToJavaClass(), and m_logger.

Referenced by alma::acs::nc::Consumer::push_structured_event().

Any alma::acs::nc::AnyAide::complexObjectToCorbaAny ( IDLEntity  obj  )  throws AcsJException [inline]

Converts a complex CORBA-based object to a CORBA any.

Parameters:
obj A complex CORBA-based object such as a user-defined IDL struct.
Returns:
A CORBA any containing obj.
Exceptions:
AcsJException if any problem occurs with the conversion.

References alma::acs::container::ContainerServicesBase::getAdvancedContainerServices(), alma::acs::container::AdvancedContainerServices::getAny(), m_containerServices, and m_logger.

Referenced by alma::acs::nc::StructuredEventCreator::createEvent(), objectToCorbaAny(), alma::acs::nc::SimpleSupplier::publishEvent(), and alma::acs::nc::refactored::NCPublisher::publishEvent().

Object alma::acs::nc::AnyAide::corbaAnyToObject ( Any  any  )  [inline]

Method which attempts to (and under normal circumstances should succeed) convert a CORBA any object to the corresponding Java object. For simple CORBA types such as long, this method will extract the long and embed it within a java.lang.Long object. In the event of failure, a null object is returned.

Parameters:
any A CORBA any containing some sort of CORBA object
Returns:
the CORBA any converted into the corresponding Java type, or null if it failed.

References m_logger.

Referenced by alma::acs::nc::ArchiveConsumer::push_structured_event().

String alma::acs::nc::AnyAide::corbaStructToJavaClass ( String  id,
boolean  isNestedStruct 
) throws IllegalArgumentException [inline, protected]

Derives the qualified Java class name for an IDL-defined struct from the Corba ID of that struct.

Parameters:
isNestedStruct if true, "Package" will be inserted according to "IDL to Java LanguageMapping Specification" version 1.2: 1.17 Mapping for Certain Nested Types apply.

Referenced by complexAnyToObject(), and alma::acs::nc::AnyAideTest::testCorbaStructToJavaClass().

Any alma::acs::nc::AnyAide::doubleArrayToCorbaAny ( double[]  doubles  )  [inline]
Any alma::acs::nc::AnyAide::floatArrayToCorbaAny ( float[]  floats  )  [inline]
Any alma::acs::nc::AnyAide::intArrayToCorbaAny ( int[]  ints  )  [inline]
Any alma::acs::nc::AnyAide::internalArrayToCorbaAny ( Object  objs  )  throws AcsJException [inline, protected]

Moved here from the now-deprecated method arrayToCorbaAny.

References doubleArrayToCorbaAny(), floatArrayToCorbaAny(), intArrayToCorbaAny(), and stringArrayToCorbaAny().

Referenced by arrayToCorbaAny(), and objectToCorbaAny().

Any alma::acs::nc::AnyAide::objectToCorbaAny ( Object  obj  )  throws AcsJException [inline]

Converts a generic Java object to a CORBA Any. May fail.

Parameters:
obj Object to be converted to a CORBA any
Returns:
A CORBA any with obj's data embedded within it.
Exceptions:
AcsJException Thrown if there's some problem converting the object to an any. TODO: make sure this works with enumerations.

References complexObjectToCorbaAny(), alma::acs::container::ContainerServicesBase::getAdvancedContainerServices(), alma::acs::container::AdvancedContainerServices::getAny(), internalArrayToCorbaAny(), and m_containerServices.

Referenced by alma::acs::nc::ArchiveSupplier::publishEvent().

Any alma::acs::nc::AnyAide::stringArrayToCorbaAny ( String[]  strings  )  [inline]

Member Data Documentation

final Logger alma::acs::nc::AnyAide::m_logger [private]

The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2