// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/domain/NoodleBar.java
// public interface NoodleBar {
// 
//     /**
//      * Places a noodle order.
//      * 
//      * @param order
//      *            the new noodle order being placed.
//      */
//     public void placeOrder(NoodleOrder order);
// 
// }
// 
// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/domain/NoodleOrder.java
// public class NoodleOrder {
//     private OrderStatus status = NEW;
// 
//     public synchronized void setStatus(OrderStatus status) {
//         this.status = status;
//     }
// 
//     public OrderStatus getStatus() {
//         return this.status;
//     }
// }
// 
// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/domain/OrderStatus.java
// public enum OrderStatus {
//     NEW, RECEIVED, REJECTED, BEING_COOKED, COMPLETE
// }
// 
// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/domain/throughput/NoodleOrderThroughputMonitor.java
// public class NoodleOrderThroughputMonitor implements ThroughputMonitor {
//     private long averageThroughput = 0l;
// 
//     public synchronized void receiveCurrentThroughput(long ordersProcessedPerDuration) {
//         this.averageThroughput = ordersProcessedPerDuration;
//     }
// 
//     public synchronized long getAverageThroughput() {
//         return averageThroughput;
//     }
// }


import org.opencredo.esper.samples.noodlebar.domain.NoodleBar;
import org.opencredo.esper.samples.noodlebar.domain.NoodleOrder;
import org.opencredo.esper.samples.noodlebar.domain.OrderStatus;
import org.opencredo.esper.samples.noodlebar.domain.throughput.NoodleOrderThroughputMonitor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/*
 * OpenCredo-Esper - simplifies adopting Esper in Java applications. 
 * Copyright (C) 2010  OpenCredo Ltd.
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package org.opencredo.esper.samples.noodlebar.main;


/**
 * Synchronously submits {@link NoodleOrder} orders to a {@link NoodleBar}.
 * 
 * @author Russ Miles (russ.miles@opencredo.com)
 * 
 */
public class SyncNoodleOrderGenerator {

    private static final int NUMBER_OF_ORDERS = 1000;

    private static final String NOODLE_BAR_BEAN_NAME = "noodleBar";

    private static final String NOODLE_ORDER_THROUGHPUT_MONITOR_BEAN_NAME = "noodleOrderThroughputMonitor";

    private static NoodleBar noodleBar;

    private static NoodleOrderThroughputMonitor noodleOrderThroughputMonitor;

    public static void main(String[] args) {

// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/domain/NoodleBar.java
// public interface NoodleBar {
// 
//     /**
//      * Places a noodle order.
//      * 
//      * @param order
//      *            the new noodle order being placed.
//      */
//     public void placeOrder(NoodleOrder order);
// 
// }
// 
// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/domain/NoodleOrder.java
// public class NoodleOrder {
//     private OrderStatus status = NEW;
// 
//     public synchronized void setStatus(OrderStatus status) {
//         this.status = status;
//     }
// 
//     public OrderStatus getStatus() {
//         return this.status;
//     }
// }
// 
// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/domain/OrderStatus.java
// public enum OrderStatus {
//     NEW, RECEIVED, REJECTED, BEING_COOKED, COMPLETE
// }
// 
// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/domain/throughput/NoodleOrderThroughputMonitor.java
// public class NoodleOrderThroughputMonitor implements ThroughputMonitor {
//     private long averageThroughput = 0l;
// 
//     public synchronized void receiveCurrentThroughput(long ordersProcessedPerDuration) {
//         this.averageThroughput = ordersProcessedPerDuration;
//     }
// 
//     public synchronized long getAverageThroughput() {
//         return averageThroughput;
//     }
// }


// Path: esper-samples/simple-esper-si-sample/src/main/java/org/opencredo/esper/samples/noodlebar/main/SyncNoodleOrderGenerator.java
import org.opencredo.esper.samples.noodlebar.domain.NoodleBar;
import org.opencredo.esper.samples.noodlebar.domain.NoodleOrder;
import org.opencredo.esper.samples.noodlebar.domain.OrderStatus;
import org.opencredo.esper.samples.noodlebar.domain.throughput.NoodleOrderThroughputMonitor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/*
 * OpenCredo-Esper - simplifies adopting Esper in Java applications. 
 * Copyright (C) 2010  OpenCredo Ltd.
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package org.opencredo.esper.samples.noodlebar.main;


/**
 * Synchronously submits {@link NoodleOrder} orders to a {@link NoodleBar}.
 * 
 * @author Russ Miles (russ.miles@opencredo.com)
 * 
 */
public class SyncNoodleOrderGenerator {

    private static final int NUMBER_OF_ORDERS = 1000;

    private static final String NOODLE_BAR_BEAN_NAME = "noodleBar";

    private static final String NOODLE_ORDER_THROUGHPUT_MONITOR_BEAN_NAME = "noodleOrderThroughputMonitor";

    private static NoodleBar noodleBar;

    private static NoodleOrderThroughputMonitor noodleOrderThroughputMonitor;

    public static void main(String[] args) {

        System.out.println("Initializing Dependencies...");