Using ADF Logging in a non-ADF project

In a previous post (Starting with ADF 11G Logging), I explained how ADF logging is simple to set up, and how it will enable you to set the logging levels at runtime, without having to restart any server. When I showed this to a colleague of mine, he immedialtely popped the question : “Can’t we use this for all of our java applications, even the ones that don’t use ADF?”. Well, the answer is yes, and it turns out to be very easy. Just add the correct jar to your project and your done.

This blog will demonstrate how to get this working. I use Eclipse Juno to create a small webproject, only containing a servlet that does the logging. In fact I will use the same servlet I used in the previous post.

So I open my Eclipse , and started with a File -> New -> Dynamic Web project. Give it a name, set ‘Dynamic web module version’ to 2.5, click the  ‘Add project to an ear’ checkbox and click finish.

dyn_wb_prj

Now Eclipse has created a web and ear module for me.

Image

Now right click the web project (ADFLogging), and select New -> Servlet, give it a name, eg. TestServlet, and click finish.

Remove the generated code in the servlet, and copy the code from the servlet ‘ExecuteLogger’ from my previous post (here) and paste it in our new serlvet.

PS. : When you copied the code from my previous blog, don’t forget to set ADFLogger.createADFLogger to our current servlet class name : TestServlet.class.

We will get compile errors on HttpServletRequest,etc… and on the ADFLogger class because they are not defined in the classpath of the project. So we’ll add them in order to get our servlet compiled.  I get the 2 jar’s from a JDeveloper installation I did on my machine. We’ll only add these jar’s in order to get the servlet compiled in Eclipse. We will NOT deploy them, as they are already available on our Weblogic server.

To add the jar’s, right click on the web project, and go to Properties. In the Properties, click on ‘Java Build Path’.

buildpath

Click on ‘Add External JARs…’ , and go to the directory where you installed your JDeveloper, which in my case is : C:\Oracle\Middleware.

In that directory , get following jar’s from the sub-directory :

\oracle_common\modules\javax.servlet_1.0.0.0_2-5.jar : contains the servlet classes like HttpServletRequest/Response,etc…

\oracle_common\modules\oracle.adf.share.ca_11.1.1\adf-share-base.jar : contains the ADFLogger classes.

Now we see the the following jar’s added :

jars_added

Click OK and return to the servlet. In the servlet use CTRL-SHIFT-O to import the neccessary classes from the jar’s we just added.

Now all compile errors should be gone.

Generate the ear file as follow : File -> Export -> Ear file

Select the ear project and enter destination of the ear file

When you examine the ear, you will notice that the folder \WEB-INF\lib is empty.

As the servlet and ADFLogger jar is already available on Weblogic, there is no need to deploy it with our application.

Now deploy the ear to the Weblogic and test the servlet with following url. :

http://localhost:7101/ADFLogging/TestServlet

It will generate following output :

output

To check the logging done by this servlet :

As I used the integrated Weblogic of JDeveloper, I will look for my logs using JDeveloper, but in a production environment,

these logs can be viewed using the enterprise manager of Weblogic. For details, see my previous blog.

In the Oracle Diagnostics Logging configuration, I see my servlet after the deployment. No message level is defined, so it will take “Warning”, as this one is defined as default by the Root Logger

logger

After te execution, I see following log lines in the log analyzer.

result

So that’s it. So the bottom line is to add the ADFLogger jar to your non-ADF project, and you are ready to go !

Seminar: “What’s your choice for Oracle Forms” – recap

A great turnout for the seminar: more than 40 interested attendees, a mix audience of IT managers, project managers and developers.
Hof ter Delft was a nice location!

Grant Ronald, Oracle Senior Group Product Manager for the development tools division, opened the seminar with a keynote presentation.
He started with the Oracle Statement of Direction: Oracle has no plans to desupport Forms and Reports.
After this he gave an high level overview of what is possible with an Oracle Forms application: modernize, upgrade, integrate and migrate.
Grant ended with an overview of ADF.

My session was next, same subject as Grant, but a bit deeper into detail with demos and customer cases.
I showed how you could modernize an application using Pluggable Java Components and JavaBeans.
Upgrade will bring you some nice features, eg. javascript integration and external events in 11g.
Those new features were shown in the integration demo, together with web service calls from Forms.
I ended with migration:  reasons to migrate, strategy(eg. a customer case of  redesign/rebuild in Apex), tools that  can be used(eg. JHeadstart ), …
One lesson: migration is not an easy path…

The following session walked this path of migration, the one of a phased migration.
Wilfred van er Deijl(Commit Consulting)presented OraFormsFaces.
A presentation about where OraFormsFaces can fit in and how it works.
When you choose for a migration and you don’t want a big bang, OraFormsFaces can help you in doing new development in a new technology(eg. Oracle ADF) and keep your Forms investment.
OraFormsFaces let you integrate a form in a webapplication and passes info between those two technologies.

To show that OraFormsFaces works with other technologies, Tom Bauwens(SmartApps) showed the integration of Oracle Forms with Eclipse RCP using OraFormsFaces.

After a nice lunch Grant Ronald gave an introduction training to ADF:

  • Building ADF Business Components
  • Business validation
  • Shaping your data
  • Application Flow
  • Building UI pages

This really showed the power of ADF to Forms developers.


OFM 11g Launch – Live Webcast – Part 1

Oracle Fusion Middleware 11g will hold a lot of new features and technologies to get acquainted with, but most of all the stack is even more integrated and the first major release after the BEA acquisition. I think a lot of people have been waiting on this announcement, especially when we talk about Fusion Apps which has been a tremendous effort and if you have the opportunity to see a demo, please do … !

