// Path: src/main/java/com/instaclick/pentaho/plugin/amqp/Messages.java
// public static String getString(String key)
// {
//     return BaseMessages.getString(PKG, key);
// }
// 
// Path: src/main/java/com/instaclick/pentaho/plugin/amqp/processor/Processor.java
// public interface Processor
// {
//     public boolean process(final Object[] r) throws KettleStepException, IOException;
//     public void start() throws KettleStepException, IOException;
//     public void shutdown() throws KettleStepException, IOException;
//     public void onSuccess() throws KettleStepException, IOException;
//     public void onFailure() throws KettleStepException, IOException;
//     public void cancel() throws KettleStepException, IOException;
// }
// 
// Path: src/main/java/com/instaclick/pentaho/plugin/amqp/processor/ProcessorFactory.java
// public class ProcessorFactory
// {
//     private final ConnectionFactory factory = new ConnectionFactory();
// 
//     protected Connection connectionFor(final AMQPPluginData data) throws IOException, URISyntaxException, NoSuchAlgorithmException, KeyManagementException
//     {
//         if ( ! Const.isEmpty(data.uri)) {
//             factory.setUri(data.uri);
// 
//             return factory.newConnection();
//         }
// 
//         factory.setHost(data.host);
//         factory.setPort(data.port);
//         factory.setUsername(data.username);
//         factory.setPassword(data.password);
// 
//         if (data.vhost != null) {
//             factory.setVirtualHost(data.vhost);
//         }
// 
//         if (data.useSsl) {
//             factory.useSslProtocol();
//         }
// 
//         return factory.newConnection();
//     }
// 
//     protected Channel channelFor(final AMQPPluginData data) throws IOException, URISyntaxException, NoSuchAlgorithmException, KeyManagementException
//     {
//         final Connection conn = connectionFor(data);
//         final Channel channel = conn.createChannel();
//         final int qos         = data.isConsumer ? data.prefetchCount : 0;
// 
//         channel.basicQos(qos);
// 
//         if ( ! conn.isOpen()) {
//             throw new AMQPException("Unable to open a AMQP connection");
//         }
// 
//         if ( ! channel.isOpen()) {
//             throw new AMQPException("Unable to open an AMQP channel");
//         }
// 
//         return channel;
//     }
// 
//     public Processor processorFor(final AMQPPlugin step,final AMQPPluginData data, final AMQPPluginMeta meta) throws IOException, URISyntaxException, NoSuchAlgorithmException, KeyManagementException
//     {
//         final Channel channel                 = channelFor(data);
//         final List<Initializer> initializers  = new ArrayList<Initializer>();
// 
//         if (data.activeConfirmation) {
//             initializers.add(ActiveConvirmationInitializer.INSTANCE);
//         }
// 
//         if (data.isConsumer && data.isDeclare) {
//             initializers.add(ConsumerDeclareInitializer.INSTANCE);
//         }
// 
//         if (data.isProducer && data.isDeclare) {
//             initializers.add(ProducerDeclareInitializer.INSTANCE);
//         }
// 
//         if (data.isConsumer && data.isWaitingConsumer) {
//             return new WaitingConsumerProcessor(channel, step, data, initializers);
//         }
// 
//         if (data.isConsumer) {
//             return new BasicConsumerProcessor(channel, step, data, initializers);
//         }
// 
//         if (data.isProducer) {
//             return new ProducerProcessor(channel, step, data, initializers);
//         }
// 
//         throw new RuntimeException("Unknown mode");
//     }
// }


import java.io.IOException;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleStepException;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.BaseStep;
import org.pentaho.di.trans.step.StepDataInterface;
import org.pentaho.di.trans.step.StepInterface;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.trans.step.StepMetaInterface;
import static com.instaclick.pentaho.plugin.amqp.Messages.getString;
import com.instaclick.pentaho.plugin.amqp.processor.Processor;
import com.instaclick.pentaho.plugin.amqp.processor.ProcessorFactory;
import static org.pentaho.di.core.encryption.KettleTwoWayPasswordEncoder.decryptPasswordOptionallyEncrypted;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.row.RowMeta;
import org.pentaho.di.trans.TransListener;
import org.pentaho.di.core.row.RowMetaInterface;

package com.instaclick.pentaho.plugin.amqp;


public class AMQPPlugin extends BaseStep implements StepInterface
{
    private AMQPPluginData data;
    private AMQPPluginMeta meta;

    final private ProcessorFactory factory = new ProcessorFactory();

// Path: src/main/java/com/instaclick/pentaho/plugin/amqp/Messages.java
// public static String getString(String key)
// {
//     return BaseMessages.getString(PKG, key);
// }
// 
// Path: src/main/java/com/instaclick/pentaho/plugin/amqp/processor/Processor.java
// public interface Processor
// {
//     public boolean process(final Object[] r) throws KettleStepException, IOException;
//     public void start() throws KettleStepException, IOException;
//     public void shutdown() throws KettleStepException, IOException;
//     public void onSuccess() throws KettleStepException, IOException;
//     public void onFailure() throws KettleStepException, IOException;
//     public void cancel() throws KettleStepException, IOException;
// }
// 
// Path: src/main/java/com/instaclick/pentaho/plugin/amqp/processor/ProcessorFactory.java
// public class ProcessorFactory
// {
//     private final ConnectionFactory factory = new ConnectionFactory();
// 
//     protected Connection connectionFor(final AMQPPluginData data) throws IOException, URISyntaxException, NoSuchAlgorithmException, KeyManagementException
//     {
//         if ( ! Const.isEmpty(data.uri)) {
//             factory.setUri(data.uri);
// 
//             return factory.newConnection();
//         }
// 
//         factory.setHost(data.host);
//         factory.setPort(data.port);
//         factory.setUsername(data.username);
//         factory.setPassword(data.password);
// 
//         if (data.vhost != null) {
//             factory.setVirtualHost(data.vhost);
//         }
// 
//         if (data.useSsl) {
//             factory.useSslProtocol();
//         }
// 
//         return factory.newConnection();
//     }
// 
//     protected Channel channelFor(final AMQPPluginData data) throws IOException, URISyntaxException, NoSuchAlgorithmException, KeyManagementException
//     {
//         final Connection conn = connectionFor(data);
//         final Channel channel = conn.createChannel();
//         final int qos         = data.isConsumer ? data.prefetchCount : 0;
// 
//         channel.basicQos(qos);
// 
//         if ( ! conn.isOpen()) {
//             throw new AMQPException("Unable to open a AMQP connection");
//         }
// 
//         if ( ! channel.isOpen()) {
//             throw new AMQPException("Unable to open an AMQP channel");
//         }
// 
//         return channel;
//     }
// 
//     public Processor processorFor(final AMQPPlugin step,final AMQPPluginData data, final AMQPPluginMeta meta) throws IOException, URISyntaxException, NoSuchAlgorithmException, KeyManagementException
//     {
//         final Channel channel                 = channelFor(data);
//         final List<Initializer> initializers  = new ArrayList<Initializer>();
// 
//         if (data.activeConfirmation) {
//             initializers.add(ActiveConvirmationInitializer.INSTANCE);
//         }
// 
//         if (data.isConsumer && data.isDeclare) {
//             initializers.add(ConsumerDeclareInitializer.INSTANCE);
//         }
// 
//         if (data.isProducer && data.isDeclare) {
//             initializers.add(ProducerDeclareInitializer.INSTANCE);
//         }
// 
//         if (data.isConsumer && data.isWaitingConsumer) {
//             return new WaitingConsumerProcessor(channel, step, data, initializers);
//         }
// 
//         if (data.isConsumer) {
//             return new BasicConsumerProcessor(channel, step, data, initializers);
//         }
// 
//         if (data.isProducer) {
//             return new ProducerProcessor(channel, step, data, initializers);
//         }
// 
//         throw new RuntimeException("Unknown mode");
//     }
// }


// Path: src/main/java/com/instaclick/pentaho/plugin/amqp/AMQPPlugin.java
import java.io.IOException;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleStepException;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.BaseStep;
import org.pentaho.di.trans.step.StepDataInterface;
import org.pentaho.di.trans.step.StepInterface;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.trans.step.StepMetaInterface;
import static com.instaclick.pentaho.plugin.amqp.Messages.getString;
import com.instaclick.pentaho.plugin.amqp.processor.Processor;
import com.instaclick.pentaho.plugin.amqp.processor.ProcessorFactory;
import static org.pentaho.di.core.encryption.KettleTwoWayPasswordEncoder.decryptPasswordOptionallyEncrypted;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.row.RowMeta;
import org.pentaho.di.trans.TransListener;
import org.pentaho.di.core.row.RowMetaInterface;

package com.instaclick.pentaho.plugin.amqp;


public class AMQPPlugin extends BaseStep implements StepInterface
{
    private AMQPPluginData data;
    private AMQPPluginMeta meta;

    final private ProcessorFactory factory = new ProcessorFactory();

    private Processor processor;
