wxtpages
Class scripthandler

java.lang.Object
  extended bywxtpages.scripthandler

public class scripthandler
extends java.lang.Object

An instance of scripthandler parses the script and generates the pagestructure as a list of unitGroup instances that in turn owns unitPage instances. The scripthandler is the interface to the GUI Each siteFrame in the GUI owns an instance of scripthandler. There is no reference back to the GUI.


Field Summary
protected  java.util.HashMap m_programMap
          All registered programs, as in program-elements in the script
protected  java.util.HashMap m_scriptOptionMap
          All registered options that are scriptglobals
 
Constructor Summary
scripthandler(java.lang.String script, java.lang.String scriptPath, reporter rep)
          Creates a new instance of scripthandler Establish sitestructure
 
Method Summary
 boolean buildForced(javax.swing.JProgressBar pBar, java.util.Vector units)
          Building everything or selected units (pages or groups), unconditionally
 boolean buildForcedOnePage(java.lang.String pageID)
          Building one page unconditionally, if we can find it Used when we build a single page from the commandline
 void buildStructure()
          Assumes that the The DOM is established and has been checked for wellformedness.
 boolean buildUpdated(javax.swing.JProgressBar pBar)
          Building the pages that have updated components, template and/or content-files and/or transformations.
protected  void cleanOutdatedElements(org.w3c.dom.Element e)
          Removes all elements in the tree that have a datespan not covering to day
protected  void collectFromScript()
          Collect values that are allowed at scriptlevel: version and programs and option logfile
 boolean controlLinks(java.util.Vector tagAttList, javax.swing.JProgressBar pBar, boolean includeAbsolutes)
          Controlling links in all pages
 java.lang.String getDirectoryPath()
          Get the path to the scripts directory
 java.util.Vector getFileList()
          Return list of all groups and pages that will be built.
 unitGroup getGroupByName(java.lang.String groupName)
          Return a group with a given name
 java.util.Vector getGroupList()
          Return list of all grups that will be built.
 java.util.Vector getPageList()
          Return list of all pages that will be built.
 java.lang.String getProgram(java.lang.String programName)
          Get the path for a registered program
 reporter getReporter()
          Get this scripthandler reporter
 org.w3c.dom.Document getScriptDoc()
          Get the script as a document
 java.util.Vector makePagelistByXPath(org.w3c.dom.Node contextNode, java.lang.String xpath)
          Collect a pagelist from the script, based on an xpath
 void setLogFileAndToday()
          Tell the reporter to set a new file to accumulate log Value set is either null, or taken from optionmap Tell accessutils-library which date we have to day
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_programMap

protected java.util.HashMap m_programMap
All registered programs, as in program-elements in the script


m_scriptOptionMap

protected java.util.HashMap m_scriptOptionMap
All registered options that are scriptglobals

Constructor Detail

scripthandler

public scripthandler(java.lang.String script,
                     java.lang.String scriptPath,
                     reporter rep)
              throws java.lang.Exception
Creates a new instance of scripthandler Establish sitestructure

Parameters:
scriptPath - The path to the script
script - The script as text
rep - The reporter object that all reporting objects in this script will use
Throws:
java.lang.Exception - when we dont have a parsable script
Method Detail

getScriptDoc

public org.w3c.dom.Document getScriptDoc()
Get the script as a document

Returns:
The script as a DOM-tree

getReporter

public reporter getReporter()
Get this scripthandler reporter

Returns:
The reporter object assigned to this scripthandler

getProgram

public java.lang.String getProgram(java.lang.String programName)
Get the path for a registered program

Parameters:
programName - the program we are looking for
Returns:
a filepath

setLogFileAndToday

public void setLogFileAndToday()
Tell the reporter to set a new file to accumulate log Value set is either null, or taken from optionmap Tell accessutils-library which date we have to day


getDirectoryPath

public java.lang.String getDirectoryPath()
Get the path to the scripts directory

Returns:
The path to the scripts directory

getFileList

public java.util.Vector getFileList()
Return list of all groups and pages that will be built. Walk the list of groups and collect pages, all in a preorder sequence

Returns:
a Vector with all pages and groups

getPageList

public java.util.Vector getPageList()
Return list of all pages that will be built. Walk the list of groups and collect pages, all in a preorder sequence

Returns:
a Vector with all pages

getGroupList

public java.util.Vector getGroupList()
Return list of all grups that will be built.

Returns:
a Vector with all groups

getGroupByName

public unitGroup getGroupByName(java.lang.String groupName)
Return a group with a given name

Parameters:
groupName - The name of the group we are looking for
Returns:
a unitGroup if found, else null

buildForced

public boolean buildForced(javax.swing.JProgressBar pBar,
                           java.util.Vector units)
Building everything or selected units (pages or groups), unconditionally

Parameters:
pBar - A progress bar that we want to update, null if we run without GUI
units - The pages we want to build, all if null
Returns:
true if built, false if we must give up due to a serious error

buildForcedOnePage

public boolean buildForcedOnePage(java.lang.String pageID)
Building one page unconditionally, if we can find it Used when we build a single page from the commandline

Parameters:
pageID - The page or group we want to build
Returns:
true if built, false if we must give up due to a serious error

buildUpdated

public boolean buildUpdated(javax.swing.JProgressBar pBar)
Building the pages that have updated components, template and/or content-files and/or transformations. All pages are candidates.

Parameters:
pBar - A progress bar that we want to update, null if we run without GUI
Returns:
true if built, false if we must give up due to a serious error

controlLinks

public boolean controlLinks(java.util.Vector tagAttList,
                            javax.swing.JProgressBar pBar,
                            boolean includeAbsolutes)
Controlling links in all pages

Parameters:
tagAttList - The list of tag/attributes to be checked
includeAbsolutes - true if absolute links should be checked
pBar - A progress bar that we want to update, null if we run without GUI
Returns:
true if control is finished, false if aborted

buildStructure

public void buildStructure()
                    throws java.lang.Exception
Assumes that the The DOM is established and has been checked for wellformedness. Produce groups as instances of unitGroup

Throws:
java.lang.Exception - when we cannot parse

collectFromScript

protected void collectFromScript()
                          throws java.lang.Exception
Collect values that are allowed at scriptlevel: version and programs and option logfile

Throws:
java.lang.Exception - if version is wrong or missing

makePagelistByXPath

public java.util.Vector makePagelistByXPath(org.w3c.dom.Node contextNode,
                                            java.lang.String xpath)
Collect a pagelist from the script, based on an xpath

Parameters:
xpath - The xpath that selects pages
contextNode - The contextnode
Returns:
A vector with pages

cleanOutdatedElements

protected void cleanOutdatedElements(org.w3c.dom.Element e)
Removes all elements in the tree that have a datespan not covering to day

Parameters:
e - The element we investigate