forked from hyperic/hq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HQ-1860] - Licensing requirement: need link in HQ enterprise install…
…er pointing to MySQL enterprise Did some refactoring and added some classes to support adding additional text around setting options
- Loading branch information
dcrutchf
committed
Sep 16, 2009
1 parent
abadb24
commit 2525b18
Showing
5 changed files
with
197 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.hyperic.util.config; | ||
|
||
public class ConfigOptionDisplay { | ||
private String name; | ||
private String description; | ||
private String note; | ||
|
||
public ConfigOptionDisplay() { | ||
this(null); | ||
} | ||
|
||
public ConfigOptionDisplay(String name) { | ||
this(name, null); | ||
} | ||
|
||
public ConfigOptionDisplay(String name, String description) { | ||
this(name, description, null); | ||
} | ||
|
||
public ConfigOptionDisplay(String name, String description, String note) { | ||
this.name = name; | ||
this.description = description; | ||
this.note = note; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getNote() { | ||
return note; | ||
} | ||
|
||
public void setNote(String note) { | ||
this.note = note; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.hyperic.util.config; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class InstallConfigOption extends ConfigOption implements Serializable { | ||
private List _values = new ArrayList(); // Values the enum holds | ||
|
||
/** | ||
* This constructor allows you to create an InstallConfigOption | ||
* and behaves pretty much like the EnumConfigOption class, however | ||
* it deals with ConfigOptionDisplay objects rather than raw Strings. | ||
*/ | ||
public InstallConfigOption(String optName, String optDesc, ConfigOptionDisplay defValue, ConfigOptionDisplay[] installOptionValues) | ||
{ | ||
this(optName, optDesc, defValue, installOptionValues, null); | ||
} | ||
|
||
public InstallConfigOption(String optName, String optDesc, ConfigOptionDisplay defValue, ConfigOptionDisplay[] installOptionValues, String confirm) { | ||
super(optName, optDesc, defValue.getName()); | ||
|
||
for (int i = 0; i < installOptionValues.length; i++) { | ||
if (installOptionValues[i] != null && installOptionValues[i].getName().length() > 0) { | ||
_values.add(installOptionValues[i]); | ||
} | ||
} | ||
|
||
if (confirm != null) setConfirm(confirm); | ||
} | ||
|
||
public void addValue(ConfigOptionDisplay option){ | ||
_values.add(option); | ||
} | ||
|
||
public List getValues(){ | ||
return _values; | ||
} | ||
|
||
public void checkOptionIsValid(String value) throws InvalidOptionValueException { | ||
boolean valid = false; | ||
|
||
for (int x = 0; x < _values.size(); x++) { | ||
if (((ConfigOptionDisplay) _values.get(x)).getName().equals(value)) { | ||
valid = true; | ||
|
||
break; | ||
} | ||
} | ||
|
||
if (!valid) throw invalidOption("must be one of options presented below. value: " + value); | ||
} | ||
|
||
public String getDefault() { | ||
String defVal = super.getDefault(); | ||
|
||
//if no default was specified, use the first in the list | ||
if ((defVal == null) && (_values.size() > 0)) { | ||
defVal = ((ConfigOptionDisplay) _values.get(0)).getName(); | ||
} | ||
|
||
return defVal; | ||
} | ||
|
||
protected Object clone() throws CloneNotSupportedException { | ||
// TODO Auto-generated method stub | ||
return super.clone(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters