Wednesday, September 29, 2010

Advanced MDS Management for Oracle ADF 11g and Oracle WebCenter 11g Applications

MDS functionality in Oracle Fusion 11g is really cool, and it makes Oracle ADF very competitive comparing to other development frameworks. You can read about personalization and customization support - Applying Personalization and Customization in Oracle ADF 11g and Oracle WebCenter 11g. However, most of the customers are asking, how they can manage MDS metadata repository effectively. In the current release of Oracle Fusion 11g, we don't have MDS metadata repository browser, its not easy to track who and when did MDS personalizations or customizations. Because of lack of MDS browser/editor, people sometimes can see a risk to implement systems with MDS functionality, no one wants to have black box as part of IT infrastructure. I have provided this feedback to Oracle Product Managers, I'm sure in the future we will have MDS browser/editor tool. I will explain, what functionality we can use today, for MDS repository management.

As a sample application for this post, I will use one application from my OOW'10 session - MDSManagement.zip. This sample contains WebCenter 11g application and two separate applications with ADF Regions, these regions are consumed from WebCenter 11g Composer component.

I'm deploying sample application on standalone WebLogic server, with WebCenter framework libraries installed. Also I have created my own MDS repository in database - mds-customapp. I'm using this repository for current blog post article:


First I will test WebCenter personalization scenario and login into application as user john:


You can use WebCenter Composer to add one of available custom ADF Task Flows - Employees Graph:


Graph is rendered fine, personalization information is stored in MDS repository:


Let's do MDS test now - I will refactor Employees Graph ADF Task Flow path and redeploy the same application. This should break my application for user john personalizations. It will happen, because MDS will store old ADF Task Flow path and will fail to load it from refactored application - we will see it now. This is valid real life scenario, it might happen that we will need to do refactoring for custom ADF Task Flow:


We can refactor it into another folder and redeploy application:


Now when we try to open redeployed application for user john, it breaks and generates exception - funny one (its because this user have personalized refactored ADF Task Flow):


I'm sure you saw this exception while developing applications with WebCenter Composer - oracle.adf.share.exceptionViewScopeException. This exception may happen, if MDS repository metadata is out of synch with application structure, its what happened in my example.

Now we need to open Oracle Enterprise Manager and navigate to MDS repository screen for our sample application:


The main goal is not to break personalizations of other users, so we don't want to clear entire MDS repository, but we want only to remove corrupted personalizations of user john. Because we don't have MDS browser/editor, its a bit complicated, but still possible. I will describe MDS repository recovery for specific user through series of steps:

1. MDS export

We need to know MDS repository structure, in order to know it - we need to export MDS repository and browse it folder structure. Export MDS repository into archive file:


Export is done successfully - 3 documents were exported:


2. MDS Labels

It is a good practice to create MDS label. This will allow us to revert MDS repository in the future, if there will be a need. However, it reverts complete repository for every user, so its not really useful in practice, when multiple users have different personalizations - these personalizations will be lost. Anyway, its a good practice to create MDS repository back up, before changing it - let's do it.

You should open Runtime MDS Browser (its not really a browser, just set of MDS commands, we can't see real MDS repository structure):


Go to Operations tab and select createMetadataLabel command:


Provide meaningful name and create MDS label:


You can invoke listMetadataLabels command to see all labels available:


List of labels we could revert in the future:


3. MDS repository structure

We don't want to revert our MDS repository blindly to initial MDS label and loose all users personalizations. We want only to clean broken personalization for one user - john. So, we need to know what MDS documents we should delete. Because there is no MDS browser, we need to check this manually through exported MDS folder structure. There are two places available with user john personalizations. First one is page definition:


And then page itself:


Remember both paths, you will need them for the next step.

4. WLST Script for MDS Management

In previous step, we have identified two MDS documents to be deleted. Will run WLST command - deleteMetadata, to delete them. Need to provide three parameters - application name, server and document to be deleted names:


Make sure you delete both documents related to user john:


MDS repository was cleaned up, now application should work for user john as well. Of course all user john personalizations are lost, but at least we didn't lost every user personalizations:


In my next post, I will describe how you can use MDS labels to revert your MDS repository in case of global system failure.

15 comments:

Venisa said...

Hi Andrej,

Very Useful Post!

We get request from end-users wanting to revert the meta data changes to the basic app. It would be good if they will be able to clear the personalizations themselves instead of IT getting involved.

Thanks for the alternate solution until Oracle comes up with one!!

Andrej Baranovskij said...

Hi Venisa,

Yes, same here...

Andrejus

Frank Nimphius said...

Hi,

I filed this as an ER and am currently discussin with the development team of how this could be implemented so it still scales. The idea is to have some sore of snapshot to rollback to

Frank

Andrej Baranovskij said...

Thanks Frank, idea with snapshots is good. Also, some visual interface would create lots of positive feedback.

Andrejus

Lucas Jellema said...

Hi Andrejus,

Very good article, thanks. Would it not be possible for the Change Manager to handle un-applicable customizations and personalizations in a more graceful manner? Why not ignore a customization/personalization (perhaps issue a warning and write a messsage to a log-file) instead of failing with this ugly error? Or at the very least marking the offending MDS resources in some way that make it easier to retrieve and correct them. And of course, if we make a small change to a page, that makes one previous customization fail while many other customizations for the same page would still be valid, it would be very painful to have to remove the entire MDS resource. More fine grained updates would be called for.

kind regards
Lucas

Andrej Baranovskij said...

Hi Lucas,

Yes, I hope in PS3 or next release we will receive improvements in this area. MDS is very powerful concept.

Andrejus

Unknown said...

Thanks for sharing these very useful article. Personalization are really useful and our generic task flows really need them; we will look for more.
Many times, missing portlets are a common error and an annoyance. Hope with this MDS approach, will try to clear them off.

-Arun

Andrej Baranovskij said...

Hi Batman,

Thats right, portlets are annoying :)

Andrejus

Achinto Banerjee said...

Hi Andrejus ,

What I am noticing is issue related to site level customization and personalization.
Consider a scenario when admin makes MDS changes at site level suppose add widgets etc for a page and then later on user logs in to personalize that page and delete the same widgets.
What we noticed (in the mds repo)in this scenario is the widget is deleted from the page (jspx.xml) for the user but the references still exist in pagedef for that user in mds.
Now for a user even if he has removed a widget there will be still processing happening because references exist in pagedef leading to perfomance issues. Strangely when the widgets are deleted using admin user (to be persisted at site level) it looks like correctly deleting the entries from pagedef.

Andrej Baranovskij said...

Hi,

This post may help you: http://andrejusb.blogspot.com/2011/09/making-it-work-together-mds-user-and.html

Andrejus

Anonymous said...

Hi We are getting : oracle.mds.core.ConcurrentMOChangeException: MDS-00165: metadata Object in our application. There are no user level customization. Can the MDS clean up would solve this issue?

Andrej Baranovskij said...

Yes, try to use MDS cleaner: http://andrejusb.blogspot.com/2012/04/red-samurai-mds-cleaner-v20.html

Andrejus

Achinto Banerjee said...

Hi Andrejus,

Off late the images in all your blog post dont open in a modal dialog like it used to earlier.

Not sure if others are also having same issue.

I tried firefox 10 and IE 9 both.

Andrej Baranovskij said...

It opens on my side with Google Chrome. May be internet speed is slow on your side. Please try again.

Andrejus

Unknown said...

Hi Andrejus, nice post.

Do you know if it's possible two Webcenter Applications share de same information in MDS?

If I go to Admin in the two applications I can see the same pages, skins, templates. Its possible?