1 8 9 package com.sleepycat.je.config; 10 11 12 19 public class ConfigParam { 20 public static final String CONFIG_DELIM = ";"; 22 23 protected String name; 24 private String defaultValue; 25 private String description; 26 private boolean mutable; 27 private boolean forReplication; 28 29 32 public ConfigParam(String configName, 33 String configDefault, 34 boolean mutable, 35 boolean forReplication, 36 String description) 37 throws IllegalArgumentException { 38 name = configName; 39 defaultValue = configDefault; 40 this.mutable = mutable; 41 this.description = description; 42 this.forReplication = forReplication; 43 44 45 validateName(configName); 46 validateValue(configDefault); 47 48 51 EnvironmentParams.addSupportedParam(this); 52 } 53 54 public String getName() { 55 return name; 56 } 57 58 public String getDescription() { 59 return description; 60 } 61 62 public String getExtraDescription() { 63 return null; 65 } 66 67 public String getDefault() { 68 return defaultValue; 69 } 70 71 public boolean isMutable() { 72 return mutable; 73 } 74 75 public boolean isForReplication() { 76 return forReplication; 77 } 78 79 public void setForReplication(boolean forReplication) { 80 this.forReplication = forReplication; 81 } 82 83 86 public void validate() 87 throws IllegalArgumentException { 88 89 validateName(name); 90 validateValue(defaultValue); 91 } 92 93 96 private void validateName(String name) 97 throws IllegalArgumentException { 98 99 if ((name == null) || (name.length() < 1)) { 100 throw new IllegalArgumentException (" A configuration parameter" + 101 " name can't be null or 0" + 102 " length"); 103 } 104 } 105 106 109 public void validateValue(String value) 110 throws IllegalArgumentException { 111 } 112 113 public String toString() { 114 return name; 115 } 116 } 117 | Popular Tags |