import java.io.*; import java.util.*; import net.deterlab.abac.*; /** * Test swig generated JNI for libabac in threaded condition. * Multiple threads, each loads credentials from keystore and * runs a query against them. */ public class threaded_test implements Runnable { static String keystore; static String iname; static String roletype; static String pname; static { System.loadLibrary("jABAC"); } public void run(String[] args) { System.out.println("Hello from a thread!"); String _keystore=args[0]; String _iname=args[1]; String _roletype=args[2]; String _pname=args[3]; Context ctxt = new Context(); /* role="[keyid:${pID}].role:delicious" principal="[keyid:${cID}]" */ String ifname=iname+"_ID.pem"; String pfname=pname+"_ID.pem"; ID iID=new ID(ifname); ID pID=new ID(pfname); String ikeyid=iID.id_keyid(); String pkeyid=pID.id_keyid(); String role="[keyid:"+ikeyid+"].role:"+roletype; String principal="[keyid:"+pkeyid+"]"; ctxt.load_directory(keystore); /* what is in prolog db ctxt.dump_yap_db(); */ AttributeVector credentials = ctxt.query(role, principal); long sz=credentials.size(); if(sz > 0) System.out.println("prover success!!"); else System.out.println("prover failed!!"); for(int i=0; i "); System.out.println(" runs the query issuer.role <-?- principal and prints the result" ); System.exit(1); } keystore=args[0]; iname=args[1]; roletype=args[2]; pname=args[3]; (new Thread(new threaded_test(args))).start(); } }