pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


vfs4j port path prototype, not functional yet
Posted by Anonymous on Thu 18th Jan 2024 06:50
raw | new post

  1. diff --git a/src/main/java/org/dcache/vfs4j/NfsMain.java b/src/main/java/org/dcache/vfs4j/NfsMain.java
  2. index ef914d6..f3160a5 100644
  3. --- a/src/main/java/org/dcache/vfs4j/NfsMain.java
  4. +++ b/src/main/java/org/dcache/vfs4j/NfsMain.java
  5. @@ -73,11 +73,24 @@ public class NfsMain implements Callable<Void> {
  6.            defaultValue = "true")
  7.    private boolean withV4;
  8.  
  9. -  @CommandLine.Parameters(index = "0", description = "directory to export")
  10. -  private File dir;
  11. +  @CommandLine.Option(
  12. +          names = {"--port"},
  13. +          description = "NFS port number (default 2049)",
  14. +          showDefaultValue = CommandLine.Help.Visibility.ALWAYS,
  15. +          defaultValue = "2049")
  16. +  private int nfsPort;
  17.  
  18. -  @CommandLine.Parameters(index = "1", description = "path to export file")
  19. -  private File export;
  20. +  @CommandLine.Option(
  21. +      names = "--root",
  22. +      description = "root directory for exports",
  23. +      defaultValue = "/")
  24. +  private File nfsRootDir;
  25. +
  26. +  @CommandLine.Option(
  27. +      names = "--exports",
  28. +      description = "paths to exports file",
  29. +      defaultValue = "")
  30. +  private File exportsFile;
  31.  
  32.    public static void main(String[] args) throws Exception {
  33.      new CommandLine(new NfsMain()).setNegatableOptionTransformer(
  34. @@ -93,25 +106,32 @@ public class NfsMain implements Callable<Void> {
  35.  
  36.      SSLParameters sslParameters = null;
  37.      SSLContext sslContext = null;
  38. +
  39. +    System.out.println("# start.");
  40. +    System.out.println("# config: nfsRootDir=" + nfsRootDir.toString() +
  41. +        " exportsFile=" + exportsFile.toString() +
  42. +       " port=" + nfsPort + ".");
  43. +
  44.      if (tls) {
  45.        sslContext = TLSUtils.createSslContext(cert, key, new char[0], chain, insecure);
  46.        sslParameters = sslContext.getDefaultSSLParameters();
  47.        sslParameters.setNeedClientAuth(mutual);
  48.      }
  49.  
  50. -    VirtualFileSystem vfs = new LocalVFS(dir);
  51. +    VirtualFileSystem vfs = new LocalVFS(nfsRootDir);
  52.      OncRpcSvc nfsSvc =
  53.          new OncRpcSvcBuilder()
  54. -            .withPort(2049)
  55. +            .withPort(this.nfsPort)
  56.              .withTCP()
  57.              .withAutoPublish()
  58.              .withWorkerThreadIoStrategy()
  59.              .withStartTLS()
  60. -            .withSSLContext(sslContext)
  61. -            .withSSLParameters(sslParameters)
  62. +//            .withSSLContext(sslContext)
  63. +//            .withSSLParameters(sslParameters)
  64. +//            .withServiceName("nfs@"+this.nfsPort)
  65.              .build();
  66.  
  67. -    ExportTable exportFile = new ExportFile(export);
  68. +    ExportTable exportFile = new ExportFile(exportsFile);
  69.  
  70.      if (withV4) {
  71.        NFSServerV41 nfs4 =

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at