protected ApiMethod validateMethod(String methodName, Class []param,
ApiMethod sourceMethod, ApiClass sourceClass,
boolean isOptional)
throws ConfigException
{
ApiMethod method = null;
method = getMethod(_ejbClass, methodName, param);
if (method == null && isOptional)
return null;
if (method == null && sourceMethod != null) {
throw error(L.l("{0}: missing '{1}' needed to match {2}.{3}",
_ejbClass.getName(),
getFullMethodName(methodName, param),
sourceClass.getSimpleName(),
getFullMethodName(sourceMethod)));
}
else if (method == null) {
throw error(L.l("{0}: expected '{1}'",
_ejbClass.getName(),
getFullMethodName(methodName, param)));
}
ApiClass declaringClass = method.getDeclaringClass();
if (method.isAbstract()) {
if (method.getDeclaringClass().getName().equals("javax.ejb.EntityBean"))
throw error(L.l("{0}: '{1}' must not be abstract. Entity beans must implement the methods in EntityBean.",
_ejbClass.getName(),
getFullMethodName(methodName, param)));
else if (method.getDeclaringClass().getName().equals("javax.ejb.SessionBean"))
throw error(L.l("{0}: '{1}' must not be abstract. Session beans must implement the methods in SessionBean.",
_ejbClass.getName(),
getFullMethodName(methodName, param)));
else if (sourceMethod != null)
throw error(L.l("{0}: '{1}' must not be abstract. All methods from '{2}' must be implemented in the bean.",
_ejbClass.getName(),
getFullMethodName(methodName, param),
sourceClass.getName()));
else
throw error(L.l("{0}: '{1}' must not be abstract. Business methods must be implemented.",
_ejbClass.getName(),
getFullMethodName(methodName, param)));
} else if (! method.isPublic()) {
throw error(L.l("{0}: '{1}' must be public. Business method implementations must be public.",
_ejbClass.getName(),
getFullMethodName(methodName, param)));
}
if (method.isStatic()) {
throw error(L.l("{0}: '{1}' must not be static. Business method implementations must not be static.",
_ejbClass.getName(),
getFullMethodName(method)));
}