tag:blogger.com,1999:blog-32985375107246188742024-03-08T03:07:17.732-08:00Liferay and Other Open Source TechnologiesThis blog is all about my investigation and research on Open Source TechnologiesSaddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-3298537510724618874.post-88365604789564750952010-08-27T02:23:00.000-07:002010-08-27T04:36:00.790-07:00How to disable border by default for all portlet in LiferayPlease add following setting in <b>liferay-look-and-feel.xml</b> file for disabling border for all portlets by default.<br />
<br />
<theme id="ecommera" name="eCommera"><br />
<settings><br />
<setting key="portlet-setup-show-borders-default" value="false" /><br />
</settings> <br />
</theme>Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com3tag:blogger.com,1999:blog-3298537510724618874.post-62600335583280579652010-08-11T03:11:00.000-07:002010-08-11T03:15:55.351-07:00What is WSRP?<u><b>WSRP stands for Web Services and Remote Protocal</b></u><br />
<br />
The Web Services for Remote Portlets specification defines a web service interface for accessing and interacting with interactive presentation-oriented web services. It has been produced through the joint efforts of the Web Services for Interactive Applications (WSIA) and Web Services for Remote Port als (WSRP) OASIS Technical Committees. It is based on the requirements gathered by both committees and on the concrete proposals to both committees. There are mainly two actors <b>Producer</b> and <b>Consumer.</b><br />
<b> Producer </b>produce web services and <b>Consumer</b> consumes it and will present easily consumable form to an End -User.<br />
<b> </b><br />
<br />
<u><b> </b></u><br />
<b><u>Motivation for WSRP</u></b><br />
<br />
Portals and other Web applications render and aggregate information from different sources and provide it in a compact and easily consumable form to an End-User.<br />
<b></b><br />
<b></b><br />
<b></b><br />
<b></b><br />
<b></b><br />
<b></b><br />
<br />
<b><u><br />
</u></b><br />
<b><u><br />
</u></b><br />
<b><br />
</b>Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com1tag:blogger.com,1999:blog-3298537510724618874.post-27216946600119943572010-08-06T00:40:00.000-07:002010-08-06T00:40:09.860-07:00How to use Freemarker Template Language in Liferay 6 theme?From Liferay 6.* version Liferay is supporting both Velocity Templates and Freemarker Template languages in Themes. Here are the settings to use Freemarker(ftl) Temaplates for our Themes.<br />
<br />
Please write ftl instead of vm in <b>template-extension</b> node in Liferay-look-and-feel.xml <br />
<br />
<br />
Then restart the server. Now do customization in ftl files rather than doing it in vm.<br />
<br />
By default Liferay uses vm(Velocity Template Language).<br />
<br />
<br />
<br />
<br />
<br />
<br />
</theme>Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com0tag:blogger.com,1999:blog-3298537510724618874.post-85596906280008581542010-08-03T00:14:00.000-07:002010-08-03T00:14:50.914-07:00What is Kuler?<b>Adobe Kuler </b>— the web-hosted application for generating color themes that can inspire any project. No matter what you're creating, with Kuler you can experiment quickly with color variations and browse thousands of themes from the Kuler community.<br />
<br />
You can Explore, create and share color themes.Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com0tag:blogger.com,1999:blog-3298537510724618874.post-25657370266974325392010-08-03T00:10:00.000-07:002010-08-03T00:10:46.280-07:00What is MooTools?<b>MooTools</b> is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer. It allows you to write powerful, flexible, and cross-browser code with its elegant, well documented, and coherent API.<br />
<br />
MooTools code respects strict standards and doesn't throw any warnings. It's extensively documented and has meaningful variable names: a joy to browse and a snap to understand.<br />
<br />
<a href="http://demos111.mootools.net/">Examples</a>Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com0tag:blogger.com,1999:blog-3298537510724618874.post-68265591074806958302010-07-28T23:50:00.000-07:002010-07-28T23:50:38.041-07:00Jquery conflict in LiferayIf user my own copy of jquery, no jquery works in Liferay like Drag-n-Drop, Dock Menu, Configuration Actions and many more. If I use the Liferay jquery, all of their scripts work, but none of mine. If both jquery files are linked, all of my stuff works, but not theirs. If I replace the jquery.js with the newest version, none of the jquery works.<br />
<br />
For this i have done more 8-hours of investigation and finally got the solution.<br />
I have written noConflict(); for my custom Jquery version and it start working.<br />
<br />
Please add following line in <b>{YOUR-THEME}/javascript/javascript.js</b><br />
<br />
<br />
<b> var $ = $.noConflict(true);</b><br />
<br />
<br />
This solves my problem and both Jquery start working.......<b><br />
</b>Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com1tag:blogger.com,1999:blog-3298537510724618874.post-16060203990187331292010-07-22T22:48:00.000-07:002010-07-22T23:33:54.774-07:00CAS Single Sign On (SSO) integration with Liferay<span style="font-weight: bold;">Steps for SSL Certificate</span><br /><br />Open Command Prompt and type given below command<br /><br /><span style="font-weight: bold; font-style: italic;">keytool -genkey -alias tomcat -keypass changeit -keyalg RSA</span><br /><br />Enter keystore password: changeit<br /><br />What is your first and last name?<br /><br />[Unknown]: localhost<br /><br />What is the name of your organizational unit?<br /><br />[Unknown]: localhost<br /><br />What is the name of your organization?<br /><br />[Unknown]:<br /><br />What is the name of your City or Locality?<br /><br />[Unknown]:<br /><br />What is the name of your State or Province?<br /><br />[Unknown]:<br /><br />What is the two-letter country code for this unit?<br /><br />[Unknown]:<br /><br />Is CN=localhost, OU=localhost, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?<br /><br />[no]: yes<br /><br /><span style="font-weight: bold; font-style: italic;">keytool -export -alias tomcat -keypass changeit -file D:\liferay5.2.3\server.crt</span><br /><br />Enter keystore password: changeit<br /><br />Certificate stored in file D:\liferay5.2.3\server.crt<br /><br /><span style="font-weight: bold; font-style: italic;">keytool -import -file D:\liferay5.2.3\server.crt -keypass changeit -keystore %JAVA_HOME%\jre\lib\security\cacerts</span><br /><br />Enter keystore password: changeit<br /><br />Owner: CN=localhost, OU=localhost, O=Unknown, L=Unknown, ST=Unknown, C=Unknown<br /><br />Issuer: CN=localhost, OU=localhost, O=Unknown, L=Unknown, ST=Unknown, C=Unknown<br /><br />Serial number: 462067d8<br /><br />Valid from: Fri Apr 13 15:39:36 HST 2010 until: Thu Jul 12 15:39:36 HST 2010<br /><br />Certificate fingerprints:<br /><br />MD5: CC:3B:FB:FB:AE:12:AD:FB:3E:D 5:98:CB:2E:3B:0A:AD<br /><br />SHA1: A1:16:80:68:39:C7:58:EA:2F:48:59:AA:1D:73:5F:56:78:CE:A4:CE<br /><br />Trust this certificate? [no]: yes<br /><br />Certificate was added to keystore<br /><br /><br />Steps for ApacheTomcat Server<br /><br />Remove comments from server.xml file for HTTPS request which runs on port no 8443.<br /><br /><span style="font-weight: bold; font-style: italic;">keystorePass="changeit" truststoreFile="C:/Program Files/Java/jdk1.6.0_14/jre/lib/security/cacerts" /></span><br /><br /><span style="font-weight: bold;">Setting up CAS server</span><br /><br />1. Download the CAS Server and find the war file e.g. \cas-server-3.2.1\modules\cas-server-webapp-3.2.1.war<br /><br />2. Start the Apache Tomcat server. Deploy the war file (cas-server-webapp-3.2.1.war) to the Tomcat’s webapps folder and rename it. e.g. C:\apache-tomcat-6.0.14\webapps\cas-web<br /><br />3. Now that CAS is deployed you should have an unpacked directory in your webapps folder e.g. C:\apache-tomcat-6.0.14\webapps\cas-web<br /><br />4. Restart tomcat and log in with the username and password at the url https://localhost:8443/cas-web/login<br /><br /><span style="font-weight: bold;">Setting up Liferay</span><br /><br />1. Create system-ext.properties (webapps\ROOT\WEB_INF\classes)<br /><br />2. Open system-ext.properties and enter and Save it.<br /><br />com.liferay.filters.sso.cas.CASFilter=true<br /><br />3. Open portal-ext.properties and enter and Save it.<br /><br />auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin<br /><br />auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin,com.liferay.portal.security.auth.CASAutoLogin<br /><br />4. Login as administrator and go to control panel->settings->Authentication->CAS<br /><br />5. Give<span style="font-style: italic;"> Login URL: https://localhost:8443/cas-web/login</span><br /><br />6. Give <span style="font-style: italic;">Logout URL: https://localhost:8443/cas-web/logout?http://localhost:8080/c/portal/login</span><br /><br />7. Give <span style="font-style: italic;">Server Name: localhost:8080</span><br /><br />8. Give <span style="font-style: italic;">Service URL: http://localhost:8080/c/portal/login</span><br /><br />9. Give <span style="font-style: italic;">Validate URL: https://localhost:8443/cas-web/proxyValidate</span><br /><br />10. Save itSaddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com3tag:blogger.com,1999:blog-3298537510724618874.post-38075581056650119582010-07-21T23:33:00.000-07:002010-07-21T23:53:48.978-07:00Performance Tuning in Liferay<span style="font-size:85%;"><b>Performance Tuning</b></span><p></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Once you have your portal up and running, you may find a need to tune it for performance, especially if your site winds up generating more traffic than you'd anticipated. There are some definite steps you can take with regard to improving Liferay's performance.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>Memory</b></span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Memory is one of the first things to look at when you want to optimize performance. If you have any disk swapping, that will have a serious impact on performance. Make sure that your server has an optimal amount of memory and that your JVM is tuned to use it. There are three basic JVM command switches that control the amount of memory in the Java heap.<br /></span></p><p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">-Xms</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">-Xmx</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">-XX:MaxPermSize</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">These three settings control the amount of memory available to the JVM initially, the maximum amount of memory into which the JVM can grow, and the separate area of the heap called Permanent Generation space. The first two settings should be set to the same value. This prevents the JVM from having to reallocate memory if the application needs more. Setting them to the same value causes the JVM to be created up front with the maximum amount of memory you want to give it.</span></p> <p style="margin-bottom: 0in; font-weight: bold;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">-Xms1024m -Xmx1024m -XX:MaxPermSize=128m</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">This is perfectly reasonable for a moderately sized machine or a developer machine. These settings give the JVM 1024MB for its regular heap size and have a Perm-Gen space of 128MB. If, however, you have Liferay on a server with 4GB of RAM and you are having performance problems, the first thing you might want to look at is increasing the memory available to the JVM. You will be able to tell if memory is a problem by running a profiler (such as Jprobe, YourKit, or the NetBeans profiler) on the server. If you see Garbage Collection (GC) running frequently, you will definitely wantto increase the amount of memory available to the JVM.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Note that there is a law of diminishing returns on memory, especially with 64 bit systems. These systems allow you to create very large JVMs, but the larger the JVM, the more time it takes for garbage collection to take place. For this reason, you probably won't want to create JVMs of more than 2 GB in size. To take advantage of higher amounts of memory on a single system, run multiple JVMs of Liferay instead. Issues with PermGen space can also affect performance. PermGen space contains long-lived classes, anonymous classes and interned Strings. Hibernate, in particular—which Liferay uses extensively—has been known to make use of PermGen space. If you increase the amount of memory available to the JVM, you may want to increase the amount of PermGen space accordingly.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>Garbage Collection</b></span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">As the system runs, various Java objects are created. Some of these objects are long-lived, and some are not. The ones that are not become <i>de-referenced</i>, which means that the JVM no longer has a link to them because they have ceased to be useful. These may be variables that were used for methods which have already returned their values, objects retrieved from the database for a user that is no longer logged on, or a host of other things. These objects sit in memory and fill up the heap space until the JVM decides it's time to clean them up. Normally, when garbage collection (GC) runs, it stops all processing in the JVM while it goes through the heap looking for dead objects. Once it finds them, it frees up the memory they were taking up, and then processing can continue. If this happens in a server environment, it can slow down the processing of requests, as all processing comes to a halt while GC is happening.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">There are some JVM switches that you can enable which can reduce the of time processing is halted while garbage collecting happens. These can improve the performance of your Liferay installation if applied properly. As always, you will need to use a profiler to monitor garbage collection during a load test to tune the numbers properly for your server hardware, operating system, and application server. The Java heap is divided into sections for the young generation, the old generation, and the permanent generation. The young generation is further divided into three sections: Eden, which is where new objects are created, and two “survivor spaces,” which we can call the <i>From </i>and <i>To </i>spaces. Garbage collection occurs in stages. Generally, it is more frequently done in the young generation, less frequently done in the old generation, and even less frequently done in the permanent generation, where long-lived objects reside. When garbage collection runs in the young generation, Eden is swept for objects which are no longer referenced. Those that are still around are moved to the “To” survivor space, and the</span> “<span style="font-size:85%;">From” space is then swept. Any other objects in that space which still have references to them are moved to the “To” space, and the “From” space is then cleared out altogether. After this, the “From” and the “To” spaces swap roles, and processing is freed up again until the next time the JVM determines that garbage collection needs to run.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">After a predetermined number of “generations” of garbage collection, surviving objects may be moved to the old generation. Similarly, after a predetermined number of “generations” of garbage collection in the old generation, surviving objects may be moved to the permanent generation.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">By default, the JDK uses a serial garbage collector to achieve this. This works very well for a short-lived desktop Java application, but is not necessarily the best performer for a server-based application like Liferay. For this reason, you may wish to switch to the Concurrent Mark-Sweep (CMS) collector.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Rather than halting application processing altogether, this garbage collector makes one short pause in application execution to mark objects directly reachable from the application code. Then it allows the application to run while it marks all objects which are reachable from the set it marked. Finally, it adds another phase the <i>remark </i>phase which finalizes marking by revisiting any objects modified while the application was running. It then sweeps through and garbage collects. This has the effect of greatly reducing the amount of time that execution needs to be halted in order to clean out dead objects. Just about every aspect of the way memory management works in Java can be tuned. In your profiling, you may want to experiment with some of the following settings to see if any of them can increase your performance.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>NewSize, MaxNewSize: </b>The initial size and the maximum size of the New or Young Generation.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>+UseParNewGC: </b>Causes garbage collection to happen in parallel, using multiple CPUs. This decreases garbage collection overhead and increases application throughput.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>+UseConcMarkSweepGC: </b>Use the Concurrent Mark-Sweep Garbage Collector. This uses shorter garbage collection pauses, and is good for applications that have a relatively large set of long-lived data, and that run on machines with two or more processors, such as web servers.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>+CMSParallelRemarkEnabled: </b>For the CMS GC, enables the garbage collector to use multiple threads during the CMS remark phase. This decreases the pauses during this phase.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>ServivorRatio: </b>Controls the size of the two survivor spaces. It's a ratio between the survivor space size and Eden. The default is 25. There's not much bang for the buck here, but it may need to be adjusted.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>ParallelGCThreads: </b>The number of threads to use for parallel garbage collection. Should be equal to the number of CPU cores in your server. A sample configuration using the above parameters might look something like this:</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">JAVA_OPTS="$JAVA_OPTS -XX:NewSize=700m -XX:MaxNewSize=700m -Xms2048m</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">-Xmx2048m -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">+CMSParallelRemarkEnabled -XX:SurvivorRatio=20 -XX:ParallelGCThreads=8"</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>Properties File Changes</b></span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">There are also some changes you can make to your <i>portal-ext.properties </i>file once you are in a production environment. Set the following to false to disable checking the last modified date on server side</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">CSS and JavaScript.</span></p> <p style="margin-bottom: 0in; font-weight: bold;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">last.modified.check=false</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Set this property to true to load the theme's merged CSS files for faster loading for production. By default it is set to false for easier debugging for development. You can also disable fast loading by setting the URL parameter <i>css_fast_load </i>to <i>0</i>.</span></p> <p style="margin-bottom: 0in; font-weight: bold; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><span style="font-weight: normal;">theme.css.fast.load=true</span></span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Set this property to true to load the combined JavaScript files from the property <i>javascript.files </i>into one compacted file for faster loading for production. By default it is set to false for easier debugging for development. You can also disable fast loading by setting the URL parameter <i>js_fast_load </i>to <i>0</i>.</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">javascript.fast.load=true</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>Servlet Filters</b></span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Liferay comes by default with 17 servlet filters enabled and running. It is likely that for your installation, you don't need them all. To disable a servlet filter, simply comment it out of your <i>web.xml </i>file. If there is a feature supported by a servlet filter that you know you are not using, you can comment it out as well to achieve some performance gains. For example, if you are not using CAS for single sign-on, comment out the CAS Filter. If you are not using NTLM for single sign-ons, comment out the Ntlm Filter. If you are not using the Virtual Hosting for Communities feature, comment out the Virtual Host Filter. The fewer servlet filters you are running, the less processing power is needed for each request.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>Portlets</b></span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Liferay comes pre-bundled with many portlets which contain a lot of functionality, but not every web site that is running on Liferay needs to use them all. In <i>portlet. xml </i>and <i>liferay-portlet.xml</i>, comment out the ones you are not using. While having a loan calculator, analog clock, or game of hangman available for your users to add to pages is nice, those portlets may be taking up resources that are needed by custom portlets you have written for your site. If you are having performance problems, commenting out some of the unused portlets may give you the performance boost you need.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>Read-Writer Database Configuration</b></span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Liferay 5.2.x allows you to use two different data sources for reading and writing. This enables you to split your database infrastructure into two sets: one that is optimized for reading and one that is optimized for writing. Since all major databases support replication in one form or another, you can then use your database vendor's replication mechanism to keep the databases in sync in a much faster manner than if you had a single data source which handled everything. Enabling a read-writer database is simple. In your <i>portal-ext.properties </i>file, configuretwo different data sources for Liferay to use, one for reading, and one for writing:</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.read.driverClassName=com.mysql.jdbc.Driver</span></p><p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.read.url=jdbc:mysql://dbread.com/lportal?useUnicode=true& \characterEncoding=UTF-8&useFastDateParsing=false</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.read.username=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.read.password=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.write.driverClassName=com.mysql.jdbc.</span></p><span style="font-style: italic;font-size:85%;" ><br />jdbc.write.url=jdbc:mysql://dbwrite.com/lportal?useUnicode=true& \</span><span style="font-style: italic;font-size:85%;" >characterEncoding=UTF-8&useFastDateParsing=false</span> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.write.username=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.write.password=</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Of course, specify the user name and password to your database in the above configuration. After this, enable the read-writer database configuration by uncommenting the Spring configuration file which enables it in your <i>spring.configs </i>property (line to uncomment is in bold:</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">spring.configs=\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/base-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/hibernate-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/infrastructure-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/management-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/util-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/editor-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/jcr-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/messaging-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/scheduler-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/search-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/counter-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/document-library-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/lock-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/mail-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/portal-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/portlet-container-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/wsrp-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/mirage-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>META-INF/dynamic-data-source-spring.xml,\</b></span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">#META-INF/shard-data-source-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/ext-spring.xml</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">The next time you restart Liferay, it will now use the two data sources you have defined. Be sure to make sure that you have correctly set up your two databases for replication before starting Liferay.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>Database Sharding</b></span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Liferay starting with version 5.2.3 supports database sharding for different portal instances. Sharding is a term used to describe an extremely high scalability configuration for systems with massive amounts of users. In diagrams, a database is normally pictured as a cylinder. Instead, picture it as a glass bottle full of data. Now take that bottle and smash it onto a concrete sidewalk. There will be shards of glass everywhere. If that bottle were a database, each shard now is a database, with a subset of the data in each shard. This allows you to split up your database by various types of data that might be in it. For example, some implementations of sharding a database split up the users: those with last names beginning with A to D go in one database; E to I go in another;etc. When users log in, they are directed to the instance of the application that is connected to the database that corresponds to their last names. In this manner, processing is split up evenly, and the amount of data the application needs to sort through is reduced.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">By default, Liferay allows you to support sharding through different portal instances, using the <i>round robin shard selector</i>. This is a class which serves as the default algorithm for sharding in Liferay. Using this algorithm, Liferay will select from several different portal instances and evenly distribute the data across them. Of course, if you wish to have your developers implement your own sharding algorithm, you can do that. You can select which algorithm is active via the <i>portal-ext.-properties </i>file:</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">shard.selector=com.liferay.portal.dao.shard.RoundRobinShardSelector</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">#shard.selector=com.liferay.portal.dao.shard.ManualShardSelector</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">#shard.selector=[your implementation here]</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Enabling sharding is easy. You will need to make sure you are using Liferay's data source implementation instead of your application server's. Set your various database shards in your <i>portal-ext.properties </i>file this way:</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.default.driverClassName=com.mysql.jdbc.Driver</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.default.username=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.default.password=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.one.driverClassName=com.mysql.jdbc.Driver</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.one.url=jdbc:mysql://localhost/lportal1?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.one.username=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.one.password=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.two.driverClassName=com.mysql.jdbc.Driver</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.two.url=jdbc:mysql://localhost/lportal2?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.two.username=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">jdbc.two.password=</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">shard.available.names=default,one,two</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">Once you do this, you can set up your DNS so that several domain names point to your Liferay installation (e.g., abc1.com, abc2.com, abc3.com). Next, go to the Control Panel and click <i>Portal Instances </i>in the Server category. Create two to three instances bound to the DNS names you have configured.</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">If you are using the RoundRobinShardSelector class, Liferay will automatically enter data into each instance one by one, automatically. If you are using the Manu-</span>alShardSelector class, you will have to specify a shard for each instance using the UI.</p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">The last thing you will need to do is modify the <i>spring.configs </i>section of your <i>portal-ext.properties </i>file to enable the sharding configuration, which by default is commented out. To do this, your spring.configs should look like this (modified section is in bold):</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">spring.configs=\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/base-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/hibernate-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/infrastructure-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/management-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/util-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/editor-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/jcr-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/messaging-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/scheduler-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/search-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/counter-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/document-library-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/lock-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/mail-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/portal-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/portlet-container-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/wsrp-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">META-INF/mirage-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">#META-INF/dynamic-data-source-spring.xml,\</span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;"><b>META-INF/shard-data-source-spring.xml,\</b></span></p> <p style="margin-bottom: 0in; font-style: italic;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">\</span></p> <p style="margin-bottom: 0in;font-family:trebuchet ms;" align="LEFT"><span style="font-size:85%;">That's all there is to it. Your system is now set up for sharding.</span></p>Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com4tag:blogger.com,1999:blog-3298537510724618874.post-81896471909458667062010-06-17T22:37:00.000-07:002010-06-17T22:50:30.355-07:00Community Roles for User Groups in Liferay<blockquote></blockquote>I have done massive investigation on User Group Roles and Permission. I have using same community roles for User Group to make working like community.<br /><blockquote>Resource resource = ResourceLocalServiceUtil.getResource(group.getCompanyId(), Group.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, Long.toString(group.getGroupId()));<br /> System.out.println("resourceId : "+resource.getResourceId());<br /> /*List<string> actions =<br /> ResourceActionsUtil.getModelResourceCommunityDefaultActions(<br /> Group.class.getName());<br /> String[] actionIds = actions.toArray(new String[actions.size()]);*/<br /> <br /> String[] actionIds = new String[7];<br /> actionIds[0] = "ASSIGN_MEMBERS";<br /> actionIds[1] = "DELETE";<br /> actionIds[2] = "MANAGE_ANNOUNCEMENTS";<br /> actionIds[3] = "PERMISSIONS";<br /> actionIds[4] = "MANAGE_LAYOUTS";<br /> actionIds[5] = "UPDATE";<br /> actionIds[6] = "VIEW";<br /><br /> PermissionLocalServiceUtil.setUserPermissions(group.getCreatorUserId(), actionIds, resource.getResourceId());<br /> <br /> //PermissionLocalServiceUtil.addPermissions(group.getCompanyId(), actions, resource.getResourceId());<br /><br /> Role roleAdmin = RoleLocalServiceUtil.getRole(group.getCompanyId(), RoleConstants.COMMUNITY_ADMINISTRATOR);<br /><br /> PermissionLocalServiceUtil.setRolePermissions(roleAdmin.getRoleId(), actionIds, resource.getResourceId());<br /><br /> Role roleOwner = RoleLocalServiceUtil.getRole(group.getCompanyId(), RoleConstants.COMMUNITY_OWNER);<br /><br /> PermissionLocalServiceUtil.setRolePermissions(roleOwner.getRoleId(), actionIds, resource.getResourceId());</blockquote><br />Added this code in EditUserGroupAction.java at the time of creating User Group.<br /><br />With this User Group is start behaving like Community.Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com3tag:blogger.com,1999:blog-3298537510724618874.post-70826426003814859692009-09-16T01:26:00.000-07:002009-09-16T01:30:22.333-07:00Getting list of portlet in existing Layout. Layout layoutForPortletName = LayoutLocalServiceUtil.getLayout(plidSelected);
<br />
<br /> LayoutTypePortlet layoutTypePortletName = (LayoutTypePortlet)layoutForPortletName.getLayoutType();
<br />
<br /> LayoutTemplate layoutTemplate=layoutTypePortletName.getLayoutTemplate();
<br />
<br /> List<string> columnCount = layoutTemplate.getColumns();
<br />
<br /> for(int i=0; i<columnCount.size();i++){
<br />
<br /> String column = columnCount.get(i);
<br /> List<portlet> portlets = layoutTypePortletName.getAllPortlets(column);
<br />
<br /> for(Portlet portlet : portlets){
<br />
<br /> PluginPackage pluginPackage = portlet.getPluginPackage();
<br /> PluginSetting pluginSetting = PluginSettingLocalServiceUtil.getPluginSetting(company.getCompanyId(), portlet.getPortletId(), Plugin.TYPE_PORTLET);
<br />
<br /> StringBuilder sb = new StringBuilder();
<br />
<br /> String displayName = portlet.getDisplayName();
<br /> String title = PortalUtil.getPortletTitle(portlet, application, locale);
<br />
<br /> out.println("portletId = "+portlet.getPortletId()+" "+" Title = " +title);
<br />
<br />
<br /> }
<br /> out.println("");
<br /> }Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com2tag:blogger.com,1999:blog-3298537510724618874.post-17647281485767163192009-09-16T01:25:00.000-07:002009-09-16T01:26:21.623-07:00Getting a ServletContext instance from a PortletSometime when developing a portlet you need to access the ServletContext object. Both JSR, 168 and 286, doesn't provide a generic way to access it. To solve this issue Liferay offers a class called com.liferay.portal.kernel.portlet.PortletBag that enables you to access the ServletContext through its method called getServletContext(). To get a instance of PortletBag you should use the com.liferay.portal.kernel.portlet.PortletBagPool class like the snippet: <br /><br /><blockquote><br />String portletId = "your-portlet-id"; <br /> PortletBag portletBag = PortletBagPool.get(portletId);<br /> ServletContext servletContext = portletBag.getServletContext();<br /></blockquote>Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com1tag:blogger.com,1999:blog-3298537510724618874.post-78555016598269683122009-09-14T01:33:00.000-07:002009-09-14T01:34:34.956-07:00How to get public and private Layouts in LiferayGroup group = themeDisplay.getScopeGroup();<br /><br />group = GroupLocalServiceUtil.getGroup(group.getGroupId());<br /><br />int layoutCount = LayoutLocalServiceUtil.getLayoutsCount();<br /><br />// Public Layout<br />List<Layout> allLayouts = LayoutLocalServiceUtil.getLayouts(group<br /> .getGroupId(), false);<br />// Private Layout<br />List<Layout> allLayouts1 = LayoutLocalServiceUtil.getLayouts(group<br /> .getGroupId(), true);Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com1tag:blogger.com,1999:blog-3298537510724618874.post-48551453019351765372009-09-14T00:59:00.000-07:002009-09-14T01:01:26.677-07:00How to get list of portlets in LiferayList<Portlet> portlets = PortletLocalServiceUtil.getPortlets(company.getCompanyId(), false, false);<br /> //portlets = ListUtil.sort(portlets, new PortletTitleComparator(application, locale));<br /> int total = portlets.size();<br /> for (int i = 0; i < total; i++) {<br /> Portlet portlet = portlets.get(i);<br /><br /> PluginPackage pluginPackage = portlet.getPluginPackage();<br /> PluginSetting pluginSetting = PluginSettingLocalServiceUtil.getPluginSetting(company.getCompanyId(), portlet.getPortletId(), Plugin.TYPE_PORTLET); <br /> <br /> // Name and description<br /><br /> StringBuilder sb = new StringBuilder();<br /><br /> String displayName = portlet.getDisplayName();<br /> String title = PortalUtil.getPortletTitle(portlet, application, locale);<br /><br /> }Saddapalli Mohammed Zaheerhttp://www.blogger.com/profile/05881402638723929510noreply@blogger.com2