use of org.sonatype.aether.repository.RemoteRepository in project zeppelin by apache.
the class InterpreterSettingManager method loadFromFile.
private void loadFromFile() {
if (!Files.exists(interpreterBindingPath)) {
// nothing to read
return;
}
InterpreterInfoSaving infoSaving;
try (BufferedReader json = Files.newBufferedReader(interpreterBindingPath, StandardCharsets.UTF_8)) {
infoSaving = gson.fromJson(json, InterpreterInfoSaving.class);
for (String k : infoSaving.interpreterSettings.keySet()) {
InterpreterSetting setting = infoSaving.interpreterSettings.get(k);
List<InterpreterInfo> infos = setting.getInterpreterInfos();
// Convert json StringMap to Properties
StringMap<String> p = (StringMap<String>) setting.getProperties();
Properties properties = new Properties();
for (String key : p.keySet()) {
properties.put(key, p.get(key));
}
setting.setProperties(properties);
// Always use separate interpreter process
// While we decided to turn this feature on always (without providing
// enable/disable option on GUI).
// previously created setting should turn this feature on here.
setting.getOption().setRemote(true);
// Update transient information from InterpreterSettingRef
InterpreterSetting interpreterSettingObject = interpreterSettingsRef.get(setting.getGroup());
if (interpreterSettingObject == null) {
logger.warn("can't get InterpreterSetting " + "Information From loaded Interpreter Setting Ref - {} ", setting.getGroup());
continue;
}
String depClassPath = interpreterSettingObject.getPath();
setting.setPath(depClassPath);
for (InterpreterInfo info : infos) {
if (info.getEditor() == null) {
Map<String, Object> editor = getEditorFromSettingByClassName(interpreterSettingObject, info.getClassName());
info.setEditor(editor);
}
}
setting.setInterpreterGroupFactory(interpreterGroupFactory);
loadInterpreterDependencies(setting);
interpreterSettings.put(k, setting);
}
interpreterBindings.putAll(infoSaving.interpreterBindings);
if (infoSaving.interpreterRepositories != null) {
for (RemoteRepository repo : infoSaving.interpreterRepositories) {
if (!dependencyResolver.getRepos().contains(repo)) {
this.interpreterRepositories.add(repo);
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.sonatype.aether.repository.RemoteRepository in project storm by apache.
the class DependencyResolver method resolve.
public List<ArtifactResult> resolve(List<Dependency> dependencies) throws MalformedURLException, DependencyResolutionException, ArtifactResolutionException {
DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE, JavaScopes.RUNTIME);
if (dependencies.size() == 0) {
return Collections.EMPTY_LIST;
}
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(dependencies.get(0));
for (int idx = 1; idx < dependencies.size(); idx++) {
collectRequest.addDependency(dependencies.get(idx));
}
for (RemoteRepository repository : remoteRepositories) {
collectRequest.addRepository(repository);
}
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFilter);
return system.resolveDependencies(session, dependencyRequest).getArtifactResults();
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class IniArtifactDataReader method parse.
private ArtifactDescription parse(Reader reader) throws IOException {
String line = null;
State state = State.NONE;
Map<State, List<String>> sections = new HashMap<State, List<String>>();
BufferedReader in = new BufferedReader(reader);
try {
while ((line = in.readLine()) != null) {
line = cutComment(line);
if (isEmpty(line)) {
continue;
}
if (line.startsWith("[")) {
try {
state = State.valueOf(line.substring(1, line.length() - 1).toUpperCase(Locale.ENGLISH));
sections.put(state, new ArrayList<String>());
} catch (IllegalArgumentException e) {
throw new IOException("unknown section: " + line);
}
} else {
List<String> lines = sections.get(state);
if (lines == null) {
throw new IOException("missing section: " + line);
}
lines.add(line.trim());
}
}
} finally {
in.close();
}
List<Artifact> relocations = relocations(sections.get(State.RELOCATIONS));
List<Dependency> dependencies = dependencies(sections.get(State.DEPENDENCIES));
List<Dependency> managedDependencies = dependencies(sections.get(State.MANAGEDDEPENDENCIES));
List<RemoteRepository> repositories = repositories(sections.get(State.REPOSITORIES));
ArtifactDescription description = new ArtifactDescription(relocations, dependencies, managedDependencies, repositories);
return description;
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class IniArtifactDataReader method repositories.
private List<RemoteRepository> repositories(List<String> list) {
ArrayList<RemoteRepository> ret = new ArrayList<RemoteRepository>();
if (list == null) {
return ret;
}
for (String coords : list) {
String[] split = coords.split(":", 3);
String id = split[0];
String type = split[1];
String url = split[2];
ret.add(new RemoteRepository(id, type, url));
}
return ret;
}
use of org.sonatype.aether.repository.RemoteRepository in project sonatype-aether by sonatype.
the class IniArtifactDataReaderTest method testResource.
@Test
public void testResource() throws IOException {
ArtifactDescription description = parser.parse("ArtifactDataReaderTest.ini");
assertEquals(1, description.getRelocations().size());
Artifact artifact = description.getRelocations().get(0);
assertEquals("gid", artifact.getGroupId());
assertEquals("aid", artifact.getArtifactId());
assertEquals("ver", artifact.getVersion());
assertEquals("ext", artifact.getExtension());
assertEquals(1, description.getRepositories().size());
RemoteRepository repo = description.getRepositories().get(0);
assertEquals("id", repo.getId());
assertEquals("type", repo.getContentType());
assertEquals("protocol://some/url?for=testing", repo.getUrl());
assertDependencies(description.getDependencies());
assertDependencies(description.getManagedDependencies());
}
Aggregations