<?xml version="1.0" encoding="UTF-8"?>
<MetamergeConfig IDIversion="Created by TDI6.1.1 - 2008-09-02" created="Mon Nov 19 15:00:27 CET 2007" createdBy="NO010196" modified="Sat Oct 11 12:03:10 CEST 2008" modifiedBy="NO010196" version="6.1.1">
<Folder name="AssemblyLines">
<AssemblyLine name="FeedServer">
<Settings>
<parameter name="ALPoolSettingsDialog">showALPoolSettings</parameter>
<parameter name="automapattributes">false</parameter>
<parameter name="createTombstones">false</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeGlobalPrologs">true</parameter>
<parameter name="includePrologs">rssFeed()</parameter>
<parameter name="nullBehaviorDialog">showNullBehavior</parameter>
</Settings>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<LogConfig/>
<ContainerEF name="EntryFeedContainer">
<Connector name="HTTP Listener">
<InheritFrom>system:/Connectors/ibmdi.HTTPServer</InheritFrom>
<ConnectorMode>Server</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>[parent]</InheritFrom>
<parameter name="authConnector">(none)</parameter>
<parameter name="authRealm">IBM Tivoli Directory Integrator</parameter>
<parameter name="contentType">text/html</parameter>
<parameter name="debug">false</parameter>
<parameter name="headersAsProperties">false</parameter>
<parameter name="httpAuth">false</parameter>
<parameter name="msgChunked">false</parameter>
<parameter name="needClientAuth">false</parameter>
<parameter name="tcpDataAsProperties">true</parameter>
<parameter name="tcpPort">80</parameter>
<parameter name="useSSL">false</parameter>
</Configuration>
<Parser>
<InheritFrom>[parent]</InheritFrom>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>*</Name>
<Type>simple</Type>
<Simple>*</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>http.body</Name>
<Type>simple</Type>
<Simple>http.body</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>http.content-type</Name>
<Type>advanced</Type>
<Script>ret.value = "text/xml";</Script>
<Simple>http.content-type</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>http.redirect</Name>
<Type>simple</Type>
<Simple>http.redirect</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>http.status</Name>
<Type>simple</Type>
<Simple>http.status</Simple>
</AttributeMapItem>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
</Connector>
</ContainerEF>
<ContainerDF name="DataFlowContainer">
<ALMap name="Parse feed name">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>FeedName</Name>
<Type>advanced</Type>
<Script><![CDATA[base = work.getString("http.base");

task.logmsg("* Feed request: " + base);

if (!base || base.trim() == "/")
	ret.value = "Feeds"
else
	ret.value = base;]]></Script>
<Simple>http.base</Simple>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
<Branch name="IF valid Feed Name">
<Connector name="Run Feed AL">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript><![CDATA[// Since I will be accumulating the Work Entries from the
// called AL, I have to start it using some JavaScript.
//

var accum = new java.util.Vector(); // for accumulating Entries
var tcb = system.newTCB(); // used to pass params into a called AL
tcb.setAccumulator(accum);

// Now we want to pass in the http.base and http.host, plus any
// parsed query strings to the called Feed AL
var attnames = work.getAttributeNames();
var opentry = system.newEntry();
for (name in attnames)
	if (name.startsWith("http"))
		opentry.setAttribute(work.getAttribute(name));
tcb.setOperationInitParams(opentry);

try {
	task.logmsg("* Starting Feed AL: " + work.getString("FeedName"));
	var al = main.startAL(work.getString("FeedName"), tcb);
	al.join();
} catch (al_exception) {
	task.logmsg("Error running feed (" + 
				work.getString("FeedName") + "): " +
				al_exception);
}
]]></ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ScriptCondition><![CDATA[feedName = work.getString("FeedName");

if (!feedName || feedName.indexOf(".ico") > 0)
	ret.value = false
else
	ret.value = true;]]></ScriptCondition>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Branch name="IF No Entries returned">
<ALMap name="Return error">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>rss.channel.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "TDI AssemblyLine: " + task.getShortName();</Script>
<Simple>rss.channel.description</Simple>
<SubstitutionTemplate>TDI RSS Data Pump Solution</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.generator</Name>
<Type>substitution</Type>
<Simple>rss.channel.generator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + work.getString("http.host") +
			"/" + task.getShortName();]]></Script>
<Simple>rss.channel.link</Simple>
<SubstitutionTemplate>{conn.rss.channel.link}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.title</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "Empty feed or error encountered for '" + task.getShortName() + "'";</Script>
<Simple>rss.channel.title</Simple>
<SubstitutionTemplate>{conn.rss.channel.title}</SubstitutionTemplate>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
<Connector name="Add to accumulator">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript><![CDATA[var errorEntry = system.newEntry();
var attnames = work.getAttributeNames();

for (name in attnames) 
	if (name.startsWith("rss."))
		errorEntry.setAttribute(work.getAttribute(name));

accum.add(errorEntry);]]></ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ScriptCondition><![CDATA[ret.value = accum.size() == 0;]]></ScriptCondition>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<ALMap name="Set http.body">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>http.body</Name>
<Type>advanced</Type>
<Script>ret.value = rssFeed(accum);  // defined in the rssFeed() library script</Script>
<Simple>http.body</Simple>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
</ContainerDF>
<ThreadOptions>
<parameter name="assemblyline.ehc.executeProlog">false</parameter>
<parameter name="assemblyline.ehc.maxInstance">10</parameter>
<parameter name="assemblyline.ehc.minPrepare">5</parameter>
</ThreadOptions>
<Operations/>
<InitParams>
<Schema name="AssemblyLineInitParams"/>
</InitParams>
</AssemblyLine>
<AssemblyLine name="Buffalo">
<Settings>
<parameter name="ALPoolSettingsDialog">showALPoolSettings</parameter>
<parameter name="automapattributes">false</parameter>
<parameter name="createTombstones">false</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeGlobalPrologs">true</parameter>
<parameter name="maxread"/>
<parameter name="nullBehaviorDialog">showNullBehavior</parameter>
</Settings>
<Hooks>
<Hook>
<Name>prolog0</Name>
<Script><![CDATA[pageSize = task.getOpEntry().getString("http.qs.pageSize");

if (system.isValidInt(pageSize))
	pageSize = system.toInt(pageSize)
else
	pageSize = 10;

page = task.getOpEntry().getString("http.qs.page");

if (system.isValidInt(page))
	page = system.toInt(page)
else
	page = 1;

skipCount = (page-1)*pageSize;
readCount = pageSize;]]></Script>
<Enabled>true</Enabled>
</Hook>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<LogConfig/>
<ContainerEF name="EntryFeedContainer">
<Connector name="ReadBuffalo">
<InheritFrom>system:/Connectors/ibmdi.LDAP</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<UserComment/>
<InheritFrom>[parent]</InheritFrom>
<parameter name="automapADPassword">false</parameter>
<parameter name="debug">false</parameter>
<parameter name="ldapAddAttr">false</parameter>
<parameter name="ldapAuthenticationMethod">Simple</parameter>
<parameter name="ldapPageSize">0</parameter>
<parameter name="ldapReferrals">follow</parameter>
<parameter name="ldapSearchBase">o=University at Buffalo,c=US</parameter>
<parameter name="ldapSearchScope">subtree</parameter>
<parameter name="ldapSizeLimit">0</parameter>
<parameter name="ldapTimeLimit">0</parameter>
<parameter name="ldapUrl">ldap://ldap.buffalo.edu</parameter>
<parameter name="ldapUseSSL">false</parameter>
<parameter name="ldapVLVPageSize">0</parameter>
<parameter name="simulateRename">false</parameter>
<parameter name="userComment"/>
</Configuration>
<Parser>
<InheritFrom>[parent]</InheritFrom>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>*</Name>
<Type>simple</Type>
<Simple>*</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>$dn</Name>
</SchemaItem>
<SchemaItem>
<Name>affiliationcode</Name>
</SchemaItem>
<SchemaItem>
<Name>cn</Name>
</SchemaItem>
<SchemaItem>
<Name>degrees</Name>
</SchemaItem>
<SchemaItem>
<Name>department</Name>
</SchemaItem>
<SchemaItem>
<Name>email</Name>
</SchemaItem>
<SchemaItem>
<Name>mail</Name>
</SchemaItem>
<SchemaItem>
<Name>objectclass</Name>
</SchemaItem>
<SchemaItem>
<Name>physicaldeliveryofficename</Name>
</SchemaItem>
<SchemaItem>
<Name>serialnumber</Name>
</SchemaItem>
<SchemaItem>
<Name>sn</Name>
</SchemaItem>
<SchemaItem>
<Name>telephonenumber</Name>
</SchemaItem>
<SchemaItem>
<Name>title</Name>
</SchemaItem>
<SchemaItem>
<Name>uid</Name>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
</Connector>
</ContainerEF>
<ContainerDF name="DataFlowContainer">
<Branch name="IF skipping">
<Connector name="Skip entry">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>system.skipEntry();</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ScriptCondition><![CDATA[ret.value = skipCount-- > 0; // defined in the AL Prolog Before Init Hook]]></ScriptCondition>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Branch name="ELSE map 2 RSS">
<ALMap name="Map 2 RSS">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>rss.channel.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "TDI AssemblyLine: " + task.getShortName();</Script>
<Simple>rss.channel.description</Simple>
<SubstitutionTemplate>TDI RSS Data Pump Solution</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.generator</Name>
<Type>substitution</Type>
<Simple>rss.channel.generator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + task.getOpEntry().getString("http.host") +
			"/" + task.getShortName();]]></Script>
