June 06, 2012

Liferay - Steps to hooking up Jackrabbit to MySQL


1> Edit the portal-ext.properties to include

### jackrabbit entry Start
jcr.initialize.on.startup=true
jcr.jackrabbit.repository.root=/opt/jboss/data/jackrabbit
jcr.jackrabbit.config.file.path=${jcr.jackrabbit.repository.root}/repository.xml
jcr.jackrabbit.repository.home=${jcr.jackrabbit.repository.root}/home
jcr.jackrabbit.credentials.username=none
jcr.jackrabbit.credentials.password=none
dl.hook.impl=com.liferay.documentlibrary.util.JCRHook
### jackrabbit entry Ends

2>repository.xml
<?xml version="1.0"?>

<Repository>  
<!--
Database File System (Cluster Configuration)

This is sample configuration for mysql persistence that can be used for
clustering Jackrabbit. For other databases, change the connection,
credentials, and schema settings.
-->

<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://localhost:3306/jcr" />
<param name="user" value="liferay" />
<param name="password" value="" />
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="J_R_FS_"/>
</FileSystem>

<Security appName="Jackrabbit">
<AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager" />
<LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
<param name="anonymousId" value="anonymous" />
</LoginModule>
</Security>
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="liferay" />
<Workspace name="${wsp.name}">
<!--
Database File System and Persistence (Cluster Configuration)

This is sample configuration for mysql persistence that can be used for
clustering Jackrabbit. For other databases, change the  connection,
credentials, and schema settings.
-->

<PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
<param name="driver" value="com.mysql.jdbc.Driver" />
<param name="url" value="jdbc:mysql://localhost:3306/jcr" />
<param name="user" value="liferay" />
<param name="password" value="" />
<param name="schema" value="mysql" />
<param name="schemaObjectPrefix" value="J_PM_${wsp.name}_" />
<param name="externalBLOBs" value="false" />
</PersistenceManager>
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://localhost:3306/jcr" />
<param name="user" value="liferay" />
<param name="password" value="" />
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="J_FS_${wsp.name}_"/>
</FileSystem>
</Workspace>
<Versioning rootPath="${rep.home}/version">
           
<!--
Database File System and Persistence (Cluster Configuration)

This is sample configuration for mysql persistence that can be used for
clustering Jackrabbit. For other databases, change the connection,
credentials, and schema settings.
-->

<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://localhost:3306/jcr" />
<param name="user" value="liferay" />
<param name="password" value="" />
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="J_V_FS_"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
<param name="driver" value="com.mysql.jdbc.Driver" />
<param name="url" value="jdbc:mysql://localhost:3306/jcr" />
<param name="user" value="liferay" />
<param name="password" value="" />
<param name="schema" value="mysql" />
<param name="schemaObjectPrefix" value="J_V_PM_" />
<param name="externalBLOBs" value="false" />
</PersistenceManager>
</Versioning>

<!--
Cluster Configuration

This is sample configuration for mysql persistence that can be used for
clustering Jackrabbit. For other databases, change the  connection,
credentials, and schema settings.
-->

    <Cluster id="worker1" syncDelay="5">
<Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
<param name="revision" value="${rep.home}/revision"/>
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://localhost:3306/jcr"/>
<param name="user" value="liferay"/>
<param name="password" value=""/>
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="J_C_"/>
</Journal>
    </Cluster>
</Repository>
3> Restart Liferay, for MySQL the table lportal should automatically be created.

Liferay - JCR vs *FileSystemHook


a) FileSystemHook[Locking]: 
Liferay admin guide states that Liferay now defaults to using the FileSystemHook as the default due to performance reasons.
Secondly its states that you can use this safely in a clustered environment because the code will prevent collisions via locking and it uses versioning as well.

Fact: Liferay does not implement any file level locking, so only use the File System Hook or the Advanced File System Hook in a clustered environment if you’re using a SAN that supports file locking (most modern ones do but check your SAN documentation to be sure).

b) Jackrabbit:
You can use Jackrabbit as the storage mechanism instead. However if you use JCR(jackrabbit) in a clustered environment, it does not recommend using the JCR/jackrabbit file system storage mechanism (possible data corruption), but rather store it in a DB.


Que: In a clustered setup, what do most people use? JCR to the database? Or the non-JCR to the filesystem? If your shared setup is over NFS or SAN, Won't 2 threads writing to same file still toss IOException causing one to fail, with no corruption?

Ans: To some degree, it will depend on how you'll be using Liferay. If document storage and retrieval will be a large part of the portal, then you may notice performance issues with JCR to the database and should instead look at Advanced File System Hook with a SAN that supports file locking.


Things to Note:[Jackrabbit with DB]


1> Make sure that the user/password has the correct permissions on the DB (in this case lportal)

2> If you wish to use a separate DB than the one Liferay portal uses, just create it, give user correct permissions and change the url in repository.xml file.

3> Note that there is an LEP on having to rename jackrabbit dir to jackrabbit.bak, then restart, and a new jackrabbit dir will be created - have to then modify that repository.xml file.

4> When pointing Jackrabbit to the database, Liferay will create a file called workspaces.xml, in /home/workspaces/liferay/workspaces.xml. This will contain a portion of the repository.xml file. If you make changes to repository.xml, make sure you also make the changes to this workspaces.xml file.

5> A specific 'Bundle Database PM' like 'org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager' should be faster.

6> If you want to use the same database that liferay is already using, set the driver to "javax.naming.InitialContext" and the url to "java:comp/env/jdbc/LiferayPool"

June 05, 2012

Grails - Getting Request,Response in Grails Service class


import org.codehaus.groovy.grails.web.util.WebUtils

…….

def webUtils = WebUtils.retrieveGrailsWebRequest()

//Getting the Request object

webUtils.getCurrentRequest()

//Getting the Response object

webUtils.getCurrentResponse()

//Getting the ServletContext object

webUtils.getServletContext()

Srping - Best Practice architecture in spring

Spring - SpringMVC3 & DWR Integration

Liferay - How to set up multiple portal instance?

Liferay + How to implement captcha in liferay-portlet?

Web Scrapping + Regular expression example: scraping HTML data

FaceBook- How to write facebook application?

Liferay - How to make email / screenname non editable for other users?



In portal-ext.properties file add following entries.


# Valid types are "administrator", "user-with-mx", and "user-without-mx".
#
# Set a value of "administrator" if an administrator can edit the specified
# field. An administrator is anyone who has the Administrator role.
#
# Set a value of "user-with-mx" if a user who has an email address that
# matches the company mail suffix can edit the specified field.
#
# Set a value of "user-without-mx" if a user who does not have an email
# address that matches the company mail suffix can edit the specified field.
#
# Set all three values if all users can edit the specified field. Set a
# combination of the three values if only a combination of the users can
# edit the specified field.
#

field.editable.com.liferay.portal.model.User.screenName=administrator
field.editable.com.liferay.portal.model.User.emailAddress=administrator

Liferay - How to increase liferay performance?



In portal-ext.properties file add following entries.


# Turn off Liferay features not used
com.liferay.portal.servlet.filters.gzip.GZipFilter=false
com.liferay.portal.servlet.filters.strip.StripFilter=false
com.liferay.portal.servlet.filters.sso.cas.CASFilter=false
com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter=false
com.liferay.portal.servlet.filters.sso.opensso.OpenSSOFilter=false
com.liferay.portal.sharepoint.SharepointFilter=false
com.liferay.portal.servlet.filters.validhtml.ValidHtmlFilter=false
session.tracker.memory.enabled=false
counter.increment=2000
portlet.css.enabled=false

#
# Set the following to true to check last modified date on server side CSS
# and JavaScript.
#
last.modified.check=false

#
# Set this property to true to load the theme's merged CSS files for faster
# loading for production. Set this property to false for easier debugging
# for development. You can also disable fast loading by setting the URL
# parameter "css_fast_load" to "0".
#
theme.css.fast.load=true

#
# Set this property to true to load the combined JavaScript files from the
# property "javascript.files" into one compacted file for faster loading for
# production. Set this property to false for easier debugging for
# development. You can also disable fast loading by setting the URL
# parameter "js_fast_load" to "0".
#
javascript.fast.load=true

Liferay - How to trun on unwanted features of liferay to increase performance?



In portal-ext.properties file add following entries.


# Turn off Liferay features not used
com.liferay.portal.servlet.filters.gzip.GZipFilter=false
com.liferay.portal.servlet.filters.strip.StripFilter=false
com.liferay.portal.servlet.filters.sso.cas.CASFilter=false
com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter=false
com.liferay.portal.servlet.filters.sso.opensso.OpenSSOFilter=false
com.liferay.portal.sharepoint.SharepointFilter=false
com.liferay.portal.servlet.filters.validhtml.ValidHtmlFilter=false
session.tracker.memory.enabled=false

counter.increment=2000
portlet.css.enabled=false

Liferay - How to add Organization link in user add page?


In portal-ext.properties file add following entries.



## Add  organizations link on user add page
users.form.add.main=details,organizations,pages

Liferay - How to remove custom fields link from user edit page?



In portal-ext.properties file add following entries.

## Remove custom fields link from user edit page

users.form.update.miscellaneous=announcements,display-settings,comments
users.form.my.account.miscellaneous=announcements,display-settings,comments

Liferay- How to remove 'terms of use' on first login?


In portal-ext.properties file add following entries.

# Remove terms of use on first login
terms.of.use.required=false

Liferay - How to remove Password reminder question on first login?



In portal-ext.properties file add following entries.


# To remove Password reminder question on first login
users.reminder.queries.enabled=false
users.reminder.queries.custom.question.enabled=false

Liferay - Load Balancer and https settings



In portal-ext.properties file add following entries.


# Settings for load balancer and https
web.server.protocol=https
web.server.https.port=443
web.server.host=domainame.com

Liferay - How to map liferay custom fileds with LDAP?


In portal-ext.properties file add following entries.

## Custom Field Mapping
### \n is separator
ldap.user.custom.mappings=customfield1=ldapfield1\ncustomfield2=ldapfield2\n customfield3=ldapfield3

Liferay - LDAP Server configuration using protal-ext.properties

In portal-ext.properties file add following entries.

### LDAP Server 1 Settings
ldap.server.name.1=Main
ldap.base.provider.url.1=ldap://domainname.com:389
ldap.base.dn.1=cn=ldap,dc=dcname,dc=msft
ldap.security.principal.1=cn=bind,dc=dcname,dc=msft
ldap.security.credentials.1=bindpass
ldap.auth.search.filter.1=(mail=@email_address@)
ldap.user.default.object.classes.1=top,person,organizationalPerson,user
ldap.group.default.object.classes.1=top,group

ldap.user.mappings.1=screenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=memberOf
ldap.group.mappings.1=groupName=cn\ndescription=description\nuser=member

ldap.import.user.search.filter.1=(objectClass=user)
ldap.import.group.search.filter.1=(objectClass=groupOfUniqueNames)
ldap.users.dn.1=ou=users,dc=example,dc=com
ldap.groups.dn.1=ou=groups,dc=example,dc=com

## Custom Field Mapping
ldap.user.custom.mappings=customfield1=ldapfield1\ncustomfield2=ldapfield2\n customfield3=ldapfield3

Liferay - Common LDAP Configuration attributes for portal-ext.properties

In portal-ext.properties file add following entries.


### Common LDAP Properties

ldap.auth.enabled=true
#LDAP Auth Req on Login.
ldap.auth.required=true
#Enable automatic LDAP Export
ldap.export.enabled=true
#Enable automatic LDAP import
ldap.import.enabled=true
ldap.import.on.startup=true
ldap.import.interval=10
ldap.import.method=user
ldap.server.ids=1

Liferay - Common Lucene configuration in clustered env


In portal-ext.properties file add following entries.

# lucene
lucene.replicate.write=true
lucene.on.startup=true
#lucene.commit.batch.size=10

#lucene.commit.time.interval=3000

# Uncomment these below
#lucene.merge.factor=10
#lucene.optimize.interval=100
#lucene.buffer.size=32

Liferay - Jackrabbit configuration using portal-ext.properties


In portal-ext.properties file add following entries.

#### jackrabbit ######
jcr.initialize.on.startup=true
jcr.jackrabbit.repository.root=/opt/jboss/data/jackrabbit
jcr.jackrabbit.config.file.path=${jcr.jackrabbit.repository.root}/repository.xml
jcr.jackrabbit.repository.home=${jcr.jackrabbit.repository.root}/home
jcr.jackrabbit.credentials.username=none
jcr.jackrabbit.credentials.password=none
dl.hook.impl=com.liferay.documentlibrary.util.JCRHook

Liferay - How to enable ecache in Liferay clustering env.


In portal-ext.properties file add following entries.

#########################
net.sf.ehcache.configurationResourceName=/ehcache/hibernate-clustered.xml
ehcache.multi.vm.config.location=/ehcache/liferay-multi-vm-clustered.xml
cluster.link.enabled=true
ehcache.multi.vm.config.location.peerProviderProperties=peerDiscovery=automatic,multicastGroupAddress=230.0.0.2,multicastGroupPort=4446,timeToLive=1
cluster.link.autodetect.address=189.00.00.00:80
#########################

Liferay-How to enable reminder query in liferay?

In portal-ext.properties file add following entries.

#######
users.reminder.queries.enabled=false
users.reminder.queries.custom.question.enabled=true
#######

Liferay-How to set session timeout?


In portal-ext.properties files add below entries.

#Session timeout Value
session.timeout=480
session.timeout.warning=1
session.timeout.auto.extend=true

Liferay-Mail server configuration:


1>Create portal-ext.properties at /webapps/Root/classes/src
2>Add below parameters
mail.session.mail.pop3.host=localhost
mail.session.mail.pop3.password=
mail.session.mail.pop3.port=110
mail.session.mail.pop3.user=
mail.session.mail.smtp.auth=false
#mail.session.mail.smtp.host=smtp-relay. oxybits .com
mail.session.mail.smtp.host=obmysmtp.oxybits.com
mail.session.mail.smtp.password=
mail.session.mail.smtp.port=25
#mail.session.mail.smtp.user=admin
mail.session.mail.smtp.user=
mail.session.mail.store.protocol=pop3
mail.session.mail.transport.protocol=smtp
3>Restart the server.

Welcome to Open Source Portal

Dear Viewers,

Very warm welcome in to the world of leading OpenSource Technologies. we are here to deliver valuable solution for all you questions related to OpenSource Technologies.

Keep Posting Your Concerns.

Thanks Very Much For Visiting This Blog.