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

AdminObjectResourceTest

public class AdminObjectResourceTest extends com.sun.enterprise.config.serverbeans.validation.GenericValidator
Custom Test for Admin Object Resource Test which calls the Generic Validation before performing custom tests
author
Srinivas Krishnan
version
2.0

Fields Summary
static boolean
checked
Constructors Summary
public AdminObjectResourceTest(com.sun.enterprise.config.serverbeans.validation.ValidationDescriptor desc)

    
       
        super(desc);
    
Methods Summary
public com.sun.enterprise.config.serverbeans.validation.Resultvalidate(com.sun.enterprise.config.ConfigContextEvent cce)

        Result result = super.validate(cce); // Before doing custom validation do basic validation
        
        if(cce.getChoice().equals(StaticTest.UPDATE)) {
            try {
                ConfigContext context = cce.getConfigContext();
                String name = cce.getName();
                String value = (String) cce.getObject();
                AdminObjectResource admin = (AdminObjectResource)cce.getClassObject();
                validateAttribute(name, value,  admin, result);
            } catch(Exception e) {
                _logger.log(Level.FINE, "domainxmlverifier.exception", e);
            }
        }
        
        if(cce.getChoice().equals(StaticTest.ADD) || cce.getChoice().equals(StaticTest.VALIDATE)) {
            try {
                ConfigContext context = cce.getConfigContext();
                Object value = cce.getObject();
                AdminObjectResource admin = (AdminObjectResource)value;
                validateAttribute(ServerTags.RES_TYPE, admin.getResType(),  admin, result);
            } catch(Exception e) {
                _logger.log(Level.FINE, "domainxmlverifier.exception", e);
            }
        }
        return result;
    
public voidvalidateAttribute(java.lang.String name, java.lang.String value, com.sun.enterprise.config.ConfigBean admin, com.sun.enterprise.config.serverbeans.validation.Result result)

       
/* 
        if(name.equals(ServerTags.RES_TYPE)) {
            String restype = value;

            String resAdapter = ((AdminObjectResource)admin).getResAdapter();
            String resTypes[] = null;

            try {
                resTypes = ConnectorRuntime.getRuntime().getAdminObjectInterfaceNames(resAdapter);
            } catch(Exception e) {
                       _logger.log(Level.FINE, "domainxmlverifier.exception", e);
            }
            boolean available = false;
            if(resTypes != null) {
                for(int i=0;i<resTypes.length;i++) {
                    if(restype.equals(resTypes[i])) {
                        available = true;
                        break;
                    }
                }
            }
            if(!available)
                    result.failed(smh.getLocalString(getClass().getName() + ".resAdapterNotAvl", 
                        "Attribute(restype={0}) : Invalid Resource Type ", new Object[]{restype}));
        }
*/