1
package com.eucalyptus.configurable;
3
import org.apache.log4j.Logger;
4
import com.eucalyptus.configurable.PropertyDirectory.NoopEventListener;
5
import com.eucalyptus.event.PassiveEventListener;
7
public abstract class AbstractConfigurableProperty implements ConfigurableProperty {
9
private static Logger LOG = Logger.getLogger( AbstractConfigurableProperty.class );
10
protected String entrySetName;
11
private String fieldName;
12
protected String qualifiedName;
13
protected String description;
14
protected PropertyTypeParser typeParser;
15
protected String defaultValue;
16
protected Class definingClass;
17
protected Boolean readOnly;
18
protected String displayName;
19
protected ConfigurableFieldType widgetType;
20
protected String alias;
21
private PassiveEventListener<ConfigurableProperty> changeListener;
23
public AbstractConfigurableProperty( Class definingClass, String entrySetName, String propertyName, String defaultValue, String description, PropertyTypeParser typeParser, Boolean readOnly, String displayName, ConfigurableFieldType widgetType, String alias, PassiveEventListener changeListener ) {
24
this( definingClass, entrySetName, propertyName, defaultValue, description, typeParser, readOnly, displayName, widgetType, alias );
25
this.changeListener = changeListener;
27
public AbstractConfigurableProperty( Class definingClass, String entrySetName, String propertyName, String defaultValue, String description, PropertyTypeParser typeParser, Boolean readOnly, String displayName, ConfigurableFieldType widgetType, String alias ) {
28
this.definingClass = definingClass;
29
this.entrySetName = entrySetName.toLowerCase( );
30
this.fieldName = propertyName.toLowerCase( );
31
this.qualifiedName = this.entrySetName + "." + this.fieldName;
32
this.description = description;
33
this.typeParser = typeParser;
34
this.defaultValue = defaultValue;
35
this.readOnly = readOnly;
36
this.displayName = displayName;
37
this.widgetType = widgetType;
39
this.changeListener = NoopEventListener.NOOP;
42
public String getFieldName( ) {
43
return this.fieldName;
46
public String getEntrySetName( ) {
47
return this.entrySetName;
50
public String getQualifiedName( ) {
51
return this.qualifiedName;
54
public String getDescription( ) {
55
return this.description;
58
public PropertyTypeParser getTypeParser( ) {
59
return this.typeParser;
62
public String getDefaultValue( ) {
63
return this.defaultValue;
66
public abstract String getValue( );
68
public abstract String setValue( String s );
70
public void resetValue( ) {
71
this.setValue( this.defaultValue );
74
public Class getDefiningClass( ) {
75
return this.definingClass;
78
public String getDisplayName( ) {
79
return this.displayName;
82
public ConfigurableFieldType getWidgetType( ) {
83
return this.widgetType;
86
public String getAlias() {
90
public void fireChange() {
91
if( !NoopEventListener.class.equals( this.changeListener.getClass( ) ) ) {
92
this.changeListener.firingEvent( this );
b'\\ No newline at end of file'