Freitag, 14. November 2014

Oracle MAF - App offline mode and sync with APAM

Thanks to Steve Davelaar the A-Team has launched a new (open source) JDev/MAF 12.1.3 extension called APAM (A-Team Mobile Persistence Accelerator) to achieve working with an App in offline mode - and lateron sync with the host (data); in the A-team blog it is described as follows:

AMPA is a lightweight persistence and data synchronization framework that works on top of Oracle Mobile Application Framework (MAF). It eases the consumption of RESTful services, and provides a complete persistence layer that allows you to use the mobile application in offline mode. You can read and write data while not connected to the internet, and synchronize any pending data changes later when you are online again. The design-time wizards that are integrated with JDeveloper enable you to build a fully functional mobile application within minutes. 

Furthermore AMPA includes an easy way to make use of RESTful/JSON services utilising a declarative wizard.
For more pls consult the A-team blog.
The sources are available at GITHub as being an open source framework.
Go to the AMPA GitHub Home Page and click on the Download ZIP button to download the source code to your computer.

Sorry for cross posting - but you might not have heard about this.

Samstag, 8. November 2014

Challenge: Certificates from the cloud - error: "Certificate was issued by an unrecognized entity"

My environment: Windows7 - JDEV 12.1.3 - MAF 2.0.0.0.41....

When developing with MAF version 12.1.3 I came across the challenge using certificates.

The error on my app was: "Certificate was issued by an unrecognized entity"

My usecase is a MAF app consuming my REST service in the cloud... (How to consume a Rest Service - dok in German)
so I had to download/extract the certificate of the cloud environment to put it in the MAF app.

In JDEV in my MAF project under "Application Resources" and "Resources" - "Security" we can find the certificate store "cacerts".

I used OPENSSL to extract the certificate from the host in the cloud.

I had to make use of HOST:PORT which reads as follows:

https://javatrial1111db-deoracletria22222.db.us2.oraclecloudapps.com:443

in command line (on an Ubuntu/Linux machine) I had to use:

openssl s_client -connect javatrial0564-deoracletrial40319.java.us2.oraclecloudapps.com:443 -showcerts

I copied the certificate (between BEGIN CERTIFICATE and END CERTIFICATE inkl. the BEGINN... and END...) to a textfile, named it "new_cert" and copied it next to my "keytool", which resides in the ..[JAVA-HOME]/jdk/bin directory.
BTW: The "keytool" is used to manipulate certificates (create/copy/add/change...).
Then I also copied the "cacerts" file from JDEV MAF project to the /jdk/bin directory.
You'll find "cacerts" in the MAF project directory.
Mine reads C:\JDeveloper\mywork\JDEV12103\MyMobileApp\resources\security

So having BOTH copied to the /jdk/bin directory I started to work with the "keytool".
Command window:

keytool -importcert -keystore cacerts -file new_cert -storepass changeit -noprompt

Thats it.
The basic steps I got from Pervasync Blog posted here - thanks to him!! and thanks to Jürgen Menge for some hints!