Pages

Sunday, January 23, 2011

Some handy code for your managed Beans ( ADF & JSF )

Back in 2009, I already a made a blogpost about some handy code which you can use in your ADF Web Application. You can say this blogspot is part 2 and here I will show you the code, I use most  in my own managed Beans.

I start with FacesContext class, with this class you can use to find a JSF Component, change the Locale, get the ELContext, Add a message to your view and get the ExternalContext
The ExternalContext class, with this you can retrieve all the java init & context (web.xml) parameters, the Request & Session parameters and your web application url.
AdfFacesContext class, you can use this class for Partial Page Rendering ( PPR), get the PageFlowScope and ViewScope variables
ADFContext class, with this you can get all the memory scopes variables even the application scope variables, ELContext and the SecurityContext.
SecurityContext class, retrieve the current user and its roles.
BindingContext, BindingContainer and DCBindingContainer class. These classes are well known when you want to retrieve the ADF pagedef objects.
The last class is ControllerContext, which you can use to retrieve the exceptions

Thursday, January 20, 2011

Get the PageFlowScope of a Region Bounded Task Flow

Sometimes you need to access the PageFlowScope of a Task Flow Region( child Bounded Task Flow ) and get a handle to a pageFlowScope managed Bean. Normally you don't need to do this and Oracle don't want you, to do this. To make this work you need three internal classes so there is no guarantee that it works in 11g R1 PS4 or higher, but it work in PS2 & PS3.

Basically this is what you need to do.

  • Get the Task Flow binding of the region in the page definition, you need to have the full name
  • Get the RootViewPortContext
  • Find the ChildViewPortContext , use the TaskFlow full name
  • Get the pageFlowScope Map of the ChildViewPortContext 

Here some demo code.

Here you can download the demo workspace

Sunday, January 16, 2011

ADF JMX Datacontrol in FMW 11g PS3

One of the new Fusion MiddleWare PS3 ADF features is the JMX Datac Control. Back in late 2007 I already blogged about it and now 3 years later, Oracle finally released this feature in Patch Set 3. With the JMX Data Control you can manage your MBeans, read its attributes or invoke its operations. When an attribute gives back an MBean reference then ADF will look up this reference and returns this object. ( This is not the case in the System MBean browser of the Enterprise Manager application. )
I don't think this feature will be used in enduser applications, but can be very useful in support applications so the administrator can control the FMW servers. In this blogpost I will show you how you can use the JMX Data Control to give you a WebLogic Domain overview with its servers and application deployments.

First you need to create a JMX connection.

 Provide the WebLogic connection information
 After the JMX Connection creation, you can add the JMX Data Control to your application
 Select the JMX Connection
Select the MBeans, ( The EM System MBean browser can be handy to find the right MBean ), I will use the domain MBean located in com.bea.Domain
In the Data Controls window you can see my Domain MBean with its attributes and accessors.

 First I drag my Domain MBean to the page and select the attributes I want to show.
I also want to show you the WebLogic servers as child of the Domain ( in table layout ), the same for application deployments. So drag the Servers accessor on the page and select the attributes you want to show.
 With this as result.
Be aware, the JMX Data Control does not  know every Java Object, so if you want to use this on the SOA Suite MBeans it will give you some errors. It can't find the XML presentation of these SOA Java Object.