Giter VIP home page Giter VIP logo

rmi-shopping-cart's Introduction

Java RMI Shopping Cart

This project is a simple implementation of a Java RMI (Remote Method Invocation) shopping cart system. It includes a Server class that sets up a registry and binds several products to it, and Admin and Customer clients that interact with the server.

Code Overview

The Server class in Server.java creates a few Product objects and a Cart object. Each Product and the Cart are then exported as a stub using UnicastRemoteObject.exportObject(). These stubs are bound to a registry which is set up on localhost at port 9100.

The Admin and Customer clients can look up the product and cart stubs in the registry using their names ("laptop", "mobilePhone", "charger", "powerBank", and "access_cart") and interact with them as if they were local objects.

Directory Structure

The project is organized into two main directories:

  • server: Contains the Server.java, Product.java, ProductInterface.java, CartInterface.java, and Cart.java files.
  • client: Contains the Admin.java, Customer.java, ProductInterface.java, and CartInterface.java files.

Running the Server

To run the server, navigate to the server directory and execute the Server class. This will set up the registry and bind the product and cart stubs to it. The server will print "Server has been started..." to indicate successful setup.

Running the Clients

To run the Admin or Customer clients, navigate to the client directory and execute the respective class. The clients will interact with the server as if the Product and Cart objects were local to them.

CLI Commands

To start the RMI registry, compile and run the server, compile and run the clients, use the following commands:

  • Start RMI registry: start rmiregistry 9100
  • Compile and run server: javac Server.java and java Server
  • Compile and run client: javac Admin.java and java Admin or javac Customer.java and java Customer

rmi-shopping-cart's People

Contributors

shinjitsue avatar

Stargazers

Jack the Rizzler avatar Honey Mae Omela avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.