Wednesday Mar 04, 2015

Introduction to REST Service Editor (PART 1)

Introduction to the REST Service Editor, Part 1

By Preston Appel

With the MAF 2.1 release, OEPE users can now easily develop applications that interact with REST APIs. All the tooling that has been added is available via the REST Service Editor. This editor allows the user to experiment with existing REST APIs and to describe their requests and related data types. This blog covers the basic functionality of the editor and its REST Client, REST API and Data Types pages, by showing how you can send a simple GET request to a server and then store a description of the request and of the received payload. Part 2 of this blog leverages this description to generate Java 8 code that consists of an API that can be used to send the request and to consume the received information programatically.


This blog assumes some knowledge of MAF development with OEPE. To create a REST service description that we’ll modify in our REST Service Editor, we need a MAF 2.1 application. Here is an outline of how to create it:

  1. From OEPE, click on File/New/MAF Application
  2. Enter the Application display name, confirm that the Runtime version is 2.1.0 and click Next
  3. Alter the project names and default packages as desired and click Next
  4. Add a deployment target, if necessary, and click Finish
  5. Click Yes to open the Oracle MAF Perspective, if prompted

Please refer to the documentation if you need further details.

Creating a REST Service Description

We can begin exploring REST services by creating a REST Service Description, an XMI file that will be modified by our REST Service Editor. REST Service Descriptions can only be created in the view project of a MAF 2.1 application. Below, we create this file by clicking the context menu’s File/New/REST Service Description.
Create a new REST Service Description

On the REST Service Description dialog, enter a new file name, if desired, and click Finish to complete creation of the XMI file and open the REST Service Editor.
REST Service Description wizard

From the image below, you can see the first page of the REST Service Editor: REST Client. The REST Client page is for experimenting with existing applications that expose REST APIs. This page is not part of the persistent state of the REST Service Description, so changes neither dirty the editor nor are they persisted when you save the editor.
REST Service Editor's REST Client page

Testing REST APIs with the REST Client Page

Now, let’s invoke a REST API. For the purposes of this blog, we have a simple resource that will return a list of departments. We start by entering its URI in the Address field. Note that we’re using a GET method.
Address field on the REST Client page

Currently, the editor is geared toward JSON REST services, so we will need to get a JSON payload if we want to import it to create data types. To do this, we modify the Request Details by adding a header to indicate that the request will accept application/json payloads. We do this by clicking the add icon on the Headers tab of the Request Details section. The Add Header dialog supports content assist.
Add Header dialog from the REST Client page

The Headers can be edited, deleted or reordered.
Request Detail's Header section on the REST Client page

After entering the method, address and header, we are ready to send our request. Click on the Send Request button to get a response.
Send Request button on the REST Client page

The status in the Response section indicates that we have successfully sent our request and received a response back.
Response section on the REST Client page

For the purposes of this blog, the more interesting view of the response is the Rendered Content. This will give us a good idea of what data types will be created when we import this JSON payload.
Response section's Rendered Content tab on the REST Client page

We have received back a JSON object containing a JSON array called "departments." Within each department, we have an object (a department) with an id and an array called "employees." The employee object has departmentId, id and name attributes. While not shown, the last employee object also contains a manager object, which is just another employee (at least in our payload). There’s more information on how this payload is imported in the data types section near the end of this blog.

Importing the Request and Data Types

Now we’re ready to import the request and data types from what we have entered on the REST Client page of the editor. Importing this information will allow us to replay the same request in the future and also to generate useful artifacts (like Java code) from it.

To import the request and data types, click Import the REST Client Information at the top of the editor.
Import the REST Client Information button on the REST Client page

We can choose whether to import the request, the data types or both from the information on the REST Client page. Since we want to describe both a REST API and the data types, we leave both checked and click the Next button.
Import REST Client Information wizard's Selection page

We now have some choices about importing the request. First, we set up the root path. It is generally a good practice to split the address up such that a new path is created for each of its segments. This tree structure allows for requests on each of the path segments. In the Root Path field, we’ll break "http://localhost:4545/departments" right after 4545 (by deleting "/departments") so that the "http://localhost:4545" becomes the root path. The "departments" segment will then be created as a child of the root path. In the Importing Revisited section, we’ll import "http://localhost:4545/employees" so that you can further see how this works. We also supply a name for the request, "getDepartments," and click Next.
Import REST Client Information wizard's Import Request page

