}
private Class<? extends DeploymentModule> checkAnnotations(final URL urls, final ClassLoader classLoader, final boolean scanPotentialEjbModules, final boolean scanPotentialClientModules) {
Class<? extends DeploymentModule> cls = null;
if (scanPotentialEjbModules || scanPotentialClientModules) {
final AnnotationFinder classFinder = new AnnotationFinder(classLoader, urls);
final Set<Class<? extends DeploymentModule>> otherTypes = new LinkedHashSet<Class<? extends DeploymentModule>>();
final AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
final String packageName = LocalClient.class.getName().replace("LocalClient", "");
@Override
public boolean accept(final String annotationName) {
if (scanPotentialClientModules && annotationName.startsWith(packageName)) {
if (LocalClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
if (RemoteClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
} else if (scanPotentialEjbModules) {
if (annotationName.startsWith("javax.ejb.")) {
if ("javax.ejb.Stateful".equals(annotationName)) return true;
if ("javax.ejb.Stateless".equals(annotationName)) return true;
if ("javax.ejb.Singleton".equals(annotationName)) return true;
if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
} else if (scanManagedBeans && "javax.annotation.ManagedBean".equals(annotationName)) {
return true;
}
}
return false;
}
};
if (classFinder.find(filter)) {
cls = EjbModule.class;
// if it is a war just throw an error
try {
final File ar = URLs.toFile(urls);
if (!ar.isDirectory() && !ar.getName().endsWith("ar")) { // guess no archive extension, check it is not a hidden war