Search in sources :

Example 1 with XmlRepository

use of org.eclipse.winery.repository.xml.XmlRepository in project winery by eclipse.

the class MultiRepository method addNamespacesToRepository.

private void addNamespacesToRepository(IRepository repository, GenericId id) {
    if (id instanceof DefinitionsChildId) {
        Namespace namespace = ((DefinitionsChildId) id).getNamespace();
        String ns = namespace.getDecoded();
        IRepository r = determineRepositoryRef(repository);
        Set<String> set = repositoryGlobal.get(r);
        set.add(ns);
        repositoryGlobal.put(r, set);
        String pns;
        try {
            if (this.localRepository.getRepository() instanceof XmlRepository) {
                pns = namespace.getEncoded().substring(0, namespace.getEncoded().lastIndexOf(RepositoryUtils.getUrlSeparatorEncoded()));
            } else {
                pns = namespace.getEncoded();
            }
        } catch (UnsupportedEncodingException ex) {
            LOGGER.error("Error when generating the namespace", ex);
            return;
        }
        Set<Namespace> setPre = repositoryCommonNamespace.get(r);
        setPre.add(new Namespace(pns, true));
        repositoryCommonNamespace.put(r, setPre);
    }
}
Also used : XmlRepository(org.eclipse.winery.repository.xml.XmlRepository) DefinitionsChildId(org.eclipse.winery.model.ids.definitions.DefinitionsChildId) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IRepository(org.eclipse.winery.repository.backend.IRepository) Namespace(org.eclipse.winery.model.ids.Namespace)

Aggregations

UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Namespace (org.eclipse.winery.model.ids.Namespace)1 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)1 IRepository (org.eclipse.winery.repository.backend.IRepository)1 XmlRepository (org.eclipse.winery.repository.xml.XmlRepository)1