Powered By Blogger

Friday, December 30, 2011

Logging webscripts in alfresco

Logging API

A root level object 'logger' is provided that provides functions to aid debugging of scripts.

boolean isLoggingEnabled()
Return true if console logging is enabled. To enable console logging the Log4J category of log4j.logger.org.alfresco.repo.jscript should be set to DEBUG. This can be applied in the log4j.properties file (Tomcat) or log4j.xml file (JBoss) on the Alfresco server.
void log(string)
Log a string message to the console.



  1. vi /tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties
  2. log4j.logger.org.alfresco.repo.jscript=debug

Monday, December 26, 2011

Tuesday, December 13, 2011

SSO Authentication filter, passing our custom header

/**
*
*/
package com.patil.web.site.servlet;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;


import org.alfresco.web.site.servlet.SSOAuthenticationFilter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.site.AuthenticationUtil;


/**
* @author basanagowda.patil
*
*/
public class Patil extends SSOAuthenticationFilter {

private static Log LOGGER = LogFactory.getLog(Patil.class);

@Override
public void doFilter(ServletRequest sreq, ServletResponse sresp,
FilterChain chain) throws IOException, ServletException {

// Get the HTTP request/response/session
HttpServletRequest req = (HttpServletRequest) sreq;
String ctuser = req.getHeader("CTUSER");
String alfrescoSystemuser = req.getHeader("X-Alfresco-Remote-User");
if(LOGGER.isDebugEnabled()){
LOGGER.debug("Getting users CTUSER " + ctuser
+ " X-Alfresco-Remote-User " + alfrescoSystemuser);

}
String user = (ctuser == null || "".equals(ctuser)) ? alfrescoSystemuser : ctuser;
if (user != null) {
AuthenticationUtil.login(req, user);
}

super.doFilter(sreq, sresp, chain);
}

}



In the web.xml you should have the entry for the custom filter




Alfresco Project Slingshot
Alfresco Project Slingshot application


org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL
true




Spring config file location
contextConfigLocation
/WEB-INF/classes/web-application-config.xml



Set HTTP cache Expires header 30 days forward for a mapping.
CacheExpiresFilter
org.alfresco.web.scripts.servlet.StaticAssetCacheFilter

Add an Expires Header 30 days forward
expires
30




MT authentication support - NOTE: does not support portlets
MTAuthentationFilter
org.alfresco.web.site.servlet.MTAuthenticationFilter



Redirects view and service URLs to the dispatcher servlet.
UrlRewriteFilter
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter



Share SSO authentication support filter.
Authentication Filter
com.patil.web.site.servlet.Patil

endpoint
alfresco




CacheExpiresFilter
*.jpg


CacheExpiresFilter
*.png


CacheExpiresFilter
*.gif


CacheExpiresFilter
*.css


CacheExpiresFilter
*.js



