This small experiment aims to provide bootstrap project environments for all the major build tools in common use for Java projects so that Liferay development can start quickly and easily.
The template projects are categorized based on the build tools,
gradle
- these are set of Liferay projects that can be bootstrapped on togradle
based development environmentliferay-gradle
- these are set of Liferay projects that can be bootstrapped on tocom.liferay.plugin
(a gradle plugin) based development environmentmaven
- these are set of Liferay projects that can be bootstrapped on tomaven
development environmentbndtools
- these are set of Liferay projects that can be bootstrapped on tobndtools
based development environment
There are 2 additional projects in the /bndtools/
folder that you will need to build and publish the modules
/bndtools/cnf
- The Bndtools configuration project/bndtools/blade.run
- A bndtools project which can push bundles into an osgi container and run them, need biz.aQute.remote.agent-X.X.X.jar deployed first.
The projects also demonstrate how to use various frameworks like:
- Blueprint
- Declarative Services(DS)
- OSGI API
Liferay does not provide a blueprint implementation out of the box. To use the blueprint modules provided in blade, you must deploy a blueprint implementation such as Apache Aries - Blueprint. Three bundles are needed:
Simply download the bundles from mvnrepository and drop them in your osgi/modules folder as usual before deploying blueprint bundles.
Extension point description:
Template project description: Uses Apache Shiro for hooking auth.pipeline.pre
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.authenticator.shiro |
BND Tools | ./bndtools/blade.authenticator.shiro |
Gradle | ./gradle/blade.authenticator.shiro |
Maven | ./maven/blade.authenticator.shiro |
Extension point description:
Template project description: Demonstrates a hook for auth.failure
and auth.max.failures
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.authfailure |
BND Tools | ./bndtools/blade.authfailure |
Gradle | ./gradle/blade.authfailure |
Maven | ./maven/blade.authfailure |
Extension point description:
Template project description: demonstrates integration point of ConfigurationAction
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.configurationaction |
BND Tools | ./bndtools/blade.configurationaction |
Gradle | ./gradle/blade.configurationaction |
Maven | ./maven/blade.configurationaction |
Extension point description: This extension point allows one to provide (or overwrite) friendly URL mapping for portlets.
Template project description: demonstrates how to create a FriendlyURLMapper for the standard NetworkUtilities
portlet.
NetworkUtilities
portlet does not provide friendly URLs out of the box. To test this plugin put a NetworkUtilities
portlet on a page.
If for example that was the home page, after deploying this plugin you can access its tabs directly using the following urls:
- http://localhost:8080/web/guest/home/-/NetworkUtilities/dns-lookup
- http://localhost:8080/web/guest/home/-/NetworkUtilities/whois
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.friendlyurl |
BND Tools | ./bndtools/blade.friendlyurl |
Gradle | ./gradle/blade.friendlyurl |
Maven | ./maven/blade.friendlyurl |
Extension point description:
Template project description: demonstrates felix gogo commands and consuming Liferay services through DS (Declarative Services)
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.gogo |
BND Tools | ./bndtools/blade.gogo |
Gradle | ./gradle/blade.gogo |
Maven | ./maven/blade.gogo |
Extension point description:
Template project description: demonstrates how to create custom IndexerPostProcessor.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.indexerpostprocessor |
BND Tools | ./bndtools/blade.indexerpostprocessor |
Gradle | ./gradle/blade.indexerpostprocessor |
Maven | ./maven/blade.indexerpostprocessor |
Extension point description:
Template project description: demonstrates a jsp hook for login.jsp
in com.liferay.login.web
bundle via fragment bundle.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.hook.jsp |
BND Tools | ./bndtools/blade.hook.jsp |
Gradle | ./gradle/blade.hook.jsp |
Maven | ./maven/blade.hook.jsp |
Extension point description: This example demonstrates how to implement a Liferay com.liferay.portal.kernel.events.LifecycleAction
. This API replaces all the legacy lifecycle events such as com.liferay.portal.kernel.events.Action
, com.liferay.portal.kernel.events.SessionAction
, and com.liferay.portal.kernel.events.SimpleAction
.
Connecting an LifecycleAction to a particular event is determined by the OSGi service property key
. The following keys are supported:
application.shutdown.events
- fired during destruction of company instances at portal shutdownapplication.startup.events
- fired during initialization of company instances at portal start, or when a new instance is createdglobal.shutdown.events
- fired during destruction of the portal's main servletglobal.startup.events
- fire during initialization of the portal's main servletlayout.configuration.action.delete
- fired during destruction of a page (Layout)layout.configuration.action.update
- fired during initialization of a page (Layout)login.events.post
- fired immediately following loginlogin.events.pre
- fired immediately prior to loginlogout.events.post
- fired immediately following logoutlogout.events.pre
- fired immediately prior to logoutservlet.service.events.post
- fired following requests to the portal (including all portlet container requests)servlet.service.events.pre
- fired prior to requests to the portal (including all portlet container requests & post login)servlet.session.create.events
- fired during creation of a portal's http sessionservlet.session.destroy.events
- fired during destruction of a portal's http session
Template project description: this example demonstrates a hook for login.events.pre
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.lifecycle.loginpreaction |
BND Tools | ./bndtools/blade.lifecycle.loginpreaction |
Gradle | ./gradle/blade.lifecycle.loginpreaction |
Maven | ./maven/blade.lifecycle.loginpreaction |
Extension point description: Model Listeners are used to listen for events on models and do something in response.
Template project description: Demonstrates how to create a model listener for Layout
After deploying this plugin the title of any newly created page will be automatically set to "Title generated by model listener!"
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.modellistener |
BND Tools | ./bndtools/blade.modellistener |
Gradle | ./gradle/blade.modellistener |
Maven | ./maven/blade.modellistener |
Extension point description:
Template project description: Demonstrates extension point of MVCActionCommand
. It integrates the action command named greet
with portlet greeter
.
To see how this example works, a portlet plugin with a portlet named greeter (javax.portlet.name='greeter'
) is to be deployed. The command adds a key greeting_message
to Liferay SessionMessages, along with a session attribute GREETER_MESSAGE
. You can independently deploy the bundle blade.portlet.actioncommand
a.k.a refresh the bundle without the need to redeploy the Portlet plugin.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.portlet.actioncommand |
BND Tools | ./bndtools/blade.portlet.actioncommand |
Gradle | ./gradle/blade.portlet.actioncommand |
Maven | ./maven/blade.portlet.actioncommand |
Extension point description:
Template project description: demonstrates how to make a hook for PollerProcessor
.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.pollprocessor |
BND Tools | ./bndtools/blade.pollprocessor |
Gradle | ./gradle/blade.pollprocessor |
Maven | ./maven/blade.pollprocessor |
Extension point description:
Below are examples of buildeing portles using diferent frameworks:
Template project description: demonstrates how to use Blueprint framework for registering a portlet.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.portlet.blueprint |
BND Tools | ./bndtools/blade.portlet.blueprint |
Gradle | ./gradle/blade.portlet.blueprint |
Maven | ./maven/blade.portlet.blueprint |
Template project description: demonstrates how to use DS (Declarative Services) framework for registering a portlet.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.portlet.ds |
BND Tools | ./bndtools/blade.portlet.ds |
Gradle | ./gradle/blade.portlet.ds |
Maven | ./maven/blade.portlet.ds |
Template project description: demonstrates how to use the raw OSGI APIs for registering a portlet.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.portlet.osgiapi |
BND Tools | ./bndtools/blade.portlet.osgiapi |
Gradle | ./gradle/blade.portlet.osgiapi |
Maven | ./maven/blade.portlet.osgiapi |
Template project description: demonstrates how to use the DS (Declarative Services) for registering a JSF portlet
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.jsf.portlet.ds |
BND Tools | ./bndtools/blade.jsf.portlet.ds |
Gradle | ./gradle/blade.jsf.portlet.ds |
Maven | ./maven/blade.jsf.portlet.ds |
Extension point description:
Template project description: demonstrates a simple jsp portlet.
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.portlet.jsp |
BND Tools | ./bndtools/blade.portlet.jsp |
Gradle | ./gradle/blade.portlet.jsp |
Maven | ./maven/blade.portlet.jsp |
Extension point description:
Template project description: demonstrates how to apply PortletFilters
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.portlet.filter |
BND Tools | ./bndtools/blade.portlet.filter |
Gradle | ./gradle/blade.portlet.filter |
Maven | ./maven/blade.portlet.filter |
Extension point description: Allows to create custom, JAX-RS standard based restfull services
Template project description: demonstrates how to create a JAX-RS service that list Liferay users
NOTE: Before this service is accessible, one needs to configure endpoints for it. To do so, go to
Control Panel > System > System Settings > Foundation
and then
- Search for CXF Endpoints
- create new
CXFEndpoint publisher configuration
providingContext path
(say/rest-test
) - Go back to
System Settings > Foundation
and selectREST Extender
- create new
Rest extender configuration
(search withrest
) providingContext paths
(say/rest-test
) andjaxrs.applications.filters
set to:(jaxrs.application=true)
Then you can access the service via http://localhost:8080/o/rest-test/blade.users/list/
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.rest |
BND Tools | ./bndtools/blade.rest |
Gradle | ./gradle/blade.rest |
Maven | ./maven/blade.rest |
Extension point description:
Template project description: demonstrates how to create a Service Builder project separated to 4 bundles:
- api bundle for interface
- svc bundle for implementation
- test bundle for testing
- web bundle is a portlet calling generated services
Template projects links:
Build tool | subproject | Link to project's source code |
---|---|---|
Liferay-gradle | API | ./liferay-gradle/blade.servicebuilder.api |
Liferay-gradle | Service | ./liferay-gradle/blade.servicebuilder.svc |
Liferay-gradle | Test | ./liferay-gradle/blade.servicebuilder.test |
Liferay-gradle | Web | ./liferay-gradle/blade.servicebuilder.web |
BND Tools | API | ./bndtools/blade.servicebuilder.api |
BND Tools | Service | ./bndtools/blade.servicebuilder.svc |
BND Tools | Test | ./bndtools/blade.servicebuilder.test |
BND Tools | Web | ./bndtools/blade.servicebuilder.web |
Gradle | API | ./gradle/blade.servicebuilder.api |
Gradle | Service | ./gradle/blade.servicebuilder.svc |
Gradle | Test | ./gradle/blade.servicebuilder.test |
Gradle | Web | ./gradle/blade.servicebuilder.web |
Maven | All (parent) | ./maven/blade.servicebuilder |
Extension point description:
Template project description: demonstrates how to wrap UserLocalService with custom UserLocalServiceWrapper
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.service.hook.user |
BND Tools | ./bndtools/blade.service.hook.user |
Gradle | ./gradle/blade.service.hook.user |
Maven | ./maven/blade.service.hook.user |
Extension point description:
Template project description: demonstrates how to write StrutsAction
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.strutsaction |
BND Tools | ./bndtools/blade.strutsaction |
Gradle | ./gradle/blade.strutsaction |
Maven | ./maven/blade.strutsaction |
Extension point description:
Template project description: demonstrates how to write StrutsPortletAction
Template projects links:
Build tool | Link to project's source code |
---|---|
Liferay-gradle | ./liferay-gradle/blade.strutsportletaction |
BND Tools | ./bndtools/blade.strutsportletaction |
Gradle | ./gradle/blade.strutsportletaction |
Maven | ./maven/blade.strutsportletaction |
This project does not yet have template projects for the following extension points. We encourage you to contribute some!
- com.liferay.mail.util.Hook
- com.liferay.portal.kernel.atom.AtomCollectionAdapter
- com.liferay.portal.kernel.format.PhoneNumberFormat
- com.liferay.portal.kernel.lar.PortletDataHandler
- com.liferay.portal.kernel.lar.StagedModelDataHandler
- com.liferay.portal.kernel.lock.LockListener
- com.liferay.portal.kernel.notifications.UserNotificationHandler
- com.liferay.portal.kernel.pop.MessageListener
- com.liferay.portal.kernel.portlet.FriendlyURLMapper
- com.liferay.portal.kernel.portlet.PortletLayoutListener
- com.liferay.portal.kernel.sanitizer.Sanitizer
- com.liferay.portal.kernel.scheduler.SchedulerEntry
- com.liferay.portal.kernel.scheduler.SchedulerEntry
- com.liferay.portal.kernel.search.Indexer
- com.liferay.portal.kernel.search.OpenSearch
- com.liferay.portal.kernel.servlet.URLEncoder
- com.liferay.portal.kernel.template.TemplateHandler
- com.liferay.portal.kernel.template.TemplateManager
- com.liferay.portal.kernel.trash.TrashHandler
- com.liferay.portal.kernel.upgrade.UpgradeProcess (call the Release service)
- com.liferay.portal.kernel.webdav.WebDAVStorage
- com.liferay.portal.kernel.workflow.WorkflowHandler
- com.liferay.portal.kernel.xmlrpc.Method
- com.liferay.portal.model.ModelListener
- com.liferay.portal.security.auth.AuthToken
- com.liferay.portal.security.auth.AuthVerifierConfiguration
- com.liferay.portal.security.auth.AutoLogin
- com.liferay.portal.security.auth.EmailAddressGenerator
- com.liferay.portal.security.auth.EmailAddressValidator
- com.liferay.portal.security.auth.FullNameGenerator
- com.liferay.portal.security.auth.FullNameValidator
- com.liferay.portal.security.auth.ScreenNameGenerator
- com.liferay.portal.security.auth.ScreenNameValidator
- com.liferay.portal.security.ldap.AttributesTransformer
- com.liferay.portal.security.membershippolicy.OrganizationMembershipPolicy
- com.liferay.portal.security.membershippolicy.RoleMembershipPolicy
- com.liferay.portal.security.membershippolicy.SiteMembershipPolicy
- com.liferay.portal.security.membershippolicy.UserGroupMembershipPolicy
- com.liferay.portal.security.permission.BaseModelPermissionChecker
- com.liferay.portal.security.permission.PermissionPropagator
- com.liferay.portal.security.pwd.Toolkit
- com.liferay.portal.verify.VerifyProcess
- com.liferay.portlet.asset.model.AssetRendererFactory
- com.liferay.portlet.ControlPanelEntry
- com.liferay.portlet.ControlPanelEntry
- com.liferay.portlet.DefaultControlPanelEntryFactory
- com.liferay.portlet.dynamicdatamapping.render.DDMFormFieldRenderer
- com.liferay.portlet.dynamicdatamapping.util.DDMDisplay
- com.liferay.portlet.expando.model.CustomAttributesDisplay
- com.liferay.portlet.social.model.SocialActivityInterpreter
- com.liferay.portlet.social.model.SocialRequestInterpreter
- java.util.ResourceBundle
- javax.portlet.filter.ActionFilter
- javax.portlet.filter.EventFilter
- javax.portlet.filter.RenderFilter
- javax.portlet.filter.ResourceFilter
- javax.portlet.PreferencesValidator
- javax.servlet.Filter (Liferay InvokerFilterChain Filters)
These templates can be copied freely and contributions are welcome. You can
contribute additional template samples by creating the project for one of the
four build tools and sending a pull request to liferay/liferay-blade-samples
.
A repository admin will review the submission and replicate the project for the
other three build tools, once the submission is approved.