Skip to content

Blue-coder89/CS301-Backend

Repository files navigation

Backend Part

Opening postgres and loading the database

  • Load the Database from ticketreservation repository.
  • Clone the repository.
  • Type sudo -s -u postgres in terminal.
  • Type psql in terminal.
  • Load the database by the command \i setup.sql
  • Create a file database.properties in the directory(Containing ServiceModule.java) with the following contents. Put the user, password and db_url of your own database.
JDBC_DRIVER=org.postgresql.Driver
USER=postgres
PASS=1234
DB_URL=jdbc:postgresql://localhost:5432/railways

Starting the backend part

  • Compile the Following files using javac
    • sendQuery.java
    • invokeWorkers.java
    • client.java
    • ServiceModule.java
    • Interactor.java
  • Open a terminal and run ServiceModule file by typing java ServiceModule
  • Now the server has started to take query

Steps to send the query written in Input Folder

  • Store the input files in the Input folder
  • Open another terminal and run client file by typing java client
  • Check the output in the output folder

File format

Files in input folder

  • each line of the file should follow format mentioned below:
    • "Number of passengers" "passenger names seperated by comma" "train number" "date" "coach type"

Files in data folder

  • Train

     line 1: <Train-No>
     line 2: <Train-Name>
    
  • Train-Schedules

     <Train-No> <date of journey> <no:of Ac-coaches> <no:of sleeper-coaches>
     # (At the end)
    
  • Station

     <Station-Name>:<Station-Code>
    
  • Routes

      line 1: <Train-Number>
      line 2: <Number-of-Stations-in-Path>
      // For each station in order as seen by train, enter following details,
          <Station-Code> <Day-of-arrival> <Time-of-arrival> <Day-of-Departure> <Time-of-Departure>
    

Using Interactor

  • How to Run?
    Javac Interactor.java
    Java Interactor
  • Operations:

  • Search:

  • Add train:

About

The is the backend part of CS301 Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •