View Javadoc

1   package org.kuali.common.deploy.aws.model;
2   
3   import org.kuali.common.util.Assert;
4   
5   public final class SesContext {
6   
7   	private final String host;
8   	private final SesCredentials credentials;
9   	private final boolean debug;
10  	private final int port;
11  	private final boolean sslEnable;
12  	private final boolean auth;
13  
14  	public static class Builder {
15  
16  		// Required
17  		private final String host;
18  		private final SesCredentials credentials;
19  
20  		// Optional
21  		private boolean debug = false;
22  		private int port = 465;
23  		private boolean sslEnable = true;
24  		private boolean auth = true;
25  
26  		public Builder(String host, SesCredentials credentials) {
27  			this.host = host;
28  			this.credentials = credentials;
29  		}
30  
31  		public Builder debug(boolean debug) {
32  			this.debug = debug;
33  			return this;
34  		}
35  
36  		public Builder port(int port) {
37  			this.port = port;
38  			return this;
39  		}
40  
41  		public Builder sslEnable(boolean sslEnable) {
42  			this.sslEnable = sslEnable;
43  			return this;
44  		}
45  
46  		public Builder auth(boolean auth) {
47  			this.auth = auth;
48  			return this;
49  		}
50  
51  		public SesContext build() {
52  			Assert.noBlanks(host);
53  			Assert.noNulls(credentials);
54  			Assert.isTrue(port > 0, "port must be a positive integer");
55  			return new SesContext(this);
56  		}
57  	}
58  
59  	private SesContext(Builder builder) {
60  		this.host = builder.host;
61  		this.credentials = builder.credentials;
62  		this.debug = builder.debug;
63  		this.port = builder.port;
64  		this.sslEnable = builder.sslEnable;
65  		this.auth = builder.auth;
66  	}
67  
68  	public String getHost() {
69  		return host;
70  	}
71  
72  	public SesCredentials getCredentials() {
73  		return credentials;
74  	}
75  
76  	public boolean isDebug() {
77  		return debug;
78  	}
79  
80  	public int getPort() {
81  		return port;
82  	}
83  
84  	public boolean isSslEnable() {
85  		return sslEnable;
86  	}
87  
88  	public boolean isAuth() {
89  		return auth;
90  	}
91  
92  }