net.sf.tomp.el.author.io
Class AuthorIO

java.lang.Object
  extended by net.sf.tomp.el.author.io.AuthorIO

public class AuthorIO
extends java.lang.Object


Constructor Summary
AuthorIO()
           
 
Method Summary
protected  java.lang.String[] listCourseIds(CourseTree tree)
          Browses the tree's directory and gets the IDs (= names of the courses' directories) of the courses.
protected  java.lang.String[] listLectureIds(Lectures lectures)
          Browses the lectures' directories and gets the IDs of the lectures (= names of the lectures' files).
protected  java.lang.String[] listPracticeIds(Practices practices)
          Browses the practices' directories and gets the IDs of the practices (= names of the practices' files).
protected  java.lang.String[] listProjectIds(Projects projects)
          Browses the projects' directories and gets the IDs of the projects (= names of the projects' files).
protected  java.lang.String[] listTaskIds(Tasks tasks)
          Browses the tasks' directories and gets the IDs of the tasks (= names of the tasks' files).
 Course loadCourse(CourseTree tree, java.lang.String id)
          Creates a new instance of Course, adds it to the CourseTree loads the lectures of the course.
 void loadCourses(CourseTree tree)
          Loads all courses in the tree.
 CourseTree loadCourseTree(java.lang.String id)
          Creates a new instance of CourseTree and loads the courses of the CourseTree.
 Lecture loadLecture(Course course, java.lang.String id)
          Loads a lecture of the course
 void loadLectures(Course course)
          Loads lectures for a course.
 Practice loadPractice(Course course, java.lang.String id)
          Loads a practice of the course
 void loadPractices(Course course)
          Loads practices for a course.
 Project loadProject(Course course, java.lang.String id)
          Loads a project of the course
 void loadProjects(Course course)
          Loads projects for a course.
 Task loadTask(Course course, java.lang.String id)
          Loads a task of the course
 void loadTasks(Course course)
          Loads tasks for a course.
 void saveCourse(Course course)
          Builds up a new XML document for Course using DOM4J factory and saves it.
 void saveCourses(CourseTree tree)
          Saves all courses in the tree.
 void saveCourseTree(CourseTree tree)
          Saves the CourseTree
 void saveLecture(Lecture lecture)
          Builds up a new XML document for lecture using DOM4J factory and saves it.
 void saveLectures(Course course)
          Saves all lectures of the course.
 void savePractice(Practice t)
          Builds up a new XML document for practice using DOM4J factory and saves it.
 void saveProject(Project t)
          Builds up a new XML document for project using DOM4J factory and saves it.
 void saveTask(Task t)
          Builds up a new XML document for task using DOM4J factory and saves it.
 void write(org.dom4j.Document doc, java.io.File f)
          Writes the XML document (e. g. of a lecture) to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorIO

public AuthorIO()
Method Detail

loadCourseTree

public CourseTree loadCourseTree(java.lang.String id)
                          throws java.net.MalformedURLException,
                                 org.dom4j.DocumentException
Creates a new instance of CourseTree and loads the courses of the CourseTree.

Parameters:
id - CourseTree ID
Returns:
Loaded CourseTree
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

saveCourseTree

public void saveCourseTree(CourseTree tree)
                    throws java.net.MalformedURLException,
                           org.dom4j.DocumentException
Saves the CourseTree

Parameters:
tree - The CourseTree to be saved.
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

loadCourses

public void loadCourses(CourseTree tree)
                 throws java.net.MalformedURLException,
                        org.dom4j.DocumentException
Loads all courses in the tree.

Parameters:
tree - Courses from this tree will be loaded.
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

saveCourses

public void saveCourses(CourseTree tree)
                 throws java.io.UnsupportedEncodingException,
                        org.dom4j.DocumentException,
                        java.io.IOException
Saves all courses in the tree.

Parameters:
tree - Courses from this tree will be saved
Throws:
java.io.UnsupportedEncodingException
org.dom4j.DocumentException
java.io.IOException

loadCourse

public Course loadCourse(CourseTree tree,
                         java.lang.String id)
                  throws java.net.MalformedURLException,
                         org.dom4j.DocumentException
Creates a new instance of Course, adds it to the CourseTree loads the lectures of the course.

Parameters:
tree - Tree where the new Course will be loaded.
id - Course ID
Returns:
Loaded Course
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

saveCourse

public void saveCourse(Course course)
                throws java.io.UnsupportedEncodingException,
                       org.dom4j.DocumentException,
                       java.io.IOException
Builds up a new XML document for Course using DOM4J factory and saves it.

Parameters:
course - This course will be saved.
Throws:
java.io.UnsupportedEncodingException
org.dom4j.DocumentException
java.io.IOException

loadLectures

public void loadLectures(Course course)
                  throws java.net.MalformedURLException,
                         org.dom4j.DocumentException
Loads lectures for a course.

Parameters:
course - Lectures from this course will be loaded.
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

saveLectures

public void saveLectures(Course course)
                  throws java.io.UnsupportedEncodingException,
                         org.dom4j.DocumentException,
                         java.io.IOException
Saves all lectures of the course.

