com.infoengine.soap.util
Class BeanUtils

java.lang.Object
  extended bycom.infoengine.soap.util.BeanUtils

public class BeanUtils
extends Object

IMPORTANT: this class must remain independant of Info*Engine classes so that it can remain portable and be used by clients in non Info*Engine VMs


Field Summary
private static Map DESCRIPTOR_CACHE
           
 
Constructor Summary
BeanUtils()
           
 
Method Summary
static Bean describeBean(String beanClass)
          Retrieves a description of a java bean.
private static javax.xml.soap.SOAPElement findPropertyElement(String pname, javax.xml.soap.SOAPElement bean)
          Searches within a bean XML element for a child property by name.
private static String getType(javax.xml.soap.SOAPElement element, javax.xml.soap.SOAPEnvelope envelope)
          Retrieves the xsi:type from an element and strips the namespace if any.
static void main(String[] args)
          Describes and echos a java bean using introspection.
static Object repopulateBean(javax.xml.soap.SOAPElement element, Bean bean, javax.xml.soap.SOAPMessage message)
          Turns a SOAPElement representing a java bean back into a java bean.
static Object repopulateBean(javax.xml.soap.SOAPElement element, javax.xml.soap.SOAPMessage message)
          Turns a SOAPElement representing a java bean back into a java bean.
static Object repopulateBean(javax.xml.soap.SOAPElement element, String beanClass, javax.xml.soap.SOAPMessage message)
          Turns a SOAPElement representing a java bean back into a java bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIPTOR_CACHE

private static Map DESCRIPTOR_CACHE
Constructor Detail

BeanUtils

public BeanUtils()
Method Detail

describeBean

public static Bean describeBean(String beanClass)
                         throws ClassNotFoundException,
                                InstantiationException,
                                IllegalAccessException,
                                NotSerializableException,
                                IntrospectionException
Retrieves a description of a java bean.

Parameters:
beanClass - The string name of the bean class.
Returns:
The bean description.
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
NotSerializableException
IntrospectionException

getType

private static String getType(javax.xml.soap.SOAPElement element,
                              javax.xml.soap.SOAPEnvelope envelope)
                       throws javax.xml.soap.SOAPException
Retrieves the xsi:type from an element and strips the namespace if any.

Parameters:
element - The element to get the type from.
envelope - The enclosing SOAP envelope.
Returns:
The value of the type attribute or null.
Throws:
javax.xml.soap.SOAPException

findPropertyElement

private static javax.xml.soap.SOAPElement findPropertyElement(String pname,
                                                              javax.xml.soap.SOAPElement bean)
                                                       throws javax.xml.soap.SOAPException
Searches within a bean XML element for a child property by name.

Parameters:
pname - The property name.
bean - The bean parent SOAP element.
Throws:
javax.xml.soap.SOAPException

repopulateBean

public static Object repopulateBean(javax.xml.soap.SOAPElement element,
                                    javax.xml.soap.SOAPMessage message)
                             throws ClassNotFoundException,
                                    InstantiationException,
                                    IllegalAccessException,
                                    NotSerializableException,
                                    IntrospectionException,
                                    javax.xml.soap.SOAPException,
                                    InvocationTargetException
Turns a SOAPElement representing a java bean back into a java bean.

Parameters:
element - The SOAP element.
message - The associated SOAP message.
Returns:
The repopulated java bean.
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
NotSerializableException
IntrospectionException
javax.xml.soap.SOAPException
InvocationTargetException

repopulateBean

public static Object repopulateBean(javax.xml.soap.SOAPElement element,
                                    String beanClass,
                                    javax.xml.soap.SOAPMessage message)
                             throws ClassNotFoundException,
                                    InstantiationException,
                                    IllegalAccessException,
                                    NotSerializableException,
                                    IntrospectionException,
                                    javax.xml.soap.SOAPException,
                                    InvocationTargetException
Turns a SOAPElement representing a java bean back into a java bean.

Parameters:
element - The SOAP element.
beanClass - The bean class the SOAP element represents (maybe it's untyped in an array).
message - The associated SOAP message.
Returns:
The repopulated java bean.
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
NotSerializableException
IntrospectionException
javax.xml.soap.SOAPException
InvocationTargetException

repopulateBean

public static Object repopulateBean(javax.xml.soap.SOAPElement element,
                                    Bean bean,
                                    javax.xml.soap.SOAPMessage message)
                             throws ClassNotFoundException,
                                    InstantiationException,
                                    IllegalAccessException,
                                    NotSerializableException,
                                    IntrospectionException,
                                    javax.xml.soap.SOAPException,
                                    InvocationTargetException
Turns a SOAPElement representing a java bean back into a java bean.

Parameters:
element - The SOAP element.
bean - The bean descriptor.
message - The associated SOAP message.
Returns:
The repopulated java bean.
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
NotSerializableException
IntrospectionException
javax.xml.soap.SOAPException
InvocationTargetException

main

public static void main(String[] args)
                 throws Exception
Describes and echos a java bean using introspection.

Throws:
Exception