FileDocCategorySizeDatePackage
ManagementRuleTest.javaAPI DocGlassfish v2 API4573Fri May 04 22:24:38 BST 2007com.sun.enterprise.config.serverbeans.validation.tests

ManagementRuleTest

public class ManagementRuleTest extends com.sun.enterprise.config.serverbeans.validation.GenericValidator

Fields Summary
static final List
EVENT_TYPES
static final List
LOG_LEVELS
Constructors Summary
public ManagementRuleTest(com.sun.enterprise.config.serverbeans.validation.ValidationDescriptor desc)

        super(desc);
    
Methods Summary
public voidvalidateElement(com.sun.enterprise.config.serverbeans.validation.ValidationContext valCtx)

    
        
    
         super.validateElement(valCtx);
         
         // this is temporaty code which should be removed after
         // "deep" childs validation will be implemented for add/set operations
         if( (valCtx.isADD() || valCtx.isSET()) && 
             valCtx.value instanceof ManagementRule)
         {
             try {
                Event event = ((ManagementRule)valCtx.value).getEvent();
                //eventtypes
                if(!EVENT_TYPES.contains(event.getType()))
                    valCtx.result.failed(smh.getLocalString(getClass().getName(),
                            valCtx.smh.getLocalString(getClass().getName() + ".wrongEventType",
                "Value {0} is not allowed for Event type", new Object[] {event.getType()})));
                //log-levels
                if(!LOG_LEVELS.contains(event.getLevel()))
                    valCtx.result.failed(smh.getLocalString(getClass().getName(),
                            valCtx.smh.getLocalString(getClass().getName() + ".wrongEventLevel",
                "Value {0} is not allowed for Event log level", new Object[] {event.getLevel()})));
             } catch (Exception e) {}
             
         }