001 package org.kuali.common.deploy.aws.model; 002 003 import org.kuali.common.util.Assert; 004 005 public final class SesContext { 006 007 private final String host; 008 private final SesCredentials credentials; 009 private final boolean debug; 010 private final int port; 011 private final boolean sslEnable; 012 private final boolean auth; 013 014 public static class Builder { 015 016 // Required 017 private final String host; 018 private final SesCredentials credentials; 019 020 // Optional 021 private boolean debug = false; 022 private int port = 465; 023 private boolean sslEnable = true; 024 private boolean auth = true; 025 026 public Builder(String host, SesCredentials credentials) { 027 this.host = host; 028 this.credentials = credentials; 029 } 030 031 public Builder debug(boolean debug) { 032 this.debug = debug; 033 return this; 034 } 035 036 public Builder port(int port) { 037 this.port = port; 038 return this; 039 } 040 041 public Builder sslEnable(boolean sslEnable) { 042 this.sslEnable = sslEnable; 043 return this; 044 } 045 046 public Builder auth(boolean auth) { 047 this.auth = auth; 048 return this; 049 } 050 051 public SesContext build() { 052 Assert.noBlanks(host); 053 Assert.noNulls(credentials); 054 Assert.isTrue(port > 0, "port must be a positive integer"); 055 return new SesContext(this); 056 } 057 } 058 059 private SesContext(Builder builder) { 060 this.host = builder.host; 061 this.credentials = builder.credentials; 062 this.debug = builder.debug; 063 this.port = builder.port; 064 this.sslEnable = builder.sslEnable; 065 this.auth = builder.auth; 066 } 067 068 public String getHost() { 069 return host; 070 } 071 072 public SesCredentials getCredentials() { 073 return credentials; 074 } 075 076 public boolean isDebug() { 077 return debug; 078 } 079 080 public int getPort() { 081 return port; 082 } 083 084 public boolean isSslEnable() { 085 return sslEnable; 086 } 087 088 public boolean isAuth() { 089 return auth; 090 } 091 092 }