Main idea of tuning approach is to prevent default query execution on page load and do it as easy as possible. We have achieved this by invoking executeEmptyRowSet() method for master View Object before opening page itself. We are performing invocation from Method Call activity in ADF Task Flow. Download sample application - ADFPageOpening.zip.

How it works: let's open our data entry page from main index page:

Data entry page opens in Insert mode. However, by default even page opens in Insert mode, framework still is sending default SQL query to database. If this query is complex and database performs many joins, it will take time to open your page. With this approach I'm describing today, no SQL query will be sent to database and page will open fast:

If user wants to edit data, ADF Query component should be used to filter data, only at that point SQL query will be sent to database:

How its implemented: ADF Task Flow contains Default Activity, this means it will be invoked each time when entering ADF Task Flow. This activity is Method Call:

Custom method implements call to executeEmptyRowSet() on master View Object and inserts new row. Method executeEmptyRowSet() prevents SQL query execution on page load by creating empty row set and in such way initializing iterator:

Download sample application updated from previous post - ADFIntegration2.zip. Its the same application described in my previous post, now updated with ADF Security.

I should say, currently there is no elegant approach for ADF Security integration from different applications. Its supposed to be possible to define multiple Policy Stores and declare them in JPS configuration file. I have tried this, however it always using first available Policy Store. Also I was thinking to put jazn-data.xml outside my ADF application, in order to reuse the same jazn-data.xml in multiple applications - but without success. Yes, its possible to specify custom jazn-data.xml file location in JPS configuration file, however current JDeveloper 11g release can't recognize it during design time. Most probably Oracle will fix it in their new JDeveloper 11g build and it will be very easy to split ADF Security across integrated applications. For now, we are using approach to have separate jazn-data.xml per application and in main application jazn-data.xml to store policies from all available jazn-data.xml files. We need to have Policy Stores in splitted applications, since we want to test ADF Security during development cycle.

Will describe how I have applied this approach in my sample application. First, I have configured one of splitted (RemoteSecondApp) application with ADF Security through standard wizard and set permission for ADF Task Flow:

I have declared RemoteSecondApp Policy Store for this application, where security role manager was defined and user scott granted with this role:

In the second splitted application (RemoteApp) I did the same action and declared permissions for ADF Task Flow. In this case, I have assigned to roles with grant to open ADF Task Flow:

Worth to mention, in this Policy Store I have defined permission for Entity Object - preventing unauthorized user from editing data. Its defined on Entity Object and grants permission to edit roles only for manager role:

Now let's see main application - LocalApp. I have defined there Policy Store as well, its called as you can predict - LocalApp. I have defined there new role employee and copied two roles from splitted applications - manager and developer:

I should mention - both users (scott and john) are granted with employee role, it allows them to open entry page from LocalApp application. As I said before, policies from splitted applications are copied there in order to make it work when we will run central application:

We can see grants in jazn-data.xml from central application, where ADF Task Flows imported through ADF Libraries are visible. Those grants are local, copied and read from local jazn-data.xml:

Now we can test ADF Security in both - splitted applications and central one, no difference. When I'm running central application and entering with user granted only developer and employee roles:

Table from integrated application, where I have declared permission for Entity Object will be rendered in read-only mode:

Since this user don't have permission to open ADF Task Flow from second integrated application, authorization error is shown, thats correct:

Business Events and Event Delivery Network (EDN), its something that makes Oracle SOA Suite 11g really strong integration platform. While discussing with customers, usually everyone is seriously concerned about loosely coupled integration, no one wants to integrate IT systems with strongly coupled services. Thats logical, because there are different systems and those systems constantly changing. Oracle SOA Suite 11g allows to implement loosely coupled integrations with Business Events. You can understand Business Event as a signal, that was sent by radio transmitter. Transmitter knows nothing about receivers, its receivers business to subscribe to particular event. Oracle SOA Suite 11g brings Event Delivery Network (EDN), space where Business Events can be raised and received across SOA infrastructure. Business Events in SOA Suite 11g can be raised not only from ADF Business Components, but from BPEL process for example as well.

Good news - we can declare Business Events on Service-Enabled Entity Objects, it works same as declared on normal Entity Object. Here is declaration:

In Business Event definition I have specified to track Salary attribute value changes. Along with changed Salary attribute value, I want to add to the payload EmployeeId attribute value. Event is published and will be raised during Update action based on Salary attribute change.

Thats all about Business Event definition in ADF Business Components, now I will develop SOA Composite where I will subscribe to Business Event. Implemented SOA Composite:

Mediator subscribes to Business Event, and forwards it to BPEL process, where Business Event data is written to file system. In this post I'm focusing on Business Events from ADF Business Components, in my next post I will focus on BPEL process implementation. Mediator receives Business Event, BPEL process will manage it, this means Business Event schema transformation should be defined:

