Methods Summary |
---|
public boolean | check(com.sun.enterprise.config.ConfigContextEvent ccce)
String name = ccce.getName();
Object value = ccce.getObject();
ConfigContext context = ccce.getConfigContext();
String choice = ccce.getChoice();
String beanName = ccce.getBeanName();
if(name == null && beanName == null)
return true;
boolean retValue = false;
if(testCases.isEmpty())
loadTestInfo();
TestInformation ti = (TestInformation)testCases.get(name);
if(ti == null && beanName != null)
ti =(TestInformation)testCases.get(beanName);
String testClass;
try {
testClass = ti.getClassName();
}
catch(Exception e){
return true;
}
try {
Class test = Class.forName(testClass);
ServerCheck tester = (ServerCheck)test.newInstance();
result = tester.check(ccce);
if (result.getStatus() == Result.PASSED)
retValue = true;
else
retValue = false;
}
catch(Throwable tt) {
// Logger
_logger.log(Level.FINE, "serverxmlverifier.error_check", tt);
retValue = true;
}
return retValue;
|
private java.io.File | getFileFromCP(java.lang.String name)
File cand = null;
String classPath = System.getProperty("java.class.path");
String classPathSep = File.pathSeparator;
StringTokenizer tokens = new StringTokenizer(classPath,classPathSep);
while(tokens.hasMoreTokens()) {
String fileName = tokens.nextToken();
if(fileName.endsWith("appserv-rt.jar")) {
// File Path separator in classpath set in server.xml is
// always forward-slash (/), so trying forward slash first
int slashPos = fileName.lastIndexOf('/");
if (slashPos == -1) {
slashPos = fileName.lastIndexOf(File.separator);
}
if (slashPos != -1) {
String libPath = fileName.substring(0, slashPos);
cand = new File(libPath,name);
}
break;
}
}
return cand;
|
private java.io.File | getTestFile(java.lang.String name)
String iasHome = System.getProperty("s1as.home");
if(iasHome!=null) {
File temp = new File(iasHome,"lib");
temp = new File(temp,name);
if(temp.exists())
return temp;
else
return null;
}
else
return getFileFromCP(name);
|
public java.util.HashMap | getTests()
return testCases;
|
public boolean | loadTestInfo()
boolean allIsWell = true;
if(testCases.isEmpty()) {
if (debug) {
// Logging
_logger.log(Level.INFO, "serverxmlverifier.getting_testnamefrom_propertyfile");
}
File inputFile = getTestFile(testFileName);
try {
// parse the xml file
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = db.parse(inputFile);
NodeList list = doc.getElementsByTagName("description");
if (list.getLength()>0) {
Element e = (Element) list.item(0);
description = e.getFirstChild().getNodeValue().trim();
}
list = doc.getElementsByTagName("test");
for (int i=0;i<list.getLength();i++) {
Element e = (Element) list.item(i);
NodeList nl = e.getChildNodes();
TestInformation ti = new TestInformation();
String testName = "";
for (int j=0;j<nl.getLength();j++) {
String nodeName = nl.item(j).getNodeName();
if("test-name".equals(nodeName.trim())) {
Node el = (Node)nl.item(j);
testName = el.getFirstChild().getNodeValue().trim();
}
if ("test-class".equals(nodeName.trim())) {
Node el = (Node) nl.item(j);
ti.setClassName(el.getFirstChild().getNodeValue().trim());
}
if ("minimum-version".equals(nodeName.trim())) {
Node el = (Node) nl.item(j);
ti.setMinimumVersion(el.getFirstChild().getNodeValue().trim());
}
if ("maximum-version".equals(nodeName.trim())) {
Node el = (Node) nl.item(j);
ti.setMaximumVersion(el.getFirstChild().getNodeValue().trim());
}
}
testCases.put(testName,ti);
}
} catch (ParserConfigurationException e) {
// Logging
_logger.log(Level.WARNING, "serverxmlverifier.parser_error", e);
allIsWell = false;
} catch (org.xml.sax.SAXException e) {
// Logging
_logger.log(Level.WARNING, "serverxmlverifier.sax_error", e);
allIsWell = false;
} catch (IOException e) {
// Logging
_logger.log(Level.WARNING, "serverxmlverifier.error_loading_xmlfile");
allIsWell = false;
}
}
return allIsWell;
|
public void | postAccessNotification(com.sun.enterprise.config.ConfigContextEvent ccce)after config add, delete, set, update or flush. type is in ccce
|
public void | postChangeNotification(com.sun.enterprise.config.ConfigContextEvent ccce)after config add, delete, set, update or flush. type is in ccce
|
public void | preAccessNotification(com.sun.enterprise.config.ConfigContextEvent ccce)before config add, delete, set, update or flush. type is in ccce
|
public void | preChangeNotification(com.sun.enterprise.config.ConfigContextEvent ccce)before config add, delete, set, update or flush. type is in ccce
if(! check(ccce))
throw new AFRuntimeException(result.getErrorDetails().toString());
|
public static void | setFile(java.lang.String file)
fileUrl = file;
|