Skip to end of metadata
Go to start of metadata

If you have developed a tool, then your tool has certain methods, screens, etc to meet the tool contract.

As LAMS is developed, we will change some of the method calls, etc occasionally. When this happens, your tool will need to change to suit the new requirements. We are trying to minimise the problems that may occur, but you will need to do some updates occasionally. This page will list the changes that you will need to make.

The main two files that will cause a problem are the ToolContentManager and ToolSessionManager interface. Your tool's service bean implements both of these interfaces. When we add new methods or change existing methods, then your code will no longer compile. However it may still run most of the time but throw errors when the LAMS core classes try to call the methods.

LAMS 2.0.2 to LAMS 2.0.4

Two methods in ToolContentManager have changed. They were changed to support Live Edit. Originally setDefineLater() and setRunOffline() only set these flags to on. Now they need to be able to turn it on and off, as the teacher may change the value during a Live Edit.

You must make this change for LAMS 2.0.4 and later versions to work properly, or it will be unable to start a lesson with a learning design that contains your tool.

To update LAMS with your new tool code, just do "compile-jar" in the ant-build for your tool, manually copy the new jar file (which should be in the build/lib directory) to lams.ear, then restart LAMS. You do not need to change anything in the database.

In your main service class you will need to change:


public void setAsDefineLater(Long toolContentId)


public void setAsDefineLater(Long toolContentId, boolean value)

public void setAsRunOffline(Long toolContentId)


public void setAsRunOffline(Long toolContentId, boolean value)

In both cases, you will need to change the logic to set the flags to true/false. For example:

public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException
    NoticeboardContent nbContent = getAndCheckIDandObject(toolContentId);

This change is not backwardly compatible - once you add the new "boolean value" parameter it won't work with with LAMS 2.0.2. If you leave the old methods in and add new methods then it will work with 2.0.2 and 2.0.4.

LAMS 2.0.4 to LAMS 2.1

The main change to the tools in LAMS 2.1 was the addition of Tool Outputs. These can be used to direct users to a particular branch in a User Based Branching activity. To support this, three new methods have been added to the two interface classes.

Not all tools have to support tool outputs - in 2.1 only three of the standard tools will support tool outputs. There has been a new column lams_tool.supports_outputs which specifies whether or not a tool supports outputs. If this is set to 0, then LAMS will assume that the tool does not support the tool outputs and so will not call the new methods. When the 2.0.4 to 2.1 upgrader runs, your tools will default to supports_outputs = 0, so LAMS should never ask your tool for the outputs, and hence nothing should break if you do not have the methods.

We've tested this briefly by plugging in one of the 2.0.4 jar/war files for a tool into 2.1, and it seems to be fine. So if you can't change your tool before the 2.1 release, then you should be able to upgrade safely. But make sure you have a backup of LAMS first before upgrading !!!!!

But your code will not compile when you come to make future improvements to your tool, and it would be better if you could add the new methods. For now, you can add the following code and this will be sufficient.

To update LAMS with your new tool code, just do "compile-jar" in the ant-build for your tool, manually copy the new jar file (which should be in the build/lib directory) to lams.ear, then restart LAMS. You do not need to change anything in the database. As these are completely new calls, you can make this change and copy the jar file into LAMS 2.0.4 and it should run fine. Otherwise you can wait until after you have done the 2.1 upgrade and then update your code.

In your main service class add the following methods:

/** Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions that are always
 * available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created for a particular activity
 * such as the answer to the third question contains the word Koala and hence the need for the toolContentId
 * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition
public SortedMap<String, ToolOutputDefinition> getToolOutputDefinitions(Long toolContentId) throws ToolException {
	return new TreeMap<String, ToolOutputDefinition>();

 * Get the tool output for the given tool output names.
 * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List<String>, java.lang.Long, java.lang.Long)
public SortedMap<String, ToolOutput> getToolOutput(List<String> names, Long toolSessionId, Long learnerId) {
	return new TreeMap<String,ToolOutput>();

 * Get the tool output for the given tool output name.
 * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long, java.lang.Long)
public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) {
	return null;

If you wish to implement tool outputs in your tool, then read how to do this on the Tool Output How To page.

  • No labels