Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Alfresco Developer Guide
Alfresco Developer Guide

Alfresco Developer Guide: Customizing Alfresco with actions, web scripts, web forms, workflows, and more

Arrow left icon
Profile Icon Jeff Potts
Arrow right icon
$68.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (7 Ratings)
Paperback Oct 2008 556 pages 1st Edition
eBook
$37.79 $41.99
Paperback
$68.99
Arrow left icon
Profile Icon Jeff Potts
Arrow right icon
$68.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (7 Ratings)
Paperback Oct 2008 556 pages 1st Edition
eBook
$37.79 $41.99
Paperback
$68.99
eBook
$37.79 $41.99
Paperback
$68.99

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Alfresco Developer Guide

Chapter 1. The Alfresco Platform

This chapter introduces the Alfresco platform and answers the question, "What can I do with this thing?" A few examples will be provided to help answer this question from the "solving business problems" perspective. The chapter then skims over basic configuration and customization before introducing the advanced customization concepts covered throughout the book. The chapter concludes with a brief discussion on the different Alfresco editions that are available.

In this chapter, we will go through the following points:

  • Examples of practical solutions built on Alfresco

  • High-level components of the Alfresco platform

  • Examples of the types of customizations that you will likely perform as a part of your implementation

  • Technologies you will use to extend the platform

Alfresco in the Real World


Alfresco will tell you that the product is a platform for Enterprise Content Management (ECM). But ECM is a somewhat nebulous and nefarious term. What does it really mean? It depends on who is saying it. ECM vendors usually use it as an umbrella term to describe a collection of content-centric technologies that includes:

  • Document Management (DM): Capturing, organizing, and sharing binary files. These files are typically produced from office productivity software, but the scope of the files being managed is unlimited.

  • Web Content Management (WCM): Managing files and content specifically intended to be delivered to the Web. The key theme of WCM is to reduce the "web developer" bottleneck and empower non-technical content owners to publish their own content.

  • Digital Asset Management (DAM): Managing graphics, video, and audio. You can think of this as DM with added functionality specific to the needs of working with rich media such as thumbnailing, transcoding, and editing. Like WCM, the intent is to streamline the production process.

  • Records Management (RM): Managing content as a legal record. Like DAM, RM starts with DM and adds functionality specific to the world of RM such as retention policies, records plans, and audit trails.

  • Imaging: This includes capturing, tagging, and routing images of documents from scanners.

Most people will also include Collaboration, Search, and occasionally, Portals as well.

Practitioners have a different perspective. They will say that ECM is less about the technology and more about how you capture, organize, and share information across the entire enterprise. For them, the "how" is more important than the "what".

What's important to know from an Alfresco perspective is that Alfresco is a platform for doing all these things.

So rather than worrying about a concise definition of ECM, let's look at a few examples to illustrate how clients are using Alfresco today, particularly in Alfresco's sweet spots such as Document Management and Web Content Management.

Basic Document Management

Alfresco started its life as a document management repository with some basic services for document management. Alfresco focused on this smart area initially for two reasons. First, it allowed Alfresco to establish a strong foundation and then build upon that foundation by expanding into other areas of ECM, with WCM being the prime example. Second, there is a huge market for systems that can manage unstructured content (aka "documents"). The market is so big because document management is a problem for everyone. All companies generate files that benefit from the kind of features document management provides such as check-in/check-out, versioning, metadata, security, full-text search, and workflow.

Examples of classic document management are often found in manufacturing, packaged goods, or other companies with large research and development divisions. As you can imagine, companies such as these deal with thousands of documents every day. The documents are in a variety of formats and languages, and are created and leveraged by many different types of stakeholders from various parts of the company.

The critical functionality required for basic document management includes things such as:

  • Easy integration with authoring tools: If users can't get documents into and out of the repository easily, user adoption will suffer. This means users must be able to open and save documents to the repository from applications such as Microsoft Office, Microsoft Windows Explorer, and email.

  • Security: Many documents, particularly legal documents and anything around new product development, are very sensitive. Employees must be able to log in with their normal username and password, and see only the documents they have access to.

  • Library services: This is a grouping of foundational document management functionality that includes check-in/check-out, versioning, metadata, and search. The ability to offer these library services is one of the things that sets a document repository apart from a plain file system.

  • Workflow: Quite literally, workflow describes the "flow of work" or business process related to a document. Requirements vary widely in this area and not everyone will leverage workflows right away. Workflows can be used to streamline and automate manual business processes by letting the document management system keep track of who needs to do what to a document at any particular time.

  • Scalability/Reliability: The system needs to scale in order to support several hundred or more users and hundreds of thousands or even millions of documents with some percentage of growth each year. Because the repository holds content that's critical to the business, it needs to be highly available.

  • Customizable user interface: The out of the box Alfresco web client is made for generic document management, which may be appropriate in many cases. Most clients will want to make at least some customizations to the web client to help increase productivity and improve user adoption.

The following diagram shows an example of high-level architecture to understand how basic document management might be implemented:

The diagram shows a single instance of Alfresco authenticating against LDAP. Some content managers are using the web client via HTTP/S, while others are using Windows Explorer, Microsoft Office, and other Thick Clients to work with content via one or more protocols such as CIFS, WebDAV, FTP, or SMTP. As noted in the diagram, Alfresco stores metadata in a Relational DB and the actual content files on the file system.

Most of the techniques for customizing Alfresco for DM solutions apply to other ECM solutions such as WCM, RM, Imaging, and DAM. Of course, there are business concepts and technical implementation details specific to each that make them unique, but the details provided in this book apply to all because the specialized solutions are built as extensions to the core Alfresco repository. WCM is built on the core repository as well, but the functionality it adds is significant enough to warrant a closer look.

Web Content Management

On the surface, WCM is very similar to document management. In both cases, content owners store files in a repository. Often, the content is assigned metadata, is secured, is indexed for search, and is routed through a workflow. The most obvious difference between DM and WCM is that the content being managed is meant specifically to be published on a web site or as part of a web application. Beyond that high-level distinction, there are several other differences that make WCM worthy of separate discussion. These include:

  • Content authoring tools used to create content

  • Separation of presentation from content

  • Systematic publication or deployment of content

Let's briefly look at each of these.

Content Authoring Tools

The majority of document management solutions deal with files generated by an office suite. Of course, there are exceptions such as various types of graphics files, CAD/CAM drawing formats, and other specialized tools. But mostly, the files are generated by a small number of different tools and an even smaller number of different software vendors.

In the case of WCM, there is a wide variety of tools involved from text editors to Integrated Development Environments (IDEs) to graphics programs with multiple vendors in each category. This means the WCM solution needs to be very flexible in the way it integrates with authoring tools. The alternative, which is forcing authors to give up their favorite tools in favor of a standard, can be a management nightmare.

Separation of Presentation from Content

WCM does not require the separation between content's appearance on the web site and its storage. But many implementations take advantage of this principle because it makes redesigning the site easier, facilitates multi-channel publishing, and enables people to author content without web skills.

To understand why this is so, think about a web site that has its content and presentation of that content merged together. When it is time to redesign the site, you have to touch every single web page because every page contains presentation markup. Similarly, content authoring is limited to people with technical skills. Otherwise, there is a risk that the content owner (for example, the person writing a press release or a job posting) will inadvertently clobber the page design.

