treebolic.site
Class SiteMaker

java.lang.Object
  extended by java.util.Observable
      extended by treebolic.site.SiteMaker
Direct Known Subclasses:
FileSiteMaker, FtpSiteMaker

public abstract class SiteMaker
extends java.util.Observable

Make site

Author:
Bernard Bou

Field Summary
(package private) static int PROGRESSCOMPLETE
          Disconnect complete
(package private) static int PROGRESSCONNECT
          Connect start
(package private) static int PROGRESSCONNECTCOMPLETE
          Connect completed
(package private) static int PROGRESSDISCONNECT
          Disconnect start
(package private) static int PROGRESSXFERDTD
          Transfer DTD
(package private) static int PROGRESSXFERHTML
          Transfer HTML
(package private) static int PROGRESSXFERIMAGES
          Transfer images
(package private) static int PROGRESSXFERJAR
          Transfer applet Jar
(package private) static int PROGRESSXFERXML
          Transfer XML
(package private) static int PROGRESSZERO
          Start
private static java.lang.String theAppclass
          Applet class
private  org.w3c.dom.Document theDocument
          Document (source)
private static java.lang.String theDTDFile
          Dtd file to transfer
protected  java.lang.String theHtmlFile
          HTML file (target)
private  java.lang.String theImageRepository
          Image repository (source)
private static java.lang.String theJarFile
          Jar file to transfer
protected  java.lang.String theOperation
          Operation string
private  java.lang.String theRepository
          Repository (source) for templetes
static java.lang.String theTemplateFile
          HTML template file
private  java.lang.String theTitle
          Title for HTML title (target)
protected  java.lang.String theXmlFile
          XML file (target)
 
Constructor Summary
SiteMaker(org.w3c.dom.Document thisDocument, java.lang.String thisRepository, java.lang.String thisImageRepository, java.lang.String thisHtmlFile, java.lang.String thisXmlFile, java.lang.String thisTitle)
          Constructor
 
Method Summary
(package private) abstract  boolean changeFolder(java.lang.String thisRelativeFolder)
          Change folder
(package private) abstract  boolean connect()
          Connect to destination
private static boolean copyStreams(java.io.InputStream thisInstream, java.io.OutputStream thisOutstream)
          Copy streams
private  boolean copyStreamsReplace(java.io.InputStream thisInstream, java.io.OutputStream thisOutstream, java.lang.String[] theseSources, java.lang.String[] theseDestinations)
          Copy text file to output stream while replacing strings with values
(package private) abstract  boolean disconnect()
          Disconnect from destination
 boolean make()
          Make site operation
(package private) abstract  java.io.OutputStream makeOutStream(java.lang.String thisFilename)
          Make output stream
(package private)  void notifyOperation(java.lang.String thisOperation, int thisProgressValue)
          Notify operation progress
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theJarFile

private static final java.lang.String theJarFile
Jar file to transfer

See Also:
Constant Field Values

theDTDFile

private static final java.lang.String theDTDFile
Dtd file to transfer

See Also:
Constant Field Values

theAppclass

private static final java.lang.String theAppclass
Applet class

See Also:
Constant Field Values

theTemplateFile

public static java.lang.String theTemplateFile
HTML template file


PROGRESSZERO

static final int PROGRESSZERO
Start

See Also:
Constant Field Values

PROGRESSCONNECT

static final int PROGRESSCONNECT
Connect start

See Also:
Constant Field Values

PROGRESSCONNECTCOMPLETE

static final int PROGRESSCONNECTCOMPLETE
Connect completed

See Also:
Constant Field Values

PROGRESSXFERXML

static final int PROGRESSXFERXML
Transfer XML

See Also:
Constant Field Values

PROGRESSXFERHTML

static final int PROGRESSXFERHTML
Transfer HTML

See Also:
Constant Field Values

PROGRESSXFERJAR

static final int PROGRESSXFERJAR
Transfer applet Jar

See Also:
Constant Field Values

PROGRESSXFERDTD

static final int PROGRESSXFERDTD
Transfer DTD

See Also:
Constant Field Values

PROGRESSXFERIMAGES

static final int PROGRESSXFERIMAGES
Transfer images

See Also:
Constant Field Values

PROGRESSDISCONNECT

static final int PROGRESSDISCONNECT
Disconnect start

See Also:
Constant Field Values

PROGRESSCOMPLETE

static final int PROGRESSCOMPLETE
Disconnect complete

See Also:
Constant Field Values

theDocument

private org.w3c.dom.Document theDocument
Document (source)


theRepository

private java.lang.String theRepository
Repository (source) for templetes


theImageRepository

private java.lang.String theImageRepository
Image repository (source)


theTitle

private java.lang.String theTitle
Title for HTML title (target)


theHtmlFile

protected java.lang.String theHtmlFile
HTML file (target)


theXmlFile

protected java.lang.String theXmlFile
XML file (target)


theOperation

protected java.lang.String theOperation
Operation string

Constructor Detail

SiteMaker

public SiteMaker(org.w3c.dom.Document thisDocument,
                 java.lang.String thisRepository,
                 java.lang.String thisImageRepository,
                 java.lang.String thisHtmlFile,
                 java.lang.String thisXmlFile,
                 java.lang.String thisTitle)
          throws java.net.URISyntaxException,
                 java.io.IOException
Constructor

Parameters:
thisDocument - document (source)
thisRepository - repository (source)
thisImageRepository - image repository (source)
thisHtmlFile - HTML file (target)
thisXmlFile - XML file (target)
thisTitle - HTML file title (target)
Throws:
java.net.URISyntaxException
java.io.IOException
Method Detail

connect

abstract boolean connect()
Connect to destination

Returns:
true if successful

disconnect

abstract boolean disconnect()
Disconnect from destination

Returns:
true if successful

changeFolder

abstract boolean changeFolder(java.lang.String thisRelativeFolder)
                       throws java.net.MalformedURLException,
                              java.net.URISyntaxException
Change folder

Parameters:
thisRelativeFolder - relative folder
Returns:
true if successful
Throws:
java.net.MalformedURLException
java.net.URISyntaxException

makeOutStream

abstract java.io.OutputStream makeOutStream(java.lang.String thisFilename)
                                     throws java.net.MalformedURLException,
                                            java.io.IOException,
                                            java.net.URISyntaxException
Make output stream

Parameters:
thisFilename - filename
Returns:
output stream
Throws:
java.net.MalformedURLException
java.io.IOException
java.net.URISyntaxException

notifyOperation

void notifyOperation(java.lang.String thisOperation,
                     int thisProgressValue)
Notify operation progress

Parameters:
thisOperation - pending operation string
thisProgressValue - progress value (max 100)

make

public boolean make()
Make site operation

Returns:
true if successful

copyStreamsReplace

private boolean copyStreamsReplace(java.io.InputStream thisInstream,
                                   java.io.OutputStream thisOutstream,
                                   java.lang.String[] theseSources,
                                   java.lang.String[] theseDestinations)
Copy text file to output stream while replacing strings with values

Parameters:
thisInstream - input stream
thisOutstream - output strean
theseSources - what to replace
theseDestinations - what to replace it with
Returns:
true if successful

copyStreams

private static boolean copyStreams(java.io.InputStream thisInstream,
                                   java.io.OutputStream thisOutstream)
Copy streams

Parameters:
thisInstream - input stream
thisOutstream - output stream
Returns:
true if successful