Attempts to verify the spec compliance of the beans in a given
EJB-JAR file. Works against EJB spec 1.1 and 2.0. Built for use in
JBoss project.
| Method from org.jboss.verifier.BeanVerifier Detail: |
public void addVerificationListener(VerificationListener listener) {
events.addVerificationListener(listener);
}
|
public void fireBeanChecked(VerificationEvent event) {
events.fireBeanChecked(event);
}
|
public void fireSpecViolation(VerificationEvent event) {
// A Spec Violation has been found. Mark as unsuccessful.
success = false;
events.fireSpecViolation(event);
}
|
public ApplicationMetaData getApplicationMetaData() {
return ejbMetaData;
}
|
public ClassLoader getClassLoader() {
return ejbClassLoader;
}
|
public String getEJBVersion() {
return VERSION_1_1;
// [TODO] fix this to return a correct version
}
|
public URL getJarLocation() {
return ejbURL;
}
|
public boolean getSuccess() {
return success;
}
Check if the Verifier was successful |
protected VerificationStrategy getVerifier() {
return verifier;
}
|
public void removeVerificationListener(VerificationListener listener) {
events.removeVerificationListener(listener);
}
|
protected void setVerifier(String version) {
if( VERSION_1_1.equals(version) )
{
verifier = new EJBVerifier11(this);
}
else if( VERSION_2_0.equals(version) )
{
verifier = new EJBVerifier20(this);
}
else if (VERSION_2_1.equals(version))
{
verifier=new EJBVerifier21(this);
}
else
{
throw new IllegalArgumentException( UNRECOGNIZED_VERSION +
": " + version);
}
}
|
public void verify(URL url,
ApplicationMetaData metaData) {
verify(url, metaData, null);
}
Checks the Enterprise Java Beans found in this Jar for EJB spec
compliance (EJB Spec. 1.1). Ensures that the given interfaces
and implementation classes implement required methods and follow
the contract given in the spec. |
public void verify(URL url,
ApplicationMetaData metaData,
ClassLoader cl) {
ejbURL = url;
ejbMetaData = metaData;
ejbClassLoader = cl;
if(metaData.isEJB1x())
{
setVerifier(VERSION_1_1);
}
else if(metaData.isEJB21())
{
setVerifier(VERSION_2_1);
}
else
{
setVerifier(VERSION_2_0);
}
Iterator beans = ejbMetaData.getEnterpriseBeans();
while (beans.hasNext())
{
BeanMetaData bean = (BeanMetaData)beans.next();
if( bean.isEntity() )
{
EntityMetaData entityBean = (EntityMetaData)bean;
if( metaData.isEJB2x() && entityBean.isCMP1x() )
{
// Hook for verifying CMP 1.x Beans in a 2.x JAR: store
// current state and restore this state after verification
// of the EJB completes.
boolean storedSuccess = success;
verifier.checkEntity( entityBean );
if( success != storedSuccess )
{
log.warn( "The CMP 1.x EJB '" + entityBean.getEjbName() +
"' generated some verification warnings. The Deployer " +
"will ignore these warnings but you should check " +
"your EJB to be on the safe side of things." );
}
success = storedSuccess;
}
else
{
verifier.checkEntity( entityBean );
}
}
else if( bean.isSession() )
{
verifier.checkSession( (SessionMetaData)bean );
}
else
{
verifier.checkMessageBean( (MessageDrivenMetaData)bean );
}
}
}
Checks the Enterprise Java Beans found in this Jar for EJB spec
compliance (EJB Spec. 1.1). Ensures that the given interfaces
and implementation classes implement required methods and follow
the contract given in the spec. |