Finally, we have some information about the data types that will be created. Note in the image below that the box is checked to set the request output to a representation with the appropriate data type. This means that our REST API will then know what data type to use for the data that is returned from the request. We now click Finish to execute the import.
Import REST Client Information wizard's Import Data Type page

Describing the Request on the REST API Page

The import process takes us to the REST API page because we chose to import the Request. Looking at the Outline, we can see that our GET request, "getDepartments," was created and that it has the HTTP Header that we added to it: "Accept=application/json." Also note how a tree of paths was created from the root path and the "departments" segment.

Regarding the editor itself, the asterisk next to the file name at the top of the editor indicates that the file is dirty. This operation has modified the XMI file. It is easy to back out changes, such as this import, since the editor fully supports undo and redo.
REST Service Editor's REST API page

Looking at the Output tab of the Request, we see that, as requested in the import wizard, we now have the representation output appropriately set to Departments1 (the top level object from our JSON payload). We’ll look at the data types in a moment, where we can change the name of Departments1 to something more appropriate.
Request section's Output tab on the REST API page

Probably the safest and fastest way to describe an existing REST API exposed by an application is to use the import process that was just described above. However, new paths and requests can be manually added to the REST API page or existing ones altered. If you do that, it is recommended that you use the Copy to REST Client button, available on requests, so that you can test the work you have done.
Copy to REST Client buttonon the REST API page

Describing the JSON Payload on the Data Types Page

Click on the Data Types tab to see how the JSON payload was imported.
REST Service Editor's Data Types page

Looking at the Departments data type, we see how the JSON payload below maps to what was created.
Departments JSON payload

Departments is a complex type because it has attributes. The id and name are simple attributes, a json.Number and json.String respectively. The employees array has become a complex attribute of data type Employees (it’s plural because the name generator for the data types uses the array name "employees"). The manager type is also the complex type Employees.

Now, the data type Departments is plural for the same reason that the data type Employees is plural— its name is generated from a name in the JSON payload which is plural. But the data type really does just represent a single department. We can easily fix this by simply changing the name to Department. I’ve also changed the name of the Employees data type to Employee since it also represents a single employee.
Departments data types on the Data Types page

So where does the name Departments1 come from for the top-level JSON object in the payload? This comes from the last segment of the address, which is "departments." The name generator had already used the name "Departments," so "Departments1" is used here. Now that we’ve changed the data type Departments to Department, let’s change Departments1 and save the description file. Also note that the Data Types page tells you which requests use a particular data type.
Renamed data types on the Data Types page

As we’ve seen, we can manually alter data types by changing their names. We can also add attributes and new data types. But how does changing an imported data type affect subsequent imports of JSON payloads that use that same data type?

Importing Revisited

Let’s change the address to "http://localhost:4545/employees" on the REST Client page and send the request. We’re still using the GET method and still have the "Accept=application/json" header. We get back a list of employees as our JSON payload.
Employees JSON payload

On importing the employee data, we will import both the request and the data types.
Import REST Client Information for employees JSON payload

The import functionality recognizes that we already have the "http://localhost:4545" root path, so it tells us it will just be creating the child "employees" path. We also provide a name for the request, "getEmployees."
Import Request wizard page for employees JSON payload

Finally, the import wizard tells us what data types it will be importing. Even though we previously renamed the data type Employees to Employee (singular), the wizard sees that the Employees JSON object is the same as (or similar to) the existing Employee data type and offers to use Employee rather than creating a new Employees type, if the “Merge types into the existing matching domain types” box is checked. (Employees1 in this case would come from the last segment of the address "http://localhost:4545/employees" and is the top-most JSON object in the JSON payload.)
Import Data Type wizard page for employees JSON payload

Here we see how we’ve continued to expand the tree of paths with the "employees" path. And remember that each path can have its own requests.
REST API page showing getEmployees request

Moving to the Data Types page, we see how the Employee (singular) data type from our previous import was used and a new Employees1 data type has been created.
Data Types page showing employees import

And to finish the work of describing data types for this blog, I’ve changed the name of Employees1 to Employees and saved the editor.
Data Types page showing final version of employees import

Next Steps: Code Generation

We’ve now experimented with invoking an existing REST API through the REST Client page. That information has been imported to describe the REST API and its associated data types. In the future, we can use the REST Service Description we’ve created to replay the requests through the Copy to REST Client functionality. The description also serves to document the REST API.

Once we’re satisfied with our description of the REST API and the data types it uses, we can also generate Java code from it. That’s covered in Part 2 of this blog.  

Additional Information

Oracle Enterprise Pack for Eclipse OTN Page

Oracle MAF OTN Page

Oracle MAF on YouTube 

New Mobile and REST tools come to OEPE

Oracle Enterprise Pack for Eclipse (OEPE) is a major feature release which provides new design time and runtime tools for Oracle Mobile Application Framework (MAF) 2.1.0 and new tools for REST service development.

Support for Oracle Mobile Application Framework 2.1

OEPE includes new design-time support for and ships the Oracle Mobile Application Framework 2.1. Oracle MAF 2.1 new features include:
  • Support for Java 8 - Java is the language used for business logic development on Oracle MAF, in fact Oracle MAF is the only solution out there that will run the same Java code on both iOS and Android.  Now developers can leverage the latest features of the Java language - such as Lambda expressions, Collections with Generics and more - while running on a 64bit JVM that supports the Java 8 Compact2 profile.
  • Cordova 3 support - Cordova is used in Oracle MAF to provide access to device features. Oracle MAF 2.1 updates the Cordova version to 3.6.3 on Android and 3.7 for iOS, dramatically increasing the number of available plugins that developers can leverage.
  • Simpler Cordova Plugin integration - Oracle MAF leverages the plugman command line to build and incorporate plugins into Oracle MAF apps.
  • Xcode 6 and Android 5 support - use the latest SDKs to compile and deploy your MAF applications across multiple devices.
Additional details for the MAF 2.1 runtime features can be found here and release notes can be found here.

New REST Service Development Tools

Oracle Enterprise Pack for Eclipse provides a new robust editor for developers who work with REST services. The new REST Service Editor includes the following capabilities:
  • Wizards to create a REST service description
  • Invoke REST operations and analyze the Response payload with multiple representations for returned data types 
  • Create complex JSON Request payloads to test deployed REST services
  • Support for multiple security protocols including OAUTH and Basic Auth
  • Generate Java clients of the REST Service based on the service description
  • Create Data Controls to easily bind MAF components to the REST service operations

REST Service Editor in Action

Additional Information

Oracle Enterprise Pack for Eclipse on OTN

Introduction to the REST Service Editor

OEPE YouTube Playlist for Mobile Developers

Oracle MAF Blog

Monday Jun 30, 2014

Android and iOS development comes to OEPE

Oracle Enterprise Pack for Eclipse adds new support for mobile application development using the new Oracle MAF framework. From within Eclipse, you can now develop hybrid mobile applications deploying to both iOS and Android devices. Some of the new features include:

Oracle Mobile Application Framework Design Time Support

  • New MAF Project Wizards help you get started with the correct project structure to start writing mobile applications
  • New MAF perspective configures your workspace with the most relevant Eclipse Views for mobile development
  • Android SDK and Apple XCode Configuration Wizards setup your Eclipse workspace to build and deploy your work to Android and iOS devices and simulators
  • AMX Tag Palette, Drag and Drop Patterns, and Smart Editors help you use and configure over 80 MAF components to develop your mobile applications
  • New Web Service Data Control simplifies binding mobile components to local and remote SOAP-based web services
  • Mobile Application descriptor editor provides a form based editor to assemble MAF applications, manage mobile security, configure Cordova plugins, and more
  • Mobile Feature descriptor editor provides a form based editor to create, manage, and reuse MAF features and more
  • Support for visual Task Flow creation, Bindings, and Data Controls in Mobile application development
  • MAF Feature and Application packaging for sharing and reuse of features across multiple mobile applications
  • AppXray dependency tracking and refactoring for MAF projects including AMX components, feature configurations, application configurations, bindings, task flows, and more
  • Deploy and Debug to Android & iOS Simulators or Devices directly from within your Eclipse workspace
  • Access Device and Simulator error logs of your running applications help debug runtime issues from within Eclipse

Oracle Mobile Application Framework Runtime

Oracle Mobile Application Framework 2.0 is shipped with OEPE zip distributions and available for download through Eclipse Update. No need to download an external runtime as the framework is included with the development tools out of the box.

Oracle Mobile Application Framework Samples

Over a dozen complete Mobile examples applications are included with the MAF tools. These sample demonstrate examples and best practices for data visualization, binding to web services, using Cordova plugins to access device features, and more. See the MAF Example Applications under the standard Eclipse Examples wizard for list of samples and detailed descriptions.

Checkout OEPE OTN page for OEPE downloads, tutorials, and documentation or see the Mobile Application Framework portal for even more information including new training videos and samples.

Sunday Mar 23, 2014

Getting Started with Oracle ADF Essentials in OEPE

Frederic Desbiens takes you through an introduction on how you can use ADF Essentials to develop and deploy ADF applications with OEPE and GlassFish.

Friday Jan 10, 2014

Java 8 at EclipseCon 2014 - Oracle is Gold Sponsor

Oracle is a gold sponsor at the 2014 EclipseCon for North America, March 17-20, San Francisco!

Oracle Enterprise Pack for Eclipse (OEPE) will of course be representing. If you're going, you should definitely checkout our new mobile development capabilities.

Java 8 is also a huge deal as it planned to be GA around this time.  If you're interested, there is a dedicated track covering Java 8.  The schedule is still in the works, but you can check it out here.

Wednesday Oct 16, 2013

Harnessing the Power of WebLogic and Coherence, November 5, 2013

Register now for OTN Virtual Developer Day
Harnessing the Power of WebLogic and Coherence, November 5, 2013

Join us for Oracle Technology Network's Virtual Developer Day, a new, free, hands-on virtual developer workshop. Java Developers and Architects can attend live, moderated sessions and hands-on labs to learn how to leverage existing skills to take advantage of features in Oracle WebLogic and Oracle Coherence, core components of Oracle's Cloud Application Foundation.  

There will be live chats w/ Oracle tech staff throughout the event.  Check it out.

Friday Aug 02, 2013

OEPE Coherence Grid Archives (GAR) Support


OEPE 12c (12.1.2) release supports Coherence Grid Archives (GAR) application development and deployment to WebLogic Server 12c (12.1.2). A Coherence application is a set of artifacts packaged in a jar called Coherence Grid Archive (.gar), which can be deployed to WebLogic Server 12c as a stand-alone module or bundled in an EAR project. This tutorial demonstrates the various GAR features available in OEPE.

Development Environment Set-up

 OEPE 12c (12.1.2)
 From OTN, download and extract OEPE
 Oracle WebLogic Server 12c (12.1.2)
 From OTN, download and install WLS RT

GAR Project Configuration

Like in any application development, the first step is to create the project that contains required configuration files and libraries.

  • Launch eclipse.exe and switch to a new workspace
  • Switch to Java EE perspective
  • A new wizard is provided to create GAR project
    • From the File | New menu launch "Oracle Coherence Project"
    • Type in a name, "GARDemo"
    • Create a new 12.1.2 RT selecting WLS home (ex: C:\12.1.2-wls-home\wlserver)
    • NOTE: You can create a standalone GAR project or bundle in an EAR
    • For demo purpose, make sure to check "Add project to an EAR"
    • On the project wizard, navigate to Library management page and note the listing of "Coherence Library in Fusion Middleware Install". And also the option to generate the required configuration files.
    • Click Finish
  • In project explorer, notice the generation of default coherence configuration files and library jars
  • Also note the creation of sample web project that can be used as a view module

Configure Coherence project

  • Download and extract to GARDemo | src folder (if required, refresh the project root)
  • Define Application Lifecyle listener
    • In Project Explorer, GARDemo | src | META-INF, double click on coherence-application.xml
    • NOTE: The coherence application file is based on Sapphire based xml editor
    • Check Application lifecycle listener, browse and select "LifeCycleReactor"
    • Save and close coherence-application.xml file
  • Configure Coherence Portable Object Format (POF)
    • In Project Explorer, GARDemo | src, open pof-config.xml
    • Copy-paste the content of <user-type> , <allow-intefaces> and <allow-subclasses> from sample file
    • Save and close pof-config.xml file
  • Export "Oracle Coherence Library"
    • In Project Explorer, right click on GARDemo | Properties | Java Build Path & switch to "Order and Export" tab
    • Make sure to select "Oracle Coherence Library"
    • FYI: We will need the libraries to reference coherence classes in web project 
    • Click OK and dismiss the properties dialog

Configure Web project

  • Add JSF Facet and define coherence deployment assembly
    • In Project Explorer, right click on GARDemoWeb | Properties | Deployment Assembly
    • Click Add and select GARDemo project
    • NOTE: The coherence module is recognized as a GAR (.gar) project
    • Click Apply
    • On the properties dialog, select Project Facets and check JSF Facet version 2.1
    • Click OK and dismiss properties dialog
  • Download and extract to GARDemoWeb | src folder (if required refresh project root)
  • Download and extract to GARDemoWeb | WebContent folder

Deploy Coherence application

  • In the Server view, create a new 12c server configuration
  • NOTE: The server configuration wizard provides an option to create new domain
  • Like any other JSP file, right click on ContactList.jsp and run on 12c server
  • On the Browser, click on "Insert 20 Random Contacts" and generate contact list
  • Optional: You can also exercise other operations, Create, Delete and Update Contact info
  • In the Server view, right click on GARDemoEar and remove the project (un-deploy) from the server

GAR Deployment Support

  • Similar to other Java EE module, the GAR project can be deployed in any of the three WLS supported modes
    • Split source (default mode, also known as Virtual deployment)
    • Exploded archive (packaged in a EAR)
    • In addition to local server, the GAR project can also be deployed to remote server instance

Packaging GAR Project

  • Similar to WAR, the GAR project can be added to WLS 12c instance as a stand-alone module (supported only in Exploded archive)
  • In the above demo we packaged GAR module in an EAR project
    • On creating GAR project bundled in an EAR, the weblogic-application.xml is auto configured with GAR module
    • A validation in weblogic-application.xml ensures only one GAR module can be bundled in an EAR
  • NOTE: As a special case, GAR project bundled in EAR can be deployed both as a stand-alone module and packaged in EAR

Export project as GAR module

  • Similar to Web project .war file, a GAR project can be exported to a .gar file


Introduction to GAR

Thursday Jul 11, 2013

New Oracle Enterprise Pack for Eclipse 12c (12.1.2) is Now Available!

In tandem with the new Oracle Cloud Application Foundation release today, OEPE 12.1.2 is perfectly synced with the latest release of Oracle WebLogic 12.1.2 and Oracle Coherence 12.1.2.

New and unique support for ease of design, development, configuration and deployment into Oracle Coherence:

  • Rich Deployment Descriptor editors including form based wizards and design time validators
  • Context sensitive help links directly into Coherence documentation
  • New tools for Coherence Managed Servers including project wizards for Coherence Grid Archive (GAR)
  • Packaging and deployment directly to WebLogic Server or Coherence Servers
  • Ability to deploy a GAR directly, embed as a library in other applications, or deploy as a shared library

Newly update WebLogic Server Adapter which provides unmatched access and ease of configuration for the Oracle WebLogic Server including:

  • Run/Deploy/Debug artifacts both locally and remotely
  • Detailed support for management of shared libraries
  • Ability to utilize FastSwap, which provides the ability to reload certain classes/components of an already deployed application
  • Direct access to management of WebLogic SCA tooling
  • Ability to configure and manage WLST (WebLogic Scripting Tool) artifacts
  • Tie in to the WebLogic MBean Browser

And don’t forget, this is all on top of the recent OEPE update for Java EE7!

Sign up for the official Cloud Application Foundation launch here

More info and download for Oracle Enterprise Pack for Eclipse is here

Tuesday Jun 25, 2013

Getting Started with GlassFish 4 and OEPE

Oracle Enterprise Pack for Eclipse introduces new support for GlassFish 4.0, the reference implementation of Java EE7. 

Getting started with GlassFish 4.0 in Eclipse couldn't be easier. Follow these short steps to get GlassFish 4.0 setup so you can start developing, deploying, and debugging your Java EE7 applications.


GlassFish 4.0

Oracle Enterprise Pack for Eclipse from OTN or Eclipse Marketplace

Setting up the server connection

In the Servers view, click to add a New > Server .

Select GlassFish 4.0 from the list of supported server configurations.

Pick your GlassFish installation directory (usually <glassfish 4>/glassfish) and select your domain.

After you click Finish you should now be setup to launch Glassfish 4.0 in normal and debug mode within Eclipse as well as associate projects for deployment through the Add and Remove wizard.

Using GlassFish tools in Eclipse

GlassFish server tools provide some useful information about your running GlassFish 4.0 environment.

Resources displays current resources deployed in the domain including your JDBC Connection Pool and JDBC Resource names. I find this extra bit of information useful when working with JPA.

Deployed Applications shows the current active deployments in GlassFish which can be undeployed as needed from within Eclipse.

Deployed Web Services provides information about SOAP-based web services deployed in this domain.

Also with the running server are quick launch links to open the Administrative Console, Server Logs, and the GlassFish Community Site all within Eclipse's embedded browser.

Wednesday Jun 12, 2013

New Java EE7 and Glassfish Support in OEPE

Oracle Enterprise Pack for Eclipse is now available for download from OTN and Eclipse Marketplace and includes new tooling for Glassfish and Java EE7.

The Glassfish Server tooling plugins have been redesigned in OEPE with a focus on performance, stability, and polish and include the following features:

  • New tooling architecture improves stability and performance when developing applications against Glassfish
  • Support for Glassfish 3.x and now 4.0
  • Target new projects against Glassfish Server and create appropriate deployment descriptors (glassfish-ejb-jar.xml, glassfish-web.xml)
  • Deploy and debug Web and Enterprise Applications directly out of the Eclipse workspace
  • View and manage deployed Applications, Web Services, and Resources on active Glassfish servers
  • Quick access to Glassfish Admin Console, Server Logs, and Glassfish Community Sites from within Eclipse

Eclipse Kepler (4.3) is the first release of Eclipse to support Java EE7 and, when combined with OEPE's Glassfish 4 support, Eclipse users get a development environment to develop, run, and test Java applications with the latest spec.  Some of the new feature enhancements in Eclipse Kepler which enable Java EE7 development are as follows:

  • Eclipse Kepler (4.3) adds new design time support for Java EE7 through the Web Tools Platform (WTP)
  • Updated Project Facets and Wizards for new Java EE7 spec levels (ie: Servlet, EJB, JPA, Web Services, JAX-RS, JSF)
  • Develop Java EE7 applications in Eclipse and run, deploy, and debug with Glassfish 4

For more information on the latest Java EE7 features and announcements, check out the Java EE7 blog.

Additional information about OEPE can always be found on the OEPE OTN page.

Thursday May 30, 2013

New WebLogic Management Tools Webcast is Now Available

 If you missed Greg Stachnick's webcast, no worries!  The recording is available on demand here.  

The best eclipse based tools for the Oracle platform simply gets better and better.  Download Oracle Enterprise Pack for Eclipse here.

Friday Mar 29, 2013

Back from a Succcessful EclipseCon Boston

Good to be back home from a successful EclipseCon Boston. (Duke approved!) We met some good folks, learned of some interesting projects/technologies and quaffed a few delicious local beers.  After a tour down Salem street in the evening, I can definitely see why locals (and tourists), love Boston. (I still wish we could have made it into Neptune Oyster, but the wait was measured in hours - maybe next time.)   I don't follow hockey, but Bruin fans, tough loss to Montreal.  My Canadian co-workers were cheering (quietly) at the bar... as we were surrounded by Bruin fans.  And well, you know - polite and all that.  

EclipseCon 2014 - perhaps next year, it will be San Francisco?  Cheers.

Thursday Feb 21, 2013

ADF Application Development Using OEPE v12.1.1.2


OEPE has been iteratively providing more ADF tooling with each release. The latest v12.1.1.2 release provides features that allows us to develop a fully functioning ADF application. The following tutorial describes HR sample application development using ADF features supported by OEPE release v12.1.1.2. It covers some of the key ADF toolings like Data Control generation on EJB, generation of Data First & UI First scenario, Page Definition editor, ADF Table generation, generation of DVT graph and some of the cool AppXray features.

Development Environment Set up

OEPE v12.1.1.2
From OTN, download and install OEPE w/ WLS Runtime
Oracle DB 10g / 11g
Use the sample HR schema bundled in Oracle DB

Create ADF Application

  • Start Eclipse with an empty workspace
  • Switch to Java EE perspective
  • Launch File | New | Oracle ADF Application wizard
  • Type in application name, "HR" 
  • Create a new run time selecting WebLogic Server 10.3.6 instance 
  • Launch "New JPA Project" wizard, click on Modify... button and select utility module facet
  • On the JPA project wizard, click Next and navigate to "JPA Facet" Page
  • For platform, select "EclipseLink 2.1.x" and verify the selection of "WebLogic System Library (Oracle TopLink 11gR1)" implementation
  • Click on "Add connection..." and create a new 10g/11g "Oracle Database Connection"
  • On the JPA project wizard, click on "Override default schema from connection" and click Finish
  • NOTE: Click "No" on switch perspective dialog
  • On the ADF Application wizard, click Finish

Figure 1: Oracle ADF Application wizard

Generate Data Model

  • In Project Explorer, right click on "HRModel" | New | "JPA Entities from Tables"
    • On "Select Tables", pick "Employees" & "Department" table and click Next
    • Retain default "Table Associations" and click Next
    • On "Customize Default Entity Generation", type in a package name and click Finish
  • Open and update with @NamedQuery(name="findAllEmps", query="select e from Employee e ")
  • Open and update with @NamedQuery(name="findAllDepts", query="select d from Department d")
  • Save the files
  • Generate Data Control artifacts
    • In Project Explorer, right click on "HRModel" | New | Other | Oracle | Application Development Framework | select "ADF Data Model Components" and click Next
    • Type in package name, ex: ejb.beans
    • Type in class name, ex: "HRModelSessionEJB" and click Next
    •  Double click on "Employee" entity and move it over to selected panel
    • Click Next, retain default object type "ADF Data Control" and click Finish

Figure 2: ADF Data Model Component wizard

Iterative Data Control artifact generation

  • In Project Explorer, expand HRModel | src | ejb.beans and right click on "HRModelSessionEJB" | Model Components | Edit Session Bean Facade ...
  • On Edit Session Bean Facade, double click on Department and move it over to selected panel, click Finish
  • In Project Explorer, right click on HRModel | src | model | "HRModelSessionEJB" | select Model Components | Create ADF Data Control

Figure 3: Edit Session Bean Facade and ADF Data Control

Data First, Department Id artifact generation

  • Create ADF page
    • In Project Explorer, right click on "HRWeb" project | New | JSP File, type in file name "emplist.jspx" and click Next
    • On template selection page, select "ADF Rich Faces Page - Three Columns (xhtml, xml syntax)" and click Finish
    • In the JSP source view, modify the facet order, i.e. move "f:facet name=start" before "f:facet name=center"
  • Generate ADF OutputText tag on departmentId artifact
    • In the JSP source view, place the cursor within "f:facet name=start" tag
    • On the Palette view, switch to Tags tab, expand ADF Faces | DND "Panel Form Layout" and click Finish 
    • On the Palette view, switch to Data tab, expand HRModelSessionEJBLocal | findAllDepts, DND "departmentId" within panelFormLayout as "Text | ADF Output Text w/ Label"
    • save the page

Figure 4: Data First, DND data control artifact

Define artifact in Page Definition editor

  • In Project Explorer, right click on emplist.jspx | Open Page Definition
  • Define new attribute value binding
    • On Page Definition editor, click on + to add new Binding
    • On the New Binding dialog, select "attributeValues" and type in id "deptName", click OK
    • On the details panel, click on "Browse" button
    • On "Rebind Attribute selection", expand findAllDepts and select "departmentName", click OK
    • NOTE: The Page definition editor validates in-valid/undefined binding or iterators.
    • save and close page definition file

Figure 5: Page Definition editor

UI First, Department Name artifact generation

  • Switch to emplist.jspx and place the cursor after closing panelLabelAndMessage tag
  • On the Palette View, switch to "Tags" tab
  • Expand "ADF Faces" node and DND "Panel Label And Message" tag
  • Click on the binding button next to "Label" field and select "bindings.deptName.hints.label", click Finish
  • In the source view, place the cursor within panelLabelAndMessage tag and from Palette view, DND "Output Text" tag
  • Click on the binding button next to "Value" field and select "bindings.deptName.inputValue", click Finish

