1 package com.jcorporate.expresso.services.controller.configuration; 2 3 66 67 import com.jcorporate.expresso.core.misc.Base64; 68 import com.jcorporate.expresso.kernel.exception.ChainedException; 69 import org.apache.log4j.Logger; 70 import org.apache.struts.action.ActionForm; 71 72 import java.io.Serializable ; 73 import java.util.Random ; 74 75 81 82 public class CreateSettingsBean extends ActionForm implements Serializable { 83 84 private static final Logger log = Logger.getLogger(CreateSettingsBean.class); 85 86 private String dbConfig = "hypersonic.xml"; 87 private String loginName = "sa"; 88 private String databaseURL = "jdbc:hsqldb:%web-app%WEB-INF/db/default/default"; 89 private String password = ""; 90 private boolean useJNDI = false; 91 private JNDIBean jndiConfig; 92 private String runtimeName = "default"; 93 private boolean useCaching = true; 94 private boolean useStrongEncryption = false; 95 private String tempFileLocation; 96 private String secretKey; 97 98 101 public CreateSettingsBean() { 102 String cwd = System.getProperty("user.dir", ""); 103 String separator = System.getProperty("file.separator", ""); 104 tempFileLocation = cwd + separator + "temp"; 105 Random r = new java.util.Random (); 106 byte theBytes[] = new byte[32]; 107 r.nextBytes(theBytes); 108 try { 109 int numTimes = r.nextInt(256); 110 for (int i = 0; i < numTimes; i++) { 113 theBytes = new com.jcorporate.expresso.core.security.StringHash().produceHash(theBytes); 114 } 115 116 secretKey = Base64.encode(theBytes); 117 } catch (ChainedException ex) { 118 log.warn("Unable to load SHA1 Hash", ex); 119 } 120 } 121 122 public String getDbConfig() { 123 return dbConfig; 124 } 125 126 public void setDbConfig(String dbConfig) { 127 this.dbConfig = dbConfig; 128 } 129 130 public void setLoginName(String loginName) { 131 this.loginName = loginName; 132 } 133 134 public String getLoginName() { 135 return loginName; 136 } 137 138 public void setDatabaseURL(String databaseURL) { 139 this.databaseURL = databaseURL; 140 } 141 142 public String getDatabaseURL() { 143 return databaseURL; 144 } 145 146 public void setPassword(String password) { 147 this.password = password; 148 } 149 150 public String getPassword() { 151 return password; 152 } 153 154 public void setUseJNDI(boolean useJNDI) { 155 this.useJNDI = useJNDI; 156 } 157 158 public boolean isUseJNDI() { 159 return useJNDI; 160 } 161 162 public void setJndiConfig(JNDIBean jndiConfig) { 163 this.jndiConfig = jndiConfig; 164 } 165 166 public JNDIBean getJndiConfig() { 167 return jndiConfig; 168 } 169 170 public void setRuntimeName(String runtimeName) { 171 this.runtimeName = runtimeName; 172 } 173 174 public String getRuntimeName() { 175 return runtimeName; 176 } 177 178 public boolean isUseCaching() { 179 return useCaching; 180 } 181 182 public void setUseCaching(boolean useCaching) { 183 this.useCaching = useCaching; 184 } 185 186 public void setUseStrongEncryption(boolean useStrongEncryption) { 187 this.useStrongEncryption = useStrongEncryption; 188 } 189 190 public boolean isUseStrongEncryption() { 191 return useStrongEncryption; 192 } 193 194 public void setTempFileLocation(String randomSeedLocation) { 195 this.tempFileLocation = randomSeedLocation; 196 } 197 198 public String getTempFileLocation() { 199 return tempFileLocation; 200 } 201 202 public void setSecretKey(String secretKey) { 203 this.secretKey = secretKey; 204 } 205 206 public String getSecretKey() { 207 return secretKey; 208 } 209 210 211 } | Popular Tags |