private MetaAnnotatedClass<?> to(Class<?> clazz) { return new MetaAnnotatedClass(clazz); }
private MetaAnnotatedClass<?>[] to(Class<?>[] a) { MetaAnnotatedClass<?>[] b = new MetaAnnotatedClass[a.length]; for (int i = 0; i < a.length; i++) { b[i] = to(a[i]); } return b; }
public MetaAnnotatedClass(Class<T> clazz) { super(clazz, unroll(clazz)); }
private static <T> boolean isProvider(final Class<T> clazz) { return new MetaAnnotatedClass<T>(clazz).isAnnotationPresent(Provider.class); }
/** * Searches for an annotation starting at the specified class and working backwards. * Searching stops when the annotation is found. * * @param clazz * @param annotationClass * @return */ private <A extends Annotation> A getInheritableAnnotation(final Class clazz, final Class<A> annotationClass) { if (clazz == null || clazz.equals(Object.class)) { return null; } final MetaAnnotatedClass meta = new MetaAnnotatedClass(clazz); final Annotation annotation = meta.getAnnotation(annotationClass); if (annotation != null) { return (A) annotation; } return getInheritableAnnotation(clazz.getSuperclass(), annotationClass); }
final MetaAnnotatedClass<?> clazz = new MetaAnnotatedClass(clazzz); if (!classPermissions.contains("*") || !classPermissions.contains(clazz.getName())) { final RolesAllowed rolesAllowed = clazz.getAnnotation(RolesAllowed.class); final PermitAll permitAll = clazz.getAnnotation(PermitAll.class); final DenyAll denyAll = clazz.getAnnotation(DenyAll.class); || (rolesAllowed != null && denyAll != null) || (permitAll != null && denyAll != null)) { ejbModule.getValidation().fail(ejbName, "permitAllAndRolesAllowedOnClass", clazz.getName()); final MethodPermission methodPermission = new MethodPermission(); methodPermission.getRoleName().addAll(asList(rolesAllowed.value())); methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*")); assemblyDescriptor.getMethodPermission().add(methodPermission); final MethodPermission methodPermission = new MethodPermission(); methodPermission.setUnchecked(true); methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*")); assemblyDescriptor.getMethodPermission().add(methodPermission); .addMethod(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*")); final RunAs runAs = clazz.getAnnotation(RunAs.class); if (runAs != null && bean.getSecurityIdentity() == null) { final SecurityIdentity securityIdentity = new SecurityIdentity(); final DeclareRoles declareRoles = clazz.getAnnotation(DeclareRoles.class);
@Override public Application handleApplication(final javax.ws.rs.core.Application application) { final Application app = super.handleApplication(application); if (app == null) { return null; } // deal with doc for the application final MetaAnnotatedClass appClass = new MetaAnnotatedClass(application.getClass()); final List<Doc> docs = handlerDoc(getDescription(appClass), DOC_TARGET_APP); if (docs == null || docs.isEmpty()) { app.withDoc(DEFAULT_APP_DOC); } else { app.withDoc(docs.toArray(new Doc[docs.size()])); } // check see links app.withAny(handleTribestream(false, appClass, appClass.getCanonicalName())); return app; }
/** * Searches for an annotation starting at the specified class and working backwards. * Searching stops when the annotation is found. * * @param clazz * @param annotationClass * @return */ private <A extends Annotation> A getInheritableAnnotation(final Class clazz, final Class<A> annotationClass) { if (clazz == null || clazz.equals(Object.class)) { return null; } final MetaAnnotatedClass meta = new MetaAnnotatedClass(clazz); final Annotation annotation = meta.getAnnotation(annotationClass); if (annotation != null) { return (A) annotation; } return getInheritableAnnotation(clazz.getSuperclass(), annotationClass); }
final MetaAnnotatedClass<?> clazz = new MetaAnnotatedClass(clazzz); if (!classPermissions.contains("*") || !classPermissions.contains(clazz.getName())) { final RolesAllowed rolesAllowed = clazz.getAnnotation(RolesAllowed.class); final PermitAll permitAll = clazz.getAnnotation(PermitAll.class); final DenyAll denyAll = clazz.getAnnotation(DenyAll.class); || (rolesAllowed != null && denyAll != null) || (permitAll != null && denyAll != null)) { ejbModule.getValidation().fail(ejbName, "permitAllAndRolesAllowedOnClass", clazz.getName()); final MethodPermission methodPermission = new MethodPermission(); methodPermission.getRoleName().addAll(Arrays.asList(rolesAllowed.value())); methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*")); assemblyDescriptor.getMethodPermission().add(methodPermission); final MethodPermission methodPermission = new MethodPermission(); methodPermission.setUnchecked(true); methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*")); assemblyDescriptor.getMethodPermission().add(methodPermission); .addMethod(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*")); final RunAs runAs = clazz.getAnnotation(RunAs.class); if (runAs != null && bean.getSecurityIdentity() == null) { final SecurityIdentity securityIdentity = new SecurityIdentity(); final DeclareRoles declareRoles = clazz.getAnnotation(DeclareRoles.class);
private MetaAnnotatedClass<?> to(Class<?> clazz) { return new MetaAnnotatedClass(clazz); }
private MetaAnnotatedClass<?>[] to(Class<?>[] a) { MetaAnnotatedClass<?>[] b = new MetaAnnotatedClass[a.length]; for (int i = 0; i < a.length; i++) { b[i] = to(a[i]); } return b; }
if (ejbClass.isInterface()) { // dynamic proxy implementation bean.setLocal(ejbClass.getName()); final Proxy proxyAnnotation = (Proxy) new MetaAnnotatedClass(ejbClass).getAnnotation(Proxy.class); if (proxyAnnotation != null) { proxyClass = proxyAnnotation.value();
public MetaAnnotatedClass(Class<T> clazz) { super(clazz, unroll(clazz)); }
private MetaAnnotatedClass<?> to(Class<?> clazz) { return new MetaAnnotatedClass(clazz); }
private MetaAnnotatedClass<?>[] to(Class<?>[] a) { MetaAnnotatedClass<?>[] b = new MetaAnnotatedClass[a.length]; for (int i = 0; i < a.length; i++) { b[i] = to(a[i]); } return b; }
if (ejbClass.isInterface()) { // dynamic proxy implementation bean.setLocal(ejbClass.getName()); final Proxy proxyAnnotation = (Proxy) new MetaAnnotatedClass(ejbClass).getAnnotation(Proxy.class); if (proxyAnnotation != null) { proxyClass = proxyAnnotation.value();
public MetaAnnotatedClass(Class<T> clazz) { super(clazz, unroll(clazz)); }
public MetaAnnotatedClass<? super T> getSuperclass() { return new MetaAnnotatedClass(target.getSuperclass()); }
public MetaAnnotatedClass<?>[] getInterfaces() { return to(target.getInterfaces()); }
final MetaAnnotatedClass<?> metaClass = new MetaAnnotatedClass(clazz); final boolean dynamicBean = DynamicProxyImplFactory.isKnownDynamicallyImplemented(metaClass, clazz); ancestors.addAll(asList(clazz.getInterfaces())); if (dynamicBean) { final Proxy p = metaClass.getAnnotation(Proxy.class); if (p != null) { ancestors.add(p.value()); } else { final Class<?>[] classes; final Proxy proxy = metaClass.getAnnotation(Proxy.class); if (proxy == null) { classes = new Class<?>[]{clazz};