Archive for the ‘FormsPublisher’ Category

in a component, you can link to a specific page by using $PAGE_LINK[name of page].
for example $PAGE_LINK[help/howto] will link to the current site help/

Using $URL_PREFIX works in a similar way so that area relative paths can be used,e.g. $URL_PREFIX/images/icons/favicon.png.

Datasources allow mainly to select things from drop-down lists in forms publisher forms and workflow forms.

Datasources are nothing but java classes that get executed when a form loads. The class must implement one of the following interfaces:


As part of the implementation, the class must therefore have an execute method which gets passed a DataSourceContext object. The return value and type vary depending of which datasource class you implement.

A SimpleDataSource implementation returns a single value. Forms publisher will use the value for example in a text field.

public String execute(String sessionId, String context, Map params) {
String datasource="value";

A ListDataSource implementation will return a List of strings. Forms publisher will use the same value for the form’s value and label.

public List<String> execute(DataSourceContext context) {
List<String> datasource = new ArrayList<String>();

The context contains some information about the session id, the server context (the vpath of the current node) and the other custom parameters passed to the datasource.

A MapDataSource implementation will return map of strings. Forms publisher will use one value for the label and the other for the value. The key is the value string.

public Map<String, String> execute(DataSourceContext context) {
Map<String,String> datasource = new HashMap<String,String>();
datasource.put("value","label"); // make sure you convert numbers to proper strings

The SortedMapDataSource implementation returns the same as a MapDataSource, except Forms Publisher will sort the results alphabetically.

public Map<String, String> execute(DataSourceContext context) {
Map<String, String> datasource = new HashMap<String, String>();
datasource.put("value", "label"); // make sure you convert numbers to proper strings
return (datasource);

In order to create a new datasource, we need to edit the local/config/DataSourceConfig.xml file. This file is an XML document which defines which datasources are available to the system as a whole.

For the example that follows, we will create a datasource that will allow a user to select an edition from the current branch. We need to add our datasource to the list by adding the following:

<name>Main Branch Editions</name>
<param name="branch">/default/main</param>

We will build a class with that name as follows:

package com.acme.util;

import com.interwoven.cssdk.factory.CSLocalFactory;
import com.interwoven.cssdk.filesys.CSBranch;
import com.interwoven.cssdk.filesys.CSEdition;
import com.interwoven.cssdk.filesys.CSVPath;
import com.interwoven.datasource.core.DataSourceContext;
import com.interwoven.datasource.SortedValuesMapDataSource;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

public class BranchEditionsDataSource implements SortedValuesMapDataSource {

 public Map<String, String> execute(DataSourceContext context) {
 Map<String, String> parameters = context.getAllParameters();
 Map<String, String> datasource = new HashMap<String, String>();
 String sessionString = context.getSessionId();
 String configFilePath = "/apps/interwoven/teamsite/cssdk/cssdk.cfg";
 Properties localProperties = new Properties();
 localProperties.setProperty("cssdk.cfg.path", configFilePath);
 CSLocalFactory csLocalFactory = (CSLocalFactory) CSLocalFactory.getFactory(localProperties);
 CSClient client = null;

 try {
 client = csLocalFactory.getClient(sessionString, Locale.ENGLISH, "BranchEditionsDataSource", "localhost");
 if (client != null) {
 String branchParameter = parameters.get("branch");
 CSVPath branchVPath = null;
 if (branchParameter != null) {
 branchVPath = new CSVPath(branchParameter);
 } else {
 branchVPath = new CSVPath(context.getServerContext());
 if (branchVPath != null) {
 branchVPath = branchVPath.getBranch(); // make sure we have a branch, really...
 CSBranch branch = client.getBranch(branchVPath, true);
 if (branch != null) {
 CSEdition[] editions = branch.getEditions(true, false, -1);
 for (CSEdition edition : editions) {
 datasource.put(edition.getVPath().toString(), edition.getName() + " - " +                                             edition.getDescription());
 } else {
 throw new NullPointerException("branch is null");
 } else {
 throw new NullPointerException("branch vpath is null");
 } else {
 throw new NullPointerException("client is null");
 } catch (Exception ex) {
 datasource = new HashMap<String, String>();
 datasource.put("error", "An error occured. Please contact your administrator");
 Logger.getLogger(BranchEditionsDataSource.class.getName()).log(Level.SEVERE, null, ex);

 return (datasource);

The context gives you all you need to connect to the local Teamsite server using the session id. From there, we can either grab the editions of the branch passed as a parameter or the current branch. You can also extend


This will give you the ability to grab the client with a simple method call of:

CSClient client=getClient(context);

You will have to use the parameters that the class expects to make the connection:

<param name="servername">teamsite</param>
<param name="csFactory">com.interwoven.cssdk.factory.CSLocalFactory</param>

Once the class has been compiled into the toolkit, we can then tell out formspublisher item to use it.

we can use a “inline” element, with a Datasource “pseudo-command” (note that this is case sensitive). This works for text instances and select, radio and checkbox instances.

    <inline command="Datasource:executeComponent:Main Branch Editions" />

All you now need to do is check the work in the form’s drop down list..

I was looking for something entirely different and found this blog about interviewers asking questions at interviews and why they are good questions.

I decided to answer them to find out how I would fare in the modern day interview.

What industry sites and blogs do you read regularly?

six revisions is the best place to keep my design skills accurate. Since I am mostly a developer and not a designer, I need to work at it. So I read that, although whatever development they have there is mostly front-end. With back-end development, the blogs are a little more involved and I am struggling to find the time to read them and I’ve not really found any that talk about Autonomy/Interwoven products in as much detail as I do. (by the way, I’d be happy to be proven wrong).

Do you prefer to work alone or on a team?

It varies depending on the complexity of the project and the complexity of the task at hand. the size of the projeccts I work on tend to be quite big, so collaboration is essential. However, we are mostly thinkers and in order to be effective, you need a place to think. I do work better in quiet environments.

How comfortable are you with writing HTML entirely by hand? (+exercise)

When I started, there wasn’t many WYSIWYG editors that could do the job so I had no choice. I still code HTML by hand today.
The editor I use (beloved Netbeans) has syntax highlighting and code completion on HTML so it goes quite fast.

What is the w3c?

World Wide Web consortium. They help define the standards of the web and their best task is to prevent Microsoft from messing things up too much and going off in a tangeant.

Can you write table-less XHTML?  Do you validate your code?

I do write table-less XHTML and CSS, although I tend to work with designers a lot so I usually have them verify the CSS. My code always validates if I can help it.

What are a few of your favorite development tools and why?

My favorite development tool is Netbeans. With it, I can do Java, HTML, CSS, javascript, XML and XSL. For mee it’s very complete. Put a layer of Firefox on top with a few choice add-ons like Firebug and HTML validator and you have a complete set-up. I also use my blog a lot, as I use it as a knowledge repository.

Describe/demonstrate your level of competence in a *nix shell environment

(the original question asked how to recursively copy directories and how to make a file only readable by the owner).
cp -R somedir, chmod 500 somefile

What skills and technologies are you the most interested in improving upon or learning?

For me, the back-end Java is just as satisfying as the front-end javascript. I am a developer at heart. The web services layer for me still holds a few secrets I’d like to unlock. I think this is the final layer I need before I’d start confortably call myself a J2EE web architect.

Show me your portfolio!

I have worked on intranets and Internet sites so not all of it can be accessed externally. Here are the few that still are in existance.,,

What sized websites have you worked on in the past?

The biggest was the Environment Agency. It was big with all its metrics: number of pages, number of editors, number of visitors. the Environment Agency is responsible for flood warnings and that was always a high profile project within the  programme of work. When the UK is hit by a series of floods, The website is hit by a deluge of requests. We had to put in place a fail-over static webserver to take over when the dynamic servers would not cope anymore and use caching… a lot of it.

Atkins intranet was big. They had everything on it and as soon as you need anything, all 15000 employees could need anything from blueprints to communications setting, they found it there. The pressure came as the system grew out of proportion and we had to do something about it. We upgraded everything: software and hardware.

Nomura’s intranet site is also quite popular within. Every department has an intranet site, from Operations to Facilities management via Equities. The support function is quite intense there as the department staff are updating their sites themselves, and not all are fully web savy.

Show me your code!

I am not afraid of putting my words where my mouth is. ask me what you want to achieve and I’d develop it for you. For some code samples, there are plenty on my blog.

What are a few sites you admire and why? (from a webdev perspective)
I am a guy without bling. This transfers in my online tastes. I go to sites because they do what they say they do, not because they look good.
Linkedin is very useful and feedshow is very handy. Google maps is always reliable. functionaly over form. Always.

Fix this code, please.

(the original question prompts the interviewer to show broken code).
Yes, I can do that too.

I just pulled up the website you built and the browser is displaying a blank page.  Walk me through the steps you’d take to troubleshoot the problem.

these would by my methods for solving the problem

Press F5
Press Control+F5
view source. Is the response empty? is the HTML invalid? is the CSS valid?
is any other page displaying similar symptoms?
what is the HTTP response code? 200? other? telnet to the server on port 80 and issue an HTTP request manually. use Fiddler to see more.

What’s your favorite development language and why?  What other features (if any) do you wish you could add to this language?
Java has been hard to learn, because I am a perfectionist. I want to know how to do things, but I want to understand how they work. RMI was very painful that way.
But now I know it, I couldn’t go back to programming in Perl easily.
I think one thing Java could borrow from Javascript is how to add methods to objects like you can assign variables for example. I have found that very useful when doing callbacks in Javascript for example. I am sure this could change a couple of things.

Do you find any particular languages or technologies intimidating?

If I had limitless time resources, none – but that’s not how it works. I focus on the things I need for work and try to learn them before I need them but that’s not always possible. Microsoft technologies are intimidating, not because they’re hard but because you put code in and you don’t know what’s going to come out.

Acronym time (oh boy!)

I don’t like this questions. Acronyms are not your friend. the reason I am saying this is because two different sectors of technology could use the same acronym for different things. Jargon needs to be understood to be effective. the purpose of communication is to understand and be unsertood. Coding things for the sake of coding things is not a clever thing to do, unless both parties have a common understanding. The whole industry suffers of jargon overdose as a whole: ECM, WCM, DM. And yes, I do know what HTML, XML and CSS stand for.

What web browser do you use?

I prefer firefox. whenever I need to develop new stuff, I normally try it out there first. IE comes second. Usually, this is sufficient to ensure it works every where. Then there is IE6. I stopped supporting it for anything personal that I do. Only in the heavy corporate world is it still used, and only there I support it.

Rank your interest in these development tasks from 1 to 5 (1 being not interested at all, 5 being extremely interested)

Java 5, HTML 3, XSL 5, XML 5, CSS 2, javascript 5, content 1, documentation 3, project management 3

What are a few personal web projects you’ve got going on?

I am creating the website for the new side venture I am starting for Wedding Photography. It is quite a good project as it brought with it a lot of new stuff about image manipulation. It uses a custom tag library that I wrote to do XSL transformation of XML documents in the same way that Interwoven LivveSite does. I uses XML to store photo galleries, transforms them using XSL to create the online galleries. It also uses AJAX to dynamically provide slideshow of the whole gallery without compromising initial load times. The site is not live yet and won’t be for a little while as holding a day job, getting married and moving house doesn’t leave much spare time.

Firefox for me has been the most customisable and because of this, it has given me the most enriched browsing experience.
I am a web developer amd the mutlitude of shortcuts I can use really saves me time. I bookmark and organise my boobmark with 1 click, and I have a lot of those. I get rid of annoying ads, added functionality to my search engines, added search engines to look for documentation quickly.
For me, it also renders HTML the way HTML is supposed to be rendered, which I cannot say the same for Microsoft Internet Explorer. Stay away from Microsoft on this one. And to top ot all up, I can create an add-on so that users visiting my site have an extra-rich experience. Linked-in did it, so can I.

For me the browser war is not just something that happens in the background. Whenever I see people, colleagues, who develop in IE and don’t make their site standard compatible, I cringe.  whenever I go to  company that insists that we must use IE as the de-facto company browser, I cringe. the reason I cringe is because if you had a car manufacturer produced a car so fuel inefficient, so clunky to drive and with a engine without 3rd gear, you wouldn’t want to drive it, would you? Now why the hell is this what most companies choose to do with their browsers is beyond me…

Some even elected to stay with IE6… I wouldn’t work for them.

If you want to know the old perl templating tags and are searching for the help files, here’s the url: