db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r469573 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client: ./ Display.java Operations.java
Date Tue, 31 Oct 2006 17:26:20 GMT
Author: djd
Date: Tue Oct 31 09:26:18 2006
New Revision: 469573

URL: http://svn.apache.org/viewvc?view=rev&rev=469573
Log:
DERBY-1994 Add the interfaces to execute the business transactions and display the results
for the order entry toolkit.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Display.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Operations.java
  (with props)

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Display.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Display.java?view=auto&rev=469573
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Display.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Display.java
Tue Oct 31 09:26:18 2006
@@ -0,0 +1,121 @@
+/*
+ *
+ * Derby - Class org.apache.derbyTesting.system.oe.client.Display
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, 
+ * software distributed under the License is distributed on an 
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
+ * either express or implied. See the License for the specific 
+ * language governing permissions and limitations under the License.
+ */
+package org.apache.derbyTesting.system.oe.client;
+
+import org.apache.derbyTesting.system.oe.model.Customer;
+import org.apache.derbyTesting.system.oe.model.District;
+import org.apache.derbyTesting.system.oe.model.Order;
+import org.apache.derbyTesting.system.oe.model.Warehouse;
+
+/**
+ * Interface to display the results of the business operations.
+ * Methods are called by implementations of Operations.
+ * There is no requirement for implementations to follow
+ * the layout dictated by the TPC-C specification.
+ * All the information required by the TPC-C specification
+ * for display will be provided through the passed in parameters.
+ * <BR>
+ * Objects passed in from the data model (Customer etc.) may not
+ * be fully populated, but they will contain all the information
+ * required for that specific operation.
+ * <P>
+ * DECIMAL values are represented as String objects to allow
+ * Order Entry to be run on J2ME/CDC/Foundation which does
+ * not support BigDecimal.
+ */
+public interface Display {
+
+    /**
+     * Display the result of a stock level. Stock level terminal i/o is
+     * described in clause 2.8.3.
+     * 
+     * @param displayData
+     *            Client specific display information, such as servlet context.
+     * @param w
+     *            Warehouse (input)
+     * @param d
+     *            District (input)
+     * @param threshold
+     *            Threshold (input)
+     * @param level
+     *            (result)
+     * @throws Exception
+     *             Error displaying data
+     */
+    public void displayStockLevel(Object displayData, short w, short d,
+            int threshold, int level) throws Exception;
+
+    /**
+     * Display the result of an order status. Order status terminal i/o is
+     * decribed in clause 2.6.3.
+     * 
+     * @param displayData
+     *            Client specific display information, such as servlet context.
+     * @param byName
+     *            Executed by name or by identifier.
+     * @param customer
+     *            Customer for order
+     * @param order
+     *            Order fetched.
+     * @throws Exception
+     */
+    public void displayOrderStatus(Object displayData, boolean byName,
+            Customer customer, Order order) throws Exception;
+              
+    /**
+     * Display the result of a payment. Payment terminal i/o
+     * is described in clause 2.5.3.
+     * @param displayData Client specific display information, such as servlet context.
+     * @param amount Amount of payment.
+     * @param byName Executed by name or by identifier.
+     * @param warehouse Warehouse of payment
+     * @param district District of payment
+     * @param customer Customer of payment.
+     * @throws Exception
+     */
+    public void displayPayment(Object displayData, String amount,
+            boolean byName, Warehouse warehouse, District district,
+            Customer customer) throws Exception;
+
+    /**
+     * Display the result of a new order. New order terminal i/o
+     * is described in clause 2.4.3.
+     * May need more parameters.
+     * @param displayData Client specific display information, such as servlet context.
+     * @param warehouse Warehouse of new order
+     * @param district District of new order
+     * @param customer Customer of new order
+     * @param order The new order
+     * @throws Exception
+     */
+    public void displayNewOrder(Object displayData, Warehouse warehouse,
+            District district, Customer customer, Order order) throws Exception;
+
+    /**
+     * Display the result of a delivery schedule.
+     * 
+     * @param displayData Client specific display information, such as servlet context.
+     * @param w Warehouse identifier
+     * @param carrier Carrier identifier
+     * @throws Exception
+     */
+    public void displayScheduleDelivery(Object displayData, short w,
+            short carrier) throws Exception;
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Display.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Operations.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Operations.java?view=auto&rev=469573
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Operations.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Operations.java
Tue Oct 31 09:26:18 2006
@@ -0,0 +1,278 @@
+/*
+ *
+ * Derby - Class org.apache.derbyTesting.system.oe.client.Operations
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, 
+ * software distributed under the License is distributed on an 
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
+ * either express or implied. See the License for the specific 
+ * language governing permissions and limitations under the License.
+ */
+package org.apache.derbyTesting.system.oe.client;
+
+/**
+ * Interface for a client to execute the logical operations. Various
+ * implementations can be provided, e.g. client side SQL, procedure, etc.
+ * <P>
+ * Typical model is that each client has its own instance of an object that
+ * implements Operations. For example the implementation in a client side SQL
+ * implementation would have a reference to its own JDBC connection and prepared
+ * statements.
+ * <P>
+ * Setup methods are provided for each operation to allow testing with a single
+ * transaction or mixing of Operations implementations from a single client.
+ * <P>
+ * Implementations of the execution methods must perform the following:
+ * <OL>
+ * <LI>Execute business transaction
+ * <LI>Populate POJO objects required by display method
+ * <LI>Commit the database transaction(s)
+ * <LI>Call the appropriate display method from Display
+ * </UL>
+ * 
+ * <P>
+ * DECIMAL values are represented as String objects to allow Order Entry to be
+ * run on J2ME/CDC/Foundation which does not support BigDecimal.
+ */
+
+public interface Operations {
+
+    /**
+     * Perform any setup required to call stockLevel().
+     * 
+     * @throws Exception
+     *             Error performing the setup.
+     * @see #stockLevel(Display, Object, short, short, int)
+     */
+    public void setupStockLevel() throws Exception;
+
+    /**
+     * Perform any setup required to call either orderStatus().
+     * 
+     * @throws Exception
+     *             Error performing the setup.
+     * @see #orderStatus
+     */
+    public void setupOrderStatus() throws Exception;
+
+    /**
+     * Perform any setup required to call either payment().
+     * 
+     * @throws Exception
+     *             Error performing the setup.
+     * @see #payment
+     */
+    public void setupPayment() throws Exception;
+
+    /**
+     * Perform any setup required to call newOrder().
+     * 
+     * @throws Exception
+     *             Error performing the setup.
+     * @see #newOrder(Display, Object, short, short, int, int[], short[], short[])
+     */
+    public void setupNewOrder() throws Exception;
+
+    /**
+     * Perform any setup required to call scheduleDelivery().
+     * 
+     * @throws Exception
+     *             Error performing the setup.
+     */
+    public void setupScheduleDelivery() throws Exception;
+
+    /**
+     * Perform any setup required to call delivery().
+     * 
+     * @throws Exception
+     *             Error performing the setup.
+     */
+    public void setupDelivery() throws Exception;
+
+    /**
+     * Execute stock level. Stock level is described in clause 2.8.
+     * 
+     * @param display
+     *            Where to display the results, if null results are not
+     *            displayed.
+     * @param displayData
+     *            Any client specific display information, such as servlet
+     *            context.
+     * @param w
+     *            Warehouse for transaction
+     * @param d
+     *            District for transaction
+     * @param threshold
+     *            Threshold for transaction.
+     * @see #setupStockLevel()
+     * @see Display#displayStockLevel(Object, short, short, int, int)
+     */
+    public void stockLevel(Display display, Object displayData, short w,
+            short d, int threshold) throws Exception;
+
+    /**
+     * Execute order status by last name. Order status is described in clause
+     * 2.6.
+     * 
+     * @param display
+     *            Where to display the results, if null results are not
+     *            displayed.
+     * @param displayData
+     *            Any client specific display information, such as servlet
+     *            context.
+     * @param w
+     *            Warehouse identifier
+     * @param d
+     *            District identifier
+     * @param customerLast
+     *            Customer's last name.
+     */
+    public void orderStatus(Display display, Object displayData, short w,
+            short d, String customerLast) throws Exception;
+
+    /**
+     * Execute order status by customer identifer. Order status is described in
+     * clause 2.6.
+     * 
+     * @param display
+     *            Where to display the results, if null results are not
+     *            displayed.
+     * @param displayData
+     *            Any client specific display information, such as servlet
+     *            context.
+     * @param w
+     *            Warehouse identifier
+     * @param d
+     *            District identifier
+     * @param c
+     *            Customer identifer.
+     */
+    public void orderStatus(Display display, Object displayData, short w,
+            short d, int c) throws Exception;
+
+    /**
+     * Execute payment by last name. Payment is described in clause 2.5.
+     * 
+     * @param display
+     *            Where to display the results, if null results are not
+     *            displayed.
+     * @param displayData
+     *            Any client specific display information, such as servlet
+     *            context.
+     * @param w
+     *            Home warehouse identifier
+     * @param d
+     *            Home district identifier
+     * @param cw
+     *            Customer warehouse identifier
+     * @param cd
+     *            Customer district identifier
+     * @param c
+     *            Customer identifer.
+     * @param customerLast
+     *            Customer's last name.
+     * @param amount
+     *            Payment amount
+     */
+    public void payment(Display display, Object displayData, short w, short d,
+            short cw, short cd, String customerLast, String amount)
+            throws Exception;
+
+    /**
+     * Execute payment by customer identifer. Payment is described in clause
+     * 2.5.
+     * 
+     * @param display
+     *            Where to display the results, if null results are not
+     *            displayed.
+     * @param displayData
+     *            Any client specific display information, such as servlet
+     *            context.
+     * @param w
+     *            Home warehouse identifier
+     * @param d
+     *            Home district identifier
+     * @param cw
+     *            Customer warehouse identifier
+     * @param cd
+     *            Customer district identifier
+     * @param c
+     *            Customer identifer.
+     * @param amount
+     *            Payment amount
+     */
+    public void payment(Display display, Object displayData, short w, short d,
+            short cw, short cd, int c, String amount) throws Exception;
+
+    /**
+     * Execute new order. New order is described in clause 2.4.
+     * <P>
+     * Assumption is that items.length == quanties.length == supplyW.length.
+     * 
+     * @param display
+     *            Where to display the results, if null results are not
+     *            displayed.
+     * @param displayData
+     *            Client specific display information, such as servlet
+     *            context.
+     * @param w
+     *            Warehouse identifier
+     * @param d
+     *            District identifier
+     * @param c
+     *            Customer identifier
+     * @param items
+     *            array of item numbers
+     * @param quantities
+     *            quanties for each item
+     * @param supplyW
+     *            Supply warehouse for each item.
+     * @throws Exception
+     */
+    public void newOrder(Display display, Object displayData, short w, short d,
+            int c, int[] items, short[] quantities, short[] supplyW)
+            throws Exception;
+
+    /**
+     * Queue a delivery request. Queuing of delivery requests is described in
+     * clause 2.7.2.
+     * <P>
+     * The implementation of Operations is responsible for managing the FIFO
+     * queue of requests, which could be in a flat file, the database or
+     * memory etc.
+     * 
+     * @param display
+     *            Where to display the results, if null results are not
+     *            displayed.
+     * @param displayData
+     *            Any client specific display information, such as servlet
+     *            context.
+     * @param w
+     *            Warehouse identifier
+     * @param carrier
+     *            Carrier identifier
+     * @throws Exception
+     */
+    public void scheduleDelivery(Display display, Object displayData, short w,
+            short carrier) throws Exception;
+
+    /**
+     * Execute a single delivery from the FIFO queue. Processing a delivery
+     * request is described in clause 2.7.4.
+     * 
+     * @return Number of seconds the delivery request was queued for. If no
+     *         request was queued then -1 is returned.
+     * @throws Exception
+     */
+    public int delivery() throws Exception;
+
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/client/Operations.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message