<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mostly Tech - Ray Gauss II</title>
	<atom:link href="http://rgauss.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://rgauss.com</link>
	<description>Enterprise Java, Open Source Integration, and the Occasional Rant</description>
	<lastBuildDate>Tue, 18 Dec 2012 17:42:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='rgauss.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Mostly Tech - Ray Gauss II</title>
		<link>http://rgauss.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rgauss.com/osd.xml" title="Mostly Tech - Ray Gauss II" />
	<atom:link rel='hub' href='http://rgauss.com/?pushpress=hub'/>
		<item>
		<title>Adding Document Library Views to Alfresco Share</title>
		<link>http://rgauss.com/2012/08/08/adding-document-library-views-to-alfresco-share/</link>
		<comments>http://rgauss.com/2012/08/08/adding-document-library-views-to-alfresco-share/#comments</comments>
		<pubDate>Wed, 08 Aug 2012 12:54:16 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Alfresco]]></category>
		<category><![CDATA[Interface]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=596</guid>
		<description><![CDATA[Overview In this post we&#8217;ll go through how to develop and deploy additional view types beyond the default simple and detailed views in the document library in Share. The techniques here require Alfresco 4.0.2 or later, or a recent checkout of community HEAD. The Document Library Component We won&#8217;t go into all the details on how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=596&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h4>Overview</h4>
<p>In this post we&#8217;ll go through how to develop and deploy additional view types beyond the default simple and detailed views in the document library in Share.</p>
<p>The techniques here require <strong>Alfresco 4.0.2</strong> or later, or a recent checkout of <a href="http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/" target="_blank">community HEAD</a>.</p>
<h4>The Document Library Component</h4>
<p>We won&#8217;t go into all the details on how the document library is rendered but it&#8217;s a fairly standard webscript-based component with &#8216;server-side&#8217; resources like FreeMarker files for HTML fragments, Javascript for manipulating the data model, and localization properties files, and &#8216;client-side&#8217; resources sent to the browser like CSS and Javascript.</p>
<p>While adding a document library view will involve changes to both client-side and server-side tiers, most of our notable changes will be to client-side Javascript files sent to the browser. The server-side webscripts changes are primarily to load and instantiate the client-side objects.</p>
<p>The component we&#8217;re interested in is at:<br />
<a href="http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/slingshot/config/alfresco/site-webscripts/org/alfresco/components/documentlibrary/" target="_blank"><code>alfresco/site-webscripts/org/alfresco/components/documentlibrary/documentlist.*</code></a></p>
<p>and note that within that directory resources from <a href="http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/slingshot/config/alfresco/site-webscripts/org/alfresco/components/documentlibrary/include/" target="_blank"><code>include/documentlist.*</code></a> are included by some of the primary files.</p>
<h4>DocumentList and DocumentListViewRenderer</h4>
<p>The <strong><code>DocumentList</code></strong> Javascript object makes up the bulk of the document library view and is defined in the client-side <a href="http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/slingshot/source/web/components/documentlibrary/documentlist.js" target="_blank"><code>documentlist.js</code></a> file along with event handler methods and other display setup. The <code>DocumentList</code> object sets up a <a href="http://developer.yahoo.com/yui/" target="_blank">YUI</a> <a href="http://developer.yahoo.com/yui/datatable/" target="_blank">DataTable</a> which handles most of the work of AJAX calls, pagination, etc.</p>
<p>Each column in the DataTable is assigned a method which dictates how to render that column given the data row.  For example, the DataTable calls <strong><code>DocumentList.fnRenderCellThumbnail</code></strong> for the &#8217;thumbnail&#8217; column of each row it renders.</p>
<p>The DocumentList also contains a set of registered <strong><code>DocumentListViewRenderers</code></strong>, &#8216;<code>simple</code>&#8216; and &#8216;<code>detailed</code>&#8216; by default, which do the work of generating the HTML for their view type. In other words, <code>DocumentList.fnRenderCellThumbnail</code> actually determines the current view renderer based on the current <code>viewRendererName</code> and hands off its work to <strong><code>DocumentListViewRenderer.renderCellThumbnail</code></strong>.</p>
<p style="text-align:center;"><a href="http://raygauss.files.wordpress.com/2012/05/document-library-views-diagram.png"><img class="aligncenter  wp-image-656" title="document-library-views-diagram" src="http://raygauss.files.wordpress.com/2012/05/document-library-views-diagram.png?w=480" alt="" width="480" /></a></p>
<p>This allows developers to create their own objects which extend and override the <code>DocumentListViewRenderer</code> with methods for their specific needs.</p>
<p>For this example our goal will be to add a view which is very similar to the existing detail view but with larger thumbnails.</p>
<h4>Steps to Add a View</h4>
<h4></h4>
<h5>Define the View</h5>
<p>For a new view we need to define a new <code>DocumentListViewRenderer</code> object.  That customization could be just a new instance of the base <code>DocumentListViewRenderer</code> with a different name so that alternate CSS is applied and metadata rendered.</p>
<p>The <strong>name of the view renderer</strong> specified in the constructor is <strong>used for CSS class names</strong> among other things so a simple example of adding a second detailed view with a larger thumbnail might look like:</p>
<p><pre class="brush: jscript;">
new Alfresco.DocumentListViewRenderer(&quot;large&quot;);
</pre></p>
<p>In more complex scenarios you probably want to extend <code>DocumentListViewRenderer</code> in a client-side <a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/blob/master/src/main/resources/META-INF/alfresco-share-doclib-views-example/components/documentlibrary/documentlist-custom.js" target="_blank"><code>documentlist-custom.js</code></a> file, which is what we&#8217;ll do in this example.</p>
<p>First we want to define a constructor:</p>
<p><pre class="brush: jscript;">
Alfresco.DocumentListLargeViewRenderer = function(name)
{
   Alfresco.DocumentListLargeViewRenderer.superclass.constructor.call(this, name);
   // Defaults to large but we'll copy the metadata from detailed view
   this.metadataBannerViewName = &quot;detailed&quot;;
   this.metadataLineViewName = &quot;detailed&quot;;
   this.thumbnailColumnWidth = 200;
   return this;
};
</pre></p>
<p>then make it extend from DocumentListViewRenderer:</p>
<p><pre class="brush: jscript;">
YAHOO.extend(Alfresco.DocumentListLargeViewRenderer, Alfresco.DocumentListViewRenderer);
</pre></p>
<p>and we&#8217;ll override the <code>renderCellThumbnail</code> method with almost the same code in the detail view, but adding a <code>documents-large</code> CSS class to the thumbnail container and changing the call to <code>generateThumbnailUrl</code> to use the <code>imgpreview</code> thumbnail definition:</p>
<p><pre class="brush: jscript;">
Alfresco.DocumentList.generateThumbnailUrl(record, 'imgpreview')
</pre></p>
<p>(<a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/blob/master/src/main/resources/META-INF/alfresco-share-doclib-views-example/components/documentlibrary/documentlist-custom.js" target="_blank">Full code</a>)</p>
<h5>Register the View</h5>
<p>Once the view renderer has been defined it needs to be <strong>registered</strong> with the <code>DocumentList</code> object via its <strong><code>registerViewRenderer</code></strong> method.  This needs to be done after the <code>DocumentList</code> object has been created and setup, so a good place to perform the registration is after the YUI Bubbling Event <code>postSetupViewRenderers</code> has fired.  To register the same view above:</p>
<p><pre class="brush: jscript;">
YAHOO.Bubbling.subscribe(&quot;postSetupViewRenderers&quot;, function(layer, args) {
   var scope = args[1].scope;
   var largeViewRenderer = new Alfresco.DocumentListLargeViewRenderer(&quot;large&quot;);
   scope.registerViewRenderer(largeViewRenderer);
});
</pre></p>
<h5>Accessing the View</h5>
<p>The user has to be able to navigate to this new view and even though we&#8217;ve registered it, the <code>DocumentList</code> needs to know which view renderers are enabled and in what order, both of which are defined in the DocumentList&#8217;s options under <strong><code>viewRendererNames</code></strong>.  We can add our custom view above to the server-side FreeMarker model:</p>
<p><pre class="brush: jscript;">
model.viewRendererNames.push(&quot;large&quot;);
</pre></p>
<p>Note that the name here must match the name of the view renderer constructor.</p>
<p>Not only does this define that the &#8216;<code>large</code>&#8216; view is enabled, the navigation buttons are also rendered from this <code>viewRendererNames</code> list, so we&#8217;ve taken care of the interface as well.</p>
<h5>CSS</h5>
<p>Our overridden <code>renderCellThumbnail</code> method above adds the <code>documents-large</code> CSS class so we&#8217;ll need to define that, as well as the display of the view selection button.  Here&#8217;s a portion of the <a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/blob/master/src/main/resources/META-INF/alfresco-share-doclib-views-example/components/documentlibrary/documentlist-custom.css" target="_blank"><code>documentlist-custom.css</code></a> file:</p>
<p><pre class="brush: css;">
.doclist .thumbnail.documents-large {
	height: 200px !important;
	width: 200px !important;
}
.doclist .thumbnail.documents-large img {
    max-width: 280px;
}
</pre></p>
<h4>Packaging</h4>
<p>There are of course a number of ways this code could be packaged and deployed but this type of customization lends itself particularly well to a share extensibility module which <a href="http://blogs.alfresco.com/wp/ewinlof/" target="_blank">Erik Winlöf</a> and <a href="http://blogs.alfresco.com/wp/ddraper/" target="_blank">David Draper</a> have blogged about in detail.  We&#8217;ll assume a standard Maven or <a href="https://github.com/AlfrescoLabs/alfresco-gradle-plugins" target="_blank">Gradle</a> Java project layout for the code, and to keep things simple the example deploys as a Share jar rather than an <a href="https://wiki.alfresco.com/wiki/AMP_Files" target="_blank">AMP</a>.</p>
<h5>Server-side Resources</h5>
<p>We need to define the customization itself:</p>
<p><a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/blob/master/src/main/resources/alfresco/site-data/extensions/custom-view-renderer.xml" target="_blank"><code>src/main/resources/alfresco/site-data/extensions/custom-view-renderer.xml</code></a></p>
<p><pre class="brush: xml;">
&lt;extension&gt;
    &lt;modules&gt;

        &lt;module&gt;
            &lt;id&gt;Example :: Document List Custom View&lt;/id&gt;
            &lt;auto-deploy&gt;true&lt;/auto-deploy&gt;
            &lt;customizations&gt;
                &lt;customization&gt;
                    &lt;targetPackageRoot&gt;org.alfresco&lt;/targetPackageRoot&gt;
                    &lt;sourcePackageRoot&gt;com.example.alfresco-share-doclib-views-example&lt;/sourcePackageRoot&gt;
                &lt;/customization&gt;
            &lt;/customizations&gt;
        &lt;/module&gt;

    &lt;/modules&gt;
&lt;/extension&gt;
</pre></p>
<p>We could place the <strong>javascript which creates the new view renderer</strong> a number of places, even purely client-side, but as we&#8217;ll see in another post it can be handy to have access to the FreeMarker data model so we&#8217;ll place it in:</p>
<p><a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/blob/master/src/main/resources/alfresco/site-webscripts/com/example/alfresco-share-doclib-views-example/components/documentlibrary/documentlist.get.html.ftl" target="_blank"><code>src/main/resources/alfresco/site-webscripts/com/example/alfresco-share-doclib-views-example/components/documentlibrary/documentlist.get.html.ftl</code></a></p>
<p>Note that the the wrapping <a href="http://blogs.alfresco.com/wp/ddraper/2012/05/24/customizing-share-javascript-widget-instantiation-part-2/" target="_blank"><code>&lt;@markup&gt;</code> directive</a> there indicates that we want to inject the Javascript <strong>after</strong> <code> documentListContainer</code>.</p>
<p>We&#8217;ll place the <strong>server-side webscript javascript</strong> which enables the view at:</p>
<p><a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/blob/master/src/main/resources/alfresco/site-webscripts/com/example/alfresco-share-doclib-views-example/components/documentlibrary/documentlist.get.js" target="_blank"><code>src/main/resources/alfresco/site-webscripts/com/example/alfresco-share-doclib-views-example/components/documentlibrary/documentlist.get.js</code></a></p>
<p>which will get its <strong>label from the localization file</strong> at:<br />
<a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/blob/master/src/main/resources/alfresco/site-webscripts/com/example/alfresco-share-doclib-views-example/components/documentlibrary/documentlist.get.properties" target="_blank"><code>src/main/resources/alfresco/site-webscripts/com/example/alfresco-share-doclib-views-example/components/documentlibrary/documentlist.get.properties</code></a></p>
<h5>Client-side Resources</h5>
<p>For including client-side CSS, Javascript, and image resources in a jar we&#8217;ll place them in the META-INF dir at:<br />
<a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/tree/master/src/main/resources/META-INF/alfresco-share-doclib-views-example/components/documentlibrary" target="_blank"><code>src/main/resources/META-INF/alfresco-share-doclib-views-example/components/documentlibrary/*</code></a></p>
<p>So at this point <a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example/tree/master/src/main/resources" target="_blank"><code>src/main/resources</code></a> should look like:</p>
<p><a href="http://raygauss.files.wordpress.com/2012/08/doclib-views-project-structure.png"><img class="alignnone size-full wp-image-694" title="doclib views project structure" src="http://raygauss.files.wordpress.com/2012/08/doclib-views-project-structure.png?w=595" alt=""   /></a></p>
<p><a href="https://github.com/AlfrescoLabs/alfresco-share-doclib-views-example#building-and-installing" target="_blank">Package that as jar</a> or AMP and deploy to your Share instance.</p>
<h4>Results</h4>
<p>The next time you go to a site&#8217;s document library you should see the additional<br />
button for your view and the larger thumbnails:</p>
<p><a href="http://raygauss.files.wordpress.com/2012/08/doclib-example-screenshot.png"><img class="alignnone size-full wp-image-697" title="doclib example screenshot" src="http://raygauss.files.wordpress.com/2012/08/doclib-example-screenshot.png?w=595" alt=""   /></a></p>
<p>Since we implemented this as a standard extensibility module you can completely disable it by going to your Share deployment&#8217;s module management page at something like <code><a href="http://localhost:8080/share/page/modules/deploy" rel="nofollow">http://localhost:8080/share/page/modules/deploy</a></code> and disable the module.</p>
<h4>What&#8217;s Next?</h4>
<p>I&#8217;ll go into more advanced customizations in future posts, but in the meantime, <strong>what kind of doclib view are you going to build?</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/596/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/596/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=596&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2012/08/08/adding-document-library-views-to-alfresco-share/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>

		<media:content url="http://raygauss.files.wordpress.com/2012/05/document-library-views-diagram.png" medium="image">
			<media:title type="html">document-library-views-diagram</media:title>
		</media:content>

		<media:content url="http://raygauss.files.wordpress.com/2012/08/doclib-views-project-structure.png" medium="image">
			<media:title type="html">doclib views project structure</media:title>
		</media:content>

		<media:content url="http://raygauss.files.wordpress.com/2012/08/doclib-example-screenshot.png" medium="image">
			<media:title type="html">doclib example screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>My Mullet Business Card</title>
		<link>http://rgauss.com/2011/09/02/my-mullet-business-card/</link>
		<comments>http://rgauss.com/2011/09/02/my-mullet-business-card/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 20:35:16 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=570</guid>
		<description><![CDATA[I recently had to redesign my business card and decided to take a step back and think about the different functions it serves at different times. What resulted was my new mullet cards: business in the front, party in the back. A business card can be much more than just a means to contact you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=570&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I recently had to redesign my business card and decided to take a step back and think about the different functions it serves at different times. What resulted was my new mullet cards: <strong>business in the front, party in the back</strong>.</p>
<p><img class="alignnone size-medium wp-image-571" title="IMG_4768" src="http://raygauss.files.wordpress.com/2011/09/img_4768.jpg?w=540" alt="" width="540" /></p>
<p>A business card can be much more than just a means to contact you at a later time.</p>
<h4>It&#8217;s a way to connect with people on a personal level</h4>
<p><span class="Apple-style-span" style="font-weight:normal;">At networking events I notice that people often<strong> jump to the address</strong> when handed a business card in order to strike up a conversation about people or places they know near there.  There&#8217;s a good chance <strong>we have a lot more in common than that</strong> so I threw several work and personal interests in a sort of thin word cloud.  Maybe they&#8217;re an avid cyclist, maybe they&#8217;ve just started coworking, or maybe they want to blow off this networking event and go get a good beer.</span></p>
<h4>Who the hell was this and why do I have their card?</h4>
<p>If I don&#8217;t process (I use <a href="http://cardmunch.com" target="_blank">CardMunch</a>) the cards I&#8217;ve collected at an event with 24 hrs (which I usually do) I often can&#8217;t place a person by their name or company alone if I didn&#8217;t have more than a brief conversation with them.  My interests might help someone recall who handed them the card, but a <strong>face</strong> will almost certainly do the trick.  Realtors usually have a headshot on their cards, why shouldn&#8217;t I?</p>
<h4>Use QR codes wisely</h4>
<p><a href="http://en.wikipedia.org/wiki/QR_code" target="_blank">QR codes</a> are meant to <strong>ease entry and access for mobile devices</strong>.  Often people put all of their contact info in one QR code in something like a <a href="http://en.wikipedia.org/wiki/VCard" target="_blank">vCard</a> format, which can work, but when you try to put all of your information in a single code it can greatly affect the ability of QR readers recognize it, especially in bad lighting.  Even if the vCard does get captured it most often gets neatly tucked away in their address book, never to be viewed again.</p>
<p>I chose instead to go with two simple codes; one that is the URL for my <a href="http://about.me/rgauss" target="_blank">About Me</a> page, and one that is my Google Voice number.  If I&#8217;m telling someone how cool <a href="http://untappd.com" target="_blank">Untappd</a> is or discussing cycling routes they can quickly snap the About Me QR code I just handed them and get right to my Untappd or <a href="http://runkeeper.com" target="_blank">RunKeeper</a> profiles from there.  If weeks later they find my card and decide they want to chat they can snap the Call Me code which is only the phone number so most readers will just ask for a quick confirmation then dial directly, no hunting through address books.</p>
<h4>Don&#8217;t buck the trend too much</h4>
<p>The front is pretty much your traditional card with basic contact info.  Obviously not everyone knows what a QR code is, let alone how to read them, or is going to want to look at my ugly mug. Business in the front.</p>
<h4>A shout out to the printers</h4>
<p>I used <a href="http://moo.com" target="_blank">MOO</a>.  I was <strong>very impressed</strong> with the ease of submitting and verifying, speed of printing and shipping, and quality of the final product.  They did a fantastic job and I highly recommend them.</p>
<p>This was a good first pass, I&#8217;ll probably modify them a bit for the next round.  Do you have any suggestions?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/570/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/570/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=570&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2011/09/02/my-mullet-business-card/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>

		<media:content url="http://raygauss.files.wordpress.com/2011/09/img_4768.jpg?w=300" medium="image">
			<media:title type="html">IMG_4768</media:title>
		</media:content>
	</item>
		<item>
		<title>Inconsistent CMIS Query Results?  It&#8217;s not You, It&#8217;s your Locale.</title>
		<link>http://rgauss.com/2011/05/20/inconsistent-cmis-query-results/</link>
		<comments>http://rgauss.com/2011/05/20/inconsistent-cmis-query-results/#comments</comments>
		<pubDate>Fri, 20 May 2011 18:30:27 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Alfresco]]></category>
		<category><![CDATA[CMIS]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[RightsPro]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=557</guid>
		<description><![CDATA[A simple CMIS query like: was giving me a fit lately, not working at all in RightsPro&#8216;s CMIS plugin which uses OpenCMIS and yielding inconsistent results in CMIS Workbench where re-posting the same query ten times would give the expected result maybe half the time. Thanks to Florian Müller and this post, it seems as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=557&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div style="height:1em;"></div>
<p>A simple <a href="http://en.wikipedia.org/wiki/Content_Management_Interoperability_Services" target="_blank">CMIS</a> query like:<br />
<pre class="brush: sql;">
SELECT D.* FROM cmis:document AS D WHERE D.cmis:name LIKE '%Flower%' OR D.cmis:contentStreamFileName LIKE '%Flower%'
</pre></p>
<p>was giving me a fit lately, not working at all in <a href="http://rightspro.com" target="_blank">RightsPro</a>&#8216;s CMIS plugin which uses <a href="http://chemistry.apache.org/java/opencmis.html" target="_blank">OpenCMIS</a> and yielding inconsistent results in CMIS Workbench where re-posting the same query ten times would give the expected result maybe half the time.</p>
<p>Thanks to Florian Müller and <a href="http://mail-archives.apache.org/mod_mbox/chemistry-dev/201104.mbox/%3C4DAEE137.90201@alfresco.com%3E" target="_blank">this post</a>, it seems as though Alfresco doesn&#8217;t always behave as expected when the locale is set in the CMIS session.</p>
<p>Removing the locale session parameters got things working in RightsPro, but I didn&#8217;t immediately see an easy way to change the locale in a Workbench session (the log shows that it&#8217;s using a default of <code>en_US</code>), and I still don&#8217;t know what&#8217;s up with the inconsistent results there, perhaps a coincidental caching issue.</p>
<p>This was all using OpenCMIS 0.3 against Alfresco Enterprise 3.3.1 over SSL.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/557/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=557&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2011/05/20/inconsistent-cmis-query-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>
	</item>
		<item>
		<title>Searching Custom Aspects via CMIS</title>
		<link>http://rgauss.com/2011/02/12/searching-custom-aspects-via-cmis/</link>
		<comments>http://rgauss.com/2011/02/12/searching-custom-aspects-via-cmis/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 21:44:25 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Alfresco]]></category>
		<category><![CDATA[CMIS]]></category>
		<category><![CDATA[Aspects]]></category>
		<category><![CDATA[IPTC]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=531</guid>
		<description><![CDATA[I didn&#8217;t immediately see any simple, working examples of how to search custom aspect properties via CMIS so I&#8217;ll post a brief one here. The Aspect In this example we&#8217;re using a CMIS query to search for the IPTC caption property provided by the IPTC/EXIF project. After installing that module the properties are applied using [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=531&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I didn&#8217;t immediately see any simple, working examples of how to <strong>search</strong> custom aspect properties via CMIS so I&#8217;ll post a brief one here.</p>
<h4>The Aspect</h4>
<p>In this example we&#8217;re using a CMIS query to search for the IPTC <strong>caption</strong> property provided by the <a target="_blank" href="http://forge.alfresco.com/projects/iptc-exif/">IPTC/EXIF project</a>.  After installing that module the properties are applied using an aspect which is defined in <code>$ALFRESCO_HOME/WEB-INF/classes/alfresco/module/iptcexif/model/iptcModel.xml</code>.</p>
<p>Within that file you&#8217;ll see:</p>
<p><pre class="brush: xml;">
    &lt;aspects&gt;
      &lt;aspect name=&quot;iptc:iptc&quot;&gt;
</pre></p>
<h4>The Query</h4>
<p>In our case the target Alfresco repository is running enterprise 3.3.1 and aspects are implemented via JOIN syntax as very briefly <a target="_blank" href="http://wiki.alfresco.com/wiki/CMIS#Aspect_Query">stated in the wiki</a>.</p>
<p>So the resulting query for this particular search of the IPTC caption field ends up looking like:</p>
<p><pre class="brush: sql;">
SELECT D.*, IPTC.* FROM cmis:document AS D JOIN iptc:iptc AS IPTC ON D.cmis:objectId = IPTC.cmis:objectId WHERE IPTC.iptc:caption LIKE '%searchTerm%'
</pre></p>
<h4>The Changes</h4>
<p>There were big changes in Alfresco 3.4 in terms of metadata extraction and I haven&#8217;t yet had a chance to update the forge projects (or determine if they&#8217;re still even needed) and there are proposals for aspects in the next CMIS spec so I&#8217;ll be back to update this post.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/531/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=531&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2011/02/12/searching-custom-aspects-via-cmis/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>
	</item>
		<item>
		<title>MyFaces Tomahawk and the HTML BASE Tag</title>
		<link>http://rgauss.com/2010/10/26/myfaces-tomahawk-and-the-html-base-tag/</link>
		<comments>http://rgauss.com/2010/10/26/myfaces-tomahawk-and-the-html-base-tag/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 01:24:55 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=524</guid>
		<description><![CDATA[This one incited a bit of facepalm. When trying to changing part of RightsPro&#8216;s header implementation to use the HTML BASE tag the element seemed to be ignored completely and resource references were still relative to the page URL.  The tag was present, correct, and closed, but having no affect. It turns out the BASE [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=524&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This one incited a bit of facepalm.</p>
<p>When trying to changing part of <a href="http://rightspro.com" target="_blank">RightsPro</a>&#8216;s header implementation to use the <a href="http://www.w3.org/TR/REC-html40/struct/links.html#edef-BASE" target="_blank"><code>HTML BASE</code></a> tag the element seemed to be ignored completely and resource references were still relative to the page URL.  The tag was present, correct, and closed, but having no affect.</p>
<p>It turns out the <code>BASE</code> tag must appear &#8216;before any element that refers to an external source&#8217; but <a href="http://myfaces.apache.org/tomahawk/index.html" target="_blank">MyFaces Tomahawk</a> adds any script references needed immediately after the opening <code>HEAD</code> tag, rendering the <code>BASE</code> tag useless.</p>
<p>I don&#8217;t have time to modify the Tomahawk source at the moment for a proper fix but did <a href="https://issues.apache.org/jira/browse/TOMAHAWK-1555" target="_blank">submit a bug</a>.</p>
<p>As a workaround you can put the BASE tag above the head element.  It&#8217;s not valid HTML but most browsers will still obey it and render the page properly.</p>
<p>A short post, but it may save a few precious hairs from being pulled out.  I&#8217;ll update if and when the bug is resolved.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/524/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=524&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2010/10/26/myfaces-tomahawk-and-the-html-base-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>
	</item>
		<item>
		<title>Spring @Configurable With AJDT Compile-Time Weaving</title>
		<link>http://rgauss.com/2010/08/13/spring-configurable-with-ajdt-compile-time-weaving/</link>
		<comments>http://rgauss.com/2010/08/13/spring-configurable-with-ajdt-compile-time-weaving/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 21:28:54 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[ajdt]]></category>
		<category><![CDATA[aspectj]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[spring aspects]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=514</guid>
		<description><![CDATA[When using Eclipse with Spring @Configurable annotations and AJDT compile-time weaving make sure the spring-aspects.jar is in the Aspect Path tab of the AspectJ Build section of the project properties.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=514&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I know, that&#8217;s a honey of a title, but you found this didn&#8217;t you?</p>
<p>Anyways, after some house cleaning and re-organizing of the projects that make up <a href="http://rightspro.com" target="_blank">RightsPro</a> in Eclipse I found that domain objects annotated with Spring&#8217;s <code>@Configurable</code> annotation were no longer having their dependencies injected when running the app in tomcat or when running<code> AbstractTransactionalDataSourceSpringContextTests</code> unit tests.</p>
<p>Turns out I must have removed the AspectJ library during re-organization and added it back in which also seemed to wipe out the AspectJ Build settings in the project properties.  When AspectJ does its compile-time weaving it doesn&#8217;t know anything about the <code>@Configurable </code>annotation unless you <strong>add spring-aspects.jar to the Aspect Path tab in the AspectJ Build settings</strong>.</p>
<p>F yeah, magical aspects are back in business.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/514/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=514&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2010/08/13/spring-configurable-with-ajdt-compile-time-weaving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>
	</item>
		<item>
		<title>Render Me This: Video Thumbnails in Alfresco 3.3</title>
		<link>http://rgauss.com/2010/06/23/render-me-this/</link>
		<comments>http://rgauss.com/2010/06/23/render-me-this/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 19:00:55 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Alfresco]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=469</guid>
		<description><![CDATA[Alfresco has undergone quite a few changes under the hood in version 3.3, including refactoring of the ThumbnailService to make use of the RenditionService, which I had to explore in a recent deep dive to get video working for the thumbnails extension. This is obviously a subject dear to your heart as well or you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=469&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://alfresco.com" target="_blank">Alfresco</a> has undergone quite a few changes under the hood in version 3.3, including refactoring of the <a href="http://wiki.alfresco.com/wiki/Thumbnail_Service" target="_blank">ThumbnailService</a> to make use of the <a href="http://wiki.alfresco.com/wiki/Rendition_Service" target="_blank">RenditionService</a>, which I had to explore in a recent deep dive to get video working for the <a href="http://forge.alfresco.com/projects/thumbnails/" target="_blank">thumbnails extension</a>.  This is obviously a subject dear to your heart as well or you would have moved on by now.</p>
<h4>Alfresco 3.1.</h4>
<p>Let&#8217;s take a look at how things worked back in the old days, before 3.2 (fuzzy 2009 dream sequence begins&#8230;)</p>
<p>You most likely kicked things off with a thumbnail generating URL which would hit a <code>ScriptNode.createThumbnail</code> method which looked up the <code>thumbnailDefinition</code> and called the <code>ThumbnailService</code> with the <code>TransformationOptions</code> contained in the definition.</p>
<p>The <code>ThumbnailService</code> then told the <code>ContentService</code> to perform the transformation which looked up the <code>ContentTransformer</code> from the <code>TransformerRegistry</code> and executed <code>transformer.transform</code> which usually delegated to a <code>RuntimeExec</code> object to perform the actual command line transformation.</p>
<p>If we were to visualize the key elements of that stack for a synchronous video thumbnail creation it would look something like:</p>
<div style="font-size:9px;margin-bottom:10px;">
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.jscript.<strong>ScriptNode.createThumbnail</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.thumbnail.<strong>ThumbnailRegistry.getThumbnailDefinition</strong> (loads TransformationOptions)</li>
<li style="padding-left:6px;">org.alfresco.repo.thumbnail.<strong>ThumbnailServiceImpl.createThumbnail</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.content.<strong>ContentServiceImpl.transform</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.content.transform.<strong>ContentTransformerRegistry.getTransformer</strong></li>
<li style="padding-left:6px;">org.alfresco.repo.content.transform.<strong>ContentTransformer.transform</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">TempFileProvider.createTempFile</li>
<li style="padding-left:6px;">org.alfresco.util.exec.<strong>RuntimeExec.execute</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">ffmpeg &#8230;</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<p>Well now, that&#8217;s not so bad.</p>
<h4>Alfresco 3.3.</h4>
<p>These Alfresco people don&#8217;t mess around.  If it&#8217;s determined that refactoring should happen, it happens, real damn quick, even if it&#8217;s huge.  To that end <a href="http://wiki.alfresco.com/wiki/Alfresco_Subsystems" target="_blank">subsystems</a> were rolled out in 3.2 and the <a href="http://wiki.alfresco.com/wiki/Rendition_Service" target="_blank">RenditionService</a> was introduced in 3.3.</p>
<p><strong>Subsystems.</strong> Certain content transformers, like ImageMagick, have been refactored as a subsystem, which is cool.  Read the <a href="http://wiki.alfresco.com/wiki/Alfresco_Subsystems" target="_blank">wiki page</a> to get the full story but in short it&#8217;s a much more flexible architecture.</p>
<p>The ffmpeg video transformer contained in the latest release of the <a href="http://forge.alfresco.com/projects/thumbnails/" target="_blank">thumbnails extension</a> follows this precedence and has been refactored as a subsystem, so there.</p>
<p><strong>RenditionService.</strong> I wouldn&#8217;t say I hate it, but this package should be wary of eating crackers in bed, or maybe I&#8217;m just not familiar enough with it yet.</p>
<p>The new rendition service utilizes <code>RenditionDefinitions</code> which require that any <code>TransformationOptions</code> be &#8216;serialized&#8217; into a parameter map, which are then reassembled into <code>TransformationOptions</code> objects before being passed to the <code>ContentTransformer</code>.  I suppose this is done to make it easier to do things like hand renditions off to another server in a cluster, but it&#8217;s a bit of a pain in the ass for developers.</p>
<p>So, back to our synchronous video thumbnail creation scenario (deep breath), the <code>ThumbnailService</code> now creates a <code>RenditionDefinition</code> which it passes to the <code>RenditionService</code> which wraps things up in a <code>PerformRenditionActionExecuter</code> that gets passed to the <code>ActionService</code>.  The <code>PerformRenditionActionExecuter</code> calls the <code>ActionService</code> again which loads the <code>RenderingEngine</code> from the spring <code>ApplicationContext</code>.  A <code>RenderingEngine</code> is itself an <code>ActionExecuter</code> so the <code>ActionService</code> calls <code>execute</code> which calls <code>render</code> which proceeds to rebuild the <code>TransformationOptions</code> object needed by the <code>ContentService</code> to get the proper <code>ContentTransformer</code> so <code>transformer.transform</code> can use a <code>RuntimeExec</code> object to perform the actual command line transformation.</p>
<p>The key elements of our pseudo stack/method trace would look like:</p>
<div style="font-size:9px;margin-bottom:10px;">
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.jscript.<strong>ScriptNode.createThumbnail</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.thumbnail.<strong>ThumbnailRegistry.getThumbnailDefinition</strong> (loads TransformationOptions)</li>
<li style="padding-left:6px;">org.alfresco.repo.thumbnail.<strong>ThumbnailServiceImpl.createThumbnail</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">&#8230;</li>
<li style="padding-left:6px;">org.alfresco.repo.thumbnail.<strong>ThumbnailServiceImpl.createRenditionDefinition</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.thumbnail.<strong>ThumbnailRegistry.getThumbnailRenditionConvertor().convert(transformationOptions, assocDetails)</strong> &lt;- this serializes the transformationOptions into a parameter map</li>
</ul>
</li>
<li style="padding-left:6px;">org.alfresco.repo.rendition.<strong>RenditionServiceImpl.render</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.rendition.RenditionServiceImpl.createAndExecuteRenditionAction
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.action.<strong>ActionServiceImpl.createAction(PerformRenditionActionExecuter.NAME)</strong></li>
<li style="padding-left:6px;">set the renditionDefintion on performRenditionAction</li>
<li style="padding-left:6px;">org.alfresco.repo.action.<strong>ActionServiceImpl.executeAction</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">&#8230;</li>
<li style="padding-left:6px;">org.alfresco.repo.action.<strong>ActionServiceImpl.directActionExecution</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">load ActionExecuter from applicationContext</li>
<li style="padding-left:6px;">org.alfresco.repo.rendition.executer.<strong>ImageRenderingEngine.execute</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">&#8230;</li>
<li style="padding-left:6px;">org.alfresco.repo.rendition.executer.<strong>ImageRenderingEngine.render</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">&#8230;</li>
<li style="padding-left:6px;">org.alfresco.repo.rendition.executer.<strong>ImageRenderingEngine.getTransformationOptions</strong> &lt;- rebuilds parameter map into TransformationOptions objects</li>
<li style="padding-left:6px;">org.alfresco.repo.content.<strong>ContentServiceImpl.transform</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.content.transform.<strong>ContentTransformerRegistry.getTransformer</strong></li>
<li style="padding-left:6px;">org.alfresco.repo.content.transform.<strong>ProxyContentTransformer.transform</strong> &lt;- subsystems
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">org.alfresco.repo.content.transform.<strong>ContentTransformerWorker.transform</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">TempFileProvider.createTempFile</li>
<li style="padding-left:6px;">org.alfresco.util.exec.<strong>RuntimeExec.execute</strong>
<ul style="padding-bottom:0;">
<li style="padding-left:6px;">ffmpeg &#8230;</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<p>that&#8217;s a spicy meatball!</p>
<p>A while ago we <a href="https://issues.alfresco.com/jira/browse/ALFCOM-2880" target="_blank">submitted an issue to Alfresco</a> suggesting TransformationOptions which contain distinct target AND source options so that one could for example specify that all &#8216;doclib&#8217; thumbnails be of max-width X and max-height Y (the type of <strong>target</strong> options currently available) and furthermore, if it&#8217;s a document take page 1 (or maybe you need a different page in your deployment) or if it&#8217;s a video take 1 frame starting 0.5 seconds in, or if it&#8217;s a layered image file take the second layer, etc. (a list of <strong>source</strong> options).</p>
<p>Alas, this concept of <code>SourceTargetTransformationOptions</code> hasn&#8217;t yet been embraced by the Alfresco team but is used by the video transformer in the thumbnails extension which made refactoring for renditions even more difficult, but you&#8217;re not here to listen to me bitch and moan, so I&#8217;ll just say that it&#8217;s done and seems to be working fine.</p>
<p>So, there you have it, renditions and subsystems as they relate to video thumbnails.  Hit me up with any questions or things I&#8217;ve missed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/469/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/469/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=469&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2010/06/23/render-me-this/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>
	</item>
		<item>
		<title>Daemontools and File Permissions</title>
		<link>http://rgauss.com/2010/04/06/daemontools-and-file-permissions/</link>
		<comments>http://rgauss.com/2010/04/06/daemontools-and-file-permissions/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 01:24:47 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[daemontools]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=446</guid>
		<description><![CDATA[Watch out for setuidgid from daemontools removing the user's secondary groups.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=446&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://contegix.com" target="_blank">Contegix</a> turned me on to <a href="http://cr.yp.to/daemontools" target="_blank">daemontools</a> which is a great way to manage services you need to keep alive.  A great use for it is managing multiple <a href="http://tomcat.apache.org" target="_blank">Apache Tomcat</a> instances which can each be easily be configured to run under different users with different options.</p>
<p>I was recently running into a problem where a webapp running in Tomcat didn&#8217;t have access to a particular directory mounted via <a href="http://fuse.sourceforge.net" target="_blank">fuse</a>.  I could verify that the user Tomcat was running under had access to the directory by logging in as that user then creating a file there.  WTF?</p>
<p>Turns out the run script being used for the Tomcat service was using the daemontools program <code>setuidgid</code>, i.e.</p>
<p><pre class="brush: bash;">exec setuidgid ${USER+&quot;$USER&quot;} ./bin/catalina.sh run</pre></p>
<p>and the daemontools <a href="http://cr.yp.to/daemontools/setuidgid.html" target="_blank">manual for that program</a> states that it removes &#8220;<em>all supplementary groups</em>&#8220;.  Doh!</p>
<p>The Tomcat user&#8217;s access to this particular directory is in fact granted based on a secondary group membership and in this case should really stay that way.  <code>setuidgid</code> only allows a single user argument that&#8217;s used for both the user and group so I couldn&#8217;t change the running group and there&#8217;s no option to keep the user&#8217;s secondary groups.</p>
<p>Instead I opted to use <code>su</code> instead of <code>setuidgid</code> which leaves the secondary groups intact and gave the desired access to the directory:</p>
<p><pre class="brush: bash;">exec su ${USER+&quot;$USER&quot;} -c &quot;./bin/catalina.sh run&quot;</pre></p>
<p>Run catalina, run.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/446/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=446&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2010/04/06/daemontools-and-file-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>
	</item>
		<item>
		<title>Alfresco Video Thumbnails</title>
		<link>http://rgauss.com/2010/03/10/alfresco-video-thumbnails/</link>
		<comments>http://rgauss.com/2010/03/10/alfresco-video-thumbnails/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 22:47:32 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Alfresco]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[cooliris]]></category>
		<category><![CDATA[thumbnails]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=423</guid>
		<description><![CDATA[It seems like every 6 months to never I hear: &#8220;The Alfresco thumbnails forge project used to be cool man, what happened?&#8221;  Chill Winston, it&#8217;s still cool. Now that Alfresco has a native implementation of thumbnails is the forge project still needed?  Well, &#8216;needed&#8217; is relative I suppose, but check out what the project gets [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=423&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>It seems like every 6 months to never I hear: &#8220;The Alfresco <a href="http://forge.alfresco.com/projects/thumbnails/" target="_blank">thumbnails forge project </a>used to be cool man, what happened?&#8221;  Chill Winston, it&#8217;s still cool.</p>
<p>Now that Alfresco has a <a href="http://rgauss.com/2010/03/10/alfresco-3-thumbnails-and-the-forge-project/">native implementation of thumbnails</a> is the forge project still needed?  Well, &#8216;needed&#8217; is relative I suppose, but check out what the project gets you beyond the basic Alfresco distribution:</p>
<ul>
<li>Thumbnails when browsing, searching, or viewing a document in <a href="http://wiki.alfresco.com/wiki/Alfresco_Explorer" target="_blank">Alfresco Explorer</a> (i.e. not <a href="http://wiki.alfresco.com/wiki/Alfresco_Share" target="_blank">Share</a>)</li>
<li><a href="http://www.cooliris.com" target="_blank">CoolIris</a> view when browsing or searching in Alfresco Explorer (which is sweet)</li>
<li><strong>Actions</strong> to force the creation or update of thumbnails using Alfresco&#8217;s native thumbnail service</li>
<li>A <strong>video transformer</strong> based on <a href="http://ffmpeg.org/" target="_blank">ffmpeg</a> with the ability to specify an offset (also sweet)</li>
<li>A patch to delete and regenerate thumbnails created by old versions of the forge project (Admittedly, not that awesome, but useful nonetheless.  No one wants a messy bloated repo.)</li>
</ul>
<p>There&#8217;s also several goodies on the roadmap for future releases of the project including Share mods.</p>
<p>So what are you waiting for?  Go manage your modules and pop that amp into your war (for the non-geeks, I promise that&#8217;s not gross).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/423/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=423&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2010/03/10/alfresco-video-thumbnails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>
	</item>
		<item>
		<title>Alfresco 3 Thumbnails and the Forge Project</title>
		<link>http://rgauss.com/2010/03/10/alfresco-3-thumbnails-and-the-forge-project/</link>
		<comments>http://rgauss.com/2010/03/10/alfresco-3-thumbnails-and-the-forge-project/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 22:11:15 +0000</pubDate>
		<dc:creator>rgauss</dc:creator>
				<category><![CDATA[Alfresco]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[forge]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://rgauss.com/?p=412</guid>
		<description><![CDATA[The thumbnails forge project was started quite a while ago (like Alfresco 0.9 or so&#8230; old school) and the first public release was put on the forge in late 2006 (which would have been around Alfresco 1.3 I guess). The project gained the attention of the Alfresco team and they contacted me about making a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=412&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://forge.alfresco.com/projects/thumbnails/" target="_blank">thumbnails forge project</a> was started quite a while ago (like Alfresco 0.9 or so&#8230; old school) and the first public release was put on the forge in late 2006 (which would have been around Alfresco 1.3 I guess).</p>
<p>The project gained the attention of the Alfresco team and they contacted me about making a few changes to bring it more inline with what they had in mind for an implementation, notably creating a public thumbnail service.  Those changes were made and I continued to collaborate with Alfresco on the forge project and gave input on their implementation.</p>
<p><a href="http://alfresco.com" target="_blank">Alfresco 3</a> now has a <a href="http://wiki.alfresco.com/wiki/Thumbnail_Service" target="_blank">native implementation of thumbnails</a> and version 1.0 of the forge project migrated to the new architecture, but it&#8217;s <a href="http://rgauss.com/2010/03/10/alfresco-video-thumbnails/">still cool</a>.</p>
<p>Here&#8217;s a look at some of the differences to be aware of between the old thumbnails project implementation and Alfresco&#8217;s new native thumbnails:</p>
<table class="comparison" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="tableHeader">Concept</td>
<td class="tableHeader old">Pre 1.0 Versions of Forge Project</td>
<td class="tableHeader">Alfresco 3 Native</td>
</tr>
<tr>
<td>The service responsible for generating and retrieving thumbnails</td>
<td class="old">
<div class="name"><code>ThumbnailService</code></div>
<p>The <code><span style="text-decoration:line-through;">generateThumbnails</span></code> method would create thumbnails for<br />
all <code><span style="text-decoration:line-through;">ThumbnailSpecification</span></code>s defined.</p>
<p>A specific thumbnail can be generated with overriding options<br />
(possibly defined by a user in the web interface) which<br />
are merged with the defaults of the<br />
<code><span style="text-decoration:line-through;">ThumbnailSpecification</span></code><br />
(useful in defining the offset for a video thumbnail for example).</td>
<td>
<div class="name"><code>ThumbnailService</code></div>
<p>The <code>createThumbnail</code> and <code>updateThumbnail</code><br />
methods are given the specific <code>TransformationOptions</code> to<br />
use in generating the thumbnail.</p>
<p>The content property from which the source data will be read<br />
must be specified when generating the thumbnail, the default <code>cm:content</code><br />
will not be assumed.</td>
</tr>
<tr>
<td>A common size and destination mimetype for thumbnails</td>
<td class="old">
<div class="name"><code><span style="text-decoration:line-through;">ThumbnailSpecification</span></code></div>
<p><code>ContentTransformer</code>s and corresponging command line options explicitly<br />
defined in config</td>
<td>
<div class="name"><code>ThumbnailDefinition</code></div>
<p><code>ContentTransformer</code> determined by <code>ContentService</code><br />
from the given <code>TransformationOptions</code></td>
</tr>
<tr>
<td>The detailed resizing specifications</td>
<td class="old">
<div class="name"><code><span style="text-decoration:line-through;">TransformerSpecification</span></code></div>
<p>The specific <code>ContentTransformer</code> to use and the necessary<br />
command line options are defined</td>
<td>
<div class="name"><code>TransformationOptions</code></div>
<p>The resizing details are specified using classes containing generic<br />
definitions (for example <code>ImageResizeOptions</code> used by<br />
the <code>ImageTransformationOptions</code> class) which are then<br />
translated to appropriate command line code by the <code>ContentTransformer</code><br />
found by the <code>ContentService</code></td>
</tr>
<tr>
<td>The model type</td>
<td class="old">
<div class="name"><code><span style="text-decoration:line-through;">tn:thumbnail</span></code></div>
<p><code>&lt;parent&gt;cm:cmobject&lt;/parent&gt;</code></p>
<p>Not being of type content prevents most rules from being run on<br />
thumbnail nodes lest we do something unnecessary and resource intensive<br />
like extract metadata or even create another thumbnail of a thumbnail node<br />
and prevents thumbnail nodes from being indexed or returned in a search.</td>
<td>
<div class="name"><code>cm:thumbnail</code></div>
<p><code>&lt;parent&gt;cm:content&lt;/parent&gt;</code></p>
<p>Care must be taken to not run rules or index thumbnail nodes since they<br />
extend content.</p>
<p>One suggestion has been to add the following to the thumbnail type:</p>
<p><code>&lt;aspect name="rule:ignoreInheritedRules"&gt;</code></p>
<p><code>&lt;title&gt;Ignore Inherited Rules&lt;/title&gt;</code></p>
<p><code> </code><code>&lt;/aspect&gt;</code></td>
</tr>
<tr>
<td>The model property name of the common size and mimetype destination definition</td>
<td class="old">
<div class="name"><code><span style="text-decoration:line-through;">tn:specificationName</span></code></div>
<p>The <code><span style="text-decoration:line-through;">specifiationName</span></code> was the name of the<br />
<code><span style="text-decoration:line-through;">ThumbnailSpecification</span></code> used to generate the thumbnail.</td>
<td>
<div class="name"><code>cm:thumbnailName</code></div>
<p>The new <code>CreateThumbnailActionExecuter</code> uses the user-chosen<br />
<code>thumbnailName</code> to retrieve the<br />
<code>ThumbnailDefinition</code> but the relationship between the<br />
<code>ThumbnailDefinition</code> and its <code>thumbnailName</code> is<br />
not enforced by the <code>ThumbnailService</code>.</td>
</tr>
<tr>
<td>Default thumbnail sizes (max length/width)</td>
<td class="old">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><code><span style="text-decoration:line-through;">SMALL</span></code></td>
<td>80px</td>
<td>JPEG</td>
</tr>
<tr>
<td><code><span style="text-decoration:line-through;">MEDIUM</span></code></td>
<td>160px</td>
<td>JPEG</td>
</tr>
</tbody>
</table>
</td>
<td>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><code>medium</code></td>
<td>100px</td>
<td>JPEG</td>
</tr>
<tr>
<td><code>doclib</code></td>
<td>100px</td>
<td>PNG</td>
</tr>
<tr>
<td><code>webpreview</code></td>
<td>-</td>
<td>SWF</td>
</tr>
<tr>
<td><code>imgpreview</code></td>
<td>480px</td>
<td>PNG</td>
</tr>
<tr>
<td><code>avatar</code></td>
<td>64px</td>
<td>PNG</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div style="font-size:.8em;color:gray;">
<ol>
<li>Strikethroughs represent deprecated items.</li>
<li>Avatar thumbnail size has nothing to do with what I can only assume is an incredibly overhyped movie about pissed off blue tree people since I haven&#8217;t been to a theater in like 10 years.</li>
</ol>
</div>
<p>This information has been available in the thumbnails project&#8217;s 1.0 release <a href="http://forge.alfresco.com/frs/?group_id=55" target="_blank">readme</a> but as it&#8217;s not shown by default I figured I&#8217;d post here as well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/raygauss.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/raygauss.wordpress.com/412/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rgauss.com&#038;blog=9045792&#038;post=412&#038;subd=raygauss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rgauss.com/2010/03/10/alfresco-3-thumbnails-and-the-forge-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/74bc741e33341b29d2d5b80c1ee90b5b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rgauss</media:title>
		</media:content>
	</item>
	</channel>
</rss>
