Search in sources :

Example 1 with FilebasedRepository

use of org.eclipse.winery.repository.backend.filebased.FilebasedRepository in project winery by eclipse.

the class RepositoryFactory method reconfigure.

public static void reconfigure(FileBasedRepositoryConfiguration fileBasedRepositoryConfiguration) {
    RepositoryFactory.fileBasedRepositoryConfiguration = fileBasedRepositoryConfiguration;
    RepositoryFactory.gitBasedRepositoryConfiguration = null;
    RepositoryFactory.jCloudsConfiguration = null;
    repository = new FilebasedRepository(fileBasedRepositoryConfiguration);
}
Also used : FilebasedRepository(org.eclipse.winery.repository.backend.filebased.FilebasedRepository)

Example 2 with FilebasedRepository

use of org.eclipse.winery.repository.backend.filebased.FilebasedRepository in project winery by eclipse.

the class WineryUsingHttpServer method main.

/**
 * When in IntelliJ, /tmp/winery-repository is used. See /src/test/resources/winery.properties
 */
public static void main(String[] args) throws Exception {
    // initialize repository
    new Prefs(true);
    Server server = createHttpServer();
    server.start();
    Server uiServer = createHttpServerForRepositoryUi();
    uiServer.start();
    IRepository repository = RepositoryFactory.getRepository();
    if (repository instanceof FilebasedRepository) {
        LOGGER.debug("Using path " + ((FilebasedRepository) repository).getRepositoryRoot());
    } else {
        LOGGER.debug("Repository is not filebased");
    }
    server.join();
    uiServer.join();
}
Also used : Server(org.eclipse.jetty.server.Server) FilebasedRepository(org.eclipse.winery.repository.backend.filebased.FilebasedRepository) Prefs(org.eclipse.winery.repository.rest.Prefs) IRepository(org.eclipse.winery.repository.backend.IRepository)

Example 3 with FilebasedRepository

use of org.eclipse.winery.repository.backend.filebased.FilebasedRepository in project winery by eclipse.

the class ServiceTemplateComplianceRuleRuleChecker method getRuleIds.

public List<ComplianceRuleId> getRuleIds(TServiceTemplate serviceTemplate) {
    List<ComplianceRuleId> complianceRules = Lists.newArrayList();
    Namespace namespace = new Namespace(serviceTemplate.getTargetNamespace(), false);
    Collection<Namespace> componentsNamespaces = RepositoryFactory.getRepository().getComponentsNamespaces(ComplianceRuleId.class);
    List<Namespace> relevantNamespaces = componentsNamespaces.stream().filter(ns -> namespace.getDecoded().startsWith(ns.getDecoded())).collect(Collectors.toList());
    for (Namespace space : relevantNamespaces) {
        complianceRules.addAll((Collection<? extends ComplianceRuleId>) ((FilebasedRepository) RepositoryFactory.getRepository()).getAllIdsInNamespace(ComplianceRuleId.class, space));
    }
    return complianceRules;
}
Also used : FilebasedRepository(org.eclipse.winery.repository.backend.filebased.FilebasedRepository) Logger(org.slf4j.Logger) ComplianceRuleId(org.eclipse.winery.common.ids.definitions.ComplianceRuleId) Collection(java.util.Collection) GraphMapping(org.jgrapht.GraphMapping) LoggerFactory(org.slf4j.LoggerFactory) Collectors(java.util.stream.Collectors) RepositoryFactory(org.eclipse.winery.repository.backend.RepositoryFactory) TServiceTemplate(org.eclipse.winery.model.tosca.TServiceTemplate) List(java.util.List) TOSCANode(org.eclipse.winery.compliance.model.TOSCANode) Lists(com.google.common.collect.Lists) IRepository(org.eclipse.winery.repository.backend.IRepository) Map(java.util.Map) TComplianceRule(org.eclipse.winery.model.tosca.TComplianceRule) Namespace(org.eclipse.winery.common.ids.Namespace) NonNull(org.eclipse.jdt.annotation.NonNull) ComplianceRuleId(org.eclipse.winery.common.ids.definitions.ComplianceRuleId) FilebasedRepository(org.eclipse.winery.repository.backend.filebased.FilebasedRepository) Namespace(org.eclipse.winery.common.ids.Namespace)

Aggregations

FilebasedRepository (org.eclipse.winery.repository.backend.filebased.FilebasedRepository)3 IRepository (org.eclipse.winery.repository.backend.IRepository)2 Lists (com.google.common.collect.Lists)1 Collection (java.util.Collection)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 NonNull (org.eclipse.jdt.annotation.NonNull)1 Server (org.eclipse.jetty.server.Server)1 Namespace (org.eclipse.winery.common.ids.Namespace)1 ComplianceRuleId (org.eclipse.winery.common.ids.definitions.ComplianceRuleId)1 TOSCANode (org.eclipse.winery.compliance.model.TOSCANode)1 TComplianceRule (org.eclipse.winery.model.tosca.TComplianceRule)1 TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)1 RepositoryFactory (org.eclipse.winery.repository.backend.RepositoryFactory)1 Prefs (org.eclipse.winery.repository.rest.Prefs)1 GraphMapping (org.jgrapht.GraphMapping)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1