/blade

Bootstrap Liferay Advanced Developer Env

Primary LanguageJavaApache License 2.0Apache-2.0

Bootstrap Liferay Advanced Developer Environments(BLADE)

Build Status Join the chat at https://gitter.im/rotty3000/blade

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.

Related build tools and frameworks

Build tools

The template projects are categorized based on the build tools,

  • gradle - these are set of Liferay projects that can be bootstrapped on to gradle based development environment
  • liferay-gradle - these are set of Liferay projects that can be bootstrapped on to com.liferay.plugin(a gradle plugin) based development environment
  • maven - these are set of Liferay projects that can be bootstrapped on to maven development environment
  • bndtools - these are set of Liferay projects that can be bootstrapped on to bndtools based development environment

A note on BNDTools

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.

Frameworks

The projects also demonstrate how to use various frameworks like:

  • Blueprint
  • Declarative Services(DS)
  • OSGI API

A note on Blueprint

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.

Liferay extension points and template projects

auth.pipeline.pre

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

auth.failure and auth.max.failures

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

ConfigurationAction

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

FriendlyURLMapper

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:

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

Gogo command

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

IndexerPostProcessor

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

JSP hook

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

login.events.pre

Extension point description:

Template project description: 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

ModelListener

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

MVCActionCommand

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

PollerProcessor

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

Portlet

Extension point description:

Below are examples of buildeing portles using diferent frameworks:

Liferay MVC Portlet - using Blueprint framework

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

Liferay MVC Portlet - using DS (Declarative Services) framework

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

Liferay MVC Portlet - using raw OSGI APIs

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

JSF Portlet - using DS (Declarative Services) framework

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

JSP Portlet

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

PortletFilter

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

REST service

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 > Platform and

  • create new CXFEndpoint publisher configuration providing Context path (say /rest-test)
  • create new Rest extender configuration providing Context paths (say /rest-test)

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

Service Builder

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

ServiceWrapper

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

StrutsAction

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

StrutsPortletAction

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

Liferay extension points without template projects

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)

License

License

Contribution

These templates can be copied freely and contributions are welcome.

References

OSGI R5

OSGI Compendium R5

Blueprint

Bndtools