use of org.glassfish.ejb.deployment.util.EjbBundleValidator in project Payara by payara.
the class EjbArchivist method validate.
/**
* validates the DOL Objects associated with this archivist, usually
* it requires that a class loader being set on this archivist or passed
* as a parameter
*/
@Override
public void validate(ClassLoader aClassLoader) {
ClassLoader cl = aClassLoader;
if (cl == null) {
cl = classLoader;
}
if (cl == null) {
return;
}
descriptor.setClassLoader(cl);
descriptor.visit(new EjbBundleValidator());
}
use of org.glassfish.ejb.deployment.util.EjbBundleValidator in project Payara by payara.
the class EjbCheckMgrImpl method check.
/**
* Check Ejb for spec. conformance
*
* @param descriptor Ejb descriptor
*/
public void check(Descriptor descriptor) throws Exception {
// run persistence tests first.
checkPersistenceUnits(EjbBundleDescriptorImpl.class.cast(descriptor));
// an EjbBundleDescriptor can have an WebServicesDescriptor
checkWebServices(descriptor);
// an EjbBundleDescriptor can have WebService References
checkWebServicesClient(descriptor);
if (verifierFrameworkContext.isPartition() && !verifierFrameworkContext.isEjb())
return;
EjbBundleDescriptorImpl bundleDescriptor = (EjbBundleDescriptorImpl) descriptor;
setDescClassLoader(bundleDescriptor);
// an ejb-ref is unresolved etc.
try {
EjbBundleValidator validator = new EjbBundleValidator();
validator.accept(bundleDescriptor);
} catch (Exception e) {
}
// initialize JDOC if bundle has CMP's
if (bundleDescriptor.containsCMPEntity()) {
try {
// See bug #6274161. We now pass an additional boolean
// to indicate whether we are in portable or AS mode.
jdc.init(bundleDescriptor, context.getClassLoader(), getAbstractArchiveUri(bundleDescriptor), verifierFrameworkContext.isPortabilityMode());
} catch (Throwable ex) {
context.setJDOException(ex);
}
}
// set the JDO Codegenerator into the context
context.setJDOCodeGenerator(jdc);
// run the ParseDD test
if (bundleDescriptor.getSpecVersion().compareTo("2.1") < 0) {
// NOI18N
EjbDeploymentDescriptorFile ddf = new EjbDeploymentDescriptorFile();
File file = new File(getAbstractArchiveUri(bundleDescriptor), ddf.getDeploymentDescriptorPath());
FileInputStream is = new FileInputStream(file);
try {
if (is != null) {
Result result = new ParseDD().validateEJBDescriptor(is);
result.setComponentName(new File(bundleDescriptor.getModuleDescriptor().getArchiveUri()).getName());
setModuleName(result);
verifierFrameworkContext.getResultManager().add(result);
}
} finally {
try {
if (is != null) {
is.close();
}
} catch (Exception e) {
}
}
}
for (Iterator itr = bundleDescriptor.getEjbs().iterator(); itr.hasNext(); ) {
EjbDescriptor ejbDescriptor = (EjbDescriptor) itr.next();
super.check(ejbDescriptor);
}
if (bundleDescriptor.containsCMPEntity() && context.getJDOException() == null) {
jdc.cleanup();
context.setJDOCodeGenerator(null);
}
}
Aggregations