Book Image

Alfresco One 5.x Developer's Guide - Second Edition

By : Benjamin Chevallereau, Jeff Potts
Book Image

Alfresco One 5.x Developer's Guide - Second Edition

By: Benjamin Chevallereau, Jeff Potts

Overview of this book

Do you want to create more reliable and secure solutions for enterprise apps? Alfresco One 5.x is your gateway to developing the best industry-standard enterprise apps and this book will help you to become a pro with Alfresco One 5.x development. This book will help you create a complete fully featured app for your organization and while you create that perfect app, you will explore and implement the new and intriguing features of Alfresco. The book starts with an introduction to the Alfresco platform and you’ll see how to configure and customize it. You will learn how to work with the content in a content management system and how you can extend it to your own use case. Next, you will find out how to work with Alfresco Share, an all-purpose user interface for general document management, and customize it. Moving on, you write web scripts that create, read, and delete data in the back-end repository. Further on from that, you’ll work with a set of tools that Alfresco provides; to generate a basic AnglularJS application supporting use cases, to name a few authentication, document list, document view. Finally, you’ll learn how to develop your own Alfresco Mobile app and understand how Smart Folders and Search manager work. By the end of the book, you’ll know how to configure Alfresco to authenticate against LDAP, be able to set up Single Sign-On (SSO), and work with Alfresco’s security services.
Table of Contents (17 chapters)
Alfresco One 5.x Developer’s Guide - Second Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Alfresco architecture


Many of Alfresco's competitors (particularly in the closed-source space) have sprawling footprints composed of multiple, sometimes competing, technologies that have been acquired and integrated over time. Some have undergone massive infrastructure overhauls over the years, resulting in bizarre vestigial tails of sorts. Luckily, Alfresco doesn't suffer from these traits. On the contrary, Alfresco's architecture shows the following characteristics:

  • It is relatively straightforward

  • It is built with state-of-the-art frameworks and open source components

  • It supports several important content management and related standards

Let's look at each of these characteristics, starting with a high-level look at the Alfresco architecture.

High-level architecture

The following diagram shows Alfresco's high-level architecture. By the time you finish this book, you'll be intimately familiar with just about every box in the diagram:

The important takeaways at this point are as follows:

  • There are many ways to get content into or out of the repository, whether that's via the protocols (for example CIFS on the diagram) or the APIs on the left.

  • Alfresco runs as a web application within a servlet container. From Alfresco 5.x, this web application doesn't provide anymore a user interface for end users. It includes only an administration console. If you need a user interface, you'll need to deploy the Alfresco Share web application (in the same container or not) and an extension package in the Alfresco web application to provide all web scripts required by Alfresco Share. You can as well implement your own user interface on top of your Alfresco repository.

  • Customizations and extensions run as part of the Alfresco repository or Share web application. An extension mechanism separates customizations from the core product to keep the path clear for future upgrades.

  • Metadata resides in a relational database. In a typical Alfresco installation, content files are usually stored in a different server than Alfresco itself (as compared to filesystem). Solr indexes needs to be located in the system as the Solr web application that can reside in a dedicated server too.

Add-ons

The add-ons are pieces of functionality not found in the core Alfresco distribution. If you are working with the binary distribution, it means you'll have additional files to download and install on top of the base Alfresco or Share installation.

