Book Image

Oracle WebLogic Server 12c Advanced Administration Cookbook

By : Dalton Iwazaki
Book Image

Oracle WebLogic Server 12c Advanced Administration Cookbook

By: Dalton Iwazaki

Overview of this book

Table of Contents (15 chapters)
Oracle WebLogic Server 12c Advanced Administration Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. Log in as a wls user to the first machine prod01 and unzip ANT:

    [wls@prod01]$ cd /oracle
    [wls@prod01]$ unzip apache-ant-XXX-bin.zip
    
  2. Create a symbolic link ant pointing to the apache-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
    
  3. 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
    
  4. Change to the console extension templates directory:

    [wls@prod01]$ cd $WL_HOME/server/lib/console-ext/templates
    
  5. 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
    
  6. Extract and copy the default message bundle global.properties to the project from the console.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
    
  7. Edit global.properties:

    [wls@prod01]$ vi global.properties
    
  8. Change the window.title and login.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"
    
  9. Archive the myConsoleExt extension and move the package to the PROD_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/
    
  10. Restart the Administration Server.

  11. Access the Administration Console login page and check the text changes.

  12. 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

  1. Remove the myConsoleExt.war file from the PROD_DOMAIN console extensions directory:

    [wls@prod01]$ rm -rf $DOMAIN_HOME/console-ext/myConsoleExt.war
    
  2. 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