FileDocCategorySizeDatePackage
ConfigContextEvent.javaAPI DocGlassfish v2 API8356Fri May 04 22:31:18 BST 2007com.sun.enterprise.config

ConfigContextEvent

public class ConfigContextEvent extends Notification
event used for notification of changes

Fields Summary
public static final String
PRE_ACCESS
public static final String
POST_ACCESS
public static final String
PRE_ADD_CHANGE
public static final String
POST_ADD_CHANGE
public static final String
PRE_UPDATE_CHANGE
public static final String
POST_UPDATE_CHANGE
public static final String
PRE_DELETE_CHANGE
public static final String
POST_DELETE_CHANGE
public static final String
PRE_SET_CHANGE
public static final String
POST_SET_CHANGE
public static final String
PRE_FLUSH_CHANGE
public static final String
POST_FLUSH_CHANGE
private static long
eventCounter
private String
name
private Object
value
private String
choice
private String
beanName
private Object
classObject
Constructors Summary
public ConfigContextEvent(ConfigContext ctx, String eventType)
Create a new ConfigChangeEvent event.

param
ctx ConfigContext which is the source


    //</addition>



                     

         

        super(eventType, ctx, ++eventCounter, System.currentTimeMillis());

    
public ConfigContextEvent(ConfigContext ctx, String eventType, String name, Object value, String choice)

        this(ctx, eventType, name, value, choice, null);
   
public ConfigContextEvent(ConfigContext ctx, String eventType, String name, Object value, String choice, String beanName)

        this(ctx,eventType);
        this.name = name;
        this.value = value;
        this.choice = choice;
        this.beanName = beanName;
    
Methods Summary
public java.lang.StringgetBeanName()


        return beanName;

    
public java.lang.StringgetChoice()


        return choice;

    
public java.lang.ObjectgetClassObject()
The function returns the classObject which is set through the base config bean. The classObject represents the actual config bean that has been invoked through the admin GUI

return
Object


        return classObject;

    
public ConfigContextgetConfigContext()
Returns ConfigContext which is the source of the event. The difference

see
getSource()
return
ConfigContext


        return (ConfigContext)getSource();

    
public java.lang.StringgetName()


        return name;

    
public java.lang.ObjectgetObject()


        return value;

    
public ConfigBeangetValidationTarget()
Return the object which is the target of the validation, given the {@link ConfigContextEvent}

param
cce the {@link ConfigContextEvent} from which the target is to be found
return
the {@link ConfigBean} target object which is to be validated.
throws
{@link ConfigException} if the validation target cannot be obtained.

        final String choice = this.getChoice();
        if (choice.equals("VALIDATE")){
            return (ConfigBean) this.getObject();
        } else if (choice.equals("ADD")) {
            return (ConfigBean) this.getObject();
        } else if (choice.equals("DELETE")) {
            return (ConfigBean) this.getObject();
        } else if (choice.equals("UPDATE")) {
            return (ConfigBean) this.getClassObject();
        } else if (choice.equals("SET")) {
            if (null == this.getBeanName()){
                if (this.getName().equals("Description")){
                    throw new ConfigException("Internal error - invalid condition - attempting to validate a SET operation with a \"Description\" object");
                } else {
                    return (ConfigBean) this.getObject();
                }
            } else {
                return (ConfigBean) this.getClassObject();
            }
        } else {
            throw new ConfigException("Internal error - invalid choice received: \""+choice+"\". Only expecting ADD, DELETE, UPDATE or SET");
        }
    
public voidsetBeanName(java.lang.String beanName)


        this.beanName = beanName;

    
public voidsetClassObject(java.lang.Object obj)
The function is called from the ConfigBean class and sets the actual config bean as the classObject.

param
Object - ConfigBean object representing the actual config bean


        this.classObject = obj;

    
public java.lang.StringtoString()
Return a String representation.


        return this.getClass().getName() + " -- " 

                + " [Id:" + this.getSequenceNumber()

                + ", ts:" + this.getTimeStamp() + "]";