private static ActiveDescriptor<?> translateToActiveDescriptor(InjectionResolverBinding<?> desc) { ParameterizedTypeImpl parameterizedType = new ParameterizedTypeImpl( org.glassfish.jersey.internal.inject.InjectionResolver.class, desc.getResolver().getAnnotation()); return BuilderHelper.createConstantDescriptor(desc.getResolver(), null, parameterizedType); }
private static ActiveDescriptor<?> translateToActiveDescriptor(InjectionResolverBinding<?> desc) { ParameterizedTypeImpl parameterizedType = new ParameterizedTypeImpl( org.glassfish.jersey.internal.inject.InjectionResolver.class, desc.getResolver().getAnnotation()); return BuilderHelper.createConstantDescriptor(desc.getResolver(), null, parameterizedType); }
AbstractActiveDescriptor<? extends Supplier<?>> supplierBuilder = BuilderHelper.createConstantDescriptor(supplier); binding.getContracts().forEach(contract -> { supplierBuilder.addContractType(new ParameterizedTypeImpl(Supplier.class, contract));
AbstractActiveDescriptor<? extends Supplier<?>> supplierBuilder = BuilderHelper.createConstantDescriptor(supplier); binding.getContracts().forEach(contract -> { supplierBuilder.addContractType(new ParameterizedTypeImpl(Supplier.class, contract));
static ActiveDescriptor<?> translateToActiveDescriptor(InstanceBinding<?> desc, Type... contracts) { AbstractActiveDescriptor<?> binding; if (contracts.length == 0) { binding = BuilderHelper.createConstantDescriptor(desc.getService()); } else { binding = BuilderHelper.createConstantDescriptor(desc.getService(), null, contracts); } binding.setName(desc.getName()); binding.setClassAnalysisName(desc.getAnalyzer()); if (desc.getScope() != null) { binding.setScope(desc.getScope().getName()); } if (desc.getRank() != null) { binding.setRanking(desc.getRank()); } for (Annotation annotation : desc.getQualifiers()) { binding.addQualifierAnnotation(annotation); } for (Type contract : desc.getContracts()) { binding.addContractType(contract); } if (desc.isProxiable() != null) { binding.setProxiable(desc.isProxiable()); } if (desc.isProxiedForSameScope() != null) { binding.setProxyForSameScope(desc.isProxiedForSameScope()); } return binding; }
static ActiveDescriptor<?> translateToActiveDescriptor(InstanceBinding<?> desc, Type... contracts) { AbstractActiveDescriptor<?> binding; if (contracts.length == 0) { binding = BuilderHelper.createConstantDescriptor(desc.getService()); } else { binding = BuilderHelper.createConstantDescriptor(desc.getService(), null, contracts); } binding.setName(desc.getName()); binding.setClassAnalysisName(desc.getAnalyzer()); if (desc.getScope() != null) { binding.setScope(desc.getScope().getName()); } if (desc.getRank() != null) { binding.setRanking(desc.getRank()); } for (Annotation annotation : desc.getQualifiers()) { binding.addQualifierAnnotation(annotation); } for (Type contract : desc.getContracts()) { binding.addContractType(contract); } if (desc.isProxiable() != null) { binding.setProxiable(desc.isProxiable()); } if (desc.isProxiedForSameScope() != null) { binding.setProxyForSameScope(desc.isProxiedForSameScope()); } return binding; }
/** * This method adds one existing object to the given service locator. The caller * of this will not get a chance to customize the descriptor that goes into the * locator, and hence must rely completely on the analysis of the system to determine * the set of contracts and metadata associated with the descriptor. The same algorithm * is used in this method as in the {@link BuilderHelper#createConstantDescriptor(Object)} * method. * * @param locator The non-null locator to add this descriptor to * @param constant The non-null constant to add to the service locator * @return The descriptor that was added to the service locator */ public static <T> ActiveDescriptor<T> addOneConstant(ServiceLocator locator, Object constant) { if (locator == null || constant == null) throw new IllegalArgumentException(); return addOneDescriptor(locator, BuilderHelper.createConstantDescriptor(constant), false); }
/** * This method adds one existing object to the given service locator. The caller * of this will not get a chance to customize the descriptor that goes into the * locator, and hence must rely completely on the analysis of the system to determine * the set of contracts and metadata associated with the descriptor. The same algorithm * is used in this method as in the {@link BuilderHelper#createConstantDescriptor(Object)} * method. * * @param locator The non-null locator to add this descriptor to * @param constant The non-null constant to add to the service locator * @return The descriptor that was added to the service locator */ public static <T> ActiveDescriptor<T> addOneConstant(ServiceLocator locator, Object constant) { if (locator == null || constant == null) throw new IllegalArgumentException(); return addOneDescriptor(locator, BuilderHelper.createConstantDescriptor(constant), false); }
/** * This method adds one existing object to the given service locator. The caller * of this will not get a chance to customize the descriptor that goes into the * locator, and hence must rely completely on the analysis of the system to determine * the set of contracts and metadata associated with the descriptor. The same algorithm * is used in this method as in the {@link BuilderHelper#createConstantDescriptor(Object)} * method. * * @param locator The non-null locator to add this descriptor to * @param constant The non-null constant to add to the service locator * @return The descriptor that was added to the service locator */ public static <T> ActiveDescriptor<T> addOneConstant(ServiceLocator locator, Object constant) { if (locator == null || constant == null) throw new IllegalArgumentException(); return addOneDescriptor(locator, BuilderHelper.createConstantDescriptor(constant), false); }
/** * This method adds one existing object to the given service locator. The caller * of this will not get a chance to customize the descriptor that goes into the * locator, and hence must rely completely on the analysis of the system to determine * the set of contracts and metadata associated with the descriptor. The same algorithm * is used in this method as in the {@link BuilderHelper#createConstantDescriptor(Object)} * method. * * @param locator The non-null locator to add this descriptor to * @param constant The non-null constant to add to the service locator * @return The descriptor that was added to the service locator */ public static <T> ActiveDescriptor<T> addOneConstant(ServiceLocator locator, Object constant) { if (locator == null || constant == null) throw new IllegalArgumentException(); return addOneDescriptor(locator, BuilderHelper.createConstantDescriptor(constant), false); }
protected void initializeServiceLocator(ServiceLocator serviceLocator) throws MultiException { DynamicConfigurationService dcs = serviceLocator .getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(Logger.getAnonymousLogger())); // default modules registry is the one that created the habitat config.bind(BuilderHelper.createConstantDescriptor(this)); ContextDuplicatePostProcessor processor = serviceLocator.getService(ContextDuplicatePostProcessor.class); if (processor == null) { config.addActiveDescriptor(ContextDuplicatePostProcessor.class); } config.commit(); }
protected void initializeServiceLocator(ServiceLocator serviceLocator) throws MultiException { DynamicConfigurationService dcs = serviceLocator .getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(Logger.getAnonymousLogger())); // default modules registry is the one that created the habitat config.bind(BuilderHelper.createConstantDescriptor(this)); ContextDuplicatePostProcessor processor = serviceLocator.getService(ContextDuplicatePostProcessor.class); if (processor == null) { config.addActiveDescriptor(ContextDuplicatePostProcessor.class); } config.commit(); }
@Override public ServiceLocator createServiceLocator(String name) throws MultiException { ServiceLocator serviceLocator = super.createServiceLocator(name); StartupContext sc = startupContext; if (startupContext==null) { sc = new StartupContext(new Properties()); } DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(sc)); config.commit(); return serviceLocator; }
private <U extends ConfigBeanProxy> U getExtension(Class<U> configExtensionType, C extensionOwner) { List<U> extensions = configModularityUtils.getExtensions(extensionOwner); for (ConfigBeanProxy extension : extensions) { try { U configBeanInstance = configExtensionType.cast(extension); if (configBeanInstance instanceof ConfigExtension) { ServiceLocatorUtilities.addOneDescriptor(serviceLocator, BuilderHelper.createConstantDescriptor(configBeanInstance, ServerEnvironment.DEFAULT_INSTANCE_NAME, ConfigSupport.getImpl(configBeanInstance).getProxyType())); } return configBeanInstance; } catch (Exception e) { // ignore, not the right type. } } return null; }
@Override public ServiceLocator createServiceLocator(String name) throws MultiException { ServiceLocator serviceLocator = super.createServiceLocator(name); StartupContext sc = startupContext; if (startupContext==null) { sc = new StartupContext(new Properties()); } DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(sc)); config.commit(); return serviceLocator; }
private static ActiveDescriptor<?> translateToActiveDescriptor(InjectionResolverBinding<?> desc) { ParameterizedTypeImpl parameterizedType = new ParameterizedTypeImpl( org.glassfish.jersey.internal.inject.InjectionResolver.class, desc.getResolver().getAnnotation()); return BuilderHelper.createConstantDescriptor(desc.getResolver(), null, parameterizedType); }
private void addDescriptorFileFinder( ServiceLocator serviceLocator, DescriptorFileFinder descriptorFileFinder) { if (descriptorFileFinder != null) { DynamicConfigurationService dcs = serviceLocator .getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.addActiveDescriptor(BuilderHelper .createConstantDescriptor(descriptorFileFinder)); config.commit(); } }
private void addDescriptorFileFinder( ServiceLocator serviceLocator, DescriptorFileFinder descriptorFileFinder) { if (descriptorFileFinder != null) { DynamicConfigurationService dcs = serviceLocator .getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.addActiveDescriptor(BuilderHelper .createConstantDescriptor(descriptorFileFinder)); config.commit(); } }
private static ActiveDescriptor<?> translateToActiveDescriptor(InjectionResolverBinding<?> desc) { ParameterizedTypeImpl parameterizedType = new ParameterizedTypeImpl( org.glassfish.jersey.internal.inject.InjectionResolver.class, desc.getResolver().getAnnotation()); return BuilderHelper.createConstantDescriptor(desc.getResolver(), null, parameterizedType); }
private static void atomicReplace(ServiceLocator locator, ProgramOptions options) { DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.addUnbindFilter(BuilderHelper.createContractFilter(ProgramOptions.class.getName())); ActiveDescriptor<ProgramOptions> desc = BuilderHelper.createConstantDescriptor( options, null, ProgramOptions.class); config.addActiveDescriptor(desc); config.commit(); }