Defining DLM Fragments ala ALM

Table of Contents

DLM Fragment Pushing Tool

Note!! This tool has not been extensively tested and should probably not be used in a production environment!

This tool allows you to specify your tabs/columns/channels for DLM in the dlm.xml file, the way ALM does (with its fragments.xml file). Syntax is very similar to ALM's fragments.xml.

You should be able to take your original dlm.xml file and just add these modifications to it. The original DLM code ignores the modifications we've made, and this tool ignores some of the original stuff like "audience". They work in a complementary way.

It expects channels to be already defined in the properties/chanpub directory (it looks up channels by their fname in the database itself).

There's an extra property that specifies the default skin:

<dlm:property name="defaultLayoutOwnerSkin" value="imm" />

Define a fragment for the default user (e.g. fragmentTemplate) (see example in the file). Inside this fragment, you should include the header and footer folders. These will be propagated to all the rest of the fragment users in the file that have the includeDefault="Y" attribute set.

Syntax is pretty much the same as for fragments.xml (but with a dlm: namespace). One extra attribute was added to the "folder" tag, "width", which lets you specify the width of a column.

The tool will automatically deal with "updating" fragments that already exist. So you should be able to do an "ant pushdlm pubfragments" with a restart and people should get the updated fragments. It will actually remove and recreate the fragment users giving them a password which is the same as their username.

A note of warning, if you make any changes to fragments, etc, via the portal itself (by logging in as a fragment user), you won't be able to run this again as it will overwrite what you did. It doesn't keep any changes done via the portal logins. (Of course this only applies to fragment users).

The DlmFragmentPusher munges dlm.xml into a "data.xml" style file in build/WEB-INF/properties/db/dlm-data.xml. It does this in a somewhat "smart" fashion, by generating "delete" actions for any existing data first and then adding the insert rows. The ant tasks call it and then push the data into the database using the dbloader (with create/droptables turned off).

Either copy the source/org/jasig/portal/security/Md5Passwd.java file into your source dir or edit your version and make the "encode" function public. DlmFragmentPusher uses this to generate an Md5 password for the users it creates.

Edit build.xml and add the following:

In the initportal task, just after the antcall to pubchan, add

<antcall target="pushdlm"/>

At the end of the file before the end project tag, add

<target name="pushdlmgen" description="Generates dlm fragments data file from dlm.xml" depends="compile">
		<java fork="true" failonerror="true" dir="${basedir}" classname="org.jasig.portal.tools.DlmFragmentPusher">
			<classpath>
				<pathelement path="${build.home}/WEB-INF/classes"/>
				<path refid="compile.classpath"/>
			</classpath>
		</java>
	</target>

	<target name="pushdlm" description="Pushes dlm fragments data to db" depends="pushdlmgen">
		<antcall target="db">
			<param name="usedata" value="-d"/>
			<param name="datafile" value="/properties/db/dlm-data.xml"/>
			<param name="droptables" value="-nD"/>
			<param name="createtables" value="-nC"/>
		</antcall>
	</target>

A sample dlm.xml file is provided in properties/dlm.xml.

dlmfragpusher.tgz

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 15, 2005

    Mike Moretti says:

    There was a bug that wouldn't allow you to see the header/footer channels if you...

    There was a bug that wouldn't allow you to see the header/footer channels if you logged in as a template user. I added UP_GROUP_MEMBERSHIP for each of the template users to the Everyone group to get around this. New tgz attached.

  2. Dec 15, 2005

    Mike Moretti says:

    I modified how the default header/footer stuff was propagated through the rest o...

    I modified how the default header/footer stuff was propagated through the rest of the fragments. It used to copy only the header/footer folders to all the rest of the fragments no matter what. It now copies the entire default user template folders (e.g. header, footer, and whatever else happens to be there) to any fragment that has the includeDefault="Y" attribute only. See the insidemit tab in the sample dlm.xml for an example. So if you don't want the default folders to be propagated, don't include the includeDefault attribute.