下面列出了怎么用javax.ejb.Remote的API类实例代码及写法,或者点击链接到github查看源代码。
@Before
public void setUp() throws Exception {
mapping = new HashMap<Class<?>, List<Class<?>>>();
classes = new ArrayList<Class<?>>();
excludes = new ArrayList<String>();
// do not check the APP beans
excludes.add("org.oscm.app.");
String directory = "..";
findAnnotatedStatelessBeans(new File(directory), "org.oscm.",
Remote.class, classes, mapping);
}
private boolean considerInterface(Class<?> i) {
if (i.getAnnotation(Local.class) != null) {
return true;
} else if (i.getAnnotation(Remote.class) != null) {
return true;
} else {
return isExcplicitlyRequiredClass(i);
}
}
@Override
public boolean isNeglectableClass(Class<?> clazz) {
return (clazz.getAnnotation(Remote.class) == null);
}
private void invokeInvocationDateInterceptor(Method method) {
if (method.getDeclaringClass().getAnnotation(Remote.class) != null) {
DateFactory.getInstance().takeCurrentTime();
}
}
private boolean isValidInterface(final RemoteBean b, final Class clazz, final Class beanClass, final String tag) {
if (clazz.equals(beanClass)) {
fail(b, "xml." + tag + ".beanClass", clazz.getName());
} else if (!clazz.isInterface()) {
fail(b, "xml." + tag + ".notInterface", clazz.getName());
} else if (EJBHome.class.isAssignableFrom(clazz)) {
if (tag.equals("home")) {
return true;
}
fail(b, "xml." + tag + ".ejbHome", clazz.getName());
} else if (EJBLocalHome.class.isAssignableFrom(clazz)) {
if (tag.equals("localHome")) {
return true;
}
fail(b, "xml." + tag + ".ejbLocalHome", clazz.getName());
} else if (EJBObject.class.isAssignableFrom(clazz)) {
if (tag.equals("remote")) {
return true;
}
fail(b, "xml." + tag + ".ejbObject", clazz.getName());
} else if (EJBLocalObject.class.isAssignableFrom(clazz)) {
if (tag.equals("local")) {
return true;
}
fail(b, "xml." + tag + ".ejbLocalObject", clazz.getName());
} else {
if (tag.equals("businessLocal") || tag.equals("businessRemote")) {
return true;
} else if (clazz.isAnnotationPresent(Local.class)) {
fail(b, "xml." + tag + ".businessLocal", clazz.getName());
} else if (clazz.isAnnotationPresent(Remote.class)) {
fail(b, "xml." + tag + ".businessRemote", clazz.getName());
} else {
fail(b, "xml." + tag + ".unknown", clazz.getName());
}
}
// must be tagged as <home>, <local-home>, <remote>, or <local>
return false;
}