Authentication Filter
/page/*



Authentication Filter
/p/*



Authentication Filter
/proxy/*



UrlRewriteFilter
/proxy/*



Authentication Filter
/service/*




UrlRewriteFilter
/service/*



UrlRewriteFilter
/feedservice/*



UrlRewriteFilter
/res/*



UrlRewriteFilter
/system/*



MTAuthentationFilter
/page/*


MTAuthentationFilter
/p/*




org.springframework.web.context.ContextLoaderListener



Spring Surf Dispatcher Servlet
org.springframework.web.servlet.DispatcherServlet

contextAttribute
org.springframework.web.context.WebApplicationContext.ROOT

1



Spring Surf Dispatcher Servlet
/page/*


Spring Surf Dispatcher Servlet
/p/*



60




index.jsp



500
/error500.jsp


Sunday, December 11, 2011

SCAN tool

1. SCAN can browse files from network file system
2. SCAN will store the indexes in the location
C:\Documents and Settings\basanagowda.patil\.scan\repository
You can get this location from

To remove the SCAN data, delete the directory where it is located. You can find the actual path of this directory
in the Repository path field of SCAN configuration dialog (Tools→Configure...).

Thursday, November 17, 2011

Wednesday, November 9, 2011

JMX Dump

We can get jmx dump using below url

http://localhost:8080/alfresco/faces/jsp/admin/jmx-dumper.jsp

Tuesday, November 8, 2011

Conditionally hiding header in Alfresco share

We can conditionally show or hide the headers in Share.
Share accepts the ftl expression and based on that it decides whether to show or hide the link.




{userdashboardpage}
{myhomeHersheys}
Alfresco.module.Sites
/people-finder
condition="user.properties['email']?ends_with('@patil.com')" >/repository



SSO to share

All the people feel that alfresco share is not easy.

Follow the below steps

1. From your web server set the REMOTE_USER
Make sure you are getting remoteuser by getting that value in the jsp

2, In the tomcat disable the tomcat authentication so that you will get
req.getRemoteUser()

tomcatauthentication="false">

3. No need to change the X-Alfresco-RemoteUSer
as it will check for remoteuser i it does not exist then only it will check for the X-Alfresco-Remote User

Monday, November 7, 2011

Setting REMOTE_USER

One way to do this is to put an apache front-end with a ajp1.3 connector with basic auth, i.e.:

a) create a /usr/local/apache2/conf/workers.properties file with:

-------------------------
worker.list=alexwk,jkstatus
worker.alexwk.host=127.0.0.1
worker.alexwk.port=8009
worker.alexwk.type=ajp13
worker.alexwk.lbfactor=100
-------------------------

b) in apache httpd.conf:

-------------------------
JkworkersFile "/usr/local/apache2/conf/workers.properties"

ServerName alfjk2.foo
JkLogFile "/usr/local/apache2/logs/mod_jk_2.log"
JkMount /alfresco alexwk
JkMount /alfresco/* alexwk
JkMount /share alexwk
JkMount /share/* alexwk
JkLogLevel info

AuthType Basic
AuthName "Test Basic Auth"
AuthUserFile /usr/local/apache2/passtest.txt
Require valid-user


-------------------------



4) In tomcat server.xml, define an ajp13 connector turning off tomcat authentication:



5) generate a password file with admin/admin:
/usr/local/apache2/bin/htpasswd -c /usr/local/apache2/passtest.txt admin

6) check the cgi variable setup putting in a new file
'tomcat/webapps/alfresco/test.jsp':

-------------------------
getRemoteUser() is set to:
<% out.print (request.getRemoteUser()); %>
-------------------------
and go to:

http://alfjk2.foo/alfresco/test.jsp

You should see the name of the HTTP user.


This is been taken from
https://issues.alfresco.com/jira/browse/ALF-4230

Thursday, November 3, 2011

Updataing the jar file with the existing class


update="true" duplicate="preserve" >





Here we need to put duplicate="preserve" so that only one file will be considered.

Friday, October 28, 2011

Liferay and Alfresco Doclib integration

Alfresco uses org.springframework.extensions.webscripts.connector.HttpConnector to talk with
Alfresco. This has the hardcoded value
headers.put("X-Alfresco-Remote-User", user);

Since it is hardcoded,if we change the value of th eheader then the authentication will not be respected.

So change the code to fir the your custom external key CTUSER defined in your external file.






alfresco-noauth
Alfresco - unauthenticated access
Access to Alfresco Repository WebScripts that do not require authentication
alfresco
http://localhost:8080/alfresco/s
none



alfresco-feed
Alfresco Feed
Alfresco Feed - supports basic HTTP authentication
http
http://localhost:8080/alfresco/s
true
user



alfrescoCookie
Alfresco Connector
Connects to an Alfresco instance using cookie-based authentication
org.springframework.extensions.webscripts.connector.AlfrescoConnector



alfresco
Alfresco - user access
Access to Alfresco Repository WebScripts that require user authentication
alfrescoCookie
http://localhost:8080/alfresco/wcs
user
true





Thursday, October 27, 2011

Finding the pid of the server running in alfresco

halfwd01:#cd /opt/alfresco/
halfwd01:#find . -name '*.pid'
./tomcat/temp/catalina.pid
halfwd01:#cat ./tomcat/temp/catalina.pid
16789
halfd01:#ps -elf|grep java
0 S patil 14735 14413 0 77 0 - 15296 - 12:24 pts/3 00:00:00 grep java
0 S alfresco 16789 1 5 84 0 - 522368 futex_ Oct26 ? 01:15:21 /opt/alfresco/java/bin/java -Djava.util.logging.config.file=/opt/alfresco/tomcat/conf/logging.properties -Xms512m -Xmx1024m -Xss1024k -XX:MaxPermSize=256m -XX:NewSize=256m -XX:+UseConcMarkSweepGC -Dalfresco.home=/opt/alfresco -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/alfresco/tomcat/endorsed -classpath /opt/alfresco/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/alfresco/tomcat -Dcatalina.home=/opt/alfresco/tomcat -Djava.io.tmpdir=/opt/alfresco/tomcat/temp org.apache.catalina.startup.Bootstrap start
halfd01:#

Thursday, October 20, 2011

ldap sync in Alfresco





org.alfresco.repo.security.sync.UserRegistrySynchronizerJob







${synchronization.synchronizeChangesOnly}






${synchronization.import.cron}








From here it calls




ChainingUserRegistrySynchronizer.java has a method by name


syncWithPlugin

private void syncWithPlugin(final String zone, UserRegistry userRegistry, boolean forceUpdate,
boolean allowDeletions, boolean splitTxns, final Set visitedZoneIds, final Set allZoneIds)



It has

final BatchProcessor personProcessor = new BatchProcessor(zone
+ " User Creation and Association", this.transactionService.getRetryingTransactionHelper(),
userRegistry.getPersons(lastModified), this.workerThreads, 10, this.applicationEventPublisher,

userRegistry.getPersons(lastModified)


It calls LDAPUSerRegistry

/*
* (non-Javadoc)
* @see org.alfresco.repo.security.sync.UserRegistry#getPersons(java.util.Date)
*/
public Collection getPersons(Date modifiedSince)
{
return new PersonCollection(modifiedSince);
}


