public ReservationStatus queryReservation(int reservationId) {
    	Reservation reservation = getReservation(reservationId);
    	if(reservation == null) {
    		logger.info("Error querying reservation, ID is invalid");
        	return ReservationStatus.UNKNOWN;
    	}

    	int resId = reservation.getResourceID();
    	
        try {
	        
	        // creates the message to be sent to the grid resource
	    	ReservationMessage message = new ReservationMessage(super.get_id(), resId, reservation);
	    	message.setMessageType(MessageType.STATUS);
	    	
	        // gets the reply from the grid resource
	    	ReservationMessage reply = sendReservationMessage(message);
	    	
	    	// If error code is NO_ERROR, the reservation has been successful. 
	        ErrorType error = reply.getErrorCode();
	        if(error == ErrorType.NO_ERROR) {
	        	return reply.getReservation().getStatus();
	        }
	        else {
	        	logger.info("Error querying status of reservation.");
	        }
        }
        catch (Exception ex) {
        	logger.log(Level.WARNING,"Error querying status of reservation.", ex);
        }
        
    	return ReservationStatus.UNKNOWN;
    }