<Simple>rss.channel.link</Simple>
<SubstitutionTemplate>{conn.rss.channel.link}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.title</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "RSS feed generated by TDI AssemblyLine '" + task.getShortName() + "'";</Script>
<Simple>rss.channel.title</Simple>
<SubstitutionTemplate>{conn.rss.channel.title}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.category</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.category</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.comments</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.comments</Simple>
<SubstitutionTemplate>Thanks to the University of Buffalo for the gentle use of their directory.</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.content:encoded</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.content:encoded</Simple>
<SubstitutionTemplate><![CDATA[<p><br/><br/><b>Encoded content for {work.FullName}</b><br/><br/><p>
<p>Email set to: <b>{work.mail}</b><p>]]></SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.dc:creator</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.dc:creator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<SubstitutionTemplate>{work.degrees} {work.department}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.guid</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>uid</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + task.getOpEntry().getString("http.host") +
			"/FindPerson=" +
			work.getString("uid");]]></Script>
<Simple>email</Simple>
<SubstitutionTemplate>http://193.90.235.232/findUID/{work.uid}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.title</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>cn</Simple>
<SubstitutionTemplate>{work.cn} ({work.title})</SubstitutionTemplate>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
<Branch name="IF page full">
<Connector name="Stop AL">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>task.shutdown();</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ScriptCondition><![CDATA[ret.value = readCount-- <= 0; // defined in the AL Prolog Before Init Hook]]></ScriptCondition>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>2</Type>
</Branch>
<Connector name="display">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Disabled</ConnectorState>
<Configuration/>
<ConnectorScript><![CDATA[var attnames = work.getAttributeNames();

for (name in attnames)
	if (!name.startsWith("rss"))
		work.removeAttribute(name);

task.logmsg(work);]]></ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
</ContainerDF>
<ThreadOptions/>
<Operations/>
<InitParams>
<Schema name="AssemblyLineInitParams">
<SchemaItem>
<Name>page</Name>
<NativeSyntax>Number</NativeSyntax>
</SchemaItem>
<SchemaItem>
<Name>pageSize</Name>
<NativeSyntax>Number</NativeSyntax>
</SchemaItem>
</Schema>
</InitParams>
</AssemblyLine>
<AssemblyLine name="Levels">
<LogEnabled>true</LogEnabled>
<Settings>
<parameter name="ALPoolSettingsDialog">showALPoolSettings</parameter>
<parameter name="ScriptEngine">JavaScript</parameter>
<parameter name="automapattributes">false</parameter>
<parameter name="createTombstones">false</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeGlobalPrologs">true</parameter>
<parameter name="maxread"/>
<parameter name="nullBehaviorDialog">showNullBehavior</parameter>
</Settings>
<Hooks>
<Hook>
<Name>prolog0</Name>
<Script><![CDATA[pageSize = task.getOpEntry().getString("http.qs.pageSize");

if (system.isValidInt(pageSize))
	pageSize = system.toInt(pageSize)
else
	pageSize = 10;

page = task.getOpEntry().getString("http.qs.page");

if (system.isValidInt(page))
	page = system.toInt(page)
else
	page = 1;

skipCount = (page-1)*pageSize;
readCount = pageSize;]]></Script>
<Enabled>true</Enabled>
</Hook>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<LogConfig/>
<ContainerEF name="EntryFeedContainer">
<Connector name="GetBasePage">
<InheritFrom>system:/Connectors/ibmdi.HTTPClient</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>[parent]</InheritFrom>
<parameter name="debug">false</parameter>
<parameter name="inbody"/>
<parameter name="method">GET</parameter>
<parameter name="outbody"/>
<parameter name="password"/>
<parameter name="proxy"/>
<parameter name="url">http://www.osi.uio.no/elvepadling/vannstand.html</parameter>
<parameter name="username">anonymous</parameter>
</Configuration>
<ComputeChanges>true</ComputeChanges>
<DeltaBehavior>0</DeltaBehavior>
<DeltaStrict>true</DeltaStrict>
<Parser>
<InheritFrom>system:/Parsers/ibmdi.ScriptParser</InheritFrom>
<parameter name="characterSet"/>
<parameter name="debug">false</parameter>
<parameter name="isnamespaceaware">false</parameter>
<parameter name="isvalidating">false</parameter>
<parameter name="omitxmldeclaration">false</parameter>
<parameter name="script"><![CDATA[function writeEntry() {
}

function readEntry ()
{
	var indOfURL ="";

	var str = inp.readLine();

	if (str == null) {
		result.setStatus (0);
		result.setMessage ("End of input");
		return;
	}


	var line = String(str);
	indOfURL = line.indexOf( "http://www2.nve.no/h/hd/plotreal/Q");
	while ( indOfURL == -1 ) {		
		str = inp.readLine();
		if (str == null) {
			result.setStatus (0);
			result.setMessage ("End of input");
			return;
		}
		var line = String(str);
		indOfURL = line.indexOf("http://www2.nve.no/h/hd/plotreal/Q");
	}

	var indOfURLend = line.indexOf( "\"", indOfURL);	
	var url = line.substring(indOfURL, indOfURLend);

	if (url == null && url == "") {
		result.setStatus (0);
		result.setMessage ("End of input");
		return;
	}

	entry.setAttribute ("url", url);
	result.setStatus (1);
}
]]></parameter>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>url</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[url = conn.getString("url");

ret.value = url.substring(0, url.length()-10);]]></Script>
<Simple>url</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>http.--------------</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>http.Accept-Ranges</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.Connection</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.Content-Length</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.Content-Type</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.Date</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.ETag</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.Last-Modified</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.Proxy-Connection</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>http.Server</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.Transfer-Encoding</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>http.X-Cache</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>http.body</Name>
<Syntax>java.lang.StringBuffer</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.body.response</Name>
<Syntax>java.lang.StringBuffer</Syntax>
</SchemaItem>
<SchemaItem>
<Name>http.responseCode</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>http.responseMsg</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
<SchemaItem>
<Name>url</Name>
<Syntax>java.lang.String</Syntax>
<Presence>null</Presence>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="autoreconnect">true</parameter>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
</Connector>
</ContainerEF>
<ContainerDF name="DataFlowContainer">
<Branch name="IF Skipping">
<Connector name="Skip entry">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>system.skipEntry();</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ScriptCondition><![CDATA[ret.value = skipCount-- > 0; // defined in the AL Prolog Before Init Hook]]></ScriptCondition>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Branch name="ELSE get level">
<Connector name="GetStationInfo">
<InheritFrom>system:/Connectors/ibmdi.HTTPClient</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>[parent]</InheritFrom>
<parameter name="debug">false</parameter>
<parameter name="inbody"/>
<parameter name="method">GET</parameter>
<parameter name="outbody"/>
<parameter name="password"/>
<parameter name="proxy"/>
<parameter name="url">@SUBSTITUTE{work.url}/index.html</parameter>
<parameter name="username">anonymous</parameter>
</Configuration>
<ComputeChanges>true</ComputeChanges>
<DeltaBehavior>0</DeltaBehavior>
<DeltaStrict>true</DeltaStrict>
<Parser>
<InheritFrom>system:/Parsers/ibmdi.ScriptParser</InheritFrom>
<parameter name="characterSet"/>
<parameter name="debug">false</parameter>
<parameter name="script"><![CDATA[function showArray(a) {
	task.logmsg("");
	for (var i = 0; i < a.length; i++)
   		task.logmsg("showArray(a) - a[" + i + "]: " + a[i]); 
}

function writeEntry() {
}

function readEntry () {
	var p;
	var parts;
	var gotName = false;
	var gotElevation = false;
	do {
	  var str = inp.readLine();

	  if (str == null) {
	    result.setStatus (0);
		result.setMessage ("End of input");
		return;
      }

      if ( (p = str.indexOf("Stasjonsnavn")) >= 0) {
		parts = system.splitString(str, "<B>");
		entry.setAttribute("StationName", parts[1].trim());
		entry.setAttribute("Zone", parts[4].trim());
		gotName = true;
	  }

      if ( (p = str.indexOf("Stasjonens h.o.h")) >= 0) {
		parts = system.splitString(str, "<B>");
		entry.setAttribute("MetersOverSeaLevel", parts[1].trim());
		gotElevation = true;
	  }
	} while (!gotName || !gotElevation);
}
]]></parameter>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>MetersOverSeaLevel</Name>
<Type>simple</Type>
<Simple>MetersOverSeaLevel</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>StationName</Name>
<Type>simple</Type>
<Simple>StationName</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>Zone</Name>
<Type>simple</Type>
<Simple>Zone</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>MetersOverSeaLevel</Name>
</SchemaItem>
<SchemaItem>
<Name>StationName</Name>
</SchemaItem>
<SchemaItem>
<Name>Zone</Name>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
<LinkCriteriaItem>
<Key>10867909ac8</Key>
<Attribute>http.responseMsg</Attribute>
<Operator>contains</Operator>
<Value>200</Value>
</LinkCriteriaItem>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="autoreconnect">true</parameter>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
<InitializeOption>3</InitializeOption>
</Connector>
<Branch name="IF no data found">
<Connector name="skipEntry">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>system.skipEntry(); // Return to Iterator for the next one</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<Conditions>
<BranchCondition>
<LeftHand>StationName</LeftHand>
<Operator>exists</Operator>
<Negate>true</Negate>
<CaseSensitive>true</CaseSensitive>
</BranchCondition>
</Conditions>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Connector name="GetWaterLevel">
<InheritFrom>system:/Connectors/ibmdi.HTTPClient</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>[parent]</InheritFrom>
<parameter name="debug">false</parameter>
<parameter name="method">GET</parameter>
<parameter name="outbody"/>
<parameter name="url">@SUBSTITUTE{work.url}/doegndata.txt</parameter>
</Configuration>
<Parser>
<InheritFrom>system:/Parsers/ibmdi.ScriptParser</InheritFrom>
<parameter name="characterSet"/>
<parameter name="debug">false</parameter>
<parameter name="script"><![CDATA[function showArray(a) {
	task.logmsg("");
	for (var i = 0; i < a.length; i++)
   		task.logmsg("showArray(a) - a[" + i + "]: " + a[i]); 
}

function writeEntry() {
}



function readEntry ()
{
	lastStr = "";
	str = "";

	// First read to the last line
	while ((str = inp.readLine()) != null)
		lastStr = str;

	var parts = system.splitString(lastStr, " ");

	if (parts.length < 5) {
		result.setStatus (0);
		result.setMessage ("End of input");
		return;
	}

// showArray(parts);

	entry.setAttribute("DateOfReading", system.parseDate(parts[0].trim(), "ddMMyyyy"));
	entry.setAttribute("Level", Number(parts[3].trim()));

// main.dumpEntry(entry);

	result.setStatus (1);
}
]]></parameter>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>DateOfReading</Name>
<Type>simple</Type>
<Simple>DateOfReading</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>Level</Name>
<Type>simple</Type>
<Simple>Level</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>DateOfReading</Name>
</SchemaItem>
<SchemaItem>
<Name>Level</Name>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
<InitializeOption>3</InitializeOption>
</Connector>
<ALMap name="Format Date">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>DateStr</Name>
<Type>advanced</Type>
<Script><![CDATA[dt = work.getObject("DateOfReading");

ret.value = system.formatDate(dt, "d MMM yyyy");]]></Script>
<Simple>DateStr</Simple>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
<ALMap name="Map2RSS">
<InheritFrom>/AttributeMaps/Map2RSS</InheritFrom>
<AttributeMap name="Input">
<InheritFrom>[no inheritance]</InheritFrom>
<AttributeMapItem>
<Name>rss.channel.description</Name>
<Type>substitution</Type>
<SubstitutionTemplate><![CDATA[Water levels in Norwegian lakes, rivers and channels.
Courtesy of the Norwegian Water Resources and Energy Directorate.
]]></SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.generator</Name>
<Type>substitution</Type>
<Simple>rss.channel.generator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.link</Name>
<Type>substitution</Type>
<SubstitutionTemplate>http://www.nve.no/</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.title</Name>
<Type>substitution</Type>
<SubstitutionTemplate>Water Levels in Norway</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.feed.pubDate</Name>
<Type>advanced</Type>
<Script><![CDATA[ret.value = system.formatDate(new java.util.Date(),
							  "EEE, d MMM yyyy HH:mm:ss") 
			+ " +0000";
]]></Script>
<Simple>rss.feed.pubDate</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.category</Name>
<Type>advanced</Type>
<Script>ret.value = ["Water Sports", "Kayak", "Canoe"];</Script>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.comments</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.comments</Simple>
<SubstitutionTemplate>Easy to extend to your own data. Just create new AL modelled after ExampleFeed</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.content:encoded</Name>
<Type>substitution</Type>
<Enabled>false</Enabled>
<Script><![CDATA[<p>
	<h1><b>{work.StationName}</b><h1>
</p>
<p>
	<h2>Measured on {work.DateOfReading}</h2>
</p>
<p>
	<h3>Elevation: <b>{work.MetersOverSeaLevel}</b>m</h3>
</p>
<p>
	<h2>Zone: <b>{work.Zone}</b></h2>
</p>
]]></Script>
<SubstitutionTemplate><![CDATA[<p>
	<h1>{work.StationName}<h1>
</p>
<p>
	<h2>{work.DateStr}</h2>
</p>
<p>
	<h2>Level: {work.Level}</h2>
</p>
<p>
	<h3>Elevation: <b>{work.MetersOverSeaLevel}</b>m</h3>
</p>
<p>
	<h3>Zone code: <b>{work.Zone}</b></h3>
</p>
]]></SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.dc:creator</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.dc:creator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.description</Name>
<Type>substitution</Type>
<Script>ret.value = work.getAttribute("rss.item.description");</Script>
<SubstitutionTemplate>Average water level is {work.Level}m</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.guid</Name>
<Type>simple</Type>
<Simple>StationName</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.link</Name>
<Type>substitution</Type>
<Script><![CDATA[ret.value = "http://" + task.getOpEntry().getString("http.host") +
			task.getOpEntry().getString("http.base") + "/" +
			work.getString("StationName");]]></Script>
<SubstitutionTemplate>{work.url}/index.html</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.pubDate</Name>
<Type>advanced</Type>
<Script><![CDATA[ret.value = system.formatDate(work.getObject("DateOfReading"),
							  "EEE, d MMM yyyy HH:mm:ss") 
			+ " +0000";
]]></Script>
<Simple>DateOfReading</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.title</Name>
<Type>substitution</Type>
<Script>ret.value = work.getString("StationName");</Script>
<Simple>StationName</Simple>
<SubstitutionTemplate>{work.Level}m for {work.StationName}</SubstitutionTemplate>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
<Connector name="display">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript><![CDATA[task.logmsg("---> Level is " + work.getObject("Level") 
			+ " for " + work.getString("StationName"));]]></ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<Branch name="IF page full">
<Connector name="Stop feed AL">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>task.shutdown();</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ScriptCondition><![CDATA[ret.value = readCount-- <= 0; // defined in the AL Prolog Before Init Hook]]></ScriptCondition>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>2</Type>
</Branch>
</ContainerDF>
<ThreadOptions/>
<Operations/>
<InitParams>
<Schema name="AssemblyLineInitParams">
<SchemaItem>
<Name>page</Name>
<NativeSyntax>Number</NativeSyntax>
</SchemaItem>
<SchemaItem>
<Name>pageSize</Name>
<NativeSyntax>Password</NativeSyntax>
</SchemaItem>
</Schema>
</InitParams>
</AssemblyLine>
<AssemblyLine name="Feeds">
<Settings>
<parameter name="ALPoolSettingsDialog">showALPoolSettings</parameter>
<parameter name="automapattributes">false</parameter>
<parameter name="createTombstones">false</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeGlobalPrologs">true</parameter>
<parameter name="nullBehaviorDialog">showNullBehavior</parameter>
</Settings>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<LogConfig/>
<ContainerEF name="EntryFeedContainer">
<Connector name="ForEachAL">
<InheritFrom>system:/Connectors/ibmdi.ScriptConnector</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>[parent]</InheritFrom>
<parameter name="debug">false</parameter>
<parameter name="includeFiles"/>
<parameter name="script"><![CDATA[// This Connector returns the list of AssemblyLines
//
var cfg = main.getMetamergeConfig();
var ALs = cfg.getDefaultFolder(cfg.ASSEMBLYLINE_FOLDER).getNames();

java.util.Arrays.sort(ALs);
var counter = 0;

function selectEntries()
{
	counter = 0;
}

function getNextEntry ()
{
	do {
		if (counter >= ALs.length) {
			result.setStatus (0);
			result.setMessage ("End of input");
			return;
		}

		var alname = ALs[counter];
		counter++;
	} while (system.isValidInt(alname.substring(0,1)));

	var alcfg = cfg.getAssemblyLine(alname);
	var desc = alcfg.getUserComment();

	entry.setAttribute("AL", alname);
	entry.setAttribute("Description", desc);
	entry.setAttribute("Parameters", getALInitParameters(alname));
}


function getALInitParameters(alname) {
	var alcfg = getALConfig(alname);
	var initp = alcfg.getPublishedInitParams();
	var att = system.newAttribute("alname");
	var pnames = initp.getItemNames();

	for (var i = 0; i < pnames.size(); i++) {
		var p = initp.getItem(pnames.get(i));
/*
		main.logmsg("@@ ReturnFeedALs - getALInitParameters() - " + p.getAttributeName() + " <" +
								p.getExternalSyntax() + "> - " +
								p.getSample());
*/
		att.addValue(p.getAttributeName());
	}

	return att;
}


function getALConfig(alname) {
	var mmcfg = main.getMetamergeConfig();
	var alcfg = mmcfg.getAssemblyLine(alname);
	if (alcfg == null) {
		task.logmsg("ERROR", "** Feed Server - ERROR ** No feed AL found with name \"" + alname + "\"" ); 
		system.exitFlow();
	}
	return alcfg;
}


]]></parameter>
</Configuration>
<Parser>
<InheritFrom>[parent]</InheritFrom>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>AL</Name>
<Type>simple</Type>
<Simple>AL</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>Parameters</Name>
<Type>simple</Type>
<Simple>Parameters</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>AL</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>Parameters</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
</Connector>
</ContainerEF>
<ContainerDF name="DataFlowContainer">
<Connector name="display">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>task.logmsg("--&gt; " + work);</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings/>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<Branch name="IF not Feed AL">
<Connector name="Skip this AL">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>system.skipEntry();</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings/>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<Conditions>
<BranchCondition>
<LeftHand>AL</LeftHand>
<Operator>equals</Operator>
<RightHand>Feeds</RightHand>
<CaseSensitive>true</CaseSensitive>
</BranchCondition>
<BranchCondition>
<LeftHand>AL</LeftHand>
<Operator>equals</Operator>
<RightHand>FeedServer</RightHand>
<CaseSensitive>true</CaseSensitive>
</BranchCondition>
</Conditions>
<MatchAny>true</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Branch name="ELSE map 2 RSS">
<ALMap name="Map 2 RSS">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>rss.channel.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "TDI AssemblyLine: " + task.getShortName();</Script>
<Simple>rss.channel.description</Simple>
<SubstitutionTemplate>TDI RSS Data Pump Solution</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.generator</Name>
<Type>substitution</Type>
<Simple>rss.channel.generator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + work.getString("http.host") +
			"/" + task.getShortName();]]></Script>
<Simple>rss.channel.link</Simple>
<SubstitutionTemplate>{conn.rss.channel.link}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.title</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "Available TDI RSS Feeds";</Script>
<Simple>rss.channel.title</Simple>
<SubstitutionTemplate>Available TDI RSS Feeds</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.category</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.category</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.comments</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.comments</Simple>
<SubstitutionTemplate>Easy to extend to your own data. Just create new AL modelled after ExampleFeed</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.dc:creator</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.dc:creator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.description</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[p = work.getAttribute("Parameters");
if (p == null || p.size() == 0)
	ret.value = ""
else {
	str = "Parameters:";
	for (i = 0; i < p.size(); i++) {
		if (i > 0)
			str += ",";

		str += " " + p.getValue(i);
	}
	ret.value = str;
}]]></Script>
<Simple>rss.item.description</Simple>
<SubstitutionTemplate>{work.Parameters}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.guid</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>AL</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + task.getOpEntry().getString("http.host") +
			task.getOpEntry().getString("http.base") +
			work.getString("AL");]]></Script>
