当前位置: 首页>>代码示例>>Java>>正文


Java ReceivePackFactory类代码示例

本文整理汇总了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;未经允许,请勿转载。