public T getValue() { return bean.getValue(); }
@Override public void add(final BeanEntry<Named, InfoProvider> beanEntry, final BundleContext bundleContext) throws Exception { log.debug("Adding: {}", beanEntry); bundleContext.registerService(InfoProvider.class, beanEntry.getValue(), null); }
public void remove( final BeanEntry<javax.inject.Named, Item> bean, final NamedItemWatcher watcher ) throws Exception { assertEquals( watcher.items.remove( bean.getKey().value() ), bean.getValue() ); } }
public void add(final BeanEntry<Named, Metric> entry, final MetricRegistry registry) throws Exception { log.debug("Registering: {}", entry); registry.register(entry.getKey().value(), entry.getValue()); }
@Override public void remove(BeanEntry<Named, SecurityContributor> entry, SecurityConfigurationManagerImpl watcher) { watcher.removeContributor(entry.getValue()); } }
@Override public void add(BeanEntry<Named, WebResourceBundle> entry, WebResourceServiceImpl watcher) throws Exception { List<WebResource> resources = entry.getValue().getResources(); if (resources != null) { for (WebResource resource : resources) { watcher.addResource(resource); } } }
@Override public Object createResource(final HttpRequest request, final HttpResponse response, final ResteasyProviderFactory factory) { final Object resource = entry.getValue(); propertyInjector.inject(request, response, resource); return resource; }
public void add(final BeanEntry<Annotation, Application> entry, final ApplicationContainer container) throws Exception { log.debug("Adding application: {}", entry); try { container.add(entry.getValue()); } catch (Exception e) { log.error("Failed to add application", e); } }
@Override protected Completer getCompleter(final Class<?> clazz) { @SuppressWarnings({ "unchecked", "rawtypes" }) Iterator<? extends BeanEntry<?, Completer>> itr = beanLocator.locate(Key.get((Class) clazz)).iterator(); if (itr.hasNext()) { return itr.next().getValue(); } return super.getCompleter(clazz); }
public void add( final BeanEntry<javax.inject.Named, Item> bean, final NamedItemWatcher watcher ) throws Exception { assertNull( watcher.items.put( bean.getKey().value(), bean.getValue() ) ); }
@Override protected Object createInvokeInstanceForMethodWithDefaultConstructor(final RegisteredMethod method) { log.debug("Creating instance of action class '{}' mapped to '{}", method.getActionClass().getName(), method.getActionName()); @SuppressWarnings("unchecked") Iterable<BeanEntry<Annotation, Object>> actionInstance = beanLocator.locate( Key.get((Class) method.getActionClass()) ); return actionInstance.iterator().next().getValue(); }
@Override public void add(BeanEntry<Named, Filter> entry, DynamicFilterChainManager manager) { manager.addFilter(entry.getKey().value(), entry.getValue(), true); }
public void remove(final BeanEntry<Annotation, FilterPipeline> entry, final DynamicFilterPipeline watcher) throws Exception { // remove pipeline from cache before disposing final FilterPipeline pipeline = entry.getValue(); watcher.refreshCache(); pipeline.destroyPipeline(); } }
public void add( final BeanEntry<Marked, Item> bean, final MarkedItemWatcher watcher ) throws Exception { assertNull( watcher.items.put( Integer.valueOf( bean.getKey().value() ), bean.getValue() ) ); }
public void remove(final BeanEntry<Annotation, FilterPipeline> entry, final DynamicFilterPipeline watcher) throws Exception { // remove pipeline from cache before disposing final FilterPipeline pipeline = entry.getValue(); watcher.refreshCache(); pipeline.destroyPipeline(); } }
/** * Detect {@link Managed} components. */ private void detectManaged(final Environment environment) { for (BeanEntry<Annotation, Managed> entry : locate(Managed.class)) { Managed component = entry.getValue(); environment.lifecycle().manage(component); log.debug("Added managed: {}", component); } }
/** * Detect {@link HealthCheck} components. */ private void detectHealthChecks(final Environment environment) { for (BeanEntry<Named, HealthCheck> entry : locate(HealthCheck.class, Named.class)) { String name = entry.getKey().value(); HealthCheck component = entry.getValue(); environment.healthChecks().register(name, component); log.debug("Added health-check: {} -> {}", name, component); } }
public void testAssistedInject() { Foo bean = beanFactory.create( 8080 ); assertTrue( bean instanceof AssistedFoo ); assertEquals( 8080, ( (AssistedFoo) bean ).port ); assertEquals( "localhost", ( (AssistedFoo) bean ).host ); bean = beanLocator.locate( Key.get( FooFactory.class ) ).iterator().next().getValue().create( 42 ); assertEquals( 42, ( (AssistedFoo) bean ).port ); assertEquals( "localhost", ( (AssistedFoo) bean ).host ); bean = beanLocator.locate( Key.get( Foo.class ) ).iterator().next().getValue(); assertTrue( bean instanceof DefaultFoo ); } }
public void add(final BeanEntry<Annotation, FilterPipeline> entry, final DynamicFilterPipeline watcher) throws Exception { // initialize pipeline before exposing via cache final FilterPipeline pipeline = entry.getValue(); pipeline.initPipeline(watcher.getServletContext()); watcher.refreshCache(); }
public void add(final BeanEntry<Annotation, FilterPipeline> entry, final DynamicFilterPipeline watcher) throws Exception { // initialize pipeline before exposing via cache final FilterPipeline pipeline = entry.getValue(); pipeline.initPipeline(watcher.getServletContext()); watcher.refreshCache(); }