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.ConfigContextEvent; 29 import com.sun.enterprise.config.ConfigException; 30 import com.sun.enterprise.config.serverbeans.ConnectorConnectionPool; 31 import com.sun.enterprise.config.serverbeans.ServerBeansFactory; 32 import com.sun.enterprise.config.serverbeans.ServerTags; 33 import com.sun.enterprise.config.serverbeans.validation.GenericValidator; 34 import com.sun.enterprise.config.serverbeans.validation.Result; 35 import com.sun.enterprise.config.serverbeans.validation.ValidationDescriptor; 36 import com.sun.enterprise.connectors.ConnectorRuntime; 37 import java.util.Set ; 38 import java.util.logging.Level ; 39 40 46 47 public class ConnectorConnectionPoolTest extends GenericValidator { 48 49 int maxPoolSize = 0; 50 51 public ConnectorConnectionPoolTest(ValidationDescriptor desc) { 52 super(desc); 53 } 54 55 public Result validate(ConfigContextEvent cce) { 56 Result result = super.validate(cce); String choice = cce.getChoice(); 58 59 if(choice.equals(StaticTest.UPDATE)) { 60 validateAttribute(cce.getName(), (String ) cce.getObject(), result); 61 } 62 return result; 63 } 64 65 66 67 68 69 public void validateAttribute(String name, String value, Result result) { 70 if(value == null || value.equals("")) 71 return; 72 if(name.equals(ServerTags.CONNECTION_DEFINITION_NAME)) { 73 } 74 } 75 76 public void validateAttribute(String name, String value, String rarName, Result result) { 77 try { 78 String connDefnNames[] = ConnectorRuntime.getRuntime().getConnectionDefinitionNames(rarName); 79 boolean available = false; 80 for(int i=0;i<connDefnNames.length;i++) { 81 if(value.equals(connDefnNames[i])) { 82 available = true; 83 break; 84 } 85 } 86 if(!available) 87 result.failed(smh.getLocalString(getClass().getName() + ".connDefnNotAvl", 88 "Attribute(conndefn={0}) : Invalid Connection Definition Name", new Object []{value})); 89 } catch(Exception e) { 90 _logger.log(Level.FINE, "domainxmlverifier.exception", e); 91 } 92 } 93 94 private final ConnectorConnectionPool getConnectorConnectionPool(final ConfigContextEvent cce) throws ConfigException{ 95 return (ConnectorConnectionPool) cce.getValidationTarget(); 96 } 97 98 } 99 | Popular Tags |