Decorates a {@link Repository} with one or more {@link DynamicDecorator}s., based on the {@link
DecoratorConfiguration} entity.
480077
@SuppressWarnings("unchecked")
  private Repository<Entity> decorateRepository(
      Repository<Entity> repository, DecoratorConfiguration configuration) {
    Map<String, Map<String, Object>> parameterMap = getParameterMap(configuration);
    List<DecoratorParameters> decoratorParameters =
        configuration.getDecoratorParameters().collect(toList());
    for (DecoratorParameters decoratorParam : decoratorParameters) {
      DynamicRepositoryDecoratorFactory factory =
          factories.get(decoratorParam.getDecorator().getId());
      if (factory != null) {
        repository =
            factory.createDecoratedRepository(repository, parameterMap.get(factory.getId()));
      }
    }
    return repository;
  }
167272
public void addDecorator(DayViewDecorator decorator) {
    if (decorator == null) {
      return;
    }
    dayViewDecorators.add(decorator);
    adapter.setDecorators(dayViewDecorators);
  }
66188
def injectClassCallback(annotationName, depth, methodName, *args, **kwargs):
    
    locals = reflect.class_locals(depth, annotationName)
    annotations = locals.get(_CLASS_ANNOTATIONS_ATTR, None)
    if annotations is None:
        annotations = list()
        locals[_CLASS_ANNOTATIONS_ATTR] = annotations
    annotation = (annotationName, methodName, args, kwargs)
    annotations.append(annotation)
354213
public <T> void addRepository(JpaRepositoryConfig<T> config) {
		checkNotInitialized();
		Class<?> resourceClass = config.getResourceClass();
		if (repositoryConfigurationMap.containsKey(resourceClass)) {
			throw new IllegalArgumentException(resourceClass.getName() + " is already registered");
		}
		repositoryConfigurationMap.put(resourceClass, config);
	}
1281469
public static <E> JpaRepositoryConfig.Builder<E> builder(Class<E> entityClass) {
        JpaRepositoryConfig.Builder<E> builder = new JpaRepositoryConfig.Builder<>();
        builder.entityClass = entityClass;
        builder.resourceClass = entityClass;
        return builder;
    }
1046784
@SuppressWarnings("unchecked")
    private static Function<Service<HttpRequest, HttpResponse>,
            ? extends Service<HttpRequest, HttpResponse>> newDecorator(Decorator decorator) {
        return service -> service.decorate(getInstance(decorator, DecoratingServiceFunction.class));
    }
210763
public void setRepository(String repository) {
        if (meta == null) {
            meta = new EventMeta();
        }
        meta.setRepository(repository);
    }
400940
private LoadingCache<Object, Optional<Map<String, Object>>> createEntityCache(
      Repository<Entity> repository) {
    Caffeine<Object, Object> cacheBuilder =
        Caffeine.newBuilder().recordStats().expireAfterAccess(10, MINUTES);
    if (!MetaDataService.isMetaEntityType(repository.getEntityType())) {
      cacheBuilder.maximumSize(MAX_CACHE_SIZE_PER_ENTITY);
    }
    LoadingCache<Object, Optional<Map<String, Object>>> cache =
        CaffeinatedGuava.build(cacheBuilder, createCacheLoader(repository));
    GuavaCacheMetrics.monitor(meterRegistry, cache, "l2." + repository.getEntityType().getId());
    return cache;
  }
194866
public void addCrudService(Class clazz, BundleContext bundleContext, JcrRepository repository) throws RepositoryException {
        jcrom.map(clazz);
        JcrCrudService<? extends Object> jcromCrudService;
        jcromCrudService = new JcrCrudService<>(repository, jcrom, clazz);
        crudServiceRegistrations.put(jcromCrudService, registerCrud(bundleContext, jcromCrudService));
    }
1342783
public final U setDecorators(
            List<Function<Service<HttpRequest, HttpResponse>,
                    ? extends Service<HttpRequest, HttpResponse>>> decorators) {
        this.decorators = requireNonNull(decorators, "decorators");
        return self();
    }
874879
private void apiAfterConfiguration(){
		ProducerFilterConfig filterConfig[] = WebUIConfig.getInstance().getFilters();
		if (filterConfig==null || filterConfig.length==0)
			return;
		List<ProducerFilter> newProducerFilters = new ArrayList<>(filterConfig.length);
		for (ProducerFilterConfig pfc : filterConfig){
			try {
				ProducerFilter filter = (ProducerFilter)Class.forName(pfc.getClazzName()).newInstance();
				filter.customize(pfc.getParameter());
				newProducerFilters.add(filter);
			} catch (InstantiationException e) {
				log.warn("Can't initialize filter of class "+pfc.getClazzName());
			} catch (IllegalAccessException e) {
				log.warn("Can't initialize filter of class " + pfc.getClazzName());
			} catch (ClassNotFoundException e) {
				log.warn("Can't initialize filter of class " + pfc.getClazzName());
			}
		}

		DecoratorConfig[] decoratorConfigs = WebUIConfig.getInstance().getDecorators();
		if (decoratorConfigs != null){
			log.debug("Configuring decorator configs "+ Arrays.toString(decoratorConfigs));
			for (DecoratorConfig config : decoratorConfigs){
				try{
					Class decoratorClass = Class.forName(config.getDecoratorClazzName());
					IDecorator decorator = (IDecorator) decoratorClass.newInstance();
					DecoratorRegistryFactory.getDecoratorRegistry().addDecorator(config.getStatClazzName(), decorator);

				}catch (ClassNotFoundException e){
					log.warn("can't configure decorator "+config+" due ", e);
				} catch (InstantiationException e) {
					log.warn("can't configure decorator " + config + " due ", e);
				} catch (IllegalAccessException e) {
					log.warn("can't configure decorator "+config+" due ", e);
				}
			}
		}

		producerFilters = newProducerFilters;

	}
