All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class websphinx.Concatenator

java.lang.Object
   |
   +----websphinx.HTMLTransformer
           |
           +----websphinx.LinkTransformer
                   |
                   +----websphinx.RewritableLinkTransformer
                           |
                           +----websphinx.Concatenator

public class Concatenator
extends RewritableLinkTransformer
Transformer that concatenates multiple pages into a single HTML page.

The entire set of pages is preceded by a "prolog" and followed by an "epilog", which are constant strings of HTML. Each page is preceded by a "header" and followed by a "footer". Adjacent pages are separated by a "divider".

Concatenator performs the following transformations on pages before appending them together:


Variable Index

 o defaultDivider
 o defaultEpilog
 o defaultFooter
 o defaultHeader
 o defaultProlog

Constructor Index

 o Concatenator(String)
Make a new Concatenator that writes to a file.

Method Index

 o close()
Close the concatenation.
 o getDivider()
Get the divider.
 o getEpilog()
Get the epilog.
 o getPageCount()
Get number of pages written to this mirror.
 o getPageFooter()
Get the footer.
 o getPageHeader()
Get the header.
 o getProlog()
Get the prolog.
 o handleElement(Element)
Process an HTML element for concatenation.
 o main(String[])
 o rewrite()
Rewrite the concatenation.
 o setDivider(String)
Set the divider.
 o setEpilog(String)
Set the epilog.
 o setPageFooter(String)
Set the footer.
 o setPageHeader(String)
Set the header.
 o setProlog(String)
Set the prolog.
 o writePage(Page)
Write a page to the concatenation.

Variables

 o defaultProlog
 public static String defaultProlog
 o defaultHeader
 public static String defaultHeader
 o defaultFooter
 public static String defaultFooter
 o defaultDivider
 public static String defaultDivider
 o defaultEpilog
 public static String defaultEpilog

Constructors

 o Concatenator
 public Concatenator(String filename) throws IOException
Make a new Concatenator that writes to a file.

Parameters:
filename - Filename to write concatenated pages to
Throws: IOException
if file cannot be opened

Methods

 o setProlog
 public synchronized void setProlog(String prolog)
Set the prolog.

Parameters:
prolog - string of HTML that is emitted at the beginning of the concatenation. Default value is:
<HTML><HEAD><TITLE>Concatenation</TITLE></HEAD><BODY>\n
 o getProlog
 public String getProlog()
Get the prolog.

Returns:
string of HTML that is emitted at the beginning of the concatenation.
 o setPageHeader
 public synchronized void setPageHeader(String header)
Set the header. The header can contain macro codes which are replaced with attributes of the page about to be written:
%t
title of the page
%u
URL of page
%a
anchor name of the page ("pageN", where N is the page number)
%p
page number (starting from 1)

Parameters:
header - string of HTML that is emitted before each page. The default value is:
<TABLE WIDTH="100%"><TR>\n
<TD ALIGN=left><A NAME="%a">%t [%u]</A>\n
<TD ALIGN=right>Page %p</TABLE>\n
 o getPageHeader
 public String getPageHeader()
Get the header.

Returns:
string of HTML that is emitted before each page.
 o setPageFooter
 public synchronized void setPageFooter(String footer)
Set the footer. The footer can contain the same macros as the header (%t, %u, %a, %p); see setPageHeader for more details.

Parameters:
footer - string of HTML that is emitted after each page.
 o getPageFooter
 public String getPageFooter()
Get the footer.

Returns:
string of HTML that is emitted after each page.
 o setDivider
 public synchronized void setDivider(String divider)
Set the divider.

Parameters:
divider - string of HTML that is emitted between each pair of pages.
 o getDivider
 public String getDivider()
Get the divider.

Returns:
string of HTML that is emitted between each pair of pages.
 o setEpilog
 public synchronized void setEpilog(String epilog)
Set the epilog.

Parameters:
epilog - string of HTML that is emitted after the entire concatenation.
 o getEpilog
 public String getEpilog()
Get the epilog.

Returns:
string of HTML that is emitted after the entire concatenation.
 o getPageCount
 public synchronized int getPageCount()
Get number of pages written to this mirror.

Returns:
number of calls to writePage() on this mirror
 o rewrite
 public synchronized void rewrite() throws IOException
Rewrite the concatenation. Makes sure all the links among concatenated pages have been fixed up.

Overrides:
rewrite in class RewritableLinkTransformer
 o close
 public synchronized void close() throws IOException
Close the concatenation. Makes sure all the links among concatenated pages have been fixed up and closes the file.

Overrides:
close in class RewritableLinkTransformer
 o writePage
 public synchronized void writePage(Page page) throws IOException
Write a page to the concatenation.

Parameters:
page - Page to write
Overrides:
writePage in class LinkTransformer
 o handleElement
 protected void handleElement(Element elem) throws IOException
Process an HTML element for concatenation. Deletes tags that would conflict with other pages (such as <HEAD>), changes the URLs in Link elements, and deletes or remaps the BASE element.

Parameters:
elem - HTML element to process
Overrides:
handleElement in class LinkTransformer
 o main
 public static void main(String args[]) throws Exception

All Packages  Class Hierarchy  This Package  Previous  Next  Index