Figure 6: Panel Label & Message and Output Text tag editors

Generate ADF Tag from Data Palette view

  •  In the JSP source view, place the cursor after closing panelLabelAndMessage tag (i.e. after deptName)
  • On the Palette view, switch to Data tab, right click on "findAllDepts" | Insert in the page | ADF Navigation | Navigation Buttons

Figure 7: Data Palette | Data control artifact context menu item

Generate Employee Table

  •  In the JSP source view, place the cursor within f:facet name=center tag
  • On the Palette view, switch to Data tab, DND "findAllDepts | employees" as Table | ADF Table...
  • On the Table configuration page, select columns EmployeeId, FirstName, LastName and PhoneNumber, remove the remaining entries and click Finish

Figure 8: ADF Table tag editor

Modify Employee Table behavior

  •  In the JSP source view, place the cursor on table tag
  • On the Properties view, click on "Edit Component Definition"
    • Check "Read-only Table", select "Single row", and "Enable sorting"
  • Click Finish and save the page

Figure 9: Edit Component definition editor

Generate DVT Graph

  • In the JSP source view, place the cursor within "f:facet name=end" tag
  • In the Data Palette view, right click on findAllDepts | employees | Insert in the page | Graph | Bar Graph
    • Retain default Bar Graph Type and select second layout, click Next
    • Bars: Click "Add attribute" and select "employeeId"
    • X axis: Click "Add attribute" and select "salary", click Finish

Figure 10: Bar Graph wizard

Smart editor, Graphical representation of Binding references

  •  In the JSP source view, place the cursor on jsp:root tag
  • On the Properties view, switch to "Bindings" tab
    • You can navigate to the binding definition, iterator or referenced tag on the JSP page
    • Also, you can place the cursor on individual tag to view the corresponding binding references

Figure 11: Smart editor binding references

AppXaminer, Graphical representation of ADF artifact references

  • In Project Explorer, right click on emplist.jspx | Show AppXray Dependencies
    • The AppXaminer displays all web artifact references in JSP page, ex: references to resource bundle, image files, adf binding references, jsf managed bean references.
    • For each artifact reference, you can navigate deeper to source file, ex: in case of adf binding, you can navigate all the way up to JPA bean class.
    • The reference link on AppXaminer provides navigation to respective source file
    • In addition to JSP, the AppXray visualization works on other web artifact files, ex: taskflow, page definition, data binding, data control, managed bean or resource bundle file

Figure 12: AppXaminer visualization

Deploy and run ADF application on WLS P5 RT

  • In the Servers view, click on "new server wizard..." link
  • Select WLS PS RT, click Next
    • On "Specify a WebLogic domain directory" page click on create button and create a domain with JRF extension
    • On New Server dialog, click Finish
  • Start the server
  • NOTE: The eclipse internal browser has a known issue with DVT tag rendering, try the following step to use external browser
    • Window | Preferences | General | Web Browser | switch to "Use external web browser" and select Firefox / IE / Chrome
  • In Project Explorer, right click on emplist.jspx | Run As | Run on Server, select WebLogic Server 10.3.6 domain and click Finish

Figure 13: WLS server configuration and RT output of emplist.jspx


Tuesday Jan 22, 2013

Join Us at EclipseCon Boston 2013

Oracle is a Gold sponsor for EclipseCon Boston 2013 March 25-28.  

If you're planning to go, stop by our booth and join our sessions. We'll have a number of sessions and events including:

  • Hudson as an effective Agile ALM Tool (Winston Prakash)
  • Large-Scale Adoption of Hudson (Jim Clark)
  • Dali Tooling for Dynamic Persistence and NoSQL (Neil Hauge)
  • EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5  (Shaun Smith)
  • A couple of presentations covering Oracle Enterprise Pack for Eclipse (Greg Stachnick)
  • Our BoF event: Oracle & Eclipse,Djava Unchained - "the 'D' is silent"



The focus of this blog is on Oracle Enterprise Pack for Eclipse (OEPE) and Oracle's involvement in the Eclipse community. Visit us for information on releases, tips and tricks related to Eclipse, and general Eclipse community information.


« March 2015