Consistent treatment of paths as URIs for transformations

* Since base paths passed to the XSLT transforms are already URIs, no need to add file:/// at the beginning
This commit is contained in:
Sam Harwell
2013-08-23 08:58:08 -05:00
parent a042ff1e06
commit bdcdc10d50
14 changed files with 97 additions and 111 deletions

View File

@@ -17,7 +17,7 @@ public abstract class ApiRefMojo extends AbstractHtmlMojo {
/**
* @parameter expression="${project.build.directory}"
*/
private String projectBuildDirectory;
private File projectBuildDirectory;
/**
* @parameter

View File

@@ -4398,7 +4398,7 @@ public abstract class EpubMojo
/**
* @parameter expression="${project.build.directory}"
*/
private String projectBuildDirectory;
private File projectBuildDirectory;
/**
* Controls how the path to the wadl is calculated. If 0 or not set, then
@@ -4414,7 +4414,7 @@ public abstract class EpubMojo
super.adjustTransformer(transformer, sourceFilename, targetFile);
transformer.setParameter("branding", branding);
transformer.setParameter("project.build.directory", projectBuildDirectory);
transformer.setParameter("project.build.directory", projectBuildDirectory.toURI().toString());
if(security != null){
transformer.setParameter("security",security);
@@ -4432,12 +4432,12 @@ public abstract class EpubMojo
File imageDirectory = getImageDirectory();
File calloutDirectory = new File (imageDirectory, "callouts");
transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath());
transformer.setParameter("source.directory",sourceDirectory);
transformer.setParameter("docbook.infile",sourceDocBook.toURI().toString());
transformer.setParameter("source.directory",sourceDirectory.toURI().toString());
transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath);
transformer.setParameter ("admon.graphics.path", imageDirectory.getAbsolutePath()+File.separator);
transformer.setParameter ("callout.graphics.path", calloutDirectory.getAbsolutePath()+File.separator);
transformer.setParameter ("admon.graphics.path", imageDirectory.toURI().toString());
transformer.setParameter ("callout.graphics.path", calloutDirectory.toURI().toString());
//
// Setup the background image file
@@ -4449,8 +4449,8 @@ public abstract class EpubMojo
coverImageTemplate = new File (cloudSub, branding + "-cover.st");
transformer.setParameter ("cloud.api.background.image", coverImage.getAbsolutePath());
transformer.setParameter ("cloud.api.cc.image.dir", ccSub.getAbsolutePath());
transformer.setParameter ("cloud.api.background.image", coverImage.toURI().toString());
transformer.setParameter ("cloud.api.cc.image.dir", ccSub.toURI().toString());
}
protected void transformCover() throws MojoExecutionException {
try {

View File

@@ -65,7 +65,7 @@ public abstract class PDFMojo extends AbstractFoMojo {
/**
* @parameter expression="${project.build.directory}"
*/
private String projectBuildDirectory;
private File projectBuildDirectory;
/**
* The greeting to display.
@@ -365,11 +365,11 @@ public abstract class PDFMojo extends AbstractFoMojo {
protected Configuration loadFOPConfig() throws MojoExecutionException {
System.out.println ("At load config");
String fontPath = (new File(getTargetDirectory().getParentFile(), "fonts")).getAbsolutePath();
StringTemplateGroup templateGroup = new StringTemplateGroup("fonts", fontPath);
File fontPath = new File(getTargetDirectory().getParentFile(), "fonts");
StringTemplateGroup templateGroup = new StringTemplateGroup("fonts", fontPath.getAbsolutePath());
StringTemplate template = templateGroup.getInstanceOf("fontconfig");
DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
template.setAttribute ("fontPath",fontPath);
template.setAttribute ("fontPath",fontPath.toURI().toString());
final String config = template.toString();
if (getLog().isDebugEnabled()) {
getLog().debug(config);
@@ -431,7 +431,7 @@ public abstract class PDFMojo extends AbstractFoMojo {
}
transformer.setParameter("statusBarText", statusBarText);
transformer.setParameter("project.build.directory", projectBuildDirectory);
transformer.setParameter("project.build.directory", projectBuildDirectory.toURI().toString());
String sysSecurity=System.getProperty("security");
getLog().info("adjustTransformer():sysSecurity="+sysSecurity);
@@ -454,12 +454,12 @@ public abstract class PDFMojo extends AbstractFoMojo {
File imageDirectory = getImageDirectory();
File calloutDirectory = new File (imageDirectory, "callouts");
transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath().replace(File.separatorChar, '/'));
transformer.setParameter("source.directory",sourceDirectory);
transformer.setParameter("docbook.infile",sourceDocBook.toURI().toString());
transformer.setParameter("source.directory",sourceDirectory.toURI().toString());
transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath);
transformer.setParameter ("admon.graphics.path", imageDirectory.getAbsolutePath()+File.separator);
transformer.setParameter ("callout.graphics.path", calloutDirectory.getAbsolutePath()+File.separator);
transformer.setParameter ("admon.graphics.path", imageDirectory.toURI().toString());
transformer.setParameter ("callout.graphics.path", calloutDirectory.toURI().toString());
//
// Setup the background image file
@@ -471,8 +471,8 @@ public abstract class PDFMojo extends AbstractFoMojo {
coverImageTemplate = new File (cloudSub, "rackspace-cover.st");
transformer.setParameter ("cloud.api.background.image", coverImage.getAbsolutePath());
transformer.setParameter ("cloud.api.cc.image.dir", ccSub.getAbsolutePath());
transformer.setParameter ("cloud.api.background.image", coverImage.toURI().toString());
transformer.setParameter ("cloud.api.cc.image.dir", ccSub.toURI().toString());
}
protected void transformCover() throws MojoExecutionException {
@@ -503,10 +503,10 @@ public abstract class PDFMojo extends AbstractFoMojo {
}
transformer.setParameter("branding", branding);
//transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath());
//transformer.setParameter("docbook.infile",sourceDocBook.toURI().toString());
String srcFilename = sourceDocBook.getName();
getLog().info("SOURCE FOR COVER PAGE: "+this.projectBuildDirectory+"/docbkx/"+srcFilename);
transformer.setParameter("docbook.infile", this.projectBuildDirectory.replace(File.separatorChar, '/')+"/docbkx/"+srcFilename);
transformer.setParameter("docbook.infile", new File(this.projectBuildDirectory, "docbkx/"+srcFilename).toURI().toString());
transformer.transform (new StreamSource(coverImageTemplate), new StreamResult(coverImage));
}
catch (TransformerConfigurationException e)
@@ -527,7 +527,7 @@ public abstract class PDFMojo extends AbstractFoMojo {
String pathToPipelineFile = "classpath:/pdf.xpl"; //use "classpath:/path" for this to work
String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replace(File.separatorChar, '/');
String sourceFileNameNormalized = sourceFile.toURI().toString();
//from super
final InputSource inputSource = new InputSource(sourceFileNameNormalized);
Source source = new SAXSource(filter, inputSource);
@@ -540,15 +540,7 @@ public abstract class PDFMojo extends AbstractFoMojo {
security=sysSecurity;
}
String targetDirString = "";
try{
targetDirString = this.getTargetDirectory().getParentFile().getCanonicalPath().replace(File.separatorChar, '/');
}catch(Exception e){
getLog().info("Exceptional!" + e);
}
map.put("targetDirectory", targetDirString);
map.put("targetDirectory", getTargetDirectory().getParentFile());
map.put("security", security);
map.put("canonicalUrlBase", canonicalUrlBase);
map.put("replacementsFile", replacementsFile);

View File

@@ -72,7 +72,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
/**
* @parameter expression="${project.build.directory}"
*/
private String projectBuildDirectory;
private File projectBuildDirectory;
/**
* Controls whether to build webhelp war output or not.
@@ -458,7 +458,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
if (useVersionForDisqus != null) {
transformer.setParameter("use.version.for.disqus", useVersionForDisqus);
}
transformer.setParameter("project.build.directory", projectBuildDirectory);
transformer.setParameter("project.build.directory", projectBuildDirectory.toURI().toString());
transformer.setParameter("branding", branding);
//if the pdf is generated automatically with webhelp then this will be set.
@@ -567,8 +567,8 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
sourceDocBook = new File(sourceFilename);
sourceDirectory = sourceDocBook.getParentFile();
transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath());
transformer.setParameter("source.directory",sourceDirectory);
transformer.setParameter("docbook.infile",sourceDocBook.toURI().toString());
transformer.setParameter("source.directory",sourceDirectory.toURI().toString());
transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath);
}
@@ -607,7 +607,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
InputStream is = null;
try {
File f = new File(result.getParentFile() + "/webapp/WEB-INF/bookinfo.properties");
File f = new File(result.getParentFile(), "webapp/WEB-INF/bookinfo.properties");
is = new FileInputStream( f );
properties.load(is);
}
@@ -619,8 +619,8 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
String warSuffixForWar = warSuffix.equals("-external") ? "" : warSuffix;
if(null != webhelpWar && webhelpWar != "0"){
//Zip up the war from here.
String sourceDir = result.getParentFile().getParentFile() + "/" + webhelpOutdir ;
String zipFile = result.getParentFile().getParentFile() + "/" + properties.getProperty("warprefix","") + warBasename + warSuffixForWar + ".war";
File sourceDir = new File(result.getParentFile().getParentFile(), webhelpOutdir);
File zipFile = new File(result.getParentFile().getParentFile(), properties.getProperty("warprefix","") + warBasename + warSuffixForWar + ".war");
//result.deleteOnExit();
try{
@@ -630,10 +630,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
//create object of ZipOutputStream from FileOutputStream
ZipOutputStream zout = new ZipOutputStream(fout);
//create File object from source directory
File fileSource = new File(sourceDir);
com.rackspace.cloud.api.docs.FileUtils.addDirectory(zout, fileSource);
com.rackspace.cloud.api.docs.FileUtils.addDirectory(zout, sourceDir);
//close the ZipOutputStream
zout.close();
@@ -648,8 +645,8 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
// if(null == webhelpWar || webhelpWar.equals("0")){
//TODO: Move dir to add warsuffix/security value
//String sourceDir = result.getParentFile().getParentFile() + "/" + warBasename ;
File webhelpDirWithSecurity = new File(result.getParentFile().getParentFile() + "/" + warBasename + warSuffix);
File webhelpOrigDir = new File(result.getParentFile().getParentFile() + "/" + webhelpOutdir );
File webhelpDirWithSecurity = new File(result.getParentFile().getParentFile(), warBasename + warSuffix);
File webhelpOrigDir = new File(result.getParentFile().getParentFile(), webhelpOutdir );
boolean success = webhelpOrigDir.renameTo(webhelpDirWithSecurity);
//}
}
@@ -748,7 +745,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
String pathToPipelineFile = "classpath:/webhelp.xpl"; //use "classpath:/path" for this to work
String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replace(File.separatorChar, '/');
String sourceFileNameNormalized = sourceFile.toURI().toString();
//from super
final InputSource inputSource = new InputSource(sourceFileNameNormalized);
Source source = new SAXSource(filter, inputSource);
@@ -769,7 +766,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
}catch(Exception e){
getLog().info("Exceptional!" + e);
}
map.put("targetDirectory", this.getTargetDirectory().getParentFile().getAbsolutePath());
map.put("targetDirectory", getTargetDirectory().getParentFile());
map.put("webhelp.war", webhelpWar);
map.put("publicationNotificationEmails", publicationNotificationEmails);
map.put("includeDateInPdfFilename", includeDateInPdfFilename);
@@ -813,8 +810,8 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
String targetFile= getTargetDirectory() + "/" + theDirName+theFileName.substring(0,index)+"/content/"+"ext_query.xml";
map.put("targetExtQueryFile", targetFile);
map.put("targetHtmlContentDir", getTargetDirectory() + "/" + theDirName+theFileName.substring(0,index) + "/content/");
map.put("base.dir", getTargetDirectory() + "/" + theDirName+theFileName.substring(0,index));
map.put("targetHtmlContentDir", new File(getTargetDirectory(), theDirName+theFileName.substring(0,index) + "/content/"));
map.put("base.dir", new File(getTargetDirectory(), theDirName+theFileName.substring(0,index)));
map.put("input.filename",theDirName+theFileName.substring(0,index));
}
else{
@@ -827,11 +824,11 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
String theFileName=inputFilename;
int index = theFileName.indexOf('.');
if(-1!=index){
String targetFile= getTargetDirectory() + "/" + theFileName.substring(0,index)+"/content/"+"ext_query.xml";
File targetFile= new File(getTargetDirectory(), theFileName.substring(0,index)+"/content/ext_query.xml");
map.put("targetExtQueryFile", targetFile);
map.put("targetHtmlContentDir", getTargetDirectory() + "/" + theFileName.substring(0,index) + "/content/");
map.put("targetHtmlContentDir", new File(getTargetDirectory(), theFileName.substring(0,index) + "/content/"));
String targetDir= getTargetDirectory() + "/" + theFileName.substring(0,index) + "/";
File targetDir = new File(getTargetDirectory(), theFileName.substring(0,index) + "/");
map.put("base.dir", targetDir);
map.put("input.filename", theFileName.substring(0,index));
}
@@ -842,18 +839,16 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
if (null != webhelpDirname && webhelpDirname != "" ) {
map.put("targetExtQueryFile", getTargetDirectory() + "/" + webhelpDirname + "/content/"+"ext_query.xml");
map.put("base.dir", getTargetDirectory() + "/" + webhelpDirname);
map.put("targetHtmlContentDir", getTargetDirectory() + "/" + webhelpDirname + "/content/");
map.put("targetExtQueryFile", new File(getTargetDirectory(), webhelpDirname + "/content/ext_query.xml"));
map.put("base.dir", new File(getTargetDirectory(), webhelpDirname));
map.put("targetHtmlContentDir", new File(getTargetDirectory(), webhelpDirname + "/content/"));
}
//targetExtQueryFile can tell us where the html will be built. We pass this absolute path to the
//pipeline so that the copy-and-transform-image step can use it to calculate where to place the images.
map.put("targetDir", baseDir.getAbsolutePath()+File.separator+"figures");
// String targetDirFiguresString = baseDir.getAbsolutePath()+File.separator+"figures";
// map.put("targetDir", targetDirFiguresString.replace(File.separatorChar, '/').replace("file:/", "file:///"));
map.put("targetDir", new File(baseDir, "figures"));
// getLog().info("~~~~~~~~FOOBAR~~~~~~~~~~~~~~~~:");
// getLog().info("~~~~~~~~baseDir:" + baseDir);
@@ -873,7 +868,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
//Target directory for Webhelp points to ${basepath}/target/docbkx/webhelp. So get parent.
File baseDir = getTargetDirectory().getParentFile();
//The point FO/PDF file output to be generated at ${basepath}/target/docbkx/autopdf.
File targetDir = new File(baseDir.getAbsolutePath()+"/autopdf");
File targetDir = new File(baseDir.getAbsolutePath(), "autopdf");
//Create a new instance of PDFBuilder class and set config variables.
PDFBuilder pdfBuilder = new PDFBuilder();
@@ -913,17 +908,16 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
pdfBuilder.setTocMaxDepth(getProperty("tocMaxDepth"));
pdfBuilder.setTocSectionDepth(getProperty("tocSectionDepth"));
String srcFilename = this.projectBuildDirectory+"/docbkx/"+sourceFile.getName();
File tempHandle = new File(srcFilename);
if(tempHandle.exists()) {
File srcFilename = new File(this.projectBuildDirectory, "docbkx/"+sourceFile.getName());
if(srcFilename.exists()) {
getLog().debug("***********************"+ srcFilename);
pdfBuilder.setSourceFilePath(srcFilename);
} else {
getLog().debug("***********************"+ getSourceDirectory()+File.separator+inputFilename);
pdfBuilder.setSourceFilePath(getSourceDirectory()+File.separator+inputFilename);
pdfBuilder.setSourceFilePath(new File(getSourceDirectory(), inputFilename));
}
pdfBuilder.setProjectBuildDirectory(baseDir.getAbsolutePath());
pdfBuilder.setProjectBuildDirectory(baseDir);
//setup fonts and images
pdfBuilder.preProcess();
//process input docbook to create FO file
@@ -933,7 +927,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
File pdfFile = pdfBuilder.postProcessResult(foFile);
//move PDF to where the webhelp stuff is for this docbook.
if(pdfFile!=null) {
File targetDirForPdf = new File(map.get("targetHtmlContentDir")).getParentFile();
File targetDirForPdf = ((File)map.get("targetHtmlContentDir")).getParentFile();
if(!targetDirForPdf.exists()) {
com.rackspace.cloud.api.docs.FileUtils.mkdir(targetDirForPdf);
}

View File

@@ -24,7 +24,7 @@ public abstract class XhtmlMojo extends AbstractHtmlMojo {
/**
* @parameter expression="${project.build.directory}"
*/
private String projectBuildDirectory;
private File projectBuildDirectory;
/**
*
@@ -157,7 +157,7 @@ public abstract class XhtmlMojo extends AbstractHtmlMojo {
* expression="${generate-xhtml.includes}"
* default-value=""
*/
private String transformDir;
private File transformDir;
/**
* A parameter used to configure how many elements to trim from the URI in the documentation for a wadl method.
@@ -352,7 +352,7 @@ public abstract class XhtmlMojo extends AbstractHtmlMojo {
// sourceDocBook = new File(sourceFilename);
// sourceDirectory = sourceDocBook.getParentFile();
// map.put("docbook.infile",sourceDocBook.getAbsolutePath());
// map.put("docbook.infile",sourceDocBook);
// map.put("source.directory",sourceDirectory);
// Profiling attrs:
@@ -376,7 +376,7 @@ public abstract class XhtmlMojo extends AbstractHtmlMojo {
int index = theFileName.indexOf('.');
if(-1!=index){
String targetDir="target/docbkx/xhtml/"+theDirName+theFileName.substring(0,index) + "/";
File targetDir=new File("target/docbkx/xhtml/"+theDirName+theFileName.substring(0,index) + "/");
map.put("base.dir", targetDir);
}
@@ -390,7 +390,7 @@ public abstract class XhtmlMojo extends AbstractHtmlMojo {
String theFileName=inputFilename;
int index = theFileName.indexOf('.');
if(-1!=index){
String targetDir="target/docbkx/xhtml/"+theFileName.substring(0,index) + "/";
File targetDir=new File("target/docbkx/xhtml/"+theFileName.substring(0,index) + "/");
map.put("base.dir", targetDir);
map.put("input.filename", theFileName.substring(0,index));

View File

@@ -96,8 +96,8 @@ public class PDFBuilder {
private File webhelpTargetDirectory = null;
private File sourceDirectory = null;
private File imageDirectory = null;
private String sourceFilePath;
private String projectBuildDirectory;
private File sourceFilePath;
private File projectBuildDirectory;
//transformer settings
//TODO: need to somehow pass coverLogoPath, secondaryCoverLogoPath, coverLogoLeft, coverLogoTop, coverUrl from the WebHelp flow
private String coverColor;
@@ -209,7 +209,7 @@ public class PDFBuilder {
final String targetFilename = baseTargetFile + ".fo";
final File sourceFile = new File(sourceDirectory+"/"+inputFilename);
final File sourceFile = new File(sourceDirectory, inputFilename);
File targetFile = new File(autopdfTargetDirectory, targetFilename);
final XMLReader reader = factory.newSAXParser().getXMLReader();
@@ -252,10 +252,10 @@ public class PDFBuilder {
String warBasename = result.getName().substring(0, result.getName().lastIndexOf('.'));
Properties properties = new Properties();
InputStream is = null;
InputStream is;
try {
File f = new File(projectBuildDirectory + "/autopdf/pdf.properties");
File f = new File(projectBuildDirectory, "autopdf/pdf.properties");
is = new FileInputStream( f );
properties.load(is);
}
@@ -396,7 +396,7 @@ public class PDFBuilder {
transformer.setParameter("formal.procedures", formalProcedures);
}
transformer.setParameter("project.build.directory", projectBuildDirectory);
transformer.setParameter("project.build.directory", projectBuildDirectory.toURI().toString());
String sysSecurity=System.getProperty("security");
if(null!=sysSecurity && !sysSecurity.isEmpty()){
@@ -431,14 +431,14 @@ public class PDFBuilder {
File imageDirectory = getImageDirectory();
File calloutDirectory = new File (imageDirectory, "callouts");
transformer.setParameter("docbook.infile",sourceDocBook.getAbsolutePath());
transformer.setParameter("source.directory",sourceDirectory);
transformer.setParameter("docbook.infile",sourceDocBook.toURI().toString());
transformer.setParameter("source.directory",sourceDirectory.toURI().toString());
transformer.setParameter("compute.wadl.path.from.docbook.path",computeWadlPathFromDocbookPath);
transformer.setParameter("pdfFilenameBase",pdfFilenameBase)
;
transformer.setParameter ("admon.graphics.path", imageDirectory.getAbsolutePath()+File.separator);
transformer.setParameter ("callout.graphics.path", calloutDirectory.getAbsolutePath()+File.separator);
transformer.setParameter ("admon.graphics.path", imageDirectory.toURI().toString());
transformer.setParameter ("callout.graphics.path", calloutDirectory.toURI().toString());
//
// Setup the background image file
@@ -450,8 +450,8 @@ public class PDFBuilder {
coverImageTemplate = new File (cloudSub, "rackspace-cover.st");
transformer.setParameter ("cloud.api.background.image", coverImage.getAbsolutePath());
transformer.setParameter ("cloud.api.cc.image.dir", ccSub.getAbsolutePath());
transformer.setParameter ("cloud.api.background.image", coverImage.toURI().toString());
transformer.setParameter ("cloud.api.cc.image.dir", ccSub.toURI().toString());
}
@@ -473,15 +473,15 @@ public class PDFBuilder {
coverImageTemplate = new File (cloudSub, COVER_IMAGE_TEMPLATE_NAME);
coverImageTemplate = new File (cloudSub, "rackspace-cover.st");
transformer.setParameter ("cloud.api.background.image", coverImage.getAbsolutePath());
transformer.setParameter ("cloud.api.cc.image.dir", ccSub.getAbsolutePath());
transformer.setParameter ("cloud.api.background.image", coverImage.toURI().toString());
transformer.setParameter ("cloud.api.cc.image.dir", ccSub.toURI().toString());
// getLog().info("SOURCE FOR COVER PAGE: "+sourceFilePath);
// transformer.setParameter("docbook.infile", sourceFilePath);
// transformer.setParameter("docbook.infile", sourceFilePath.toURI().toString());
getLog().info("SOURCE FOR COVER PAGE: "+this.projectBuildDirectory.replace(File.separatorChar, '/')+"/"+inputFilename);
transformer.setParameter("docbook.infile", this.projectBuildDirectory.replace(File.separatorChar, '/')+"/"+inputFilename);
getLog().info("SOURCE FOR COVER PAGE: " + new File(projectBuildDirectory, inputFilename).getAbsolutePath());
transformer.setParameter("docbook.infile", new File(projectBuildDirectory, inputFilename).toURI().toString());
transformer.transform (new StreamSource(coverImageTemplate), new StreamResult(coverImage));
}
@@ -559,17 +559,17 @@ public class PDFBuilder {
this.imageDirectory = imageDirectory;
}
public String getSourceFilePath() {
public File getSourceFilePath() {
return sourceFilePath;
}
public void setSourceFilePath(String sourceDocBook) {
public void setSourceFilePath(File sourceDocBook) {
this.sourceFilePath = sourceDocBook;
}
public String getProjectBuildDirectory() {
public File getProjectBuildDirectory() {
return projectBuildDirectory;
}
public void setProjectBuildDirectory(String projectBuildDirectory) {
public void setProjectBuildDirectory(File projectBuildDirectory) {
this.projectBuildDirectory = projectBuildDirectory;
}
@@ -1067,7 +1067,7 @@ public class PDFBuilder {
throws MojoExecutionException {
String pathToPipelineFile = "classpath:/pdf.xpl"; //use "classpath:/path" for this to work
String sourceFileNameNormalized = "file:///" + sourceFile.getAbsolutePath().replace(File.separatorChar, '/');
String sourceFileNameNormalized = sourceFile.toURI().toString();
//from super
final InputSource inputSource = new InputSource(sourceFileNameNormalized);
Source source = new SAXSource(filter, inputSource);
@@ -1114,7 +1114,7 @@ public class PDFBuilder {
System.out.println("Transforming...");
PDFBuilder pdfBuilder = new PDFBuilder();
File targetDir = new File(baseDir.getAbsolutePath()+"/target/docbkx/pdf1");
File targetDir = new File(baseDir, "target/docbkx/pdf1");
pdfBuilder.setSourceDirectory(sourceDir);
pdfBuilder.setAutopdfTargetDirectory(targetDir);
pdfBuilder.setImageDirectory(targetDir.getParentFile());
@@ -1122,8 +1122,8 @@ public class PDFBuilder {
pdfBuilder.setInputFilename("os-compute-devguide.xml");
pdfBuilder.setSourceFilePath(sourceDir+"/os-compute-devguide.xml");
pdfBuilder.setProjectBuildDirectory(sourceDir.getParent());
pdfBuilder.setSourceFilePath(new File(sourceDir, "os-compute-devguide.xml"));
pdfBuilder.setProjectBuildDirectory(sourceDir.getParentFile());
pdfBuilder.preProcess();
//File fofile = pdfBuilder.processSources();

View File

@@ -185,7 +185,7 @@ public class CopyTransformImage implements ProcessMatchingNodes {
getLog().error("Unable to copy file: " + srcFile.getAbsolutePath() + " to " + targetDir.getAbsolutePath());
throw new XProcException(e);
}
return new File(targetDir.getAbsolutePath() + File.separator + srcFile.getName());
return new File(targetDir.getAbsolutePath(), srcFile.getName());
}
private void reportImageNotFoundError(URI baseUri, String fileRef, File srcImgFile) {

View File

@@ -14,7 +14,7 @@
<xsl:param name="coverColor"/>
<xsl:param name="draft.status" select="''"/>
<xsl:variable name="docbook" select="document(concat('file:///',$docbook.infile))"/>
<xsl:variable name="docbook" select="document($docbook.infile)"/>
<xsl:variable name="status.bar.text">
<xsl:call-template name="pi-attribute">

View File

@@ -420,7 +420,7 @@
<xsl:param name="current.docid" select="/*/@xml:id"/>
<xsl:param name="target.database.document" select="concat('file:///',$project.build.directory, '/../olink.db')"/>
<xsl:param name="target.database.document" select="concat($project.build.directory, '/../olink.db')"/>
<xsl:param name="olink.doctitle">yes</xsl:param>
<xsl:param name="activate.external.olinks" select="0"/>

View File

@@ -40,7 +40,7 @@
<xsl:for-each
select="distinct-values($wadls/wadl/@href)">
<xsl:variable name="checksum" select="rax:checksum(.)"/>
<xsl:variable name="newhref" select="concat('file:///',translate($project.build.directory,'\','/'),'/generated-resources/xml/xslt/',$checksum,'-',replace(., '^(.*/)?([^/]+)$', '$2'))"/>
<xsl:variable name="newhref" select="concat($project.build.directory,'/generated-resources/xml/xslt/',$checksum,'-',replace(., '^(.*/)?([^/]+)$', '$2'))"/>
<!-- Only add this wadl to the list if the new wadl does not already exist -->
<xsl:choose>
<xsl:when test="unparsed-text-available(.)">

View File

@@ -54,7 +54,7 @@
<xsl:apply-templates/>
<xsl:result-document
href="file:///{$base.dir}/bookinfo.xml"
href="{$base.dir}/bookinfo.xml"
method="xml" indent="yes" encoding="UTF-8">
<products xmlns="">
<latestpdf><xsl:value-of select="$pdfFilenameBaseCalculated"/>-latest.pdf</latestpdf><!-- <xsl:choose> -->
@@ -127,7 +127,7 @@
</products>
</xsl:result-document>
<xsl:result-document
href="file:///{$base.dir}/webapp/WEB-INF/bookinfo.properties"
href="{$base.dir}/webapp/WEB-INF/bookinfo.properties"
method="xml" indent="no" encoding="UTF-8">
<c:result xmlns:c="http://www.w3.org/ns/xproc-step">
warprefix=<xsl:value-of select="$warprefix"/>

View File

@@ -45,7 +45,7 @@
<xsl:param name="project.build.directory"/>
<xsl:param name="current.docid" select="/*/@xml:id"/>
<xsl:param name="target.database.document" select="concat('file:///',$project.build.directory, '/olink.db')"/>
<xsl:param name="target.database.document" select="concat($project.build.directory, '/olink.db')"/>
<xsl:param name="olink.doctitle">yes</xsl:param>
<xsl:param name="activate.external.olinks" select="0"/>

View File

@@ -85,7 +85,7 @@ pdfsuffix=<xsl:if test="not($security = 'external') and not($security = '') and
</p:xslt>
<p:store name="store" encoding="utf-8" method="text" media-type="text">
<p:with-option name="href" select="concat('file:///',
<p:with-option name="href" select="concat(
(if ($targetDirectory != '') then $targetDirectory else $project.build.directory),
(if ($targetDirectory = '') then '/docbkx' else ''),
'/autopdf/pdf.properties')"/>

