AdminObjectResourceTestpublic 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 |
Fields Summary |
---|
static boolean | checked |
Methods Summary |
---|
public com.sun.enterprise.config.serverbeans.validation.Result | validate(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 void | validateAttribute(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}));
}
*/
|
|