use of com.mindbright.security.x509.Attribute in project bioformats by ome.
the class NetCDFServiceImpl method parseAttributesAndVariables.
// -- Helper methods --
/**
* Recursively parses attribute and variable paths, filling
* <code>attributeList</code> and <code>variableList</code>.
* @param groups List of groups to recursively parse.
*/
private void parseAttributesAndVariables(List<Group> groups) {
for (Group group : groups) {
String groupName = group.getName();
List<Attribute> attributes = group.getAttributes();
for (Attribute attribute : attributes) {
String attributeName = attribute.getName();
if (!groupName.endsWith("/"))
attributeName = "/" + attributeName;
attributeList.add(groupName + attributeName);
}
List<Variable> variables = group.getVariables();
for (Variable variable : variables) {
String variableName = variable.getName();
if (!groupName.endsWith("/"))
variableName = "/" + variableName;
variableList.add(variableName);
}
groups = group.getGroups();
parseAttributesAndVariables(groups);
}
}
use of com.mindbright.security.x509.Attribute in project bioformats by ome.
the class NetCDFServiceImpl method getVariableAttributes.
/* (non-Javadoc)
* @see loci.formats.NetCDFService#getVariableAttributes(java.lang.String)
*/
@Override
public Hashtable<String, Object> getVariableAttributes(String name) {
String groupName = getDirectory(name);
String variableName = getName(name);
Group group = getGroup(groupName);
Variable variable = group.findVariable(variableName);
Hashtable<String, Object> toReturn = new Hashtable<String, Object>();
if (variable != null) {
List<Attribute> attributes = variable.getAttributes();
for (Attribute attribute : attributes) {
toReturn.put(attribute.getName(), arrayToString(attribute.getValues()));
}
}
return toReturn;
}
use of com.mindbright.security.x509.Attribute in project goobi-workflow by intranda.
the class XsltPreparatorDocket method startExport.
/**
* This method exports the production metadata for a list of processes as a single file to a given stream.
*
* @param processList
* @param outputStream
* @param xslt
*/
public void startExport(List<Process> processList, OutputStream outputStream, String xslt) {
Document answer = new Document();
Element root = new Element("processes");
answer.setRootElement(root);
Namespace xmlns = Namespace.getNamespace("http://www.goobi.io/logfile");
Namespace xsi = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
root.addNamespaceDeclaration(xsi);
root.setNamespace(xmlns);
Attribute attSchema = new Attribute("schemaLocation", "http://www.goobi.io/logfile" + " XML-logfile.xsd", xsi);
root.setAttribute(attSchema);
for (Process p : processList) {
Document doc = createDocument(p, false, true);
Element processRoot = doc.getRootElement();
processRoot.detach();
root.addContent(processRoot);
}
XMLOutputter outp = new XMLOutputter();
outp.setFormat(Format.getPrettyFormat());
try {
outp.output(answer, outputStream);
} catch (IOException e) {
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
outputStream = null;
}
}
}
}
use of com.mindbright.security.x509.Attribute in project goobi-workflow by intranda.
the class XsltPreparatorMetadata method startExport.
/**
* This method exports the production metadata for a list of processes as a single file to a given stream.
*
* @param processList
* @param outputStream
* @param xslt
*/
public void startExport(List<Process> processList, OutputStream outputStream, String xslt) {
Document answer = new Document();
Element root = new Element("processes");
answer.setRootElement(root);
Namespace xmlns = Namespace.getNamespace("http://www.goobi.io/logfile");
Namespace xsi = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
root.addNamespaceDeclaration(xsi);
root.setNamespace(xmlns);
Attribute attSchema = new Attribute("schemaLocation", "http://www.goobi.io/logfile" + " XML-logfile.xsd", xsi);
root.setAttribute(attSchema);
for (Process p : processList) {
Document doc = createDocument(p, false);
Element processRoot = doc.getRootElement();
processRoot.detach();
root.addContent(processRoot);
}
XMLOutputter outp = new XMLOutputter();
outp.setFormat(Format.getPrettyFormat());
try {
outp.output(answer, outputStream);
} catch (IOException e) {
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
outputStream = null;
}
}
}
}
use of com.mindbright.security.x509.Attribute in project n2o-framework by i-novus-llc.
the class IOProcessorImpl method childAttributeInteger.
@Override
public void childAttributeInteger(Element element, String childName, String name, Supplier<Integer> getter, Consumer<Integer> setter) {
if (r) {
Element child = element.getChild(childName, element.getNamespace());
if (child == null)
return;
Attribute attribute = child.getAttribute(name);
if (attribute != null) {
setter.accept(Integer.parseInt(process(attribute.getValue())));
}
} else {
if (getter.get() == null)
return;
Element childElement = element.getChild(childName, element.getNamespace());
if (childElement == null) {
childElement = new Element(childName, element.getNamespace());
childElement.setAttribute(new Attribute(name, getter.get().toString()));
element.addContent(childElement);
} else {
childElement.setAttribute(new Attribute(name, getter.get().toString()));
}
}
}
Aggregations