Object Definition


You can define a Data Object in either of two ways. Static definition means that the Data Object is structured at development time rather than at run time. This alternative is available only if you can access, at development time, the data definition of interest to you. Dynamic definition means that the Data Object is structured at run time - for example, in response to configuration settings or user input.

Static Definition

Static definition has the following benefits.

  • Your task is easy. You create and submit a data description that (in many cases) is in the form of an XML Schema definition. SDO then generates interface classes that identify getter methods (for reading data from the Data Object) and setter methods (for writing data to the Data Object); also, the product generates a class file that implements those interfaces.

  • In most cases, your code runs faster when creating and processing the Data Object, as compared to the performance when the Object is defined dynamically.

  • The variables in your access statements are strongly typed, protecting against runtime errors that occur if your code assigns data incompatible with the data type.

Static definition is available only in SDO for Java but is expected to be available in other languages.

Even when you use static definition, you can use XPath-like syntax from the dynamic API to retrieve the value of a property. Furthermore, if you categorize an Object as open, you can add properties at run time and use the dynamic API to access them.

Dynamic Definition and Access

When you define a Data Object dynamically, you reference data-type descriptions at run time. This kind of access keeps you from having to maintain any generated interface and implementation files, so you don't need to deploy and maintain them.

Dynamic access is often required or preferable because it increases corporate agility, as in the following cases:

  • Your code queries a database, but characteristics of the database query cannot be known at development time; they are specified by user input or in a configuration file.

    For example, a Web application at Highlight Insurance lets executives review data on active insurance policies. A service invoked by the application returns only the kinds of data requested by the manager, and the data is ordered in accordance with the manager's request. The service provides the needed flexibility by creating a query only at run time, and the result of that query is stored in a Data Object whose specific type is known only at run time.

  • You are developing a service to validate details that are embedded in different kinds of input. For example, a service might check the validity of address data in any of the company's insurance policies (for car insurance, homeowner's insurance, and so on). To support the different kinds of policies that may be added over the years, your service might search the input for a field of a pre-specified address type, rather than relying on the static structure of a specific kind of policy.

Dynamic access is possible because, when you use SDO, you can access not only the business data, but the metadata, which is a description of the data. An example of metadata is an XML Schema definition.




SOA for the Business Developer. Concepts, BPEL, and SCA
SOA for the Business Developer: Concepts, BPEL, and SCA (Business Developers series)
ISBN: 1583470654
EAN: 2147483647
Year: 2004
Pages: 157
Authors: Ben Margolis

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net