Wednesday, March 21, 2012

Apply MDS To Oracle ADF Application

What is MDS?
Metadata Services (MDS) is a feature provided by oracle to store customization and personalization information in a repository. The repository can either be stored in a database or in a file system as we will see.

for example if there is a screen has a table this table has 8 columns, and there are a user (User1) want to see only 4 columns and hide the others. When User1 login again he want to see last changes which he make (see only 4 columns), the user can see any changes he make in the screen only if you apply MDS to your application.

To apply MDS to your application follow this:

1.Pages should be (.jspx) not (.jsp).
2.In your project properties --> ADF View check on "Enable User Customizations" then select "Across Sessions Using MDS".



3.Create a new class like this



This class has two main functions:
- getName() which return the folder name that hold all users changes.
- getValue() which return the folder name for the login user. This folder should be unique for every login user and will saved inside the getName() folder.

4. In Application Resources --> Descriptors --> ADF META-INF open adf-config.xml.
5. In adf-config file go to MDS Configurations and add your class



6. In adf-config file go to View tab and add all Tags.



7. Now you apply MDS to your application.

8. If you run your application in Integrated Weblogic there will be no problem, you should only specify the path to store the users changes (changes will stored in file system). You will find this path in your Application properties --> Run --> MDS.



9. If you deploy your application in standalone weblogic server you should setup Repository Creation Utility (RCU). You can download it from
here
RCU will create a new schema in your database which hold all the changes.

10. Unzip RCU downloaded file and go to rcuHome --> BIN and run rcu.bat.



Press Next



Select Create then Press Next



Enter Database connection with sysdba username and password then press next

If any error message appear press ignore



Press OK



Select Metadata Services Then Press Next



Press OK



Enter the password for the newly created User in database then press Next. Then follow all other steps until Finish

11. After finishing installation of RCU you should configure you weblogic domain to the MDS Repository.

12. Open your weblogic Enterprise manager using URl like
http://yourServerIP:7001/em

13. Enter weblogic username and password

14. Right click in you Weblogic domain the choose "Metadata Repositories"



15. Press Register Button and Enter Database Connection then Press Query



You will find your repository information press on your repository and enter Repository Name and Schema Password Then Press OK.

16. Now you register your MDS to Your Weblogic Domain.


You can select it and choose the target.



17. Weblogic automatic create a data source for connecting to your MDS Repository. If you go to Weblogic Console (http://yourServerIp:7001/console) and go to Services --> Data Sources you will find a newly Data Source



18. Deploy your application directly from JDeveloper to your weblogic server the MDS Deployment Configuration will automatically opened with the configurations of your MDS Repository you should only enter the Position Name.