Class ProductManagerServer

java.lang.Object
de.calamanari.pk.util.AbstractConsoleServer
de.calamanari.pk.combinedmethod.ProductManagerServer
All Implemented Interfaces:
ProductManager, java.rmi.Remote

public class ProductManagerServer
extends AbstractConsoleServer
implements ProductManager
Product Manager Server - the server side
Author:
Karl Eilebrecht
  • Field Details

  • Constructor Details

  • Method Details

    • findProductById

      public Product findProductById​(java.lang.String id) throws java.rmi.RemoteException
      Description copied from interface: ProductManager
      Finds the product and returns it
      Specified by:
      findProductById in interface ProductManager
      Parameters:
      id - the product's id
      Returns:
      product or null if not found
      Throws:
      java.rmi.RemoteException - on remoting error
    • acquireProductId

      public java.lang.String acquireProductId() throws java.rmi.RemoteException
      Description copied from interface: ProductManager
      Returns a new product-ID, the ID must be acquired before registering a new product
      Specified by:
      acquireProductId in interface ProductManager
      Returns:
      acquired product identifier
      Throws:
      java.rmi.RemoteException - on remoting error
    • registerProduct

      public void registerProduct​(Product product) throws java.rmi.RemoteException
      Description copied from interface: ProductManager
      Registers a new product
      Specified by:
      registerProduct in interface ProductManager
      Parameters:
      product - the product to be registered, including a previously registered id
      Throws:
      java.rmi.RemoteException - on remoting error
    • setNextProductRegistrationMustFail

      public void setNextProductRegistrationMustFail() throws java.rmi.RemoteException
      Description copied from interface: ProductManager
      for testing, simulates error on next call
      Specified by:
      setNextProductRegistrationMustFail in interface ProductManager
      Throws:
      java.rmi.RemoteException - on remoting error
    • combinedCreateAndRegisterProduct

      public Product combinedCreateAndRegisterProduct​(Product product) throws java.rmi.RemoteException
      Description copied from interface: ProductManager
      COMBINED METHOD to acquire id and then register the product in one step
      Specified by:
      combinedCreateAndRegisterProduct in interface ProductManager
      Parameters:
      product - without id
      Returns:
      product including id from remote system
      Throws:
      java.rmi.RemoteException - on remoting error
    • reset

      public void reset() throws java.rmi.RemoteException
      Description copied from interface: ProductManager
      for testing, resets state
      Specified by:
      reset in interface ProductManager
      Throws:
      java.rmi.RemoteException - on remoting error
    • main

      public static void main​(java.lang.String[] args)
      Creates stand-alone console server
      Parameters:
      args - first argument may optionally specify the port