Add-ons are provided by Alfresco, third-party software vendors, and members of the Alfresco community such as partners and customers. Alfresco makes several add-on modules available such as Records Management, Google Docs, Office Services or Kofax integration. Members of the Alfresco community create and share add-on modules via the Alfresco add-Ons (https://addons.alfresco.com/), a website set up by Alfresco for that purpose. At the time of writing, this website contains 444 different add-ons compatible with Alfresco Enterprise and/or Community.

Open source components

One of the reasons Alfresco has been able to create a viable offering so quickly is because it didn't start from scratch. The Alfresco engineers assembled the product from many finer-grained open source components. Why does this matter? First, instead of reinventing the wheel, they used proven components. This saved them time, but it also resulted in a more robust, more standard-based product. Second, it eases the transition for people new to the platform. If a developer already knows Spring, for example, many of the customization concepts are going to be familiar. Alfresco uses Surf, a Spring framework extension for building or extending MVC applications. And besides, as a developer, wouldn't you rather invest your time and effort in learning standard development frameworks rather than proprietary development kits?

The following table lists some of the major open source components used to build Alfresco:

Open source component

Use in Alfresco

Apache Solr (http://lucene.apache.org/solr/)

Full-text and metadata search

Hibernate (http://www.hibernate.org/)

Database persistence

FreeMarker (http://freemarker.org/)

Web script framework views, custom views in the web client, web client dashlets, email templates

Mozilla Rhino JavaScript Engine (http://www.mozilla.org/rhino/)

Web script framework controllers, server-side JavaScript, actions

OpenSymphony Quartz (http://www.quartz-scheduler.org/)

Scheduling of asynchronous processes

Spring ACEGI (http://projects.spring.io/spring-security/)

Security (authorization), roles, and permissions

Apache Axis (http://ws.apache.org/axis/)

Web services

LibreOffice (http://www.libreoffice.org/)

Conversion of office documents into PDF

Apache FOP (http://xmlgraphics.apache.org/fop/)

Transformation of XSL:FO into PDF

Apache POI (http://poi.apache.org/)

Metadata extraction from Microsoft Office files

Activiti (http://www.activiti.org/)

Advanced workflow

ImageMagick (http://www.imagemagick.org/)

Image file manipulation

GhostScript (http://www.ghostscript.com/)

Image file manipulation

Does this mean you have to be an expert in all open source components used to build Alfresco to successfully implement and customize the product? Not at all! Developers looking to contribute significant product enhancements to Alfresco or those making major, deep customizations to the product may require experience with a particular component, depending on exactly what they are trying to do. Everyone else will be able to customize and extend Alfresco using basic Java and web application development skills.

Major standards and protocols supported

Software vendors love buzz words. As new acronyms climb the hype cycle, vendors scramble to figure out how they can at least appear to support the standard or protocol so that the prospective clients can check that box on the Request for proposal (RFP). Commercial open source vendors are still software vendors and thus are no less guilty of this practice. But because open source software is developed in the open by a community of developers, its compliance to standards tends to be more genuine. It makes more sense for an open source project to implement a standard than to go off in some new direction because it saves time. It promotes interoperability with other open source projects, and stays true to what open source is all about-freedom and choice.

Here, are the significant standards and protocols Alfresco supports:

Standard/protocol

Comment

HTTP

The main protocol used to access Alfresco content repository via for example the Alfresco REST APIs.

CMIS

CMIS is a standard allowing information sharing between different content management systems. Alfresco supports the version 1.0. and 1.1 of the CMIS standard.

FTP

Content can be contributed to the repository via FTP.

WebDAV

WebDAV is an HTTP-based protocol commonly supported by content management vendors. It is one way to make the repository look like a file system.

CIFS

CIFS allows the repository to be mounted as a shared drive by other machines. As opposed to WebDAV, systems (and people) can't tell the difference between an Alfresco repository mounted as a shared drive through CIFS and a traditional file server.

IMAP

IMAP protocol is used by any modern email clients. Directly from your client, you can connect to your Alfresco repository.

SMTP

It is possible to email content into the repository (InboundSMTP). A folder can be dedicated as an email target.

SPP

Enables Alfresco to act as a Microsoft SharePoint Server. Allows Microsoft Office users to access documents within the Alfresco repository.

Alfresco Office Services

Using Alfresco Office Services (AOS), you can access your documents directly via all Microsoft Office software. AOS replaces and improves the Microsoft SharePoint protocol available in the previous versions.

SOAP

The Alfresco Web Services API uses SOAP-based web services.

OpenSearch (http://www.opensearch.org)

Alfresco repositories can be configured as an OpenSearch data source, which allows Alfresco to participate in federated search queries.

XSLT, XSL:FO

Web form data can be transformed using XSL 1.0.

LDAP

Alfresco can authenticate against an LDAP directory or a Microsoft Active Directory server.