//
if (session.isStateless())
{
if (!hasDefaultCreateMethod(home))
{
fireSpecViolationEvent(session, new Section("7.11.6.d2"));
status = false;
}
else
{
Method create = getDefaultCreateMethod(home);
if (hasMoreThanOneCreateMethods(home))
{
fireSpecViolationEvent(session, new Section("7.11.6.d2"));
status = false;
}
}
}
// The session bean's home interface MUST extend the
// javax.ejb.EJBHome interface.
//
// Spec 7.11.6
//
if (!hasEJBHomeInterface(home))
{
fireSpecViolationEvent(session, new Section("7.11.6.a"));
status = false;
}
// Method arguments defined in the home interface MUST be
// of valid types for RMI/IIOP.
//
// Method return values defined in the home interface MUST
// be of valid types for RMI/IIOP.
//
// Methods defined in the home interface MUST include
// java.rmi.RemoteException in their throws clause.
//
// Spec 7.11.6
///
Iterator it = Arrays.asList(home.getMethods()).iterator();
while (it.hasNext())
{
Method method = (Method)it.next();
if (!hasLegalRMIIIOPArguments(method))
{
fireSpecViolationEvent(session, method, new Section("7.11.6.b1"));
status = false;
}
if (!hasLegalRMIIIOPReturnType(method))
{
fireSpecViolationEvent(session, method, new Section("7.11.6.b2"));
status = false;
}
if (!throwsRemoteException(method))
{
fireSpecViolationEvent(session, method, new Section("7.11.6.b3"));
status = false;
}
}
// A session bean's home interface MUST define one or more
// create(...) methods.
//
// Spec 7.11.6
//
if (!hasCreateMethod(home))
{
fireSpecViolationEvent(session, new Section("7.11.6.d1"));
status = false;
}
// Each create(...) method in the session bean's home interface
// MUST have a matching ejbCreate(...) method in the session
// bean's class.
//
// Each create(...) method in the session bean's home interface
// MUST have the same number and types of arguments to its
// matching ejbCreate(...) method.
//
// The return type for a create(...) method MUST be the session
// bean's remote interface type.
//
// All the exceptions defined in the throws clause of the matching
// ejbCreate(...) method of the enterprise bean class MUST be
// included in the throws clause of a matching create(...) method.
//
// The throws clause of a create(...) method MUST include the
// javax.ejb.CreateException.
//
// Spec 7.11.6
//
Iterator createMethods = getCreateMethods(home);
while (createMethods.hasNext())
{
Method create = (Method)createMethods.next();
if (!hasMatchingEJBCreate(bean, create))
{
fireSpecViolationEvent(session, create, new Section("7.11.6.e"));
status = false;
}
if (!hasRemoteReturnType(session, create))
{
fireSpecViolationEvent(session, create, new Section("7.11.6.f"));
status = false;
}
if (hasMatchingEJBCreate(bean, create))
{
Method ejbCreate = getMatchingEJBCreate(bean, create);
if (!hasMatchingExceptions(ejbCreate, create))
{
fireSpecViolationEvent(session, create,
new Section("7.11.6.g"));
status = false;
}
}
if (!throwsCreateException(create))
{
fireSpecViolationEvent(session, create, new Section("7.11.6.h"));
status = false;
}
}
return status;