/** * Returns the specified date as ISO 8601 format. * * @param date the specified date. * @param format the ISO 8601 format to use. * @return the date formatted using ISO 8601. */ public static String format(long date, ISO8601 format) { return format.format(date); }
/** * Returns the filename of this bundle. * * <p>The filename is: <code>[name]-[isodate]-[etag-suffix].[extension]</code>. * <p>Or <code>[name]-[isodate]-[etag-suffix].min.[extension]</code> if minimized. * * @return the filename of this bundle. */ public String getFileName() { StringBuilder filename = new StringBuilder(this._name); filename.append('-'); filename.append(ISO8601.CALENDAR_DATE.format(getMostRecent(this._files))); String etag = getETag(false); filename.append('-').append(etag.substring(etag.length()-4)); String ext = getExtension(this._files.get(0)); if (this._minimized) { filename.append(".min"); } if (ext != null) { filename.append(ext); } return filename.toString(); }
/** * Returns the log file as a * * @param log the log file * @param xml The XML writer * * @throws IOException If thrown while writing the XML. */ private static void toXML(File log, XMLWriter xml) throws IOException { xml.openElement("log-file"); xml.attribute("name", log.getName()); xml.attribute("size", Long.toString(log.length())); xml.attribute("datetime", ISO8601.DATETIME.format(log.lastModified())); xml.closeElement(); }
@Override public void toXML(XMLWriter xml) throws IOException { xml.openElement("statistics"); xml.attribute("since", ISO8601.format(this.since, ISO8601.DATETIME)); for (BasicStats s : this._stats.values()) { s.toXML(xml); } xml.closeElement(); }
private void toBasicIndexXML(XMLWriter xml, File index) throws IOException { xml.openElement("index"); xml.attribute("name", index.getName()); IndexMaster master = FlintConfig.get().getMaster(index.getName()); long modified = master == null ? -1 : master.getIndex().getIndexIO().getLastTimeUsed(); boolean exists = modified > 0; xml.attribute("exists", Boolean.toString(exists)); if (exists) { xml.attribute("modified", ISO8601.format((long)modified, (ISO8601)ISO8601.DATETIME)); } xml.closeElement(); } }
json.append('{'); appendJSONProperty(json, "http-code", code).append(','); appendJSONProperty(json, "datetime", ISO8601.format(System.currentTimeMillis(), ISO8601.DATETIME)).append(',');
public static final void batchToXML(IndexBatch batch, XMLWriter xml) throws IOException { xml.openElement("batch"); if (batch != null) { if (batch.getIndex() != null) xml.attribute("index", batch.getIndex()); xml.attribute("documents", batch.getTotalDocuments()); xml.attribute("creation", ISO8601.DATETIME.format(batch.getCreation().getTime())); if (batch.isStarted()) xml.attribute("start", ISO8601.DATETIME.format(batch.getStart().getTime())); xml.attribute("index-time", String.valueOf(batch.getIndexingDuration())); xml.attribute("compute-time", String.valueOf(batch.getComputingDuration())); xml.attribute("total-time", String.valueOf(batch.getTotalDuration())); xml.attribute("computed", String.valueOf(batch.isComputed())); xml.attribute("finished", String.valueOf(batch.isFinished())); } xml.closeElement(); } }
/** * Serialise the specified file as XML. * * @param f the file. * @param xml the xml where the file information goes to. * @throws IOException Should any IO occurs while retrieving the info or writing XML. */ private void toXML(File f, XMLWriter xml) throws IOException { xml.openElement("file"); xml.attribute("name", f.getName()); xml.attribute("path", FileUtils.path(this.folder, f)); if (f.exists()) { if (f.isDirectory()) { xml.attribute("type", "folder"); for (File x : f.listFiles()) { toXML(x, xml); } } else { xml.attribute("type", "file"); xml.attribute("content-type", getMediaType(f)); xml.attribute("media-type", getMediaType(f)); xml.attribute("length", Long.toString(f.length())); xml.attribute("modified", ISO8601.format(f.lastModified(), ISO8601.DATETIME)); } } else { xml.attribute("status", "not-found"); } xml.closeElement(); }
@Override public void toXML(XMLWriter xml) throws IOException { xml.openElement("indexer"); if (this.started > 0) xml.attribute("started", ISO8601.DATETIME.format(this.started)); xml.attribute("index", getName()); xml.attribute("completed", String.valueOf(this.done));
Element element = cache.getQuiet(key); if (element != null) { xml.attribute("creation-time", ISO8601.DATETIME.format(element.getCreationTime())); xml.attribute("expiration-time", ISO8601.DATETIME.format(element.getExpirationTime())); xml.attribute("last-access-time", ISO8601.DATETIME.format(element.getLastAccessTime())); xml.attribute("last-update-time", ISO8601.DATETIME.format(element.getLastUpdateTime())); xml.attribute("hit-count", Long.toString(element.getHitCount())); xml.attribute("version", Long.toString(element.getVersion()));
Element element = cache.getQuiet(key); if (element != null) { xml.attribute("creation-time", ISO8601.DATETIME.format(element.getCreationTime())); xml.attribute("expiration-time", ISO8601.DATETIME.format(element.getExpirationTime())); xml.attribute("last-access-time", ISO8601.DATETIME.format(element.getLastAccessTime())); xml.attribute("last-update-time", ISO8601.DATETIME.format(element.getLastUpdateTime())); xml.attribute("hit-count", Long.toString(element.getHitCount())); xml.attribute("version", Long.toString(element.getVersion()));
xml.openElement(getRootElementName(code)); xml.attribute("http-code", code); xml.attribute("datetime", ISO8601.format(System.currentTimeMillis(), ISO8601.DATETIME));
xml.openElement("server-error"); xml.attribute("http-code", HttpServletResponse.SC_SERVICE_UNAVAILABLE); xml.attribute("datetime", ISO8601.format(System.currentTimeMillis(), ISO8601.DATETIME));
if (lm > 0) xml.attribute("last-modified", ISO8601.DATETIME.format(lm)); xml.attribute("current", Boolean.toString(dreader.isCurrent())); xml.attribute("version", Long.toString(dreader.getVersion()));
xml.attribute("logger", this._logger.getName()); xml.attribute("timestamp", Long.toString(this._timestamp)); xml.attribute("datetime", ISO8601.DATETIME.format(this._timestamp));
dreader = DirectoryReader.open(index.getIndex().getIndexDirectory()); long lu = index.getIndex().getIndexIO().getLastTimeUsed(); if (lu > 0) xml.attribute("last-modified", ISO8601.DATETIME.format(lu)); xml.attribute("current", Boolean.toString(dreader.isCurrent())); xml.attribute("version", Long.toString(dreader.getVersion()));
xml.attribute("content", '/' + Files.path(GlobalSettings.getAppData(), index.getIndex().getContentLocation())); long lm = index.getIndex().getIndexIO().getLastTimeUsed(); if (lm > 0) xml.attribute("last-modified", ISO8601.DATETIME.format(lm)); xml.closeElement();
xml.attribute("http-class", getHTTPClass(code)); xml.attribute("http-code", code); xml.attribute("datetime", ISO8601.format(System.currentTimeMillis(), ISO8601.DATETIME));