Schema transformation can be done automatically in JDeveloper 11g:

Basic BPEL process for today post, received Business Event data is stored in file system using File Adapter:

File adopter is defined with the same WSDL as BPEL process, means it will know Business Event input data format and will store information in C:/tmp folder:

I have deployed both applications (ADF application and SOA Composite) to Oracle SOA Suite 11g WebLogic server and opened ADF Application screen:

Thursday, August 13, 2009

In Oracle Fusion 11g, JDeveloper provides great support for Application Integration Architecture (AIA) through Service-Enabled Entity Objects. It allows to build Enterprise Composite Applications (ECA) in Oracle ADF. Developer now can implement Entity Objects directly based on View Objects from remote application, exposed through Web Service. This means we can expose and consume Web Services on Model level using ADF Business Components, this gives more centralized integration approach. Its especially important for AIA, when building ECA. For more info, please read Section 11.3 Accessing Remote Data Over the Service-Enabled Application Module from Oracle Fusion Developer Guide. In this post I will describe some tips and tricks from my experience.

I have investigated Service-Enabled Entity Objects in greater detail and developed sample application. Sample is based on two JDeveloper 11g applications, first - SalaryUpdateRemote.zip is consuming remote Web Service on Entity Object level, second - SalaryControlService2.zip implements this Web Service. Application with Web Service implementation was developed in my previous post - Web Service Interface for ADF BC Application Module in Oracle Fusion 11g, where I have described how to expose through Web Service custom methods from Application Module implementation class. I have updated previously developed application in order to use it in current post, additionally have exposed View Object itself through Web Service.

I'm using Employees View Object from SalaryControlService application to be accessed through Web Service:

In SalaryControlService Application Module Service Interface, you can see EmployeesView1 exposed as View Instance:

I have declared three operations to be enabled for EmployeesView1. Find is required operation to retrieve data, Update operation will be used to edit employees data through remote Entity Object:

When Service Interface for View Object is defined, we can redeploy SalaryControlService. I have accessed redeployed application through Enterprise Manager console, updated list of operations is present now:

We need to note down WSDL URL, it will be needed soon, when we will define Entity based on Service Interface.

Its time to open application, where View Object is consumed over Web Service - SalaryUpdateRemote. Its pretty basic application:

Only one interesting thing - Employees Entity Object is based on Service Interface, we can see this from DataSource tag. This Entity Object is based on View Object exposed through Web Service, instead of Database table:

When you base Entity Object on Web Service interface, same as you generate it from Database table, all attributes are defined:

To create Entity Object based on Service Interface, in Create Entity Object wizard select Service Interface option for Data Source. You will be requested to provide WSDL URL for Web Service, available Service View Instances will be listed automatically:

All other steps are the same, as when creating Entity Object based on Database table. When I have created View Object referencing Service-Enabled Entity Object, I have noticed that Query section is empty:

Finally, in order to test Service-Enabled functionality, as described in documentation you need to include common library from Web Service application:

And define service connection information in connections.xml file:

You can copy paste this information from Web Service application and just add couple parameters. In documentation they say we can access remote Web Service with Local or Remote Business Components Service configuration. Local can be used when Business Components Service runs local to the consuming application. However, I wasn't able to run with Local configuration, seems it was trying to load two Application Modules on Class Path and then conflicting. Good news, I was able to run with Remote configuration:

In jndiProviderURL I have specified IP and Port of my WebLogic domain extended with SOA support.

Now its time to run Application Module and test Service-Enabled Entity functionality:

Because I have enabled Find and Update operations, I can browse and edit data retrieved from Web Service View Object instance:

I have developed ViewController part as well, where I have implemented simple edit type form for Employees data. Finally, I have deployed application with Service-Enabled Entity Object to the same WebLogic domain with SOA support, where original ADF BC Web Service was deployed. I have noticed, if you want to use Service-Enabled Entity Object in ViewController, common library from Web Service application should be added to ViewController classpath:

But its not enough, additionally you should open deployment profile and in WEB-INF/lib Contributors section ensure that added common library is selected for deployment:

If its not selected, this means it will be not packaged into EAR there will be runtime exception when trying to access Web Service through Entity Object.

When SalaryUpdateRemote application is deployed:

We can access main page and retrieve Employees information through remote Web Service directly using ADF Business Components. Data can be edited and saved to database through Web Service:

Its very interesting and useful functionality, if there will be decision to implement Salary attribute validation rule, there is no need to implement it on Service-Enabled Entity:

It can be done directly on original Entity Object available in ADF Business Components exposed through Web Service - SalaryControlService application:

Data from consuming application will be sent to Web Service and validated there centrally. In case of invalid data, remote application will show error: