Remove the webapppath information from XID.

This commit is contained in:
Christian P. MOMON 2010-02-23 18:20:02 +01:00
parent 5456caece2
commit 58ffaea88d
8 changed files with 32 additions and 155 deletions

View file

@ -22,7 +22,6 @@ public class DomPresenter extends Presenter
} }
protected String webappPath;
protected Document doc; protected Document doc;
/* /*
@ -30,7 +29,6 @@ public class DomPresenter extends Presenter
*/ */
public DomPresenter () public DomPresenter ()
{ {
this.webappPath = Presenter.staticRootPath;
this.doc = null; this.doc = null;
} }
@ -40,53 +38,11 @@ public class DomPresenter extends Presenter
*/ */
public DomPresenter (Document doc) public DomPresenter (Document doc)
{ {
this.webappPath = Presenter.staticRootPath;
this.doc = doc; this.doc = doc;
DomPresenter.addMetaTag (this.doc, "generator", "XID 0.0"); DomPresenter.addMetaTag (this.doc, "generator", "XID 0.0");
} }
/*
*
*/
public DomPresenter (String webappPath, Document doc)
{
if ((webappPath == null) || (webappPath.equals ("")))
{
this.webappPath = Presenter.staticRootPath;
}
else
{
this.webappPath = webappPath;
}
this.doc = doc;
DomPresenter.addMetaTag (this.doc, "generator", "XID 0.0");
}
/*
*
*/
public String getWebappPath ()
{
String result;
result = this.webappPath;
//
return (result);
}
/*
*
*/
public void setWebappPath (String path)
{
this.webappPath = path;
}
/** /**
* *
*/ */
@ -160,7 +116,7 @@ public class DomPresenter extends Presenter
else else
{ {
// Build the web page. // Build the web page.
result = Presenter.doXid (this.doc, datas, this.webappPath, errorOutput); result = Presenter.doXid (this.doc, datas, errorOutput);
} }
// //

View file

@ -15,7 +15,7 @@ public class FilePresenter extends DomPresenter
logger = org.apache.log4j.Logger.getLogger (FilePresenter.class); logger = org.apache.log4j.Logger.getLogger (FilePresenter.class);
} }
protected String sourceFileName; protected String sourceFilePathname;
protected long sourceFileTime; protected long sourceFileTime;
/* /*
@ -23,8 +23,7 @@ public class FilePresenter extends DomPresenter
*/ */
public FilePresenter () public FilePresenter ()
{ {
this.webappPath = Presenter.staticRootPath; this.sourceFilePathname = null;
this.sourceFileName = null;
this.sourceFileTime = 0; this.sourceFileTime = 0;
this.doc = null; this.doc = null;
} }
@ -33,10 +32,9 @@ public class FilePresenter extends DomPresenter
/* /*
* *
*/ */
public FilePresenter (String fileName) public FilePresenter (String filePathname)
{ {
this.webappPath = Presenter.staticRootPath; this.sourceFilePathname = filePathname;
this.sourceFileName = fileName;
this.sourceFileTime = 0; this.sourceFileTime = 0;
this.doc = null; this.doc = null;
} }
@ -45,28 +43,9 @@ public class FilePresenter extends DomPresenter
/* /*
* *
*/ */
public FilePresenter (String webappPath, String fileName) public void setSource (String filePathname)
{ {
if ((webappPath == null) || (webappPath.equals (""))) this.sourceFilePathname = filePathname;
{
this.webappPath = Presenter.staticRootPath;
}
else
{
this.webappPath = webappPath;
}
this.sourceFileName = fileName;
this.sourceFileTime = 0;
this.doc = null;
}
/*
*
*/
public void setSource (String fileName)
{
this.sourceFileName = fileName;
this.sourceFileTime = 0; this.sourceFileTime = 0;
this.doc = null; this.doc = null;
} }
@ -79,7 +58,7 @@ public class FilePresenter extends DomPresenter
{ {
String result; String result;
result = this.sourceFileName; result = this.sourceFilePathname;
// //
return (result); return (result);
@ -102,7 +81,7 @@ public class FilePresenter extends DomPresenter
{ {
StringBuffer result; StringBuffer result;
String sourceFilePath = this.webappPath + File.separator + this.sourceFileName; String sourceFilePath = this.sourceFilePathname;
// Get the good tree. // Get the good tree.
File source = new File (sourceFilePath); File source = new File (sourceFilePath);
@ -134,7 +113,7 @@ public class FilePresenter extends DomPresenter
} }
// Build the web page. // Build the web page.
result = Presenter.doXid (doc, datas, this.webappPath, errorOutput); result = Presenter.doXid (doc, datas, errorOutput);
// //
return (result); return (result);
@ -144,7 +123,7 @@ public class FilePresenter extends DomPresenter
/* /*
* Xid a file without data. * Xid a file without data.
*/ */
static public StringBuffer doXid (String fileName, String webappPath, StringBuffer errorOutput) static public StringBuffer doXid (String fileName, StringBuffer errorOutput)
{ {
StringBuffer result; StringBuffer result;
@ -158,7 +137,7 @@ public class FilePresenter extends DomPresenter
{ {
Presenter.addMetaTag (doc, "generator", "XID 0.0"); Presenter.addMetaTag (doc, "generator", "XID 0.0");
result = Presenter.doXid (doc, null, webappPath, errorOutput); result = Presenter.doXid (doc, null, errorOutput);
} }
// //

View file

@ -21,43 +21,15 @@ public class Presenter
logger = org.apache.log4j.Logger.getLogger (Presenter.class); logger = org.apache.log4j.Logger.getLogger (Presenter.class);
} }
static protected String staticRootPath;
static
{
staticRootPath = null;
}
/*
*
*/
static public void setStaticRootPath (String path)
{
Presenter.staticRootPath = path;
}
/*
*
*/
static public String getStaticRootPath ()
{
String result;
result = Presenter.staticRootPath;
//
return (result);
}
/* /*
* Xid a file with data. * Xid a file with data.
*/ */
static public StringBuffer doXid (Document doc, IdsDataById datas, String webappPath, StringBuffer errorOutput) static public StringBuffer doXid (Document doc, IdsDataById datas, StringBuffer errorOutput)
{ {
StringBuffer result; StringBuffer result;
result = Presenter.process (doc, datas, webappPath, errorOutput); result = Presenter.process (doc, datas, errorOutput);
// //
return (result); return (result);
@ -219,12 +191,12 @@ public class Presenter
lineCounter += 1; lineCounter += 1;
if (lineCounter == 1) if (lineCounter == 1)
{ {
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item (childIndex), datas, suffix, errorOutput));
} }
} }
else else
{ {
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item (childIndex), datas, suffix, errorOutput));
} }
} }
break; break;
@ -239,12 +211,12 @@ public class Presenter
if ((lineCounter == 1) || (lineCounter == 2)) if ((lineCounter == 1) || (lineCounter == 2))
{ {
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item (childIndex), datas, suffix, errorOutput));
} }
} }
else else
{ {
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item (childIndex), datas, suffix, errorOutput));
} }
} }
break; break;
@ -259,12 +231,12 @@ public class Presenter
if ((attrs2 != null) && if ((attrs2 != null) &&
(attrs2.getNamedItem ("id") != null)) (attrs2.getNamedItem ("id") != null))
{ {
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item (childIndex), datas, suffix, errorOutput));
} }
} }
else else
{ {
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item (childIndex), datas, suffix, errorOutput));
} }
} }
break; break;
@ -278,12 +250,12 @@ public class Presenter
if ((attrs2 == null) || if ((attrs2 == null) ||
(attrs2.getNamedItem ("id") == null)) (attrs2.getNamedItem ("id") == null))
{ {
result.append (process (children.item(childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item(childIndex), datas, suffix, errorOutput));
} }
} }
else else
{ {
result.append (process (children.item (childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item (childIndex), datas, suffix, errorOutput));
} }
} }
break; break;
@ -291,7 +263,7 @@ public class Presenter
case ALL_ROWS: case ALL_ROWS:
for (int childIndex = 0; childIndex < childrenCount; childIndex++) for (int childIndex = 0; childIndex < childrenCount; childIndex++)
{ {
result.append (process (children.item(childIndex), datas, webappPath, suffix, errorOutput)); result.append (process (children.item(childIndex), datas, suffix, errorOutput));
} }
break; break;
} }
@ -489,11 +461,11 @@ public class Presenter
/** /**
* *
*/ */
static protected StringBuffer process (Node node, IdsDataById datas, String webappPath, StringBuffer errorOutput) static protected StringBuffer process (Node node, IdsDataById datas, StringBuffer errorOutput)
{ {
StringBuffer result; StringBuffer result;
result = Presenter.process (node, datas, webappPath, "", errorOutput); result = Presenter.process (node, datas, "", errorOutput);
// //
return (result); return (result);
@ -504,7 +476,7 @@ public class Presenter
* Recursive method that processes a node and any child nodes. * Recursive method that processes a node and any child nodes.
* *
*/ */
static protected StringBuffer process (Node node, IdsDataById datas, String webappPath, String suffix, StringBuffer errorOutput) static protected StringBuffer process (Node node, IdsDataById datas, String suffix, StringBuffer errorOutput)
{ {
logger.debug ("Enter"); logger.debug ("Enter");
String TRANSITIONAL_DTD = "xhtml1-transitional.dtd"; String TRANSITIONAL_DTD = "xhtml1-transitional.dtd";
@ -548,7 +520,7 @@ public class Presenter
// Log.write(Log.TRACE,"systemId = " + systemId); // Log.write(Log.TRACE,"systemId = " + systemId);
} }
result.append (Presenter.process (((Document) node).getDocumentElement(), datas, webappPath, suffix, errorOutput)); result.append (Presenter.process (((Document) node).getDocumentElement(), datas, suffix, errorOutput));
break; break;
} }
@ -566,13 +538,12 @@ public class Presenter
attrs, attrs,
idAttr, idAttr,
datas, datas,
webappPath,
suffix, suffix,
errorOutput)); errorOutput));
} }
else else
{ {
result.append (Presenter.processElementBasically (node, datas, webappPath, suffix, errorOutput)); result.append (Presenter.processElementBasically (node, datas, suffix, errorOutput));
} }
break; break;

View file

@ -23,7 +23,6 @@ public class StringPresenter extends DomPresenter
public StringPresenter () public StringPresenter ()
{ {
super (); super ();
this.webappPath = Presenter.staticRootPath;
this.doc = null; this.doc = null;
this.html = null; this.html = null;
} }
@ -34,25 +33,6 @@ public class StringPresenter extends DomPresenter
*/ */
public StringPresenter (String html) public StringPresenter (String html)
{ {
this.webappPath = Presenter.staticRootPath;
this.doc = null;
this.html = html;
}
/*
*
*/
public StringPresenter (String webappPath, String html)
{
if ((webappPath == null) || (webappPath.equals ("")))
{
this.webappPath = Presenter.staticRootPath;
}
else
{
this.webappPath = webappPath;
}
this.doc = null; this.doc = null;
this.html = html; this.html = html;
} }
@ -119,7 +99,7 @@ public class StringPresenter extends DomPresenter
} }
StringBuffer htmlTarget; StringBuffer htmlTarget;
htmlTarget = Presenter.doXid (doc, datas, this.webappPath, errorOutput); htmlTarget = Presenter.doXid (doc, datas, errorOutput);
if (htmlTarget == null) if (htmlTarget == null)
{ {
@ -156,27 +136,18 @@ public class StringPresenter extends DomPresenter
*/ */
static public StringBuffer doXid (String html, Data datas, StringBuffer errorOutput) static public StringBuffer doXid (String html, Data datas, StringBuffer errorOutput)
{ {
return (doXid (html, datas.getIdsDataById (), "", errorOutput)); return (doXid (html, datas.getIdsDataById (), errorOutput));
}
/*
*
*/
static public StringBuffer doXid (String html, Data datas, String webappPath, StringBuffer errorOutput)
{
return (doXid (html, datas.getIdsDataById (), webappPath, errorOutput));
} }
/* /*
* Xid a string with html in. * Xid a string with html in.
*/ */
static public StringBuffer doXid (String html, IdsDataById datas, String webappPath, StringBuffer errorOutput) static public StringBuffer doXid (String html, IdsDataById datas, StringBuffer errorOutput)
{ {
StringBuffer result; StringBuffer result;
StringPresenter presenter = new StringPresenter (webappPath, html); StringPresenter presenter = new StringPresenter (html);
result = presenter.doXid (datas, errorOutput); result = presenter.doXid (datas, errorOutput);