Package org.glassfish.hk2.api

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


        if (descriptor.getLocatorId() != null && descriptor.getServiceId() != null) {
            Filter destructionFilter = BuilderHelper.createSpecificDescriptorFilter(descriptor);
           
            config.addUnbindFilter(destructionFilter);
           
            config.commit();
           
            return;
        }
       
        // Must use second algorithm, which is not as precise, but which still mainly works
View Full Code Here


           
        };
       
        config.addUnbindFilter(destructionFilter);
       
        config.commit();
    }
   
    /**
     * Removes all the descriptors from the given locator that match the
     * given filter
View Full Code Here

        DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
        DynamicConfiguration config = dcs.createDynamicConfiguration();
       
        config.addUnbindFilter(filter);
       
        config.commit();
    }
   
    /**
     * Returns the best service matching the passed in fully qualified
     * class name of the service
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

        DynamicConfiguration dc = dcs.createDynamicConfiguration();

        locator.inject(binder);
        binder.bind(dc);

        dc.commit();
    }

    /**
     * Get the class by contract or create and inject a new instance.
     *
 
View Full Code Here

                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(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

            for (final Binder binder : binders) {
                binder.bind(dc);
                allConfigured.add(binder);
            }
            dc.commit();
        }

        return allConfigured;
    }
View Full Code Here

    public void bindInstances(final Iterable<Object> instances) {
        final DynamicConfiguration dc = Injections.getConfiguration(locator);
        for (final Object instance : instances) {
            bindInstance(instance, dc);
        }
        dc.commit();
    }


    /**
     * Register/bind custom provider classes. Registered providers will be handled
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.