<Simple>email</Simple>
<SubstitutionTemplate>http://193.90.235.232/findUID/{work.uid}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.title</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>AL</Simple>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>2</Type>
</Branch>
</ContainerDF>
<ThreadOptions/>
<Operations/>
<InitParams>
<Schema name="AssemblyLineInitParams"/>
</InitParams>
</AssemblyLine>
<AssemblyLine name="LogHistory">
<Settings>
<parameter name="ALPoolSettingsDialog">showALPoolSettings</parameter>
<parameter name="automapattributes">false</parameter>
<parameter name="createTombstones">false</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeGlobalPrologs">true</parameter>
<parameter name="maxread"/>
<parameter name="nullBehaviorDialog">showNullBehavior</parameter>
</Settings>
<Hooks>
<Hook>
<Name>prolog0</Name>
<Script><![CDATA[pageSize = task.getOpEntry().getString("http.qs.pageSize");

if (system.isValidInt(pageSize))
	pageSize = system.toInt(pageSize)
else
	pageSize = 10;

page = task.getOpEntry().getString("http.qs.page");

if (system.isValidInt(page))
	page = system.toInt(page)
else
	page = 1;

skipCount = (page-1)*pageSize;
readCount = pageSize;]]></Script>
<Enabled>true</Enabled>
</Hook>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<LogConfig/>
<ContainerEF name="EntryFeedContainer">
<Connector name="ReadLogfile">
<InheritFrom>/Connectors/ReadLogfile</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>system:/Connectors/ibmdi.FileSystem</InheritFrom>
<parameter name="debug">false</parameter>
<parameter name="entryRawData"><![CDATA[line 1;this is the first line;by Eddie
line 2;this is the second line;also by Eddie
line 3;this is the third one;maybe Johan did this
line 4;no wait, he's in Sweden;so it must be Eddie again]]></parameter>
<parameter name="filePath">_PublishedStuff\_Mine\RSS FeedServer\Demo.log</parameter>
</Configuration>
<Parser>
<InheritFrom>[parent]</InheritFrom>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>*</Name>
<Type>simple</Type>
<Simple>*</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>Field01</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>Field02</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>Field03</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
</Connector>
</ContainerEF>
<ContainerDF name="DataFlowContainer">
<Branch name="IF skipping">
<Connector name="Skip entry">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>system.skipEntry();</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ScriptCondition><![CDATA[ret.value = skipCount-- > 0; // defined in the AL Prolog Before Init Hook]]></ScriptCondition>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Branch name="ELSE map 2 RSS">
<ALMap name="Map 2 RSS">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>rss.channel.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "TDI AssemblyLine: " + task.getShortName();</Script>
<Simple>rss.channel.description</Simple>
<SubstitutionTemplate>RSS-Enabled Log (via TDI)</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.generator</Name>
<Type>substitution</Type>
<Simple>rss.channel.generator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + task.getOpEntry().getString("http.host") +
			"/" + task.getShortName();]]></Script>
<Simple>rss.channel.link</Simple>
<SubstitutionTemplate>{conn.rss.channel.link}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.title</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "RSS feed generated from log file by AL: " + task.getShortName();</Script>
<Simple>rss.channel.title</Simple>
<SubstitutionTemplate>{conn.rss.channel.title}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.category</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.category</Simple>
<SubstitutionTemplate>Log</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.comments</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.comments</Simple>
<SubstitutionTemplate>No comment</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.content:encoded</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.content:encoded</Simple>
<SubstitutionTemplate><![CDATA[<p><br/><br/><b>Encoded content for {work.FullName}</b><br/><br/><p>
<p>Email set to: <b>{work.mail}</b><p>]]></SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.dc:creator</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.dc:creator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<SubstitutionTemplate>{work.Field02}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.guid</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>Field01</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + task.getOpEntry().getString("http.host") +
			"/LogEntry=" + 
			work.getString("Field01");]]></Script>
