<?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/"
	>

<channel>
	<title>Fatcoders</title>
	<atom:link href="http://www.sciabarra.com/fatwire/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sciabarra.com/fatwire</link>
	<description>The independent FatWire blog</description>
	<lastBuildDate>Fri, 18 Jan 2013 21:24:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>What is wrong in Fatwire/WCS 3: Mixing HTML and Code</title>
		<link>http://www.sciabarra.com/fatwire/2013/01/18/what-is-wrong-in-fatwirewcs-3-mixing-html-and-code/</link>
		<comments>http://www.sciabarra.com/fatwire/2013/01/18/what-is-wrong-in-fatwirewcs-3-mixing-html-and-code/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 21:23:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=750</guid>
		<description><![CDATA[It is hard to believe that in 2012 we still we have problems of mixing html and code. Those problems  are supposed to have been solved since many years, but unfortunately they are still around. In an ideal world, a web designer is also able to code. In a world even better, a web designer [...]]]></description>
				<content:encoded><![CDATA[<p>It is hard to believe that in 2012 we still we have problems of mixing html and code. Those problems  are supposed to have been solved since many years, but unfortunately they are still around.</p>
<p>In an ideal world, a web designer is also able to code. In a world even better, a web designer is also able to write jsp templates and knows fatwire tags.</p>
<p>In the real world, web designers, while often knowledgeable of  javascript, have usually no clue of JSP nor of specific Fatwire coding, so they produce only a mockup made of client-side HTML, CSS and Javascript. They leave to  "server side" developers the task of using that HTML/CSS/Javascript to create a content manageable website.</p>
<p>The problem with Fatwire/WCS is that to render the mockup code, you have to add Fatwire coding to it. So , because WCS is still a JSP based system,  you have to add  logic to extract the content model and put it in place in the HTML mockup. That would be fine if... it were to be done  only once.</p>
<p>But in reality, HTML code undergoes a number of iterations. Web designer will update the mockup and return it to server side developers. Those developers will  have to use the new HTML to update their templates code, that is now an heavily modified version, with added a lot logic in Java and JSP tags.</p>
<p>This is a big problem, because it is not easy. The usual process is figuring out what changed in the mockup  from the latest version used to build templates,  then go through the code to apply those modifications. Hoping that nothing will break.</p>
<p>When the HTML is heavily modified, starting from scratch is not unusual. In short, the process of updating templates when the HTML mockup changes is a real pain in the ass.</p>
<h2>What is really needed.</h2>
<p>The principle of separating presentation code (HTML) from logic is almost as old as the web itself. There are millions of solutions arounds for this, yet those solutions did not yet reach WCS in his core. We strongly need to implement for real this separations.</p>
<p>Furthermore, since HTML mockups are going to change ofter, we should be able to leave the mockup in his original form, in order to be easily updatable. Rendering logic should be applicable directly to HTML in his original form, without modifications.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2013/01/18/what-is-wrong-in-fatwirewcs-3-mixing-html-and-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is wrong in Fatwire/WCS development 2: Deployment Hell</title>
		<link>http://www.sciabarra.com/fatwire/2013/01/09/what-is-wrong-in-fatwirewcs-development-2-deployment-hell/</link>
		<comments>http://www.sciabarra.com/fatwire/2013/01/09/what-is-wrong-in-fatwirewcs-development-2-deployment-hell/#comments</comments>
		<pubDate>Wed, 09 Jan 2013 19:55:32 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=745</guid>
		<description><![CDATA[One "feature" of WCS, being a CMS, is deployment of code done in the same way as content. Code is treated as content and managed in the same way. We will see that this fact can create many problems. A content editor doing is job changes some content, and then he approves it for publishing. [...]]]></description>
				<content:encoded><![CDATA[<p>One "feature" of WCS, being a CMS, is deployment of code done in the same way as content. Code is treated as content and managed in the same way. We will see that this fact can create many problems.</p>
<p>A content editor doing is job changes some content, and then he approves it for publishing. WCS is smart enough to detect dependent content and requires the approval of related content to publish it in single publishing session.</p>
<p>This is great for a web site, where you only have to update a single content asset to update all the web pages referring to that content in the web site. Furthermore the publishing process is smart enough to invalidate only parts of the cache affected by the  changed content.</p>
<p>Developers <strong>should</strong> work in the same way: in the development server, a developer  can change  the template code, then approve it and finally publish it. Code should then go from development servers to staging servers and finally to live servers.</p>
<p>Let's put aside for now that having a single development server for multiple developers is a problem in itself (I will say more of this later), let's give a look at what developers really do and why this way of developing the code does not work as good as it should.</p>
<h2>How developers REALLY develop...</h2>
<p>There is a great variation in development procedures. The more common, even if now there better tools are available, many are still using the aging ContentServer Explorer  (now Sites Explorer) editing directly JSP code stored in the  ElementCatalog table.</p>
<p>Unfortunately, when you edit a JSP, the associated Template or CSElement is not aware that you changed the code with CSExplorer. So to make sure the "code publishing" mechanism work, you have to manually edit and save the   Template or CSElement corresponding to the JSP you edited, then approve it and finally publish it.</p>
<p>Being a manual process, way too often happens that someone forget either the edit/save or the approval of a changed template.</p>
<p>Also the propagation of the code from staging to live requires a re-approval of the templates. Although you can theoretically could just do a bulk approve, many people are scared of republishing everything. So what usually happens is that all the changed templates are manually approved and published, using manually kept release notes.</p>
<p>Since usually who deployed templates from development to staging is a different person from whom developed them, a floating document with the list of the changed element, or worse a flow of random email is used to propagate those informations.</p>
<p>At some point someone makes a mistake, forget to approve a template, distribute a list with the wrong templates ... and  problems not existing in development starts to appear in staging or in production, randomly.</p>
<p>When different developers are involved, or there is a turnaround in the editorial team, it happens way to often that you no more know what is deployed in which server. I have seen people periodically spending days comparing each template in different server just to figure out what went wrong and the origin of a bug.</p>
<h2>But wait... there is more</h2>
<p>Actually things can go much worse than this.</p>
<p>Another problem happens  very often when developers are forced to develop on a system disconnected from the staging/deliver chain.</p>
<p>This may happen for many reasons, the more common is some brain-damaged security policy, but there can are other more practical reasons, for example: "the connection from UK to India is too slow and we had to deploy a local development server".</p>
<p>The current solution to this problem is CSDT but to be honest, it is not  yet very widely used. People are very creative in solving the problem of distributing their development work. Some uses catalog mover, but I have seen people distributing their work as a database dump and even manually copying and pasting the code  in the Fatwire Advance Interface.</p>
<p>Needless to say, this is aggravating the deployment hell already described in the previous paragraph.</p>
<p>But the worse situation, that I have seen too, is when developers are developing in their development server, then some other people fix some issues (usually in HTML) editing directly templates in staging, and at the same time some urgent issues are also fixed manually editing templates  directly on the live server. The result as you can imagine is a total unmanageable mess. And unfortunately, even is is an extreme case, it happens.</p>
<h2>What you really need</h2>
<div> The whole idea of deploying code as a collection of separate elements singularly deployable is wrong, and all this is originated because code is treated as content.</div>
<div></div>
<div>Code is inherently different from content. It has a different structure, a different  development process, different editing tools. More important, code must be always deployed always as a single unit, ideally as a single file, easily trackable and recognisable. You should immediately know that you have for example version 1.3.14 on production, and bug report and fixes must refer to a specific version number.</div>
<div></div>
<div>So the fact that Fatwire/WCS allows code to be treated as separate entities independently deployable is a weakness.</div>
<p>Java has a concept of  deployment unit:  it is called the "jar" file. Fatwire/WCS is one of the few Java places where code is not deployed in jars, but it is instead delivered as separate templates deployed through publishing.</p>
<p><strong>What is really needed is that all the code for a site can be distribuited as single JAR fil, that can be <strong>easily </strong>deployed, tracked, compared, distribuited and versioned.</strong></p>
<p>All the deployment hell I described would go away if instead of having a bunch of files, you have a jar. The jar can be built by developers, tested separately with bug report and fixed referring to a specific build, delivered to destination and deployed just copying the file and eventually running some schema update procedure.</p>
<p>Jars have a shortcoming, of course. Usually they require the restart of the application server to be recognized. This in a live environment is not usually acceptable. Nonetheless,  it is not always true that deploying a new jar requires the application server restart. There are plenty of hot-reloading  Java systems. Just to mention one, hot reloading of jars in JBoss. So it is possible a system where a site is deployed in jars that are deployed without restarting the application server (and indeed, I already implemented such a system).</p>
<p>I will continue to list WCS/Fatwire development problems in the next few posts before introducing my solution to those problems. Stay tuned.</p>
<p>&nbsp;</p>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2013/01/09/what-is-wrong-in-fatwirewcs-development-2-deployment-hell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is wrong in Fatwire/WCS development 1: JSP are evil</title>
		<link>http://www.sciabarra.com/fatwire/2013/01/07/what-is-wrong-in-fatwirewcs-development-1-jsp-are-evil/</link>
		<comments>http://www.sciabarra.com/fatwire/2013/01/07/what-is-wrong-in-fatwirewcs-development-1-jsp-are-evil/#comments</comments>
		<pubDate>Mon, 07 Jan 2013 20:46:29 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=742</guid>
		<description><![CDATA[I am close to release a new open source project that  tries to fix  many of the common problems in Fatwire and WCS development. But before the release, I want to  discuss those problems, since fixing them  is the main motivations underlying my development effort. Actually, many of the features of the framework I am [...]]]></description>
				<content:encoded><![CDATA[<p>I am close to release a new open source project that  tries to fix  many of the common problems in Fatwire and WCS development.</p>
<p>But before the release, I want to  discuss those problems, since fixing them  is the main motivations underlying my development effort.</p>
<p>Actually, many of the features of the framework I am doing cannot be understood unless you know which real world problems they try to solve.</p>
<p>This is not a rant.  <strong>I also have a solution to those problems and it will follow in the next few weeks. </strong></p>
<h2>JSP are evil</h2>
<p>The biggest issue in Fatwire/WCS in my view is that you are stuck with JSP (or worse, with the obsolete, very limited and almost undocumented "Fatwire XML").</p>
<p>JSP are designed only to be a quick way of rendering a dynamic HTML page using Java code. Something that is 95% html and only a little bit of code. They are no way  meant in no way to be a complete tool for doing generic Java coding.</p>
<p>They provide the flexibility of immediate availability (since they are recompiled and reloaded on the fly), and they provide the "markup first" approach that is useful when you need to render a lot of HTML and only a small part need to be coded and rendered dynamically.</p>
<p>Indeed this JSP  flexibility comes with a lot of limitation, while the coding in Fatwire development tend to be pretty complex, so complex that you end up writing big JSP so full of code that  may you have difficulties finding the HTML.</p>
<p>Here some of the limitations of JSP. First and before all, because a JSP is  a single method of a single class, you generally are not supposed to define methods and classes. You actually can define classes and methods, using the "&lt;%!" syntax.</p>
<p>Hovewer, since it is not the way  JSP are supposed to be used, you cannot reuse any defined  method in another JSP . This is even worse when you also define a class. You can create classes inside a JSP but you cannot reuse that class in another JSP.</p>
<p>The only way of having code shared between different JSP is to create a separate jar with all the code and deploy in the application server Coding such a jar is relatively awkward, because you have to build it, deploy and restart the application server for every change. So usually this is done rarely.</p>
<p>For this reason, building libraries of code is not normally done in Java (as it should). Instead, the common practice is to create a library of "elements" called by JSP.</p>
<p>The problem is that a CSElement is not really meant to be a library doing complex things, it is meant as a medium to generate repeatable rendering of common elements.</p>
<p>The semantics of calling  CSElements, and using them as a library is, frankly, disgusting. There is no way return value from a CSElement , so you normally use a global environment and  side effects (altering the value of a variable value in a shared environment).</p>
<p>The JSP "language" does not offer any enforcement to using a CSElement as a library call, so everything is left to convention. You need to document clearly which variables are changed to see what is returned. This practice is error prone, hard to read and even harder to maintain.</p>
<p>Also it happen often that a CSElement "pollutes" the calling enviroment, so you need to use pushvar and popvar to preserve the environment. And this makes the whole procedure even more disgusting, unreadable and produces really bad code, where a lot of complexity is there just to move around variables, protect them and read side effects.</p>
<p>Last but not least, the invoking CSElements is really verbose and typing an invocation method is often so long that you copy and paste code. Long code doing little is also very hard to read.</p>
<h2>How to solve JSP problems</h2>
<p>1. What really is needed is a way to code in full, plain, clean Java, not in JSP. Classes offers all the power needed to build complex programs, and a JSP are a simplified AND limited form of Java classes. Using Java will immediately give you the ability to write methods and classes, keeping them totally reusable.</p>
<p>2. However you need to retain the ability of seeing immediately the result of a change because restarting the application server at each change is usually not really practical:  it is so slow that developers to avoid it will prefer to push tons of code in the JSP. A solution could be "JRebel" but since it is expensive for some teams (most notably indian teams) buying it can be a problem. So that solution should be cheap.</p>
<p>3. Coding in Java you will also want to avoid ton of out.println("...") filled of "\" to escape quotes just to generate HTML. Probably you may not not the "HTML first" approach of JSP  and you may prefer the "code first" of Java, but you still want an easy way of generating HTML.</p>
<p>4. Last but not least, JSP offers some well defined tag libraries for rendering the content model. Since the equivalent Fatwire Java API (the Asset API) is not even close to the quality of tag libraries, you need some  <strong>efficient</strong> way of invoking tag directly from Java code.</p>
<h2>We have not finished, yet.</h2>
<p>Actually we have just started, a lot more will come. So please wait, there are more problems to  discuss in the next posts. And the solution will follow, it is a promise. So stay tuned.</p>
<div><strong><br />
</strong></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2013/01/07/what-is-wrong-in-fatwirewcs-development-1-jsp-are-evil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Please stop using libraries and learn the tags!</title>
		<link>http://www.sciabarra.com/fatwire/2012/12/15/please-stop-using-libraries-and-learn-the-tags/</link>
		<comments>http://www.sciabarra.com/fatwire/2012/12/15/please-stop-using-libraries-and-learn-the-tags/#comments</comments>
		<pubDate>Sat, 15 Dec 2012 13:22:07 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=730</guid>
		<description><![CDATA[In the  projects I have worked in the latest two years, a pattern emerged: developers were developing using libraries of code but  not using directly fatwire tags.  So, instead of using fatwire tags, they were calling all the time some "elements". That is puzzling. Why they do this way? Why they use those libraries instead [...]]]></description>
				<content:encoded><![CDATA[<p>In the  projects I have worked in the latest two years, a pattern emerged: developers were developing using libraries of code but  not using directly fatwire tags.  So, instead of using fatwire tags, they were calling all the time some "elements".</p>
<p>That is puzzling. Why they do this way? Why they use those libraries instead of just LEARNING THE CODING OF THE PRODUCT? There is no real advantage of using those libraries. A lot of code is needed to pass the parameters, other code is required to read the result, and overall it is more complex than just using the fatwire tags in the first place. What is worse, fatwire tags are documented. Those libraries are usually NOT.</p>
<p>I suspect this is a common pattern because implementers follow directions from someone that is providing the library. However, the library that they use is very often (I would say always) much worse than using directly the fatwire API. This is because Fatwire does not really provide features to write libraries in templates. They should code custom tags, instead. Something very rarely done.</p>
<p>I know that Fatwire API is somewhat confusing; for example having to extract each attribute before rendering it looks to be too much effort. But this is not an excuse for avoiding to learn it.</p>
<p>For example to render an attribute of an asset, an <strong>assetset:getmultiplevalues</strong> and then a <strong>ics:listget </strong>it is all that is needed to render an attribute.</p>
<p>&nbsp;</p>
<p>It is shorter than calling the "getpageattributes" call I have seen too many times.</p>
<p>Real code I saw yesterday do:</p>
<ul>
<li>collect a number of parameters</li>
<li>calling the element that extracts ALL the attributes and store in an hashmap</li>
<li>retrieve the hashmap</li>
<li>extract the values in java variables</li>
<li>sometimes bring back those variables in ics variables</li>
<li>add a lot of checks for null values</li>
</ul>
<p>But using a library can generate be much worse results than this.</p>
<p>I have see in a project developers calling all the time a library that was extracting the attributes filtered by date. EVEN FOR NON DATE SENSITIVE FILTERED ATTRIBUTES.</p>
<p>So the coders, instead of just extracting the attributes they were needing, did some dirty trick with variables to simulate a different time range and disable the filtering when it was not needed. An extreme case of total ignorance of the enviroment they are working in. Code 10 times more complex totally unreadable and filled with hack and tricks.</p>
<p>So I feel to give a big warning to all the Fatwire Customers (and I know many of them  read my blog and listen to me): check that the developers knows Fatwire coding. It is not that hard. Below there is a list of questions developers will have to know the answers (without the answers... so developers that will try to be prepared for my test will have to learn).</p>
<p>Unfortunately many indians and chinese companies have this bad habit: since they cannot find the developers with the proper skills, they throw in the team generic java and jsp developers, and instead of providing training, they put some team leader that provides a library. Then they (regularly) lose the team leader and the developers are left hacking the library without never learning the enviroment.</p>
<h2>Simple Test: do you know enough of fatwire for coding?</h2>
<ul>
<li>What is an IList?</li>
<li>How do you extract fields os an IList?</li>
<li>How do you loop an IList?</li>
<li>How do you load a basic asset?</li>
<li>How do you extract fields from a basic asset?</li>
<li>How do you load a flex asset?</li>
<li>How do you load attributes of flex assets?</li>
<li>How do you read a single value?</li>
<li>How do you read multiple values of an attribute?</li>
<li>What you get when an attribute is a blob?</li>
<li>What you get when an attribute is an asset?</li>
<li>What is the impact on the cache using a calltemplate?</li>
<li>What is the impact on the cache using searches with search state?</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2012/12/15/please-stop-using-libraries-and-learn-the-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSDT Toolkit</title>
		<link>http://www.sciabarra.com/fatwire/2012/11/10/csdt-toolkit/</link>
		<comments>http://www.sciabarra.com/fatwire/2012/11/10/csdt-toolkit/#comments</comments>
		<pubDate>Sat, 10 Nov 2012 21:59:28 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=717</guid>
		<description><![CDATA[I  recently had to perform a large migration and I choose to use to use CSDT. Well, this may be contradictory with some post I did in the past, where I stated I was don't  like CSDT. Actually, what I dislike is the CSDT eclipse plugin.  While it has some usefulness, it is not that [...]]]></description>
				<content:encoded><![CDATA[<p>I  recently had to perform a large migration and I choose to use to use CSDT. Well, this may be contradictory with some post I did in the past, where I stated I was don't  like CSDT. Actually, what I dislike is the CSDT eclipse plugin.  While it has some usefulness, it is not that great andI currently just use Eclipse in a local jumpstart using <a title="Eclipse for Fatwire" href="http://www.sciabarra.com/fatwire/2012/04/13/the-simplest-way-to-use-eclipse-for-fatwire-development/">this trick</a> for editing.</p>
<p>But CSDT command line is pretty useful when used as an export/import tool. It could be better however. Using it, I learned a few lessons and I wrote a couple of scripts to make it easier to use. I stored them in my FatGoodies repository, <a href="https://github.com/sciabarra/FatGoodies/tree/master/csdt-helper">here</a>. You can downloading the scripts with git or just display them raw and save them locally (there are just 3 files).</p>
<p>CSDT jars are  not included though. Being proprietary software, I cannot distribute it. You have to take the relevant jars from your Fatwire/WCS installation and copy them in the lib subdirectory where you placed the scripts. Read the README for the list of the required jars.</p>
<p>There are 2 scripts: a launcher, and an exporter. Scripts are written for the BASH shell and works out of the box in common Unixes (Linux / Mac OSX). For Windows you need to install <a href="http://www.cygwin.com/">CygWin</a> or another unix like environment with Bash like the  one that comes with <a href="http://code.google.com/p/msysgit/">Git for Windows</a>. I actually use this last one, not Cygwin, but I do not expect problems with Cygwin</p>
<h2>The Launcher</h2>
<p>The first script is the <a href="https://github.com/sciabarra/FatGoodies/blob/master/csdt-helper/csdt-unix.sh">launcher</a>. It actually comes in 2 flavors: <strong>csdt-unix.sh</strong> for Unix and and <strong>csdt-win.sh</strong> for windows.  The script does the dirty work of building the classpath you need to lanunch csdt and provide all the numerous parameter that are making a pain to use it.</p>
<p>However the intended use of the launcher is from a  <a href="https://github.com/sciabarra/FatGoodies/blob/master/csdt-helper/wrapper.sh">wrapper</a> script. You should copy the wrapper.sh in your own file, and  edit it filling in the parameter: location of your content server, username, password and site. Defaults are good for a local jumpstart kit.</p>
<p>Your wrapper will the  invoke  the launcher, and then working with CSDT becomes easy. The launcher is separated from the wrapper because you can have multiple wrappers.  I actually make copies of the wrapper script for each server I want to use: for example <strong>staging.sh</strong>, <strong>delivery.sh</strong> and so on.</p>
<p>The wrapper script  synopsis is then just: <strong>./wrapper.sh [&lt;selection&gt;] [&lt;command&gt;] </strong></p>
<p>If you run it without argument,  you will get the list of all assets in the configured server.</p>
<p>The first argument is the <strong>&lt;selection&gt; </strong>of the assets and it defaults to <strong>@ALL_ASSETS</strong>. Its syntax is documented in the Content Server developer tools manual.  Basically,<strong> AssetType:AssetId</strong> select a single asset, <strong>AssetType </strong>select all the assets of a given type, <strong>@ALL_ASSETS </strong>select all the assets and <strong>@ALL_NONASSETS </strong>select the configurations. It</p>
<p>The second argument is the csdt command to perform, one of  <strong>listcs, listds, export, import</strong>. You can now do easily stuff like:</p>
<div>
<ul>
<li>List all the assets:<br />
<strong>./wrapper.sh</strong></li>
<li>List all the CSElements (or template or whatever) from staging:<br />
.<strong>/staging.sh CSElement</strong></li>
<li>List all the non-assets in "ds" (with fw_unid) on live:<br />
<strong>./delivery.sh @NON_ASSETS</strong>  <strong>listds</strong></li>
<li>Export only the CSElements from staging:<br />
<strong>./wrapper.sh CSElements export</strong></li>
<li>Import all the non-assets in live:<br />
<strong>./import.sh @NON_ASSETS</strong>  <strong>import</strong></li>
</ul>
</div>
<h2>A more robust export</h2>
<p>The previous script is good enough to launch csdt. However, when performing a full export of a site,  there is a problem. CSDT is somewhat fragile: if there is an inconsistency in the content model , the export fails.</p>
<p>There are many possible incosistencies: for example, an asset using a deleted attribute, or a locked asset or something shared with another site. Many inconsistencies that are not a big issue and survive to publishing and don't impact site rendering are fatal for CSDT.</p>
<p>The problem is particularly evident when you try to export all with @ALL_ASSETS, you may to wait a lot of time for answer, then finally the export stops with an exception. You have to  fix the issue and then run again the script. When you have thousand of assets, the loop "export - fix - try again" can be unacceptably slow.</p>
<p>The solution is, sadly, exporting all the but one by one, collect the errors and then fix all of them at the end.  This is what the second script does.</p>
<p>The synopsis is: <strong>./export.sh &lt;wrapper&gt; [&lt;selection&gt;] </strong></p>
<p>The script requires as the first argument a wrapper script, one of those created in the first part of the post, providing the parameters to connect to a specific CSDT instance. As said in the previous section, you create one copying the <strong>wrapper.sh</strong> into another file and then editing it providing the appropriate parameters.</p>
<p>The <strong>&lt;selection&gt;</strong> is by default <strong>@ALL_ASSETS</strong> but you can use also something like "<strong>Template</strong>" or "<strong>CSElement</strong>" to select only one specific asset type or even "<strong>CSElement:123456789</strong>" to select a single asset.</p>
<p>The export script will export each asset in the selection separately.</p>
<p>The output will be logged in a file called <strong>out/&lt;wrapper&gt;/&lt;asset-type&gt;/&lt;asset-id&gt;</strong></p>
<p>The script has 2 advantages:  it won't stop if there is an error, and it is incremental .</p>
<p>While csdt alone will bomb if there is any error and stop processing, the export script will simply log the error and continue. However you can stop the processing at any time, and then resume: existing logs will be used as markers, and already extracted asset will not be extracted again.</p>
<p>Once you have all the logs, you can search for errors. The simple command</p>
<p><strong>grep -r out/staging Exception</strong></p>
<p>will return a list of assets that logged an exception, something like this</p>
<pre>out/staging/CSElement/1327351719222:Exception
out/staging/CSElement/1327351719637:Exception
out/staging/CSElement/1327351720069:Exception</pre>
<p>You can then inspect the export that failed the export, fix it and then export them again. Since by default already exported assets are skipped you have to add "-f" to the script to force a re-export. So for export again the first asset of the previous list you may use</p>
<p><strong>./export.sh  staging.sh CSElement:1327351719222 -f</strong></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2012/11/10/csdt-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cross Platform Jump Start Kit</title>
		<link>http://www.sciabarra.com/fatwire/2012/10/02/cross-platform-jump-start-kit/</link>
		<comments>http://www.sciabarra.com/fatwire/2012/10/02/cross-platform-jump-start-kit/#comments</comments>
		<pubDate>Tue, 02 Oct 2012 22:15:19 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=712</guid>
		<description><![CDATA[How to use a Windows JDK on Unix (Linux/Mac) and ViceVersa I am a Mac user and I usually deploy my work on Linux servers, so I work normally and comfortably in an unix environment, both for development and delivery. Because of Java portability and because paths on  Mac and Linux are the same, I [...]]]></description>
				<content:encoded><![CDATA[<h3>How to use a Windows JDK on Unix (Linux/Mac) and ViceVersa</h3>
<p>I am a Mac user and I usually deploy my work on Linux servers, so I work normally and comfortably in an unix environment, both for development and delivery. Because of Java portability and because paths on  Mac and Linux are the same, I do not have any problem moving my JumpStartKit or local install between Mac and Linuux: just copying files and placing them in the same location is enough (paths are harcoded in a Fatwire installation so the paths must be the same).</p>
<p>However one day I found myself,  with a JSK built for my Mac I had to run in a Windows environment, and with a JSK built by someone else in a windows environment that I had to run in my Mac  (Unix) environment.</p>
<p>I have previously  "converted" those JSK using string replacement tricks, but it is definitely an error prone and annoying task. Furthermore,  sometimes I have to make some changes, using Mac, and then send it back to a windows user.</p>
<p>So I started  to think if replacing strings in JSK configuration files and database to run it on  another environment can be avoided. After some thinking and experimentation, <strong>the answer is a full YES.</strong> With a couple of simple os level tricks you don't have to change anything.</p>
<h2><strong>How Run an Unix JSK under WIndows</strong></h2>
<p>This is easy.</p>
<p>The basic finding is that Java treats slashes and backslashes in the same way.</p>
<p>So a path like /Developer/Fatwire/jsk (a unix absolute path) it is actually interpreted in windows as "\Developer\Fatwire\jsk", that is an absolute path too, except that is relative to  the current drive.</p>
<p>So, to run an Unix JSK in Windows, all is needed is  placing it in the corresponding directory it would be under Unix, then  <strong>change the current drive</strong> when you start it to  the one where the JSK is installed.</p>
<p>To be sure of the current drive, you do better to start JSK command line, as explained below, instead of relying on the launcher provided by the JSK itself. Here is the procedure</p>
<ul>
<li> Open the Command prompt</li>
<li> Change to C: if I placed the JSK in C:/Developer/Fatwire/JSK</li>
<li> Go to C:/Developer/Fatwire/JSK/App_Serverver/apache-tomcat-6.0.30/bin</li>
<li> Copy catalina.bat.org to catalina2.bat</li>
<li> Start it from the command prompt using catalina2.bat run</li>
</ul>
<p>Please note you may need to tweak the catalina.bat adding more memory, more perm gen space and so on. For a hint of the changes needed, give a look in the original catalina.ba,t looking for JAVA_OPTS and CATALINA_OPTS.</p>
<h2><strong>How Run a Windows JSK under Unix</strong></h2>
<p>It is slightly more complex to run a Windows JSK on Unix without changing strings in the JSK.</p>
<p>The problem here is that a Windows path is usually something like "c:\Fatwire\JSK\7.6.2\". Now, Java does  not care of the slashes. Reverse slashes are translated in forward slashed automatically.</p>
<p><strong>The problem is that a path starting with C: is an absolute path in Windows but… a relative path on Unix</strong>! So trying to start JSK simply won't work unless you do something fix this confusion.</p>
<p>So my technique is installing the JSK in the same directory in the filesystem without the drive name; in the example before, in /Fatwire/JSK/7.6.2</p>
<p>Then I open the terminal,  I go the tomcat  bin directory (something like /Fatwire/JSK/7.6.2/App_Server/apache-tomcat-6.0.32/bin), do the trick described before for Windows to start it (I copy catalina.sh.org to catalina2.sh, then I tweak the OPTS taking the parameters from the catalina.sh).</p>
<p>Now, before starting tomcat I also do this :</p>
<pre>ln -sf / C:</pre>
<p>this way you create a symbolic link named "C:" (that is legal file name on unix)  pointing to the root folder.</p>
<p>Now you can start tomcat with ./catalina2.sh run</p>
<p>This way, the current directory is the bin directory of tomcat. Every path is relative to this directory. This directory normally won't change, at least I am not aware of any internal change directory inside Fatwire.</p>
<p>So any reference to paths will start from C: that will point to the root folder. Since you have placed the JSK in the same position as it was in Windows, now every path now is resolved correctly.</p>
<p>That is all. Enjoy now working in a team without having either to switch to windows or (worse) run the JSK in an emulator(a real pain I do not advise to anyone unless you have really a lot of ram)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2012/10/02/cross-platform-jump-start-kit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why you should upgrade to Oracle WCS11g&#8230; or at least to Fatwire 7.6</title>
		<link>http://www.sciabarra.com/fatwire/2012/09/22/why-you-should-upgrade-to-wcs11g-or-at-least-fatwire76/</link>
		<comments>http://www.sciabarra.com/fatwire/2012/09/22/why-you-should-upgrade-to-wcs11g-or-at-least-fatwire76/#comments</comments>
		<pubDate>Sat, 22 Sep 2012 12:57:16 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=698</guid>
		<description><![CDATA[Almost in all the  projects I worked this year, I was plagued with legacy Fatwire  versions  that are still around. An outdated version of the software was often a major problem on all the development and the issues I was called to solve. And the worse is that customers often did not feel any need [...]]]></description>
				<content:encoded><![CDATA[<p>Almost in all the  projects I worked this year, I was plagued with legacy Fatwire  versions  that are still around. An outdated version of the software was often a major problem on all the development and the issues I was called to solve. And the worse is that customers often did not feel any need to upgrade.</p>
<p>I discussed so many times the reasons to upgrade at least to  7.6 that... I decide to write this blog post, both to share the wisdom with other,  and both as a reminder for myself to shorten  future discussions on this subject .</p>
<p>Fatwire 7.6 is still largely compatible with  7.x and 6.x: users won't notice any significant difference,  so (unless you have a heavily customised UI) upgrading to 7.6 is mostly painless (except for CAS, see below).  However you get a  number of significant improvements pretty useful for new development .  You can see <a title="Fatwire 7.6 Release Notes" href="http://docs.oracle.com/cd/E28662_01/doc.76/content_server/cs_release_notes_762.html">here</a> and <a href="http://docs.oracle.com/cd/E28662_01/doc.76/content_server/90_cs_release_notes_75_75p5_updated_4_1_11.html">here</a>  the release notes document for 7.6 and 7.5, but in this post I am trying to better explain what they really means.</p>
<p>Upgrading to 11g probably  is the better choice, as I discussed in<a href="http://www.sciabarra.com/fatwire/2012/06/10/the-new-wcs-user-interface/"> this blog post</a>, however it somewhat changes the editorial team experience. In this post instead I explain the technical reasons for upgrading to at least to 7.6.</p>
<h2>CSDT</h2>
<p>Number one reason to switch to 7.6 is CSDT. While I was critical of CSDT in the past (because I do not like the eclipse plugin - I still prefer either <a href="https://fatclipse.assembla.com/">Fatclipse</a> or my homegrown alternative <a href="https://github.com/sciabarra/FatGoodies/tree/master/fatproject">fatproject</a>) there is a feature in CSDT (that is similar to my own FatProject code) that is actually working well and it is a much complete solution than FatProject : the import/export feature.</p>
<p>CSDT lets you export an entire web site in XML format, including configurations and content model, and then reimport it in another instance.</p>
<p>Anyone working with Fatwire knows the pain having of multiple developers working on the same server, using ContentServer Explorer to edit pages, and how limited as a version control system revision tracking is. Modern agile development prescribes a continuos integration server. Furthermore, publishing is a tool for deploying content, but it is not great to deploy code.</p>
<p>Just to make a simple example, code has relations (a piece of code to work may require a specific version of another piece of code), but  publishing just doesn't capture this relation, while version control systems does. So publishing template by template is very error prone and lead to inconsistencies between environments. Furthermore code is usually dependent on a specific content model, so it must be kept together.</p>
<p>CSDT gives finally developers freedom from those constraints. Since you can import and export a whole site, you can export it from a shared development environment then import in a JumpStart and use it for development. Furthermore, you can revision control the csdt export , sharing and merging it with other developers. And finally deploy it to the final, production server.</p>
<p>So definitely, CSDT (Content Server Development Tool) is the definitive tool to make Fatwire Development acceptable for a professional developers, used to work in their machine for development,  accustomed to perform merging of others work, revision control the code as a whole, creating automated builds and running tests against the builds.</p>
<h2>AssetCache</h2>
<div> Asset Cache has been introduced in 7.6,  it is only vaguely mentioned in the release notes but it addresses a very important problem: improve performances of uncacheable templates caching the assets instead.</div>
<div></div>
<div>Let's define the problem: your site is dynamic enough that many templates cannot be cached. Before version 7.5, Fatwire cache was based on the idea of caching the <strong>pagelets</strong>, the snippets of html generated by template execution.</div>
<div></div>
<div>This works well as long as the snippets you generate are not too many. But think to a search page, for example: you  may generate way too many different renderings to cache them, so unless you want to fill the cache without any performance gain, you need to leave the search page uncached. And this can be pretty slow.</div>
<div></div>
<div>What it is really needed then it is the ability to cache the Java "pojos", the underlying objects that are created when you render a templates. To better explain what this means, consider the standard call <strong>&lt;asset:load name="asset" ...&gt;</strong>  used to load an asset in memory for extracting the content.</div>
<div></div>
<div>The "traditional" Fatwire way is to load the asset in a pojo in memory, use it to generate a snippet of html (the pagelet), then throw it away and cache the pagelet. This works well for cacheable template, but uncached templates were a "don't do it" before Asset Cache...</div>
<div></div>
<div>Now, using AssetCache the underlying pojo is no more thrown away: instead it is cached, as it happens in many other  java applications (like those based on Hibernate for example).</div>
<div></div>
<div>This feature lets developers to write uncacheable templates acceptable .... and save their butt when the performance of the site are unacceptable because templates are all uncached (somethings that happens too much often unfortunately) and cannot be cached for many reasons (complex logic, too many parameters, messy design and so on).</div>
<div></div>
<div>So if your site is now unacceptably slow, and you have just discovered that the templates cannot be cached because you passed 20 different arguments including the browser agent and the current date and time, you can still keep your job just recommending to upgrade to Fatwire 7.6 and then enable Asset Cache (and InCache,  see below)... Actually  AssetCache  requires InCache, let's focus on it.</div>
<div></div>
<div>
<h2>Incache</h2>
<p>Incache was introduced with Fatwire 7.5. What is InCache? It is basically just <a href="http://ehcache.org/">ehcache</a>, the underlying cache used with Hibernate and many other project around. It improves the traditional fatwire cache offering a number of interesting features. From the release notes, InCache, as ehcache, is:</p>
<ul>
<li>Distributed</li>
<li>Scalable and High performance</li>
<li>No single node needs a complete view of cache</li>
<li>Communication via dependencies</li>
<li>No shared disk</li>
</ul>
<div>It is basically a better cache that works distributing the load within different nodes. More nodes can be added when required so it is not limited by the speed of a shared disk and can be scaled up adding more servers. <a href="http://www.ehcache.org">You can learn more here</a>.</div>
</div>
<h2>Rest API</h2>
<p>Fatwire 7.5 introduces also a new API that replaces the obsolete SOAP bases web services API. This means... a lot. This Rest API is pretty verbose, but is it finally allows interaction with the server in XML and JSON, and not only through Form POST.. Using the rest API your web site can be written not only as a static site, but also as an HTML5 fronted calling backend  restful webservices, a design becoming increasingly common. I would say that is the current state of the art since all the new sites includes (and uses) jQuery...</p>
<p>So, if you plan to advance your web site to implement some ajax call using jQuery or similar, of better you want to have code that can also update some assets and not only read them, definitely having the Rest API deployed is a must.</p>
<h2>Single Sign On (CAS)</h2>
<div>Well, I am not sure if the Single Sign On component (that is actually the open source project <a href="http://www.jasig.org/cas">CAS</a>) is an advantage... or a liability. It was introduced together with the RestAPI both to protect restful resources and allows multiple applications to be plugged as extension to Fatwire (like Community Server and Gadget Server).</div>
<div></div>
<div>It is required since the Rest API is based on it, and since CSDT uses the RestAPI you cannot get rid of it if you want CSDT. You can skip the installation but you will lose RestAPI... and CSDT. Not recommended. However, it <strong>IS</strong> a major source of pain for upgrader, since it works using a double redirect.</div>
<div></div>
<div>When you access to a protected resource,  or just log into Fatwire, CAS redirects to its server, generate a ticket and then redirect back. This requires a that DNS is properly configured (and a broken DNS is not uncommon in many intranets). This requires  also that all the proxy servers in the middle can  proxy the fixed URL and not a generic ip based URL.</div>
<div></div>
<div>CAS can make also impossible to log into ContentServer when you try to access using a tunnel and you are trying to do an emergency intervention to a customer that cannot quickly open you the firewall, so you trying to log into the the server through multiple ssh to the host server...</div>
<div></div>
<div>It is also a source of problems in publishing. Since it is used also by the publishing system, a misconfiguration can cause the publishing to start to fail after the upgrade... when it was previously working perfectly.</div>
<h2>Last but not least</h2>
<p>I am aware at least of one important security hole still present in 7.5 that has been fixed in 7.6. I prefer not to tell the details in a public blog post, but I strongly suggest to check release notes of 7.6... or just upgrade...</p>
<h2>Conclusion</h2>
<p>If you want</p>
<ul>
<li>develop in a healthy, isolated, version controlled development environment</li>
<li>need caching options for complex uncached templates</li>
<li>need to scale your cache up to the infinity</li>
<li>leverage ajax using jquery</li>
<li>fix some security bugs</li>
<li>AND you are NOT SCARED of fixing DSN and PROXY configuration because of the introduction of CAS</li>
</ul>
<p>then definitely go and upgrade .</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2012/09/22/why-you-should-upgrade-to-wcs11g-or-at-least-fatwire76/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ScalaWCS 0.1 released</title>
		<link>http://www.sciabarra.com/fatwire/2012/09/14/scalawcs-0-1-released/</link>
		<comments>http://www.sciabarra.com/fatwire/2012/09/14/scalawcs-0-1-released/#comments</comments>
		<pubDate>Fri, 14 Sep 2012 03:43:48 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=693</guid>
		<description><![CDATA[Hi all. My first code drop of the ScalaWCS is on GitHub. It is informally 0.1 (not even tagged as such actually), but it is not really yet usable because of the lack of a Scala API, and the documentation is still very rough. So please don't expect to go there and use it, please [...]]]></description>
				<content:encoded><![CDATA[<p>Hi all.</p>
<p>My first code drop of the <a href="https://github.com/sciabarra/scalawcs">ScalaWCS is on GitHub.</a></p>
<p>It is informally 0.1 (not even tagged as such actually), but <strong>it is not really yet usable</strong> because of the lack of a Scala API, and the documentation is still very rough.</p>
<p>So please don't expect to go there and use it, please give a look and let me know what you think if you like.</p>
<p>However some planned key features are already there. Here there are a few:</p>
<h2>Dispatcher to Scala is in place</h2>
<p>The basic idea is that every template will be replaced by a simple Dispatcher with this body:</p>
<pre>&lt;%=wcs.boot.WCS.dispatch(ics)%&gt;</pre>
<p>This body will invoke a corresponding Scala class.</p>
<p>For a CSElement, the class will be in app.CSElement, for a template in app.Template. Then the name of the class is Type.Name, where Type is the name of the type (or Typeless if no type)</p>
<p>Examples:</p>
<p>CSElement swWrapper will invoke class <strong>app.CSElement.swWrapper.</strong></p>
<p>Template Typeless swLayout will invoke class <strong>app.Template.Typeless.swLayout.</strong></p>
<p>Template swBody for Page will invoke class<strong> app.Template.Page.swBody.</strong></p>
<h2>Hot code loading is working.</h2>
<p>You have to deploy a stub in WebCenter Sites, then all the code is deployed in a jar that is dynamically reloaded when you rebuild it. Combined with the continous packaging of SBT, you get the effect "code" then "reload the page" to see the results.</p>
<h2>Tag API is wrapped in Scala</h2>
<p>All the tags can be called in Scala: I generated  a wrapper for each of them from the TLD so you can call a tag as simply as you would invoke a method.</p>
<h1>What is left to do?</h1>
<p>A lot. Here is the plan for 0.2</p>
<ul>
<li>integrate csdt  so you can invoke it from sbt</li>
<li>implement the planned Scala API</li>
<li>create a reference site</li>
<li>create a Mock for ICS so you can unit test templates</li>
</ul>
<div>and this is a list for 0.3</div>
<div>
<ul>
<li>integrate catalogmover in sbt</li>
<li>wrap url assemblers in Scala</li>
<li>wrap filters in scala</li>
</ul>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2012/09/14/scalawcs-0-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Planning a Scala based WCS framework</title>
		<link>http://www.sciabarra.com/fatwire/2012/07/28/planning-a-scala-based-wcs-framework/</link>
		<comments>http://www.sciabarra.com/fatwire/2012/07/28/planning-a-scala-based-wcs-framework/#comments</comments>
		<pubDate>Sat, 28 Jul 2012 14:12:56 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[ScalaWCS]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=679</guid>
		<description><![CDATA[With this post I am starting to collect ideas about developing an Open Source Scala based development framework for WCS, tentatively named ScalaWCS. I am making public my intention in order to collect suggestions, critiques and, why not?, collaborators. The rationale behind this idea is my desire (and I do not think I am alone) [...]]]></description>
				<content:encoded><![CDATA[<p>With this post I am starting to collect ideas about developing an Open Source Scala based development framework for WCS, tentatively named ScalaWCS. I am making public my intention in order to collect suggestions, critiques and, why not?, collaborators.</p>
<p>The rationale behind this idea is my desire (and I do not think I am alone) to  modernise a bit WCS development .</p>
<p>I do all my  work outside Fatwire/WCS in Scala. I love Scala a lot  and I want to use it for Fatwire coding as well. Here I  collected my ideas so far for this framework. I would really like to hear from you what you think.</p>
<p><strong>Warning</strong>: the rest of this article will be hard to read for anyone who does not know Scala. Apologies for this. Maybe the number of developers is really small but Scala is really an exciting and powerful language and it is worth every minute you spent on it.</p>
<h2>Move Away From JSP</h2>
<p>The main goal of this framework is moving away from JSP.  I would like to to do all the coding in Scala instead.</p>
<p>JSP are really meant to be used only as a presentation layer, but in Fatwire you end up to do much more than this in JSP, and it is not very nice.</p>
<p>Of course JSP are actually part of Fatwire, there is no direct replacement for them you cannot get rid of them. But you can use them as a stub to call your Scala code.</p>
<p>The initial, rough idea is that you will keep Templates and CSElement, but the body of a template will be simply something like this</p>
<pre>&lt;% wcs.Dispatcher.dispatch(ics); %&gt;</pre>
<p>(automatically generated configuring the default template ). You are not expected to code anything else.</p>
<p>So, what will replace JSP?</p>
<h2>Scala based templates</h2>
<p>The real code will be written in Scala and will be something like this:</p>
<pre>package article

object Layout extends Template {
    def apply(ics: ICS, c: String, cid: Long) =
      &lt;h1&gt;{ "title"! }&lt;/h1&gt;
      &lt;p&gt;{ "body"! }&lt;/p&gt;
 }</pre>
<p>Instead of writing JSPs you use for rendering a method written in Scala.  For template coding,  I am leveraging the embedded xml literals available in Scala.</p>
<p>Furthermore, I am going to leverage the powerful Scala syntax, that will allow me to write "<strong>title"!  </strong>instead of <strong>ics.GetVar("title")</strong>.</p>
<p>I understand there are some problems with this approach, mostly on  development and deployment. More on this later.</p>
<h2>Nice wrapper on Fatwire API</h2>
<p>Using Scala, I plan to wrap all the existing Fatwire tags with Scala calls. Something like</p>
<pre>&lt;asset:load name="thePage" type="Page" objectid="&lt;%=ics.GetVar("cid")&amp;&gt;"/&gt;
 &lt;asset:get name="thePage" field="id" output="id"/&gt;</pre>
<p>will be available as a Scala call (using named parameters) like:</p>
<pre>asset.load(name="thePage", type="Page", objectid= ("cid"!))
asset.get(name="thePage", field="id", output= "id")</pre>
<p>This is however only the first step. The API will leverage some common elements in the API to be able to do</p>
<pre>val thePage = asset.load("Page", "cid"!)
val id = thePage("id")</pre>
<p>Each element will be functional and will return objects with appropriate methods allowing to extract fields using the apply syntax. A lot of work will be done on making  the API as nice as possible</p>
<p>It would be nice also to be able to keep the tag based syntax in the XML literals.</p>
<p>This should be possible, however the xml literals are not compiled in Scala, while they are in JSP.</p>
<p>A simpler implementation is possible just interpreting them when generating the  output. A more advanced implementation could be generating actual Scala code. This is more difficult to implement since it needs to leverage either a compiler plugin or a Scala macro.  Advantages and disadvantages will have to be carefully considered.</p>
<h2>Real Unit testing</h2>
<p>Once we moved away from JSP, the biggest advantage of using this approach is the possibility to perform <strong>real</strong> unit testing. Any unit test framework can be used, either ScalaTest or Specs2.</p>
<p>Because real code will live outside of WCS it will be possible to test it before deploying. However the framework will have to provide mocks in order to simulate the WCS environment.</p>
<p>This is an important feature.</p>
<div>
<h2>Flexible URL Handling</h2>
<div> I plan to introduce a flexible and general url assembler allowing for arbitrary "routing".</div>
<div></div>
<div>The idea is roughly to introduce a Router object that will perform translations.</div>
<div></div>
<div>If the request is for a url like <strong>/article/London2012?page=1 </strong>(well, actually /cs/Satellite/article/London?page=1)</div>
<div></div>
<div>the url will be first split  in a list of components (<strong>List("article", "London2012")</strong>) and a map or parameters (<strong>Map( "page" -&gt; 1)</strong>), then passed to a a router object,  something like this:</div>
<div></div>
<pre>Router {
   def name2id(name: String) = /* map a name in an id */
   def apply(components: List, param: Map ) components match {
       case Nil =&gt; Map( "c" -&gt; "Page", "cid" -&gt; name2id("Home"))+params
       case cid :: Nil =&gt; Map( "c" -&gt; "Page", "cid" -&gt; name2id(cid))+param
       case c :: cid :: Nil =&gt; Map("c" =&gt; c, cid -&gt; name2id(cid)) + params
   }
}</pre>
<div></div>
<div>The sample router before will return a map where:</div>
<div></div>
<div><strong>c/cid</strong> corresponds to the home page for  an url "/",</div>
<div><strong>c/cid</strong> refers to a Page named "Hello" for url "/Hello",<br />
<strong>c/cid/page</strong> refers to an article named "London2012" with an additional parameter  =1 for the input "/article/London2012?page=1".</div>
<div></div>
<div>The idea however is that the URL assembler will be  easy to change,  allowing for different url strategies that can be dynamically changed.</div>
<div></div>
<div>An interesting feature to consider is using  the router with an "unapply" function that will perform the reverse function, mapping an asset to an url.</div>
<div></div>
<div>This feature should be integrated in the link generation making pretty easy to control the url generation strategy of the URLs.</div>
<h2>Agile Development</h2>
<p>I plan to use SBT (simple build tool) for building the application.</p>
<p>The framework is mostly compatible with the existing frameworks, but it will move away from existing standards because it uses external code (not jsp) to do most of the real work. This poses a serious problem: hot reloading and distributed development.</p>
<p>While JSP have many limits, they have an important advantage, they are recompiled on the fly and the result is immediately visible without restarting the application server. In the case of WCS, it is pretty problematic to perform those restarts, not only because it is time consuming but also because the system can be remote, sometimes even located in another continent, and shared  with other developers.</p>
<p>While I think that working with a local jump start is a better options, I cannot exclude the need to use a shared development environment. Even with  a local development environment there is still the problem that restarting the application development is time consuming, and using non JSP code would require to do for each change.</p>
<p>To solve this problem (admittedly a major one) the fast track is to use the (non free) tool JRebel. The tool is actually free for Scala developers so it is not a cost issue. In the first place I think I will just use JRebel</p>
<p>However it is still a problem when the development server is remote. To solve this problem I am considering to write a custom class loader for a jar file coupled with a "file deployer", integrating the procedure with a SBT tool.</p>
<h2>Conclusion</h2>
<p>This is my first collection of ideas. I plan to launch a poll on Linkedin asking your opinion and I recommend to send me an email or comment this post about what you like or dislike of this idea.</p>
<h2></h2>
<h2></h2>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2012/07/28/planning-a-scala-based-wcs-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The new WCS User Interface</title>
		<link>http://www.sciabarra.com/fatwire/2012/06/10/the-new-wcs-user-interface/</link>
		<comments>http://www.sciabarra.com/fatwire/2012/06/10/the-new-wcs-user-interface/#comments</comments>
		<pubDate>Sun, 10 Jun 2012 21:53:46 +0000</pubDate>
		<dc:creator>msciab</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sciabarra.com/fatwire/?p=667</guid>
		<description><![CDATA[The new  Oracle-branded WecCenter Sites v11g is not a revolutionary product: it is still recognizable as the old, good ContentServer (formerly Fatwire, Divine and OpenMarket) we already know.  Nonetheless, in this new incarnation it looks like a big jump forward. This release is probably defined more from what has been removed than from what has [...]]]></description>
				<content:encoded><![CDATA[<p>The new  Oracle-branded WecCenter Sites v11g is not a revolutionary product: it is still recognizable as the old, good ContentServer (formerly Fatwire, Divine and OpenMarket) we already know.  Nonetheless, in this new incarnation it looks like a big jump forward.</p>
<p>This release is probably defined more from what has been <em>removed</em> than from what has been <em>added. </em>Most of  the work done  on WCS looks to be a great effort to simplify, make uniform and consistent,  overall improve the user experience of the product. The first and more evident feature gone is the dash interface (but not its functionalities). It is also gone the insite interface,  but again,  insite editing is now even more powerful.</p>
<p>There is no more the dualism of 3 competing user interface (dash, advanced and insite), where you can do more or less the same thing in different incarnations. Instead, there is now one unified UI. It acts like the old Advanced interface when it comes to manage "advanced" content assets (mostly used by developers and webmasters) . The UI also acts like the dash interface to browse and edit content, but seamlessly integrates  insite editing to preview and edit content at the same time.</p>
<p>Let's do a walkthrough with screenshots to  understand better.</p>
<h2>The Administrative interface</h2>
<p>Let's start from the administrative (the old avanced) interface. It is now probably  going to be the less used but we start from it because it is familiar to the vast majority of current users.</p>
<p>On the top of the screen there is now a toolbar allowing to select the interface (now there are 2, the administrative and the contributor). If we select the administrative interface, as below:</p>
<p><img class="aligncenter" title="Advanced/Contributor" src="http://www.sciabarra.com/snapshot/2012/06/10/1339357436.png" alt="" width="131" height="60" /></p>
<p>&nbsp;</p>
<p>It is now possible to create and search assets, but, important new, ONLY administrative assets: templates, cselements, attributes, definitioins and so on. It is <strong>no more</strong> possible create and edit content assets from this interface.</p>
<p>Creating an asset is still done in the old way. For example clicking on a start menu link to create a new template:</p>
<p><img class="aligncenter" title="New Template" src="http://www.sciabarra.com/snapshot/2012/06/10/1339357532.png" alt="" width="338" height="26" /></p>
<p>&nbsp;</p>
<p>then the usual form is shown:</p>
<p><img class="aligncenter" title="New Template Form" src="http://www.sciabarra.com/snapshot/2012/06/10/1339357599.png " alt="" width="463" height="371" /></p>
<p>&nbsp;</p>
<p>nothing new under the sun regarding the administrative assets (except a css restyling). The interesting parts comes now.</p>
<h2> The Contributor interface</h2>
<p>When we select the new Contributor Interface things start to became new (and interesting):</p>
<p><img class="aligncenter" title="Contributor Interface" src="http://www.sciabarra.com/snapshot/2012/06/10/1339358515.png" alt="" width="133" height="61" /></p>
<p>Creating a new element now requires you select it from the menu. The new  action  now appears in a pull down menu:</p>
<p><a href="http://www.sciabarra.com/fatwire/wp-content/uploads/2012/06/Screen-shot-2012-06-10-at-20.48.31.png"><img class="aligncenter" title="New Article" src="http://www.sciabarra.com/fatwire/wp-content/uploads/2012/06/Screen-shot-2012-06-10-at-20.48.31.png" alt="" width="390" height="364" /></a></p>
<p>&nbsp;</p>
<p>Content can be edited now in a form, so in a sense it is still possible to do form oriented content editing. See below and please note the toolbar of saving, approving , previewing and deleting.</p>
<p>&nbsp;</p>
<div><img class="aligncenter" title="Form" src="http://www.sciabarra.com/snapshot/2012/06/10/1339357892.png" alt="" width="589" height="354" /></div>
<div></div>
<div>However, the interesting part is the switch to enable a visually oriented content editing. Just click on the switch and the form becames an (editable) preview.</div>
<div></div>
<div><img class="aligncenter" title="Web" src="http://www.sciabarra.com/snapshot/2012/06/10/1339358063.png" alt="" width="630" height="455" /></div>
<div></div>
<div>Here the content editing is pretty rich. You can drag and drop an image to insert it  in an area of the page, click on a text field to do inline editing, click on a date area to display a date picker and so on.</div>
<div></div>
<div><a href="http://www.sciabarra.com/fatwire/wp-content/uploads/2012/06/Screen-shot-2012-06-10-at-20.58.49.png"><img class="aligncenter size-full wp-image-671" title="Insite Editing" src="http://www.sciabarra.com/fatwire/wp-content/uploads/2012/06/Screen-shot-2012-06-10-at-20.58.49.png" alt="" width="653" height="318" /></a></div>
<div></div>
<div>Definitely, now the content editing integrates the 2 different interfaces (dash and insite) but it has became much easier to understand. Overall the user experience is way simpler and straightforward. Furthermore, a lot of duplications are removed, while keeping and even improving the features already available.</div>
<div></div>
<div>Definitely a sign of product maturation worth to be now the Oracle CMS. Because the software has been developed before the acquisition, it is worth to say: excellent job, Fatwire!</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sciabarra.com/fatwire/2012/06/10/the-new-wcs-user-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