which in turn calls PersonCollection. The PersonCollection has the constructor to initialize the query


PersonIterator has the next to get the users from the system

private NodeDescription fetchNext() throws NamingException
{
boolean readyForNextPage;
do
{
readyForNextPage = this.searchResults == null;
while (!readyForNextPage && this.searchResults.hasMore())
{
SearchResult result = this.searchResults.next();
Attributes attributes = result.getAttributes();
Attribute uidAttribute = attributes.get(LDAPUserRegistry.this.userIdAttributeName);
if (uidAttribute == null)
{
if (LDAPUserRegistry.this.errorOnMissingUID)
{
throw new AlfrescoRuntimeException(
"User returned by user search does not have mandatory user id attribute "
+ attributes);
}
else
{
LDAPUserRegistry.logger
.warn("User returned by user search does not have mandatory user id attribute "
+ attributes);
continue;
}
}
String uid = (String) uidAttribute.get(0);

if (this.uids.contains(uid))
{
LDAPUserRegistry.logger
.warn("Duplicate uid found - there will be more than one person object for this user - "
+ uid);
}

this.uids.add(uid);

if (LDAPUserRegistry.logger.isDebugEnabled())
{
LDAPUserRegistry.logger.debug("Adding user for " + uid);
}

// Apply the mapped properties to the node description
return mapToNode(LDAPUserRegistry.this.personAttributeMapping,
LDAPUserRegistry.this.personAttributeDefaults, result);
}

// Examine the paged results control response for an indication that another page is available
if (!readyForNextPage)
{
readyForNextPage = LDAPUserRegistry.this.ldapInitialContextFactory.hasNextPage(this.ctx,
LDAPUserRegistry.this.queryBatchSize);
}

// Fetch the next page if there is one
if (readyForNextPage)
{
this.searchResults = this.ctx.search(LDAPUserRegistry.this.userSearchBase,
PersonCollection.this.query, this.userSearchCtls);
}
}
while (readyForNextPage);
this.searchResults.close();
this.searchResults = null;
this.ctx.close();
this.ctx = null;
return null;
}


Monday, October 17, 2011

Open Office Trouble shooting

http://wiki.knowledgetree.org/Troubleshooting_OpenOffice.org_Service

testing the service

ps -aux | grep soffice

Tuesday, October 11, 2011

Cron jobs

30 1 * * * --- every day 1:30


http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html


http://www.abunchofutils.com/utils/developer/cron-expression-helper/
http://www.cronmaker.com/

0 0 23 1/1 * ? * --- Every day night 11'o clock

Thursday, October 6, 2011

WebServices for Alfresco