<Simple>email</Simple>
<SubstitutionTemplate>http://193.90.235.232/findUID/{work.uid}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.title</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>cn</Simple>
<SubstitutionTemplate>{work.Field01} -{work.Field03}</SubstitutionTemplate>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
<Branch name="IF page full">
<Connector name="Stop AL">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>task.shutdown();</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ScriptCondition><![CDATA[ret.value = readCount-- <= 0; // defined in the AL Prolog Before Init Hook]]></ScriptCondition>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>0</Type>
</Branch>
<Conditions/>
<MatchAny>false</MatchAny>
<Enabled>true</Enabled>
<Type>2</Type>
</Branch>
<Connector name="display">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Disabled</ConnectorState>
<Configuration/>
<ConnectorScript><![CDATA[var attnames = work.getAttributeNames();

for (name in attnames)
	if (!name.startsWith("rss"))
		work.removeAttribute(name);

task.logmsg(work);]]></ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
</ContainerDF>
<ThreadOptions/>
<Operations/>
<InitParams>
<Schema name="AssemblyLineInitParams">
<SchemaItem>
<Name>page</Name>
<NativeSyntax>Number</NativeSyntax>
</SchemaItem>
<SchemaItem>
<Name>pageSize</Name>
<NativeSyntax>Number</NativeSyntax>
</SchemaItem>
</Schema>
</InitParams>
</AssemblyLine>
<AssemblyLine name="LogEvents">
<Settings>
<parameter name="ALPoolSettingsDialog">showALPoolSettings</parameter>
<parameter name="automapattributes">false</parameter>
<parameter name="createTombstones">false</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeGlobalPrologs">true</parameter>
<parameter name="maxread"/>
<parameter name="nullBehaviorDialog">showNullBehavior</parameter>
</Settings>
<Hooks>
<Hook>
<Name>prolog0</Name>
<Script><![CDATA[pageSize = task.getOpEntry().getString("http.qs.pageSize");

if (system.isValidInt(pageSize))
	pageSize = system.toInt(pageSize)
else
	pageSize = 10;

page = task.getOpEntry().getString("http.qs.page");

if (system.isValidInt(page))
	page = system.toInt(page)
else
	page = 1;

skipCount = (page-1)*pageSize;
readCount = pageSize;]]></Script>
<Enabled>true</Enabled>
</Hook>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<LogConfig/>
<ContainerEF name="EntryFeedContainer">
<Connector name="ReadLogfile">
<InheritFrom>/Connectors/ReadLogfile</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>system:/Connectors/ibmdi.FileSystem</InheritFrom>
<parameter name="debug">false</parameter>
<parameter name="entryRawData"><![CDATA[line 1;this is the first line;by Eddie
line 2;this is the second line;also by Eddie
line 3;this is the third one;maybe Johan did this
line 4;no wait, he's in Sweden;so it must be Eddie again]]></parameter>
<parameter name="filePath">_PublishedStuff\_Mine\RSS FeedServer\Demo.log</parameter>
</Configuration>
<Parser>
<InheritFrom>[parent]</InheritFrom>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>*</Name>
<Type>simple</Type>
<Simple>*</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>_Unique_ID</Name>
<Type>advanced</Type>
<Script><![CDATA[attnames = conn.getAttributeNames();
val = "";

for (name in attnames)
	val += conn.getString(name);

if (val.length > 250)
	val = val.substring(0,249);

ret.value = val;]]></Script>
<Simple>id</Simple>
<SubstitutionTemplate/>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<Enabled>true</Enabled>
<UniqueAttribute>_Unique_ID</UniqueAttribute>
<FilePath>LogEvents</FilePath>
<RemoveDeleted>true</RemoveDeleted>
<DeltaFastAlgorithm>true</DeltaFastAlgorithm>
<WhenToCommit>On end of AL cycle</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>Field01</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>Field02</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>Field03</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
</Connector>
</ContainerEF>
<ContainerDF name="DataFlowContainer">
<ALMap name="Map 2 RSS">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>rss.channel.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "TDI AssemblyLine: " + task.getShortName();</Script>
<Simple>rss.channel.description</Simple>
<SubstitutionTemplate>RSS-Enabled Log (via TDI)</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.generator</Name>
<Type>substitution</Type>
<Simple>rss.channel.generator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + task.getOpEntry().getString("http.host") +
			"/" + task.getShortName();]]></Script>
<Simple>rss.channel.link</Simple>
<SubstitutionTemplate>{conn.rss.channel.link}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.title</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "RSS feed generated from log file by AL: " + task.getShortName();</Script>
<Simple>rss.channel.title</Simple>
<SubstitutionTemplate>{conn.rss.channel.title}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.category</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.category</Simple>
<SubstitutionTemplate>Log</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.comments</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.comments</Simple>
<SubstitutionTemplate>No comment</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.content:encoded</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.content:encoded</Simple>
<SubstitutionTemplate><![CDATA[<p><br/><br/><b>Encoded content for {work.FullName}</b><br/><br/><p>
<p>Email set to: <b>{work.mail}</b><p>]]></SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.dc:creator</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.dc:creator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<SubstitutionTemplate>{work.Field02}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.guid</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>Field01</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + task.getOpEntry().getString("http.host") +
			"/LogEntry=" + 
			work.getString("Field01");]]></Script>