366382
@SuppressWarnings("unchecked")
    public <T extends BaseWrapper<T>> T create(final Object entity, boolean isRevision) {
        if (entity == null) {
            return null;
        }

        // Create the key
        final DBWrapperKey key = new DBWrapperKey(entity);

        // Check to see if a wrapper has already been cached for the key
        final BaseWrapper cachedWrapper = wrapperCache.get(key);
        if (cachedWrapper != null) {
            return (T) cachedWrapper;
        }

        final DBBaseWrapper wrapper;

        if (entity instanceof ApplicationConfig) {
            // SERVER SETTINGS
            wrapper = new DBServerSettingsWrapper(getProviderFactory(), (ApplicationConfig) entity);
        } else if (entity instanceof EntitiesConfig) {
            // SERVER ENTITIES
            wrapper = new DBServerEntitiesWrapper(getProviderFactory(), (EntitiesConfig) entity);
        } else if (entity instanceof UndefinedEntity) {
            // UNDEFINED ENTITY
            wrapper = new DBServerUndefinedEntityWrapper(getProviderFactory(), (UndefinedEntity) entity);
        } else if (entity instanceof UndefinedSetting) {
            // UNDEFINED SETTING
            wrapper = new DBServerUndefinedSettingWrapper(getProviderFactory(), (UndefinedSetting) entity);
        } else if (entity instanceof Locale) {
            // Locale
            wrapper = new DBLocaleWrapper(getProviderFactory(), (Locale) entity);
        } else if (entity instanceof TranslationServer) {
            // Translation server
            throw new UnsupportedOperationException("A return class needs to be specified for TranslationServer entities.");
        } else if (entity instanceof Topic) {
            // TOPIC
            wrapper = new DBTopicWrapper(getProviderFactory(), (Topic) entity, isRevision);
        } else if (entity instanceof TopicSourceUrl) {
            // TOPIC SOURCE URL
            wrapper = new DBTopicSourceURLWrapper(getProviderFactory(), (TopicSourceUrl) entity, isRevision);
        } else if (entity instanceof TranslatedTopicData) {
            // TRANSLATED TOPIC
            wrapper = new DBTranslatedTopicDataWrapper(getProviderFactory(), (TranslatedTopicData) entity, isRevision);
        } else if (entity instanceof TranslatedTopicString) {
            // TRANSLATED TOPIC STRING
            wrapper = new DBTranslatedTopicStringWrapper(getProviderFactory(), (TranslatedTopicString) entity, isRevision);
        } else if (entity instanceof Tag) {
            // TAG
            wrapper = new DBTagWrapper(getProviderFactory(), (Tag) entity, isRevision);
        } else if (entity instanceof TagToCategory) {
            throw new UnsupportedOperationException("A return class needs to be specified for TagToCategory entities.");
        } else if (entity instanceof Category) {
            // CATEGORY
            wrapper = new DBCategoryWrapper(getProviderFactory(), (Category) entity, isRevision);
        } else if (entity instanceof PropertyTag) {
            // PROPERTY TAGS
            wrapper = new DBPropertyTagWrapper(getProviderFactory(), (PropertyTag) entity, isRevision);
        } else if (entity instanceof TopicToPropertyTag) {
            wrapper = new DBTopicToPropertyTagWrapper(getProviderFactory(), (TopicToPropertyTag) entity, isRevision);
        } else if (entity instanceof TagToPropertyTag) {
            wrapper = new DBTagToPropertyTagWrapper(getProviderFactory(), (TagToPropertyTag) entity, isRevision);
        } else if (entity instanceof ContentSpecToPropertyTag) {
            wrapper = new DBContentSpecToPropertyTagWrapper(getProviderFactory(), (ContentSpecToPropertyTag) entity, isRevision);
        } else if (entity instanceof PropertyTagToPropertyTagCategory) {
            wrapper = new DBPropertyTagToPropertyTagCategoryWrapper(getProviderFactory(), (PropertyTagToPropertyTagCategory) entity,
                    isRevision);
        } else if (entity instanceof BlobConstants) {
            // BLOB CONSTANT
            wrapper = new DBBlobConstantWrapper(getProviderFactory(), (BlobConstants) entity, isRevision);
        } else if (entity instanceof StringConstants) {
            // STRING CONSTANT
            wrapper = new DBStringConstantWrapper(getProviderFactory(), (StringConstants) entity, isRevision);
        } else if (entity instanceof File) {
            // FILE
            wrapper = new DBFileWrapper(getProviderFactory(), (File) entity, isRevision);
        } else if (entity instanceof LanguageFile) {
            // LANGUAGE FILE
            wrapper = new DBLanguageFileWrapper(getProviderFactory(), (LanguageFile) entity, isRevision);
        } else if (entity instanceof ImageFile) {
            // IMAGE
            wrapper = new DBImageWrapper(getProviderFactory(), (ImageFile) entity, isRevision);
        } else if (entity instanceof LanguageImage) {
            // LANGUAGE IMAGE
            wrapper = new DBLanguageImageWrapper(getProviderFactory(), (LanguageImage) entity, isRevision);
        } else if (entity instanceof User) {
            // USER
            wrapper = new DBUserWrapper(getProviderFactory(), (User) entity, isRevision);
        } else if (entity instanceof ContentSpec) {
            // CONTENT SPEC
            throw new UnsupportedOperationException("A return class needs to be specified for ContentSpec entities.");
        } else if (entity instanceof CSNode) {
            // CONTENT SPEC NODE
            wrapper = new DBCSNodeWrapper(getProviderFactory(), (CSNode) entity, isRevision);
        } else if (entity instanceof CSNodeToCSNode) {
            wrapper = new DBCSRelatedNodeWrapper(getProviderFactory(), (CSNodeToCSNode) entity, isRevision);
        } else if (entity instanceof CSInfoNode) {
            // CONTENT SPEC INFO NODE
            wrapper = new DBCSInfoNodeWrapper(getProviderFactory(), (CSInfoNode) entity, isRevision);
        } else if (entity instanceof TranslatedCSNode) {
            // CONTENT SPEC TRANSLATED NODE
            wrapper = new DBTranslatedCSNodeWrapper(getProviderFactory(), (TranslatedCSNode) entity, isRevision);
        } else if (entity instanceof TranslatedCSNodeString) {
            // CONTENT SPEC TRANSLATED NODE STRING
            wrapper = new DBTranslatedCSNodeStringWrapper(getProviderFactory(), (TranslatedCSNodeString) entity, isRevision);
        } else if (entity instanceof CSTranslationDetail) {
            // CONTENT SPEC TRANSLATION DETAIL
            wrapper = new DBCSTranslationDetailWrapper(getProviderFactory(), (CSTranslationDetail) entity);
        } else {
            throw new IllegalArgumentException("Failed to create a Wrapper instance as there is no wrapper available for the Entity.");
        }

        // Add the wrapper to the cache
        wrapperCache.put(key, wrapper);

        return (T) wrapper;
    }