Bringing this single stack of technology, using the best of breed of both middleware stacks, will minimize the product dependencies because we will be using 1 single stack for as well Applications, Middleware projects, database as the infrastructure-side.
Using this pre-fabricated environment based on open standards which will give us the ability to have a pre-patched, pre-tested, pre-configured, … environment that can be managed, monitored, secured, … in a unified way.

The middleware is the key part in the entire stack to be able to offer and re-use standardized services to each component, technology or product within the product stack.
In other words, if you understand how the middleware works and operates you will understand how security, deployment, management, monitoring, … works throughout the stack.

Building rich client applications using the Application Development Framework that will give you the ability to render your application as you see fit.
Building an orchestration engine for as well human-, process- as document-centric process flows.
Having a single and unified way of defining security, managing components and monitoring these different services by using a single layer of metadata.

All these functionalities and features will give us more time to innovate instead of maintaining the existing applications landscape.

Fusion Design Fundamentals

Duncan Mills gave a great presentation on ODTUG regarding the Fusion Design Fundamentals which gave more insight in how to manage and start in Fusion Development.

The key take aways I found very interesting:

  • The Groundwork: 1. understand the fundamentals of the UI in which you’re aware of what ADF can and can’t do (don’t start designing in dreamweaver because you need to be able to hook it up into ADF. 2. Prototype it and make it sufficiently real which will also give your team and the customer a real case study of what the application can become. 3. Approach the framework and architecture with an open mind because the architectural approach is key.
  • What is the fusion blue print = View – Business Logic – Data (as what you would think working with an MVC-framework.
  • Educate your UI Designers: Use the Placeholder Data Control to mock data and services + show them the rea-site in which you have a sandbox available to plug and play with the different components + behaviour of the design is key when designing User Interfaces (e.g. what happens to the application when I resize the window)
  • Team organisation: a. Optimize team size so you can have expertise in specific technology areas (you can’t do that if the team’s to small, in that case they need to know more about the framework, as well UI as business logic for example). b. try to partition the skills: UI specialist, Service specialist, Orchestration Specialist, DB Specialist, SCM-build and release management. => more separation within the team so developers can specialize.
  • 2 trains of training: a. Create Subject Matter Experts that can mentor large teams (they create POC’s and get to know the framework). b. SWAT-team: mixture of architects and PM’s to get high level view of development teams and decide when to move up and escalate, e.g. in case of a bug
  • Source control and release management need a separate team in which Master Data Management is an integral part of dependency managment
  • Specific things you can do with the stack: a. Create your own Superclasses (Application Super Classes for ADF BC + UI Event Handler Superclasses). b. Use templates for the UI and taskflow using your pre-defined exception handlers. c. Use the skinning-technology to be able to change the look and feel of the UI in a general, generic way. d. Learn to love ADF Taskflows which is fundamental to create reusable stuff and to encapsulate a flow of information ( ADF Taskflow = Page flow on steriods; used for chunks of reusable UI with transactional state, private memory areas, … the true Web 2.0 experience). e. Work with the UI, not against it (think of geometry management, e.g. use decorativeBix which can be resized and stretched depending on the UI Specs) => don’t use absolute sizing or positioning. f. Document the UI patterns you’re using: e.g. master-detail, wizards, … the common patterns are documented on OTN: ADF Functional Patterns.
  • ADF 11G: You will have different source of template patterns to choose from (this is an awesome functionality in which you can choose to work with 1, 2 or 3 columns and each area can be defined upfront as being locked, stretchable, scrollable, …)

Another interesting part of the presentation, 5 laws to live by ;o):

  • Don’t write javascript because anything in Javascript can be hacked or bypassed (make use of the Client Side and Server Side Listener functionalities)
  • Don’t mix in html => stick to the components, avoid JSP Constructs (e.g. JSP include or JSTL) => in this way you can use any controller-layer possible and uplift performance
  • Minimize Use of CSS => use skinning technology and define custom styles in skin
  • Don’t write Custom SQL => try to do it declaratively using view and entity objects
  • Communicate ! Demo, document and share experiences

This was a really interesting presentation regarding the organisation of teams, how to use ADF and what the pitfalls can be.

ADF 11g – Take Aways

Monday morning I followed the session of Lucas Jellema, Putting a Smile on ADF Faces. The presentation was great, especially because Lucas created a demo with some of the features integrated that Steve Miranda had shown in the keynote session regarding Fusion Apps.

Take aways from this session:

  • A table can fetch data in an asynchronous request, so you can scroll throug records and the server will get more data as needed. In other words you don’t need to use the pre-defined row-set anymore which was necessary in previous versions, e.g. show 10 records at a time)
  • Client Side and Server Side support has been greatly improved so developers can tackle functionality where it’s supposed to happen. API’s are available to be able to work only on the Client Side or Server Side using Listeners. Using the Client Side scripting for example, you can now use javascript and client Side API’s instead of needing to use backing beans or managed beans. For Example using propertyListeners on the client side to trigger events.
  • You can embed tables inside the panelCollection-component to be able to change to look and feel of a table component, e.g. detach the table to a separate region to have more display-functionality. What you can do know is hide columns, filter on records at run-time which can give you the same dynamic look and feel as with using interactive reporting within Apex
  • Autosuggest-functionality to be able to get a list of valies according to the information the end-user has putted in. The event keys kan be intercepted by the Client Side Listener, calling the Server Side Listener which can then push the data to the Client Side
  • The Data Push mechanism or Active Data Services give you the ability to work on real-time data without the need to fetch the data yourself which is a great enhancement

And of course there’s lots more in the ADF 11g release that will enhance user friendliness and capabilities for the developer to give you a true Web 2.0 experience. The hierarchy viewer-component can be viewed already on the rea-side. Have a look at what ADF has to offer you in a sandbox-environment where you can start playing around with the functionality.