<Simple>email</Simple>
<SubstitutionTemplate>http://193.90.235.232/findUID/{work.uid}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.title</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>cn</Simple>
<SubstitutionTemplate>{work.Field01} -{work.Field03}</SubstitutionTemplate>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
</ContainerDF>
<ThreadOptions/>
<Operations/>
<InitParams>
<Schema name="AssemblyLineInitParams"/>
</InitParams>
</AssemblyLine>
<AssemblyLine name="FileList">
<Settings>
<parameter name="ALPoolSettingsDialog">showALPoolSettings</parameter>
<parameter name="automapattributes">false</parameter>
<parameter name="createTombstones">false</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeGlobalPrologs">true</parameter>
<parameter name="maxread">15</parameter>
<parameter name="nullBehaviorDialog">showNullBehavior</parameter>
</Settings>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<LogConfig/>
<ContainerEF name="EntryFeedContainer">
<Connector name="FileScan">
<InheritFrom>system:/Connectors/ibmdi.ScriptConnector</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>[parent]</InheritFrom>
<parameter name="connectorType">com.ibm.di.connector.ScriptConnector</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeFiles"/>
<parameter name="parserOption">Useless</parameter>
<parameter name="script"><![CDATA[// FileScan Connector - see the options described below (directory, recursion & sort order)
var vrs = "v.2.0";

// The directory where the file scan begins
//
var baseDir = getProp("FileScan.directory", "./"); // function defined below

// Whether to recursively scan sub-directories or not. This can be 'yes' or
// 'true' or 'no' or 'false'.  
//
var recurse = getProp("FileScan.recurse_subfolders", "true"); // or 'yes'

// The FileScan.sort_by property is used to control the ordering of returned
// file information. This can be any one of the following sort options:
//		o 'path' - by full Pathname
//		o 'name' - by the filename (plus extension)
//		o 'size' - by size
//		o 'date' - by modified date
// Following this can be the optional directional keyword: 'asc' or 'desc'
// For example: 
//
//		'date,desc'  - return by modified-timestamp starting with the most recently changed
//
var sortBy = getProp("FileScan.sort_by", "date,desc"); // or 'path', 'name', 'date' or 'size' , 'asc' or 'desc'

var parts = system.splitString(sortBy, ",");
sortBy = parts[0];

if (parts.length <= 1)
	direction = "desc"
else
	direction = parts[1];



logmsg("** FileScan " + vrs + " initializing");
logmsg("**   sort " + sortBy + " (" + direction + ")");


var filePath = [];
var fileName = [];
var fileSize = [];
var lastModList = [];
var fileIndex = 0;
var scanTime = new java.util.Date();
var sortMap = new java.util.TreeMap();
var sortedKeys = null;
var sortIndex = 0;


//===  Function definitions ===

// This version writes to standard out as well, so you can
// see it from the terminal window where you started TDI.
//
function logmsg(msg, logLevel) {
	if (!logLevel)
		logLevel = "INFO";

	main.logmsg(logLevel, msg);
//	java.lang.System.out.println(msg);
}

// Gets TDI property from System-Properties, which is available
// by default, but will not get persisted.
//
function getProp(pname, defvalue) {
	var p = system.getTDIProperty("System-Properties", pname);
	if (p == null)
		p = String(defvalue);
	return p.trim().toLowerCase();
}


// Right-justifies a string
//
function rj(str,len) {
	if (!len)
		return str;

	str = "                                                                                         " + str;
	return str.substring(str.length-len);
}


// Scan this directory
//
function getScanList(fName) {
	var fObj = new java.io.File(fName);
	var key = "";

// 	java.lang.System.out.println("---> Scanning " + fName);

	if (fObj == null)
		throw "Scan directory/file (" + fName + ") not found"
	else
	if (fObj.isFile()) {
		fileIndex++;
		filePath[fileIndex] = fObj.getCanonicalPath()
		fileName[fileIndex] = fObj.getName();
		fileSize[fileIndex] = fObj.length();
		lastModList[fileIndex] = fObj.lastModified();
		switch (sortBy.substring(0,1)) {
			case 'n' /*name*/: key = fileName[fileIndex];
					break;
			case 'p' /*path*/: key = filePath[fileIndex];
					break;
			case 's' /*size*/ : key = rj(fileSize[fileIndex],20) + filePath[fileIndex];
					break;
			default /*date*/: key = rj(lastModList[fileIndex],40) + filePath[fileIndex];
		}
		sortMap.put(key, fileIndex);
// logmsg("@@ fileIndex: " + fileIndex + "   key: '" + key + "'");	
	} else
	if (fObj.isDirectory()) {
		var contents = fObj.listFiles();

		if (contents != null)
			for (var i = 0; i < contents.length; i++)
				getScanList(contents[i]);
	}
}

function selectEntries()
{
 	logmsg("** FileScan scanning " + baseDir + "  ...");

	getScanList(baseDir);

	sortedKeys = sortMap.keySet().toArray();
	logmsg("**    " + sortedKeys.length + " file(s) found");
	
	sortIndex = 0;
}

function getNextEntry ()
{
	var next = "";

	if (sortIndex >= sortedKeys.length) {
		result.setStatus (0);
		result.setMessage ("End of input");
		return;
	}

	if (direction.startsWith == "a") // ascending
		fileIndex = sortMap.get(sortedKeys[sortIndex++])
	else
		fileIndex = sortMap.get(sortedKeys[sortedKeys.length - (++sortIndex)])

	entry.setAttribute("filePath", filePath[fileIndex]);
	entry.setAttribute("fileName", fileName[fileIndex]);
	entry.setAttribute("fileLastModified", new java.util.Date(lastModList[fileIndex]));
	entry.setAttribute("fileIndex", new java.lang.Integer(sortIndex));
	entry.setAttribute("fileSize", new java.lang.Long(fileSize[fileIndex]));
	entry.setAttribute("scanTime", scanTime);
	entry.setAttribute("fileCount", new java.lang.Integer(sortedKeys.length));

	fileIndex++;
}

]]></parameter>
</Configuration>
<ComputeChanges>true</ComputeChanges>
<DeltaBehavior>0</DeltaBehavior>
<DeltaStrict>true</DeltaStrict>
<Parser>
<InheritFrom>[parent]</InheritFrom>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>fileCount</Name>
<Type>simple</Type>
<Simple>fileCount</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>fileIndex</Name>
<Type>simple</Type>
<Simple>fileIndex</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>fileLastModified</Name>
<Type>simple</Type>
<Simple>fileLastModified</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>fileName</Name>
<Type>simple</Type>
<Simple>fileName</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>filePath</Name>
<Type>simple</Type>
<Simple>filePath</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>fileSize</Name>
<Type>simple</Type>
<Simple>fileSize</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>scanTime</Name>
<Type>simple</Type>
<Simple>scanTime</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>fileCount</Name>
<Syntax>java.lang.Integer</Syntax>
</SchemaItem>
<SchemaItem>
<Name>fileIndex</Name>
<Syntax>java.lang.Integer</Syntax>
</SchemaItem>
<SchemaItem>
<Name>fileLastModified</Name>
<Syntax>java.util.Date</Syntax>
</SchemaItem>
<SchemaItem>
<Name>fileName</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>filePath</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>fileSize</Name>
<Syntax>java.lang.Long</Syntax>
</SchemaItem>
<SchemaItem>
<Name>scanTime</Name>
<Syntax>java.util.Date</Syntax>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<OperationCarrierIsProperty>false</OperationCarrierIsProperty>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
<Enabled>false</Enabled>
<MinPoolSize>0</MinPoolSize>
<PurgeInterval>0</PurgeInterval>
<InitializeAttempts>1</InitializeAttempts>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
<InitializeOption>0</InitializeOption>
</Connector>
</ContainerEF>
<ContainerDF name="DataFlowContainer">
<Connector name="define functions">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript><![CDATA[var sizes = ["bytes", "Kb", "Mb", "Gb", "Tb"];

function byteSize(size) {
	var n = 1;
	var s = 0;
	if (!size || size <= 0)
		return 0
	else if (size < 1024)
		return size;

	while (size	> Math.pow(1024,n)) n++;

	s = Math.round((size/Math.pow(1024,n-1))*10)/10;
// task.logmsg("--byteSize(" + size + ")  n: " + n + "   s: " + s);
	return s + sizes[n-1];
}
]]></ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings>
<Driver>BTree</Driver>
</DeltaSettings>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
<ALMap name="Map2RSS">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>rss.channel.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "TDI AssemblyLine: " + task.getShortName();</Script>
<Simple>rss.channel.description</Simple>
<SubstitutionTemplate>TDI FileList Feed</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.generator</Name>
<Type>substitution</Type>
<Simple>rss.channel.generator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + work.getString("http.host") +
			"/" + task.getShortName();]]></Script>