One way to address this is to separate the content (the press release copy) from the presentation of that content. A common way to do that is to store the content as presentation-independent XML. The XML can then be transformed into any presentation that's needed. A redesign is as simple as changing the presentation in a single place, and then regenerating all of the pages.

The impact of separating content from presentation is three-fold. First, assuming the content consumers aren't interested in reading raw XML, something has to be responsible for transforming the content. Depending on the implementation, it may be up to the WCM system or a frontend web application.

Second, in the case of static content, any change in the underlying content has to trigger a transformation so that the presentation will be up-to-date, keeping in mind that there may be more than one file affected by the change. For example, data from a job posting appears in the job posting detail as well as the list of job postings. If the posting and the job posting index are both static, the list has to be regenerated whenever the job posting changes.

Third, content authors lose the benefit of WYSIWYG (What You See Is What You Get) content authoring because the content doesn't immediately look the way it will as soon as it is published to the web site. The WCM system, then, has to be able to let content authors "preview" the content as they author it, preferably in the context of the entire site.

Systematic Publication or Deployment

A Document Management system is a lot like a relational database in the sense that it is typically an authoritative, centralized repository. There are exceptions, but for the most part, content resides in the repository and is retrieved by the systems and applications that need it. On the other hand, a WCM system often faces a publication or deployment challenge. Files go into the repository, but must be delivered somewhere to be consumed. This might happen on a schedule, at the request of a user, as part of a workflow, or all of the above. Granted, some web sites retrieve their content dynamically; but most sites have at least a subset of content that should be statically delivered to a web server.

Alfresco WCM Example

Let's look at an example of a basic corporate web site. Most companies have a mix of "About Us" content that probably doesn't change very often, press releases or "News" that might get updated daily, and maybe some document-based content such as marketing slicks, product information sheets, technical specifications, and so on. There's also some content that is used to build the site such as HTML, XML, JavaScript, Flash, CSS, and image files.

It is likely that there are several different teams with several different skill sets, all collaborating to produce the site. In this example, suppose the "About Us" and "News pages" come from the marketing team, the site is built by the web team and the document-based content can come from many organizations within the company.

Alfresco WCM sits on top of the core Alfresco product to provide additional WCM-specific functionality. An important distinction between Alfresco WCM and other open source Content Management Systems is that Alfresco is a "de-coupled" CMS while something such as Drupal is a "coupled" CMS. This means that Alfresco manages the web site but does not concern itself with presentation unlike Drupal, which is both a repository and a presentation framework. This doesn't mean that Alfresco can only manage static sites. You can easily query the repository in any number of ways. It just means it is up to you to provide the frontend from the ground up.

Using Alfresco, the WCM implementation for this example might look like this:

Note that in the diagram there is a mix of structured content (XML) and unstructured content (CSS, PNG, and PDF). The structured content gets created through Alfresco web forms and is transformed to one or more formats (in this case, JSP) using XSLT or FreeMarker. The unstructured content is simply uploaded via either the web client or CIFS.

Regardless of whether it is created with a web form or uploaded to the repository directly, the content has to make it to a web server at some point. In this example, the content is being deployed to the frontend web server using Alfresco's file deployment mechanism. In Chapter 8, other content deployment patterns will be explored.

Custom Content-Centric Applications

Content-centric applications are those in which the primary purpose of the application is to process, produce, collaborate on, or manage unstructured or semi-structured content.

The Alfresco web client is an example of a content-centric application, although it is meant for a very general, all-purpose use case. When solutions are very close to basic document management, the web client can be customized as previously discussed. At some point, it makes more sense to build a separate custom application with Alfresco as the backend repository for that application.

Consider the sales process within a company, for example. Sales people create proposals. Those proposals are usually routed internally for review and approval, and then are delivered to the client. If the client accepts the proposal, a contract is drawn up and the product is delivered. The out of the box web client could be used to manage these documents, assign metadata, manage the review process through workflows, and make it all searchable. But the sales team might be even more productive if it used a purpose-built user interface. For this solution, a frontend built with a scripting language such as PHP, a Java framework such as Seam, or even a Rich Internet Application (RIA) technology such as Flex might be a good option. Alfresco would provide the document management services. The frontend would talk to Alfresco via SOAP or RESTful services.

Another example is a "community" site. With so much buzz around Web 2.0, companies are looking for ways to add community features to their online presence such as forums, blogs, and personalized content as well as user-generated content such as comments, ratings, and rich media.

As discussed previously in the WCM section, Alfresco is very good at publishing static files to one or more web servers or application servers. What it lacks, at least in the current release, is a presentation framework. Many clients appreciate this separation because it gives them complete freedom with regard to how they build the frontend. But in the case of a community site, it would be a good thing to be spared of building the frontend from scratch.

One way to implement this kind of solution is to use an open source portal such as Liferay or JBoss Portal for the frontend. Alfresco can manage the content and also the business process used to approve that content for publication in the community site. Portlets can be written that use either SOAP-based or REST-based web services calls, to query for and display content stored in the repository.

Note that the diagram also shows a Single Sign-On (SSO) solution so that users have to log in only once when moving back-and-forth between the portal and Alfresco. This isn't strictly required, but it is worth considering, particularly with freely available open source SSO solutions such as Yale CAS.

The openness of the Alfresco repository, particularly its ability to be easily exposed as a set of services, makes Alfresco an ideal platform for content-centric applications. As the examples have shown, custom content-centric web applications use Alfresco as the backend. As a result, they have complete flexibility in frontend technology choices from portals to lower-level frameworks to no framework at all.

Example Used throughout This Book


In this book, we'll assume we are rolling out Alfresco throughout a consulting firm. Professional services firms make great examples because they tend to generate a variety of different documents. The other reason is that document and content management is usually a big challenge, which is the core to the business. But the examples should be applicable to any business that generates a significant amount of documents.

The example firm, SomeCo, wants to leverage document and content management throughout the organization to make it easier to find important information, streamline certain business processes, and secure sensitive documents.

SomeCo's company organization is pretty standard. It consists of Operations, Sales, Human Resources, Marketing, and Finance/Legal. Examples of the different types of content each department is concerned with are shown in the following table:

Department

Example document types

Format and Process Notes

Finance/Legal

Client Proposals for Project Work

Statements of Work

Master Services Agreements

Non-Disclosure Agreements (NDAs)

  • Microsoft Word and Adobe PDF.

  • Several iterations between the firm and the client before a "final" version is completed.

  • Some documents may require internal review and approval.

Marketing

Case studies

Whitepapers

Marketing plans

Marketing slicks/Promotional material

  • Microsoft Word, Microsoft PowerPoint, Adobe PDF, and Adobe Flash.

  • Mostly single-author content.

  • Some content may come from third parties.

  • Some content may need to be published on the web site.

Human Resources

Job postings

Resumes

Interview feedback

Offer letters

Employee Profiles

/Biographies

Project reviews

Annual reviews

  • Microsoft Word, Adobe PDF, and HTML.

  • Single-author content with consumers being spread throughout the company.

  • Some content formats are unpredictable (such as resumes). Some are very standard and could be templatized (such as offer letters).

  • With the exception of job postings, none of this content should go near the Web.

  • Some content needs strict internal permissions.

