Package org.glassfish.hk2.api

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


                return;
            }

            final DynamicConfiguration dc = Injections.getConfiguration(locator);
            unsafeBindResource(resourceClass, null, dc);
            dc.commit();
        }
    }

    /**
     * Binds {@code resourceClass} into HK2 context as singleton.
View Full Code Here


            }
            if (getScope(resourceClass) == Singleton.class) {
                final DynamicConfiguration dc = Injections.getConfiguration(locator);
                //noinspection unchecked
                Injections.addBinding(Injections.newBinder(resource).to((Class<T>) resourceClass), dc);
                dc.commit();
            }

            bindingCache.add(resourceClass);
        }
    }
View Full Code Here

            } else {
                ProviderBinder.bindProvider(component, model, dc);
            }
        }

        dc.commit();
    }

    private boolean bindWithComponentProvider(
            final Class<?> component,
            final ContractProvider providerModel,
View Full Code Here

                Injections.newBinder(MyInjectablePerRequest.class).to(MyInjectablePerRequest.class).in(RequestScoped.class),
                dc);
        Injections.addBinding(
                Injections.newBinder(MyInjectableSingleton.class).to(MyInjectableSingleton.class).in(Singleton.class),
                dc);
        dc.commit();

        final RequestScope requestScope = locator.getService(RequestScope.class);

        final MyInjectableSingleton myInjectableSingleton = locator.getService(MyInjectableSingleton.class);
        assertEquals(myInjectableSingleton, locator.getService(MyInjectableSingleton.class));
View Full Code Here

                            .qualifiedBy(new MyQualifierImpl())
                            .in(RequestScoped.class),
                    dc);

            // commits changes
            dc.commit();
        }

        @Override
        public Set<Class<?>> getClasses() {
            return classes;
View Full Code Here

                    bind(runtimeCfgState).to(Configuration.class);
                }
            };
            final DynamicConfiguration dc = Injections.getConfiguration(locator);
            configBinder.bind(dc);
            dc.commit();

            // Bind providers.
            ProviderBinder.bindProviders(runtimeCfgState.getComponentBag(), RuntimeType.CLIENT, null, locator);

            final ClientConfig configuration = new ClientConfig(runtimeCfgState);
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

        config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(
                env.isEmbedded() ?
                new ProcessEnvironment(ProcessEnvironment.ProcessType.Embedded):
                new ProcessEnvironment(ProcessEnvironment.ProcessType.Server)));
        config.commit();

        // activate the run level services
        masterListener.reset();
       
        long initFinishTime = 0L;
View Full Code Here

        config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(
                env.isEmbedded() ?
                new ProcessEnvironment(ProcessEnvironment.ProcessType.Embedded):
                new ProcessEnvironment(ProcessEnvironment.ProcessType.Server)));
        config.commit();

        // activate the run level services
        if (proceedTo(InitRunLevel.VAL, new InitActivator())) {
            if (proceedTo(StartupRunLevel.VAL, new StartupActivator())) {
                proceedTo(PostStartupRunLevel.VAL, new PostStartupActivator());
View Full Code Here

        config.addUnbindFilter(BuilderHelper.createContractFilter(ProgramOptions.class.getName()));
        ActiveDescriptor<ProgramOptions> desc = BuilderHelper.createConstantDescriptor(
                options, null, ProgramOptions.class);
        config.addActiveDescriptor(desc);
       
        config.commit();
    }

    /**
     * Read commands from the specified BufferedReader
     * and execute them.  If printPrompt is set, prompt first.
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.