Sunday, November 28, 2010

How-to Share Skin Clarification Files Opposite Applications

Skinning defines the look and feel of an ADF Faces webapplication. On OTN and on inner helplists, the subject came up of how to share a singular skin clarification fileacross ADF Faces applications to ease skin administration department and modification. Thepreferred answer amid customers is a URL anxiety to a remote server thatdownloads the skin clarification with the beginning of an application. Though it is probable to setup the "style-sheet-name" component in the trinidad-skins.xmlconfiguration record to anxiety the skin CSS source record using an total URLto a remote host, we am not assured this is most appropriate great practice:

- The remote horde connection may fail, in whichcase all applications beginning with the elementary look and feel, that is far awayfrom any corporate pattern we am wakeful of

- In the past it happened that failedconfiguration on a router - or a flaw - lead to bad reply time of servers.If a of these servers hosts the remote CSS file, then most expected theapplication renders with the elementary look and feel

- Hard coded URL references are hard to maintain,and even if the trinidad-skins.xml record authorised the use of EL to dynamicallyresolve the URL, the URL had to be configured for and deployed with theapplication

- Skin estate is from a bottom skin definitionthat is referenced by its skin family name and the ".desktop" or".pda" extension. If both skin definitions anxiety remote serversfor their CSS, then the initial determination to facilitate administration department istraded in for a more intricate and blunder disposed approach.

The improved solution, that addresses all the problemslisted is to URL anxiety approach, whilst still discussion the objective ofsimplified administration department and setup is to use skin definitions that aredefined in and deployed as common libraries to WLS.

- Shared libraries can enclose a singular skindefinition or connected definitions. For example, a bottom skin record may be shippedwith skin definitions shawl get from it

- Shared libraries enclose a duplicate oftrinidad-skins.xml in it, that simplifies skin showing and configuration

- Changing a skin usually requires varying thedeployed common library. WLS takes caring of creation certain all servers in a clusterare versed with the library

- Different focus indicate to precisely the sameskin definition, so that coherence is guaranteed

- No network latency between the focus usinga skin and the server hosting the skin

- Skin definitions are stable from unauthorised changes.This ensures that a corporate skin does not deteriorate over time by developersapplying ad-hoc fixes

To exercise the common library approach, developers needto change their existing skin clarification so it may be deployed in a JAR file.The stairs for this include

- Creating a META-INF directory

- Creating a trinidad-skins.xml record that definesthe skins deployed with the JAR file

- Creating an META-INF/adf underling office forimages and icons served from the JAR file

- Changing the picture anxiety in the CSS toinclude the "adf" directory, that creates certain images and icons arehandled by the ADF Faces resource loader, that can read resources from JARfiles

- JAR the META-INF office to emanate the libraryfile

The "how-to muster skin definitions in a JAR file" isexplained in the "Oracle Fusion Middleware Web User Interface Developer'sGuide for Oracle Application Development Framework" product documentation,which you can access from here:

In the following, the stairs to muster the JAR record arelisted in short - even though sufficiently detailed to succeed.

In the following, we item the stairs for deploying a new skin clarification "princessSkin" in a JAR record and configuring it as a common library in WLS and Oracle JDeveloper.

First, emanate a printed matter make up as explained in the Oracleproduct documentation to horde images, and CSS files. The trinidad-skins.xmlfile itself is located right away beneath the META-INF office you created.

Make certain the JAR order is in the order trail of yourOS. If not, set the trail and increase a anxiety to the garbage bin office of a Java JDK6 or 5. If you have no mount alone JSK installed, use the a inside of the OracleJDeveloper installation.

Next, situation the JAR order shown below

jar-cvf ;.jar META-INF/

The order is expected to be achieved from the parentfolder of the META-INF printed matter you combined to grip the skin sources and thetrinidad-skins.xml file. In the e.g. we built, we combined a pricessSkin.jarfile, using the subsequent to command

jar-cvf princessSkin.jar META-INF/

To configure the JAR record as a common library, startupWebLogic server (either the integrated WLS in Oracle JDeveloper for testing, ora stand-alone server for production) and link up to the WLS console

or class="09Bodytext">Connect as weblogic/weblogic1 to link up as anadministrator

Note: If you arein a prolongation mood and weblogic/weblogic1 still allows you toauthenticate to the server then you have a major safety problem

In the administration department console, choose the"Deployment" access in the "Domain Structure"

Press the "install" symbol on tip of thedeployments list to register a new library

Browse to the place on the local server that has a copyof the skin clarification JAR record and choose it before dire "Next"

The next shade shows an blunder summary that you can ignore.Still on this shade however, you should pay consideration to the "Name"field that shows the referred to share library name. You can keep the defaultname, or change it. However, it is critical to recollect the name as we need itlater.

Still on the same screen, choose the "Copy this focus onto every aim forme " option, to make sure all servers inside of a cluster are

You can then confirm either or not you wish to examination theconfiguration before dire "Finish" on the next screen

Note: The WLSconsole may or may not inquire you to trigger the practical changes. What you shouldalways do even though is to re-start WLS server - even if the server says that thisis not needed.

Open the application(s) that you wish to use the skindefinition in the common library record in Oracle JDeveloper. Expand the"Application Resources" accordion in the Application Navigator andselect the "weblogic-application.xml" file. Double click onto thefile to open it.

With the "weblogic-application.xml" record openedin the visible editor, choose the "Libraries" category

Press the "green in addition to icon" to emanate a newlibrary anxiety is to application

In the library name filed, sort the name of the sharedlibrary you just created. In the e.g. we used, the name was"princessSkin"

Next time the focus deploys, the common library andits skin definitions turn existing is to focus to use

Note: If youdeploy the focus to a server that does not have the common librarydefined, then the deployment will flop since the unused libraryreference

The same topic will be published, with ancillary images, in the monthly OTN collect report published on ADF Code Corner by the finish of 11/2010 - />

No comments:

Post a Comment