Interface ProductManager

  • All Superinterfaces:
    java.rmi.Remote
    All Known Implementing Classes:
    ProductManagerServer

    public interface ProductManager
    extends java.rmi.Remote
    Product Manager - interface provided by the remote product manager server, originally with two methods to first acquire a new id and than register the product. As always the reason for this strange interface is legacy behavior. :-)
    A new COMBINED METHOD was introduced to combine the two steps into one transactional step to avoid inconsistencies in case of error.
    Author:
    Karl Eilebrecht
    • Method Detail

      • acquireProductId

        java.lang.String acquireProductId()
                                   throws java.rmi.RemoteException
        Returns a new product-ID, the ID must be acquired before registering a new product
        Returns:
        acquired product identifier
        Throws:
        java.rmi.RemoteException - on remoting error
      • registerProduct

        void registerProduct​(Product product)
                      throws java.rmi.RemoteException
        Registers a new product
        Parameters:
        product - the product to be registered, including a previously registered id
        Throws:
        java.rmi.RemoteException - on remoting error
      • findProductById

        Product findProductById​(java.lang.String id)
                         throws java.rmi.RemoteException
        Finds the product and returns it
        Parameters:
        id - the product's id
        Returns:
        product or null if not found
        Throws:
        java.rmi.RemoteException - on remoting error
      • combinedCreateAndRegisterProduct

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

        void setNextProductRegistrationMustFail()
                                         throws java.rmi.RemoteException
        for testing, simulates error on next call
        Throws:
        java.rmi.RemoteException - on remoting error
      • reset

        void reset()
            throws java.rmi.RemoteException
        for testing, resets state
        Throws:
        java.rmi.RemoteException - on remoting error