30th Jul, 2009

Alfresco Developer Guide source reorg and 3.2 Community update

[UPDATE: Added a link to the source code that works with 3.2 Enterprise]

I originally wrote the Alfresco Developer Guide source code for Alfresco 2.2 Enterprise and Alfresco 3 Labs. The code was pretty much the same regardless of which one you were running. For things that did happen to be different, I handled those with separate projects: one for community-specific stuff and one for enterprise-specific stuff. This was pretty much limited to minor web script differences for the “client extensions” projects and LDAP configuration differences for the “server extension” project.

With the release of 3.2 Community, I realized:

  • The number of different flavors of Alfresco any given reader might be running are going up, not down. Who knows when 2.2 Enterprise will be sunset.
  • It is no longer as easy as “Enterprise” versus “Labs/Community” because multiple releases of the same flavor are prevalent (2.2E, 3.0E, and 3.1E, for example).
  • Tagging my code in Subversion by Chapter alone is no longer enough–I need to tag by Chapter and by Alfresco version.
  • Sending the publisher the code one chapter at-a-time and expecting them to manage updates and deciding how to organize all of the chapter code was a bad idea.

So, I’ve done some work to make this better (reorg the projects, restructure the download files). I’ve also tested the example code from each chapter against the latest service packs for all releases since 2.2 Enterprise. That includes making some small updates to get the examples running on 3.2 Community.

You can now download either all of the source for every version I tested against, or, download the source that works for a specific version. It may take the official download site at Packt a while to get the new files, so here are links to download them from my site:

Alfresco Developer Guide example source code for…

  • Alfresco 2.2 Enterprise (~5.3 MB, Download)
  • Alfresco 3.0 Labs (~5.6 MB, Download)
  • Alfresco 3.0 Enterprise (~5.7 MB, Download)
  • Alfresco 3.1 Enterprise (~5.6 MB, Download)
  • Alfresco 3.2 Community (~5.7 MB, Download)
  • Alfresco 3.2 Enterprise (~5.9 MB, Download)
  • All of the above, combined (~28.1 MB, Download)

Hopefully this makes it easier for you to grab only what you need and makes it clear that each Eclipse project contains only what’s needed to work with that version of Alfresco. Deployment is easier too. Most of the time, it’s just the “someco-client-extensions” project that you deploy.

Now that I’ve got everything structured like I want it, as new versions of Alfresco are released, it should be much easier to keep up.

Responses

Jeff,

Thank you for updating your sample code to the latest version, and separating the code into version-specific releases. I appreciate the efforts of an author to keep a book relevant — and thus useful to readers — when the targeted platform keeps evolving.

-Tom

Hi Jeff,

congratulations also from my part! i pay high tribute to your travails in the alfresco project, which are so helpful to get the volatile elephant under control!

after one year working intensely with Alfresco i must say, the complexity of the code and configuration, together with the half-hearted modularization (restart for nearly every extension!) makes one pay a high price for the conceptional ingeniousness. for this reason people like you are so important for the community!

Thanks a lot for sharing your knowledge!!

Dirk

I’m trying to learn how to develop and deploy workflows in Alfresco’s WCM module using your book.

I downloaded your sample code for enterprise 3.1 and followed the instructions in your readme, but the workflow is not visible in alfresco.

I can make the workflow appear by adding a workflow deployer spring bean in a context file. Did you forget to document a step?

Thanks,

— Mike

You have three primary choices when deploying workflows, all of which are in the book:
* You can use the workflow console (p.285),
* Use a spring bean in the context file (p.294), as you noted,
* You can deploy using the deploy tab on the JBoss Graphical Process Designer Eclipse plug-in (p.286, p.291), which is my favorite approach during development.

You can also use Ant or the jBPM API which I mention (p.294) but don’t show examples of because they don’t seem common, at least for Alfresco projects.

In any case, thanks for reading and I’m glad you got yours working!

Jeff

