/* (non-Javadoc)
@see com.tobedevoured.naether.api.Naether#addRemoteRepository(java.lang.String, java.lang.String, java.lang.String)
17115
public final void addRemoteRepository(String id, String type, String url) {
        if (this.repositoryIds.add(id) ) {
            getRemoteRepositories().add(new RemoteRepository(id, type, url));
        }
    }
643888
public void setRepositories(java.util.Collection<Repository> repositories) {
        if (repositories == null) {
            this.repositories = null;
            return;
        }

        this.repositories = new java.util.ArrayList<Repository>(repositories);
    }
1190067
public function setRepository(Repository $repository, $default = null, $customName = null)
    {
        if ($default === true) {
            $this->repository = $repository;
        }

        $name = $customName ?: $repository->getName();
        $name = $name ?: uniqid();

        $this->repositories[strtolower($name)] = $repository;

        return $this;
    }
382121
private void addRepository(String repositoryId, RepositoryWrapper repositoryHolder) {
        repositories.put(repositoryId, repositoryHolder);
        try {
            numRepos = getNumberOfRepositories();
        } catch (WIMException e) {
            // okay
        }
    }
105452
private void addRuntimeNameProperty() throws RepositoryException {
		
		String statement = 
				"/jcr:root" + ISO9075.encodePath(StorageConstants.REPORTS_ROOT) + 
				"//*[@className='ro.nextreports.server.domain.Report']" + 
				"//*[fn:name()='parametersValues']";
		  
		QueryResult queryResult = getTemplate().query(statement);

		NodeIterator nodes = queryResult.getNodes();
		
		LOG.info("RuntimeHistory : Found " + nodes.getSize() + " parameterValues nodes");
		while (nodes.hasNext()) {			
			Node node = nodes.nextNode();
			NodeIterator childrenIt = node.getNodes();
			while (childrenIt.hasNext()) {
				Node child = childrenIt.nextNode();				
				child.setProperty("runtimeName", child.getName());
			}
		}	
		getTemplate().save();		
	}
789817
protected function getRepositoryUrl($repositoryId, $selector = null)
    {
        $result = $this->getRepositoryUrlCache()->getRepositoryUrl($repositoryId, $selector);

        if ($result === null) {
            $this->getRepositoriesInternal($repositoryId);
            $result = $this->getRepositoryUrlCache()->getRepositoryUrl($repositoryId, $selector);
        }

        if ($result === null) {
            throw new CmisObjectNotFoundException(
                sprintf(
                    'Unknown repository! Repository: "%s" | Selector: "%s"',
                    $repositoryId,
                    $selector
                )
            );
        }

        return $result;
    }
666734
@Override
  public Object execute(@Nonnull final CommandContext context) throws Exception {
    RemoteRepository.Builder builder = new RemoteRepository.Builder(id, type, url);
    repositoryAccess.addRemoteRepository(builder.build());
    return null;
  }
933213
protected function addThemeRepositoryToRootComposer()
    {
        $composer = json_decode(file_get_contents(base_path('composer.json')), true);

        $composer['repositories'][] = [
            'type' => 'path',
            'url' => './'.$this->relativeThemePath(),
        ];

        file_put_contents(
            base_path('composer.json'),
            json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
        );
    }
979275
public void addDependencies( Project project, List<String> scopes ) throws ProjectException {
        for ( org.apache.maven.model.Dependency dependency : project.getDependencies(scopes) ) {
            addDependency( dependency );
        }
        
        // Add remote repositories from pom
        for ( Repository repo : project.getMavenModel().getRepositories() ) {
            this.addRemoteRepository( repo.getId(), repo.getLayout(), repo.getUrl() );
        }
    }
828719
private static void initRepositoryDefinitions() throws JSONException {
        final JSONObject jsonObject = Repositories.getRepositoriesDescription();
        if (null == jsonObject) {
            LOGGER.warn("Loads repository description [repository.json] failed");

            return;
        }

        repositoryDefinitions = new ArrayList<>();
        final JSONArray repositoritArray = jsonObject.getJSONArray(REPOSITORIES);
        JSONObject repositoryObject;
        JSONObject keyObject;
        for (int i = 0; i < repositoritArray.length(); i++) {
            repositoryObject = repositoritArray.getJSONObject(i);

            final RepositoryDefinition repositoryDefinition = new RepositoryDefinition();
            repositoryDefinitions.add(repositoryDefinition);
            repositoryDefinition.setName(repositoryObject.getString(NAME));
            repositoryDefinition.setDescription(repositoryObject.optString(DESCRIPTION));
            final List<FieldDefinition> keys = new ArrayList<>();
            repositoryDefinition.setKeys(keys);
            final JSONArray keysJsonArray = repositoryObject.getJSONArray(KEYS);
            FieldDefinition definition;
            for (int j = 0; j < keysJsonArray.length(); j++) {
                keyObject = keysJsonArray.getJSONObject(j);
                definition = fillFieldDefinitionData(keyObject);
                keys.add(definition);
            }
            repositoryDefinition.setCharset(repositoryObject.optString(CHARSET));
            repositoryDefinition.setCollate(repositoryObject.optString(COLLATE));
        }
    }
930269
protected void createRepositoryInternally(String backupId, RepositoryEntry rEntry, String rToken,
      DBCreationProperties creationProps) throws RepositoryConfigurationException, RepositoryCreationException
   {
      if (rpcService != null)
      {
         String stringRepositoryEntry = null;
         try
         {
            JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
            JsonValue json = generatorImpl.createJsonObject(rEntry);
            stringRepositoryEntry = json.toString();
         }
         catch (JsonException e)
         {
            throw new RepositoryCreationException("Can not serialize repository entry: " + e.getMessage(), e);
         }

         // notify coordinator node to create repository
         try
         {
            Object result =
               rpcService.executeCommandOnCoordinator(createRepository, true, backupId, stringRepositoryEntry, rToken,
                  creationProps);

            if (result != null)
            {
               if (result instanceof Throwable)
               {
                  throw new RepositoryCreationException("Can't create repository " + rEntry.getName(),
                     (Throwable)result);
               }
               else
               {
                  throw new RepositoryCreationException("createRepository command returned uknown result type.");
               }
            }
         }
         catch (RPCException e)
         {
            Throwable cause = (e).getCause();
            if (cause instanceof RepositoryCreationException)
            {
               throw (RepositoryCreationException)cause;
            }
            else if (cause instanceof RepositoryConfigurationException)
            {
               throw (RepositoryConfigurationException)cause;
            }
            else
            {
               throw new RepositoryCreationException(e.getMessage(), e);
            }
         }

         // execute startRepository at all cluster nodes (coordinator will ignore this command)
         try
         {
            List<Object> results =
               rpcService.executeCommandOnAllNodes(startRepository, true, stringRepositoryEntry, creationProps);

            for (Object result : results)
            {
               if (result != null)
               {
                  if (result instanceof Throwable)
                  {
                     throw new RepositoryCreationException("Repository " + rEntry.getName()
                        + " created on coordinator, but can not be started at other cluster nodes", ((Throwable)result));
                  }
                  else
                  {
                     throw new RepositoryCreationException("startRepository command returns uknown result type");
                  }
               }
            }
         }
         catch (RPCException e)
         {
            throw new RepositoryCreationException("Repository " + rEntry.getName()
               + " created on coordinator, can not be started at other cluster node: " + e.getMessage(), e);
         }
      }
      else
      {
         try
         {
            createRepositoryLocally(backupId, rEntry, rToken, creationProps);
         }
         finally
         {
            pendingRepositories.remove(rToken);
         }
      }
   }
473522
public function addRepository(RepositoryInterface $repository)
    {
        if ($repository instanceof IssueRepository) {
            $type = 'issue';
        } else {
            throw new \Exception('Unknown repository type.');
        }

        $this->repositories[$type] = $repository;
    }
864718
protected I_CmsCmisRepository getRepository(String repositoryId) {

        I_CmsCmisRepository result = OpenCms.getRepositoryManager().getRepository(
            repositoryId,
            I_CmsCmisRepository.class);
        if (result == null) {
            throw new CmisConnectionException("missing repository: " + repositoryId);
        }
        return result;
    }
1241876
public void addRepository(String id, URL url) {
        for (UpdateRepository ur : repositories) {
            if (ur.getId().equals(id)) {
                throw new RuntimeException("Repository with id " + id + " already exists");
            }
        }
        repositories.add(new DefaultUpdateRepository(id, url));
    }
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;
    }
666702
@com.fasterxml.jackson.annotation.JsonProperty("repositoryName")
    public void setRepositoryName(String repositoryName) {
        this.repositoryName = repositoryName;
    }
451974
@Override
    public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
        LOGGER.debug("-- getting repository info");
        RepositoryInfo info = jcrRepository(repositoryId).getRepositoryInfo(login(repositoryId));
        return new RepositoryInfoLocal(repositoryId, info);
    }