Extending and customizing the Administration Console
The Administration Console is a Java web application based on the WebLogic portal that can be modified and extended. These console extensions can be used to customize the Administration Console layout, style, logos, and images, and also to add extra pages, and extra functionalities to monitor and manage WebLogic Server and deployed applications.
This recipe will focus on creating a simple console extension to change a few text elements of the PROD_DOMAIN
the Administration Console.
Getting ready
This task requires you to have ANT installed. It can be downloaded at http://ant.apache.org. Download the latest stable build and install it. The filename should be apache-ant-XXX-bin.zip
where XXX
stands for the ANT version.
Note
All necessary work will be done in a Linux environment. You can assume the use of the prod01
machine in this recipe.
How to do it...
Carry out the following steps to customize and extend the Administration Console:
Log in as a
wls
user to the first machineprod01
and unzip ANT:[wls@prod01]$ cd /oracle [wls@prod01]$ unzip apache-ant-XXX-bin.zip
Create a symbolic link
ant
pointing to theapache-ant-XXX
directory:[wls@prod01]$ ln -s apache-ant-XXX ant [wls@prod01]$ ls -l lrwxrwxrwx 1 wlswls 16 Aug 9 10:37 ant -> apache-ant-XXX drwxr-xr-x 6 wlswls 4096 May 22 06:24 apache-ant-XXX
Export the environment variables:
[wls@prod01]$ export JAVA_HOME=/oracle/jvm [wls@prod01]$ export ANT_HOME=/oracle/ant [wls@prod01]$ export MW_HOME=/oracle/Middleware [wls@prod01]$ export WL_HOME=/oracle/Middleware/wlserver_12.1 [wls@prod01]$ export PATH=$ANT_HOME/bin:$JAVA_HOME/bin:$PATH
Change to the console extension templates directory:
[wls@prod01]$ cd $WL_HOME/server/lib/console-ext/templates
Run ANT to expand the Look and Feel Template (
laf
):[wls@prod01]$ ant -f build-new-laf.xml -Dname=myConsoleExt -Ddir=/oracle/myConsoleExt Buildfile: /oracle/Middleware/wlserver_12.1/server/lib/console-ext/templates/build-new-laf.xml all: [mkdir] Created dir: /oracle/myConsoleExt [unzip] Expanding: /oracle/Middleware/wlserver_12.1/server/lib/console-ext/templates/laftemplate.zip into /oracle/myConsoleExt [move] Moving 1 file to /oracle/myConsoleExt/framework/markup/lookandfeel BUILD SUCCESSFUL Total time: 1 second
Extract and copy the default message bundle
global.properties
to the project from theconsole.jar
file:[wls@prod01]$ cd /oracle/myConsoleExt/WEB-INF [wls@prod01]$ mkdir classes [wls@prod01]$ cd classes [wls@prod01]$ $JAVA_HOME/bin/jar -xf $WL_HOME/server/lib/consoleapp/webapp/WEB-INF/lib/console.jar global.properties
Edit
global.properties
:[wls@prod01]$ vi global.properties
Change the
window.title
andlogin.title
values from:window.title=Oracle WebLogic Server Administration Console login.title=Welcome
To:
window.title=My Company-Oracle WebLogic Server Administration Console login.title=Welcome to "My Company"
Archive the
myConsoleExt
extension and move the package to thePROD_DOMAIN
console extensions directory:[wls@prod01]$ cd /oracle/myConsoleExt [wls@prod01]$ $JAVA_HOME/bin/jar -cf myConsoleExt.war * [wls@prod01]$ mv myConsoleExt.war $DOMAIN_HOME/console-ext/
Restart the Administration Server.
Access the Administration Console login page and check the text changes.
Before the changes are made, it should look like the following screenshot:
And afterwards, you will notice the changes highlighted in the following image:
How it works...
You created a myConsoleExt.war
console extension application that changes some of the text of the Administration Console.
Other modifications can be made to the following resources to suit your customization needs:
Images:
/oracle/myConsoleExt/images/*/oracle/myConsoleExt/framework/skins/myConsoleExt/images/*
Stylesheet:
/oracle/myConsoleExt/css/*/oracle/myConsoleExt/framework/skins/myConsoleExt/css/*
JSP:
/oracle/myConsoleExt/framework/skeletons/myConsoleExt/*
Text:
/oracle/myConsoleExt/WEB-INF/classes/global.properties
The global.properties
file is the generic resource bundle that holds the text messages. Depending on the internationalization needs, you may create the appropriate files for each language. More details can be found at http://docs.oracle.com/cd/E24329_01/web.1211/e24966/bundles.htm#g1076214.
There's more...
To remove the Administration Console extension or to add more pages and content to it, follow the given instructions.
Removing the console extension from the Administration Console
Remove the
myConsoleExt.war
file from thePROD_DOMAIN
console extensions directory:[wls@prod01]$ rm -rf $DOMAIN_HOME/console-ext/myConsoleExt.war
Restart the Administration Console.
Tip
Clean your browser cache before accessing the Administration Console again.
Adding pages and content to the Administration Console
Adding other content to Console involves developing a WebLogic portal web application, using NetUI, portlets, JSP, and other J2EE technology. It is a Java programming task, which is beyond the scope of this book.
You can check Oracle's documentation at http://docs.oracle.com/cd/E24329_01/web.1211/e24966/addcontrols.htm#CNSLX159.
See also
Starting the Administration Server
Saving and activating changes in the Administration Console