001 package org.kuali.common.deploy.appserver.tomcat; 002 003 import org.kuali.common.util.Assert; 004 005 public final class TomcatDirs { 006 007 private final String basedir; 008 private final String conf; 009 private final String catalina; 010 private final String logs; 011 private final String bin; 012 private final String lib; 013 private final String webapps; 014 private final String work; 015 private final String temp; 016 017 public static class Builder { 018 019 // Required 020 private final String basedir; 021 022 // Optional 023 private String logs; 024 private String bin; 025 private String lib; 026 private String webapps; 027 private String work; 028 private String temp; 029 private String conf; 030 private String catalina; 031 032 public Builder(String basedir) { 033 this.basedir = basedir; 034 this.logs = basedir + "/logs"; 035 this.bin = basedir + "/bin"; 036 this.lib = basedir + "/lib"; 037 this.webapps = basedir + "/webapps"; 038 this.work = basedir + "/work"; 039 this.temp = basedir + "/temp"; 040 this.conf = basedir + "/conf"; 041 this.catalina = conf + "/Catalina"; // The "Catalina" dir under conf has a special meaning to Tomcat 042 } 043 044 public Builder logs(String logs) { 045 this.logs = logs; 046 return this; 047 } 048 049 public Builder bin(String bin) { 050 this.bin = bin; 051 return this; 052 } 053 054 public Builder lib(String lib) { 055 this.lib = lib; 056 return this; 057 } 058 059 public Builder webapps(String webapps) { 060 this.webapps = webapps; 061 return this; 062 } 063 064 public Builder work(String work) { 065 this.work = work; 066 return this; 067 } 068 069 public Builder temp(String temp) { 070 this.temp = temp; 071 return this; 072 } 073 074 public Builder conf(String conf) { 075 this.conf = conf; 076 return this; 077 } 078 079 public Builder catalina(String catalina) { 080 this.catalina = catalina; 081 return this; 082 } 083 084 public TomcatDirs build() { 085 Assert.noBlanks(basedir, logs, bin, lib, webapps, work, temp, conf, catalina); 086 return new TomcatDirs(this); 087 } 088 089 } 090 091 private TomcatDirs(Builder builder) { 092 this.basedir = builder.basedir; 093 this.logs = builder.logs; 094 this.bin = builder.bin; 095 this.lib = builder.lib; 096 this.webapps = builder.webapps; 097 this.work = builder.work; 098 this.temp = builder.temp; 099 this.conf = builder.conf; 100 this.catalina = builder.catalina; 101 } 102 103 public String getConf() { 104 return conf; 105 } 106 107 public String getLogs() { 108 return logs; 109 } 110 111 public String getBin() { 112 return bin; 113 } 114 115 public String getLib() { 116 return lib; 117 } 118 119 public String getWebapps() { 120 return webapps; 121 } 122 123 public String getWork() { 124 return work; 125 } 126 127 public String getTemp() { 128 return temp; 129 } 130 131 public String getBasedir() { 132 return basedir; 133 } 134 135 public String getCatalina() { 136 return catalina; 137 } 138 139 }