diff --git a/src/main/java/emissary/parser/ParserFactory.java b/src/main/java/emissary/parser/ParserFactory.java index 59059d7a01..6ff2745ec6 100755 --- a/src/main/java/emissary/parser/ParserFactory.java +++ b/src/main/java/emissary/parser/ParserFactory.java @@ -3,16 +3,12 @@ import emissary.config.ConfigUtil; import emissary.config.Configurator; import emissary.core.Factory; -import emissary.util.WindowedSeekableByteChannel; import emissary.util.shell.Executrix; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.RandomAccessFile; -import java.nio.channels.Channels; import java.nio.channels.SeekableByteChannel; import java.util.HashMap; import java.util.Map; @@ -110,53 +106,6 @@ public void reconfigure(@Nullable Configurator config) { } } - /** - * Make a session parser with the data - * - * @param data the bytes to parse - * @return SessionParser implementation - */ - @Deprecated - public SessionParser makeSessionParser(byte[] data) { - try { - WindowedSeekableByteChannel channel = new WindowedSeekableByteChannel(Channels.newChannel(new ByteArrayInputStream(data)), 1024 * 1024); - return makeSessionParser(channel); - } catch (IOException ex) { - logger.warn("Unable to instantiate channel"); - throw new RuntimeException("Failed to instantiate WindowedSeekableByteChannel from byte[]", ex); - } - } - - /** - * Make a session parser with the data of the specified data type - * - * @param type the data type - * @param data the bytes to parse - * @return SessionParser implementation - */ - @Deprecated - public SessionParser makeSessionParser(String type, byte[] data) { - try { - WindowedSeekableByteChannel channel = new WindowedSeekableByteChannel(Channels.newChannel(new ByteArrayInputStream(data)), 1024 * 1024); - return makeSessionParser(type, channel); - } catch (IOException ex) { - logger.warn("Unable to instantiate channel"); - throw new RuntimeException("Failed to instantiate WindowedSeekableByteChannel from byte[]", ex); - } - } - - /** - * Make a session parser with the data in the file. If no RAF parser is configured for the type of this data, a byte[] - * parser will be produced if there is one available. - * - * @param raf the data to be parsed - * @return SessionParser implementation - */ - @Deprecated - public SessionParser makeSessionParser(RandomAccessFile raf) { - return makeSessionParser(raf.getChannel()); - } - /** * Make a session parser with the data in channel. If no NIO parser is configured for the type of this data, a standard * byte[] parser will be produced if there is one available and the size of the data in the channel is less than the @@ -190,20 +139,6 @@ public SessionParser makeSessionParser(String type, SeekableByteChannel channel) return sp; } - /** - * Make a session parser with the data in the file. If no RAF parser is configured for the type of this data, a standard - * byte[] parser will be produced if there is one available. - * - * @param type the type of data - * @param raf the data to be parsed - * @return SessionParser implementation - */ - @Deprecated - public SessionParser makeSessionParser(String type, RandomAccessFile raf) { - return makeSessionParser(type, raf.getChannel()); - } - - /** * Make a session parser for the specified data type with the args * diff --git a/src/main/java/emissary/pickup/PickUpPlace.java b/src/main/java/emissary/pickup/PickUpPlace.java index db4e0d0d26..ac7c1eb1f7 100755 --- a/src/main/java/emissary/pickup/PickUpPlace.java +++ b/src/main/java/emissary/pickup/PickUpPlace.java @@ -6,6 +6,7 @@ import emissary.core.IBaseDataObject; import emissary.core.IMobileAgent; import emissary.core.NamespaceException; +import emissary.core.channels.InMemoryChannelFactory; import emissary.log.MDCConstants; import emissary.parser.ParserEOFException; import emissary.parser.ParserException; @@ -642,8 +643,7 @@ public int processSessions(byte[] data, String fixedName, File theFile) { int sessionNum = 0; // Get the right type of session parser - SessionParser sp = parserFactory.makeSessionParser(data); - logger.debug("Using session parser from byte ident {}", sp.getClass().getName()); + SessionParser sp = parserFactory.makeSessionParser(InMemoryChannelFactory.create(data).create()); // .. and a session producer to crank out the data objects... SessionProducer dof = new SessionProducer(sp, myKey, null);