001package edu.pdx.cs410J.grader;
002
003import edu.pdx.cs410J.grader.gradebook.GradeBook;
004import jakarta.mail.MessagingException;
005import org.slf4j.Logger;
006import org.slf4j.LoggerFactory;
007
008import java.io.File;
009
010public abstract class StudentEmailAttachmentProcessor implements EmailAttachmentProcessor {
011  protected final Logger logger = LoggerFactory.getLogger(this.getClass().getPackage().getName());
012  protected final File directory;
013  protected final GradeBook gradeBook;
014
015  public StudentEmailAttachmentProcessor(File directory, GradeBook gradeBook) {
016    this.directory = directory;
017    this.gradeBook = gradeBook;
018  }
019
020  protected void logException(String message, Exception ex) {
021    this.logger.error(message, ex);
022  }
023
024  public abstract String getEmailFolder();
025
026  protected void warn(String message) {
027    this.logger.warn(message);
028  }
029
030  protected void info(String message) {
031    this.logger.info(message);
032  }
033
034  protected void debug(String message) {
035    this.logger.debug(message);
036  }
037
038  protected class SubmissionException extends Exception {
039    public SubmissionException(String message) {
040      super(message);
041    }
042
043    public SubmissionException(String message, MessagingException cause) {
044      super(message, cause);
045    }
046  }
047}