1 23 24 package com.sun.enterprise.tools.verifier; 25 26 import com.sun.enterprise.deployment.Application; 27 import com.sun.enterprise.deployment.deploy.shared.AbstractArchive; 28 import com.sun.logging.LogDomains; 29 30 import java.util.logging.Logger ; 31 import java.util.logging.Level ; 32 import java.util.List ; 33 import java.lang.reflect.Method ; 34 import java.lang.reflect.Constructor ; 35 import java.io.File ; 36 37 public class AppVerifier { 38 39 static Logger _logger=LogDomains.getLogger(LogDomains.APPVERIFY_LOGGER); 40 Method verify = null; 41 Object verifier =null; 42 43 public AppVerifier() throws Exception { 44 init(); 45 } 46 47 private void init() throws Exception { 48 String name = "com.sun.enterprise.tools.verifier.Verifier"; 49 try { 50 Class verifierClass = Class.forName(name); 51 verify = verifierClass.getDeclaredMethod("verify", 52 new Class [] {Application.class, 53 AbstractArchive.class, 54 List .class, 55 File .class}); 56 Constructor constructor = verifierClass.getDeclaredConstructor(); 57 verifier = constructor.newInstance(); 58 } catch (ClassNotFoundException e) { 59 _logger.log(Level.SEVERE,"verifier.class.notfound", 60 new Object [] {name}); 61 throw e; 62 } 63 catch (NoSuchMethodException e) { 64 _logger.log(Level.SEVERE,"verifier.method.notfound",e); 65 throw e; 66 } catch (Exception e) { 67 _logger.log(Level.SEVERE,"verifier.intialization.error", e); 68 throw e; 69 } 70 } 71 72 public void verify(Application application, 73 AbstractArchive abstractArchive, 74 List classPath, 75 File jspOutDir) throws Exception { 76 Object result = verify.invoke(verifier, 77 new Object [] {application, abstractArchive, classPath, jspOutDir}); 78 if(((Integer )result).intValue() > 0) 79 throw new Exception ("Some verifier tests Failed."); 80 } 81 } 82 | Popular Tags |