本文整理汇总了Java中org.sonatype.aether.RepositoryException类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryException类的具体用法?Java RepositoryException怎么用?Java RepositoryException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryException类属于org.sonatype.aether包,在下文中一共展示了RepositoryException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPersist
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
@Test
public void testPersist() throws IOException, SchedulerException, RepositoryException {
Note note = notebook.createNote(anonymous);
// run with default repl
Paragraph p1 = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
Map config = p1.getConfig();
config.put("enabled", true);
p1.setConfig(config);
p1.setText("hello world");
note.persist(anonymous);
Notebook notebook2 = new Notebook(
conf, notebookRepo, schedulerFactory,
new InterpreterFactory(interpreterSettingManager),
interpreterSettingManager, null, null, null, null);
assertEquals(1, notebook2.getAllNotes().size());
notebook.removeNote(note.getId(), anonymous);
}
示例2: setUp
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
@Before
public void setUp() throws IOException, RepositoryException {
InterpreterOption interpreterOption = new InterpreterOption();
interpreterOption.setPerUser(InterpreterOption.SCOPED);
InterpreterInfo interpreterInfo1 = new InterpreterInfo(EchoInterpreter.class.getName(), "echo", true, new HashMap<String, Object>());
InterpreterInfo interpreterInfo2 = new InterpreterInfo(DoubleEchoInterpreter.class.getName(), "double_echo", false, new HashMap<String, Object>());
List<InterpreterInfo> interpreterInfos = new ArrayList<>();
interpreterInfos.add(interpreterInfo1);
interpreterInfos.add(interpreterInfo2);
interpreterSetting = new InterpreterSetting.Builder()
.setId("id")
.setName("test")
.setGroup("test")
.setInterpreterInfos(interpreterInfos)
.setOption(interpreterOption)
.create();
}
示例3: load
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
public synchronized List<File> load(String artifact, Collection<String> excludes)
throws RepositoryException, IOException {
if (StringUtils.isBlank(artifact)) {
// Skip dependency loading if artifact is empty
return new LinkedList<>();
}
// <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
int numSplits = artifact.split(":").length;
if (numSplits >= 3 && numSplits <= 6) {
return loadFromMvn(artifact, excludes);
} else {
LinkedList<File> libs = new LinkedList<>();
libs.add(new File(artifact));
return libs;
}
}
示例4: getArtifactsWithDep
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
/**
* @param dependency
* @param excludes list of pattern can either be of the form groupId:artifactId
* @return
* @throws Exception
*/
@Override
public List<ArtifactResult> getArtifactsWithDep(String dependency,
Collection<String> excludes) throws RepositoryException {
Artifact artifact = new DefaultArtifact(dependency);
DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
PatternExclusionsDependencyFilter exclusionFilter =
new PatternExclusionsDependencyFilter(excludes);
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));
synchronized (repos) {
for (RemoteRepository repo : repos) {
collectRequest.addRepository(repo);
}
}
DependencyRequest dependencyRequest = new DependencyRequest(collectRequest,
DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter));
try {
return system.resolveDependencies(session, dependencyRequest).getArtifactResults();
} catch (NullPointerException | DependencyResolutionException ex) {
throw new RepositoryException(
String.format("Cannot fetch dependencies for %s", dependency), ex);
}
}
示例5: testLoad
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
@Test
public void testLoad() throws Exception {
// basic load
resolver.load("com.databricks:spark-csv_2.10:1.3.0", testCopyPath);
assertEquals(testCopyPath.list().length, 4);
FileUtils.cleanDirectory(testCopyPath);
// load with exclusions parameter
resolver.load("com.databricks:spark-csv_2.10:1.3.0",
Collections.singletonList("org.scala-lang:scala-library"), testCopyPath);
assertEquals(testCopyPath.list().length, 3);
FileUtils.cleanDirectory(testCopyPath);
// load from added repository
resolver.addRepo("sonatype", "https://oss.sonatype.org/content/repositories/agimatec-releases/", false);
resolver.load("com.agimatec:agimatec-validation:0.9.3", testCopyPath);
assertEquals(testCopyPath.list().length, 8);
// load invalid artifact
resolver.delRepo("sonatype");
exception.expect(RepositoryException.class);
resolver.load("com.agimatec:agimatec-validation:0.9.3", testCopyPath);
}
示例6: getNotebookServerImps
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
public NotebookServerImpl getNotebookServerImps(String projectName, Session session) throws IOException,
RepositoryException,
TaskRunnerException {
Project project = projectBean.findByName(projectName);
if (project == null) {
return null;
}
NotebookServerImpl impl = notebookServerImpls.get(projectName);
if (impl == null) {
impl = new NotebookServerImpl(project, zeppelinConfigFactory, certsFacade,
settings, projectTeamFacade, activityFacade, certificatesMgmService);
notebookServerImpls.put(projectName, impl);
}
impl.addConnectedSocket(session);
return impl;
}
示例7: setNotebookServer
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
public void setNotebookServer(NotebookServerImpl nbs) {
if(this.notebookServer!=null){
return;
}
this.notebookServer = nbs;
try {
this.replFactory = new InterpreterFactory(this.conf, this.notebookServer,
this.notebookServer, this.heliumApplicationFactory,
this.depResolver, SecurityUtils.isAuthenticated(),
this.interpreterSettingManager);
this.notebook = new Notebook(this.conf, this.notebookRepo,
this.schedulerFactory, this.replFactory, interpreterSettingManager,
this.notebookServer,
this.noteSearchService, this.notebookAuthorization,
this.credentials);
// to update notebook from application event from remote process.
this.heliumApplicationFactory.setNotebook(notebook);
// to update fire websocket event on application event.
this.heliumApplicationFactory.setApplicationEventListener(this.notebookServer);
this.notebook.addNotebookEventListener(heliumApplicationFactory);
this.notebook.addNotebookEventListener(this.notebookServer.getNotebookInformationListener());
} catch (InterpreterException | IOException | RepositoryException | SchedulerException ex) {
LOGGER.log(Level.SEVERE, null, ex);
}
}
示例8: getZeppelinConfig
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
/**
* Returns conf for the project. This can not be used to call
* notebook server, replFactory or notebook b/c a user specific notebook
* server
* connection is needed to create those.
*
* @param projectName
* @return
*/
public ZeppelinConfig getZeppelinConfig(String projectName, NotebookServerImpl nbs) throws IOException,
RepositoryException, TaskRunnerException {
// User is null when Hopsworks checks for running interpreters
ZeppelinConfig config = projectConfCache.get(projectName);
if (config == null) {
Project project = projectBean.findByName(projectName);
if (project == null) {
return null;
}
String owner = hdfsUsername.getHdfsUserName(project, project.getOwner());
ZeppelinInterpreterConfs interpreterConf = zeppelinInterpreterConfFacade.findByProject(project);
String conf = null;
if (interpreterConf != null) {
conf = interpreterConf.getInterpreterConf();
}
config = new ZeppelinConfig(projectName, project.getId(), owner, settings, conf, nbs);
projectConfCache.put(projectName, config);
}
config.setNotebookServer(nbs);
return config;
}
示例9: deleteZeppelinConfDir
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
/**
* Deletes zeppelin configuration dir for projectName.
*
* @param project
* @return
*/
public boolean deleteZeppelinConfDir(Project project) throws IOException, RepositoryException, TaskRunnerException {
ZeppelinConfig conf = projectConfCache.remove(project.getName());
if (conf != null) {
return conf.cleanAndRemoveConfDirs(notebookServerImplFactory);
}
String projectDirPath = settings.getZeppelinDir() + File.separator
+ Settings.DIR_ROOT + File.separator + project.getName();
File projectDir = new File(projectDirPath);
String hdfsUser = hdfsUsername.getHdfsUserName(project, project.getOwner());
if (projectDir.exists()) {
conf = new ZeppelinConfig(project.getName(), project.getId(), hdfsUser, settings, null, null);
return conf.cleanAndRemoveConfDirs(notebookServerImplFactory);
}
return false;
}
示例10: merge
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
public void merge( File current, File result )
throws RepositoryException
{
try
{
if ( current.exists() )
{
FileUtils.copyFile( current, result );
}
ArtifactRepository localRepo = new MetadataRepository( result );
metadata.storeInLocalRepository( localRepo, localRepo );
merged = true;
}
catch ( Exception e )
{
throw new RepositoryException( e.getMessage(), e );
}
}
示例11: write
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
private void write( File metadataFile, Metadata metadata )
throws RepositoryException
{
Writer writer = null;
try
{
metadataFile.getParentFile().mkdirs();
writer = WriterFactory.newXmlWriter( metadataFile );
new MetadataXpp3Writer().write( writer, metadata );
}
catch ( IOException e )
{
throw new RepositoryException( "Could not write metadata " + metadataFile + ": " + e.getMessage(), e );
}
finally
{
IOUtil.close( writer );
}
}
示例12: publish
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
public void publish() {
List<Artifact> artifacts = new ArrayList<Artifact>();
if (mainArtifact.getFile() != null) {
artifacts.add(mainArtifact);
}
artifacts.add(pomArtifact);
artifacts.addAll(attached);
try {
publishArtifacts(artifacts, newRepositorySystem(), session);
} catch (RepositoryException e) {
throw new GradleException(e.getMessage(), e);
}
}
示例13: testCreateNoteWithSubject
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
@Test
public void testCreateNoteWithSubject() throws IOException, SchedulerException, RepositoryException {
AuthenticationInfo subject = new AuthenticationInfo("user1");
Note note = notebook.createNote(subject);
assertNotNull(notebook.getNotebookAuthorization().getOwners(note.getId()));
assertEquals(1, notebook.getNotebookAuthorization().getOwners(note.getId()).size());
Set<String> owners = new HashSet<>();
owners.add("user1");
assertEquals(owners, notebook.getNotebookAuthorization().getOwners(note.getId()));
notebook.removeNote(note.getId(), anonymous);
}
示例14: testExportAndImportNote
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
@Test
public void testExportAndImportNote() throws IOException, CloneNotSupportedException,
InterruptedException, InterpreterException, SchedulerException, RepositoryException {
Note note = notebook.createNote(anonymous);
interpreterSettingManager.setInterpreterBinding("user", note.getId(), interpreterSettingManager.getInterpreterSettingIds());
final Paragraph p = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
String simpleText = "hello world";
p.setText(simpleText);
note.runAll();
String exportedNoteJson = notebook.exportNote(note.getId());
Note importedNote = notebook.importNote(exportedNoteJson, "Title", anonymous);
Paragraph p2 = importedNote.getParagraphs().get(0);
// Test
assertEquals(p.getId(), p2.getId());
assertEquals(p.getText(), p2.getText());
assertEquals(p.getResult().message().get(0).getData(), p2.getResult().message().get(0).getData());
// Verify import note with subject
AuthenticationInfo subject = new AuthenticationInfo("user1");
Note importedNote2 = notebook.importNote(exportedNoteJson, "Title2", subject);
assertNotNull(notebook.getNotebookAuthorization().getOwners(importedNote2.getId()));
assertEquals(1, notebook.getNotebookAuthorization().getOwners(importedNote2.getId()).size());
Set<String> owners = new HashSet<>();
owners.add("user1");
assertEquals(owners, notebook.getNotebookAuthorization().getOwners(importedNote2.getId()));
notebook.removeNote(note.getId(), anonymous);
notebook.removeNote(importedNote.getId(), anonymous);
notebook.removeNote(importedNote2.getId(), anonymous);
}
示例15: testCloneNote
import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
@Test
public void testCloneNote() throws IOException, CloneNotSupportedException,
InterruptedException, InterpreterException, SchedulerException, RepositoryException {
Note note = notebook.createNote(anonymous);
interpreterSettingManager.setInterpreterBinding("user", note.getId(), interpreterSettingManager.getInterpreterSettingIds());
final Paragraph p = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
p.setText("hello world");
note.runAll();
p.setStatus(Status.RUNNING);
Note cloneNote = notebook.cloneNote(note.getId(), "clone note", anonymous);
Paragraph cp = cloneNote.paragraphs.get(0);
assertEquals(cp.getStatus(), Status.READY);
// Keep same ParagraphId
assertEquals(cp.getId(), p.getId());
assertEquals(cp.getText(), p.getText());
assertEquals(cp.getResult().message().get(0).getData(), p.getResult().message().get(0).getData());
// Verify clone note with subject
AuthenticationInfo subject = new AuthenticationInfo("user1");
Note cloneNote2 = notebook.cloneNote(note.getId(), "clone note2", subject);
assertNotNull(notebook.getNotebookAuthorization().getOwners(cloneNote2.getId()));
assertEquals(1, notebook.getNotebookAuthorization().getOwners(cloneNote2.getId()).size());
Set<String> owners = new HashSet<>();
owners.add("user1");
assertEquals(owners, notebook.getNotebookAuthorization().getOwners(cloneNote2.getId()));
notebook.removeNote(note.getId(), anonymous);
notebook.removeNote(cloneNote.getId(), anonymous);
notebook.removeNote(cloneNote2.getId(), anonymous);
}