Tuesday, February 23, 2010

Installing Weblogic Server 10.3 and extending it to support ADF

When I started working on ADF application development I thought when I am done from development, I just have to deploy the application to weblogic server, then running the application and it will run with no extra work to do.

But, it seems there some confusion when installing and deploying ADF applications to weblogic server, so i wanted to stat it in a step wise procedure.

This is a basic steps carried out through installation of production weblogic server:

1- Download weblogic server 10.3 and latest version of JDeveloper from oracle website.

2- Install weblogic into new BEA home, my installation is carried out on windows 2008 R2 server 64-bit. My installation directory is C:\BEA\Middelware.

3-  Deselect the components that you don't need such as :
  • Web 2.0 http pub-sub server
  • Weblogic Web Server Plugins
  • UDDI and Xquery Support
  • Server Examples
  • Workshop


Monday, February 8, 2010

Oracle Database, and RAC: How to delete, add, remove OCR and Voting Disk

This post is directed for DBAs who need to modify, or move OCR and voting disk locations. Some times a DBA wants to move to new storage area location. Typically, one would simply copy or dd the files once the new storage has been presented to the hosts. But when moveing OCR and/or voting disk its a little bit different.


ADD/REMOVE/REPLACE OCR Device
You must be logged in as the root user, because root own the OCR files.

Make sure there is a recent copy of the OCR file before making any changes:
ocrconfig –showbackup

If there is not a recent backup copy of the OCR file, an export can be taken for the current OCR file. Use the following command to generate an export of the online OCR file:
ocrconfig –export -s online

To recover using the export file use the following command:
ocrconfig import

Friday, February 5, 2010

JDeveloper, and Weblogic:Accessing Detailed Views from Master One Using Java

One of the most addressable issues in Oracle ADF Application Development is how to access your business model components through Java method call. Accessing the parent view that requires a bind variable and attaching it to a page doesn't mean that the details views related to master one at data model level will execute with same bind variable.

In this post we will address the problem of how to call a master view with bind variable set through Java call ? and at the same time to fetish data from detail views ?

First of all make sure that your data model is built to reflect master detail relation. A view link between Master and Detail should be created at first and added to Data Model, like simple two key join in a select statement:

As you note a country-City relation ship exists, in which you must get country to get its cities.
The country view has a bind variable set at run-time through expression language and called through execute with params method call. This what happened at normal page flow navigation. But, in our case we want to set the bind variable using Java code and then looping thourgh to get the detailed cities.

Tuesday, February 2, 2010

JDeveloper, Weblogic and ADF: Security in Oracle ADF and Session invalidate

In enterprise applications that require user authentication, a user can't navigate back to a cached page. When developing applications using JDeveloper11g ADF, I encountered two problems.

First, how to kill a user session when clicking logout button, as explained below:
In ADF, you might use SessionScope to create variables or beans that can be carried out during the life cycle of a user session. Destroying the session bean or setting a session variable to null doesn't mean that the session is killed, to kill a session you have to:

1- Add a method call to logout button Action can be in the managed or backing bean and name it logout_action();

2- The code is used to invalidate the user session then redirect the page to your login screen displayed below:

        FacesContext fc = FacesContext.getCurrentInstance();
        ExternalContext ectx = fc.getExternalContext();      
        HttpSession session = (HttpSession)ectx.getSession(false);
        try {
            session.invalidate();          
            ectx.redirect("../loginpage");
            fc.responseComplete();
        } catch (Exception exp) {
            ectx.redirect("../loginpage");
            fc.responseComplete();
        }

* note if you are using a bounded task flow and your loging screen exists in unbounded task flow located one level up then consider navigating through floders using (..) till login screen location.