Result result = getInitializedResult();
try{
String earURI=getAbstractArchiveUri(descriptor);
com.sun.enterprise.tools.verifier.apiscan.packaging.Archive jar=new com.sun.enterprise.tools.verifier.apiscan.packaging.Archive(new File(earURI));
//See we do not care about bundled opt packages, as for an ear file
//there should not be any Class-Path entry.
com.sun.enterprise.tools.verifier.apiscan.packaging.ExtensionRef[] extRefs=jar.getExtensionRefs();
com.sun.enterprise.tools.verifier.apiscan.packaging.Archive[] allOptPkgs=com.sun.enterprise.tools.verifier.apiscan.packaging.Archive.getAllOptPkgsInstalledInJRE();
ArrayList<ExtensionRef> notFounds=new ArrayList<ExtensionRef>();
for(int i=0;i<extRefs.length;++i){
ExtensionRef ref=extRefs[i];
boolean found=false;
for(int j=0;j<allOptPkgs.length;++j){
if(ref.isSatisfiedBy(allOptPkgs[j])) {
found=true;
break;
}
}
if(!found) notFounds.add(ref);
}//for
if(notFounds.isEmpty()){
result.passed(smh.getLocalString(getClass().getName() + ".passed",
"All opt package dependency satisfied for this ear file."));
result.passed("");
}else{
result.failed(smh.getLocalString(getClass().getName() + ".failed","Some dependencies could not be satisfied for this ear file. See info below..."));
for(Iterator i=notFounds.iterator();i.hasNext();){
result.addErrorDetails(i.next().toString());
}
}
}catch(IOException e){
result.failed(e.toString());
}
return result;