1 23 24 package org.infoglue.cms.applications.managementtool.actions; 25 26 import java.util.HashMap ; 27 import java.util.List ; 28 import java.util.Map ; 29 30 import org.infoglue.cms.applications.common.actions.InfoGluePropertiesAbstractAction; 31 import org.infoglue.cms.controllers.kernel.impl.simple.ServerNodeController; 32 import org.infoglue.cms.entities.management.ServerNodeVO; 33 import org.infoglue.cms.exception.SystemException; 34 import org.infoglue.cms.security.InfoGlueAuthenticationFilter; 35 import org.infoglue.cms.util.CmsPropertyHandler; 36 import org.infoglue.cms.util.NotificationMessage; 37 import org.infoglue.cms.util.RemoteCacheUpdater; 38 import org.infoglue.deliver.util.CacheController; 39 40 import com.opensymphony.module.propertyset.PropertySet; 41 import com.opensymphony.module.propertyset.PropertySetManager; 42 43 49 50 public class ViewServerNodePropertiesAction extends InfoGluePropertiesAbstractAction 51 { 52 private static final long serialVersionUID = 1L; 53 54 private ServerNodeVO serverNodeVO = new ServerNodeVO(); 55 private PropertySet propertySet = null; 56 private List serverNodeVOList = null; 57 private String key = null; 58 59 public ViewServerNodePropertiesAction() 60 { 61 } 62 63 protected void initialize(Integer serverNodeId) throws Exception 64 { 65 if(serverNodeId != null && serverNodeId.intValue() > -1) 66 this.serverNodeVO = ServerNodeController.getController().getServerNodeVOWithId(serverNodeId); 67 68 Map args = new HashMap (); 69 args.put("globalKey", "infoglue"); 70 this.propertySet = PropertySetManager.getInstance("jdbc", args); 71 } 72 73 76 77 public String doExecute() throws Exception 78 { 79 this.initialize(getServerNodeId()); 80 81 return "success"; 82 } 83 84 private void populate(PropertySet ps, String key) 85 { 86 String value = this.getRequest().getParameter(key); 87 if(value != null && !value.equals("")) 88 ps.setString("serverNode_" + this.getServerNodeId() + "_" + key, value); 89 } 90 91 private void populateData(PropertySet ps, String key) 92 { 93 try 94 { 95 String value = this.getRequest().getParameter(key); 96 if(value != null && !value.equals("")) 97 ps.setData("serverNode_" + this.getServerNodeId() + "_" + key, value.getBytes("utf-8")); 98 } 99 catch(Exception e) 100 { 101 e.printStackTrace(); 102 } 103 } 104 105 108 109 public String doSave() throws Exception 110 { 111 Map args = new HashMap (); 112 args.put("globalKey", "infoglue"); 113 PropertySet ps = PropertySetManager.getInstance("jdbc", args); 114 115 populate(ps, "isPageCacheOn"); 116 populate(ps, "useSelectivePageCacheUpdate"); 117 populate(ps, "expireCacheAutomatically"); 118 populate(ps, "cacheExpireInterval"); 119 populate(ps, "deliverRequestTimeout"); 120 populate(ps, "session.timeout"); 121 populate(ps, "compressPageCache"); 122 populate(ps, "compressPageResponse"); 123 populate(ps, "siteNodesToRecacheOnPublishing"); 124 populate(ps, "recachePublishingMethod"); 125 populate(ps, "recacheUrl"); 126 populate(ps, "useUpdateSecurity"); 127 populate(ps, "allowedAdminIP"); 128 populate(ps, "pageKey"); 129 populate(ps, "cmsBaseUrl"); 130 populate(ps, "cmsFullBaseUrl"); 131 populate(ps, "componentEditorUrl"); 132 populate(ps, "componentRendererUrl"); 133 populate(ps, "componentRendererAction"); 134 populate(ps, "editOnSiteUrl"); 135 populate(ps, "useFreeMarker"); 136 populate(ps, "webServerAddress"); 137 populate(ps, "applicationBaseAction"); 138 populate(ps, "digitalAssetBaseUrl"); 139 populate(ps, "imagesBaseUrl"); 140 populate(ps, "digitalAssetPath"); 141 populate(ps, "urlFormatting"); 142 populate(ps, "enableNiceURI"); 143 populate(ps, "niceURIEncoding"); 144 populate(ps, "niceURIAttributeName"); 145 populate(ps, "requestArgumentDelimiter"); 146 populate(ps, "errorHandling"); 147 populate(ps, "errorUrl"); 148 populate(ps, "errorBusyUrl"); 149 populate(ps, "externalThumbnailGeneration"); 150 populate(ps, "URIEncoding"); 151 populate(ps, "workflowEncoding"); 152 populate(ps, "formsEncoding"); 153 populate(ps, "useShortTableNames"); 154 populate(ps, "logDatabaseMessages"); 155 populate(ps, "statistics.enabled"); 156 populate(ps, "statisticsLogPath"); 157 populate(ps, "statisticsLogOneFilePerDay"); 158 populate(ps, "statisticsLogger"); 159 populate(ps, "enablePortal"); 160 populate(ps, "portletBase"); 161 populate(ps, "mail.smtp.host"); 162 populate(ps, "mail.smtp.auth"); 163 populate(ps, "mail.smtp.user"); 164 populate(ps, "mail.smtp.password"); 165 populate(ps, "mail.contentType"); 166 populate(ps, "systemEmailSender"); 167 populate(ps, "warningEmailReceiver"); 168 populate(ps, "loginUrl"); 169 populate(ps, "logoutUrl"); 170 populate(ps, "invalidLoginUrl"); 171 populate(ps, "successLoginBaseUrl"); 172 populate(ps, "authenticatorClass"); 173 populate(ps, "authorizerClass"); 174 populate(ps, "serverName"); 175 populate(ps, "authConstraint"); 176 populate(ps, "extraParametersFile"); 177 populateData(ps, "extraSecurityParameters"); 178 populate(ps, "casValidateUrl"); 179 populate(ps, "casServiceUrl"); 180 populate(ps, "casLogoutUrl"); 181 182 populate(ps, "deliver_loginUrl"); 183 populate(ps, "deliver_logoutUrl"); 184 populate(ps, "deliver_invalidLoginUrl"); 185 populate(ps, "deliver_successLoginBaseUrl"); 186 populate(ps, "deliver_authenticatorClass"); 187 populate(ps, "deliver_authorizerClass"); 188 populate(ps, "deliver_serverName"); 189 populate(ps, "deliver_authConstraint"); 190 populate(ps, "deliver_extraParametersFile"); 191 populateData(ps, "deliver_extraSecurityParameters"); 192 populate(ps, "deliver_security.anonymous.username"); 193 populate(ps, "deliver_security.anonymous.password"); 194 populate(ps, "deliver_casValidateUrl"); 195 populate(ps, "deliver_casServiceUrl"); 196 populate(ps, "deliver_casLogoutUrl"); 197 populateData(ps, "shortcuts"); 198 199 populate(ps, "protectContentTypes"); 200 populate(ps, "protectWorkflows"); 201 populate(ps, "protectCategories"); 202 203 populate(ps, "maxRows"); 204 populate(ps, "showContentVersionFirst"); 205 populate(ps, "tree"); 206 populate(ps, "treemode"); 207 populate(ps, "showComponentsFirst"); 208 populate(ps, "showAllWorkflows"); 209 populate(ps, "editOnSight"); 210 populate(ps, "previewDeliveryUrl"); 211 populate(ps, "stagingDeliveryUrl"); 212 populateData(ps, "internalDeliveryUrls"); 213 populateData(ps, "publicDeliveryUrls"); 214 populate(ps, "edition.pageSize"); 215 populate(ps, "content.tree.sort"); 216 populate(ps, "structure.tree.sort"); 217 populate(ps, "structure.tree.isHidden"); 218 populate(ps, "disableEmptyUrls"); 219 populate(ps, "cacheUpdateAction"); 220 populate(ps, "logPath"); 221 222 populate(ps, "logTransactions"); 223 populate(ps, "enableExtranetCookies"); 224 populate(ps, "useAlternativeBrowserLanguageCheck"); 225 populate(ps, "caseSensitiveRedirects"); 226 populate(ps, "useDNSNameInURI"); 227 228 populate(ps, "extranetCookieTimeout"); 229 populate(ps, "webServicesBaseUrl"); 230 populate(ps, "publicationThreadDelay"); 231 populate(ps, "pathsToRecacheOnPublishing"); 232 populate(ps, "disableTemplateDebug"); 233 populate(ps, "dbRelease"); 234 populate(ps, "dbUser"); 235 populate(ps, "dbPassword"); 236 populate(ps, "masterServer"); 237 populate(ps, "slaveServer"); 238 populate(ps, "buildName"); 239 populate(ps, "adminToolsPath"); 240 populate(ps, "dbScriptPath"); 241 populate(ps, "digitalAssetUploadPath"); 242 populate(ps, "inputCharacterEncoding"); 243 populate(ps, "deliver_inputCharacterEncoding"); 244 populate(ps, "protectDeliverWorking"); 245 populate(ps, "protectDeliverPreview"); 246 247 try 248 { 249 CacheController.clearServerNodeProperty(); 250 InfoGlueAuthenticationFilter.initializeCMSProperties(); 251 } 252 catch (SystemException e) 253 { 254 e.printStackTrace(); 255 } 256 257 NotificationMessage notificationMessage = new NotificationMessage("ViewServerNodePropertiesAction.doSave():", "ServerNodeProperties", this.getInfoGluePrincipal().getName(), NotificationMessage.SYSTEM, "0", "ServerNodeProperties"); 258 RemoteCacheUpdater.getSystemNotificationMessages().add(notificationMessage); 260 261 return "save"; 262 } 263 264 267 268 public String doDeleteProperty() throws Exception 269 { 270 Map args = new HashMap (); 271 args.put("globalKey", "infoglue"); 272 PropertySet ps = PropertySetManager.getInstance("jdbc", args); 273 274 ps.remove("serverNode_" + this.getServerNodeId() + "_" + key); 275 276 try 277 { 278 CacheController.clearServerNodeProperty(); 279 InfoGlueAuthenticationFilter.initializeCMSProperties(); 280 } 281 catch (SystemException e) 282 { 283 e.printStackTrace(); 284 } 285 286 NotificationMessage notificationMessage = new NotificationMessage("ViewServerNodePropertiesAction.doSave():", "ServerNodeProperties", this.getInfoGluePrincipal().getName(), NotificationMessage.SYSTEM, "0", "ServerNodeProperties"); 287 RemoteCacheUpdater.getSystemNotificationMessages().add(notificationMessage); 289 290 return "save"; 291 } 292 293 296 297 public String doSaveAndExit() throws Exception 298 { 299 doSave(); 300 301 return "saveAndExit"; 302 } 303 304 public java.lang.Integer getServerNodeId() 305 { 306 return this.serverNodeVO.getServerNodeId(); 307 } 308 309 public void setServerNodeId(java.lang.Integer serverNodeId) throws Exception 310 { 311 this.serverNodeVO.setServerNodeId(serverNodeId); 312 } 313 314 public ServerNodeVO getServerNodeVO() 315 { 316 return serverNodeVO; 317 } 318 319 public PropertySet getPropertySet() 320 { 321 return propertySet; 322 } 323 324 public String getPropertyValue(String prefix, String key) 325 { 326 String value = propertySet.getString("serverNode_" + this.getServerNodeId() + "_" + prefix + "_" + key); 327 328 return (value != null ? value : ""); 329 } 330 331 public String getPropertyValue(String key) 332 { 333 String value = propertySet.getString("serverNode_" + this.getServerNodeId() + "_" + key); 334 335 return (value != null ? value : ""); 336 } 337 338 public String getDataPropertyValue(String key) throws Exception 339 { 340 byte[] valueBytes = propertySet.getData("serverNode_" + this.getServerNodeId() + "_" + key); 341 342 return (valueBytes != null ? new String (valueBytes, "utf-8") : ""); 343 } 344 345 public String getDataPropertyValue(String prefix, String key) throws Exception 346 { 347 byte[] valueBytes = propertySet.getData("serverNode_" + this.getServerNodeId() + "_" + prefix + "_" + key); 348 349 return (valueBytes != null ? new String (valueBytes, "utf-8") : ""); 350 } 351 352 public List getServerNodeVOList() 353 { 354 return serverNodeVOList; 355 } 356 357 public String getKey() 358 { 359 return key; 360 } 361 362 public void setKey(String key) 363 { 364 this.key = key; 365 } 366 } 367 | Popular Tags |