Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Back to Developer Guide
Previous version of SDK Alfresco SDK 3.3
Welcome to the Alfresco SDK for 3.4
Alfresco provides a developer oriented download bundle, known as the Alfresco SDK (Software Development Kit) to complement the Alfresco release bundle.
This page outlines the steps required to start developing with the Alfresco SDK.
The Alfresco SDK provides support for developers who wish to extend or customise the Alfresco platform.
It's been designed for the developer to get developing with minimal fuss for the following development scenarios:
The SDK also contains the Java Doc for the Alfresco API
Some say typically, the SDK is used stand-alone, but how do you see the results without using Alfresco Explorer or Alfresco Share? An Alfresco Release Installation is also required if performing any of the following:
You need to install both Alfresco, tomcat and Eclipse on the same system. Please note, SDK and Alfresco Version have to match in order to work correctly.
The SDK is not designed for re-building Alfresco, it does not provide full build scripts and artifacts, therefore if you wish to develop bug fixes or extend the core functionality of the Alfresco platform, you should use the full Alfresco development environment provided in the Alfresco SVN Repository.
1. Prerequisites: Ensure the following development tools are installed...
2. Download the Alfresco Community Edition Release from the downloads page. Community_file_list_3.4.b
3. Download the Alfresco SDK The SDK bundle is provided in .zip and .tar.gz formats. A separate package is available for each Alfresco release.
4. Unpack the downloaded package to a file system folder of your choice.
5. It's now installed.
An expanded Alfresco SDK contains the following directories and top-level files:
/bin - supporting dll's, exe's
/doc - zipped Javadoc's for all pre-built libaries
/extras - additional files - e.g. for MySQL db setup/removal
/lib - pre-built Alfresco .jars
/deployment - WCM deployment libraries
/remote - Alfresco libraries required for access to a remote Alfresco server
/wsdl - Web Services Definition Files
/dependencies - supporting libraries,
/server - Alfresco libraries required for embedding an Alfresco server
/config - alfresco sample configuration files.
/dependencies - third party dependencies.
Alfresco server libraries
/share - Alfresco Share libraries.
/licenses - third party license files
/src - zipped source code for all pre-built libraries
/samples - template Eclipse projects for common development scenarios
licence.txt - Alfresco licence file
notice.txt - notices
readme.txt - Alfresco readme
This section explains how to setup your Eclipse environment for use with the Alfresco SDK.
Create the databases:
Run the install file.
Test to make sure you can access alfresco (link is in Programs menu in Windows).
Alfresco from 3.3 uses Java 1.6 language features, therefore Eclipse must be configured appropriately for JDK 1.6.
Add the alfresco bin folder to the system PATH.
Alternatively you theoretically should be able to add it to the java.library.path variable.
The easiest and quickest way to explore the samples is via Eclipse. Each sample comes with its own Eclipse project which may be used as a template for future developments of a similar kind.
At this point, all SDK projects are now imported.
Check Build hints window for error. Known fixes are listed below
Each one of the examples has its own configuration file. The configuration file tells the example application critical information about your Alfresco repository such as which database to connect to and where the data directory resides. To run the examples against your existing CE (Community Edition) installation, for each example, do the following:
If you already have a working installation on your machine, you can just overwrite the example application's local alfresco-global.properties file with the contents of your working alfresco-global.properties file.
There are two projects of particular importance:
SDK AlfrescoEmbedded - this project provides references to the libraries required for Alfresco Embedded use.
SDK AlfrescoRemote - this project provides references to the libraries required for Alfresco Remote use.
Each of the sample projects depends on one of the above.
SDK FirstFoundationClient - use of embedded Alfresco server via the Foundation API.
SDK FirstJCRClient - use of embedded Alfresco server via the JCR API.
SDK FirstWebServiceClient - use of remote Alfresco server via the Web Services API.
SDK JCRSamples - a mixture of JCR code samples including a simple WIKI demonstration.
SDK WebServiceSamples - a mixture of Web Service samples.
SDK CustomAction - how to develop a custom Action which may be deployed to an Alfresco Repository.
SDK CustomAspect - how to develop a custom Aspect with behaviour which may be deployed to an Alfresco Repository.
SDK CustomJSP - how to develop and configure a custom JSP for the Alfresco Web Client.
SDK CustomDialog - how to develop and configure a custom Dialog for the Alfresco Web Client.
SDK CustomWizard - how to develop and configure a custom Wizard for the Alfresco Web Client.
SDK CustomLogin - example demonstrating how to override Login page of the Alfresco Web Client.
SDK TaggingSample - example demonstrating how to adding document tagging behaviour to the Alfresco Web Client.
SDK Basic AMP - example demonstrating how to build an AMP (Alfresco Module Package) file.
Whilst developing against Alfresco it is useful to have access to Alfresco's source code and Java documentation. Within Eclipse, it's possible to associate such material with the libraries you're using.
For example, to associate source code and Javadoc with the Alfresco repository.jar in Eclipse...
Repeat above for in SDK Alfresco embedded:
SDK Alfresco Remote:
The first sample to try is SDK FirstFoundationClient which demonstrates the use of an embedded Alfresco Repository via the the Java Foundation API. It simply connects to the Repository and creates a file in the 'Company Home' folder of the Web Client.
Before turning the ignition key, the first step is to ensure an appropriate database is setup for the Alfresco Repository, but this is only necessary if you did not install the Community edition version in addition to the SDK.
If you do not have a CE installed with a database already and you are using MySQL, the following may be issued from the shell script:
mysqladmin -u root -p create alfresco
mysql -u root -p -e 'grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;'
mysql -u root -p -e 'grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;'
Alternatively you can run the batch/sql file:
/extras/databases/mysql/db_setup.bat (which calls db_setup.sql)
The SDK FirstFoundationClient project consists of the following source folders:
/alfresco/extension - runtime configuration files (e.g. database connection details)
/org/alfresco/sample - Sample application consisting of FirstFoundationClient.java
Check the database connection details are correct (alfresco-global.properties) and then it's simply a case of running or debugging the FirstFoundationClient.java application within Eclipse.
The sample will initialise the Repository if it is the first client to connect to the Repository. In this case, the sample will take longer to execute as all Repository bootstrap data is installed into the database.
IMPORTANT NOTE - Alfresco CE tomcat can not be running at the same time as the samples. Shutdown tomcat and run the example. Then start Alfresco Tomcat again from programs menu, log in and you should see the results of the samples that ran. For instance, after running the FirstFoundationClient when you start Alfresco CE again and log in, under the Company Home space you will see the content created by the example.
The projects SDK CustomAction and SDK CustomAspect demonstrate how to develop a plug-in for the Alfresco Repository. Plug-ins can be developed and tested with an embedded Alfresco Repository. Then, once satisfied, a plug-in can be packaged into a .jar which may then be deployed to any existing Alfresco installation. For example, the SDK CustomAspect project has a JUnit sample that tests the custom aspect by running an embedded Alfresco Repository using the Java Foundation API.
For each applicable SDK project, a build.xml file has been provided for packaging to a .jar file. See Packaging And Deploying Extensions for details on how to deploy extensions.
To execute any of the Web Service Samples for Java it is necessary to have an existing Alfresco Server installation to connect to. The easiest option is to install Alfresco.
The location of the Alfresco server to connect to is specified in the file webserviceclient.properties.
Note: This file is located in /alfresco for the SDK FirstWebServiceClient project and in /alfresco/extension for the SDK WebServiceSamples project.
The custom web client samples include: SDK CustomJSP, SDK CustomDialog, SDK CustomWizard, SDK CustomLogin and SDK TaggingSample.
To deploy and test Web Client customisations it is necessary to have an existing Alfresco Server to deploy to.
Documentation to support the SDK Web Client samples is available at Web Client Configuration Guide and Web Client Customisation Guide.
The SDK contains ANT build scripts, with the option to integrate your extension into an existing Alfresco WAR file. For example, you can copy your Alfresco WAR file to one of the sample directories (such as samples/TaggingSample) and then run:
ant integrate-extension
For more details, see Packaging_And_Deploying_Extensions#Integrated_deployment
Alfresco extensions may be packaged into an AMP file for subsequent deployment into any existing Alfresco installation. The project demonstrates how to structure a project to build an AMP file.
The SDK Basic AMP project is a small SDK sample that show how classes and configuration files can be arranged to generate an Alfresco Module Package (AMP). For more details on the supported layout of files, see: AMP file
Use ANT to generate the AMP file from the build script:
ant -f build.xml
To deploy your SDK Basic Sample AMP, you can download the Module_Management_Tool into a working directory and then copy the generated AMP file and Alfresco WAR file into the same working directory.
The following example command will preview the change:
java -jar alfresco-mmt-2.1.jar install alfresco-sdk-custom-service.amp alfresco.war -preview
The following example command will actual modify your working copy of the Alfresco WAR file:
java -jar alfresco-mmt-2.1.jar install alfresco-sdk-custom-service.amp alfresco.war -verbose
The modified Alfresco WAR can then be re-deployed back into your Alfresco server installation. If using Tomcat, you can shutdown Tomcat, delete the webapps/alfresco sub-directory and place the modified Alfresco WAR into webapps.
On re-starting the server, the Tomcat console will show that the custom class has been initialised during startup:
SDK Demo AMP class has been loaded
and also the module component has been installed and started:
13:13:51,712 INFO [repo.module.ModuleServiceImpl] Found 1 module(s).
13:13:52,509 INFO [repo.module.ModuleServiceImpl] Installing module 'sdkDemoAmp' version 1.0.
DemoComponent has been executed
You can build the SDK from SVN source using ANT:
ant -f continuous.xml distribute-sdk
Alfresco documentation is continuously being improved. If you see any issues with this documentation please feel free to fix via our WIKI editing capabilities. Again, if you get stuck, don't forget the Developer Resources.
SDK
3.4
Overview
Getting Started
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.