• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RepositoryException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.sonatype.aether.RepositoryException的典型用法代码示例。如果您正苦于以下问题:Java RepositoryException类的具体用法?Java RepositoryException怎么用?Java RepositoryException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RepositoryException类属于org.sonatype.aether包,在下文中一共展示了RepositoryException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:21,代码来源:NotebookTest.java


示例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();
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:18,代码来源:ManagedInterpreterGroupTest.java


示例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;
  }
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:18,代码来源:DependencyResolver.java


示例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);
  }
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:32,代码来源:DependencyResolver.java


示例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);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:24,代码来源:DependencyResolverTest.java


示例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;
}
 
开发者ID:hopshadoop,项目名称:hopsworks,代码行数:17,代码来源:NotebookServerImplFactory.java


示例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);
  }
}
 
开发者ID:hopshadoop,项目名称:hopsworks,代码行数:26,代码来源:ZeppelinConfig.java


示例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;
}
 
开发者ID:hopshadoop,项目名称:hopsworks,代码行数:32,代码来源:ZeppelinConfigFactory.java


示例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;
}
 
开发者ID:hopshadoop,项目名称:hopsworks,代码行数:22,代码来源:ZeppelinConfigFactory.java


示例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 );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:MetadataBridge.java


示例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 );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:20,代码来源:MavenMetadata.java


示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:AbstractMavenPublishAction.java


示例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);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:13,代码来源:NotebookTest.java


示例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);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:36,代码来源:NotebookTest.java


示例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);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:33,代码来源:NotebookTest.java


示例16: loadFromMvn

import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
private List<File> loadFromMvn(String artifact, Collection<String> excludes)
    throws RepositoryException {
  Collection<String> allExclusions = new LinkedList<>();
  allExclusions.addAll(excludes);
  allExclusions.addAll(Arrays.asList(exclusions));

  List<ArtifactResult> listOfArtifact;
  listOfArtifact = getArtifactsWithDep(artifact, allExclusions);

  Iterator<ArtifactResult> it = listOfArtifact.iterator();
  while (it.hasNext()) {
    Artifact a = it.next().getArtifact();
    String gav = a.getGroupId() + ":" + a.getArtifactId() + ":" + a.getVersion();
    for (String exclude : allExclusions) {
      if (gav.startsWith(exclude)) {
        it.remove();
        break;
      }
    }
  }

  List<File> files = new LinkedList<>();
  for (ArtifactResult artifactResult : listOfArtifact) {
    files.add(artifactResult.getArtifact().getFile());
    logger.debug("load {}", artifactResult.getArtifact().getFile().getAbsolutePath());
  }

  return files;
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:30,代码来源:DependencyResolver.java


示例17: open

import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
@OnOpen
public void open(Session conn, EndpointConfig config, @PathParam("projectID") String projectId) throws AppException {
  try {
    this.session = conn;
    this.sender = (String) config.getUserProperties().get("user");
    this.project = getProject(projectId);
    authenticateUser(conn, this.project, this.sender);
    if (this.userRole == null) {
      LOG.log(Level.INFO, "User not authorized for Zeppelin Access: {0}", this.sender);
      return;
    }
    if (project.getPaymentType().equals(PaymentType.PREPAID)) {
      YarnProjectsQuota projectQuota = yarnProjectsQuotaFacade.findByProjectName(project.getName());
      if (projectQuota == null || projectQuota.getQuotaRemaining() < 0) {
        session.close(new CloseReason(CloseReason.CloseCodes.NORMAL_CLOSURE, "This project is out of credits."));
        return;
      }
    }
    this.impl = notebookServerImplFactory.getNotebookServerImps(project.getName(), conn);
    if (impl.getConf() == null) {
      impl.removeConnectedSockets(conn, notebookServerImplFactory);
      LOG.log(Level.INFO, "Could not create Zeppelin config for user: {0}, project: {1}", new Object[]{this.sender,
        project.getName()});
      return;
    }
    addUserConnection(this.hdfsUsername, conn);
    addUserConnection(project.getProjectGenericUser(), conn);
    this.session.getUserProperties().put("projectID", this.project.getId());
    String httpHeader = (String) config.getUserProperties().get(WatcherSecurityKey.HTTP_HEADER);
    this.session.getUserProperties().put(WatcherSecurityKey.HTTP_HEADER, httpHeader);
    impl.unicast(new Message(OP.CREATED_SOCKET), conn);
  } catch (IOException | RepositoryException | TaskRunnerException ex) {
    throw new AppException(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), ex.getMessage());
  }
}
 
开发者ID:hopshadoop,项目名称:hopsworks,代码行数:36,代码来源:NotebookServer.java


示例18: NotebookServerImpl

import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
public NotebookServerImpl(Project project, ZeppelinConfigFactory zeppelin,
    CertsFacade certsFacade, Settings settings, ProjectTeamFacade projectTeamFacade,
    ActivityFacade activityFacade, CertificatesMgmService certificatesMgmService)
    throws IOException, RepositoryException,
    TaskRunnerException {
  this.project = project;
  this.conf = zeppelin.getZeppelinConfig(project.getName(), this);
  this.notebook = this.conf.getNotebook();
  this.settings = settings;
  this.certsFacade = certsFacade;
  this.projectTeamFacade = projectTeamFacade;
  this.activityFacade = activityFacade;
  this.certificatesMgmService = certificatesMgmService;
}
 
开发者ID:hopshadoop,项目名称:hopsworks,代码行数:15,代码来源:NotebookServerImpl.java


示例19: installBundleFromRepository

import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
@Override
public BundleInformation installBundleFromRepository(String moduleId, boolean startBundle) {
    try {
        return installFromRepository(new Dependency(new DefaultArtifact(moduleId), JavaScopes.RUNTIME), startBundle);
    } catch (RepositoryException | IOException | BundleException e) {
        throw new MotechException("Unable to install module from repository " + moduleId, e);
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:9,代码来源:ModuleAdminServiceImpl.java


示例20: merge

import org.sonatype.aether.RepositoryException; //导入依赖的package包/类
public void merge( File existing, File result )
    throws RepositoryException
{
    Metadata recessive = read( existing );

    merge( recessive );

    write( result, metadata );

    merged = true;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:12,代码来源:MavenMetadata.java



注:本文中的org.sonatype.aether.RepositoryException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ResourceRequirements类代码示例发布时间:2022-05-22
下一篇:
Java JavaObjectData类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap