Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Sunday, July 13, 2014

ADF Mobile rebrands to Oracle MAF (Mobile Application Framework) - New Name, New Features, Growing Community!

Shortly after the release of ADF 12.1.3 the cross-platform mobile development framework ADF Mobile was rebranded to Oracle MAF (Mobile Application Framework). Nothing has changed on the technical foundation of that mobile framework. It is still based on Apache Cordova, HTML5/CSS3, Java, and offers the possibility to develop offline-capable apps with the help of an embedded SQLite database. The developed hybrid apps run on iOS and Android-based smartphones and tablets.
Oracle MAF (Mobile Application Framework) - Build Once , Run anyware
Oracle MAF Overview
The migration of ADF Mobile Apps to Oracle MAF runs smoothly. The migration is totaly transparent when opening the existing app in JDeveloper 12.1.3/Oracle MAF 2.0 Extension.  Excellent!

A highlight of Oracle MAF is that Apache Cordova plugins (eg barcode scanner plugins) can be integrated. The included sample apps have a showcase for reading barcodes. This is very handy! The integrated barcode scanner gives rise to many new and interesting fields of action. Hope to blog about that in more detail in near future. Stay tuned!

Oracle MAF - Finally integrated BarCode Scanner
Oracle MAF 2.0 -  Barcode Scanner Integration included














I won't list all the new features here, since it is well announced by Shay Shmeltzer here (Say hello to the new Oracle MAF) and here (Oracle MAF hits the street).

Besides the "rebranding" many new "channels" were launched, such as a forum for technical issues, a community at G+, Twitter and Facebook. I have checked all that and summarized the most important links. A lot of activity is going on! Enjoy Exploring;)

Oracle Mobile Application Framework (MAF)

Oracle Mobile Community and Forum

What others write

Saturday, June 7, 2014

Create RESTful services on top of ADF Business Components


Introduction

Creating SOAP Services on top of ADF Model is for a long time quite easy and convenient. In JDeveloper: Open an ApplicationModule goto WebService Tab and create a Service Interface by exposing some given ViewObject Instances or custom Service methods. See http://www.oracle.com/technetwork/issue-archive/2012/12-sep/o52adf-1735897.html (Consume Early, Consume Often) for more details and great explanation or take a look in the official Oracle documentation http://docs.oracle.com/cd/E23943_01/web.1111/b31974/bcextservices.htm#CJAJGIEB (11 Integrating Service-Enabled Application Modules)

Options to create RESTful Services on top ob ADF BC Model

Creating a RESTful Service Fassade on top of existing ADF Business Components Model is not that straightforward. From different „announcements" we know that Oracle plans to generate RESTful Services ADF BC SDO (Service Data Object) in the future. But for now we need a custom solution.

Exploring various possibilities I came up with the following


Note that the Service Facade is optional but recommended in terms of „separation of concerns", „service virtualization", „clean code", etc. Watch the youtube ADF Insider Essentials for the detailed explanation of the Service Facade Pattern.

Going from top to bottom in the diagram we have the following options
a) ADF BC -> SDO Service Interface -> WebService  -> SOAP 
b) ADF BC -> SDO Service Interface -> Inject EJB in REST-Resource -> REST
c) ADF BC -> Use AM Instance programmatically in REST-Resource ->REST
d) this one is planned for some 12.1.3+ release (and in future will be the default option to expose RESTful Services for a given ADF BC Model).

In this post I am covering case b. I did not find a sample on the web yet. So I give it a try cause it looks like THE pragmatic approach so far.

Howto

For the example I am using JDeveloper 12.1.2 and the corresponding Runtim ADF 12.1.2. In order to understand the next steps I assume you know the basics of ADF and JDeveloper.

1. Create ADF BC SDO SOAP Service for an Application Module:
Open the AM in „Overview", goto "Web Service" Tab. Now open the dialog to create the service interface.

Choose the desired VO-Instances and apply you changes.

JDeveloper should generate some files now. If you take a look in the *ServiceImpl.java Class you will notice that  it is exposed as Stateless Session EJB. This is great!

Because from now on you can use the EJB in a REST-Resource to expose it as RESTful-Service. That's what we are planning to do next.

But before this step test your generated (SOAP-based) service first: Make sure you do not ran into the „StackOverflowException" because the SDO Service will try to traverse the ViewLinks recursively. So the following exception might be the one you will run into.

To fix this, open the corresponding ViewLink and uncheck the property „Generate Property in SDO"


2.  Next: Create a new Project for the RESTful Service
Use the right project template from the NEW-Wizard

Open the NEW-Wizard again and create a RESTful service from new

Deselect the Checkbox in front of GET-Method. We are going to do that later in Sourcecode.

Finish. => This should generate a Java class and configure the project with the Jersey Library.
For the sample to complete the project needs on more adjustment in the project properties. 
- One more Library (Context and Dependency Injection CDI)
and a dependency to the Model-Project because the RESTfulWebService project need access to the application module.

Thats all for the project setup.

3. Add some classes, annotations and the methods you want to expose

import javax.ejb.EJB;

import javax.inject.Singleton;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import oracle.jbo.service.errors.ServiceException;

@Singleton
@Path("api")
public class HrRESTResource {
   
    @EJB
    HRAppModuleService serviceBean;
   
    public HrRESTResource() {
    }
   
    /**
     * getEmployeesView1: generated method. Do not modify.
     */
    @GET
    @Path("emp/{empId}")
    @Produces(value = { "application/json", "application/xml" })
    public EmpResult getEmployeesView1(@PathParam("empId") Integer employeeId) throws ServiceException {
       
        EmployeesViewSDO empSDO = serviceBean.getEmployeesView1(employeeId);
       
        EmpResult result = new EmpResult();
        result.setEmployee(empSDO);
       
        return result;
    }
   
    @GET
    @Path("depts")
    @Produces(value = { "application/json", "application/xml" })
    public DeptResult findAllDepartments() throws ServiceException {
        DeptResult result = new DeptResult();
        result.setDepartmentList(serviceBean.findDepartmentsView1(null, null));
       
        return result;
       
    }
}

Important note: For what ever reason you need to annotate the REST-Resource with @javax.inject.Singleton. Otherwise the EJB-Injection won't work.

Just reuse the SDO-Entity-classes (eg. EmployeesViewSDO), but wrap them inside a custom „Result"-class which should be annotated with @XmlRootElement (JAX-B Standard). 

@XmlRootElement

public class DeptResult {
    public DeptResult() {
        super();
    }
   
    @XmlElement(name="departments")
    private List<DepartmentsViewSDO> departmentList;

    public void setDepartmentList(List<DepartmentsViewSDO> departmentList) {
        this.departmentList = departmentList;
    }

    public List<DepartmentsViewSDO> getDepartmentList() {
        return departmentList;
    }
}
See attached sample application for the whole source code.

4. Run an see the RESTful service in action

As a result we will get the proper JSON structure


if changing the accept- Header to: application/xml we will get XML-Result. 

This is pretty cool. Because we can reuse the generated ADF BC SDO SOAP Service Layer as EJB for the REST Fassade.

Download sample application, based on Version ADF 12.1.2: enpit.sample.adf12.restadfbc-jdev1212.zip

More Information



Thursday, May 17, 2012

Java Heap Monitor in JDeveloper

Tested with JDeveloper Version 11.1.1.5, 11.1.2.1

Short post, but hopefully a useful productivity tip. Recently I thought if there isn't such a feature as I was used from some other IDEs
0000@2933_2933-41266b5f570d462a

Monitoring of the java heap size + the ability to force garbage collection.

Finally I found it as you can see from the screen shot above which shows my right bottom of JDeveloper Statusbar.

So how to activate this one? Well it is quite easy. Locate $MW_HOME/jdeveloper/jdev/bin/jdev.conf and add the following line at the bottom

AddVMOption -DMainWindow.MemoryMonitorOn=true

Restart JDeveloper and you should be able to see the java heap size monitor. Clicking on the recycle bin will force garbage collection.
0001@2933_2933-41266b5f592f684c

After garbage collection (in my just started jdeveloper) the used memory dropped from 200M to 105M
0002@2933_2933-41266b5f59d7cc6c

Conclusion
That might save you from restarting Jdeveloper to often a day;)

Further Reading
http://docs.oracle.com/cd/E25178_01/fusionapps.1111/e15524/gs_install_e.htm#CDEFEDGC

Monday, March 12, 2012

Learning from Fusion Applications Development

The purpose of this blog post is to get my feet wet with "the art" of Fusion Applications programming and of course learn best practices from Oracle in the overall application design and architecture for custom ADF Applications. In order to get there I downloaded the following components from Oracles eDelivery Platform:

* Oracle JDeveloper and ADF 11.1.1.5.3

* Oracle Fusion Applications Companion

Installation

Following the Fusion Applications Development Guide I installed the JDeveloper (nothing special here - like every other 11g JDev version). After starting JDev 11.1.1.5.3 I installed a bunch of extensions wich are part of the fusion apps companion package.

...

After JDev Restart I have created a new app usgin the well known app template "Fusion Web Application (ADF)" opened the ViewController preferences and added the following Libraries

0000@2807_2807-41266a99be90e085

When you now create a JSF Page you are able to choose from the following Page Templates:

0001@2807_2807-41266a99bf240796

The UIShell based JSF page looks as follows

0002@2807_2807-41266a99c0369d03

Taking a deeper look into the JSF template we can see a bunch of popup definitions

0009@2807_2807-41266addace209dc

From a UI Pattern perspective I would imagine to see one common practice for popup but as you can see almost every tech. possible solution is in use

0010@2807_2807-41266addae40795d

The UIShellMainArea template is for JSF Fragments has nothing special. It looks like

0003@2807_2807-41266a99c1ad524d

One interesting thing here is that there is another facet exposed which is not visible

0004@2807_2807-41266a99c1f31aed

To ease the development experience with the apps UI Shell a special controller exists that is exposed as datacontrol (UIShellController)

0005@2807_2807-41266a99cb5dad52

Further DC are

0006@2807_2807-41266adda52adb36

0007@2807_2807-41266adda54dbf87

0008@2807_2807-41266adda57e4b18

and many many more.

So now let's create a playground HRAppModule an drop a collection on the page

0011@2807_2807-41266addb71c71c7

The apps extensions have additional support for

Popup
Table
Panel
Dialog Details
Tree
Tree Table

I will try the table

0012@2807_2807-41266addb7a67eac

Pressing "Continue" we are moved to the next interesting screen

0014@2807_2807-41266addb8acf135

After confirming with OK..unfortunataly the visual design is messed up

0015@2807_2807-41266addb9555555

Never mind...under the hood the following is created

0016@2807_2807-41266addba7104ee

Can we run this without looking into the dev guide?

Lets try start the integrated WLS:

<12.03.2012 22:01 Uhr MEZ> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>

<12.03.2012 22:01 Uhr MEZ> <Warning> <JDBC> <BEA-001129> <Received exception while creating connection for pool "SearchDB": I/O-Fehler: Unknown host specified >

<12.03.2012 22:01 Uhr MEZ> <Warning> <JDBC> <BEA-001129> <Received exception while creating connection for pool "SearchDB": I/O-Fehler: Unknown host specified >

=> Solution: fixed the jdbc connection in $DH/config/config.xml. Just pointed it to a valid Oracle DB.

The start procedures moves on. Stops with the following exception:

12.03.2012 22:17 Uhr MEZ> <Error> <HTTP> <BEA-101020> <[ServletContext@8785308[app:FusionAppsCustomization module:FusionAppsCustomization-ViewController-context-root path:/FusionAppsCustomization-ViewController-context-root spec-version:2.5]] Servlet failed with Exception

oracle.jbo.NoDefException: JBO-25002: Definition oracle.apps.fnd.applcore.uicomponents.view.DataControls of type null is not found.

at oracle.jbo.mom.DefinitionManager.findDefObjectUsingMetadataObject(DefinitionManager.java:2918)

at oracle.adf.model.binding.DCDataControlConfigDef.findDefObject(DCDataControlConfigDef.java:32)

=> No solution yet! One more great example of bad exception handling in ADF ;)

Lessons learned so far

- UI Popups: The different popup construction practices may come from different reusability contexts.
- UI Popups: Put global available popups into the page template
- DataControls for UI specific operations
- Usage of declarative components to simplify/standardize ui development
- Of course BTFs where ever you look
- AND: Although Fusion Apps developers have same JDeveloper it is enriched with great extensions (by the cost of performance. The IDE performance is much worse than the pulicly available JDev)

ADF Enhencement requests
- The default for af:popup/contentDelivery attribute should be changed from: "lazy" to "lazyUncached". Fusion apps template confirms this!
- Dear Oracle, please integrate the Applications extensions for: Table, Panel, Popup.....into default JDev Wizard.

References

Tuesday, December 13, 2011

RESTful Management Services in Oracle WebLogic Server 12c

Version: 12.1.1 (developer edition, ZIP, no installer)

Installation

unzip wls1211_dev as follows

0000@2713_0-41266a23103b2a19

In order to be able to work with this edition we have to call configure.cmd. This basically unpacks all jars, create the registry.xml and wlserver\.product.properties

To have some reusable snippets I have created additional scripts in the new MW_HOME

env_wls12c_dev.cmd

@echo off
@rem ***************************************************************************
@rem This script is used to set the environment for
@rem Oracle WebLogic Server 12.1.1 dev ZIP edition
@rem ***************************************************************************

set MW_HOME=C:\oracle\product\12.1.1\middleware
set JAVA_HOME=C:\oracle\product\11.1.2.1\middleware\jdk160_24
set JAVA_VENDOR=Sun


install_wls12c_dev.cmd



@echo off
@rem ***************************************************************************
@rem This script is used to install Oracle WebLogic Server 12.1.1 dev ZIP edition
@rem ***************************************************************************

call env_wls1211_dev.cmd

title Installing WLS 12.1.1.0...

call %MW_HOME%\configure.cmd

pause


Now execute install_wls12c_dev.cmd



In order to create a domain by configuration wizard



a) call env_wls12c_dev.cmd



b) %MW_HOME%\wlserver\common\bin\config.cmd



RESTful Management Service API



Sounds cool...lets try



Activate by Domain > Configuration > Advanced Configuation > Enable RESTful Management Services



=> (restart required)



After restart you will notice the following in the output



INFO: Scanning for root resource and provider classes in the packages:
weblogic.management.rest.resources
weblogic.management.rest.provider
13.12.2011 00:03:13 com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class weblogic.management.rest.resources.ApplicationResource
class weblogic.management.rest.resources.TestResource
class weblogic.management.rest.resources.ClusterResource
class weblogic.management.rest.resources.DataSourceResource
class weblogic.management.rest.resources.ServerResource
13.12.2011 00:03:13 com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Provider classes found:
class weblogic.management.rest.provider.CollectionResponseXmlProvider
class weblogic.management.rest.provider.ItemResponseJsonProvider
class weblogic.management.rest.provider.CollectionResponseJsonProvider
class weblogic.management.rest.provider.CollectionResponseHtmlProvider
class weblogic.management.rest.provider.ItemResponseHtmlProvider
class weblogic.management.rest.provider.ItemResponseXmlProvider
13.12.2011 00:03:14 com.sun.jersey.server.impl.application.WebApplicationImpl _i
nitiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'


(=> This is good news! It states that some RESTful service will be available.)



After Restart open http://localhost:7001/management/tenant-monitoring/servers



(the authorized users must be in the group Administrators or Monitors)



0001@2713_2713-41266a27ed555555



Login in as weblogic user and see the default HTML output



0002@2713_2713-41266a27efb11d34



If you e.g. need better proccessable formats, JSON and XML are of course also supported. Let's see how it is done and what it looks.



Add Accept Header with application/json



0004@2713_2713-41266a27f2c474d0



Add Accept Header with application/xml



0005@2713_2713-41266a27f36b5493



Currently there is REST support for Servers (all in a domain or specific one), Clusters ( all in a domain or specific incl server members), applications (all in a domain or specific app), data sources (all in a domain or specific).



With these capabilities it' possible to implement a custom monitoring solution. A slim mobile wls monitoring app (and more)! => Hands on;)



See doc for details of all available RESTful-Services in WLS12.1.1 http://docs.oracle.com/cd/E24329_01/web.1211/e26722/toc.htm



Collected Documentation links



Overview OTN: http://www.oracle.com/technetwork/middleware/weblogic/documentation/index.html



WLS 12c  Data sheet: http://www.oracle.com/us/products/middleware/application-server/oracle-weblogic-server-ds-1391360.pdf



WLS 12c online Documentation Library: http://docs.oracle.com/cd/E24329_01/index.htm



Usind RESTful Services  With WLS 12c: http://docs.oracle.com/cd/E24329_01/web.1211/e26722/toc.htm



Dislikes



- Still many BEA* stuff in diffrent scripts. It would be nice to have a clean and straight product without any historical garbage.



- configure.xml : ProgramGroupName=BEA WebLogic Platform 10.3 (Integrated Build)....


Why there is still the need to have a programm group called "BEA WebLogic Platform 10.3"?


My suggestions: Oracle WebLogic Platform 12.1.1 or Oracle Fusion Middleware Platform 12.1.1, everythin else, but not 10.3!



Like



- Java EE 6 Support. (It took a long time..)


- Better Maven Support


- RESTful Management Service


- ZIP distribution. Although the file is called wls1211_dev.zip it is possible to create a domain in production mode by the configuration wizard. At least in a simple testdrive it worked for me.


-Startup time feels better than wls11g


- more to test...(-Dservertype=wlx  to avoid loading EJB, JMS, JCA )

Monday, November 21, 2011

My DOAG 2011 Slides – Upgrade Guide for Oracle ADF on WebLogic Server

Just translated my german slides from DOAG 2011 and uploaded those to slideshare.
Hopefully someone will find it useful. At the conference there were just too few attendees…
http://www.slideshare.net/multikoop/doag-2011-upgrade-guide-for-oracle-adf-on-weblogic-server