org.openorb.rmi.compiler.parser
Class MappingAPI

java.lang.Object
  |
  +--org.openorb.rmi.compiler.parser.MappingAPI

public class MappingAPI
extends java.lang.Object

This class provides the needed methods to map the java tree to the idl tree.

Author:
Vincent Vallee, Jerome Daniel

Field Summary
static int CORBA_ABSTRACT_INTERFACE_TYPE
          CORBA Reference type
static int CORBA_COMPLEX_TYPE
          IDL entity type
static int CORBA_REFERENCE_TYPE
          CORBA Reference type
static int CORBA_SYSTEM_EXCEPTION
          IDL entity type
static int CORBA_TYPE_MASK
          This bit is set for all corba types.
static int CORBA_USER_EXCEPTION
          IDL entity type
static int CORBA_VALUE_TYPE
          CORBA Reference type
static int EXCEPTION_TYPE_MASK
          This bit is set for all exceptions.
static int NON_CONFORMING_TYPE
          Non Conforming CLASSES & interface type
static int NOT_TO_MAP
          NOT TO MAP
static int REMOTE_TYPE_MASK
          This bit is set for all exceptions.
static int RMI_IDL_ABSTRACT_INTERFACE_TYPE
          Abstract interface type
static int RMI_IDL_ARRAYS_TYPE
          RMI/IDL ARRAYS type
static int RMI_IDL_CUSTOM_VALUE_TYPES_TYPE
          RMI/IDL customvalue types type
static int RMI_IDL_EXCEPTION_TYPE
          RMI/IDL EXCEPTION type
static int RMI_IDL_REMOTE_INTERFACE_TYPE
          RMI/IDL remote interface type
static int RMI_IDL_VALUE_TYPES_TYPE
          RMI/IDL value types type
static int RMI_IMPLEMENTATION_CLASS
          Rmi Implementation class
 
Constructor Summary
MappingAPI(JavaParser jp)
           
 
Method Summary
static void add_idl_object_as_first(org.openorb.compiler.object.IdlObject idlObj, org.openorb.compiler.object.IdlObject sub_idlObj)
          Insert the sub idl_object at the first place of the list
static java.lang.String get_absolute_idl_name(java.lang.String n)
          Return the absolute name of the class ::toto::titi
static java.lang.String get_array_name_without_extra_char(java.lang.String n)
          Return the package name for this class
static java.lang.String get_package_name(java.lang.String n)
          Return the package name for this class
static java.lang.String get_path(java.lang.String n)
          Return the path of the directory of the given file
static java.lang.String get_primitive_type(java.lang.String str)
          Return the equivalent idl type
static java.lang.String get_relative_name(java.lang.String n)
          Return the name of the class without the package name
