Tuesday, September 27, 2011
Grails
Now will tell some steps
1. By default in the controller index method will be called
2. In the views folder name of the controller (login) folder will be created if you create loginController
3. In the controller we can instantiate Java classes and call them
4. In the contoller we will have the enclosures.
if you have the enclosure by name search inside LoginController
then it will look for
views --> login-->search.gsp
def search= {
render "abccc.gsp";
}
5. to define variables use def, semicolons are not mandatory
6. USes Gstrings similar to Velocity.
Sample
package com.hersheys.groovy.quickr
import com.hersheys.quickr.migration.TestClass
class LoginController {
/* def index = {
//can be double or string
def i = 4;
System.out.print("Inside the LoginController");
if(i < 0.5){
render "Hellvsgvdso World";
}else{
// brackets are not mandtory
render ("asfasgfasg");
}
//grroovy typeless, no return type , No semicolons , Gstring we have extrac com pared to Java
// Now calling Java
TestClass testClass = new TestClass();
def name = testClass.getNickName("john");
render name;
}
*/
def index = {
//We can configure the gsp to be used as below
//render "abccc.gsp";
// if you leave this method emptry then the index.gsp will be take n from the login folder of views
}
// url --- We can access closure similar to Dispatch Action
//http://localhost:8080/QuickrAlfresco/login/index
//login -- Controller
//index-- closure
def update = {
//render "updatehit"
System.out.print("Inside the update Closure. If we dont return anything then it will look for update.gsp inside song folder in views");
}
def search ={
def x = params.item;
//render x;
request.message = x;
}
}
We can explictly specify the name of the file where to go also
Sunday, September 25, 2011
Getting all the users present in Liferay
Saturday, September 24, 2011
Policy and Behaviour
EX:
public class UsageQuotaProtector implements NodeServicePolicies.OnUpdatePropertiesPolicy
public void init()
{
if (contentUsageService.getEnabled())
{
// Register interest in the onUpdateProperties policy
policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"),
ContentModel.TYPE_PERSON,
new JavaBehaviour(this, "onUpdateProperties"));
}
}
Similarly we can have
public class RepositoryAuthenticationDao implements MutableAuthenticationDao, InitializingBean, OnUpdatePropertiesPolicy, BeforeDeleteNodePolicy
*/
public void afterPropertiesSet() throws Exception
{
this.policyComponent.bindClassBehaviour(
OnUpdatePropertiesPolicy.QNAME,
ContentModel.TYPE_PERSON,
new JavaBehaviour(this, "onUpdateProperties"));
Friday, September 23, 2011
Alfresco Liferay doclib
In this site you have the demo for alfreso and liferay doclib integration
Commands to copy file
cp /home/hbasa/share-config-custom.xml /opt/liferay-portal-6.0-ee/tomcat-6.0.29/shared/classes/alfresco/web-extension/
file operations
vim filename
to open the file
press i to write the content
once you are done with file operation do this to save and quit
esc:q! --- To Quit the file
escape+:+w+q
To write and quit the file
Wednesday, September 21, 2011
We can generate the classes from the below command
http://axis.apache.org/axis2/java/core/docs/jaxws-guide.html
We can generate the classes from the below command
wsimport -keep -verbose wsdl_URL
This is how we generate files
wsimport -p com.patil.jax -keep file.wsdl
Sunday, September 18, 2011
Alfresco Doc lib portlets working
23:52:27,703 INFO [site.servlet.SSOAuthenticationFilter] NTLMAuthenticationFil
ter initialised.
So this is the one which makes sso possible.
In the web.xml of share we have the following filter
So this filter is looking for endpoint alfresco present in share-config-custom.xml
Here to make the external users to allow , we have external-auth true.
Now /wcs is mapped to following filter in alfresco's web.xml
which points to the class
And here again WebscriptAuthenticationFilter
maps to
Wednesday, September 14, 2011
CKEditor
This call will get converted as below
From the File Browser following url will be called
http://localhost:9090/c/portal/fckeditor?p_l_id=10141&p_p_id=15&doAsUserId=Yhlw4Jlrv4M%3d&doAsGroupId=18&Command=GetFoldersAndFiles&
Type=Image&CurrentFolder=%2F&uuid=1316050672680
In the structs-config.xml we have the maping for
Here the ConnectorAction based on the parameters is going to call the corresponding
command method
ex: GetFoldersAndFilesCommand
This is going to return the xml
and the returned xml will be parsed.
Tuesday, September 13, 2011
Place to change the FCKEditor
E:\Dumps\Liferay\liferay-portal-src-6.0.5\liferay-portal-src-6.0.5\portal-web\docroot\html\js\editor\fckeditor_diffs
from the above mentioned location.
SingleSigon For Share
1. alfresco-global.properties
ntlm.authentication.sso.enabled=true
authentication.chain=alfrescoNtlm1:alfrescoNtlm,external1:external
2. share-config.custom.xml
Here we should enable connector with the name alfrescoCookie and with the endpoint
alfresco as below
setting up the memory(Perm Gen)
set JAVA_OPTS=-Xms512m -Xmx1024m -Xss1024k -XX:MaxPermSize=256m
By setting the above parameter we can start the server from startup.bat file.
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat 908749 2010-02-10 23:26:42Z markt $
rem ---------------------------------------------------------------------------
rem Guess CATALINA_HOME if not defined
set JAVA_OPTS=-Xms512m -Xmx1024m -Xss1024k -XX:MaxPermSize=256m -XX:NewSize=256m
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"
rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find "%EXECUTABLE%"
echo This file is needed to run this program
goto end
:okExec
rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
:end
Liferay CMIS hook to connect to Alfresco
Install Liferay and make it up. liferay-portal-tomcat-6.0-ee-sp1
In the portal-ext.properties put following properties and restart server
dl.hook.impl=com.liferay.documentlibrary.util.CMISHook
cmis.credentials.username=admin
cmis.credentials.password=admin
cmis.repository.url=http://localhost:8080/alfresco/service/api/cmis
cmis.repository.version=1.0
cmis.system.root.dir=Liferay Home
Restart Liferay and create content in the Document Library, the created content should go and sit in Alfresco.
But here the disadvantage is , it is storing the files in binary in Alfresco.
Hope that in the future releases we will have the actual content inside Alfresco
You can find more info in the blog
https://www.liferay.com/web/jonas.yuan/blog/-/blogs/integrating-alfresco-through-cmis-in-liferay
Monday, September 5, 2011
Content Storage and Lifecycle
In Alfresco, the content binaries are stored separately from the metadata, which is always found in the database. The primary metadata that acts as a reference to the binaries takes the form contentUrl=store://.........|mimetype=...(etc). The abstraction that takes care of mapping the store://... part of the reference to a physical location is the ContentStore interface.
Content Binaries and Transactions
Because binaries are not modified, it means that writes to the filesystem do not become visible until the metadata has been committed to the database. In the event of transaction failure or rollback, the metadata will be left in the pre-transaction state i.e. referencing the older binary; the newer content binary will be left in an orphaned state for later cleanup.
Deleting Files
When a file node (or anything containing a reference to raw content) is permanently deleted, there is just one less reference to the raw content. When there are no more references to some raw content, it is called orphaned. Were nothing further done, the content stores would just irreversibly fill up with content.
Cleaning up Orphaned Content (Purge)
Once all references to a content binary have been removed from the metadata, the content is said to be orphaned. Orphaned content can be deleted or purged from the content store while the system is running. Identifying and either sequestering or deleting the orphaned content is the job of the contentStoreCleaner.
In the default configuration, the contentStoreCleanerTrigger fires the contentStoreCleaner bean.
... 14
- protectDays
Use this property to dictate the minimum time that content binaries should be kept in the contentStore. In the above example, if a file is created and immediately deleted, it will not be cleaned from the contentStore for at least 14 days. The value should be adjusted to account for backup strategies, average content size and available disk space. Setting this value to zero will result in a system warning as it breaks the transaction model and it is possible to lose content if the orphaned content cleaner runs whilst content is being loaded into the system. If the system backup strategy is just to make regular copies, then this value should also be greater than the number of days between successive backup runs.
- store
This is a list of ContentStore beans to scour for orphaned content.
- listeners
When orphaned content is located, these listeners are notified. In this example, the deletedContentBackupListener copies the orphaned content to a separate deletedContentStore.
Note that this configuration will not actually remove the files from the file system but rather moves them to the designated deletedContentStore, usually contentstore.deleted. The files can be removed from the deletedContentStore via script or cron job once an appropriate backup has been performed.
Code for Purging the content
/images/icons/delete.gif
#{actionContext.id}
Sunday, September 4, 2011
Exposing objects in Alfresco share
This is done by extending ScriptBase object
org.springframework.extensions.webscripts.ScriptUser ---> exposes user object
Create a Meeting Workspace
Create a Meeting Workspace
- Open Outlook and create a meeting request in the Calendar view with the following details:
- To
- usera@alfrescodemo.org; userb@alfrescodemo.org
- Subject
- Project Planning
- Location
- Conference Room
- Start time
- any date in the future, 10:00
- End time
- same day as start date, 12:00
- Message
- Please use the link provided to review the agenda and associated material for this meeting.
- Click Meeting Workspace on the Meeting tab.The Meeting Workspace task pane opens on the right side of the dialog box.
- Click Change settings and configure the workspace as follows:
- Specify http://localhost:7070/alfresco as the workspace location.
- Select Create a new workspace.
- Select Alfresco Meeting Workspace as the template type.If prompted, log in as the administrator (admin, admin).
Click Create.
Outlook creates the Meeting Workspace (Share site), adds to this the meeting being scheduled, and inserts a link into the body of the meeting request. This link provides attendees with easy access to the workspace.If prompted, log in as the administrator (admin, admin).
- Click Go to workspace at the top of the task pane to access the Meeting Workspace. Again, log in as the administrator.Use this link to create an agenda and upload meeting materials to the site before sending the meeting request. These tasks are not required as part of the tutorial.The new Meeting Workspace opens with the calendar component displayed. The meeting request Subject line becomes both the meeting title and the workspace name (non-alphanumeric characters, including spaces, are converted to underscores for the workspace name). When you create a Meeting Workspace from Outlook, the site includes only the Document Library and Calendar components. To include additional page components—Wiki, Blog, Links, Discussions, or Data Lists—refer to the Share user help.
- Log out of Share and close the browser.
- In the meeting request in Outlook, click Send.Outlook sends the meeting request. In Share, the meeting attendees are added to the Meeting Workspace as site members. By default, they are given the role Collaborator.
Create a Meeting Workspace
- Open Outlook and create a meeting request in the Calendar view with the following details:
- To
- usera@alfrescodemo.org; userb@alfrescodemo.org
- Subject
- Project Planning
- Location
- Conference Room
- Start time
- any date in the future, 10:00
- End time
- same day as start date, 12:00
- Message
- Please use the link provided to review the agenda and associated material for this meeting.
- Click Meeting Workspace on the Meeting tab.The Meeting Workspace task pane opens on the right side of the dialog box.
- Click Change settings and configure the workspace as follows:
- Specify http://localhost:7070/alfresco as the workspace location.
- Select Create a new workspace.
- Select Alfresco Meeting Workspace as the template type.If prompted, log in as the administrator (admin, admin).
Click Create.
Outlook creates the Meeting Workspace (Share site), adds to this the meeting being scheduled, and inserts a link into the body of the meeting request. This link provides attendees with easy access to the workspace.If prompted, log in as the administrator (admin, admin).
- Click Go to workspace at the top of the task pane to access the Meeting Workspace. Again, log in as the administrator.Use this link to create an agenda and upload meeting materials to the site before sending the meeting request. These tasks are not required as part of the tutorial.The new Meeting Workspace opens with the calendar component displayed. The meeting request Subject line becomes both the meeting title and the workspace name (non-alphanumeric characters, including spaces, are converted to underscores for the workspace name). When you create a Meeting Workspace from Outlook, the site includes only the Document Library and Calendar components. To include additional page components—Wiki, Blog, Links, Discussions, or Data Lists—refer to the Share user help.
- Log out of Share and close the browser.
- In the meeting request in Outlook, click Send.Outlook sends the meeting request. In Share, the meeting attendees are added to the Meeting Workspace as site members. By default, they are given the role Collaborator.
Command to change tomcat server settings in tomcat
C:\Alfresco3.4.3\tomcat\bin>tomcat6w.exe //ES//alfrescoTomcatnum2
Here alfrescoTomcatnum2 is the name of the service. You can change this name based in your service name.
Now set the required memory settings in the Java tab
Initail Memory pool 256 MB
Maximum memory pool 512mb
Thread stack size 64
If memory is not set then alfresco service may not start
DB Creation scripts for Alfresco with mysql
create database alfresco default character set utf8 collate utf8_bin;
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;
Database deletion scripts for mysql
create database alfresco default character set utf8 collate utf8_bin;
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;
Configuring Alfresco to this database is done by below lines
### database connection properties ###
db.driver=org.gjt.mm.mysql.Driver
db.username=alfresco
db.password=alfresco
db.name=alfresco
db.url=jdbc:mysql://localhost:3306/alfresco
How documentlibrary folder gets created when we create site in Alfresco
The pages will be defined here
The corresponding page definition will be available in the folder.
C:\Alfresco3.4.1\tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\pages
For the documentlibrary we will hava the below page definition.
If you see the page It has Template-instance, so it will look for template-instance. The template-instance are located at C:\Alfresco3.4.1\tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\template-instances\documentlibrary.xml
The template-instance is made up of the components. Components will have the region-id as below.
Here multiple calls will happen.
Call to the template file and the corresponding javascript file.
Call to the region ids
C:\Alfresco3.4.1\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\title
These calls will be continued for each region. By calling seperate webscripts based on the urls.
If you see the
It will call the scripts located in the below location
C:\Alfresco3.4.1\tomcat\webapps\share\WEB-INF\classes\alfresco\templates\org\alfresco\ documentlibrary.js and the corresponding template. The ftl is going to have the definition of the page.
It will connect to alfresco and creats the folder
result = connector.get("/slingshot/doclib/container/" + siteId + "/" + containerId + "?type=" + toRepoType(contentType));