@Override public <X, T extends Annotation> X getResourceReference(final ResourceReference<X, T> resourceReference) { final Class<X> type = resourceReference.getResourceType(); final String name = resourceReference.getJndiName(); try { return type.cast(new InitialContext().lookup(name)); } catch (final NamingException e) { for (final BeanContext beanContext : compContexts) { try { final String relativeName = name.replace("java:", ""); return type.cast(beanContext.getJndiContext().lookup(relativeName)); } catch (final NamingException e1) { // fine for now } } // throw new WebBeansException("Could not look up resource at " + resourceReference.getJndiName(), e); } return null; }
return beanContext.getJndiContext().lookup(jndiName); } catch (final NamingException e) { try { value = InjectionProcessor.unwrap(beanContext.getJndiContext()).lookup(jndiName); } catch (final NamingException e1) {
return beanContext.getJndiContext().lookup(jndiName); } catch (final NamingException e) { try { value = InjectionProcessor.unwrap(beanContext.getJndiContext()).lookup(jndiName); } catch (final NamingException e1) {
boolean setAppNamingContextReadOnly(final List<BeanContext> allDeployments) { if("true".equals(SystemInstance.get().getProperty(FORCE_READ_ONLY_APP_NAMING, "false"))) { for(BeanContext beanContext : allDeployments) { Context ctx = beanContext.getJndiContext(); if(IvmContext.class.isInstance(ctx)) { IvmContext.class.cast(ctx).setReadOnly(true); } else if(ContextHandler.class.isInstance(ctx)) { ContextHandler.class.cast(ctx).setReadOnly(); } } return true; } return false; }
for (final BeanContext beanContext : compContexts) { try { return type.cast(beanContext.getJndiContext().lookup(noJavaPrefix)); } catch (final NamingException e1) {
return method.invoke(ctx.getBeanContext().getJndiContext().lookup(jndi), args);
final Validator validator = (Validator) beanContext.getJndiContext().lookup("comp/Validator");
final Validator validator = (Validator) beanContext.getJndiContext().lookup("comp/Validator");
return method.invoke(ctx.getBeanContext().getJndiContext().lookup(jndi), args);
final Validator validator = (Validator) beanContext.getJndiContext().lookup("comp/Validator");
containerSystem.getAppContext(appInfo.appId).getWebBeansContext(), comp.getJndiContext(), providers, pojoConfigurations, application, wildcard); } else { if (BeanType.MANAGED.equals(ctx.getComponentType())) { deployPojo("", ejb.getValue().path, ctx.getBeanClass(), null, ctx.getClassLoader(), ctx.getInjections(), ctx.getJndiContext(), containerSystem.getAppContext(appInfo.appId).getWebBeansContext(), providers, new ServiceConfiguration(ctx.getProperties(), appInfo.services));
public static <T> T inject(final T object) { assert object != null; final Class<?> clazz = object.getClass(); final BeanContext context = resolve(clazz); if (context != null) { // found the test class directly final InjectionProcessor processor = new InjectionProcessor(object, context.getInjections(), context.getJndiContext()); cdiInjections(context, object); try { return (T) processor.createInstance(); } catch (final OpenEJBException e) { throw new InjectionException(clazz.getName(), e); } } else if (!isAnnotatedLocalClient(clazz)) { // nothing to do throw new NoInjectionMetaDataException(clazz.getName()); } // the test class was not found in beans (OpenEJB ran from parent) but was annotated @LocalClient try { final InjectionProcessor<?> processor = ClientInjections.clientInjector(object); cdiInjections(null, object); return (T) processor.createInstance(); } catch (final OpenEJBException e) { throw new NoInjectionMetaDataException("Injection failed", e); } }
@SuppressWarnings("unchecked") public static <T> T inject(final T object) { assert object != null; final Class<?> clazz = object.getClass(); final BeanContext context = resolve(clazz); if (context != null) { // found the test class directly final InjectionProcessor processor = new InjectionProcessor(object, context.getInjections(), context.getJndiContext()); cdiInjections(context, object); try { return (T) processor.createInstance(); } catch (final OpenEJBException e) { throw new InjectionException(clazz.getName(), e); } } else if (!isAnnotatedLocalClient(clazz)) { // nothing to do throw new NoInjectionMetaDataException(clazz.getName()); } // the test class was not found in beans (OpenEJB ran from parent) but was annotated @LocalClient try { final InjectionProcessor<?> processor = ClientInjections.clientInjector(object); cdiInjections(null, object); return (T) processor.createInstance(); } catch (final OpenEJBException e) { throw new NoInjectionMetaDataException("Injection failed", e); } }
final ThreadContext oldContext = ThreadContext.enter(callContext); try { final InjectionProcessor processor = new InjectionProcessor(testInstance, context.getInjections(), context.getJndiContext()); processor.createInstance(); } catch (final OpenEJBException e) {
final ThreadContext oldContext = ThreadContext.enter(callContext); try { final InjectionProcessor processor = new InjectionProcessor(inputTestInstance, context.getInjections(), context.getJndiContext()); processor.createInstance();
final ThreadContext oldContext = ThreadContext.enter(callContext); try { final InjectionProcessor processor = new InjectionProcessor(inputTestInstance, context.getInjections(), context.getJndiContext()); processor.createInstance();