Ext plugins are powerful tools for extending Liferay. Because they increase the complexity of your Liferay instance, you should only use an Ext plugin if you’re sure you can’t accomplish your goal using a different tool. Check out Chapter 6, Hooks for the available alternatives. If a hook won’t suffice, keep reading to discover the use cases for Ext plugins and how to set one up. First let’s talk about why you should avoid Ext plugins when possible.

As someone once said, “With great power comes great responsibility” (okay, many people have said that many times). Before deciding to use an Ext plugin, weigh the cost of using such a powerful tool. Ext plugins allow the use of internal APIs or even overwriting files from the Liferay core. When upgrading to a new version of Liferay (even if it’s a maintenance version or a service pack), you have to review all changes and manually modify your Ext plugin to merge your changes with Liferay’s. Additionally, Ext plugins aren’t hot deployable. To deploy an Ext plugin, you must restart your server. Lastly, with Ext plugins, additional steps are required to deploy or redeploy to production systems.

Now that you know the limitations of Ext plugins, let’s look at why you’d want to use them:

  • To specify custom classes as portal property values. For example, to specify a property that needs a custom class (e.g., global.startup.events=my.custom.MyStartupAction), you need an Ext plugin to add your custom class to the portal class loader.
  • To provide custom implementations for any Liferay beans declared in Liferay’s Spring files (when possible, use service wrappers from a hook instead of an Ext plugin).
  • To add JSPs referenced from portal properties that can only be changed from an Ext plugin (check whether the property can be modified from a hook plugin first).
  • To Overwrite a class (not recommended unless you have no other choice).

With these use cases in mind, we’ll discuss the following topics:

  • Creating an Ext plugin
  • Developing an Ext plugin
  • Deploying in production
  • Migrating old extension environments

Let’s create an Ext plugin.

Creating an Ext plugin

You can create Ext plugins in Liferay Developer Studio or in your terminal environment. The Ext plugin is stored in the ext directory of the Plugins SDK (see Chapter 2, The Plugins SDK). Using...

Read More

Developing an Ext Plugin

An Ext plugin changes Liferay itself when deployed; it’s not a separate component that can be easily removed at any time. For this reason, the Ext plugin development process is different from other...

Read More

Deploying in production

Often times you can’t use Ant to deploy web applications in production or pre-production environments. Additionally, some application servers such as WebSphere or Weblogic have their own deployment...

Read More

Migrating old extension environments

Because Ext plugins are an evolution of the extension environment provided in Liferay 5.2 and earlier, you might need to migrate your extension environment into Ext plugins when upgrading Liferay....

Read More

Summary

Ext plugins are a powerful way to extend Liferay. There are no limits to what you can use them to customize, so use them carefully. Before using an Ext plugin, see if you can implement all or part...

Read More
Average (0 Votes)
Summary Previous