Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated parserfactory methods #565

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions src/main/java/emissary/parser/ParserFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
*
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/emissary/pickup/PickUpPlace.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down