com.codetaco.funnel.publisher.PublisherFactory Maven / Gradle / Ivy
package com.codetaco.funnel.publisher;
import java.io.IOException;
import java.text.ParseException;
import com.codetaco.funnel.FunnelDataPublisher;
import com.codetaco.funnel.parameters.FunnelContext;
/**
*
* PublisherFactory class.
*
*
* @author Chris DeGreef [email protected]
*/
public class PublisherFactory
{
/**
*
* create.
*
*
* @param context a {@link com.codetaco.funnel.parameters.FunnelContext}
* object.
* @return a {@link com.codetaco.funnel.FunnelDataPublisher} object.
* @throws java.text.ParseException if any.
* @throws java.io.IOException if any.
*/
static public FunnelDataPublisher create(final FunnelContext context) throws ParseException, IOException
{
if (context.getFixedRecordLengthOut() == 0)
{
if (context.isSysout())
return new VariableLengthSysoutPublisher(context);
return new VariableLengthFilePublisher(context);
}
if (context.isSysout())
return new FixedLengthSysoutPublisher(context);
return new FixedLengthFilePublisher(context);
}
}