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

Java ReceivePackFactory类代码示例

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

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



ReceivePackFactory类属于org.eclipse.jgit.transport.resolver包,在下文中一共展示了ReceivePackFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configure

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
@Override
protected void configure() {
  bind(Resolver.class);
  bind(UploadFactory.class);
  bind(UploadFilter.class);
  bind(new TypeLiteral<ReceivePackFactory<HttpServletRequest>>() {})
      .to(enableReceive ? ReceiveFactory.class : DisabledReceiveFactory.class);
  bind(ReceiveFilter.class);
  install(
      new CacheModule() {
        @Override
        protected void configure() {
          cache(ID_CACHE, AdvertisedObjectsCacheKey.class, new TypeLiteral<Set<ObjectId>>() {})
              .maximumWeight(4096)
              .expireAfterWrite(10, TimeUnit.MINUTES);
        }
      });
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:19,代码来源:GitOverHttpServlet.java


示例2: GitOverHttpServlet

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
@Inject
GitOverHttpServlet(
    Resolver resolver,
    UploadFactory upload,
    UploadFilter uploadFilter,
    ReceivePackFactory<HttpServletRequest> receive,
    ReceiveFilter receiveFilter) {
  setRepositoryResolver(resolver);
  setAsIsFileService(AsIsFileService.DISABLED);

  setUploadPackFactory(upload);
  addUploadPackFilter(uploadFilter);

  setReceivePackFactory(receive);
  addReceivePackFilter(receiveFilter);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:GitOverHttpServlet.java


示例3: testStartStop

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
@Test
public void testStartStop() throws Exception {
    final GitSSHService sshService = new GitSSHService();
    final File certDir = createTempDirectory();

    sshService.setup(certDir,
                     null,
                     "10000",
                     "RSA",
                     mock(ReceivePackFactory.class),
                     mock(JGitFileSystemProvider.RepositoryResolverImpl.class),
                     executorService);

    sshService.start();
    assertTrue(sshService.isRunning());

    sshService.stop();

    assertFalse(sshService.isRunning());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:GitSSHServiceTest.java


示例4: testStartStopAlgo2

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
@Test
public void testStartStopAlgo2() throws Exception {
    final GitSSHService sshService = new GitSSHService();
    final File certDir = createTempDirectory();

    sshService.setup(certDir,
                     null,
                     "10000",
                     "DSA",
                     mock(ReceivePackFactory.class),
                     mock(JGitFileSystemProvider.RepositoryResolverImpl.class),
                     executorService);

    sshService.start();
    assertTrue(sshService.isRunning());

    sshService.stop();

    assertFalse(sshService.isRunning());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:GitSSHServiceTest.java


示例5: testCheckTimeout

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
@Test
public void testCheckTimeout() throws Exception {
    final GitSSHService sshService = new GitSSHService();
    final File certDir = createTempDirectory();

    sshService.setup(certDir,
                     null,
                     "10000",
                     "RSA",
                     mock(ReceivePackFactory.class),
                     mock(JGitFileSystemProvider.RepositoryResolverImpl.class),
                     executorService);

    sshService.start();
    assertTrue(sshService.isRunning());

    assertTrue("10000".equals(sshService.getSshServer().getProperties().get(SshServer.IDLE_TIMEOUT)));

    sshService.stop();

    assertFalse(sshService.isRunning());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:GitSSHServiceTest.java


示例6: testCheckAlgo

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
@Test
public void testCheckAlgo() throws Exception {
    final GitSSHService sshService = new GitSSHService();
    final File certDir = createTempDirectory();

    try {
        sshService.setup(certDir,
                         null,
                         "10000",
                         "xxxx",
                         mock(ReceivePackFactory.class),
                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),
                         executorService);
        fail("has to fail");
    } catch (final Exception ex) {
        assertThat(ex.getMessage()).contains("'xxxx'");
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:GitSSHServiceTest.java


示例7: GitReceiveCommand

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
public GitReceiveCommand(final String command,
                         final JGitFileSystemProvider.RepositoryResolverImpl<BaseGitCommand> repositoryResolver,
                         final FileSystemAuthorizer fileSystemAuthorizer,
                         final ReceivePackFactory<BaseGitCommand> receivePackFactory,
                         final ExecutorService executorService) {
    super(command,
          fileSystemAuthorizer,
          repositoryResolver,
          executorService);
    this.receivePackFactory = receivePackFactory;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:12,代码来源:GitReceiveCommand.java


示例8: setup

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
public void setup(final File certDir,
                  final InetSocketAddress inetSocketAddress,
                  final String sshIdleTimeout,
                  final String algorithm,
                  final ReceivePackFactory receivePackFactory,
                  final JGitFileSystemProvider.RepositoryResolverImpl<BaseGitCommand> repositoryResolver,
                  final ExecutorService executorService) {
    checkNotNull("certDir",
                 certDir);
    checkNotEmpty("sshIdleTimeout",
                  sshIdleTimeout);
    checkNotEmpty("algorithm",
                  algorithm);
    checkNotNull("receivePackFactory",
                 receivePackFactory);
    checkNotNull("repositoryResolver",
                 repositoryResolver);

    sshd.getProperties().put(SshServer.IDLE_TIMEOUT,
                             sshIdleTimeout);

    if (inetSocketAddress != null) {
        sshd.setHost(inetSocketAddress.getHostName());
        sshd.setPort(inetSocketAddress.getPort());
    }

    if (!certDir.exists()) {
        certDir.mkdirs();
    }

    final AbstractGeneratorHostKeyProvider keyPairProvider = new SimpleGeneratorHostKeyProvider(new File(certDir,
                                                                                                         "hostkey.ser"));

    try {
        SecurityUtils.getKeyPairGenerator(algorithm);
        keyPairProvider.setAlgorithm(algorithm);
    } catch (final Exception ignore) {
        throw new RuntimeException(String.format("Can't use '%s' algorithm for ssh key pair generator.",
                                                 algorithm),
                                   ignore);
    }

    sshd.setKeyPairProvider(keyPairProvider);
    sshd.setCommandFactory(command -> {
        if (command.startsWith("git-upload-pack")) {
            return new GitUploadCommand(command,
                                        repositoryResolver,
                                        getAuthorizationManager(),
                                        executorService);
        } else if (command.startsWith("git-receive-pack")) {
            return new GitReceiveCommand(command,
                                         repositoryResolver,
                                         getAuthorizationManager(),
                                         receivePackFactory,
                                         executorService);
        } else {
            return new UnknownCommand(command);
        }
    });
    sshd.setPublickeyAuthenticator(new CachingPublicKeyAuthenticator((username, key, session) -> false));
    sshd.setPasswordAuthenticator((username, password, session) -> {
        final FileSystemUser user = getUserPassAuthenticator().authenticate(username,
                                                                            password);
        if (user == null) {
            return false;
        }
        session.setAttribute(BaseGitCommand.SUBJECT_KEY,
                             user);
        return true;
    });
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:72,代码来源:GitSSHService.java


示例9: buildAndStartSSH

import org.eclipse.jgit.transport.resolver.ReceivePackFactory; //导入依赖的package包/类
private void buildAndStartSSH() {
    final ReceivePackFactory receivePackFactory = (ReceivePackFactory<BaseGitCommand>) (req, db) -> new ReceivePack(db) {{

        final JGitFileSystem fs = fsManager.get(db);
        final Map<String, RevCommit> oldTreeRefs = new HashMap<>();

        setPreReceiveHook((rp, commands2) -> {
            fs.lock();
            for (final ReceiveCommand command : commands2) {
                final RevCommit lastCommit = fs.getGit().getLastCommit(command.getRefName());
                oldTreeRefs.put(command.getRefName(),
                                lastCommit);
            }
        });

        setPostReceiveHook((rp, commands) -> {
            fs.unlock();
            final String userName = req.getUser().getName();
            for (Map.Entry<String, RevCommit> oldTreeRef : oldTreeRefs.entrySet()) {
                final List<RevCommit> commits = fs.getGit().listCommits(oldTreeRef.getValue(),
                                                                        fs.getGit().getLastCommit(oldTreeRef.getKey()));
                for (final RevCommit revCommit : commits) {
                    final RevTree parent = revCommit.getParentCount() > 0 ? revCommit.getParent(0).getTree() : null;
                    notifyDiffs(fs,
                                oldTreeRef.getKey(),
                                "<ssh>",
                                userName,
                                revCommit.getFullMessage(),
                                parent,
                                revCommit.getTree());
                }
            }

            //broadcast changes
        });
    }};

    gitSSHService = new GitSSHService();

    gitSSHService.setup(config.getSshFileCertDir(),
                        InetSocketAddress.createUnresolved(config.getSshHostAddr(),
                                                           config.getSshPort()),
                        config.getSshIdleTimeout(),
                        config.getSshAlgorithm(),
                        receivePackFactory,
                        new RepositoryResolverImpl<>(),
                        executorService);

    gitSSHService.start();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:51,代码来源:JGitFileSystemProvider.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ActionsPublisher类代码示例发布时间:2022-05-22
下一篇:
Java TwitterUtils类代码示例发布时间: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