Parameters:
course - lectures from this course will be saved.
Throws:
java.io.UnsupportedEncodingException
org.dom4j.DocumentException
java.io.IOException

loadLecture

public Lecture loadLecture(Course course,
                           java.lang.String id)
                    throws java.net.MalformedURLException,
                           org.dom4j.DocumentException
Loads a lecture of the course

Parameters:
course - Lectures from this course will be loaded.
id - Lecture ID
Returns:
Lecture
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

saveLecture

public void saveLecture(Lecture lecture)
                 throws java.io.UnsupportedEncodingException,
                        org.dom4j.DocumentException,
                        java.io.IOException
Builds up a new XML document for lecture using DOM4J factory and saves it.

Parameters:
lecture - This lecture will be saved.
Throws:
java.io.UnsupportedEncodingException
org.dom4j.DocumentException
java.io.IOException

loadTask

public Task loadTask(Course course,
                     java.lang.String id)
              throws java.net.MalformedURLException,
                     org.dom4j.DocumentException
Loads a task of the course

Parameters:
course - Tasks from this course will be loaded.
id - Task ID
Returns:
Task
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

loadTasks

public void loadTasks(Course course)
               throws java.net.MalformedURLException,
                      org.dom4j.DocumentException
Loads tasks for a course.

Parameters:
course - Tasks from this course will be loaded.
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

saveTask

public void saveTask(Task t)
              throws java.io.UnsupportedEncodingException,
                     org.dom4j.DocumentException,
                     java.io.IOException
Builds up a new XML document for task using DOM4J factory and saves it.

Parameters:
t - This task will be saved.
Throws:
java.io.UnsupportedEncodingException
org.dom4j.DocumentException
java.io.IOException

loadPractice

public Practice loadPractice(Course course,
                             java.lang.String id)
                      throws java.net.MalformedURLException,
                             org.dom4j.DocumentException
Loads a practice of the course

Parameters:
course - Practices from this course will be loaded.
id - Practice ID
Returns:
Practice
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

loadPractices

public void loadPractices(Course course)
                   throws java.net.MalformedURLException,
                          org.dom4j.DocumentException
Loads practices for a course.

Parameters:
course - Practices from this course will be loaded.
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

savePractice

public void savePractice(Practice t)
                  throws java.io.UnsupportedEncodingException,
                         org.dom4j.DocumentException,
                         java.io.IOException
Builds up a new XML document for practice using DOM4J factory and saves it.

Parameters:
t - This practice will be saved.
Throws:
java.io.UnsupportedEncodingException
org.dom4j.DocumentException
java.io.IOException

loadProject

public Project loadProject(Course course,
                           java.lang.String id)
                    throws java.net.MalformedURLException,
                           org.dom4j.DocumentException
Loads a project of the course

Parameters:
course - Projects from this course will be loaded.
id - Project ID
Returns:
Project
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

loadProjects

public void loadProjects(Course course)
                  throws java.net.MalformedURLException,
                         org.dom4j.DocumentException
Loads projects for a course.

Parameters:
course - Projects from this course will be loaded.
Throws:
java.net.MalformedURLException
org.dom4j.DocumentException

saveProject

public void saveProject(Project t)
                 throws java.io.UnsupportedEncodingException,
                        org.dom4j.DocumentException,
                        java.io.IOException
Builds up a new XML document for project using DOM4J factory and saves it.

Parameters:
t - This project will be saved.
Throws:
java.io.UnsupportedEncodingException
org.dom4j.DocumentException
java.io.IOException

listCourseIds

protected java.lang.String[] listCourseIds(CourseTree tree)
Browses the tree's directory and gets the IDs (= names of the courses' directories) of the courses.

Parameters:
tree - This tree (courses' directories) will be browsed.
Returns:
IDs of the courses

listLectureIds

protected java.lang.String[] listLectureIds(Lectures lectures)
Browses the lectures' directories and gets the IDs of the lectures (= names of the lectures' files).

Parameters:
lectures - These lectures will be browsed.
Returns:
IDs of the lectures

listTaskIds

protected java.lang.String[] listTaskIds(Tasks tasks)
Browses the tasks' directories and gets the IDs of the tasks (= names of the tasks' files).

Parameters:
tasks - These tasks will be browsed.
Returns:
IDs of the tasks

listPracticeIds

protected java.lang.String[] listPracticeIds(Practices practices)
Browses the practices' directories and gets the IDs of the practices (= names of the practices' files).

Parameters:
practices - These practices will be browsed.
Returns:
IDs of the practices

listProjectIds

protected java.lang.String[] listProjectIds(Projects projects)
Browses the projects' directories and gets the IDs of the projects (= names of the projects' files).

Parameters:
projects - These projects will be browsed.
Returns:
IDs of the projects

write

public void write(org.dom4j.Document doc,
                  java.io.File f)
           throws org.dom4j.DocumentException,
                  java.io.UnsupportedEncodingException,
                  java.io.IOException
Writes the XML document (e. g. of a lecture) to a file.

Parameters:
doc - The generated XML document which will be saved.
f - The names of the file to save do XML document to.
Throws:
org.dom4j.DocumentException
java.io.UnsupportedEncodingException
java.io.IOException