protected final void processFieldInjections() { Object home = null; ClassFinder finder = null; List<Field> fieldList = null; finder = new ClassFinder(getClassPath()); fieldList = finder.findAnnotatedFields(EJB.class); for(final Iterator fields = fieldList.iterator(); fields.hasNext();) { final Field field = (Field) fields.next(); final EJB ejbAnnotation = field.getAnnotation(EJB.class); if( (ejbAnnotation.name() != null) && (ejbAnnotation.name() != "") && (ejbAnnotation.beanInterface() != null)) { try { home = initialContext.lookup(ejbAnnotation.name()); // home = ejbAnnotation.beanInterface().cast(PortableRemoteObject.narrow(home, ejbAnnotation.beanInterface())); home = cast(home, ejbAnnotation.beanInterface()); field.setAccessible(true); field.set(this, home); } catch(final Exception ex) { // TODO - MNour : Needs better exception handling ex.printStackTrace(); } } } }
public static void addWebServiceContextInjections(Holder holder, ClassFinder finder) { List<Field> fields = finder.findAnnotatedFields(Resource.class); for (Field field : fields) { Resource resource = field.getAnnotation(Resource.class); Class type = getInjectionType(resource.type(), null, field); if (WebServiceContext.class == type) { holder.addInjection(field.getDeclaringClass().getName(), new Injection(field.getDeclaringClass().getName(), getInjectionName(null, field), BINDING_WEBSERVICE_CONTEXR_JNDI_NAME, ReferenceType.RESOURCE_ENV)); } } List<Method> methods = finder.findAnnotatedMethods(Resource.class); for (Method method : methods) { Resource resource = method.getAnnotation(Resource.class); Class type = getInjectionType(resource.type(), method, null); if (WebServiceContext.class == type) { holder.addInjection(method.getDeclaringClass().getName(), new Injection(method.getDeclaringClass().getName(), getInjectionName(method, null), BINDING_WEBSERVICE_CONTEXR_JNDI_NAME, ReferenceType.RESOURCE_ENV)); } } }
protected final void processFieldInjections() { Object home = null; ClassFinder finder = null; List<Field> fieldList = null; finder = new ClassFinder(getClassPath()); fieldList = finder.findAnnotatedFields(EJB.class); for(Iterator fields = fieldList.iterator(); fields.hasNext();) { Field field = (Field) fields.next(); EJB ejbAnnotation = field.getAnnotation(EJB.class); if( (ejbAnnotation.name() != null) && (ejbAnnotation.name() != "") && (ejbAnnotation.beanInterface() != null)) { try { home = initialContext.lookup(ejbAnnotation.name()); // home = ejbAnnotation.beanInterface().cast(PortableRemoteObject.narrow(home, ejbAnnotation.beanInterface())); home = cast(home, ejbAnnotation.beanInterface()); field.setAccessible(true); field.set(this, home); } catch(Exception ex) { // TODO - MNour : Needs better exception handling ex.printStackTrace(); } } } }
for (final Field field : finder.findAnnotatedFields(RandomPort.class)) { final Class<?> type = field.getType(); if (int.class != type && URL.class != type) {
for (final Field field : finder.findAnnotatedFields(RandomPort.class)) { final Class<?> type = field.getType(); if (int.class != type && URL.class != type) {
private void scan(Object managed, String prefix) { ClassFinder finder = new ClassFinder(managed.getClass()); List<Field> fields = finder.findAnnotatedFields(Managed.class); for (Field field : fields) { scan(new FieldMember(field, managed, prefix)); } List<Method> methods = finder.findAnnotatedMethods(Managed.class); for (Method method : methods) { scan(new MethodMember(method, managed, prefix)); } }
private void scan(final Object target, final String prefix) { final ClassFinder finder = new ClassFinder(Classes.ancestors(target.getClass())); final List<Field> fields = finder.findAnnotatedFields(Managed.class); for (final Field field : fields) { attribute(new FieldMember(field, target, prefix)); } final List<Method> managed = finder.findAnnotatedMethods(Managed.class); for (final Method method : managed) { final MethodMember member = new MethodMember(method, target, prefix); if (!method.getName().matches("(get|is)([A-Z_].*|)")) { operationsMap.put(member.getName(), member); } else { attribute(new MethodMember(method, target, prefix)); } } final List<Method> collections = finder.findAnnotatedMethods(ManagedCollection.class); for (final Method method : collections) { dynamic.add(new MethodMember(method, target, prefix)); } }
private void scan(final Object target, final String prefix) { final ClassFinder finder = new ClassFinder(Classes.ancestors(target.getClass())); final List<Field> fields = finder.findAnnotatedFields(Managed.class); for (final Field field : fields) { attribute(new FieldMember(field, target, prefix)); } final List<Method> managed = finder.findAnnotatedMethods(Managed.class); for (final Method method : managed) { final MethodMember member = new MethodMember(method, target, prefix); if (!method.getName().matches("(get|is)([A-Z_].*|)")) { operationsMap.put(member.getName(), member); } else { attribute(new MethodMember(method, target, prefix)); } } final List<Method> collections = finder.findAnnotatedMethods(ManagedCollection.class); for (final Method method : collections) { dynamic.add(new MethodMember(method, target, prefix)); } }
for (Field field : classFinder.findAnnotatedFields(EJB.class)) { EJB ejb = field.getAnnotation(EJB.class); for (Field field : classFinder.findAnnotatedFields(Resource.class)) { Resource resource = field.getAnnotation(Resource.class); for (Field field : classFinder.findAnnotatedFields(WebServiceRef.class)) { WebServiceRef webserviceref = field.getAnnotation(WebServiceRef.class); HandlerChain handlerChain = field.getAnnotation(HandlerChain.class); buildPersistenceUnit(consumer, pUnit, null); for (Field field : classFinder.findAnnotatedFields(PersistenceUnit.class)) { PersistenceUnit pUnit = field.getAnnotation(PersistenceUnit.class); Member member = new FieldMember(field); buildPersistenceContext(consumer, pcFactory.create(pCtx, null), null); for (Field field : classFinder.findAnnotatedFields(PersistenceContext.class)) { PersistenceContext pCtx = field.getAnnotation(PersistenceContext.class); Member member = new FieldMember(field);
for (final Field field : finder.getValue().findAnnotatedFields(RandomPort.class)) { if (!field.isAccessible()) { field.setAccessible(true);
for (final Field field : finder.getValue().findAnnotatedFields(RandomPort.class)) { if (!field.isAccessible()) { field.setAccessible(true); final List<Field> fields = new ArrayList<Field>(testClassFinder.findAnnotatedFields(AppResource.class)); fields.addAll(testClassFinder.findAnnotatedFields(org.apache.openejb.junit.AppResource.class)); for (final Field field : fields) { final Class<?> type = field.getType();
final List<Field> fields = new ArrayList<>(testClassFinder.findAnnotatedFields(AppResource.class)); fields.addAll(testClassFinder.findAnnotatedFields(org.apache.openejb.junit.AppResource.class)); for (final Field field : fields) { final Class<?> type = field.getType();