JdbcResourceTestpublic class JdbcResourceTest extends ServerXmlTest implements ServerCheckPROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
Copyright 2001-2002 by iPlanet/Sun Microsystems, Inc.,
901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
All rights reserved. |
Fields Summary |
---|
static Logger | _logger |
Constructors Summary |
---|
public JdbcResourceTest()
|
Methods Summary |
---|
public Result | check(com.sun.enterprise.config.ConfigContext context)
Result result;
result = super.getInitializedResult();
// 8.0 XML Verifier
/*try {
Server server = (Server)context.getRootConfigBean();
Resources resource = server.getResources();
JdbcResource [] jdbcResources = resource.getJdbcResource();
JdbcConnectionPool[] connection = resource.getJdbcConnectionPool();
String poolName=null;
boolean isPool=false;
for(int i=0;i<jdbcResources.length;i++){
poolName=jdbcResources[i].getPoolName();
for(int j=0;j<connection.length;j++){
if(connection[j].getName().equals(poolName))
isPool=true;
}
if(isPool) {
result.passed("Valid Connection Pool");
isPool = false;
}
else
result.failed("Connection Pool " + poolName + " Not Available for jdbc resource " + jdbcResources[i].getJndiName() );
}
}
catch(Exception ex) {
// Logging
_logger.log(Level.FINE, "serverxmlverifier.exception", ex);
result.failed("Exception : " + ex.getMessage());
}*/
return result;
| public Result | check(com.sun.enterprise.config.ConfigContextEvent ccce)
Result result = new Result();
String beanName = ccce.getBeanName();
if(beanName!=null) {
result.passed("Save to be implemented");
return result;
}
ConfigContext context = ccce.getConfigContext();
Object value = ccce.getObject();
JdbcResource jdbc = (JdbcResource)value;
boolean isPool = false;
String pool = jdbc.getPoolName();
// check if jdbc resource jndi-name is valid object name Bug : 4698687 : start
if(StaticTest.checkObjectName(jdbc.getJndiName(), result))
result.passed("Valid Object Name");
else {
result.failed("JDBC Resource Jndi-Name Invalid ");
return result;
}
// End Bug : 4698687
try {
// 8.0 XML Verifier
//Server server = (Server)context.getRootConfigBean();
//Resources resource = server.getResources();
Domain domain = (Domain)context.getRootConfigBean();
Resources resource = domain.getResources();
JdbcConnectionPool[] connection = resource.getJdbcConnectionPool();
for(int i=0;i<connection.length;i++){
if(connection[i].getName().equals(pool))
isPool=true;
}
if(isPool)
result.passed("Valid Connection Pool");
else
result.failed("Connection Pool Not Available");
}
catch(Exception e) {
// Logging
_logger.log(Level.FINE, "serverxmlverifier.exception", e);
result.failed("Exception : " + e.getMessage());
}
return result;
|
|