<commit_before>package doss.nfs;

import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.dcache.nfs.ExportFile;
import org.dcache.nfs.v3.MountServer;
import org.dcache.nfs.v3.NfsServerV3;
import org.dcache.nfs.v4.MDSOperationFactory;
import org.dcache.nfs.v4.NFSServerV41;
import org.dcache.nfs.v4.NfsIdMapping;
import org.dcache.nfs.v4.SimpleIdMap;
import org.dcache.nfs.vfs.VirtualFileSystem;
import org.dcache.xdr.OncRpcException;
import org.dcache.xdr.OncRpcProgram;
import org.dcache.xdr.OncRpcSvc;
import org.dcache.xdr.OncRpcSvcBuilder;
import org.dcache.xdr.RpcDispatchable;
import org.dcache.xdr.portmap.OncRpcEmbeddedPortmap;

public class Main {
	public static void main(String[] args) throws IOException, OncRpcException, InterruptedException {
		URL exports = Main.class.getClassLoader().getResource(
				"doss/nfs/exports");
		if (exports == null) {
			throw new RuntimeException(
					"doss/nfs/exports not found on classpath");
		}
		VirtualFileSystem fs = new BlobStoreVFS();
		ExportFile exportFile = new ExportFile(exports);
		
		// NFS 3
		NfsServerV3 nfs3 = new NfsServerV3(exportFile, fs);
		
		// NFS 4
		MDSOperationFactory opfac = new MDSOperationFactory();
		NfsIdMapping idMap = new SimpleIdMap();
		
		NFSServerV41 nfs4 = new NFSServerV41(opfac, null, fs, idMap, exportFile);
		
		MountServer mountd = new MountServer(exportFile, fs);

		OncRpcSvc rpcSvc = new OncRpcSvcBuilder().withPort(1234).withTCP()
				.build();
		Map<OncRpcProgram, RpcDispatchable> services = new HashMap<>();
		
		rpcSvc.register(new OncRpcProgram(100003, 3), nfs3);
		rpcSvc.register(new OncRpcProgram(100003, 4), nfs4);
		rpcSvc.register(new OncRpcProgram(100005, 3), mountd);
		
		rpcSvc.setPrograms(services );
		rpcSvc.start();
		Thread.sleep(100000);
	}
}<commit_msg>Remove NFS3 server as it's a bit more fiddly<commit_after>package doss.nfs;

import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.dcache.nfs.ExportFile;
import org.dcache.nfs.v3.MountServer;
import org.dcache.nfs.v3.NfsServerV3;
import org.dcache.nfs.v4.MDSOperationFactory;
import org.dcache.nfs.v4.NFSServerV41;
import org.dcache.nfs.v4.NfsIdMapping;
import org.dcache.nfs.v4.SimpleIdMap;
import org.dcache.nfs.vfs.VirtualFileSystem;
import org.dcache.xdr.OncRpcException;
import org.dcache.xdr.OncRpcProgram;
import org.dcache.xdr.OncRpcSvc;
import org.dcache.xdr.OncRpcSvcBuilder;
import org.dcache.xdr.RpcDispatchable;
import org.dcache.xdr.portmap.OncRpcEmbeddedPortmap;

public class Main {
	public static void main(String[] args) throws IOException, OncRpcException, InterruptedException {
		// virtual file system
		VirtualFileSystem fs = new BlobStoreVFS();
		
		// exports config file
		URL exportsUrl = Main.class.getClassLoader().getResource("doss/nfs/exports");
		if (exportsUrl == null) {
			throw new RuntimeException("doss/nfs/exports not found on classpath");
		}
		ExportFile exports = new ExportFile(exportsUrl);
		
		// NFS 4 server
		MDSOperationFactory opfac = new MDSOperationFactory();
		NfsIdMapping idMap = new SimpleIdMap();
		NFSServerV41 nfs4 = new NFSServerV41(opfac, null, fs, idMap, exports);
		
		// mountd
		MountServer mountd = new MountServer(exports, fs);

		// RPC server
		OncRpcSvc rpcSvc = new OncRpcSvcBuilder().withPort(1234).withTCP().build();
		Map<OncRpcProgram, RpcDispatchable> services = new HashMap<>();
		rpcSvc.register(new OncRpcProgram(100003, 4), nfs4);
		rpcSvc.register(new OncRpcProgram(100005, 3), mountd);
		rpcSvc.setPrograms(services );
		rpcSvc.start();
		
		try {
			// hang around for a while
			Thread.sleep(100000);
		} finally {
			rpcSvc.stop();
		}
	}
}
{'fraction_non_alphanumeric': 0.11587173268660739, 'fraction_numerical': 0.025060630557801132, 'mean_word_length': 4.836477987421383, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2061966', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1362, 'n_words': 268}