use of org.eclipse.winery.repository.backend.filebased.AbstractFileBasedRepository in project winery by eclipse.
the class RepositoryFactory method reconfigure.
public static void reconfigure(GitBasedRepositoryConfiguration configuration) throws IOException, GitAPIException {
RepositoryFactory.gitBasedRepositoryConfiguration = configuration;
RepositoryFactory.fileBasedRepositoryConfiguration = null;
if (repositoryContainsMultiRepositoryConfiguration(configuration)) {
repository = new MultiRepository(configuration.getRepositoryPath().get());
} else if (Environments.getInstance().getRepositoryConfig().isTenantRepository()) {
repository = new TenantRepository(configuration.getRepositoryPath().get());
} else {
// if a repository root is specified, use it instead of the root specified in the config
AbstractFileBasedRepository localRepository = configuration.getRepositoryPath().isPresent() ? createXmlOrYamlRepository(configuration, configuration.getRepositoryPath().get()) : createXmlOrYamlRepository(configuration, Paths.get(Environments.getInstance().getRepositoryConfig().getRepositoryRoot()));
repository = new GitBasedRepository(configuration, localRepository);
}
}
use of org.eclipse.winery.repository.backend.filebased.AbstractFileBasedRepository in project winery by eclipse.
the class WineryUsingHttpServer method main.
public static void main(String[] args) throws Exception {
// Initialize repository
new Prefs(true);
Server server = createHttpServer();
server.start();
IRepository repository = RepositoryFactory.getRepository();
if (repository instanceof AbstractFileBasedRepository) {
LOGGER.debug("Using path " + repository.getRepositoryRoot());
} else {
LOGGER.debug("Repository is not filebased");
}
// Waits until server is finished.
// Will never happen, thus user has to press Ctrl+C.
// See also https://stackoverflow.com/a/14981621/873282.
server.join();
}
use of org.eclipse.winery.repository.backend.filebased.AbstractFileBasedRepository in project winery by eclipse.
the class WineryCli method main.
public static void main(String[] args) throws Exception {
Option repositoryPathOption = new Option("p", "path", true, "use given path as repository path");
Option serviceTemplatesOnlyOption = new Option("so", "servicetemplatesonly", false, "checks service templates instead of the whole repository");
Option checkDocumentationOption = new Option("cd", "checkdocumentation", false, "check existence of README.md and LICENSE. Default: No check");
Option verboseOption = new Option("v", "verbose", false, "be verbose: Output the checked elements");
Option generateCopybaraConfigOption = new Option("cb", "generatecopybaraconfig", true, "Generates a configuration for Copybara.");
generateCopybaraConfigOption.setOptionalArg(true);
Option helpOption = new Option("h", "help", false, "prints this help");
Options options = new Options();
options.addOption(repositoryPathOption);
options.addOption(serviceTemplatesOnlyOption);
options.addOption(checkDocumentationOption);
options.addOption(verboseOption);
options.addOption(generateCopybaraConfigOption);
options.addOption(helpOption);
CommandLineParser parser = new DefaultParser();
CommandLine line = parser.parse(options, args);
if (line.hasOption("h")) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("winery", options);
System.exit(0);
}
IRepository repository;
if (line.hasOption("p")) {
repository = RepositoryFactory.getRepository(Paths.get(line.getOptionValue("p")));
} else {
repository = RepositoryFactory.getRepository();
}
if (line.hasOption("cb")) {
CopybaraGenerator copybaraGenerator = new CopybaraGenerator();
String outfile = line.getOptionValue("cb");
if (outfile == null) {
String copybaraConfigFile = copybaraGenerator.generateCopybaraConfigFile();
System.out.println(copybaraConfigFile);
} else {
Path file = Paths.get(outfile);
copybaraGenerator.generateCopybaraConfigFile(file);
}
System.exit(0);
}
if (repository instanceof AbstractFileBasedRepository) {
System.out.println("Using repository path " + repository.getRepositoryRoot() + "...");
} else {
System.out.println("Using non-filebased repository");
}
doConsistencyCheck(line, repository);
}
Aggregations