View Javadoc
1   package org.kuali.common.devops.model.metadata;
2   
3   import org.kuali.common.core.build.ValidatingBuilder;
4   import org.kuali.common.core.validate.annotation.IdiotProofImmutable;
5   
6   import com.google.common.base.Optional;
7   
8   @IdiotProofImmutable
9   public final class EnvironmentMetadataUrls {
10  
11  	private final String fqdn;
12  	private final String tomcatVersion;
13  	private final String tomcatHeap;
14  	private final String systemPropertiesJsp;
15  	private final String applicationManifest;
16  	private final Optional<String> projectProperties;
17  	private final Optional<String> projectConfiguration;
18  
19  	private EnvironmentMetadataUrls(Builder builder) {
20  		this.fqdn = builder.fqdn;
21  		this.tomcatVersion = builder.tomcatVersion;
22  		this.tomcatHeap = builder.tomcatHeap;
23  		this.systemPropertiesJsp = builder.systemPropertiesJsp;
24  		this.applicationManifest = builder.applicationManifest;
25  		this.projectProperties = builder.projectProperties;
26  		this.projectConfiguration = builder.projectConfiguration;
27  	}
28  
29  	public static Builder builder(String fqdn) {
30  		return new Builder(fqdn);
31  	}
32  
33  	public static class Builder extends ValidatingBuilder<EnvironmentMetadataUrls> {
34  
35  		public static final String DEFAULT_PREFIX = "http://";
36  		private static final String SYSTEM_PROPERTIES_URL_FRAGMENT = "/tomcat/logs/env.jsp";
37  		private static final String MANIFEST_URL_FRAGMENT = "/tomcat/webapps/ROOT/META-INF/MANIFEST.MF";
38  		private static final String VERSION_URL_FRAGMENT = "/tomcat";
39  		private static final String HEAP_URL_FRAGMENT = "/tomcat/logs/heap.log";
40  
41  		private String fqdn;
42  		private String tomcatVersion;
43  		private String tomcatHeap;
44  		private String systemPropertiesJsp;
45  		private String applicationManifest;
46  		private Optional<String> projectProperties = Optional.absent();
47  		private Optional<String> projectConfiguration = Optional.absent();
48  
49  		public Builder() {
50  		}
51  
52  		public Builder(String fqdn) {
53  			this.fqdn = fqdn;
54  			tomcatVersion(DEFAULT_PREFIX + fqdn + VERSION_URL_FRAGMENT);
55  			tomcatHeap(DEFAULT_PREFIX + fqdn + HEAP_URL_FRAGMENT);
56  			systemPropertiesJsp(DEFAULT_PREFIX + fqdn + SYSTEM_PROPERTIES_URL_FRAGMENT);
57  			applicationManifest(DEFAULT_PREFIX + fqdn + MANIFEST_URL_FRAGMENT);
58  		}
59  
60  		@Override
61  		public EnvironmentMetadataUrls build() {
62  			return validate(new EnvironmentMetadataUrls(this));
63  		}
64  
65  		public Builder fqdn(String fqdn) {
66  			this.fqdn = fqdn;
67  			return this;
68  		}
69  
70  		public Builder tomcatVersion(String tomcatVersion) {
71  			this.tomcatVersion = tomcatVersion;
72  			return this;
73  		}
74  
75  		public Builder tomcatHeap(String tomcatHeap) {
76  			this.tomcatHeap = tomcatHeap;
77  			return this;
78  		}
79  
80  		public Builder systemPropertiesJsp(String systemPropertiesJsp) {
81  			this.systemPropertiesJsp = systemPropertiesJsp;
82  			return this;
83  		}
84  
85  		public Builder applicationManifest(String applicationManifest) {
86  			this.applicationManifest = applicationManifest;
87  			return this;
88  		}
89  
90  		public Builder projectProperties(Optional<String> projectProperties) {
91  			this.projectProperties = projectProperties;
92  			return this;
93  		}
94  
95  		public Builder projectConfiguration(Optional<String> projectConfiguration) {
96  			this.projectConfiguration = projectConfiguration;
97  			return this;
98  		}
99  
100 		public String getTomcatVersion() {
101 			return tomcatVersion;
102 		}
103 
104 		public void setTomcatVersion(String releaseNotes) {
105 			this.tomcatVersion = releaseNotes;
106 		}
107 
108 		public String getTomcatHeap() {
109 			return tomcatHeap;
110 		}
111 
112 		public void setTomcatHeap(String heap) {
113 			this.tomcatHeap = heap;
114 		}
115 
116 		public String getSystemPropertiesJsp() {
117 			return systemPropertiesJsp;
118 		}
119 
120 		public void setSystemPropertiesJsp(String envJsp) {
121 			this.systemPropertiesJsp = envJsp;
122 		}
123 
124 		public String getApplicationManifest() {
125 			return applicationManifest;
126 		}
127 
128 		public void setApplicationManifest(String manifest) {
129 			this.applicationManifest = manifest;
130 		}
131 
132 		public Optional<String> getProjectProperties() {
133 			return projectProperties;
134 		}
135 
136 		public void setProjectProperties(Optional<String> projectProperties) {
137 			this.projectProperties = projectProperties;
138 		}
139 
140 		public Optional<String> getProjectConfiguration() {
141 			return projectConfiguration;
142 		}
143 
144 		public void setProjectConfiguration(Optional<String> configuration) {
145 			this.projectConfiguration = configuration;
146 		}
147 
148 		public String getFqdn() {
149 			return fqdn;
150 		}
151 
152 		public void setFqdn(String fqdn) {
153 			this.fqdn = fqdn;
154 		}
155 
156 	}
157 
158 	public String getTomcatVersion() {
159 		return tomcatVersion;
160 	}
161 
162 	public String getTomcatHeap() {
163 		return tomcatHeap;
164 	}
165 
166 	public String getSystemPropertiesJsp() {
167 		return systemPropertiesJsp;
168 	}
169 
170 	public String getApplicationManifest() {
171 		return applicationManifest;
172 	}
173 
174 	public Optional<String> getProjectProperties() {
175 		return projectProperties;
176 	}
177 
178 	public Optional<String> getProjectConfiguration() {
179 		return projectConfiguration;
180 	}
181 
182 	public String getFqdn() {
183 		return fqdn;
184 	}
185 
186 }