Ask a question
Wednesday, 19 August 2009 09:58

Doing Portal Administration

Rate this item
(2 votes)

Using the Admin Portlet

Liferay provides a useful application called Admin that helps you perform several administrative tasks. Such tasks involve monitoring resource utilization to ensure optimal portal performance, logging messages from various classes in the system to get insight into what’s happening under the hood, checking the various system and portal properties, monitoring server instances, shutting down the server, and so on.

You will now learn to use the Admin portlet. First, you need to install this portlet on your ISI portal. For this, you will create a private page in your own community. Users without administrator privileges will not be able to use the portlet, but it’s still a good idea to put it on a private page rather than a public page. Perform these steps to create a private page: 325

1. Log on to the portal using your Administrator account.
2. Open the drop-down Welcome menu.
3. Navigate to the Private Pages menu item of the Fundamental Analysts community that you created previously
4. Click the new-page icon on the right side of the menu item This opens the Manage Pages screen, which lets you create a new page
5. Enter Administration as the page name.
6. Click the Add Page button. This creates a new page and displays it in the navigation tree on the left side of the screen.
7. Click the Return to Full Page link to see the newly created private page onscreen. You can now add applications to the page.

Installing the Application

To install the Admin portlet on your portal, follow the steps listed here:

1. Log on to the portal using your Administrator account if you’re not already logged in.
2. Open the Administration private page that you just created.
3. Select the Add Application menu.
4. Locate the Admin application under the Admin category.
5. Add the application to the Administration page by clicking the Add link. /div>

Using the Application

Note that the Admin application screen shows the Server tab by default. It displays the server’s build version, date, and uptime (the time elapsed since the server was restarted).

These are the functions of the Admin application’s three tabs:
 
• Server: Facilitates sever monitoring and management
• Instances: Displays a list of server instances
• Plugins: Displays a list of all installed plugins, including portlets, themes, and layouts

I will discuss each of these options in detail.

Examining Server Options

When you click the More link under the Server tab, you will see the following tabbed options:
 
Resources: Displays memory usage and facilitates memory management • Log Levels: Allows you to set the message-priority level for the server’s various packages and classes
System Properties: Displays a list of all predefined system properties and their values
Portal Properties: Displays a list of all predefined portal properties and their values
Shutdown: Facilitates shutting down the server
OpenOffice: Facilitates integration with OpenOffice

Checking Resources

When you select the Resources tabbed option under the Server tab,

This screen shows information related to memory usage, including a graphical representation of the percentage of free memory with respect to the total and maximum memory available for Liferay’s use. The screen’s secondary Actions tab offers you options to manage memory. You perform one of these actions by clicking the Execute button associated with it. Here are the various actions you can take:

Run the garbage collector: Executing this action results in freeing the unreferenced (orphaned) resources from memory. It basically sends a request to the JVM (Java Virtual Machine) to begin the garbage-collection task.

Clear content cached by this VM: The VM (Virtual Machine) periodically caches frequently used content to generate a faster response for the users. This action asks the JVM to clear the single VM cache. Doing this will free up some resources, but the VM cache will soon fill up again depending on the current load.
 

Clear content cached across the cluster: The Liferay portal can run in a cluster environment. When it does, you can cache the frequently used content on several machines across the cluster. Performing this action clears this cache. This is useful when you want to synchronize the servers.

Clear the database cache: Liferay can cache all your database resultsets. This action clears the database cache, which proves useful when you make direct modifications to the database.

Reindex all search indexes: This action sends a request to regenerate all search indexes. Regenerating indexes will improve performance later, but it might affect the portal’s immediate performance because the action takes a long time to process. You should schedule reindexing tasks at nonpeak hours when the server load is minimal. Also, because your indexes could become fragmented due to continuous additions, deletions, and updates, you should perform this task periodically to maintain optimal server performance.

Generate thread dump: This action generates a system thread dump for later examination, which proves useful during testing and debugging.

Changing Log Levels

Logging application messages helps you debug your applications and also generally helps you get an inside view of what is happening in the system. During its lifetime, an object might generate several messages during the execution of its methods. You can prioritize such messages with different levels. Liferay provides several predefined priority levels: FATAL, ERROR, WARN, INFO, and DEBUG. Liferay classes use the log4j API (http://logging.apache.org/) to log these messages to an output device. Generally, this output device is redirected to a file, so you can view the messages later by opening a physical file.
 
You’ll be happy to know that you can also log the messages generated by the plugins (classes) that you use to extend Liferay’s functionality. I’ll show you how to do that later in this section, but first let’s look at how to select the message-priority levels for the various Liferay classes. When you select the secondary Log Levels tab under the Server tab,

In the Category column under the Update Categories tab, you will see a list of various Liferay classes and packages. The next column called Level displays the currently selected priority level for each item. By default, this level is set to ERROR for most of the classes and packages. You can select a different priority level or turn off the logging by making a choice from the drop-down combo box. After you have selected the desired priority levels for the various classes, click the Save button at the bottom of the screen. The changes take effect immediately, so all the new messages logged by the system will have updated priority levels.

The messages are generally saved to a physical file, the name and location of which depends on the application server where Liferay is running. If your portal is running on Tomcat, the file is stored in the catalina.yyyy-mm-dd.log file in the \logs folder, where the fields yyyy, mm, and dd designate the system date. So every day, a new log file is created.

Now let’s go back to the topic of logging messages generated by user-created plugins. To do this, you first need to create a logging category.

Create a logging category by selecting the Add Category tab under the Log Levels tab.  Here, you will enter the fully qualified name of the plugin’s class or package, select the message-priority level from the combo box, and click the Save button. When you return to the category list, you will find the newly added category at the end of the list on the last page. The logging is enabled immediately, so the system will log all the messages generated by the new category class matching the selected priority level.

As you can see from the category list, Liferay allows you to select classes in its entire hierarchy starting from the com.liferay root. If you select a class higher up in the hierarchy, you will end up logging the messages for every class lower down in the hierarchy. This will make your log file too bulky to examine physically, so you might want to select only the classes you need.

Checking System Properties

Selecting the System Properties tab under the Server tab displays all the predefined system properties and their values.

The list, which runs across several pages, helps you examine the value of any system variable. For example, suppose you want to know which copy of the Tomcat server on your machine is being used by Liferay. If you look up the catalina.home property, you will learn the location of the Tomcat server that Liferay is using. If you want to know which version of Java Runtime Environment (JRE) Liferay is using, you can check the value of the env.JAVA_HOME variable. And so on.

Checking Portal Properties

Selecting the Portal Properties tab under the Server tab displays the list of portal properties

This screen gives you the values of all the property variables used by the portal. For example, to learn the default Email From address used by the portal, you examine the value of the admin.email.from.address property. To know the default folder where your plugins are installed, you can examine the value of the auto.deploy.default.dest.dir property. These properties reside in the portal.properties file, which you can find in the Tomcat installation’s WEB-INF\lib folder. This file is available in the portal-impl.jar archive.

Shutting Down the Portal

The Shutdown tabbed option allows you to initiate the portal shutdown.

Here, you need to enter the following information:

Number of Minutes: Indicate the number of minutes after which the portal is to be shut down.
Custom Message: Type the message to the user that indicates the reason for shutdown. Entering the information and clicking the Shutdown button starts the shutdown process. Basically, the system notifies all logged-in users so that they can prepare for the shutdown.
 
You will notice that your custom message is appended to the system-generated message. After the specified shutdown time expires, a user will see this message if he tries any activity on the portal:
After shutdown is initiated, you can cancel the process by clicking the Cancel Shutdown button.

Integrating with OpenOffice

OpenOffice is the leading open source office software suite consisting of word-processing, spreadsheet, presentation, and database applications. It’s typically used in graphical mode to create documents, but you can also run it in server mode to convert documents from one format to another on the fly. Liferay’s Document Library portlet incorporates this feature

Examining Server Instances

Selecting the top-level Instances tab in the Admin portlet displays all the server instances

You can add more server instances by clicking the Add button. On the resulting screen, enter the following information:

Web ID: Provide a user-specified ID, generally the domain name.

Virtual Host: Specify the domain name that you have configured in your network. When the user opens the web site in her browser using this domain name, she will be redirected to the Liferay server. The server will send her the appropriate portal instance.

Mail Domain: Specify the domain name for the mail host used by this portal instance. Liferay uses this mail domain to send notification messages.
 
After you have entered the information, click the Save button to save your changes. Now open the browser and navigate to the portal using the specified domain name. You will see the new instance of Liferay running in the browser. You can configure this new instance independently of the previous instance.

Listing Plugins

You’ve downloaded and installed plugins of various types using Liferay’s Plugin Installer application. The top-level Plugins tab in the Admin application provides the same functionality, allowing you to list the plugins currently installed on your portal and to add new plugins to the portal. These are the types of plugins you can have:

• Portlet
• Theme
• Layout template
• Web
• Hook
 
By now you’ve worked extensively with portlets, and you learned about themes and layout templates. I’ll now discuss the other two plugin types: web plugins and hook plugins. A web plugin is essentially a Java EE module that helps integrate your Liferay portal with various Enterprise Service Bus (ESB) implementations, single sign-on (SSO) implementations, workflow engines, and so on.

Hook plugins, introduced in Liferay Portal version 5.1.0, are destined to replace EXT, Liferay’s existing extension model. They’re easier to use and they cause fewer maintenance and upgrade issues. Using hook plugins, you can hook into these entities:

• Liferay’s eventing system
• Java model listeners
• JavaServer Pages (JSPs)
• Portal properties
• Language properties

To augment your portal with support for hook plugins, create a hook-configuration file with this structure:
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 5.1.0//EN"
"http://www.liferay.com/dtd/liferay-hook_5_1_0.dtd">

<hook>
</hook>

You’ll be adding your plugin classes in the hook element. For example, you can place an event tag within the hook tag to extend event processing for any of the three types of events supported by Liferay: application-startup events, login events, and service events. If you wish to provide additional processing whenever a certain type of event occurs, add the following code in the event tag of your hook-configuration file:

<hook>
...
<event>
<event-class>Event Processing Class</event-class>
<event-type>Event Type Class</event-type>
</event>
</hook>

You provide the name of your event-processing class in the event-class tag and the event-type class name in the event-type tag. Now, whenever an event of the specified type occurs, the service code in your custom class would be executed.

Hooking into Java model listeners is similar to hooking into Liferay’s eventing system. To extend the functionality provided in model listeners, you will write a custom class and specify it in the model-listener tag in the hook-configuration file:

<hook>
...
<model-listener>
<model-listener-class> Listener Class</model-listener-class>
<model-name> Model Class</model-name>
</model-listener>
</hook>

 
 In addition to integrating model listeners, hook plugins allow you to easily integrate new JSPs in your portal. Rather than replace the existing JSPs with the new ones, you can use the plugin to invoke the new JSPs provided in an independent folder. You simply specify the new folder in the custom-jsp-dir tag of the hook-configuration file: ...

<hook>
...
<custom-jsp-dir>
/WEB-INF/jsps
</custom-jsp-dir>
</hook>
This way, you can maintain several versions of JSPs and integrate them at any time by modifying only the configuration file. Hook plugins also allow you to modify the portal properties easily. To modify the properties, write them in another file and specify the file name in the portal-properties tag of the hook-configuration file:
 
<hook>
...
<portal-properties>
New Properties File
</portal-properties>
</hook>
 
  Finally, you can use hook plugins to modify language properties. You could install new translations or override desired words in existing translations by using code like this:
 
<hook>
...
<language-properties>
New Properties File
</language-properties>
</hook>

The major advantage offered by hook plugins is that you can easily revert to your original functionality; you simply remove the installed hook plugins from the portal. You can also disable each type of hook via the portal.properties file. Lastly, you can build, package, and deploy hook plugins, just as you can with other Liferay plugins.

Managing Plugins

Over time, you’ll likely accumulate many plugins on your Liferay portal. Some of these will undergo various updates, while some of them will become obsolete. You’ll want to manage your plugins using Liferay’s Update Manager application. When Update Manager is installed, it will display a message at the top of your portal pages whenever new versions of your plugins are available

The Update Manager application is available in the Admin category. Install the application on your Administration private page and look at its main screen

The screen shows the currently installed plugins along with their status. If a newer version of an application is available, you’ll see Update Available in the app’s Status column. From here, you can upgrade the plugin to a newer version by clicking the Actions button to install the updates. If a plugin is outdated, on the other hand, you can uninstall it by clicking its Uninstall link.

To install more plugins, click the Install More Plugins button, which will take you to the Plugin Installer application.

Using Tools

Generating User Passwords

When you create a new user, you will provide her with an initial password for her login. You also might have to regenerate a user’s password because he has forgotten it. Liferay provides an application called Password Generator that creates random passwords for you. Find this application under the Tools category and add it to your Administration portal page.

Before you generate a random password, you should set the password features, such as whether the password should contain a combination of uppercase letters, lowercase letters, and/or numbers. Additionally, you need to specify the desired password length. Once this is done, click the Generate button—you’ll see a new password displayed on the screen. Every time you click the Generate button, the application generates a new random password. You can now send this password to your portal user after resetting his previous one.

Setting Language

As your portal becomes popular, you can expect users from all over the globe to visit it. When such a time comes, you probably want to add multilanguage support to your portal so that your portal pages can be viewed in different languages. Liferay provides an application called Language that facilities region selection. Find this application under the Tools category and add it to your Administration portal page. above the Password Generator application screen. Password Generator is the application that we’ll translate using the Language tool.

The application shows the flags of different countries. The default language selection is American English. Note that the Password Generator screen immediately changes to display translated text

Clicking a different flag will display the text in the corresponding regional language.

Monitoring Portal Traffic

It is always a good practice to monitor your site traffic on a regular basis. This allows you to make timely changes to the portal to keep your customers happy. Liferay provides integrated support for Google Analytics, a popular tool for analyzing site-traffic data. With this functionality, you can easily monitor and analyze the traffic generated on your community pages.
Before you enable this support, you must sign up with Google Analytics (http://www. google.com/analytics/) to receive an ID. You’ll specify this ID on the community pages that you wish to monitor. Follow these steps to enable analytics support on your community pages:

1. Go to the Communities portlet application. If it’s not currently installed on your portal page, install it from the Community category.
2. Get a list of available communities.
3. Select the name of the community that you wish to monitor.
4. Click the Actions button.
5. Select the Manage Pages menu option.
6. Click the Settings tab.
7. Click the Monitoring tab.
8. Enter your Google Analytics ID.
9. Click the Save button.

The monitoring is now enabled. After a certain period of portal use by your community users, you can view the site-traffic data on the Google Analytics web site (http://www.google. com/analytics).
Last modified on Wednesday, 19 August 2009 11:21
Vicky

Vicky

E-mail: This e-mail address is being protected from spambots. You need JavaScript enabled to view it