Sales

Forecast

Presentations

Proformas

  • Microsoft Excel and Microsoft Powerpoint.

  • Some business process and automated document-handling possibilities such as Forecast.

  • Searchability of presentations is important.

Operations

Methodology

Utilization reports

Status reports

  • All Microsoft Office formats.

  • Some opportunity for integration into enterprise systems such as time tracking and project management.

Examples throughout the rest of the book will show how Alfresco can be implemented and customized to meet the needs of the various organizations within SomeCo. During a real implementation, time would be spent gathering requirements, selecting the appropriate open source components to integrate with the solution, finalizing architecture, and structuring the project. There are plenty of other books and resources that discuss how to roll out content management across an enterprise and others that cover project methodologies. So none of that will be covered here.

Chapter 2. Getting Started with Alfresco

Before you can customize Alfresco, you need to get your development environment in order. In this chapter, you'll learn how to get the Software Development Kit (SDK) set up in Eclipse, how to build and deploy customizations, helpful debugging tips, and the cleanest and quickest way to "reset" your Alfresco sandbox. The chapter includes an example that shows how to package and deploy some extremely basic customizations just to get your feet wet. Specifically, you are going to learn:

  • Where to get the Alfresco SDK, how to build it, and how to set it up in Eclipse
  • How to extend Alfresco without modifying the Alfresco source code or configuration
  • How to package and deploy your customizations
  • How to use the Eclipse debugger and log4j to troubleshoot problems
  • How to start clean for testing or debugging purposes

This book assumes you already have Alfresco installed and running on Tomcat, and are also using MySQL as the backend database; but that's up to you. If you need help getting your basic installation up and running, refer to the Appendix.

It may seem odd to talk about deployment before you've learned how to create something worth deploying, but these techniques will be used in all subsequent chapters. So you might as well get everything set up and tested now so that you don't have to deal with it later.

Obtaining the SDK

If you are running the Enterprise network, it is likely that the SDK has been provided to you as a binary. Alternatively, you can check out the Enterprise source code and build it yourself. In the Enterprise SVN repository, specific releases are tagged. So if you wanted 2.2.0, for example, you'd check out V2.2.0-ENTERPRISE-FINAL. The Enterprise SVN repository for the Enterprise network is password-protected. Consult your Alfresco representative for the URL, port, and credentials that are needed to obtain the Enterprise source code.

Labs network users can either download the SDK as a binary from SourceForge (https://sourceforge.net/project/showfiles.php?group_id=143373&package_id=189441) or check out the Labs source code and build it. The SVN URL for the Labs source code is svn://svn.alfresco.com. In the Labs repository, nothing is tagged. You must check out HEAD.

Step-by-Step: Building Alfresco from Source

Regardless of whether you are using Enterprise or Labs, if you've decided to build from the source it is very easy to do it. At a high level, you simply check out the source and then run Ant. If you've opted to use the pre-compiled binaries, skip to the next section. Otherwise, let's use Ant to create the same ZIP/TAR file that is available on the download page. To do that, follow these steps:

  1. Check out the source from the appropriate SVN repository, as mentioned earlier.
  2. Set the TOMCAT_HOME environment variable to the root of your Apache Tomcat install directory.
  3. Navigate to the root of the source directory, then run the default Ant target:
    ant build.xml
    
  4. It will take a few minutes to build everything. When it is done, run the distribute task like this:
    ant -f continuous.xml distribute
    
  5. Again, it may take several minutes for this to run. When it is done, you should see several archives in the build|dist directory. For example, running this Ant task for Alfresco 3.0 Labs produces several archives. The subset relevant to the book includes:
    • alfresco-labs-sdk-*.tar.gz
    • alfresco-labs-sdk-*.zip
    • alfresco-labs-tomcat-*.tar.gz
    • alfresco-labs-tomcat-*.zip
    • alfresco-labs-war-*.tar.gz
    • alfresco-labs-war-*.zip
    • alfresco-labs-wcm-*.tar.gz
    • alfresco-labs-wcm-*.zip
  6. You should extract the SDK archive somewhere handy. The next step will be to import the SDK into Eclipse.

Setting up the SDK in Eclipse

Nothing about Alfresco requires you to use Eclipse or any other IDE. But Eclipse is very widely used and the Alfresco SDK distribution includes Eclipse projects that can easily be imported into Eclipse, so that's what these instructions will cover.

In addition to the Alfresco JARs, dependent JARs, Javadocs, and source code, the SDK bundle has several Eclipse projects. Most of the Eclipse projects are sample projects showing how to write code for a particular area of Alfresco. Two are special, however. The SDK AlfrescoEmbedded project and the SDK AlfrescoRemote project reference all of the JARs needed for the Java API and the Web Services API respectively. The easiest way to make sure your own Eclipse project has everything it needs to compile is to import the projects bundled with the SDK into your Eclipse workspace, and then add the appropriate SDK projects to your project's build path.

Step-by-Step: Importing the SDK into Eclipse

Every developer has his or her own favorite way of configuring tools. If you are going to work with multiple versions of Alfresco, you should use version-specific Eclipse workspaces. For example, you might want to have a workspace-alfresco-2.2 workspace as well as a workspace-alfresco-3.0 workspace, each with the corresponding Alfresco SDK projects imported. Then, if you need to test customizations against a different version of the Alfresco SDK, all you have to do is switch your workspace, import your customization project if it isn't in the workspace already, and build it. Let's go ahead and set this up. Follow these steps:

  1. In Eclipse, select File|Switch Workspace or specify a new workspace location. This will be your workspace for a specific version of the Alfresco SDK so use a name such as workspace-alfresco-3.0. Eclipse will restart with an empty workspace.
  2. Make sure the Java compiler compliance level preference is set to 5.0 (Window|Preferences|Java|Compiler). If you forget to do that, Eclipse won't be able to build the projects after they are imported.
  3. Select File|Import|Existing Projects into Workspace. For the root directory, specify the directory where the SDK was uncompressed.

    Note

    You want the root SDK directory, not the Samples directory.

  4. Select all of the projects that are listed and click Import.

After the import, Eclipse should be able to build all projects cleanly. If not, double-check the compiler compliance level. If that is set but there are still errors, make sure you imported all SDK projects including SDK AlfrescoEmbedded and SDK AlfrescoRemote.

Now that the files are in the workspace, take a look at the Embedded project. That's quite a list of dependent JAR files! The Alfresco-specific JARs all start with alfresco-. It depends on what you are doing, of course, but the JAR that is referenced most often is likely to be alfresco-repository.jar because that's where the bulk of the API resides.

The SDK comes with zipped source code and Javadocs, which are both useful references (although the Javadocs are pretty sparse). It's a good idea to tell Eclipse where those files are, so you can drill in to the Alfresco source when debugging. To do that, right-click on the Alfresco JAR, and then select Properties. You'll see panels for Java Source Attachment and Javadoc Location that you can use to associate the JAR with the appropriate source and Javadoc archives.

The following image shows the Java Source Attachment for alfresco-repository.jar:

Step-by-Step: Importing the SDK into Eclipse

The following image shows the Javadoc Location panel for alfresco-repository.jar.

Step-by-Step: Importing the SDK into Eclipse

Source and Javadoc are provided for each of the Alfresco JARs, as shown in the following table. Note that source and Javadoc for everything is available. This is open source software after all, not just all bundled with the SDK:

Alfresco JAR

Source archive

Javadoc archive

alfresco-core.jar

Src|core-src.zip

Doc|api|core-doc.zip

alfresco-remote-api.jar

Src|remote-api-src.zip

Doc|api|remote-api-doc.zip

alfresco-web-client.jar

src|web-client-src.zip

doc|api|web-client-doc.zip

alfresco-repository.jar

src|repository-src.zip

doc|api|repository-doc.zip

Extending Alfresco

Alfresco provides an extension mechanism that keeps customizations separate from the files that are a part of the Alfresco distribution. It is important to keep your customizations separate from Alfresco's in order to help streamline future upgrades and to simplify troubleshooting.

Understanding the Extension Mechanism

When you implement Alfresco, you will inevitably identify things you want to tweak and potentially define an entirely new functionality that you would like to add to the platform. The approach you will use to extend Alfresco with your own customizations is the same you use when extending other Spring or JSF-based web applications. You will extend the existing or write new Spring beans, JSF-managed beans, Java classes, JSPs, tag libraries, and other files. The custom files are deployed as a part of the Alfresco web application. The trick is to override or extend Alfresco with your own code, while keeping those extensions and customizations separate from the Alfresco core. This means you have to know what goes where and the answer to that depends on what's being extended.

When implementing your solution, you are likely to create or customize one or more of the following types of files:

  • Standard Java web application files (JSP pages, tag libraries, resource bundles, and Java classes)
  • Framework files (Spring beans, JSF-managed beans, and their associated configuration files)
  • Alfresco configuration files (properties files and XML files)
  • Solution-specific files (content models, business process definitions, web scripts, JavaScript, and Freemarker templates)

Let's look at how each of these areas is extended.

Standard Java Web Application Files

Given that you probably have experience developing Java web applications, there is not much need to go into detail here. The Java classes you develop as a part of your customization will go into a JAR file. The JAR file will reside in the WEB-INF|lib of the Alfresco web application. Therefore, you should name it such that it is easy to spot among the hundred or so JAR files distributed as part of Alfresco. Similarly, any tag libraries that you develop will reside in WEB-INF alongside Alfresco's taglibs.

Custom JSP pages should be kept separate from Alfresco's to make them easier to identify. One way to do this is to create an extension directory under jsp, but it is completely up to you. The same goes for scripts, images, and CSS.

Framework Files

Alfresco makes heavy use of the Spring Framework for Inversion of Control (IoC) and the MyFaces implementation of the JavaServer Faces (JSF) standard for web client user interface components and navigation. Each of these frameworks can be extended.

Spring Configuration Files

Spring configuration files always end in -context.xml. That's how Spring knows to read them when the application starts up. Alfresco's Spring configuration files reside in WEB-INF|classes|alfresco.

You can override Alfresco's Spring bean configurations with your own by creating custom Spring configuration files. Custom Spring configuration files must follow the *-context.xml naming convention. They need to reside in a directory called alfresco|extension, but that directory can be anywhere on the Classpath. The convention is to use either the shared|classes directory in $TOMCAT_HOME or WEB-INF|classes.

Note

If you are curious, Alfresco (or more specifically, Spring) knows to load custom context files in the alfresco|extension directory because that's what is configured in WEB-INF|classes|alfresco|application-context.xml. You can find other interesting Spring configuration files by searching web.xml for context.xml.

Let's look at an example. Here's the out of the box Alfresco Spring bean that's used to tell Alfresco about the default custom content model file:

<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
    <property name="models">
        <list>
            <value>alfresco/model/defaultCustomModel.xml</value>
        </list>
    </property>
</bean>

This Spring bean happens to reside in a file called core-services-context.xml, but that's not important. Suppose you want to configure Alfresco with an additional custom content model, don't worry that you haven't yet learned what a content model XML file is; the point is that there is a bean defined as part of the out of the box configuration with a property ("models", in this case) we might want to set. To do that, you'd create a new file following the *-context.xml naming convention. In that file, you would place a bean configuration that sets the model's property the way you want it. The question you have to ask is: Do you want to completely override the exact same bean that Alfresco has configured out of the box, or do you want to create a new instance of a bean that would co-exist with Alfresco's?

In this example, you could override Alfresco's extension.dictionaryBootstrap bean by adding your own bean to your context file with the matching bean ID, and then set the model's property as needed like this:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Registration of new models -->
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/model/scModel.xml
                </value>
                <value>alfresco/extension/model/scWorkflowModel.xml
                </value>
            </list>
        </property>
</bean>
</beans>

The custom Spring configuration file could be named anything you want as long as it ends with -context.xml. In this example, the models property points to two custom model XML files called scModel.xml and scWorkflowModel.xml. Your custom bean would override Alfresco's extension.dictionaryBootstrap bean because it loads the custom context files last.

For this particular bean, the problem with overriding extension.dictionaryBootstrap is that someone else might develop an add-on module for Alfresco that overrides the same bean. The one that gets loaded last will win, which may not be what you want. So instead, in this case, the better approach is to create a unique bean ID such as this:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    <!-- Registration of new models -->
    <bean id="someco.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/model/scModel.xml</value>
                <value>alfresco/extension/model/scWorkflowModel.xml</value>
            </list>
        </property>
    </bean>
</beans>

When adding new beans to your context files, make sure you are making a conscious decision regarding whether you are deliberately overriding a bean with your own definition, or are simply creating a new instance of a bean instead. Neither one is always right; it just depends on what you are trying to do.

Note

If you aren't familiar with Spring, you might be wondering about the "parent" and "depends-on" attributes. A parent bean is like a template: The child inherits the parent bean's configuration and can override the parent settings. The depends-on attribute is used to make sure that Spring instantiates the dependent bean first. Learn more about the Spring Framework at http://www.springframework.org.

There are many Spring beans configured in Alfresco out of the box. The Appendix includes a list of the beans that are considered "public services". In addition to the Appendix, you can also use the files distributed with Alfresco. The out of the box Spring bean configuration files are named *-context.xml, and reside in WEB-INF|classes|alfresco. Within the Alfresco distribution, the extensions|extension directory contains a set of sample files. If you wanted to set up some scheduled actions, for example, you could copy scheduled-actions-services-context.xml.sample from the distribution to your extension directory, rename it to scheduled-actions-services-context.xml, and then modify it as needed.

JavaServer Faces Configuration Files

Alfresco uses JavaServer Faces (JSF) for its UI component model. Alfresco uses the MyFaces implementation of the JSF specification. Note that for the rest of the book, it will be referred to simply as "JSF" even though, technically, JSF is a specification and MyFaces is the implementation of that spec.

Like Spring, JSF relies on XML files to configure the framework. Alfresco's JSF files reside in the WEB-INF directory, and all begin with "faces". Custom JSF components and navigation rules are declared in a faces configuration file. Unfortunately, there is not as much flexibility in the location of your JSF configuration files as there is with Spring. For JSF, it comes down to two choices: WEB-INF|faces-config-custom.xml or faces-config.xml in META-INF within a JAR file that resides in Alfresco's

WEB-INF|lib directory. Which one you use depends on what you are trying to do. If you are overriding Alfresco's existing JSF navigation rules, you have to go the META-INF route. If you are overriding Alfresco's existing JSF component declarations, you have to go the WEB-INF route. If you aren't overriding anything, you can pick either.

For example, let's suppose you want to override the login.jsp page with a custom version. As previously discussed, the new JSP should go into jsp|extension to keep it separate from Alfresco's JSPs. Alfresco uses JSF to configure navigation rules related to login. If you search the files within the WEB-INF directory for the string login.jsp, you'll see that the JSF file that defines the navigation rules related to login is faces-config-navigation.xml. In this example, the goal is to use a custom login page. That means, the existing navigation rules pointing to the out of the box login.jsp page have to be overridden. To change the navigation to use the custom login.jsp page, copy the appropriate navigation-rule elements (there are two) into a new file called faces-config.xml and change the from-view-id and to-view-id elements to reference the custom JSP as follows:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>

   <navigation-rule>
      <description>
         The decision rule used by the NavigationHandler to
         determine which view must be displayed after the
         current view, login.jsp is processed.
      </description>
      <from-view-id>/jsp/extension/login.jsp</from-view-id>
      <navigation-case>
         <description>
             Indicates to the NavigationHandler that the browse.jsp
             view must be displayed if the Action referenced by a 
             UICommand component on the login.jsp view returns 
             the outcome "success".
         </description>
         <from-outcome>success</from-outcome>
         <to-view-id>/jsp/browse/browse.jsp</to-view-id>
      </navigation-case>
   </navigation-rule>

   <!-- rule to get back to the login page from anywhere -->
   <navigation-rule>
      <from-view-id>/jsp/*</from-view-id>
      <navigation-case>
         <from-outcome>logout</from-outcome>
         <to-view-id>/jsp/extension/login.jsp</to-view-id>
      </navigation-case>
      <navigation-case>
         <from-outcome>relogin</from-outcome>
         <to-view-id>/jsp/extension/relogin.jsp</to-view-id>
      </navigation-case>
   </navigation-rule>   
</faces-config>

Because this Faces configuration overrides existing navigation rules, the file has to be called faces-config.xml and it has to reside in the META-INF directory of a JAR file placed in Alfresco's WEB-INF|lib directory.

Note that this isn't a complete example for customizing the login page. There's another step involving an Alfresco configuration file. Alfresco configuration files are covered in the next section.

Alfresco Configuration Files

Not all configurations are handled through standard frameworks such as Spring and JSF. Some configuration changes are made using properties files or Alfresco configuration XML. For example, the most commonly customized properties file is custom-repository.properties. In it, you can find things such as the username and password used to connect to the underlying relational database, the database driver, and the data directory file path. Like the Spring files, there are sample properties files in the extensions|extension directory of the Alfresco distribution.

The full out of the box repository.properties file resides in WEB-INF|classes|alfresco. To override any of the properties in that file, add custom values to a file called custom-repository.properties in the alfresco|extension directory. This file is specifically named in the repository-properties Spring bean so if, for some reason, you have more than one or you want to change the name, you must specify the updated properties file location in the configuration for the repository-properties bean. By default, that bean is configured in custom-repository-context.xml.

When you browse the WEB-INF|classes|alfresco directory, you'll see several XML files that are not Spring configuration files (they don't end in context.xml). These are configuration files that use Alfresco's configuration mechanism. The list of these files can be found in the configuration for the webClientConfigSource bean that resides in WEB-INF|classes|alfresco|web-client-application-context.xml.

The best example of a file of this type is web-client-config.xml. An earlier section discussed overriding the default login page by creating a new login.jsp and modifying the JSF navigation rule. In addition to the navigation rules, Alfresco has a setting that tells it what the initial login page should be. That setting is in web-client-config.xml. A portion of the relevant section of that file is shown here:

<config>
	<admin>
		<initial-password>admin</initial-password>
	</admin>

	<client>
		<!-- the error page the client will use -->
		<error-page>/jsp/error.jsp</error-page>

		<!-- the login page the client will use -->
		<login-page>/jsp/login.jsp</login-page>

To complete the custom login example, the login-page element needs to be updated to point to the custom login JSP. The override has to happen in a file named web-client-config-custom.xml residing in alfresco|extension. It can't be named anything else because the webClientConfigSource bean names it explicitly. In this case, the web-client-config-custom.xml file would contain the following:

<config>
	<client>
		<!-- the login page the client will use -->
		<login-page>/jsp/extension/login.jsp</login-page>

Note that only the settings that need to be overridden are repeated in web-client-config-custom.xml. In this case, that's just the login-page element.

If you look at web-client-config.xml, you'll notice a few different types of elements. Depending on what's being configured, Alfresco configuration XML might use elements with specific names (admin, client, and login-page in the previous example). In other cases, an element named config is used with evaluator and condition attributes to define exactly what's being configured. Consider the configuration that specifies what languages should be shown in the drop-down box on the login page. The language configuration in the out of the box web-client-config.xml file looks like this:

<config evaluator="string-compare" condition="Languages">
	<!-- the list of available language files -->
	<languages>
		<language locale="en_US">English</language>
	</languages>
</config>

To override or extend this list, the config element can be copied to web-client-config-custom.xml and updated as needed:

<config evaluator="string-compare" condition="Languages">
	<languages>
		<language locale="ca_ES">Catalan</language>
		<language locale="hr_HR">Croatian</language>
		<language locale="cs_CZ">Czech</language>
		<language locale="da_DK">Danish</language>
	</languages>
</config>

In this case, four new languages would be added to the dropdown for a total of five languages. If, instead, you wanted to replace English with only these four choices, you would add the replace attribute to the config element like this:

<config evaluator="string-compare" condition="Languages" replace="true">
	<languages>
	<language locale="ca_ES">Catalan</language>
	<language locale="hr_HR">Croatian</language>
	<language locale="cs_CZ">Czech</language>
<language locale="da_DK">Danish</language>
</languages>
</config>

Solution-Specific Files

There are several types of files that, conceptually, sit on top of the Alfresco platform as a part of the solution you are implementing with Alfresco. These include files such as content models, business process definitions, web scripts, server-side JavaScript, and FreeMarker templates. Alfresco ships several of these with the product. Some are purely meant to be used as examples, while others are functional pieces of the platform. With the exception of content models that can import and extend Alfresco's out of the box content models, there is no need to extend these files directly. Instead, your custom versions of these types of files will sit alongside Alfresco's.

These files can live on the file system or in the repository. When they reside on the file system, they need to be on the classpath. So they should be placed in the alfresco|extension directory. When stored in the repository, each type of file has a designated folder within the |Company Home|Data Dictionary folder.

For example, suppose you write a JavaScript file to implement the business logic for an action. Ignoring the details on actions for the moment, you can choose to store that JavaScript file either on the file system, perhaps in a directory called scripts in the alfresco|extension directory, or in the repository within the Scripts folder under Data Dictionary.

Business process definitions can live on the file system and in the repository, but they can also be deployed directly to the JBoss jBPM engine. This will be discussed in the Advanced Workflow chapter.

Avoid Modifying Alfresco Code and Configuration

Now that you've got the full source code for Alfresco, it may be tempting to make changes directly to the Alfresco web application. Avoid this temptation at all costs. As soon as you recompile an Alfresco class, tag library, JSP page, or even a configuration file, you've complicated your life unnecessarily.

"But this is open source," you may say, "Why can't I change it if I want to?". Yes, it is open source and, yes, you can change it to your heart's content. But when you do so, be prepared to effectively take ownership of that code going forward. It will be up to you to figure out whether a problem is in your code or Alfresco's. You will also have to devote more time to upgrades than you would have, had you kept your customizations separate from Alfresco's code. In the U.S., a phenomenon that seems to be peculiar to antique shop owners is the posting of a sign that reads, "You break it, you bought it". That certainly applies to modifying the Alfresco source code directly.

There are three situations when, try as you might, you may have to touch Alfresco's files. First, you may identify a bug in the Alfresco source as well as a fix. In this situation, the best thing to do is to put the fix in place as a temporary measure, file a JIRA ticket, and attach the fix to the ticket. Alfresco will confirm the bug and implement the fix (sometimes using your code unchanged and sometimes with its own). Enterprise customers can usually get a patch right away. Labs users may have to run on their own fix until the problem is resolved in a future build.

The second situation is that sometimes (and this is increasingly rare) there may be a configuration change or customization that cannot be implemented through the standard extension mechanism. This is really no different than the previous scenario. If this happens, treat it like a bug. Make the change then file a ticket. Alfresco's intent is for the product to be extensible without the need to change the core installation, so anything less than that is a bug.

The third situation is that you might identify a product enhancement that cannot be implemented without modifying the source. In this case, it is a very good idea to talk to Alfresco (either your representative or via the forums) before you start coding, particularly if it is a big change. They might already be working on the same enhancement. Or, they might be able to gauge demand for the enhancement as well as provide implementation advice. If this enhancement is critical to your solution but no one else is interested in it, you'll have a hard decision to make because it may be a long time before the enhancement gets incorporated into the product. Moving forward without Alfresco's commitment to incorporate the enhancement into the product could mean supporting your own fork of the Alfresco source for the foreseeable future.

Packaging and Deploying Customizations

Now you know how to extend Alfresco without getting your files tangled up with the core distribution. But what is the best way to package them up and deploy them to the server? Most people choose Ant to build and package their customizations. Once they are packaged, you have three options for deploying them as part of the Alfresco web application:

  • Copy your files on top of an exploded Alfresco web application.
  • Integrate your files with the Alfresco WAR, which you then deploy.
  • Package your changes as an Alfresco Module Package (AMP) file. The AMP is then installed in—merged into—an Alfresco WAR, which is then deployed to the application server.

The first two approaches are self-explanatory. Copying custom files into an exploded Alfresco web application is the least trouble of the three. It is fast, and makes for a very efficient development cycle. A common approach is to use an Ant build file to zip everything into an archive, and then unzip the archive on top of the exploded Alfresco web application. This is the approach you'll use as you work through the examples in this book.

Some application servers, such as JBoss, have a deployment process that deploys WAR files automatically. In this case, it might be useful to integrate the custom files with the Alfresco WAR and then copy the WAR to the deployment directory. Again, using one or more Ant tasks is a common approach in this situation.

The third approach is to use an AMP. Conceptually, the AMP approach is no different than the "integrate with the Alfresco WAR" option: An AMP file is really just a ZIP of your customizations, which are then merged with an Alfresco WAR. The difference is that when you "install" an AMP into the Alfresco WAR, the AMP tools can do things such as check for specific versions of Alfresco, make a backup of the Alfresco WAR, and notify you if the AMP has already been installed to the WAR. More details on working with AMPs can be found in the Appendix.

The following table summarizes the three approaches:

Deployment Approach

Considerations

Copy customizations over the top of an expanded Alfresco web application.

Fastest development cycle.

Easy to point to a definitive set of changes.

Some Change Management organizations like to deal only with WAR files.

Merge customizations with the Alfresco WAR.

Change Management likes it—Leverages standard "I deploy the WAR you give me" procedures.

When developing locally, merging with the WAR seems unnecessary.

Package customizations as an AMP, which is then "installed" into the Alfresco WAR and deployed.

Facilitates version and dependency checking.

Easier to share with others, particularly when the set of customizations may need to coexist with customizations provided by others.

Same development overhead as "merge with WAR" option.

Uses nonstandard, Alfresco-only tool.

Separating Server-Specific Customizations

In every implementation, there is usually a set of customizations that is server-specific and a set that is not server-specific. A good practice is to keep server or environment-specific customizations separate from customizations that do not depend on a specific server or environment. For example, suppose in your shop you have three environments—one each for Development, Test, and Production. Let's assume that you want to configure Alfresco to authenticate against an LDAP directory. You ought to be able to take your Alfresco WAR and deploy it, unchanged, to Development, Test, and Production. If each environment has its own LDAP server, and you include the LDAP configuration as a part of the WAR, you won't be able to do that.

The way to address this is to make sure that only customizations that are independent of server or environment get packaged together. Server-specific customizations should be packaged separately. You might even want to use two different Eclipse projects. One might be called server extensions and the other client extensions, for example. In this case, the LDAP configuration is a server extension.

Using this approach, when you package your client customizations, you should be able to deploy the same package to Development, Test, or Production without modification.

Step-by-Step: Packaging and Deploying a Simple Customization

Let's run through an end-to-end example for a simple customization to validate what you've learned so far. In this example you're going to do two things. First, you're going to modify the login page to display the proud SomeCo logo and the Alfresco version. Second, you're going to extend the content model with a few simple types. To do this, follow these steps:

  1. If you haven't already, create a new Java project in Eclipse called client-extensions and update its build path to be dependent on SDK AlfrescoEmbedded, which is one of the projects included with the Alfresco SDK that references all of the dependent JARs.
  2. How you set up the directory structure in your Java project is mostly a personal preference. The source code that accompanies the book will follow Alfresco's project structure fairly close, thus making it easier to follow.
  3. Given that, create the following directory structure in the client-extensions project:
        |config|alfresco|extension|model
        |src|java
        |src|web|jsp|extension
        |src|web|META-INF
        |src|web|someco|images
  4. The examples in this book use Apache Ant to package and deploy the customizations to your local Alfresco web application. The build.xml file refers to a build.properties file. The build.properties file should be used to specify variables specific to your setup. If you set up your Eclipse project folder structure as described earlier, you shouldn't have to edit the build.xml file; the build.properties file should be all you need to touch. The source code that accompanies this chapter includes a build.properties.sample file. Rename it to build.properties, and then edit it to point to the expanded Alfresco SDK and the exploded Alfresco webapp directory in Tomcat. Here is an example:
        alfresco.sdk.remote.dir=|usr|local|bin|alfresco-labs-3.0-sdk|lib|remote
        alfresco.sdk.server.dir=|usr|local|bin|alfresco-labs-3.0-sdk|lib|server
        alfresco.web.dir=|usr|local|bin|apache|apache-tomcat-5.5.17|webapps|alfresco

    Now you are ready to populate the project with Alfresco customizations. The exact details aren't important right now: The point of the exercise is to learn what goes where. So rather than building each file from scratch, use the following table to figure out what files need to be copied from the source code included with the chapter into your Eclipse project. The "Where it came from" column shows where I got the file, in case you are curious. You'll learn how to build these files in the subsequent chapters:

    File (Path relative to the root of the Eclipse project)

    File description

    Where it came from

    |src|web|jsp|extension|login.jsp

    |src|web|jsp|extension|relogin.jsp

    Modified login.jsp and relogin.jsp

    Copied from Alfresco's web application and modified

    |src|web|someco|images|someco-logo.png

    SomeCo corporate logo

    High-dollar branding consultants, focus groups, hours of graphics design work

    |src|web|META-INF|faces-config.xml

    Custom faces-config.xml file to override Alfresco's navigation rules related to login

    Copied from Alfresco's web application and modified

    |config|alfresco|extension|web-client-config-custom.xml

    Custom web client configuration to override login page path with the path to the custom page

    Copied from Alfresco's web application and modified

  5. That's all that is required to customize the login page. To make the example slightly more interesting, let's make a very small extension to Alfresco's content model. A full chapter is devoted to extending the content model, so, again, don't sweat the details at this point. For now, just copy each of the files shown in the following table from the source code that accompanies this chapter into your Eclipse project:

    File (Path relative to the root of the Eclipse project)

    File description

    Where it came from

    |config|alfresco|extension|someco-model-context.xml

    Model context file (Spring bean configuration)

    Copied from custom-model-context.xml.sample in [distribution]|extensions|extension and modified

    |config|alfresco|extension|model|scModel.xml

    Model XML file

    Copied from customModel.xml.sample in [distribution]|extensions|extension and modified

    |config|alfresco|extension|web-client-config-custom.xml

    Custom web client configuration to expose custom types to the web client user interface

    Modified the same web-client-config-custom.xml file as the one used for the custom login page

  6. Now deploy the customizations. If it is running, shut down Tomcat. Then use Ant to package and deploy the files. You can use Eclipse to invoke the deploy target or use the command line as follows:
    ant deploy
    
    

After successfully running the Ant target, your changes will be sitting in the Alfresco web application directory you specified in build.properties. To test this out, start Tomcat back up and see if the customizations made it.

The login page should look like this:

Step-by-Step: Packaging and Deploying a Simple Customization

Log in, navigate to a folder, and create some content. You should see Someco Document and Someco Whitepaper as available content types.

Taking a Look at the Build File

The sample code in this book uses Ant to package and deploy the customizations. The initial build.xml file is very straightforward. The list of Ant targets and what they do is probably more important than the actual contents of the build.xml file. The Ant targets are shown in the following table:

Ant Target

What it does

clean

Removes all generated files

compile

Compiles src to ${bin.dir}

deploy

Unzips the ${package.file.zip} into ${alfresco.web.dir}

package-extension

Creates a ZIP called ${package.file.zip} that can be unzipped on top of an exploded Alfresco web application

package-jar

Jars up the compiled classes and ${web.dir}/META-INF into ${package.file.jar}

setup

Creates the ${build.dir} and ${bin.dir} directories

zip-project

Zips the entire Eclipse project as is into ${project.file.zip}

You can recreate the table output by asking Ant for project help on the command line:

ant -p
Left arrow icon Right arrow icon

Description

This book will guide you through the steps necessary to add image, video, and audio elements into your Drupal sites. For each topic, you start with simple techniques and move on to more advanced techniques. By the time you've completed this book, you should have a firm ground from which to tackle most multimedia needs, and enough of an understanding to creatively solve more complex problems. This book will provide information for administrators and professional site developers who are required to embed multimedia into a Drupal site. The reader needs basic knowledge of Drupal operation, but no experience of how Drupal handles multimedia items is expected.
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 31, 2008
Length: 556 pages
Edition : 1st
Language : English
ISBN-13 : 9781847193117
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Oct 31, 2008
Length: 556 pages
Edition : 1st
Language : English
ISBN-13 : 9781847193117
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 212.97
Alfresco 4 Enterprise Content Management Implementation
$68.99
Alfresco 3 Records Management
$74.99
Alfresco Developer Guide
$68.99
Total $ 212.97 Stars icon

Table of Contents

9 Chapters
The Alfresco Platform Chevron down icon Chevron up icon
Getting Started with Alfresco Chevron down icon Chevron up icon
Working with Content Models Chevron down icon Chevron up icon
Handling Content Automatically with Actions, Behaviors, Transformers, and Extractors Chevron down icon Chevron up icon
Customizing the Web Client User Interface Chevron down icon Chevron up icon
Exposing Content through a RESTful API with Web Scripts Chevron down icon Chevron up icon
Advanced Workflow Chevron down icon Chevron up icon
Web Content Management Chevron down icon Chevron up icon
Security Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(7 Ratings)
5 star 71.4%
4 star 0%
3 star 0%
2 star 14.3%
1 star 14.3%
Filter icon Filter
Top Reviews

Filter reviews by




Kindle Customer Dec 12, 2008
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If you have been looking for a technical book on how to develop applications on top of the Alfresco platform, this is it. Jeff wastes little time introducing abstract content management concepts or explaining the user interface, he digs right into setting up your local development environment. I like this approach but it assumes a solid foundation in both ECM and Java - if you don't have one, there are plenty of other books to start with. The expectation of some baseline knowledge saves the book from getting bogged down with introducing Spring, jBPM, and many of the other popular Java frameworks and components that make up Alfresco.The book is written with a bias toward the document management end of the ECM spectrum but that makes sense for a book about Alfresco. Only one chapter (out of 9) is devoted to Alfresco's WCM component. The core strength of book is how it teaches developer to build <em>dynamic web applications and services that access documents from the Alfresco repository</em> (which may be the core strength of Alfresco too). There is great coverage on Alfresco's Web Scripts framework with plenty of interesting examples that showcase the flexibility of the platform. For example, there is a nice description of how to create an AJAX document rating widget you could put on another website.Jeff's writing style is both thorough and readable. He has a nice technique of pulling up and explaining details in "What Just Happened?" sections. This allows him to run cleanly through a topic and then summarize and discuss some of the nuances of the steps.Unfortunately for Jeff, his book (which covers 2.2 of the Enterprise Edition) came out right around the time version 3.0 was released. However, since he writes mainly about the API level, the book will stay relevant and accurate longer (Luckily API's can't change as fast as user interfaces). So, if you are a Java developer and are considering using Alfresco for building a "document centric web application," this book will help.
Amazon Verified review Amazon
Daniel Gradecak Dec 17, 2008
Full star icon Full star icon Full star icon Full star icon Full star icon 5
You think you are an Alfresco expert ... well, read this book and think again. This is actually my conclusion and I was thinking about only having that sentence in this review, because while reading this you are wasting your precious time as you could read the Alfresco Developer Guide.For sure this is not a book for "Java enterprise" novice people and some knowledge and understanding of the Java enterprise stack is required to fully enjoy your reading time. Since I am working with Alfresco for more than 3 years now, I had some development habits that sometimes were not that good, which I realized after reading this book.You know or you heard about JBPM, the workflow engine Alfresco is using, it is not a problem, a complete guide is explaining all you need to know to start writing your own flow and to get it deployed. Creating your application model, customizing actions, localizing your messages ... nothing is a secret any more.If you want to learn how to get all the benefits out of your "electronical" content then check out the "chapter 4" and see how to add your own content extraction, create business specific content transformation or use Alfresco's Java behavior cut points. After all, an enterprise solution should be able to provide easy integrations with other systems, especially for SSO and LDAP - you want it, Alfresco's has it, Jeff Potts explains it.If you are still fan of JSF than you could learn how to customize the default Alfresco User Interface, which is JSF based or learn how to write a custom UI using the webscript framework.Jeff also helps you to bring some best practices in your Alfresco development and deployment lifecycle. However, I would prefer to see some more words about Alfresco Module Packages.This book was published just before Alfresco 3.0 Enterprise edition was released and is based on Alfresco 2.2 and 3.0 Labs (or community version). Alfresco did some refactoring but nothing was changed that should bother you. Do not be afraid of getting the book as this is probably the best Alfresco book written for developers by a, more than professional, developer.Alfresco's ECM capabilities are explained by example but you would like to see Alfesco's WCM possibilities, simply check the "chapter 8" and you will find anything you need to start using it.Do you still think you are an expert ? :) I do not ...
Amazon Verified review Amazon
Victor A Mar 03, 2009
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is fantastic. The amount of information and examples is overwelming. I think is the best book I have ever read. A must-have
Amazon Verified review Amazon
Pawan Kumar Jan 30, 2009
Full star icon Full star icon Full star icon Full star icon Full star icon 5
While Alfresco by Munwar Shariff got you started with Alfresco, Alfresco Developer Guide by Jeff Potts gets you going. The first book provides good overview of the breadth of features and Alfresco Developer Guide dives deep into customization for Alfresco-based solutions. Content management is a general requirement but its applications vary significantly. Without accommodating the specific needs of the business, a content management system (CMS) would usually be little more than a glorified file system.As I started reading the book, it quickly became evident that the author had significant hands-on experience with customizing Alfresco. The book has detailed examples with code and screenshots. The step-by-step directions with practical advice and recommendations make it easy to follow. The book uses Alfresco 2.2 Enterprise and 3.0 Labs versions. In one sentence, I would characterize this book as an illustrated handbook for customizing Alfresco.The book starts with a description of the Alfresco Platform. This includes overview of content management, the architecture of Alfresco-based solutions, the example used throughout the book, and various kinds of customizations that can be done with Alfresco. It is followed by directions for setting up an Alfresco development environment using Eclipse. Detailed discussion of customization starts with creating custom models - which includes types, associations, and aspects. The UI changes and programmatic access to go with custom content model are also discussed. Automated processing of content with actions, behaviors, transformers, and extractors is discussed next. Web client customization discusses how to adapt the UI for specific needs. The book also discusses implementation of RESTful API using Web Scripts. Workflows are an important feature of content management systems. The book discusses implementation of advanced workflows using jBPM. jBPM enables you to implement complex workflows within Alfresco platform. Web Content management is a popular and common application of content management systems. The book discusses web content management on Alfresco using Alfresco WCM. The book concludes with a discussion on security, including incorporating Alfresco in a Single-Sign-On solution. The appendix includes API reference and examples.Given my experience with EMC Documentum, I couldn't help but compare the details with how I do things with Documentum. This book provided the depth to make such a comparison possible. One would normally use this book as a reference to jump to the task at hand and follow a step-by-step example. If you need to understand the breadth, you can skip over example details and read it in a flow. However, in my opinion, the best value provided by this book is in terms of best practices and practical advice which is hard to find in product documentation.The author does not skimp on sharing practical advice. A fundamental advice is around separation of solution files from Alfresco files. The author also discusses various options for packaging and deployment of customizations. The troubleshooting tools and practices discussed would benefit any Alfresco developer. Modeling best practices are also very important since the custom content model is usually the foundation of a custom solution on Alfresco. When creating a solution for a large organization, advice about handling large directories for user/group synchronization would be handy. Other tips such as dealing with cross-domain scripting limitation and implementing Single-Sign-On also add value.I think that it is a great book for people who are already working with Alfresco or another content management system. Readers new to the content management space may need a gentler introduction to the concepts and to Alfresco before they can derive maximum value out of this book.ConclusionEven if you had the expertise to write this book, you might want to keep a copy handy if you frequently implement solutions using Alfresco. If you are new to Alfresco this book is even more valuable. If you are new to content management in general then you may want to ramp up with some other resources before making the best use of this book.
Amazon Verified review Amazon
Ugo Cei Dec 24, 2008
Full star icon Full star icon Full star icon Full star icon Full star icon 5
"Alfresco Developer Guide", by Jeff Potts, is the second title about Alfresco recently published by Packt Publishing, after Alfresco Enterprise Content Management Implementation , by Munwar Shariff, that was published almost two years ago.For those who don't know, Alfresco is the leading Open Source Enterprise Content Management system and is rapidly gaining acceptance in many enterprises, thanks to its rich feature set and ease of implementation.Given the brisk pace of development of the product over the recent months, a new volume on Alfresco was eagerly awaited by many. This one mostly covers Alfresco 2.2, with some mentions about the new features introduced in version 3.0, whose official release happened shortly after the book was published. So it hit the shelves with a bit of unfortunate timing, but luckily none of the content of the book is to be considered obsolete, as all the APIs that used to work with 2.2 still work with 3.0. Still, a bit more coverage of 3.0 would have been great, but we can hope that maybe more will be added in a second edition.Speaking of the content that is in this edition, readers will be able to find in-depth coverage of almost all aspects of the Alfresco platform, from a developer point of view. The target audience of the book is indeed developers who want to customize and extend Alfresco, and create new applications on top of it. Good overviews of content modeling, Web Client (Alfresco's own web-based management console) customizations, behaviors, transformers and extractors, Web Scripts, advanced workflows, and security are provided, with plenty of detailed examples of configurations and API usage.A long chapter is dedicated to the Web Content Management (WCM) add-on product and the book closes with appendixes containing a concise reference of APIs and configuration properties. Thankfully, the author and the publisher did not opt for including a complete reprint of the APIs in order to beef up the page count. Instead, a list of the main Java classes and Javascript root objects is provided, but developers will have to refer to the online documentation for a complete reference.A section of this reference that many readers will find to be extremely useful is a detailed description of the Lucene search syntax. On the other hand, page 271 talks about a Surf API reference to be found in the appendix, but there isn't one there. Surf is the new web application framework included in version 3, so they probably couldn't find the time to provide some documentation for it in time for publishing. As I wrote above, this is understandable, given the timing, but let's hope the second edition amends these shortcomings.My overall judgment of the book is definitely positive, anyway. The author does an excellent job of maintaining a good balance between breadth and depth, and the narrative of each chapter manages to capture well the attention of the reader, guiding him from simple concepts to more complex scenarios in a very natural progression. Readers are expected to have a good working knowledge of Java, XML, and Java web application development. Some basic knowledge of Javascript will be useful too.If I have a specific complaint about the content is that the index is too thin and many concepts are not referenced there. This is a defect that does not compromise the overall usefulness of the book, however.The author, Jeff Potts, is an accomplished ECM consultant and long-time Alfresco expert. You can read more from him at his website [...]
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon