Public Member Functions | Protected Member Functions

alma.acs.nc.AnyAide Class Reference

List of all members.

Public Member Functions

 AnyAide (ContainerServicesBase cs)
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

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  ) 

Standard constructor.

Parameters:
cs Container services reference of the component.

References alma.acs.container.ContainerServicesBase.getLogger().


Member Function Documentation

Object alma.acs.nc.AnyAide.complexAnyToObject ( Any  any  ) 

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 alma.acs.nc.AnyAide.corbaStructToJavaClass().

Referenced by alma.acs.nc.refactored.NCSubscriber.push_structured_event(), and alma.acs.nc.Consumer.push_structured_event().

Any alma.acs.nc.AnyAide.complexObjectToCorbaAny ( IDLEntity  obj  )  throws AcsJException

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().

Referenced by alma.acs.nc.AnyAide.objectToCorbaAny(), alma.acs.nc.SimpleSupplier.publishEvent(), and alma.acs.nc.refactored.NCPublisher.publishEvent().

Object alma.acs.nc.AnyAide.corbaAnyToObject ( Any  any  ) 

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.

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

String alma.acs.nc.AnyAide.corbaStructToJavaClass ( String  id,
boolean  isNestedStruct 
) throws IllegalArgumentException [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 alma.acs.nc.AnyAide.complexAnyToObject().

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

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 alma.acs.nc.AnyAide.complexObjectToCorbaAny(), alma.acs.container.ContainerServicesBase.getAdvancedContainerServices(), and alma.acs.nc.AnyAide.internalArrayToCorbaAny().

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

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

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties