Search in sources :

Example 1 with Pdml

use of org.apache.metron.rest.model.pcap.Pdml in project metron by apache.

the class PcapServiceImpl method getPdml.

@Override
public Pdml getPdml(String username, String jobId, Integer page) throws RestException {
    Pdml pdml = null;
    Path path = getPath(username, jobId, page);
    try {
        FileSystem fileSystem = getFileSystem();
        if (path != null && fileSystem.exists(path)) {
            String scriptPath = environment.getProperty(MetronRestConstants.PCAP_PDML_SCRIPT_PATH_SPRING_PROPERTY);
            InputStream processInputStream = pcapToPdmlScriptWrapper.execute(scriptPath, fileSystem, path);
            pdml = new XmlMapper().readValue(processInputStream, Pdml.class);
            processInputStream.close();
        }
    } catch (IOException e) {
        throw new RestException(e);
    }
    return pdml;
}
Also used : Path(org.apache.hadoop.fs.Path) Pdml(org.apache.metron.rest.model.pcap.Pdml) InputStream(java.io.InputStream) FileSystem(org.apache.hadoop.fs.FileSystem) RestException(org.apache.metron.rest.RestException) IOException(java.io.IOException) XmlMapper(com.fasterxml.jackson.dataformat.xml.XmlMapper)

Aggregations

XmlMapper (com.fasterxml.jackson.dataformat.xml.XmlMapper)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 RestException (org.apache.metron.rest.RestException)1 Pdml (org.apache.metron.rest.model.pcap.Pdml)1