Class CustomerManagerServer

java.lang.Object
de.calamanari.pk.util.AbstractConsoleServer
de.calamanari.pk.datatransferobject.server.CustomerManagerServer
All Implemented Interfaces:
CustomerManager, java.rmi.Remote

public class CustomerManagerServer
extends AbstractConsoleServer
implements CustomerManager
Customer Manager Server - a remote service handling persistence
Author:
Karl Eilebrecht
  • Nested Class Summary

    Nested classes/interfaces inherited from class de.calamanari.pk.util.AbstractConsoleServer

    AbstractConsoleServer.ServerState
  • Field Summary

    Fields
    Modifier and Type Field Description
    static int DEFAULT_REGISTRY_PORT
    default registry port (our private server, usually this is 1099 for RMI!)
  • Constructor Summary

    Constructors
    Constructor Description
    CustomerManagerServer()
    Creates new Customer Manager Server
  • Method Summary

    Modifier and Type Method Description
    void addCustomer​(java.lang.String customerId, java.lang.String lastName, java.lang.String firstName, java.lang.String street, java.lang.String zipCode, java.lang.String city)
    For testing, adds a customer to the manager's database
    Customer findCustomer​(java.lang.String customerId)
    Returns the remote interface for the customer entity
    Customer findCustomerReturnDto​(java.lang.String customerId)
    Returns the DATA TRANSFER OBJECT for the customer entity
    static void main​(java.lang.String[] args)
    Creates stand-alone console server

    Methods inherited from class de.calamanari.pk.util.AbstractConsoleServer

    getServerName, getServerState, setupAndStart, start, stop

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • addCustomer

      public void addCustomer​(java.lang.String customerId, java.lang.String lastName, java.lang.String firstName, java.lang.String street, java.lang.String zipCode, java.lang.String city) throws java.rmi.RemoteException
      Description copied from interface: CustomerManager
      For testing, adds a customer to the manager's database
      Specified by:
      addCustomer in interface CustomerManager
      Parameters:
      customerId - identifier
      lastName - person's last name
      firstName - person's first name
      street - address field
      zipCode - address field
      city - address field
      Throws:
      java.rmi.RemoteException - on communication error
    • findCustomer

      public Customer findCustomer​(java.lang.String customerId) throws java.rmi.RemoteException
      Description copied from interface: CustomerManager
      Returns the remote interface for the customer entity
      Specified by:
      findCustomer in interface CustomerManager
      Parameters:
      customerId - identifier
      Returns:
      entity or null if not found
      Throws:
      java.rmi.RemoteException - on communication error
    • findCustomerReturnDto

      public Customer findCustomerReturnDto​(java.lang.String customerId) throws java.rmi.RemoteException
      Description copied from interface: CustomerManager
      Returns the DATA TRANSFER OBJECT for the customer entity
      Specified by:
      findCustomerReturnDto in interface CustomerManager
      Parameters:
      customerId - identifier
      Returns:
      dto or null if not found
      Throws:
      java.rmi.RemoteException - on communication error
    • main

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