[...] to be compatible with the recent 3.2 Enterprise release of Alfresco. You can get the link from my original post on the source code re-org, or download it [...]

Hi Jeff,

I’ve been going through your book. It’s a very good resource. The step by step approach is great!

I’m having a problem though and can’t figure out what I’m doing wrong. In chapter 4, there’s a bean created called “policyLogger”

However, when I start Tomcat, I get an error stating that opsDoc has not been added to the dictionary model. But, I’m see it in the scModel.xml file and all my other dictionary definitions are loading fine. Can you shed some light for me please?

BTW, I tried adding to the bean definition depends-on”someco.dictionaryBootstrap”. When I did that, Tomcat did not complain and I was able to get into Alfresco, but the behavior is not running when I create a sc:opsDoc (I confirmed log4j.prop is set correctly to debug… but no messages).

I’m really excited about getting through your book. Thanks so much for a great product.

Best,
Al

Nevermind. I did fix it with the depends-on attribute. FYI, the way the code is written right now, Spring tries to load the PolicyLogger bean before the someco.dictionaryBootstrap. if you modify the PolicyLogger bean as follows, it works:

[code]

[/code]

The reason I was not seeing the debug logs was due to my log4j.property file being in two places. I inadvertently updated the wrong log4j.property file. However, without the “depends-on” attribute added to the bean above, I was getting Tomcat errors. Now it all works!

Thanks again for a great book, Jeff. I am starting to get a feel for the power of Alfresco. I wake every day excited to become a little more proficient with Alfresco via your step by step book.

Best,
Al

I guess it does not like the [code][/code] tags as I’m not seeing the bean in my code. Oh well, here it is again if anyone stumbles across it:

That will get rid of your “opsDoc Class does not exist in the dictionary model” exception.

bean id=”policyLogger” class=”com.someco.behaviour.PolicyLogger” init-method=”init” depends-on=”someco.dictionaryBootstrap”

Al,

Thanks for reading the book and the blog and for posting your fix!

Jeff

Hello,

I’m trying to run your code from the chapter 4. After deployment I start Alfresco server and it gaves an exception about not finding pdfbox and log4j. The two jars are in WEB-INF/lib.. so what I’m missing?

Thanks!

Right, those JARs should be there. What version of Alfresco are you running?

Hello,

I’m running Alfresco 3.2r2 Community.
I’m trying to implement a listener to integrate with another system that will be triggered when a file (or folder) is created, deleted, updated and versioned. I’ve follow your steps to create a behaviour and bind to policies. However, if I bind the “onCreateVersion”, the version system stops working giving this error on the web interface when I try to access a version of the document:

The node’s content is missing:
node: versionStore://version2Store/832c5cae-d7e8-4945-96db-5cbb3169b0b9
reader: null
Please contact your system administrator.

On the javadoc of the method there’s this warning:

WARNING: implementing behaviour for this policy effects the versioning behaviour of the type the behaviour is registered against.

How can I make this work right?

Thanks for your time,

Pedro Saraiva

Pedro,

I’ve never bound anything to onCreateVersion so I don’t know for sure how well it does/doesn’t work. I wonder if Alfresco already has something bound to that behavior and is doing something with the node before you get a chance to do anything with it. It looks like the node you’re getting is pointing to the version store. Is there a way you could get the workspace node and work with that instead? I’m just taking a few wild guesses here. You’ll probably have better luck in the forums on this one.

Jeff

You may have figured this out already but between 3.2 Community and 3.2R Community, Alfresco upgraded pdfbox to the Apache incubating version. If you change the SomeCo extracter classes to point to org.apache.pdfbox instead of org.pdfbox, that will address the pdfbox problem. The other change is that log4j is no longer being distributed with the SDK or the web app. You can grab log4j-1.2.15.jar and place it in the SDK’s library for compile purposes and WEB-INF/lib for run-timer purposes.

Jeff

Leave a response

Your response:

Categories