/** * Construct a new FileResource from a File. * @param f the File represented. */ public FileResource(File f) { setFile(f); }
/** * Set the stylesheet file. * @param stylesheet a <code>File</code> value * @throws Exception on error */ public void setStylesheet(final File stylesheet) throws Exception { final FileResource fr = new FileResource(); fr.setProject(project); fr.setFile(stylesheet); setStylesheet(fr); }
/** * Loads the stylesheet and set xsl:param parameters. * * @param stylesheet the file from which to load the stylesheet. * @exception BuildException if the stylesheet cannot be loaded. * @deprecated since Ant 1.7 */ @Deprecated protected void configureLiaison(final File stylesheet) throws BuildException { final FileResource fr = new FileResource(); fr.setProject(getProject()); fr.setFile(stylesheet); configureLiaison(fr); }
/** * Get the file represented by this FileResource. * @return the File. */ @Override public File getFile() { if (isReference()) { return getCheckedRef().getFile(); } dieOnCircularReference(); synchronized (this) { if (file == null) { //try to resolve file set via basedir/name property setters: File d = getBaseDir(); String n = super.getName(); if (n != null) { setFile(FILE_UTILS.resolveFile(d, n)); } } } return file; }
fr.setFile(stylesheet); styleResource = fr; } else {
/** * Access the stylesheet to be used as a resource. * * @return stylesheet as a resource */ @Override protected Resource getStylesheet() { String xslname = "junit-frames.xsl"; if (NOFRAMES.equals(format)) xslname = "junit-noframes.xsl"; if (styleDir == null) { URLResource stylesheet = new URLResource(); URL stylesheetURL = getClass().getClassLoader().getResource(concat(XSL_FILE_PATH, xslname)); stylesheet.setURL(stylesheetURL); return stylesheet; } FileResource stylesheet = new FileResource(); File stylesheetFile = new File(styleDir, xslname); stylesheet.setFile(stylesheetFile); return stylesheet; }
/** * Access the stylesheet to be used as a resource. * * @return stylesheet as a resource */ @Override protected Resource getStylesheet() { String xslname = "junit-frames.xsl"; if (NOFRAMES.equals(format)) xslname = "junit-noframes.xsl"; if (styleDir == null) { URLResource stylesheet = new URLResource(); URL stylesheetURL = getClass().getClassLoader().getResource(concat(XSL_FILE_PATH, xslname)); stylesheet.setURL(stylesheetURL); return stylesheet; } FileResource stylesheet = new FileResource(); File stylesheetFile = new File(styleDir, xslname); stylesheet.setFile(stylesheetFile); return stylesheet; }