http://wiki.alfresco.com/wiki/IngresTutorial_Alfresco_Web_Service_API_for_Java

org.alfresco.webservice.test.ContentServiceSystemTest

It has more explainations on the content upload through stream

Wednesday, October 5, 2011

Converting InputStream to byte for ByteArrayPartSource

InputStream is = null;
int len;
int size = 1024;
byte[] buf = null;

if (is instanceof ByteArrayInputStream) {
size = is.available();
buf = new byte[size];
len = is.read(buf, 0, size);
}


new FilePart(filename, new ByteArrayPartSource("filename.txt", buf));

How to upload file to Alfresco share using java code

Here the siteid is :testFolders
location to upload is : "/aaa/bbbb

It will upload the file from the local disk to the alfresco site testfolders/documentlibrary/aaa/bbb

Here I have passed the ticket to authenticate with the system



/**
*
*/
package com;

import java.io.File;
import java.io.IOException;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;





/**
* @author basanagowda.patil
*
*/
public class FileUpload {

public static void uploadDocument(String authTicket, File fileobj, String filename, String filetype, String description, String destination)
{
try
{
String urlString = "http://localhost:8080/alfresco/service/api/upload?alf_ticket="+authTicket;
System.out.println("The upload url:::"+urlString);
HttpClient client = new HttpClient();
PostMethod mPost = new PostMethod(urlString);
//File f1 =fileobj;
Part[] parts = {
new FilePart("filedata",filename,fileobj,filetype,null),
new StringPart("filename", filename),
new StringPart("description", description),
// new StringPart("destination", destination)
new StringPart("description", description),
new StringPart("siteid", "testFolders"),
new StringPart("containerid", "documentLibrary"),
new StringPart("uploaddirectory", "/aaa/bbbb")


};
mPost.setRequestEntity(
new MultipartRequestEntity(parts, mPost.getParams())
);
int statusCode1 = client.executeMethod(mPost);
System.out.println("statusLine>>>" +statusCode1+"......"+ mPost.getStatusLine()+mPost.getResponseBodyAsString());
mPost.releaseConnection();

}
catch (Exception e)
{
System.out.println(e);
}
}
public static void main(String args[])throws IOException
{
// SimpleUpload aw=new SimpleUpload();
//String Ticket=aw.login();
//String ticket="TICKET_3e61ccfa8a11690b10e1a2fb0eeee2c5583b0043";

String alfrescoTiccketURL = "http://localhost:8080/alfresco"+"/service/api/login?u="+"admin"+"&pw="+"admin";




String ticketURLResponse = invokeWebScriptgetRequest(alfrescoTiccketURL);

//ticketURLResponse =
int startindex= ticketURLResponse.indexOf("")+8;
int endindex = ticketURLResponse.indexOf("
");

ticketURLResponse = ticketURLResponse.substring(startindex, endindex);



File f=new File("D:/Testupload/Alfresco_Enterprise_3_4_4_Administrator.pdf");

//FileInputStream is=new FileInputStream(f);
uploadDocument(ticketURLResponse, f,"Alfresco_Enterprise_3_4_4_Administrator.pdf","application/pdf","description",null);

//uploadDocument("TICKET_3ef085c4e24f4e2c53a3fa72b3111e55ee6f0543", f,"47.bmp","image file","application/jpg","workspace://SpacesStore/65a06f8c-0b35-4dae-9835-e38414a99bc1");
}



public static String invokeWebScriptgetRequest(String url){


// Create an instance of HttpClient.
HttpClient client = new HttpClient();

// Create a method instance.
GetMethod method = new GetMethod(url);
/* // Provide custom retry handler is necessary
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(3, false));*/
String response = null;
try {
// Execute the method.
int statusCode = client.executeMethod(method);

if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " + method.getStatusLine());
}

// Read the response body.
byte[] responseBody = method.getResponseBody();

// Deal with the response.
// Use caution: ensure correct character encoding and is not binary data
response = new String(responseBody);
System.out.println(response);

} catch (HttpException e) {
System.err.println("Fatal protocol violation: " + e.getMessage());
e.printStackTrace();
} catch (IOException e) {
System.err.println("Fatal transport error: " + e.getMessage());
e.printStackTrace();
} finally {
// Release the connection.
method.releaseConnection();
}
return response;

}



}

Tuesday, October 4, 2011

Grails Features

We can have the services declared in the services folder
These services can be used by Contoller by declaring the variable, automatically this service will be
autowired and we can easily access them.


Sending the message to MQ is simple simply put the send command and send the object string.
If you have map it can be converted to json string or xml.
There is a way to get back the object from json by typecasting. Once we are done we can place that message on the MQ.

While putting in the MQ we can use the payloader and pass that payloader object as string.

We can use the groovy variables interchangable with alfresco variables.

We can use any front end. To the front end we can pass the Model and View object. The model can be accessed in the front end.

In the front end we can use JSTL

http://grails.org/doc/latest/

http://grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html

<http://grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.7 Ajax>

JMS Plugin Documentation: http://gpc.github.com/grails-jms/docs/manual/index.html

Tuesday, September 27, 2011

Grails

Spring Source tools eclipse is used foe Grails Development.


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

Link to get the Remote object

https://forums.alfresco.com/en/viewtopic.php?t=17587

Sunday, September 25, 2011

Saturday, September 24, 2011

Policy and Behaviour

We can trigger same policy for 2 contents in 2 different classes

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

http://pypeline.net

In this site you have the demo for alfreso and liferay doclib integration

Commands to copy file

sudo su -liferay



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

When we start Liferay server after putting share war we see the below line info

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

Share SSO authentication support filter.
Authentication Filter
org.alfresco.web.site.servlet.SSOAuthenticationFilter

endpoint
alfresco



So this filter is looking for endpoint alfresco present in share-config-custom.xml


alfresco
Alfresco - user access
Access to Alfresco Repository WebScripts that require user authentication
alfrescoCookie
http://localhost:8080/alfresco/wcs
user
true


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


WebScript Authentication Filter
/wcs/*


which points to the class

WebScript Authentication Filter
Authentication filter mapped to web script URLs. Mainly for SSO support
org.alfresco.repo.web.filter.beans.BeanProxyFilter

beanName
WebscriptAuthenticationFilter




And here again WebscriptAuthenticationFilter
maps to



${ntlm.authentication.sso.enabled}



















Wednesday, September 14, 2011

CKEditor

http://localhost:9090/html/js/editor/ckeditor/editor/filemanager/browser/liferay/browser.html?Connector=%2fc%2fportal%2ffckeditor%3fp_l_id%3d10141%26p_p_id%3d15%26doAsUserId%3dYhlw4Jlrv4M%253d%26doAsGroupId%3d18&CKEditor=CKEditor1&CKEditorFuncNum=1&langCode=en

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

You can extend the FCKEditor using hook

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

Lets do single sign on step by step
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







false


false









production















false


-1









































http://localhost:8080/alfresco




false



application/msword
application/vnd.ms-excel
application/vnd.ms-powerpoint






true






alfresco://company/home



false


500








secret

ALFRESCO.ORG

HTTP/repository.server.com@ALFRESCO.ORG

ShareHTTP








alfresco/web-extension/alfresco-system.p12
pkcs12
alfresco-system



alfrescoCookie
Alfresco Connector
Connects to an Alfresco instance using cookie-based authentication
org.springframework.extensions.webscripts.connector.AlfrescoConnector



alfresco
Alfresco - user access
Access to Alfresco Repository WebScripts that require user authentication
alfrescoCookie
http://localhost:8080/alfresco/wcs
user
true










alfresco-noauth
Alfresco - unauthenticated access
Access to Alfresco Repository WebScripts that do not require authentication
alfresco
http://localhost:8080/alfresco/s
none





alfresco-feed
Alfresco Feed
Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet
http
http://localhost:8080/alfresco/s
true
user





setting up the memory(Perm Gen)

In the startup.bat file put the below lines(C:\Alfresco3.4.3\tomcat\bin)
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 and make Alfresco up and running with the version Alfresco 3.4.1
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

http://wiki.alfresco.com/wiki/Content_Store_Configuration

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








delete
/images/icons/delete.gif
dialog:deleteItem
#{DialogManager.setupParameters}

#{actionContext.id}








org.alfresco.web.bean.trashcan.TrashcanDeleteItemDialog

Code to delate the content
property.getNodeArchiveService().purgeArchivedNode(item.getNodeRef());