wabson

New 4.0 features for Share Import-Export

Blog Post created by wabson Employee on Oct 12, 2011
If you've not come across the project before, Share Import-Export provides a set of Python scripts to export sites and their supporting data into a standardised structure based on ACP and JSON, and can also then import these definitions into another Alfresco system. As well as the scripts, a set of sample sites from the Alfresco Cloud Trial are provided to help you get started.



With version 1.3 of Share Import-Export fresh out of the door, I wanted to post a quick update on the changes in this version, which are designed to provide even more options for those early adopters of Alfresco 4.0. So you can read on for more details, or download the new version straight away.



Tag support



The first major addition is the new support for importing and exporting the tags associated with site content. Share sites just look more complete with tags populated, so this has been on the list for a little while.



Unfortunately the ACP format used doesn't currently allow tag definitions to be embedded in exports of site content, but tag information can be easily pulled out in JSON format and this can be easily persisted to an additional file alongside the ACP.



You should see this if you run export-site.py with the --export-tags option, and I've also added tag data for the sample sites in the package, so you should see the definitions in the data folder too.



When importing sites with import-site.py, again the tag definitions aren't yet included by default, but you can include these using the the --import-tags option.



The idea is that this will help when demonstrating Alfresco Share in 4.0, but it's not limited to that version and works well with 3.4 in my own tests. So please do try this out and post your feedback.



Bootstrap your sites



The second improvement is specific to 4.0, but allows sites that you've exported using the scripts to be packaged up as bootstrappable components - complete with Spring configuration - inside a single JAR file, which can be automatically imported when Alfresco is started up.



The format used is the same as the Web Site Design Project site, first introduced in Alfresco Team, and also included in Alfresco 4.0, which provides the default sample content. So you can install additional users and sites alongside the out-of-the-box site, or completely replace it. (Look for the bean with id patch.siteLoadPatch.swsdp in the patch-services-context.xml file in WEB-INF/classes/alfresco/patch inside the Alfresco webapp, which you can comment out to disable the default site)



[caption id='attachment_394' align='alignnone' width='408' caption='Bootstrap your own site definitions alongside the default sample site'][/caption]



Of course you can also continue to import sites manually using the import-site.py script, but if you're distributing Alfresco instances to others (say a demo package used across your sales team) then the bootstrap packages can be useful to automatically import the sites when Alfresco is started up.



To package up a site in this format, you must previously have exported the site from Alfresco into the normal local structure using export-site.py. You can then point the new script create-bootstrap-package.py to this local definition and tell it the name of the JAR file to produce, containing the bootstrap components, for example

python create-bootstrap-package.py data/sites/branding.json sample-branding-site.jar --users-file=data/cloud-users.json


You should find that this builds a JAR file named sample-branding-site.py in the current directory, using the contents of the Company Rebranding site from the bundled cloud trial sites. If you have problems, or you want to know what other options, type  create-bootstrap-package.py --help for more information.



Other improvements



Lots of bug fixes and small improvements have gone into this release, based on testing across various versions of Alfresco from 3.2 to 4.0.



Download packages



If you check out the downloads page you'll see that there's now a choice of packages there. The full 54MB package, with scripts and full Green Energy sample sites and users, is still recommended for most users and is linked to from the home page. However, you can also grab a version with just the scripts plus user data (8MB), or with just the scripts themselves and no sample data (61kB). If you don't need the full sample data, you might find one of these smaller packages useful.



Download Share Import-Export from Google Code

Attachments

Outcomes