org.activemath.omdocjdom
Class OJContentCollectionUtil

java.lang.Object
  extended by org.activemath.omdocjdom.OJContentCollectionUtil

public class OJContentCollectionUtil
extends Object

Simple methods to easily find properties of an enclosing collections as determined by a heuristics. The heuristics simply relies on the file being part of a directory an ancestor of which can contain a file with pattern ContentDescr_*.properties.


Constructor Summary
OJContentCollectionUtil()
           
 
Method Summary
static void cleanUpOMDocDoc(File file)
          Deprecated. Please refer to OQMathBuffer
static void cleanUpOMDocElt(OJElement elt)
           
static File findNotationsFile(File oqmathOrOMdocFile)
           
static Properties getCollectionDescriptorOfDocument(File docFile)
           
static File getCollectionDirOfDocument(File docFile)
          Searches for a directory above docFile which contains a Content-descriptor.
static String getCollectionIdOfDocument(File docFile)
          Finds the collection-description and extracts from it a property OmdocJdomMBase.collections.*.publicIdentifier.
static File getDtdFileOfDocument(File docFile)
           
static com.wutka.dtd.DTD getDtdOfDocument(File docFile)
           
static List getExtasyEnabledCollections(Subconfiguration extasySubconfig)
          Finds the name of the loaded collections which are enabled for exercise authoring.
static File getExtasyPictPath(String collectionName, Subconfiguration extasySubconfig)
          Finds the directory where the collection offers space to save picture files to.
static File getExtasySavePath(String collectionName, Subconfiguration extasySubconfig)
          Finds the directory where the collection offers space to save OMDoc files to.
static void main(String[] args)
          Invoke with a single parameter... the name of the omdoc file.
static boolean mayAuthorEditCollection(String authorUserId, String collectionName, Subconfiguration extasySubconfig)
          checks whether the named author is allowed to author into this collection (if there is no author configuration, all authors are allowed to write).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OJContentCollectionUtil

public OJContentCollectionUtil()
Method Detail

getCollectionIdOfDocument

public static String getCollectionIdOfDocument(File docFile)
Finds the collection-description and extracts from it a property OmdocJdomMBase.collections.*.publicIdentifier. Returns if if found (and alone).

Parameters:
docFile -
Returns:
the collection string

getCollectionDescriptorOfDocument

public static Properties getCollectionDescriptorOfDocument(File docFile)

getDtdOfDocument

public static com.wutka.dtd.DTD getDtdOfDocument(File docFile)

getDtdFileOfDocument

public static File getDtdFileOfDocument(File docFile)

getCollectionDirOfDocument

public static File getCollectionDirOfDocument(File docFile)
Searches for a directory above docFile which contains a Content-descriptor.

Parameters:
docFile -
Returns:
the directory of the collection string

getExtasyEnabledCollections

public static List getExtasyEnabledCollections(Subconfiguration extasySubconfig)
Finds the name of the loaded collections which are enabled for exercise authoring.

Parameters:
extasySubconfig: - the extasy sub-configuration as can be obtained with new ManagerSubconfiguration("exercises.author-content");
Returns:
the list of collection identifier strings, ordered alphabetically

getExtasySavePath

public static File getExtasySavePath(String collectionName,
                                     Subconfiguration extasySubconfig)
Finds the directory where the collection offers space to save OMDoc files to.

Parameters:
extasySubconfig: - the extasy sub-configuration as can be obtained with new ManagerSubconfiguration("exercises.author-content");
collectionName: - the content collection string-identifier
Returns:
the directory

getExtasyPictPath

public static File getExtasyPictPath(String collectionName,
                                     Subconfiguration extasySubconfig)
Finds the directory where the collection offers space to save picture files to.

Parameters:
extasySubconfig: - the extasy sub-configuration as can be obtained with new ManagerSubconfiguration("exercises.author-content");
collectionName: - the content collection string-identifier
Returns:
the directory

mayAuthorEditCollection

public static boolean mayAuthorEditCollection(String authorUserId,
                                              String collectionName,
                                              Subconfiguration extasySubconfig)
checks whether the named author is allowed to author into this collection (if there is no author configuration, all authors are allowed to write).

Parameters:
authorUserId: - the extasy sub-configuration as can be obtained with new ManagerSubconfiguration("exercises.author-content");
collectionName: - the content collection string-identifier
Returns:
true or false

cleanUpOMDocElt

public static void cleanUpOMDocElt(OJElement elt)

cleanUpOMDocDoc

public static void cleanUpOMDocDoc(File file)
                            throws Exception
Deprecated. Please refer to OQMathBuffer

Throws:
Exception

findNotationsFile

public static File findNotationsFile(File oqmathOrOMdocFile)

main

public static void main(String[] args)
                 throws Exception
Invoke with a single parameter... the name of the omdoc file.

Throws:
Exception