Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, August 6, 2008

Java Proxy Objects Tables Developing Message Interfaces

Unbounded Occurring Elements in XSD

Neither XSD nor Java has an explicit table type. However, in XSD you can define elements so that there is no limit to how often they may occur (also see: Elements and Attributes). For example, assume you require a data type staff, which you can use to select a group of colleagues as members of staff and assign them a manager. The following table reflects the definition of this data type in the XSD editor:

Definition of an Unbounded XSD Element Within a Structure

Structure

Category

Type

Occurrence

Description

staff

Complex Type




[-] manager

Element


1

staff manager


name

Element

xsd:string

1



birthday

Element

xsd:date

1


[-] employee

Element


1..unbounded

staff members


name

Element

xsd:string

1



birthday

Element

xsd:date

1


According to this definition, the element employee can occur more than once in the corresponding XML schema.

Conversion to Java Classes

Java proxy generation generates the class Staff_Type for the data type staff. This class can be reused just like the data type in the Integration Repository. The class provides two alternatives for accessing the values of the element employee that can occur infinitely in the message:

  • The method
  • getEmployee() returns an array type Staff_Type.Employee_Type[]
  • The method
  • get_as_listEmployee() returns an object of type Staff_Type.Employee_List for accessing the values with list methods.

The class Staff_Type contains the inner class Staff_Type.Employee_List for accessing with list methods as well as the inner classes Staff_Type.Employee_Type and Staff_Type.Manager_Type.

StaffType.EmployeeList implements the Java interface java.util.List, so that its general methods can be used (for example, the method size() determines the number of elements in the list).

Class Hierarchy with Public Methods in UML Notation

This graphic is explained in the accompanying text

Since the elements manager and employee are defined locally in the data type staff, the Java proxy generation functions generate inner classes. If you reference reusable data types for these elements, the Java proxy generation functions also generate global classes. (However, the inner classes can also be reused).

No comments:

Archives