433477
private void createDynamicConfigManager() {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "createDynamicConfigManager");

        _dynamicConfigManager = new DynamicConfigManager(this);

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "createDynamicConfigManager");
    }
386589
@SuppressWarnings("unchecked")
    public static Set<Repository> toRepositoryList(Vector<Object> repositoriesParams)
    {
        Set<Repository> repositories = new TreeSet<Repository>();
        for(Object repositoryParams : repositoriesParams)
        {
            repositories.add(toRepository((Vector<Object>)repositoryParams));
        }
        
        return repositories;
    }
1030347
@PostConstruct
    public void buildRepository() {
        try {
            LOGGER.info("Using repo config (classpath): {}", repositoryConfiguration.getURL());
            getPropertiesLoader().loadSystemProperties();

            final RepositoryConfiguration config =
                    RepositoryConfiguration.read(repositoryConfiguration.getURL());
            repository = modeShapeEngine.deploy(config);

            // next line ensures that repository starts before the factory is used.
            final org.modeshape.common.collection.Problems problems =
                    repository.getStartupProblems();
            for (final org.modeshape.common.collection.Problem p : problems) {
                LOGGER.error("ModeShape Start Problem: {}", p.getMessageString());
                // TODO determine problems that should be runtime errors
            }
        } catch (final Exception e) {
            throw new RepositoryRuntimeException(e);
        }
    }
1274723
@Override
    public Function<Service<HttpRequest, HttpResponse>,
            ? extends Service<HttpRequest, HttpResponse>> newDecorator(LoggingDecorator parameter) {
        return new LoggingServiceBuilder()
                .requestLogLevel(parameter.requestLogLevel())
                .successfulResponseLogLevel(parameter.successfulResponseLogLevel())
                .failureResponseLogLevel(parameter.failureResponseLogLevel())
                .samplingRate(parameter.samplingRate())
                .newDecorator();
    }
342028
protected <T> void bindDynamicProvider(TypeLiteral<T> typeLiteral) {
    DynamicAnnotations.bindDynamicProvider(binder(), Key.get(typeLiteral, getBindingAnnotation()));
  }