Commit b6e722de authored by Volodymyr Yurchenko's avatar Volodymyr Yurchenko
Browse files

More options in XmlCollection ctors

parent 785aaf53
......@@ -59,6 +59,18 @@ public class XmlCollection extends LinkedHashSet<LFN> {
parseXML(content);
}
/**
* Parse this XML
*
* @param content
* @param getReal
* must be true if you want real LFN objects from a database
* @throws IOException
*/
public XmlCollection(final String content, final boolean getReal) throws IOException {
parseXML(content, getReal);
}
/**
* read the contents of a LFN in the catalogue
*
......@@ -72,6 +84,21 @@ public class XmlCollection extends LinkedHashSet<LFN> {
parseXML(IOUtils.getContents(lfn));
}
/**
* read the contents of a LFN in the catalogue
*
* @param lfn
* @param getReal
* must be true if you want real LFN objects from a database
* @throws IOException
*/
public XmlCollection(final LFN lfn, final boolean getReal) throws IOException {
if (lfn == null || !lfn.isFile())
throw new IOException("LFN is not readable");
parseXML(IOUtils.getContents(lfn), getReal);
}
/**
* read the contents of a GUID in the catalogue
*
......@@ -90,6 +117,11 @@ public class XmlCollection extends LinkedHashSet<LFN> {
}
private void parseXML(final String content, final boolean getReal) throws IOException {
if (content == null) {
System.err.println("Failed to read a content of XML collection: " + this.getName());
return;
}
final BufferedReader br = new BufferedReader(new StringReader(content));
String sLine;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment