From c25b305e3072791ea4d249aca141139647c38395 Mon Sep 17 00:00:00 2001 From: Gregor Riegler Date: Mon, 10 Jun 2013 17:26:22 +0200 Subject: [PATCH] Merge it! --- .gitignore | 2 ++ .../tuwien/sbc/valesriegler/common/Util.java | 30 ++++++------------- .../cook/actions/DeliveryOrderInfo.java | 4 +-- .../sbc/valesriegler/cook/jms/JMSCook.java | 15 +++++----- .../DeliveryOrdersToCook.java | 18 ++++------- .../jms/messageListeners/OrdersToCook.java | 18 ++++------- .../driver/actions/OrderDeliveredInfo.java | 4 +-- .../valesriegler/driver/jms/JMSDriver.java | 13 ++++---- .../CookedDeliveryOrders.java | 18 ++++------- .../sbc/valesriegler/group/DeliveryGroup.java | 5 ++-- .../group/gui/DeliveryOverviewModel.java | 10 +++++++ 11 files changed, 55 insertions(+), 82 deletions(-) diff --git a/.gitignore b/.gitignore index 2404147..e49a1c9 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ target/* #active-mq persistent data activemq-data/* +.idea/* +.idea/**/* diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java index 3db298a..36d52c0 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/common/Util.java @@ -1,30 +1,18 @@ package at.ac.tuwien.sbc.valesriegler.common; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; - -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ScrollPaneConstants; -import javax.swing.border.TitledBorder; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import at.ac.tuwien.sbc.valesriegler.group.gui.GroupCreationDetailsRequest; import at.ac.tuwien.sbc.valesriegler.types.Order; import at.ac.tuwien.sbc.valesriegler.types.PizzaOrder; import at.ac.tuwien.sbc.valesriegler.types.PizzaType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import java.awt.*; +import java.net.URI; +import java.util.*; +import java.util.List; public abstract class Util { private static final Logger log = LoggerFactory.getLogger(Util.class); diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/actions/DeliveryOrderInfo.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/actions/DeliveryOrderInfo.java index 0abcc11..5fd5ee0 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/actions/DeliveryOrderInfo.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/actions/DeliveryOrderInfo.java @@ -1,10 +1,10 @@ package at.ac.tuwien.sbc.valesriegler.cook.actions; -import java.io.Serializable; - import at.ac.tuwien.sbc.valesriegler.common.AbstractDeliveryAction; import at.ac.tuwien.sbc.valesriegler.types.DeliveryGroupData; +import java.io.Serializable; + /** * response to the group's interest in pizza. * diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/JMSCook.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/JMSCook.java index 79026eb..3e1b0eb 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/JMSCook.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/JMSCook.java @@ -1,17 +1,16 @@ package at.ac.tuwien.sbc.valesriegler.cook.jms; -import javax.jms.Connection; -import javax.jms.JMSException; -import javax.jms.MessageConsumer; -import javax.jms.Session; - +import at.ac.tuwien.sbc.valesriegler.common.HasId; +import at.ac.tuwien.sbc.valesriegler.cook.jms.messageListeners.DeliveryOrdersToCook; +import at.ac.tuwien.sbc.valesriegler.cook.jms.messageListeners.OrdersToCook; import org.apache.activemq.ActiveMQConnectionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.ac.tuwien.sbc.valesriegler.common.HasId; -import at.ac.tuwien.sbc.valesriegler.cook.jms.messageListeners.DeliveryOrdersToCook; -import at.ac.tuwien.sbc.valesriegler.cook.jms.messageListeners.OrdersToCook; +import javax.jms.Connection; +import javax.jms.JMSException; +import javax.jms.MessageConsumer; +import javax.jms.Session; /** * JMSCook registers all the Listeners. diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/messageListeners/DeliveryOrdersToCook.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/messageListeners/DeliveryOrdersToCook.java index e2a63cf..dc26967 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/messageListeners/DeliveryOrdersToCook.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/messageListeners/DeliveryOrdersToCook.java @@ -1,18 +1,5 @@ package at.ac.tuwien.sbc.valesriegler.cook.jms.messageListeners; -import javax.jms.Connection; -import javax.jms.DeliveryMode; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.ObjectMessage; -import javax.jms.Session; - -import org.apache.activemq.ActiveMQConnectionFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import at.ac.tuwien.sbc.valesriegler.cook.actions.DeliveryOrderInfo; import at.ac.tuwien.sbc.valesriegler.cook.jms.JMSCook; import at.ac.tuwien.sbc.valesriegler.group.actions.DeliveryOrderRequest; @@ -20,6 +7,11 @@ import at.ac.tuwien.sbc.valesriegler.types.OrderStatus; import at.ac.tuwien.sbc.valesriegler.types.Pizza; import at.ac.tuwien.sbc.valesriegler.types.PizzaOrder; import at.ac.tuwien.sbc.valesriegler.types.PizzaOrderStatus; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.jms.*; /** * Cook the requested pizza. diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/messageListeners/OrdersToCook.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/messageListeners/OrdersToCook.java index 62b6875..a3facf7 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/messageListeners/OrdersToCook.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/cook/jms/messageListeners/OrdersToCook.java @@ -1,18 +1,5 @@ package at.ac.tuwien.sbc.valesriegler.cook.jms.messageListeners; -import javax.jms.Connection; -import javax.jms.DeliveryMode; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.ObjectMessage; -import javax.jms.Session; - -import org.apache.activemq.ActiveMQConnectionFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import at.ac.tuwien.sbc.valesriegler.cook.actions.OrderInfo; import at.ac.tuwien.sbc.valesriegler.cook.jms.JMSCook; import at.ac.tuwien.sbc.valesriegler.group.actions.OrderRequest; @@ -20,6 +7,11 @@ import at.ac.tuwien.sbc.valesriegler.types.OrderStatus; import at.ac.tuwien.sbc.valesriegler.types.Pizza; import at.ac.tuwien.sbc.valesriegler.types.PizzaOrder; import at.ac.tuwien.sbc.valesriegler.types.PizzaOrderStatus; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.jms.*; /** * Cook the requested pizza. diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/actions/OrderDeliveredInfo.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/actions/OrderDeliveredInfo.java index 2b03449..aaa1e3f 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/actions/OrderDeliveredInfo.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/actions/OrderDeliveredInfo.java @@ -1,10 +1,10 @@ package at.ac.tuwien.sbc.valesriegler.driver.actions; -import java.io.Serializable; - import at.ac.tuwien.sbc.valesriegler.common.AbstractDeliveryAction; import at.ac.tuwien.sbc.valesriegler.types.DeliveryGroupData; +import java.io.Serializable; + /** * response to the group's interest in pizza. * diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/jms/JMSDriver.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/jms/JMSDriver.java index 8742b41..65bbd43 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/jms/JMSDriver.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/jms/JMSDriver.java @@ -1,16 +1,15 @@ package at.ac.tuwien.sbc.valesriegler.driver.jms; -import javax.jms.Connection; -import javax.jms.JMSException; -import javax.jms.MessageConsumer; -import javax.jms.Session; - +import at.ac.tuwien.sbc.valesriegler.common.HasId; +import at.ac.tuwien.sbc.valesriegler.driver.jms.messageListeners.CookedDeliveryOrders; import org.apache.activemq.ActiveMQConnectionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.ac.tuwien.sbc.valesriegler.common.HasId; -import at.ac.tuwien.sbc.valesriegler.driver.jms.messageListeners.CookedDeliveryOrders; +import javax.jms.Connection; +import javax.jms.JMSException; +import javax.jms.MessageConsumer; +import javax.jms.Session; /** * JMSDriver registers all the Listeners. diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/jms/messageListeners/CookedDeliveryOrders.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/jms/messageListeners/CookedDeliveryOrders.java index 5013d4a..6c08250 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/jms/messageListeners/CookedDeliveryOrders.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/driver/jms/messageListeners/CookedDeliveryOrders.java @@ -1,22 +1,14 @@ package at.ac.tuwien.sbc.valesriegler.driver.jms.messageListeners; -import javax.jms.Connection; -import javax.jms.DeliveryMode; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.ObjectMessage; -import javax.jms.Session; - -import org.apache.activemq.ActiveMQConnectionFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import at.ac.tuwien.sbc.valesriegler.common.Util; import at.ac.tuwien.sbc.valesriegler.cook.actions.DeliveryOrderInfo; import at.ac.tuwien.sbc.valesriegler.driver.actions.OrderDeliveredInfo; import at.ac.tuwien.sbc.valesriegler.driver.jms.JMSDriver; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.jms.*; /** * diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/group/DeliveryGroup.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/group/DeliveryGroup.java index 38aa521..fd21703 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/group/DeliveryGroup.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/group/DeliveryGroup.java @@ -1,13 +1,12 @@ package at.ac.tuwien.sbc.valesriegler.group; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import at.ac.tuwien.sbc.valesriegler.common.HasId; import at.ac.tuwien.sbc.valesriegler.group.actions.DeliveryOrderRequest; import at.ac.tuwien.sbc.valesriegler.group.jms.JMSGroupConnector; import at.ac.tuwien.sbc.valesriegler.types.DeliveryGroupData; import at.ac.tuwien.sbc.valesriegler.types.DeliveryStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DeliveryGroup implements Runnable, HasId { private static final Logger log = LoggerFactory.getLogger(DeliveryGroup.class); diff --git a/src/main/java/at/ac/tuwien/sbc/valesriegler/group/gui/DeliveryOverviewModel.java b/src/main/java/at/ac/tuwien/sbc/valesriegler/group/gui/DeliveryOverviewModel.java index 8bce9d4..eaf9545 100644 --- a/src/main/java/at/ac/tuwien/sbc/valesriegler/group/gui/DeliveryOverviewModel.java +++ b/src/main/java/at/ac/tuwien/sbc/valesriegler/group/gui/DeliveryOverviewModel.java @@ -29,6 +29,16 @@ public class DeliveryOverviewModel extends TableModel { return COLUMNS; } + @Override + public void addItems(List newItems) { + log.info("addItems()"); + super.addItems(newItems); + for (DeliveryGroup g : newItems) { + if (Util.useJMS) + g.orderSomeFood(); + } + } + @Override public Object getValueAt(int rowIndex, int columnIndex) { List values = new ArrayList<>(items.values()); -- 2.43.0