View File

@@ -64,7 +64,7 @@
<p:variable name="project.build.directory" select="//c:param[@name = 'project.build.directory']/@value">
<p:pipe step="params" port="parameters"/>
</p:variable>
<p:variable name="invalidFile" select="concat('file:///',$project.build.directory,'/',//c:param[@name = 'inputSrcFile']/@value,'-invalid-idrefs-', current-dateTime(),'.xml')">
<p:variable name="invalidFile" select="concat($project.build.directory,'/',//c:param[@name = 'inputSrcFile']/@value,'-invalid-idrefs-', current-dateTime(),'.xml')">
<p:pipe step="params" port="parameters"/>
</p:variable>
<p:store>
@@ -215,7 +215,7 @@ setting failOnValidationError to no in your pom.
<p:variable name="project.build.directory" select="//c:param[@name = 'project.build.directory']/@value">
<p:pipe step="params" port="parameters"/>
</p:variable>
<p:variable name="invalidFile" select="concat('file:///',$project.build.directory,'/',//c:param[@name = 'inputSrcFile']/@value,'-invalid-', current-dateTime(),'.xml')">
<p:variable name="invalidFile" select="concat($project.build.directory,'/',//c:param[@name = 'inputSrcFile']/@value,'-invalid-', current-dateTime(),'.xml')">
<p:pipe step="params" port="parameters"/>
</p:variable>
<p:store>
@@ -657,7 +657,7 @@ setting failOnValidationError to no in your pom.
</p:iteration-source>
<p:store encoding="utf-8" indent="true" omit-xml-declaration="false">
<p:with-option name="href"
select="concat('file:///',$project.build.directory,'/generated-resources/xml/xslt/',$checksum,'-',replace(base-uri(/*), '^(.*/)?([^/]+)$', '$2'))"
select="concat($project.build.directory,'/generated-resources/xml/xslt/',$checksum,'-',replace(base-uri(/*), '^(.*/)?([^/]+)$', '$2'))"
/>
</p:store>
</p:for-each>
@@ -703,7 +703,7 @@ setting failOnValidationError to no in your pom.
</cx:replace-text>
<p:store encoding="utf-8" indent="true" omit-xml-declaration="false">
<p:with-option name="href"
select="concat('file:///',$targetDirectory,'/',$inputSrcFile)"
select="concat($targetDirectory,'/',$inputSrcFile)"
/>
</p:store>
</p:group>
@@ -872,7 +872,7 @@ setting failOnValidationError to no in your pom.
<p:load name="preprocess.xsl">
<p:with-option name="href"
select="concat('file:///',
select="concat(
(if ($targetDirectory != '') then $targetDirectory else $project.build.directory),
(if ($targetDirectory = '') then '/docbkx' else ''),
'/cloud/war/preprocess.xsl')" >
@@ -994,7 +994,7 @@ setting failOnValidationError to no in your pom.
<p:load name="bookinfo.xsl">
<p:with-option name="href"
select="concat('file:///',
select="concat(
(if ($targetDirectory != '') then $targetDirectory else $project.build.directory),
(if ($targetDirectory = '') then '/docbkx' else ''),
'/cloud/webhelp/bookinfo.xsl')" >
@@ -1244,8 +1244,8 @@ setting failOnValidationError to no in your pom.
<p:pipe step="copy-and-transform-images-step" port="source"/>
</p:input>
<p:with-option name="target" select="concat('file:///',$target.html.content.dir, '/figures')"/>
<p:with-option name="targetHtmlContentDir" select="concat('file:///',$target.html.content.dir)"/>
<p:with-option name="target" select="concat($target.html.content.dir, '/figures')"/>
<p:with-option name="targetHtmlContentDir" select="$target.html.content.dir"/>
<p:with-option name="inputFileName" select="concat($input.docbook.file,'')"/>
<p:with-option name="outputType" select="concat($output.type,'')"/>
<p:with-option name="fail-on-error" select="concat($strict.image.validation,'')"/>