// Path: examples/simpleorder-javaee/src/main/java/oose/dea/controller/ViewItemsPageController.java
// @Singleton
// @WebServlet(urlPatterns = "/viewItems")
// public class ViewItemsPageController extends HttpServlet {
//     @Inject
//     private ItemService itemService;
// 
//     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//         List<Item> items = itemService.findAll();
//         request.setAttribute("all", items);
//         request.getRequestDispatcher("viewItems.jsp").forward(request, response);
//     }
// }
// 
// Path: examples/simpleorder-javaee/src/main/java/oose/dea/dataaccess/ItemDAO.java
// public interface ItemDAO extends DAO<Item>{
// }
// 
// Path: examples/simpleorder-javaee-cdi/src/main/java/oose/dea/dataaccess/ItemJdbcDAO.java
// @Default
// public class ItemJdbcDAO implements ItemDAO {
//     private static Logger logger = Logger.getLogger(ItemJdbcDAO.class.getName());
// 
//     private JdbcConnectionFactory jdbcConnectionFactory;
// 
//     @Inject
//     public ItemJdbcDAO(JdbcConnectionFactory jdbcConnectionFactory) {
//         this.jdbcConnectionFactory = jdbcConnectionFactory;
//     }
// 
//     @Override
//     public void add(Item entity) {
//         Connection connection = jdbcConnectionFactory.create();
//         try {
//             PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO items VALUES (NULL, ? , ? , ?)");
//             preparedStatement.setString(1, entity.getSku());
//             preparedStatement.setString(2, entity.getCategory());
//             preparedStatement.setString(3, entity.getTitle());
//             preparedStatement.executeUpdate();
//             connection.close();
//         } catch (SQLException e) {
//             logger.severe(e.getMessage());
//         }
//     }
// 
//     @Override
//     public void update(Item updatedEntity) {
//         throw new RuntimeException("Not implemented yet");
//     }
// 
//     @Override
//     public void remove(Item entity) {
//         throw new RuntimeException("Not implemented yet");
//     }
// 
//     @Override
//     public List<Item> list() {
//         Connection connection = jdbcConnectionFactory.create();
//         List<Item> items = new ArrayList<Item>();
//         try {
//             ResultSet rs = connection.prepareStatement("SELECT * FROM items").executeQuery();
//             while (rs.next()) {
//                 items.add(new Item(rs.getString("sku"),rs.getString("category"),rs.getString("title")));
//             }
//             connection.close();
//         } catch (SQLException e) {
//             logger.severe(e.getMessage());
//         }
//         return items;
//     }
// 
//     @Override
//     public Item find(int id) {
//         throw new RuntimeException("Not implemented yet");
//     }
// }
// 
// Path: examples/simpleorder-javaee/src/main/java/oose/dea/services/ItemService.java
// public interface ItemService {
//     List<Item> findAll();
// }
// 
// Path: examples/simpleorder-javaee/src/main/java/oose/dea/services/local/LocalItemService.java
// public class LocalItemService implements ItemService {
//     @Inject
//     private ItemDAO itemDAO;
// 
//     @Override
//     public List<Item> findAll() {
//         return itemDAO.list();
//     }
// }


import com.google.inject.servlet.ServletModule;
import oose.dea.controller.ViewItemsPageController;
import oose.dea.dataaccess.ItemDAO;
import oose.dea.dataaccess.ItemJdbcDAO;
import oose.dea.services.ItemService;
import oose.dea.services.local.LocalItemService;
package oose.dea.config;


public class AppBinding extends ServletModule {
    @Override
// Path: examples/simpleorder-javaee/src/main/java/oose/dea/controller/ViewItemsPageController.java
// @Singleton
// @WebServlet(urlPatterns = "/viewItems")
// public class ViewItemsPageController extends HttpServlet {
//     @Inject
//     private ItemService itemService;
// 
//     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//         List<Item> items = itemService.findAll();
//         request.setAttribute("all", items);
//         request.getRequestDispatcher("viewItems.jsp").forward(request, response);
//     }
// }
// 
// Path: examples/simpleorder-javaee/src/main/java/oose/dea/dataaccess/ItemDAO.java
// public interface ItemDAO extends DAO<Item>{
// }
// 
// Path: examples/simpleorder-javaee-cdi/src/main/java/oose/dea/dataaccess/ItemJdbcDAO.java
// @Default
// public class ItemJdbcDAO implements ItemDAO {
//     private static Logger logger = Logger.getLogger(ItemJdbcDAO.class.getName());
// 
//     private JdbcConnectionFactory jdbcConnectionFactory;
// 
//     @Inject
//     public ItemJdbcDAO(JdbcConnectionFactory jdbcConnectionFactory) {
//         this.jdbcConnectionFactory = jdbcConnectionFactory;
//     }
// 
//     @Override
//     public void add(Item entity) {
//         Connection connection = jdbcConnectionFactory.create();
//         try {
//             PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO items VALUES (NULL, ? , ? , ?)");
//             preparedStatement.setString(1, entity.getSku());
//             preparedStatement.setString(2, entity.getCategory());
//             preparedStatement.setString(3, entity.getTitle());
//             preparedStatement.executeUpdate();
//             connection.close();
//         } catch (SQLException e) {
//             logger.severe(e.getMessage());
//         }
//     }
// 
//     @Override
//     public void update(Item updatedEntity) {
//         throw new RuntimeException("Not implemented yet");
//     }
// 
//     @Override
//     public void remove(Item entity) {
//         throw new RuntimeException("Not implemented yet");
//     }
// 
//     @Override
//     public List<Item> list() {
//         Connection connection = jdbcConnectionFactory.create();
//         List<Item> items = new ArrayList<Item>();
//         try {
//             ResultSet rs = connection.prepareStatement("SELECT * FROM items").executeQuery();
//             while (rs.next()) {
//                 items.add(new Item(rs.getString("sku"),rs.getString("category"),rs.getString("title")));
//             }
//             connection.close();
//         } catch (SQLException e) {
//             logger.severe(e.getMessage());
//         }
//         return items;
//     }
// 
//     @Override
//     public Item find(int id) {
//         throw new RuntimeException("Not implemented yet");
//     }
// }
// 
// Path: examples/simpleorder-javaee/src/main/java/oose/dea/services/ItemService.java
// public interface ItemService {
//     List<Item> findAll();
// }
// 
// Path: examples/simpleorder-javaee/src/main/java/oose/dea/services/local/LocalItemService.java
// public class LocalItemService implements ItemService {
//     @Inject
//     private ItemDAO itemDAO;
// 
//     @Override
//     public List<Item> findAll() {
//         return itemDAO.list();
//     }
// }


// Path: examples/simpleorder-javaee/src/main/java/oose/dea/config/AppBinding.java
import com.google.inject.servlet.ServletModule;
import oose.dea.controller.ViewItemsPageController;
import oose.dea.dataaccess.ItemDAO;
import oose.dea.dataaccess.ItemJdbcDAO;
import oose.dea.services.ItemService;
import oose.dea.services.local.LocalItemService;

package oose.dea.config;


public class AppBinding extends ServletModule {
    @Override
    protected void configureServlets() {