static boolean has_write_object_method(java.lang.reflect.Method[] methods)
          Return true if the writeObject method is present
 void map_accessors(java.lang.reflect.Method[] methods, org.openorb.compiler.object.IdlObject parent)
          Maps the accessors of the class
 org.openorb.compiler.object.IdlObject map_array(java.lang.Class c, org.openorb.compiler.object.IdlObject parent, int locSeqNumber)
          Map the array to the idl corresponding type An RMI/IDL is mapped to a "boxed" value type containing an idl sequence.
 void map_class(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map the class or the array
 void map_constant(java.lang.reflect.Field c, org.openorb.compiler.object.IdlObject parent)
          Map a constant field
 void map_constants(java.lang.reflect.Field[] classes, org.openorb.compiler.object.IdlObject parent)
          Map the constants
 void map_constructor(java.lang.reflect.Constructor c, org.openorb.compiler.object.IdlObject parent, java.lang.String class_name)
          Map the constructor to an idl tree format node
 void map_constructors(java.lang.reflect.Constructor[] constructors, org.openorb.compiler.object.IdlObject parent, java.lang.String class_name)
          Map the constructors
 void map_corba_exception_class(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map a corba exception class to the existing idl type
 void map_entity(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map an idl entity
 void map_exception_class(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map an exception class to the existing idl type
 void map_exception(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map an exception to the existing idl type
 void map_exceptions(java.lang.Class[] classes, org.openorb.compiler.object.IdlObject parent)
          Map the exceptions threw by the methods
 void map_field(java.lang.reflect.Field f, org.openorb.compiler.object.IdlObject parent)
          Map the given field to equivalent ild type
 void map_fields(java.lang.reflect.Field[] fields, org.openorb.compiler.object.IdlObject parent)
          Map the fields to equivalent ild type
 void map_id(java.lang.String str, org.openorb.compiler.object.IdlObject parent, java.lang.Class c)
          Map a #pragma id flag
 void map_implement(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map the implemented class in the case of a class
 void map_implements(java.lang.Class[] classes, org.openorb.compiler.object.IdlObject parent)
          Map the implemented classes in the case of a class
 void map_inheritance(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map the inheritance
 void map_inheritances(java.lang.Class[] classes, org.openorb.compiler.object.IdlObject parent)
          Map the inheritance
 void map_interface(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map the interface to the correct idl object in the tree
 void map_method(java.lang.reflect.Method m, org.openorb.compiler.object.IdlObject parent, java.lang.Class c)
          Map the method to an idl tree format node
 void map_methods(java.lang.reflect.Method[] methods, org.openorb.compiler.object.IdlObject parent, java.lang.Class c)
          Maps the methods of the class
 org.openorb.compiler.object.IdlObject map_package(java.lang.String full_path, org.openorb.compiler.object.IdlObject parent)
          Map the java package to an idlModule object in the idl tree
 void map_parameter(java.lang.Class c, org.openorb.compiler.object.IdlObject parent, int arg_nb)
          Maps the given parameter in the idl tree
 void map_parameters(java.lang.Class[] parameters, org.openorb.compiler.object.IdlObject parent)
          Maps the given parameters in the idl tree in the array order
 void map_primitive_type(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map the corresponding type of the given class
 void map_type(java.lang.Class c, org.openorb.compiler.object.IdlObject parent)
          Map the corresponding type of the given class
 void map_value_type(java.lang.Class c, org.openorb.compiler.object.IdlObject parent, org.openorb.compiler.object.IdlObject locIdlobj)
          Common mapping method to value type and custom value type
 org.openorb.compiler.object.IdlObject return_existing_object(java.lang.Class c)
          Return the object corresponding to the class if it exists
 org.openorb.compiler.object.IdlObject return_existing_object(java.lang.String c_full_name)
          Return the object corresponding to the class name if it exists
static java.lang.String split_accessor_name(java.lang.String n)
          Return the name of the property
static boolean throws_remote_exception(java.lang.reflect.Method method)
          Return true if this method throws a RemoteException
static java.lang.String toString(int type)
          Show the type of the identified class in a human readable way.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CORBA_TYPE_MASK

public static final int CORBA_TYPE_MASK
This bit is set for all corba types.

EXCEPTION_TYPE_MASK

public static final int EXCEPTION_TYPE_MASK
This bit is set for all exceptions.

REMOTE_TYPE_MASK

public static final int REMOTE_TYPE_MASK
This bit is set for all exceptions.

NOT_TO_MAP

public static final int NOT_TO_MAP
NOT TO MAP

RMI_IDL_REMOTE_INTERFACE_TYPE

public static final int RMI_IDL_REMOTE_INTERFACE_TYPE
RMI/IDL remote interface type

RMI_IDL_VALUE_TYPES_TYPE

public static final int RMI_IDL_VALUE_TYPES_TYPE
RMI/IDL value types type

RMI_IDL_CUSTOM_VALUE_TYPES_TYPE

public static final int RMI_IDL_CUSTOM_VALUE_TYPES_TYPE
RMI/IDL customvalue types type

RMI_IMPLEMENTATION_CLASS

public static final int RMI_IMPLEMENTATION_CLASS
Rmi Implementation class

RMI_IDL_ARRAYS_TYPE

public static final int RMI_IDL_ARRAYS_TYPE
RMI/IDL ARRAYS type

RMI_IDL_ABSTRACT_INTERFACE_TYPE

public static final int RMI_IDL_ABSTRACT_INTERFACE_TYPE
Abstract interface type

RMI_IDL_EXCEPTION_TYPE

public static final int RMI_IDL_EXCEPTION_TYPE
RMI/IDL EXCEPTION type

NON_CONFORMING_TYPE

public static final int NON_CONFORMING_TYPE
Non Conforming CLASSES & interface type

CORBA_REFERENCE_TYPE

public static final int CORBA_REFERENCE_TYPE
CORBA Reference type

CORBA_ABSTRACT_INTERFACE_TYPE

public static final int CORBA_ABSTRACT_INTERFACE_TYPE
CORBA Reference type

CORBA_VALUE_TYPE

public static final int CORBA_VALUE_TYPE
CORBA Reference type

CORBA_COMPLEX_TYPE

public static final int CORBA_COMPLEX_TYPE
IDL entity type

CORBA_USER_EXCEPTION

public static final int CORBA_USER_EXCEPTION
IDL entity type

CORBA_SYSTEM_EXCEPTION

public static final int CORBA_SYSTEM_EXCEPTION
IDL entity type
Constructor Detail

MappingAPI

public MappingAPI(JavaParser jp)
Method Detail

toString

public static java.lang.String toString(int type)
Show the type of the identified class in a human readable way.

map_package

public org.openorb.compiler.object.IdlObject map_package(java.lang.String full_path,
                                                         org.openorb.compiler.object.IdlObject parent)
Map the java package to an idlModule object in the idl tree
Parameters:
c - The current class
parent - The parent node in the tree
Returns:
The last idlobject

map_interface

public void map_interface(java.lang.Class c,
                          org.openorb.compiler.object.IdlObject parent)
Map the interface to the correct idl object in the tree
Parameters:
c - The interface class
parent - The parent node in the tree

map_class

public void map_class(java.lang.Class c,
                      org.openorb.compiler.object.IdlObject parent)
Map the class or the array
Parameters:
c - The class to map
parent - The parent node in the tree

map_value_type

public void map_value_type(java.lang.Class c,
                           org.openorb.compiler.object.IdlObject parent,
                           org.openorb.compiler.object.IdlObject locIdlobj)
Common mapping method to value type and custom value type
Parameters:
c - The classto map
parent - The parent node in the compilation tree
locIdlobj - The current object

map_entity

public void map_entity(java.lang.Class c,
                       org.openorb.compiler.object.IdlObject parent)
Map an idl entity
Parameters:
c - The classto map
parent - The parent node in the compilation tree

map_inheritances

public void map_inheritances(java.lang.Class[] classes,
                             org.openorb.compiler.object.IdlObject parent)
Map the inheritance
Parameters:
classes - The classes that the current class inherits from
parent - The parent node in the compilation tree

map_inheritance

public void map_inheritance(java.lang.Class c,
                            org.openorb.compiler.object.IdlObject parent)
Map the inheritance
Parameters:
c - The class that the current class inherits from
parent - The parent node in the compilation tree

map_implements

public void map_implements(java.lang.Class[] classes,
                           org.openorb.compiler.object.IdlObject parent)
Map the implemented classes in the case of a class
Parameters:
classes - The classes to analyse
parent - The parent node in the tree

map_implement

public void map_implement(java.lang.Class c,
                          org.openorb.compiler.object.IdlObject parent)
Map the implemented class in the case of a class
Parameters:
c - The class to map
parent - The parent node in the tree

map_id

public void map_id(java.lang.String str,
                   org.openorb.compiler.object.IdlObject parent,
                   java.lang.Class c)
Map a #pragma id flag
Parameters:
str - The full name of the class
parent - The parent node in the tree

map_methods

public void map_methods(java.lang.reflect.Method[] methods,
                        org.openorb.compiler.object.IdlObject parent,
                        java.lang.Class c)
Maps the methods of the class
Parameters:
methods - The array of class that are the methods
parent - The parent node in the tree

map_accessors

public void map_accessors(java.lang.reflect.Method[] methods,
                          org.openorb.compiler.object.IdlObject parent)
Maps the accessors of the class
Parameters:
methods - The array of class that are the ptential accessors
parent - The parent node in the tree

map_method

public void map_method(java.lang.reflect.Method m,
                       org.openorb.compiler.object.IdlObject parent,
                       java.lang.Class c)
Map the method to an idl tree format node
Parameters:
m - The method to map
parent - The parent node in the tree

map_constructors

public void map_constructors(java.lang.reflect.Constructor[] constructors,
                             org.openorb.compiler.object.IdlObject parent,
                             java.lang.String class_name)
Map the constructors
Parameters:
constructors - The constructors to map
parent - The parent node in the tree
class_name - The class name that is the same for the constructors

map_constructor

public void map_constructor(java.lang.reflect.Constructor c,
                            org.openorb.compiler.object.IdlObject parent,
                            java.lang.String class_name)
Map the constructor to an idl tree format node
Parameters:
c - The constructor to map
parent - The parent node in the tree
class_name - The class name that is the same for the constructors

map_parameters

public void map_parameters(java.lang.Class[] parameters,
                           org.openorb.compiler.object.IdlObject parent)
Maps the given parameters in the idl tree in the array order
Parameters:
parameters - The classes tab for the params type
parent - The parent node in the tree

map_parameter

public void map_parameter(java.lang.Class c,
                          org.openorb.compiler.object.IdlObject parent,
                          int arg_nb)
Maps the given parameter in the idl tree
Parameters:
c - The class for the param type
parent - The parent node in the tree

map_exceptions

public void map_exceptions(java.lang.Class[] classes,
                           org.openorb.compiler.object.IdlObject parent)
Map the exceptions threw by the methods
Parameters:
classes - The table of exceptions
parent - The parent node

map_exception

public void map_exception(java.lang.Class c,
                          org.openorb.compiler.object.IdlObject parent)
Map an exception to the existing idl type
Parameters:
c - The exception class
parent - The parent node in the tree

map_exception_class

public void map_exception_class(java.lang.Class c,
                                org.openorb.compiler.object.IdlObject parent)
Map an exception class to the existing idl type
Parameters:
c - The exception class
parent - The parent node in the tree

map_corba_exception_class

public void map_corba_exception_class(java.lang.Class c,
                                      org.openorb.compiler.object.IdlObject parent)
Map a corba exception class to the existing idl type
Parameters:
c - The exception class
parent - The parent node in the tree

map_fields

public void map_fields(java.lang.reflect.Field[] fields,
                       org.openorb.compiler.object.IdlObject parent)
Map the fields to equivalent ild type
Parameters:
fields - The fields of the class to map
parent - The parent node in the tree

map_field

public void map_field(java.lang.reflect.Field f,
                      org.openorb.compiler.object.IdlObject parent)
Map the given field to equivalent ild type
Parameters:
f - The field to map
parent - The parent node in the tree

map_constants

public void map_constants(java.lang.reflect.Field[] classes,
                          org.openorb.compiler.object.IdlObject parent)
Map the constants
Parameters:
classes - The Field classes to map
parent - The parent node in the idl tree

map_constant

public void map_constant(java.lang.reflect.Field c,
                         org.openorb.compiler.object.IdlObject parent)
Map a constant field
Parameters:
c - The constant field to map
parent - The parent node in the idl tree

map_type

public void map_type(java.lang.Class c,
                     org.openorb.compiler.object.IdlObject parent)
Map the corresponding type of the given class
Parameters:
c - The class to map
parent - The parent node in the idl tree

map_primitive_type

public void map_primitive_type(java.lang.Class c,
                               org.openorb.compiler.object.IdlObject parent)
Map the corresponding type of the given class
Parameters:
c - The class to map
parent - The parent node in the idl tree

map_array

public org.openorb.compiler.object.IdlObject map_array(java.lang.Class c,
                                                       org.openorb.compiler.object.IdlObject parent,
                                                       int locSeqNumber)
Map the array to the idl corresponding type An RMI/IDL is mapped to a "boxed" value type containing an idl sequence.
Parameters:
c - The class to map
parent - The parent node in the idl tree
nb_dim - The number of dimension of the array
Returns:
The object value mapped

throws_remote_exception

public static boolean throws_remote_exception(java.lang.reflect.Method method)
Return true if this method throws a RemoteException

has_write_object_method

public static boolean has_write_object_method(java.lang.reflect.Method[] methods)
Return true if the writeObject method is present
Parameters:
methods - The methods of the class
Returns:
True if the writeObject method is present

get_package_name

public static java.lang.String get_package_name(java.lang.String n)
Return the package name for this class
Parameters:
n - The full class name
Returns:
The package name

get_array_name_without_extra_char

public static java.lang.String get_array_name_without_extra_char(java.lang.String n)
Return the package name for this class
Parameters:
n - The full class name
Returns:
The package name

get_relative_name

public static java.lang.String get_relative_name(java.lang.String n)
Return the name of the class without the package name
Parameters:
n - The full class name
Returns:
The class name

get_path

public static java.lang.String get_path(java.lang.String n)
Return the path of the directory of the given file
Parameters:
n - The full class name (package + name)
Returns:
The path where the file could be found

get_absolute_idl_name

public static java.lang.String get_absolute_idl_name(java.lang.String n)
Return the absolute name of the class ::toto::titi
Parameters:
n - The full class name
Returns:
The absolute name

get_primitive_type

public static java.lang.String get_primitive_type(java.lang.String str)
Return the equivalent idl type
Parameters:
str - The name of the primitive type
Returns:
The associated primitive type name

split_accessor_name

public static java.lang.String split_accessor_name(java.lang.String n)
Return the name of the property
Parameters:
n - The full method name
Returns:
The property name

return_existing_object

public org.openorb.compiler.object.IdlObject return_existing_object(java.lang.Class c)
Return the object corresponding to the class if it exists
Parameters:
c - The class to search for
Returns:
The object if it exists null otherwise.

return_existing_object

public org.openorb.compiler.object.IdlObject return_existing_object(java.lang.String c_full_name)
Return the object corresponding to the class name if it exists
Parameters:
c_full_name - The full class name to search for
Returns:
The object if it exists null otherwise.

add_idl_object_as_first

public static void add_idl_object_as_first(org.openorb.compiler.object.IdlObject idlObj,
                                           org.openorb.compiler.object.IdlObject sub_idlObj)
Insert the sub idl_object at the first place of the list
Parameters:
idlObj - The parent idl object
sub_idlObj - The sub idl object to add to the parent