is there a way to create/export a LAR from liferay server A and import this in liferay server B with a script or even a maven/hudson plugin? I'm using Liferay 6.0.5.
thanks,
Stijn
The best way to achieve what you want is to make use of scheduling for remote publication. You can find this option in the manage pages portlet.
Keep in mind that you can deploy servlets in Liferay. I would package the war file as a "web" plugin as described in this article on Nabble in order to access the Liferay APIs. From here you could perform whatever units of work you want, of which exporting a lar file. Call the servlet URL with the appropriate parameters and you're g2g.
You may refer to following Liferay resources to get details of Liferay API:
http://docs.liferay.com/portal/6.1/javadocs/com/liferay/portal/service/LayoutLocalServiceUtil.html
https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portal/staging/StagingImpl.java
Related
I have been using Liferay for work for 2 weeks. I noticed that it's a bit difficult to find good documentation and tutorials.
Until now I created pages from the web portal. After I create them, I drag and drop portlets. I don't really like this approach, I would prefer to use a coding approach. Is there a way to create a website or page programmatically by defining a project as I do to create portlets?
Moreover, I am using Liferay with WebLogic 10.3.6. I want to know where liferay puts pages I created via web-portal on the file system. I suppose that a file, or something similar, is created when I declare a new site on the Liferay web-portal.
Thank you all,
Marco
Yes Liferay has it's Database, all data of any Liferay object is stored in the database and / or on the file system depending on your configuration.
However, one of the functionality of Liferay is to let you create pages / sites through the UI. As documented in the Java Portal Specification and Liferay Server Documents your approach to create pages in an alternative way is possible but it is part of Liferay's Portal Services. You can use Liferay's Service (HTTP REST) API to call the related service. To access those APIs you need to configure your Liferay Server.
In case you want to do programmatically you still need to configure, enable and call those external HTTP services from your code. You should not create Liferay Objects from your own code hosted as an extension inside your Liferay Instance as that will result inconsistency in your Liferay Database / filesystem. (As in case of page creation Liferay creates a set of other related objects in it's database / filesystem.)
In your liferay bundle you will find two plugins of interest.
First is resources-importer-web for which description says
The Resources Importer app allows front-end developers to package web
content, portlet configurations, and layouts together in a theme
without saving it as a compiled .LAR file thereby allowing for greater
flexibility in its usage between Liferay Portal versions.This app will automatically create associated content when other
plugins are deployed that are configured to make use of the Resource
Importer app.This app installs as a Liferay service.
Second is welcome-theme which declares resources to be created by resources-importer-web. This on should be example how to create your own. Take a look at
welcome-theme\WEB-INF\src\resources-importer\*
welcome-theme\WEB-INF\liferay-plugin-package.properties
This feature is described at importing-resources-with-themes
As mentioned by gabor_the_kid, Liferay stores all objects in its tables. For example, User related objects would be in user table. Liferay exposed services or API's to change the default/to add new behaviors by program but not easier than achieving it through UI. Also maintenance should be considered for going program way of creating pages or layouts etc.
You can describe your changes using xml and use the Liferay Portal DB Setup core to create the changes in DB.
The library defines the list of available xml configurations.
As the title states, i'm trying to convert these Vignette portlets into Liferay portlets.
Is there any documentation on this anywhere? I've searched the entire Internet
-When trying to deploy my WARs right off the bat, I'm getting a "missing liferay.plugin.packet.xml" which tells me the entire portlet must be reconfigured to work with Liferay.
-Running Liferay 6.1.1 ga2 on Web Logic 12c server
Cheers!
You mean "liferay-plugin-package.xml", don't you?
You will find such a file in the source of Liferay at /portal-web/docroot/WEB-INF/liferay-plugin-package.xml. For other examples just download sources from other Portlets (Github or Liferay-Marketplace).
Besides some other values, this file defines how Liferay should handle your war (layout-template, portlet, theme).
EDIT: As the marketplace does not allow (plz see the comment in: liferay-plugin-package_6_1_0.dtd) portlets having an liferay-plugin-package.xml, I would recommend to use the corresponding properties file.
Reference file (in the portal sources): /definitions/liferay-plugin-package_6_1_0.properties
I am developing Liferay portal and I have one portlet which handles the administrator side of the portal and one the client side. The thing is that the clients cannot see the administrator page (including the portlet). Also I have created custom DataBase for the portal (I included my own tables in the Liferay database using Service Builder). Now I want to use the same database so I can take info from it using the client portlet.
Any ideas?
I am using Liferay 6.1 with Tomcat and Liferay SDK plugin for Eclipse.
You can copy the [portlet name]-service.jar from Web-Inf/lib, and paste it to any other portlet's lib folder. Even better if you can do this with maven and add this jar as a dependency. This way you can have access to the Util Classes that your service provides, to any other Portlet
All portlets in a plugin project share the service builder service made by that plugin (because they end up in one war file and thus share runtime context). So you could just put both your portlets in the same plugin and they can both access that plugin's service builder services/tables. I think you will find this is a commonly used approach. The permission and visibility issues you mention are not impacted by this organization.
Doing it this way keeps the deployment simple -- just deploy the plugin's war, done.
If there are reasons beyond your control that require the portlets to be in separate plugins, then it becomes harder -- yannicuLar's approach is one way.
If you have two portlets sharing same tables/entities , you can copy the service.jar to
tomcat-7.0.27\lib\ext a common location where these two portlets can access this .jar at runtime.
First of all, let me tell you what I am or my company is intended to do. We have already developed a project using Java, JSP and Servlet. We want it to integrate with Liferay so that we can change logo, css, images, themes or any other UI related component at run time using Liferay admin panel. But backend should be what we have developed.
In short, the UI of our project is controlled by Liferay, but control of data displayed on UI or submitted from UI should be from our developed backend code.
Now I have a few questions regarding above said approach of fulfilling the requirement:
What we are trying to do is possible?
Is this approach recommendable for what we intended to do?
Or do we need to develop our project from scratch to fit into Liferay? Like developing portlets and deploying in Liferay or other approach that has been given in Liferay documentation.
What about database integration? We have around 15 columns/fields in user table in database of our project which is completely different from that of Liferay's user table.
Liferay is a very new for us. We have checked the documentation section of Liferay but still few things like above said requirements and its implementation is not clear. Also, we would like to know in what scenarios/requirements Liferay is useful.
Ok let me try to answer your question point-wise and I would answer your last question first, which should automatically clear other questions:
Q. Also, we would like to know in what scenarios/requirements Liferay is useful.
This can have a very wide answer, but I have made it shorter for you:
If your site is content heavy and not data heavy then go for Portal
If you plan to use only a single web-application in a portal then I would suggest standalone custom developed web-application is much better.
I agree liferay portal will give you lot of things out-of-box like Single Sign-on, authorization, authentication, friendly-url and page creation and also lot of applications like Blogs, Wikis, Document library, some social networking apps etc. But think about it, do you really need all this? if not, then this is overkill
Here are some really nice links to better understand a portal's usage:
When to use a portal
Why to use portal technology
liferay tag wiki: It has nice description as to what is liferay and it also contains relevant links to Admin guide which will tell you what all functionalities liferay has and how you can manage it.
So still if you find your other questions unanswered, read-on ...
Q1. What we are trying to do is possible?
Nope. Portlet technology is different from Servlet technology. Liferay (or anyother portal) does not provide a way (atleast a simple one) to integrate servlets that would render pages inside a portal. For eg: Since with servlet you define URL mappings for a particular servlets before-hand in a web.xml but in a portal the URLs are generated by the Portlet Container. So portals work with portlets and not Servlets.
Q2. Is this approach recommendable for what we intended to do?
Nope. As I already explained in Q1.
Q3. Or do we need to develop our project from scratch to fit into Liferay? Like developing portlets and deploying in Liferay or other approach that has been given in Liferay documentation.
If you want to go the liferay way then Yes.
If you want to build applications that talk to your custom tables then portlets are the way to go.
Q4. What about database integration? We have around 15 columns/fields in user table in database of our project which is completely different from that of Liferay's user table.
If you go with Liferay. In this scenario you can create a combination of liferay-hook & portlet (may be using service-builder) to customize liferay's User creation mechanism and there by store data in both Liferay's User table and your custom tables.
Liferay's permission system is really fine-grained so you can also benefit from this system and put permission even on the data level.
In conclusion I would say:
Everything boils down to what your requirements are and what resources you have. And sometimes what future requirements you can have.
Note: All the terms used in this answer which are specific to liferay (like service-builder, hook etc) are explained in the liferay tag wiki.
Hope this helps. If you would like to know anything specific I would gladly update my answer.
I'm new to liferay, trying to create web app using liferay protlets. I'm trying to create a custom login portlet. In html file, using form action method I'm trying to call a jsp file, which is giving error. help me out. can you give suggest some tuts so tat I can learn how to design dynamic liferay protlets and to deploy in the liferay portal server.
You can achive login in liferay by
An AutoLogin hook http://www.liferay.com/community/wiki/-/wiki/Main/Portal+Hook+Plugins#section-Portal+Hook+Plugins-Portal+Properties
Extending authentication pipeline http://www.liferay.com/community/wiki/-/wiki/Main/Developing+a+CAS#section-Developing+a+CAS-Authenticaton+Pipeline
By your custom implementation http://www.liferay.com/it/community/forums/-/message_boards/message/16008439
Extending Liferay itself (by EXT plugin) https://www.liferay.com/community/wiki/-/wiki/Main/Ext+Plugin
I would suggest doing them in the order I specified, as they increase in complexity.
Please do let me know of any specific queries in these.