1 29 30 package com.caucho.server.deploy; 31 32 import com.caucho.config.BuilderProgram; 33 import com.caucho.config.BuilderProgramContainer; 34 import com.caucho.config.ConfigException; 35 import com.caucho.config.ObjectAttributeProgram; 36 import com.caucho.config.types.PathBuilder; 37 import com.caucho.config.types.Period; 38 import com.caucho.config.types.RawString; 39 import com.caucho.vfs.Path; 40 import com.caucho.vfs.Vfs; 41 42 import java.util.Map ; 43 import java.util.logging.Level ; 44 import java.util.logging.Logger ; 45 46 49 public class DeployConfig { 50 private final static Logger log 51 = Logger.getLogger(DeployConfig.class.getName()); 52 53 private String _id = ""; 55 56 private String _rootDirectory; 58 59 private String _archivePath; 61 62 private String _startupMode; 64 65 private String _redeployMode; 67 68 private Period _redeployCheckInterval; 70 71 private BuilderProgramContainer _program = new BuilderProgramContainer(); 73 74 77 public void setId(String id) 78 { 79 _id = id; 80 } 81 82 85 public String getId() 86 { 87 return _id; 88 } 89 90 93 public void setRootDirectory(RawString rootDirectory) 94 { 95 _rootDirectory = rootDirectory.getValue(); 96 } 97 98 101 public String getRootDirectory() 102 { 103 return _rootDirectory; 104 } 105 106 109 public void setArchivePath(RawString path) 110 { 111 _archivePath = path.getValue(); 112 } 113 114 117 public String getArchivePath() 118 { 119 return _archivePath; 120 } 121 122 125 public void setStartupMode(String mode) 126 throws ConfigException 127 { 128 _startupMode = DeployController.toStartupCode(mode); 129 } 130 131 134 public String getStartupMode() 135 { 136 return _startupMode; 137 } 138 139 142 public void setRedeployCheckInterval(Period period) 143 { 144 _redeployCheckInterval = period; 145 } 146 147 150 public Period getRedeployCheckInterval() 151 { 152 return _redeployCheckInterval; 153 } 154 155 158 public void setRedeployMode(String mode) 159 throws ConfigException 160 { 161 _redeployMode = DeployController.toRedeployCode(mode); 162 } 163 164 167 public String getRedeployMode() 168 { 169 return _redeployMode; 170 } 171 172 175 public DeployConfig getPrologue() 176 { 177 return null; 178 } 179 180 183 public void addBuilderProgram(BuilderProgram program) 184 { 185 _program.addProgram(program); 186 } 187 188 191 public BuilderProgram getBuilderProgram() 192 { 193 return _program; 194 } 195 196 199 public void addPropertyProgram(String name, Object value) 200 { 201 _program.addProgram(new ObjectAttributeProgram(name, value)); 202 } 203 204 207 public Path calculateRootDirectory() 208 { 209 return calculateRootDirectory(null); 210 } 211 212 215 public Path calculateRootDirectory(Map <String ,Object > varMap) 216 { 217 try { 218 String rawPath = getRootDirectory(); 219 Path rootDir = null; 220 221 if (rawPath != null) 222 rootDir = PathBuilder.lookupPath(rawPath, varMap); 223 224 if (rootDir != null) 225 return rootDir; 226 227 return Vfs.lookup(); 228 } catch (Exception e) { 229 log.log(Level.WARNING, e.toString(), e); 230 231 return null; 232 } 233 } 234 } 235 | Popular Tags |