<Simple>rss.channel.link</Simple>
<SubstitutionTemplate>{conn.rss.channel.link}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.title</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "RSS feed generated by TDI AssemblyLine '" + 
			task.getShortName() + "'";]]></Script>
<Simple>rss.channel.title</Simple>
<SubstitutionTemplate>{conn.rss.channel.title}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.category</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.category</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.comments</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.comments</Simple>
<SubstitutionTemplate>Easy to extend to your own data. Just create new AL modelled after ExampleFeed</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.content:encoded</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.content:encoded</Simple>
<SubstitutionTemplate><![CDATA[<p><br/><br/><b>Encoded content for {work.FullName}</b><br/><br/><p>
<p>Email set to: <b>{work.mail}</b><p>]]></SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.dc:creator</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.dc:creator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.description</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = work.getString("fileName") + " ..... " +
		byteSize(work.getObject("fileSize")) +
		" byte(s) ..... LastMod: " +
		work.getString("fileLastModified");
]]></Script>
<SubstitutionTemplate><![CDATA[{work.fileName} {javascript return byteSize(work.fileSize);} byte(s) last modified {work.fileLastModified}
]]></SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.guid</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.guid</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.link</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>email</Simple>
<SubstitutionTemplate>http://193.90.235.232/findUID/{work.uid}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.title</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>Title</Simple>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
<Connector name="display">
<ConnectorMode>Script</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration/>
<ConnectorScript>task.logmsg(work);</ConnectorScript>
<Parser/>
<AttributeMap name="Input"/>
<AttributeMap name="Output"/>
<DeltaSettings/>
<Schema name="Input"/>
<Schema name="Output"/>
<LinkCriteria/>
<Hooks/>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
</PoolDefinition>
<PoolInstance/>
</Connector>
</ContainerDF>
<ThreadOptions/>
<Operations/>
<InitParams>
<Schema name="AssemblyLineInitParams">
<SchemaItem>
<Name>Directory Path</Name>
<NativeSyntax>String</NativeSyntax>
</SchemaItem>
<SchemaItem>
<Name>Recurse sub-folders?</Name>
<NativeSyntax>Boolean</NativeSyntax>
</SchemaItem>
</Schema>
</InitParams>
</AssemblyLine>
</Folder>
<Folder name="Connectors">
<Connector name="ReadLogfile">
<InheritFrom>system:/Connectors/ibmdi.FormEntry</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>[parent]</InheritFrom>
<parameter name="debug">false</parameter>
<parameter name="entryRawData"><![CDATA[line 1;this is the first line;by Eddie
line 2;this is the second line;also by Eddie
line 3;this is the third one;maybe Johan did this
line 4;no wait, he's in Sweden;so it must be Eddie again]]></parameter>
<parameter name="isLoop">false</parameter>
</Configuration>
<Parser>
<InheritFrom>system:/Parsers/ibmdi.CSV</InheritFrom>
<parameter name="characterSet"/>
<parameter name="csvColumns"><![CDATA[Field01
Field02
Field03
Field04
Field05
Field06
Field07
Field08
Field09
Field10
Field11
Field12
Field13
Field14
Field15
Field16
Field17
Field18
Field19
Field20
Field21
Field22
Field23
Field24
Field25
Field26
Field27
Field28
Field29
Field30]]></parameter>
<parameter name="csvEnableQuoting">true</parameter>
<parameter name="csvLogLongLines">0</parameter>
<parameter name="csvWriteHeader">true</parameter>
<parameter name="debug">false</parameter>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>Field01</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>Field02</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>Field03</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
<Enabled>false</Enabled>
<MinPoolSize>0</MinPoolSize>
<PurgeInterval>0</PurgeInterval>
<InitializeAttempts>1</InitializeAttempts>
</PoolDefinition>
<PoolInstance/>
</Connector>

<Connector name="FileScan">
<InheritFrom>system:/Connectors/ibmdi.ScriptConnector</InheritFrom>
<ConnectorMode>Iterator</ConnectorMode>
<ConnectorState>Enabled</ConnectorState>
<Configuration>
<InheritFrom>[parent]</InheritFrom>
<parameter name="connectorType">com.ibm.di.connector.ScriptConnector</parameter>
<parameter name="debug">false</parameter>
<parameter name="includeFiles"/>
<parameter name="parserOption">Useless</parameter>
<parameter name="script"><![CDATA[// FileScan Connector - see the options described below (directory, recursion & sort order)
var vrs = "v.2.0";

// The directory where the file scan begins
//
var baseDir = getProp("FileScan.directory", "./"); // function defined below

// Whether to recursively scan sub-directories or not. This can be 'yes' or
// 'true' or 'no' or 'false'.  
//
var recurse = getProp("FileScan.recurse_subfolders", "true"); // or 'yes'

// The FileScan.sort_by property is used to control the ordering of returned
// file information. This can be any one of the following sort options:
//		o 'path' - by full Pathname
//		o 'name' - by the filename (plus extension)
//		o 'size' - by size
//		o 'date' - by modified date
// Following this can be the optional directional keyword: 'asc' or 'desc'
// For example: 
//
//		'date,desc'  - return by modified-timestamp starting with the most recently changed
//
var sortBy = getProp("FileScan.sort_by", "date,desc"); // or 'path', 'name', 'date' or 'size' , 'asc' or 'desc'

var parts = system.splitString(sortBy, ",");
sortBy = parts[0];

if (parts.length <= 1)
	direction = "desc"
else
	direction = parts[1];



logmsg("** FileScan " + vrs + " initializing");
logmsg("**   sort " + sortBy + " (" + direction + ")");


var filePath = [];
var fileName = [];
var fileSize = [];
var lastModList = [];
var fileIndex = 0;
var scanTime = new java.util.Date();
var sortMap = new java.util.TreeMap();
var sortedKeys = null;
var sortIndex = 0;


//===  Function definitions ===

// This version writes to standard out as well, so you can
// see it from the terminal window where you started TDI.
//
function logmsg(msg, logLevel) {
	if (!logLevel)
		logLevel = "INFO";

	main.logmsg(logLevel, msg);
//	java.lang.System.out.println(msg);
}

// Gets TDI property from System-Properties, which is available
// by default, but will not get persisted.
//
function getProp(pname, defvalue) {
	var p = system.getTDIProperty("System-Properties", pname);
	if (p == null)
		p = String(defvalue);
	return p.trim().toLowerCase();
}


// Right-justifies a string
//
function rj(str,len) {
	if (!len)
		return str;

	str = "                                                                                         " + str;
	return str.substring(str.length-len);
}


// Scan this directory
//
function getScanList(fName) {
	var fObj = new java.io.File(fName);
	var key = "";

// 	java.lang.System.out.println("---> Scanning " + fName);

	if (fObj == null)
		throw "Scan directory/file (" + fName + ") not found"
	else
	if (fObj.isFile()) {
		fileIndex++;
		filePath[fileIndex] = fObj.getCanonicalPath()
		fileName[fileIndex] = fObj.getName();
		fileSize[fileIndex] = fObj.length();
		lastModList[fileIndex] = fObj.lastModified();
		switch (sortBy.substring(0,1)) {
			case 'n' /*name*/: key = fileName[fileIndex];
					break;
			case 'p' /*path*/: key = filePath[fileIndex];
					break;
			case 's' /*size*/ : key = rj(fileSize[fileIndex],20) + filePath[fileIndex];
					break;
			default /*date*/: key = rj(lastModList[fileIndex],40) + filePath[fileIndex];
		}
		sortMap.put(key, fileIndex);
// logmsg("@@ fileIndex: " + fileIndex + "   key: '" + key + "'");	
	} else
	if (fObj.isDirectory()) {
		var contents = fObj.listFiles();

		if (contents != null)
			for (var i = 0; i < contents.length; i++)
				getScanList(contents[i]);
	}
}

function selectEntries()
{
 	logmsg("** FileScan scanning " + baseDir + "  ...");

	getScanList(baseDir);

	sortedKeys = sortMap.keySet().toArray();
	logmsg("**    " + sortedKeys.length + " file(s) found");
	
	sortIndex = 0;
}

function getNextEntry ()
{
	var next = "";

	if (sortIndex >= sortedKeys.length) {
		result.setStatus (0);
		result.setMessage ("End of input");
		return;
	}

	if (direction.startsWith == "a") // ascending
		fileIndex = sortMap.get(sortedKeys[sortIndex++])
	else
		fileIndex = sortMap.get(sortedKeys[sortedKeys.length - (++sortIndex)])

	entry.setAttribute("filePath", filePath[fileIndex]);
	entry.setAttribute("fileName", fileName[fileIndex]);
	entry.setAttribute("fileLastModified", new java.util.Date(lastModList[fileIndex]));
	entry.setAttribute("fileIndex", new java.lang.Integer(sortIndex));
	entry.setAttribute("fileSize", new java.lang.Long(fileSize[fileIndex]));
	entry.setAttribute("scanTime", scanTime);
	entry.setAttribute("fileCount", new java.lang.Integer(sortedKeys.length));

	fileIndex++;
}

]]></parameter>
</Configuration>
<ComputeChanges>true</ComputeChanges>
<DeltaBehavior>0</DeltaBehavior>
<DeltaStrict>true</DeltaStrict>
<Parser>
<InheritFrom>[parent]</InheritFrom>
</Parser>
<AttributeMap name="Input">
<InheritFrom>[parent]</InheritFrom>
<AttributeMapItem>
<Name>fileCount</Name>
<Type>simple</Type>
<Simple>fileCount</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>fileIndex</Name>
<Type>simple</Type>
<Simple>fileIndex</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>fileLastModified</Name>
<Type>simple</Type>
<Simple>fileLastModified</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>fileName</Name>
<Type>simple</Type>
<Simple>fileName</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>filePath</Name>
<Type>simple</Type>
<Simple>filePath</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>fileSize</Name>
<Type>simple</Type>
<Simple>fileSize</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>scanTime</Name>
<Type>simple</Type>
<Simple>scanTime</Simple>
</AttributeMapItem>
</AttributeMap>
<AttributeMap name="Output">
<InheritFrom>[parent]</InheritFrom>
</AttributeMap>
<DeltaSettings>
<WhenToCommit>After every database operation</WhenToCommit>
<Driver>CloudScape</Driver>
</DeltaSettings>
<Schema name="Input">
<InheritFrom>[parent]</InheritFrom>
<SchemaItem>
<Name>fileCount</Name>
<Syntax>java.lang.Integer</Syntax>
</SchemaItem>
<SchemaItem>
<Name>fileIndex</Name>
<Syntax>java.lang.Integer</Syntax>
</SchemaItem>
<SchemaItem>
<Name>fileLastModified</Name>
<Syntax>java.util.Date</Syntax>
</SchemaItem>
<SchemaItem>
<Name>fileName</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>filePath</Name>
<Syntax>java.lang.String</Syntax>
</SchemaItem>
<SchemaItem>
<Name>fileSize</Name>
<Syntax>java.lang.Long</Syntax>
</SchemaItem>
<SchemaItem>
<Name>scanTime</Name>
<Syntax>java.util.Date</Syntax>
</SchemaItem>
</Schema>
<Schema name="Output">
<InheritFrom>[parent]</InheritFrom>
</Schema>
<LinkCriteria>
<InheritFrom>[parent]</InheritFrom>
</LinkCriteria>
<Hooks>
<InheritFrom>[parent]</InheritFrom>
</Hooks>
<CheckpointConfig/>
<SandboxConfig/>
<Reconnect>
<InheritFrom>[parent]</InheritFrom>
<parameter name="initreconnect">false</parameter>
<parameter name="numberOfRetries">1</parameter>
<parameter name="retryDelay">10</parameter>
</Reconnect>
<Operations/>
<OperationCarrierIsProperty>false</OperationCarrierIsProperty>
<PoolDefinition>
<InheritFrom>[parent]</InheritFrom>
<Enabled>false</Enabled>
<MinPoolSize>0</MinPoolSize>
<PurgeInterval>0</PurgeInterval>
<InitializeAttempts>1</InitializeAttempts>
</PoolDefinition>
<PoolInstance>
<Enabled>false</Enabled>
<ExhaustedPoolBehavior>Wait</ExhaustedPoolBehavior>
</PoolInstance>
<InitializeOption>0</InitializeOption>
</Connector>
</Folder>
<Folder name="Parsers"/>
<Folder name="EventHandlers"/>
<Folder name="Scripts">
<Script name="rssFeed()">
<parameter name="includeFiles"/>
<parameter name="script"><![CDATA[function rssFeed(accum) {
	var rss = "";
	var entry;	
	var title = null;
	var xml_return = null;

	// First check for the 'xml_return' Attribute. Use the first one found.
	for (entry in accum) {
		if (xml_return = entry.getString("xml_return"))
			break;
	}

	if (xml_return)
		return xml_return;

	for (entry in accum) {
		if (title = entry.getString("rss.channel.title"))
			break;
	}

	if (!title) {
		task.logmsg("** ERROR: No channel attributes found");
		return errorFeed(accum);
	}

	rss = rssChannelXML(entry) +
			rssItemXML(accum) +
			rssEndTags();	

	return rss;
}


function rssChannelXML(entry) {
	var attnames = entry.getAttributeNames();
	var xml = "<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'>\n" +
				"  <channel>\n";
	var pubDateToday = "    <pubDate>" +
						system.formatDate(new java.util.Date(),
								 			"EEE, d MMM yyyy HH:mm:ss '+0000'")  +
					"</pubDate>\n";	
	var foundDate = false;

	for (var name in attnames) {
		name = String(name); // Convert to JS String
		if (name.startsWith("rss.channel.")) {
			xml += "    <" + name.substring(12) + ">" +
					entry.getString(name) +
					"</" + name.substring(12) + ">\n";

			if (name.substring(12).equalsIgnoreCase("pubdate"))
				foundDate = true;
		}
	}

	if (!foundDate)
		xml += pubDateToday;
	
	return xml;
}


function rssItemXML(accum) {
	var xml = "";
	var pubDateToday = "      <pubDate>" +
						system.formatDate(new java.util.Date(),
								 			"EEE, d MMM yyyy HH:mm:ss '+0000'")  +
					"</pubDate>\n";

	for (var entry in accum) {
		var attnames = entry.getAttributeNames();
		var foundDate = false;

		xml += "    <item>\n";

		for (var name in attnames) {
			name = String(name); // Convert to JS String

			if (name.startsWith("rss.item."))
				xml += "      <" + name.substring(9) + ">" +
						removeInvalidXML(entry.getString(name),name) +
						"</" + name.substring(9) + ">\n";

			if (name.substring(9).equalsIgnoreCase("pubdate"))
				foundDate = true;

		}

		if (!foundDate)
			xml += pubDateToday;

		xml += "    </item>\n";
	}

	return xml;
}


function rssEndTags() {
	return "  </channel>\n" +
		   "</rss>";
}

function errorFeed(accum) {
	return "*ERROR*";
}


function removeInvalidXML(xml,attname) {
	return system.remove( "$<>&'\"\\", system.removeInvalidXMLChars( xml ) );
}
]]></parameter>
</Script>
<Script name="byteSize()">
<parameter name="script"><![CDATA[sizes = ["bytes", "Kb", "Mb", "Gb", "Tb", "Pb"];

function bigNum(num) {
	var s = String(java.lang.Double(num).longValue());
	var s2 = "";
	for (var i = s.length; i >= 0; i--) {
		s2 = s.charAt(i) + ( ((s.length-i-1)%3 == 0) ? "," : "" ) + s2;
	}
	return s2.substring(0,s2.length-1);
}

function byteSize(size) {
	var n = 0;
	if (size < 1024)
		return bigNum(size) + " bytes"
	else {
		while (size	>= Math.pow(1024,++n)) { /* do nothing */ };
		return Math.round((size / Math.pow(1024,n-1))*10)/10 + sizes[n-1];
	}
}
]]></parameter>
</Script>
</Folder>
<JavaLibraries/>
<JavaProperties/>
<Folder name="Includes"/>
<Folder name="Config">
<LogConfig name="Logging"/>
<InstanceProperties name="AutoStart">
<AutoStart>
<ParameterList>
<parameter name="Name">AssemblyLines/FeedServer</parameter>
</ParameterList>
</AutoStart>
</InstanceProperties>
<TombstonesConfig name="Tombstones"/>
<SolutionInterface name="SolutionInterface"/>
</Folder>
<Folder name="Functions"/>
<Folder name="AttributeMaps">
<ALMap name="Map2RSS">
<AttributeMap name="Input">
<AttributeMapItem>
<Name>rss.channel.description</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "TDI AssemblyLine: " + task.getShortName();</Script>
<Simple>rss.channel.description</Simple>
<SubstitutionTemplate>TDI RSS Data Pump Solution</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.generator</Name>
<Type>substitution</Type>
<Simple>rss.channel.generator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.link</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script><![CDATA[ret.value = "http://" + work.getString("http.host") +
			"/" + task.getShortName();]]></Script>
<Simple>rss.channel.link</Simple>
<SubstitutionTemplate>{conn.rss.channel.link}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.channel.title</Name>
<Type>advanced</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Script>ret.value = "RSS feed generated by TDI AssemblyLine '" + task.getShortName() + "'";</Script>
<Simple>rss.channel.title</Simple>
<SubstitutionTemplate>{conn.rss.channel.title}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.category</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.category</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.comments</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.comments</Simple>
<SubstitutionTemplate>Easy to extend to your own data. Just create new AL modelled after ExampleFeed</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.content:encoded</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.content:encoded</Simple>
<SubstitutionTemplate><![CDATA[<p><br/><br/><b>Encoded content for {work.FullName}</b><br/><br/><p>
<p>Email set to: <b>{work.mail}</b><p>]]></SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.dc:creator</Name>
<Type>substitution</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.dc:creator</Simple>
<SubstitutionTemplate>TDI</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.description</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.description</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.guid</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>rss.item.guid</Simple>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.link</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>email</Simple>
<SubstitutionTemplate>http://193.90.235.232/findUID/{work.uid}</SubstitutionTemplate>
</AttributeMapItem>
<AttributeMapItem>
<Name>rss.item.title</Name>
<Type>simple</Type>
<Enabled>true</Enabled>
<Add>true</Add>
<Modify>true</Modify>
<Simple>Title</Simple>
</AttributeMapItem>
</AttributeMap>
<State>Enabled</State>
</ALMap>
</Folder>
<Properties name="Properties">
<Stores>
<PropertyStore name="Solution-Properties">
<Parser/>
<RawConnector>
<InheritFrom>system:/Connectors/ibmdi.Properties</InheritFrom>
<parameter name="collectionType">Solution-Properties</parameter>
</RawConnector>
<Key>key</Key>
<Value>value</Value>
<ReadOnly>false</ReadOnly>
<InitialLoad>true</InitialLoad>
<CacheTimeout>0</CacheTimeout>
</PropertyStore>
<PropertyStore name="Global-Properties">
<Parser/>
<RawConnector>
<InheritFrom>system:/Connectors/ibmdi.Properties</InheritFrom>
<parameter name="collectionType">Global-Properties</parameter>
</RawConnector>
<Key>key</Key>
<Value>value</Value>
<ReadOnly>false</ReadOnly>
<InitialLoad>true</InitialLoad>
<CacheTimeout>0</CacheTimeout>
</PropertyStore>
<PropertyStore name="Java-Properties">
<Parser/>
<RawConnector>
<InheritFrom>system:/Connectors/ibmdi.Properties</InheritFrom>
<parameter name="collectionType">Java-Properties</parameter>
</RawConnector>
<Key>key</Key>
<Value>value</Value>
<ReadOnly>false</ReadOnly>
<InitialLoad>true</InitialLoad>
<CacheTimeout>0</CacheTimeout>
</PropertyStore>
<PropertyStore name="System-Properties">
<Parser/>
<RawConnector>
<InheritFrom>system:/Connectors/ibmdi.Properties</InheritFrom>
<parameter name="collectionType">System-Properties</parameter>
</RawConnector>
<Key>key</Key>
<Value>value</Value>
<ReadOnly>false</ReadOnly>
<InitialLoad>true</InitialLoad>
<CacheTimeout>0</CacheTimeout>
</PropertyStore>
</Stores>
</Properties>
</MetamergeConfig>
