JAXB Wizard and Code-Seeder Palette User's Guide

Similar documents
Oracle Retail MICROS Stores2 Functional Document Tax Free - Manual Receipt Number Assignment Release September 2015

Oracle Fusion Middleware. 1 Oracle Identity Management Templates

Oracle Retail MICROS Stores2 Functional Document Sales - Reasons Release September 2015

Review Employee Leave Balances

Oracle Retail MICROS Stores2 Functional Document General - License Control Release September 2015

Reviewing Employee History

Oracle Cloud E

StorageTek Library Attach for Window Servers

Oracle Enterprise Manager

New Features in Primavera Contract Management 14.1


Vendor Performance Summary Report

NetFlow Collection and Processing Cartridge Pack User Guide Release 6.0

Oracle Communications Network Charging and Control. Release: 4.4

About Contract Management

Oracle Cloud E

COPYRIGHT & TRADEMARKS

Revenue/Expenses Balance by Fund

Oracle Enterprise Manager

Oracle Fusion Middleware

New Features in Primavera P6 Professional 15.1

Introduction to Virtual Datacenter

Third Party System Management Integration Solution

Oracle FLEXCUBE Direct Banking Release Help Desk User Manual. Part No. E

Approve or Reject Purchase Requistions, Contracts, and Purchase Orders

Oracle Hospitality Payment Gateway Services Release Notes Release Part Number: E January 2016

Oracle Fusion Middleware

Oracle VM. Paravirtual Drivers Installation Guide for Microsoft Windows for Release E May 2012

Oracle Enterprise Manager Ops Center. Introduction. Tuning Monitoring Rules and Policies 12c Release 1 ( )

Oracle Audit Vault Administrator s Guide Oracle Audit Vault Auditor s Guide Oracle Enterprise Manager Cloud Control Administrator s Guide

Bank Account Numbers for ACH Payments

Oracle Fusion Transactional Business Intelligence

Oracle Retail Customer Engagement Cloud Service (Relate) Release Notes Release March 2015

1 What Are Web Services?

Oracle Cloud. Creating a Business Intelligence Cloud Extract E

Oracle Retail MICROS Stores2 Functional Document Customers - Online Centralized Customer Management Release September 2015

Oracle Enterprise Manager

Siebel Application Deployment Manager Guide. Siebel Innovation Pack 2013 Version 8.1/8.2 September 2013

Oracle Business Intelligence Publisher. 1 Oracle Business Intelligence Publisher Certification. Certification Information 10g Release 3 (

Oracle Retail MICROS Retail-J. Inventory Management: Stock Adjustments Release 13.0

Oracle Enterprise Data Quality. 1 JMX Binding. 1.1 Examples. Java Management Extensions Configuration Release 11g R1 ( )

Oracle Java Micro Edition Software Development Kit

Oracle Enterprise Manager. Introduction to the Oracle Virtual Networking Plug-in. Requirements. Supported Versions

Customer Order Portal Created on 9/24/ :45 PM

Crystal Access Guide HCM 9.1 All Sites

Oracle WebCenter Sites. Backup and Recovery Guide 11g Release 1 (11.1.1)

Oracle Field Service Cloud SmartCollaboration Administration Panel. Release 4.5

Oracle Virtual Desktop Client. Release Notes for Version 3.0

Oracle Banking Digital Experience

Oracle. Human Capital Management Cloud Using Workforce Reputation Management. Release 11. This guide also applies to on-premise implementations

Oracle Virtual Desktop Client for ipad. User Guide for Version 1.0

Oracle CRM On Demand Connected Mobile Sales Administration Guide. Version March 2012

Oracle Cloud. What s New for Oracle Compute Cloud Service (IaaS) Topics. July What's New for Oracle Compute Cloud Service (IaaS) Release 16.

Integrating Oracle Sales Cloud, Release 9 with JD Edwards EnterpriseOne release 9.1 Implementation Guide

PeopleSoft Enterprise Campus Solutions 9.0 Enrollment Web Services

Oracle Sales Cloud Reporting and Analytics Overview. Release 13.2 Part Number E January 2014

Oracle Transactional Business Intelligence Enterprise for Human Capital Management Cloud Service

1 Changes in this release

Oracle Transactional Business Intelligence Enterprise for Human Capital Management Cloud Service

Oracle WebLogic Server

IBM WebSphere Portal Reference Guide Release 9.2

How To Customize An Orgsync App On Anorus Mobile Security Suite On A Microsoft Ipad Oracle 2.5 (Ios) On A Pc Orca 2.2 (Iphone) On An Android Orca2 (Ip

Functional Enhancements

New Features in Primavera P6 EPPM 16.1

Oracle Virtual Desktop Client for Android. Release Notes for Release 1.2

Scheduler JAVA JOB Creation Oracle FLEXCUBE Investor Servicing Release [September] [2014]

Oracle Banking Digital Experience

Oracle Order to Activate Integration Pack for Siebel CRM and Oracle Communications Order and Service Management

Note : It may be possible to run Test or Development instances on 32-bit systems with less memory.

Oracle Cloud E

Version Using Oracle Commerce Cloud Service Agent Console

Oracle Banking Digital Experience

Oracle Cloud E

Configuring Secure Network Communications for SAP

Oracle Database. How To Get Started. April g Release 2 (10.2) for or IBM z/os (OS/390) B

Report Writer's Guide Release 14.1

Hardware and Software Requirements

Human Resources 9.1 Basic Navigation Guide

Siebel Correspondence, Proposals, and Presentations Guide. Siebel Innovation Pack 2013 Version 8.1/8.2 September 2013

JD Edwards EnterpriseOne Applications

MySQL and Virtualization Guide

Oracle Communications Network Charging and Control. Session Initiation Protocol (SIP) Protocol Implementation Conformance Statement Release 5.0.

Oracle Retail Clearance Optimization Engine. Overview. About Patch Releases. Release Notes Release

JD Edwards EnterpriseOne Tools. 1 Understanding JD Edwards EnterpriseOne Business Intelligence Integration. 1.1 Oracle Business Intelligence

Oracle WebCenter Content Service for Microsoft Exchange

Oracle Hospitality OPERA Cloud Services Security Guide Release 1.20 Part Number: E April 2016

Oracle Enterprise Single Sign-on Logon Manager How-To: Configuring ESSO-LM Event Logging with Microsoft SQL Server 2005 Release

Siebel Installation Guide for Microsoft Windows. Siebel Innovation Pack 2013 Version 8.1/8.2, Rev. A April 2014

Required Ports and Protocols. Communication Direction Protocol and Port Purpose Enterprise Controller Port 443, then Port Port 8005

Application Interface Services Server for Mobile Enterprise Applications Configuration Guide Tools Release 9.2

Oracle Utilities Integration for Device Operations

University of Missouri

Siebel Social Media Guide. Siebel Innovation Pack 2013 Version 8.1/8.2 September 2013

Contents Legal Notices... 2 Preface... 5 Introduction... 7 Installation Instructions... 8

2 Software requirements and installation

P R O V I S I O N I N G O R A C L E H Y P E R I O N F I N A N C I A L M A N A G E M E N T

Reference Process Models User's Guide for Oracle Application Integration Architecture Foundation Pack 11g Release 1 ( )

Oracle Agile Product Lifecycle Management for Process

Siebel Installation Guide for UNIX. Siebel Innovation Pack 2013 Version 8.1/8.2, Rev. A April 2014

Oracle Virtual Desktop Infrastructure. VDI Demo (Microsoft Remote Desktop Services) for Version 3.2

Transcription:

JAXB Wizard and Code-Seeder Palette User's Guide Part No: 821 2634 December 2011

Copyright 2009, 2011, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS. Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065. This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services. 120126@25097

Contents Using the JAXBWizard and Code-Seeder Palette... 5 Performing a Typical JAXB Binding Process...6 To Perform a Typical JAXB Binding Process...6 The JAXB Wizard...7 Code-Seeder Palette (JAXB) Wizard Editor Palette Actions...8 3

4

Using the JAXB Wizard and Code-Seeder Palette The Java Architecture for XML Binding (JAXB) provides a fast and convenient way to bind XML schemas to Java representations, making it easy for Java developers to incorporate XML data and processing functions in Java applications. As part of this process, JAXB provides methods for constructing, unmarshalling, and marshalling XML content and data using Java language objects. This allows you to leverage the flexibility of platform-neutral XML data in Java applications without having to work with or even know XML programming techniques. The result is highly portable XML data joined with highly portable Java code that can be used to create flexible and portable applications and Web services. When using integration solutions, data in web services is received and sent through JAX-WS or JAX-RPC. When the data is received it is converted to Java classes, which makes it easy to access when contained in the message. But not all data enters the system through web services. For example, it could enter through Java-based integration applications, where data is read from JMS or from the file system. In either case, there is a similar need to be able to access the data through Java classes. The JAXB Wizard enables you to generate Java classes from an XSD or DTD inside the IDE. The Code-Seeder Palette's functionality allows you to generate template code in order to marshal, unmarshal, construct JAXB Objects to and from many sources. Sources can be JMS Message, String, or File. What You Need to Do The following topics provide instructions on how access and use data to generate Java classes from an XSD or DTD inside the IDE. Performing a Typical JAXB Binding Process on page 6 The JAXB Wizard on page 7 Additional Resources 5

Performing atypical JAXB Binding Process Below are links to additional information, tutorials, and a screencast to help you work with the JAXB Wizard and Code-Seeder Palette: Using JAXB to Process XML Payloads (http://webcast-west.sun.com/interactive/ 09B01880/index.html) This is a 14 minute screencast. It might take some time to download. Binding WSDL to Java with JAXB (http://www.netbeans.org/kb/docs/websvc/ jaxb.html) This is a short JAXB tutorial. JAXB Sample (http://wiki.netbeans.org/nb6jaxbsample1) Frequently Asked Questions (http://wiki.netbeans.org/faqjaxb) Performing a Typical JAXB Binding Process The JAXB APIs and tools are shipped in the taxi subdirectory of the Java WISED. This directory contains sample applications, a JAXB binding compiler (SC), and implementations of the runtime binding framework APIs contained in the javax.xml.bind package. For more information on binding between XML Schema and Java Classes, refer to the following tutorial: http://download.oracle.com/javaee/5/tutorial/doc/bnazf.html. To Perform a Typical JAXB Binding Process The following steps demonstrate ONE particular way to bind XML schemas and Java representations. Depending on your requirements, the binding process can be achieved in several different ways. 1 2 3 Generate JAXB classes. An XML schema is used as input to the JAXB binding compiler to generate JAXB classes based on that schema. Compile JAXB classes. All of the generated classes, source files, and application code must be compiled. Unmarshal XML documents. XML documents written according to the constraints in the source schema are unmarshalled by the JAXB binding framework. 6 JAXBWizard and Code-Seeder Palette User's Guide December 2011

Note JAXB also supports the unmarshalling of XML data from sources other than files/documents, such as DOM nodes, string buffers, and SAX Sources. 4 5 Generate the content tree. The unmarshalling process generates a content tree of data objects instantiated from the generated JAXB classes; this content tree represents the structure and content of the source XML documents. Validate source XML (optional). The unmarshalling process optionally involves validation of the source XML documents before generating the content tree. Note If you modify the content tree in Step 6 (below), you can also use the JAXB Validate operation to validate the changes before marshalling the content back to an XML document. 6 7 Process content. The client application can modify the XML data represented by the Java content tree by means of interfaces generated by the binding compiler. Marshal the content tree out to one or more XML output documents. The content may be validated before marshalling. To summarize, using JAXB involves two discrete sets of activities: Generate and compile JAXB classes from a source schema, and build an application that implements these classes Run the application to unmarshal, process, validate, and marshal XML content through the JAXB binding framework These two steps are usually performed at separate times in two distinct phases. Typically, there is an application development phase in which JAXB classes are generated and compiled, with a binding implementation being built. That is followed by a deployment phase in which the generated JAXB classes are used to process XML content in an ongoing live production setting. The JAXB Wizard The JAXB wizard enables you to generate and compile JAXB classes for a schema, while not requiring a knowledge of the JAXB XML Binding Compiler (xjc) Tool. The wizard also helps in code completion for generated classes. JAXB code generation and compilation is made part of the project's compilation and build task. Once the JAXB Binding is created, the code seeder Palette actions will help you in using the JAXB generated classes in constructing, marshalling, and unmarshalling Using the JAXBWizard and Code-Seeder Palette 7

Code-Seeder Palette (JAXB) Wizard Editor Palette Actions The Code-Seeder Palette (JAXB) Wizard contains the following palette actions. Constructs JAXB Object on page 8 Marshal JAXB Object on page 11 Unmarshal JAXB Object on page 13 FIGURE 1 Palette Menu Constructs JAXB Object The Constructs action generates code to instantiate JAXB objects. This code generation is useful in automating the generation of a series of getter and setter methods, especially when the JAXB object contains a series of nested objects. The code that is generated will not only instantiate the JAXB Object, but will also populate all the nested objects with initial values. This instantiation and population of values and objects can be done by passing a sample XML file. The Sample XML file needs to conform to the XSD/Schema used to generate the JAXB class. When sample XML file is not provided, all the nested JAXB members objects are instantiated. 1 To Generate Code Using the Constructs JAXB Object Drag and drop the Constructs JAXB Object icon into the IDE editor of an existing project. The Generate JAXB Constructs code dialog box is displayed. 8 JAXBWizard and Code-Seeder Palette User's Guide December 2011

FIGURE 2 JAXB Constructs Object 2 Enter the JAXB class name with the package name to be instantiated/initialized. You can also use the Find button to search for the class (as shown below). FIGURE 3 Find Class Type 3 Enter a sample XML file (if available) for the initialization code to use. Update the auto generated method name if required. Using the JAXBWizard and Code-Seeder Palette 9

FIGURE 4 Providing Sample XML File 4 Assuming the XML file conforms to the schema used in generating JAXB classes, a method will be created (as shown below). FIGURE 5 Successful Method Created If the sample XML file is not provided, the code generated will not populate the default values (as shown below). 10 JAXBWizard and Code-Seeder Palette User's Guide December 2011

FIGURE 6 Unpopulated Method Marshal JAXB Object The Marshal palette icon action generates template code to marshal a JAXB object. This provides the ability to convert a Java object tree back into XML data. There is no difference between marshalling a content tree that is created manually using the factory methods and marshalling a content tree that is the result of an unmarshal operation. Clients can marshal a Java content tree back to XML data to a java.io.outputstream or a java.io.writer. You must know the Class name of the object you are trying to marshal. You can search for the class using the Find button. The template code can be generated to marshal a JAXB object to a String, OutputStream, File, Writer, or byte array. Note The Code-Seeder currently generates code using a single package name in the context path. You may want to edit the code if more than one package name is needed in the context path. 1 To Generate Code Using the Marshal JAXB Object To marshal an existing JAXB class object, drag and drop the JAXB Marshal palette icon to IDE editor. The Generate JAXB Marshal codedialog box is displayed. Using the JAXBWizard and Code-Seeder Palette 11

FIGURE 7 JAXB Marshal Object 2 3 Enter the JAXB object's class name or use the Find button to search for the class. (as in the Construct's Figure 3section) Select the MarshalTo option.you can generate the code from a marshal JAXB object to one of String, Writer, OutputStream, JMSTextMessage, or File. FIGURE 8 Select Marshal To The desired method will be generated (as shown below). FIGURE 9 Marshal Generated Method 12 JAXBWizard and Code-Seeder Palette User's Guide December 2011

Unmarshal JAXB Object The Unmarshal palette icon action will generate template code to unmarshal a JAXB object. This allows for any global XML element declared in the schema to be unmarshalled as the root of an instance document. The JAXBContext object allows the merging of global elements across a set of schemas (listed in the contextpath). This means that a client application is able to unmarshal XML documents that are instances of any of the schemas listed in the contextpath. You must know the Class name of the object you are trying to unmarshal. Since each schema in the schema set can belong to distinct namespaces, the unification of schemas to an unmarshalling context should be namespace-independent. You can search for the class using the Find button. The template code can be generated to unmarshal a JAXB object from a String, InputStream, File, Reader, or byte array. Note The Code-Seeder currently generates code using a single package name in the context path. You may want to edit the code if more than one package name is needed in the context path. 1 To Generate Code Using the Unmarshal JAXB Object To unmarshal an existing JAXB class object, drag and drop the JAXB Unmarshal palette icon into the IDE editor. The Generate JAXB Unmarshal code dialog box is displayed. FIGURE 10 Unmarshal Option 2 3 Enter the JAXB object's class name or use the Find button to search for the class. Select the Unmarshal From option. You can generate the code to unmarshal a JAXB object from one of String, Reader, InputStream, JMSTextMessage, or File. Using the JAXBWizard and Code-Seeder Palette 13

FIGURE 11 Select Unmarshal From The Unmarshal Method will be generated as shown below. FIGURE 12 Unmarshal Method 14 JAXBWizard and Code-Seeder Palette User's Guide December 2011