Package org.glassfish.hk2.api

Examples of org.glassfish.hk2.api.DynamicConfiguration.commit()


            // Add a bean to the service locator
            CDIHK2Descriptor<Object> descriptor = new CDIHK2Descriptor<Object>(manager, (Bean<Object>) bean);
            config.addActiveDescriptor(descriptor);
        }
       
        config.commit();
       
        return true;
    }

}
View Full Code Here


      DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
      DynamicConfiguration config = dcs.createDynamicConfiguration();
     
      config.addActiveDescriptor(WebConfigListener.class);
     
      config.commit();
     
      return locator.getService(WebConfigListener.class);
    }

    public void postConstruct() {
View Full Code Here

    @Override
    public void initialize(final ServiceLocator locator) {
        this.locator = locator;
        final DynamicConfiguration configuration = Injections.getConfiguration(locator);
        Injections.addBinding(Injections.newBinder(this).to(ResourceMethodInvocationHandlerProvider.class), configuration);
        configuration.commit();
    }

    private void registerEjbInterceptor() {
        try {
            final Object interceptor = new EjbComponentInterceptor(locator);
View Full Code Here

            bindingBuilder.to(contract);
        }

        Injections.addBinding(bindingBuilder, dc);

        dc.commit();

        if (LOGGER.isLoggable(Level.CONFIG)) {
            LOGGER.config(LocalizationMessages.EJB_CLASS_BOUND_WITH_CDI(component));
        }
View Full Code Here

    }

    private void registerEjbExceptionMapper() {
        final DynamicConfiguration dc = Injections.getConfiguration(locator);
        Injections.addBinding(Injections.newBinder(EjbExceptionMapper.class).to(ExceptionMapper.class).in(Singleton.class), dc);
        dc.commit();
    }

    private boolean isEjbComponent(Class<?> component) {
        for (Annotation a : component.getAnnotations()) {
            if (EjbComponentAnnotations.contains(a.annotationType().getName())) {
View Full Code Here

            bindingBuilder.to(contract);
        }

        Injections.addBinding(bindingBuilder, dc);

        dc.commit();

        if (LOGGER.isLoggable(Level.CONFIG)) {
            LOGGER.config(LocalizationMessages.CDI_CLASS_BOUND_WITH_CDI(clazz));
        }
View Full Code Here

        final DynamicConfiguration dc = Injections.getConfiguration(locator);
        final ServiceBindingBuilder bindingBuilder =
                Injections.newFactoryBinder(new CdiFactory(TransactionalExceptionMapper.class, locator, beanManager, true));
        bindingBuilder.to(ExceptionMapper.class);
        Injections.addBinding(bindingBuilder, dc);
        dc.commit();
    }

    private boolean isCdiComponent(final Class<?> component) {
        final Annotation[] qualifiers = getQualifiers(component.getAnnotations());
        return !beanManager.getBeans(component, qualifiers).isEmpty();
View Full Code Here

                .to(ClassAnalyzer.class)
                .named(CDI_CLASS_ANALYZER);

        Injections.addBinding(bindingBuilder, dc);

        dc.commit();
    }

    private StringBuilder listTypes(final StringBuilder logMsgBuilder, final Collection<Type> types) {
        for (Type t : types) {
            logMsgBuilder.append(String.format(" - %s\n", t));
View Full Code Here

            String beanName = beanNames[0];

            ServiceBindingBuilder bb = Injections.newFactoryBinder(new SpringComponentProvider.SpringManagedBeanFactory(ctx, locator, beanName));
            bb.to(component);
            Injections.addBinding(bb, c);
            c.commit();

            LOGGER.config(LocalizationMessages.BEAN_REGISTERED(beanName));
            return true;
        }
        return false;
View Full Code Here

                .in(RequestScoped.class), dc);

        Injections.addBinding(Injections.newBinder(HK2ServicePerLookup.class).to(HK2ServicePerLookup.class)
                .in(PerLookup.class), dc);

        dc.commit();
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.