use of org.apache.tika.sax.Link in project tika by apache.
the class RollbackSoftware method rollback.
public void rollback(File deployArea) throws IOException, SAXException, TikaException {
LinkContentHandler handler = new LinkContentHandler();
Metadata met = new Metadata();
DeploymentAreaParser parser = new DeploymentAreaParser();
parser.parse(IOUtils.toInputStream(deployArea.getAbsolutePath(), UTF_8), handler, met);
List<Link> links = handler.getLinks();
if (links.size() < 2)
throw new IOException("Must have installed at least 2 versions!");
Collections.sort(links, new Comparator<Link>() {
public int compare(Link o1, Link o2) {
return o1.getText().compareTo(o2.getText());
}
});
this.updateVersion(links.get(links.size() - 2).getText());
}
Aggregations