Tuesday, September 17, 2013

How to install Alfresco Workdesk

The installation of Alfresco Workdesk is already explained in the Alfresco Workdesk documentation. So this article aims to be a short summary of it.

Let's assume that we already have a running Alfresco instance. Even the Alfresco Community Edition will do it. The default installation of Alfresco already comes with Apache Tomcat. So we can just use this container for evaluation purposes.

The Alfresco Workdesk bundle comes as an archive which contains the following folders:
  • bin: The Desinger and the Workdesk application
  • db: The database creation scripts
  • doc: Some basic documentation. Further documentation is available, but you have to request it at Alfresco.
  • javadoc: The source code documentation
  • lib: Additional dependencies
The 'bin' folder contains a script 'create_workdesk_war' which creates you a WAR-file from the 'bin/workdesk' folder. Actually it just zips the content of this folder up. However, let's create it. Then perform the follwing steps:
  • Copy the workdesk.war file to $TOMCAT_HOME/webapps
  • Restart your Tomcat Server
  • Open http://${host}:${port}/workdesk
As you can see Workdesk was already successfully deployed and can already be used BUT it is currently configured to use an Alfresco repository (via CMIS) which is hosted in the Cloud. So in the next steps we focus on changing the Workdesk configuration in order to access our local repository.
  • There are some prepared configuration profiles stored in '$TOMCAT_HOME/webapps/workdesk/WEB-INF/conf . Our current installation uses the 'opencmis_trial' profile. To connect to the local repository we need to use the 'opencmis' profile.
  • The profile's root foler 'opencmis' contains a file named 'owbootstrap.xml'.  It contains a section 'EcmAdapter. In order to use our local Repository, you have to adapt the URL in the subsection 'AtomPub'. It looks like the following configuration:
 <EcmAdapter>
 ...
                <AtomPub>http://${host}:${port}/alfresco/cmisatom</AtomPub>
 ...
</EcmAdapter>

  •  Now you have to tell Workdesk to use this configuration profile instead the default one. Therefore it is necessary to edit the file '$TOMCAT_HOME/webapps/workdesk/WEB-INF/web.xml'. The file contains a context parameter definition which is named 'OwResourceFilePath':
<context-param id="OwResourceFilePath">
        <param-name>OwResourceFilePath</param-name>
        <param-value>deploy#WEB-INF/conf/opencmis</param-value>
</context-param>
  •  Alfresco Workdesk seems to require own database tables. I just created the tables inside my Alfresco database. Here are the PostgreSQL statements:
-- CREATE TABLE "OW_ATTRIBUTE_BAG";
CREATE TABLE OW_ATTRIBUTE_BAG
(
  "username" character varying(128) NOT NULL,
  "bagname" character varying(128) NOT NULL,
  "attributename" character varying(256) NOT NULL,
  "attributevalue" character varying(1024) NOT NULL,
  CONSTRAINT "OW_ATTRIBUTE_BAG_pkey" PRIMARY KEY ("username" , "bagname" , "attributename" )
)
WITH (
  OIDS=FALSE
);
-- CREATE TABLE "OW_HISTORY";
CREATE TABLE OW_HISTORY
(
  "eventindex" SERIAL UNIQUE NOT NULL,
  "ow_hist_type" integer NOT NULL,
  "ow_hist_id" character varying(128) NOT NULL,
  "ow_hist_status" integer  DEFAULT NULL,
  "ow_hist_time" timestamp DEFAULT NULL,
  "ow_hist_user" character varying(255) NOT NULL,
  "ow_hist_summary" character varying(2048) DEFAULT NULL,
  "objectdmsid" character varying(255) DEFAULT NULL,
  "objectname" character varying(1024) DEFAULT NULL,
  "parentdmsid" character varying(255) DEFAULT NULL,
  "parentname" character varying(1024) DEFAULT NULL,
  "custom1" character varying(2048) DEFAULT NULL,
  "custom2" character varying(2048) DEFAULT NULL,
  "custom3" character varying(2048) DEFAULT NULL,
  CONSTRAINT "EventIndex_pkey" PRIMARY KEY ("eventindex" )
)
WITH (
  OIDS=FALSE
);
-- CREATE TABLE "OW_ROLE";
CREATE TABLE OW_ROLE
(
  "role_id" SERIAL UNIQUE NOT NULL,
  "role_name" character varying(255) NOT NULL,
  "role_resource" character varying(255) NOT NULL,
  "role_access" integer NOT NULL DEFAULT (-1),
  "role_access_mask" integer NOT NULL DEFAULT (-1),
  "category" integer NOT NULL,
  CONSTRAINT role_id_pkey PRIMARY KEY ("role_id")
)
WITH (
  OIDS=FALSE
);
  • Last but not least, it is required to tell Workdesk which database should be used. Therefore the file '$TOMCAT_HOME/webapps/workdesk/META-INF/context.xml needs to be edited. In my case it has the following content:
 <?xml version="1.0" encoding="UTF-8"?>

<Context path="/workdesk" debug="100" privileged="true" reloadable="true">
  
    <Resource name="java:/PostgreSQLDS"
        auth="Container"
        type="javax.sql.DataSource"
        factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
        driverClassName="org.postgresql.Driver"
        url="jdbc:postgresql://localhost:5432/alfresco"
        username="${alf.db.user}"
        password="${alf.db.pwd}"
        removeAbandoned="true"
        maxActive="30"
        maxIdle="10"
        maxWait="1000"
        removeAbandonedTimeout="60"
        logAbandoned="true"/>         
   
</Context>

  • Just restart your Tomcat installation to get the changes applied. Then log-in by using one of your Alfresco users.

The more interesting part will follow. Another article will focus on how to customize Alfresco Workdesk in order manage specific cases.