Create a repository by connection configuration.

@param ContainerBuilder $container
@param string           $name
@param array            $repositoryConfiguration
@param string           $indexName
433254
private function createSearchRepository(
        ContainerBuilder $container,
        string $name,
        array $repositoryConfiguration,
        string $indexName
    ) {
        $repositoryName = "apisearch.repository_$name.$indexName";
        $repositoryTransformableName = "apisearch.repository_transformable_$name.$indexName";
        $clientName = "apisearch.client_$name";

        switch ($repositoryConfiguration['adapter']) {
            case 'in_memory':
                $repositoryDefinition = $container
                    ->register($repositoryName, InMemoryRepository::class)
                    ->setPublic($this->repositoryIsTest($repositoryConfiguration));
                break;

            case 'disk':
                $repositoryDefinition = $container
                    ->register($repositoryName, DiskRepository::class)
                    ->addArgument($repositoryConfiguration['disk_file'].'.'.$name)
                    ->setPublic($this->repositoryIsTest($repositoryConfiguration));
                break;

            case 'http':
            case 'http_test':
                $repositoryDefinition = $container
                    ->register($repositoryName, HttpRepository::class)
                    ->addArgument(new Reference($clientName))
                    ->setPublic($this->repositoryIsTest($repositoryConfiguration));
                break;

            case 'service':
                $container->setAlias($repositoryName, $repositoryConfiguration['search']['repository_service']);
                $aliasDefinition = $container->getAlias($repositoryName);
                $aliasDefinition->setPublic($this->repositoryIsTest($repositoryConfiguration));
                $repositoryDefinition = $container->getDefinition($repositoryConfiguration['search']['repository_service']);
                break;
        }

        $this->injectRepositoryCredentials(
            $repositoryDefinition,
            $name,
            $repositoryConfiguration,
            $indexName
        );

        $definition = $container
            ->register($repositoryTransformableName, TransformableRepository::class)
            ->setDecoratedService($repositoryName)
            ->addArgument(new Reference($repositoryTransformableName.'.inner'))
            ->addArgument(new Reference('apisearch.transformer'))
            ->setPublic($this->repositoryIsTest($repositoryConfiguration));

        $this->injectRepositoryCredentials(
            $definition,
            $name,
            $repositoryConfiguration,
            $indexName
        );

        $container
            ->getDefinition('apisearch.repository_bucket')
            ->addMethodCall(
                'addRepository',
                [$name, $indexName, new Reference($repositoryName)]
            )
            ->setPublic($this->repositoryIsTest($repositoryConfiguration));
    }
501037
protected function configureAsseticBundle(ContainerBuilder $container, array $config)
    {
        foreach (array_keys($container->getExtensions()) as $name) {
            switch ($name) {
                case 'assetic':
                    $asseticConfig = new AsseticConfiguration;
                    $container->prependExtensionConfig(
                        $name,
                        array('assets' => $asseticConfig->build($config))
                    );
                    break;
            }
        }
    }
1153011
protected RepositoryConfig createRepositoryConfiguration() throws ConfigurationException, IOException {

        final File jcrHome = getOuterRule().getRoot();
        final URL cfgUrl = this.getConfigUrl();
        assertNotNull("No Repository Configuration found", cfgUrl);

        return RepositoryConfig.create(cfgUrl.openStream(), jcrHome.getAbsolutePath());
    }
1323569
public function configureIndex(
        IndexUUID $indexUUID,
        Config $config
    ) {
        if (!array_key_exists($this->getIndexKey($indexUUID), $this->indices)) {
            throw ResourceNotAvailableException::indexNotAvailable('Index not available in InMemoryRepository');
        }

        $this->indices[$this->getIndexKey($indexUUID)]['was_reconfigured'] = true;
    }
345242
public function getOptions(ContainerInterface $container, $key, $name = null)
    {
        if ($name === null) {
            $name = $this->getName();
        }

        $options = $container->get('config');
        $options = $options['doctrine'];
        if ($mappingType = $this->getMappingType()) {
            $options = $options[$mappingType];
        }
        $options = isset($options[$key][$name]) ? $options[$key][$name] : null;

        if (null === $options) {
            throw new RuntimeException(
                sprintf(
                    'Options with name "%s" could not be found in "doctrine.%s".',
                    $name,
                    $key
                )
            );
        }

        $optionsClass = $this->getOptionsClass();

        return new $optionsClass($options);
    }
