diff --git a/pom.xml b/pom.xml index 726de4e2..d2f61338 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,7 @@ dlm benchmarks basic-server + rquota diff --git a/rquota/pom.xml b/rquota/pom.xml new file mode 100644 index 00000000..6d1c9e63 --- /dev/null +++ b/rquota/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + org.dcache + nfs4j + 0.26.0-SNAPSHOT + + + org.dcache + rquota + jar + Remote quota protocol implementation + + + + + junit + junit + test + + + org.mockito + mockito-core + test + + + + ch.qos.logback + logback-classic + test + + + org.slf4j + slf4j-api + + + com.google.guava + guava + + + org.dcache + oncrpc4j-core + + + + diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/ext_getquota_args.java b/rquota/src/main/java/org/dcache/rquota/xdr/ext_getquota_args.java new file mode 100644 index 00000000..bdd6af0d --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/ext_getquota_args.java @@ -0,0 +1,43 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import org.dcache.oncrpc4j.rpc.net.*; +import org.dcache.oncrpc4j.xdr.*; +import java.io.IOException; + +public class ext_getquota_args implements XdrAble { + public String gqa_pathp; + public int gqa_type; + public int gqa_id; + + public ext_getquota_args() { + } + + public ext_getquota_args(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeString(gqa_pathp); + xdr.xdrEncodeInt(gqa_type); + xdr.xdrEncodeInt(gqa_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + gqa_pathp = xdr.xdrDecodeString(); + gqa_type = xdr.xdrDecodeInt(); + gqa_id = xdr.xdrDecodeInt(); + } + +} +// End of ext_getquota_args.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/ext_setquota_args.java b/rquota/src/main/java/org/dcache/rquota/xdr/ext_setquota_args.java new file mode 100644 index 00000000..0b844fe5 --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/ext_setquota_args.java @@ -0,0 +1,49 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import org.dcache.oncrpc4j.rpc.net.*; +import org.dcache.oncrpc4j.xdr.*; +import java.io.IOException; + +public class ext_setquota_args implements XdrAble { + public int sqa_qcmd; + public String sqa_pathp; + public int sqa_id; + public int sqa_type; + public sq_dqblk sqa_dqblk; + + public ext_setquota_args() { + } + + public ext_setquota_args(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(sqa_qcmd); + xdr.xdrEncodeString(sqa_pathp); + xdr.xdrEncodeInt(sqa_id); + xdr.xdrEncodeInt(sqa_type); + sqa_dqblk.xdrEncode(xdr); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + sqa_qcmd = xdr.xdrDecodeInt(); + sqa_pathp = xdr.xdrDecodeString(); + sqa_id = xdr.xdrDecodeInt(); + sqa_type = xdr.xdrDecodeInt(); + sqa_dqblk = new sq_dqblk(xdr); + } + +} +// End of ext_setquota_args.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/getquota_args.java b/rquota/src/main/java/org/dcache/rquota/xdr/getquota_args.java new file mode 100644 index 00000000..8e5b1580 --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/getquota_args.java @@ -0,0 +1,40 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import org.dcache.oncrpc4j.rpc.net.*; +import org.dcache.oncrpc4j.xdr.*; +import java.io.IOException; + +public class getquota_args implements XdrAble { + public String gqa_pathp; + public int gqa_uid; + + public getquota_args() { + } + + public getquota_args(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeString(gqa_pathp); + xdr.xdrEncodeInt(gqa_uid); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + gqa_pathp = xdr.xdrDecodeString(); + gqa_uid = xdr.xdrDecodeInt(); + } + +} +// End of getquota_args.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/getquota_rslt.java b/rquota/src/main/java/org/dcache/rquota/xdr/getquota_rslt.java new file mode 100644 index 00000000..89e54aa6 --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/getquota_rslt.java @@ -0,0 +1,56 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import org.dcache.oncrpc4j.rpc.net.*; +import org.dcache.oncrpc4j.xdr.*; +import java.io.IOException; + +public class getquota_rslt implements XdrAble { + public int status; + public rquota gqr_rquota; + + public getquota_rslt() { + } + + public getquota_rslt(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + switch ( status ) { + case qr_status.Q_OK: + gqr_rquota.xdrEncode(xdr); + break; + case qr_status.Q_NOQUOTA: + break; + case qr_status.Q_EPERM: + break; + } + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + switch ( status ) { + case qr_status.Q_OK: + gqr_rquota = new rquota(xdr); + break; + case qr_status.Q_NOQUOTA: + break; + case qr_status.Q_EPERM: + break; + } + } + +} +// End of getquota_rslt.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/qr_status.java b/rquota/src/main/java/org/dcache/rquota/xdr/qr_status.java new file mode 100644 index 00000000..fe201f43 --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/qr_status.java @@ -0,0 +1,20 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +/** + * Enumeration (collection of constants). + */ +public interface qr_status { + + public static final int Q_OK = 1; + public static final int Q_NOQUOTA = 2; + public static final int Q_EPERM = 3; + +} +// End of qr_status.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/rquota.java b/rquota/src/main/java/org/dcache/rquota/xdr/rquota.java new file mode 100644 index 00000000..60ea3983 --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/rquota.java @@ -0,0 +1,64 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import org.dcache.oncrpc4j.rpc.net.*; +import org.dcache.oncrpc4j.xdr.*; +import java.io.IOException; + +public class rquota implements XdrAble { + public int rq_bsize; + public boolean rq_active; + public int rq_bhardlimit; + public int rq_bsoftlimit; + public int rq_curblocks; + public int rq_fhardlimit; + public int rq_fsoftlimit; + public int rq_curfiles; + public int rq_btimeleft; + public int rq_ftimeleft; + + public rquota() { + } + + public rquota(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(rq_bsize); + xdr.xdrEncodeBoolean(rq_active); + xdr.xdrEncodeInt(rq_bhardlimit); + xdr.xdrEncodeInt(rq_bsoftlimit); + xdr.xdrEncodeInt(rq_curblocks); + xdr.xdrEncodeInt(rq_fhardlimit); + xdr.xdrEncodeInt(rq_fsoftlimit); + xdr.xdrEncodeInt(rq_curfiles); + xdr.xdrEncodeInt(rq_btimeleft); + xdr.xdrEncodeInt(rq_ftimeleft); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + rq_bsize = xdr.xdrDecodeInt(); + rq_active = xdr.xdrDecodeBoolean(); + rq_bhardlimit = xdr.xdrDecodeInt(); + rq_bsoftlimit = xdr.xdrDecodeInt(); + rq_curblocks = xdr.xdrDecodeInt(); + rq_fhardlimit = xdr.xdrDecodeInt(); + rq_fsoftlimit = xdr.xdrDecodeInt(); + rq_curfiles = xdr.xdrDecodeInt(); + rq_btimeleft = xdr.xdrDecodeInt(); + rq_ftimeleft = xdr.xdrDecodeInt(); + } + +} +// End of rquota.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/rquota.java~ b/rquota/src/main/java/org/dcache/rquota/xdr/rquota.java~ new file mode 100644 index 00000000..743242a1 --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/rquota.java~ @@ -0,0 +1,27 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +/** + * A collection of constants used by the "rquota" ONC/RPC program. + */ +public interface rquota { + public static final int RQUOTAPROC_GETQUOTA_1 = 1; + public static final int RQUOTAPROC_GETACTIVEQUOTA_1 = 2; + public static final int RQUOTAPROC_GETQUOTA_2 = 1; + public static final int RQUOTAPROC_SETQUOTA_1 = 3; + public static final int RQUOTAPROC_GETACTIVEQUOTA_2 = 2; + public static final int RQUOTAPROC_SETQUOTA_2 = 3; + public static final int RQUOTAVERS = 1; + public static final int RQ_PATHLEN = 1024; + public static final int RQUOTAPROG = 100011; + public static final int RQUOTAPROC_SETACTIVEQUOTA_1 = 4; + public static final int RQUOTAPROC_SETACTIVEQUOTA_2 = 4; + public static final int EXT_RQUOTAVERS = 2; +} +// End of rquota.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/rquotaServerStub.java b/rquota/src/main/java/org/dcache/rquota/xdr/rquotaServerStub.java new file mode 100644 index 00000000..4c270d5b --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/rquotaServerStub.java @@ -0,0 +1,111 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import java.io.IOException; + +/** + */ +public abstract class rquotaServerStub implements RpcDispatchable { + + public void dispatchOncRpcCall(RpcCall call) + throws OncRpcException, IOException { + + int version = call.getProgramVersion(); + int procedure = call.getProcedure(); + + if ( version == 1 ) { + switch ( procedure ) { + case 1: { + getquota_args args$ = new getquota_args(); + call.retrieveCall(args$); + getquota_rslt result$ = RQUOTAPROC_GETQUOTA_1(call, args$); + call.reply(result$); + break; + } + case 2: { + getquota_args args$ = new getquota_args(); + call.retrieveCall(args$); + getquota_rslt result$ = RQUOTAPROC_GETACTIVEQUOTA_1(call, args$); + call.reply(result$); + break; + } + case 3: { + setquota_args args$ = new setquota_args(); + call.retrieveCall(args$); + setquota_rslt result$ = RQUOTAPROC_SETQUOTA_1(call, args$); + call.reply(result$); + break; + } + case 4: { + setquota_args args$ = new setquota_args(); + call.retrieveCall(args$); + setquota_rslt result$ = RQUOTAPROC_SETACTIVEQUOTA_1(call, args$); + call.reply(result$); + break; + } + default: + call.failProcedureUnavailable(); + } + } else if ( version == 2 ) { + switch ( procedure ) { + case 1: { + ext_getquota_args args$ = new ext_getquota_args(); + call.retrieveCall(args$); + getquota_rslt result$ = RQUOTAPROC_GETQUOTA_2(call, args$); + call.reply(result$); + break; + } + case 2: { + ext_getquota_args args$ = new ext_getquota_args(); + call.retrieveCall(args$); + getquota_rslt result$ = RQUOTAPROC_GETACTIVEQUOTA_2(call, args$); + call.reply(result$); + break; + } + case 3: { + ext_setquota_args args$ = new ext_setquota_args(); + call.retrieveCall(args$); + setquota_rslt result$ = RQUOTAPROC_SETQUOTA_2(call, args$); + call.reply(result$); + break; + } + case 4: { + ext_setquota_args args$ = new ext_setquota_args(); + call.retrieveCall(args$); + setquota_rslt result$ = RQUOTAPROC_SETACTIVEQUOTA_2(call, args$); + call.reply(result$); + break; + } + default: + call.failProcedureUnavailable(); + } + } else { + call.failProgramUnavailable(); + } + } + + public abstract getquota_rslt RQUOTAPROC_GETQUOTA_1(RpcCall call$, getquota_args arg1); + + public abstract getquota_rslt RQUOTAPROC_GETACTIVEQUOTA_1(RpcCall call$, getquota_args arg1); + + public abstract setquota_rslt RQUOTAPROC_SETQUOTA_1(RpcCall call$, setquota_args arg1); + + public abstract setquota_rslt RQUOTAPROC_SETACTIVEQUOTA_1(RpcCall call$, setquota_args arg1); + + public abstract getquota_rslt RQUOTAPROC_GETQUOTA_2(RpcCall call$, ext_getquota_args arg1); + + public abstract getquota_rslt RQUOTAPROC_GETACTIVEQUOTA_2(RpcCall call$, ext_getquota_args arg1); + + public abstract setquota_rslt RQUOTAPROC_SETQUOTA_2(RpcCall call$, ext_setquota_args arg1); + + public abstract setquota_rslt RQUOTAPROC_SETACTIVEQUOTA_2(RpcCall call$, ext_setquota_args arg1); + +} +// End of rquotaServerStub.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/setquota_args.java b/rquota/src/main/java/org/dcache/rquota/xdr/setquota_args.java new file mode 100644 index 00000000..1522302f --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/setquota_args.java @@ -0,0 +1,46 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import org.dcache.oncrpc4j.rpc.net.*; +import org.dcache.oncrpc4j.xdr.*; +import java.io.IOException; + +public class setquota_args implements XdrAble { + public int sqa_qcmd; + public String sqa_pathp; + public int sqa_id; + public sq_dqblk sqa_dqblk; + + public setquota_args() { + } + + public setquota_args(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(sqa_qcmd); + xdr.xdrEncodeString(sqa_pathp); + xdr.xdrEncodeInt(sqa_id); + sqa_dqblk.xdrEncode(xdr); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + sqa_qcmd = xdr.xdrDecodeInt(); + sqa_pathp = xdr.xdrDecodeString(); + sqa_id = xdr.xdrDecodeInt(); + sqa_dqblk = new sq_dqblk(xdr); + } + +} +// End of setquota_args.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/setquota_rslt.java b/rquota/src/main/java/org/dcache/rquota/xdr/setquota_rslt.java new file mode 100644 index 00000000..f61f73f6 --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/setquota_rslt.java @@ -0,0 +1,56 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import org.dcache.oncrpc4j.rpc.net.*; +import org.dcache.oncrpc4j.xdr.*; +import java.io.IOException; + +public class setquota_rslt implements XdrAble { + public int status; + public rquota sqr_rquota; + + public setquota_rslt() { + } + + public setquota_rslt(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + switch ( status ) { + case qr_status.Q_OK: + sqr_rquota.xdrEncode(xdr); + break; + case qr_status.Q_NOQUOTA: + break; + case qr_status.Q_EPERM: + break; + } + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + switch ( status ) { + case qr_status.Q_OK: + sqr_rquota = new rquota(xdr); + break; + case qr_status.Q_NOQUOTA: + break; + case qr_status.Q_EPERM: + break; + } + } + +} +// End of setquota_rslt.java diff --git a/rquota/src/main/java/org/dcache/rquota/xdr/sq_dqblk.java b/rquota/src/main/java/org/dcache/rquota/xdr/sq_dqblk.java new file mode 100644 index 00000000..14765b70 --- /dev/null +++ b/rquota/src/main/java/org/dcache/rquota/xdr/sq_dqblk.java @@ -0,0 +1,58 @@ +/* + * Automatically generated by jrpcgen 1.0.7+ on 6/19/24, 7:09 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://remotetea.sourceforge.net for details + * + * This version of jrpcgen adopted by dCache project + * See http://www.dCache.ORG for details + */ +package org.dcache.rquota.xdr; +import org.dcache.oncrpc4j.rpc.*; +import org.dcache.oncrpc4j.rpc.net.*; +import org.dcache.oncrpc4j.xdr.*; +import java.io.IOException; + +public class sq_dqblk implements XdrAble { + public int rq_bhardlimit; + public int rq_bsoftlimit; + public int rq_curblocks; + public int rq_fhardlimit; + public int rq_fsoftlimit; + public int rq_curfiles; + public int rq_btimeleft; + public int rq_ftimeleft; + + public sq_dqblk() { + } + + public sq_dqblk(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(rq_bhardlimit); + xdr.xdrEncodeInt(rq_bsoftlimit); + xdr.xdrEncodeInt(rq_curblocks); + xdr.xdrEncodeInt(rq_fhardlimit); + xdr.xdrEncodeInt(rq_fsoftlimit); + xdr.xdrEncodeInt(rq_curfiles); + xdr.xdrEncodeInt(rq_btimeleft); + xdr.xdrEncodeInt(rq_ftimeleft); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + rq_bhardlimit = xdr.xdrDecodeInt(); + rq_bsoftlimit = xdr.xdrDecodeInt(); + rq_curblocks = xdr.xdrDecodeInt(); + rq_fhardlimit = xdr.xdrDecodeInt(); + rq_fsoftlimit = xdr.xdrDecodeInt(); + rq_curfiles = xdr.xdrDecodeInt(); + rq_btimeleft = xdr.xdrDecodeInt(); + rq_ftimeleft = xdr.xdrDecodeInt(); + } + +} +// End of sq_dqblk.java