org.activemath.exercises
Class Composer

java.lang.Object
  extended by org.activemath.exercises.Composer

public class Composer
extends Object

Exercise composer.

Version:
$Revision: 1.67 $ $Date: 2011/08/24 16:49:55 $

Field Summary
protected static Configuration config
           
protected static org.jdom.Namespace omdocNamespace
           
protected static org.jdom.Namespace openmathNamespace
           
 
Constructor Summary
Composer()
           
 
Method Summary
protected static org.jdom.Document loadExercise(String exerciseId, String strategy, User user)
           
protected static org.jdom.Document loadExercise(String exerciseId, String strategy, User user, String lang)
           
protected static org.jdom.Document loadExercise(String exerciseId, User user)
           
protected static org.jdom.Document loadExercise(String exerciseId, User user, String lang)
           
static InteractionGenerator prepareExercise(org.jdom.Document exercise, User user)
          Prepare for generating the interactions for the provided exercise.
static InteractionGenerator prepareExercise(String exerciseId, String strategy, User user, String lang)
           
static InteractionGenerator prepareExercise(String exerciseId, User user, String lang)
          Prepare for generating the interactions for the requested exercise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected static Configuration config

openmathNamespace

protected static final org.jdom.Namespace openmathNamespace

omdocNamespace

protected static final org.jdom.Namespace omdocNamespace
Constructor Detail

Composer

public Composer()
Method Detail

prepareExercise

public static InteractionGenerator prepareExercise(String exerciseId,
                                                   User user,
                                                   String lang)
                                            throws IOException
Prepare for generating the interactions for the requested exercise. The default implementation loads the exercise description as XML. If the exercise identifier begins with "mbase:", it is fetched through MBase. If not, a file name is constructed by prepending the value of the property "exercises.location" as a path, and appending the suffix ".omdoc". The normal case is to use MBase, but the other possibility is there for debugging purposes, since the current MBase implementation in ActiveMath changes the content on storage, but the direct loading does not.

Parameters:
exerciseId - identifier for the exercise.
Returns:
interaction generator object for the exercise.
Throws:
IOException - can happen in case of direct loading.

prepareExercise

public static InteractionGenerator prepareExercise(String exerciseId,
                                                   String strategy,
                                                   User user,
                                                   String lang)
                                            throws IOException
Throws:
IOException

prepareExercise

public static InteractionGenerator prepareExercise(org.jdom.Document exercise,
                                                   User user)
Prepare for generating the interactions for the provided exercise. It is the same as prepareExercise(String exerciseId), but uses the provided exercise content instead of loading it.

Parameters:
exercise - exercise document.
Returns:
interaction generator object for the exercise.

loadExercise

protected static org.jdom.Document loadExercise(String exerciseId,
                                                User user)
                                         throws IOException
Throws:
IOException

loadExercise

protected static org.jdom.Document loadExercise(String exerciseId,
                                                User user,
                                                String lang)
                                         throws IOException
Throws:
IOException

loadExercise

protected static org.jdom.Document loadExercise(String exerciseId,
                                                String strategy,
                                                User user)
                                         throws IOException
Throws:
IOException

loadExercise

protected static org.jdom.Document loadExercise(String exerciseId,
                                                String strategy,
                                                User user,
                                                String lang)
                                         throws IOException
Throws:
IOException