1 23 24 31 32 package com.sun.enterprise.admin.verifier.tests; 33 34 37 38 import com.sun.enterprise.config.serverbeans.Server; 41 import com.sun.enterprise.config.serverbeans.*; 42 import com.sun.enterprise.config.serverbeans.Resources; 43 import com.sun.enterprise.config.serverbeans.Applications; 44 import com.sun.enterprise.config.ConfigContext; 45 import com.sun.enterprise.config.ConfigContextEvent; 46 import com.sun.enterprise.config.ConfigException; 47 import com.sun.enterprise.config.serverbeans.JdbcResource; 48 49 import com.sun.enterprise.admin.verifier.*; 50 51 import java.util.logging.Logger ; 53 import java.util.logging.Level ; 54 import com.sun.logging.LogDomains; 55 56 57 public class JdbcResourceTest extends ServerXmlTest implements ServerCheck { 58 59 static Logger _logger = LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 61 62 public JdbcResourceTest() { 63 } 64 65 public Result check(ConfigContext context) { 67 Result result; 68 result = super.getInitializedResult(); 69 96 return result; 97 } 98 99 public Result check(ConfigContextEvent ccce) { 101 Result result = new Result(); 102 103 String beanName = ccce.getBeanName(); 104 if(beanName!=null) { 105 result.passed("Save to be implemented"); 106 return result; 107 } 108 109 ConfigContext context = ccce.getConfigContext(); 110 Object value = ccce.getObject(); 111 JdbcResource jdbc = (JdbcResource)value; 112 boolean isPool = false; 113 String pool = jdbc.getPoolName(); 114 115 if(StaticTest.checkObjectName(jdbc.getJndiName(), result)) 117 result.passed("Valid Object Name"); 118 else { 119 result.failed("JDBC Resource Jndi-Name Invalid "); 120 return result; 121 } 122 124 125 try { 126 Domain domain = (Domain)context.getRootConfigBean(); 130 Resources resource = domain.getResources(); 131 JdbcConnectionPool[] connection = resource.getJdbcConnectionPool(); 132 for(int i=0;i<connection.length;i++){ 133 if(connection[i].getName().equals(pool)) 134 isPool=true; 135 } 136 if(isPool) 137 result.passed("Valid Connection Pool"); 138 else 139 result.failed("Connection Pool Not Available"); 140 } 141 catch(Exception e) { 142 _logger.log(Level.FINE, "serverxmlverifier.exception", e); 144 result.failed("Exception : " + e.getMessage()); 145 } 146 return result; 147 } 148 } 149 | Popular Tags |