1 23 24 package com.sun.enterprise.config.serverbeans.validation.tests; 25 26 import java.util.logging.Level ; 27 28 import com.sun.enterprise.config.ConfigException; 29 import com.sun.enterprise.config.ConfigContextEvent; 30 import com.sun.enterprise.config.ConfigBean; 31 import com.sun.enterprise.config.serverbeans.validation.Result; 32 import com.sun.enterprise.config.serverbeans.validation.ValidationDescriptor; 33 import com.sun.enterprise.config.serverbeans.validation.GenericValidator; 34 35 41 abstract class DeployableAppTest extends GenericValidator 42 { 43 44 DeployableAppTest(final ValidationDescriptor desc){ 45 super(desc); 46 } 47 48 public Result validate(ConfigContextEvent cce) { 49 Result result = super.validate(cce); try{ 53 if(cce.getChoice().equals(StaticTest.UPDATE) || cce.getChoice().equals(StaticTest.DELETE)) { 54 55 if(!getObjectType(cce).equals("user")) 56 result.failed(smh.getLocalString(getClass().getName()+".systemAppNotChangeable", 57 "System Application, Attribute Not Changeable")); 58 } 59 } 60 catch (final ConfigException ce){ 61 _logger.log(Level.WARNING, "domainxmlverifier.exception", ce); 62 } 63 return result; 64 } 65 66 72 protected abstract String getObjectType(final ConfigBean app); 73 74 77 private String getObjectType(final ConfigContextEvent cce) throws ConfigException{ 82 return getObjectType(getApp(cce)); 83 } 84 85 private ConfigBean getApp(final ConfigContextEvent cce) throws ConfigException{ 86 return (ConfigBean) cce.getValidationTarget(); 87 } 88 89 90 } 91 92 93 94 | Popular Tags |