1012383
protected function createRepository(EntityManagerInterface $entityManager, $entityName)
    {
        $metadata = $entityManager->getClassMetadata($entityName);
        $repository = $metadata->customRepositoryClassName;

        if ($repository === null) {
            $repository = $entityManager->getConfiguration()->getDefaultRepositoryClassName();
        }

        return $this->createResourceRepository(
            $repository,
            $entityManager,
            $metadata,
            $this->resolveResource($metadata->getName())
        );
    }
9799
public static function getInstance($name, array $config, Container $repository, Repository $cache)
    {
        if (self::$oInstance == false) {
            self::$oInstance = new Registry($name, $config, $repository, $cache);
        }
        return self::$oInstance;
    }
473522
public function addRepository(RepositoryInterface $repository)
    {
        if ($repository instanceof IssueRepository) {
            $type = 'issue';
        } else {
            throw new \Exception('Unknown repository type.');
        }

        $this->repositories[$type] = $repository;
    }
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);
        }
    }
638271
public function attachRegistryToRepository(ContainerBuilder $container, $registryId, $repositoryId)
    {
        $registry   = $container->getDefinition($registryId);
        $repository = $container->getDefinition($repositoryId);
        if ( ! $registry->hasTag('spray_persistence.filter_registry')) {
            $registry->addTag('spray_persistence.filter_registry');
        }
        if ( ! $repository->hasMethodCall('setFilterLocator')) {
            $repository->addMethodCall('setFilterLocator', array(
                new Reference($registryId)
            ));
        }
    }
981287
protected function getPackage(RepositoryInterface $repos, $name)
    {
        $name = strtolower($name);
        $pool = new Pool('dev');
        $pool->addRepository($repos);
        $matches = $pool->whatProvides($name);

        foreach ($matches as $index => $package) {
            // skip providers/replacers
            if ($package->getName() !== $name) {
                unset($matches[$index]);
                continue;
            }

            return $package;
        }
    }
215925
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('lag.repository.repository_pool')) {
            return;
        }
        // find service with doctrine.repository tag
        $repositoryTags = $container->findTaggedServiceIds('doctrine.repository');
        // get pool definition
        $poolDefinition = $container->findDefinition('lag.repository.repository_pool');

        foreach ($repositoryTags as $serviceId => $tags) {
            // add repository to the pool
            $poolDefinition->addMethodCall('add', [
                new Reference($serviceId),
            ]);
        }
    }
712894
protected function loadConfigurationFiles(Application $app, RepositoryContract $config)
    {
        foreach ($this->getConfigurationFiles($app) as $key => $path) {
            $config->set($key, require $path);
        }
    }
475199
@Override
    protected RepositoryImpl createRepository() throws IOException {

        try {
            final RepositoryConfig config = createRepositoryConfiguration();
            return RepositoryImpl.create(config);
        } catch (final ConfigurationException e) {
            LOG.error("Configuration invalid", e);
            throw new AssertionError(e.getMessage(), e);
        } catch (RepositoryException e) {
            LOG.error("Could not create repository", e);
            throw new AssertionError(e.getMessage(), e);
        }
    }
1073940
public static function create(
        AppUUID $appUUID = null,
        IndexUUID $indexUUID = null
    ): RepositoryReference {
        return new self($appUUID, $indexUUID);
    }
145641
private static function createConfiguration(array $config, ContainerInterface $container = null)
    {
        $cache = $config['cache'];

        if ($container && is_string($config['cache']) && $container->has($config['cache'])) {
            $cache = $container->get($config['cache']);
        }

        return Setup::createConfiguration($config['debug'], $config['proxy_dir'], $cache);
    }
1208847
public function bindParameters(ContainerBuilder $container, $name, $config)
    {
        $container->setParameter('alpixel_user.role_descriptions', $config['role_descriptions']);
        $container->setParameter('alpixel_user.firewall_templates', $config['firewall_templates']);
        $container->setParameter('alpixel_user.default_login_background_image', $config['default_login_background_image']);
        $container->setParameter('alpixel_user.default_login_background_color', $config['default_login_background_color']);
    }