//sign cli entry point static int Main(string[] args) { String contextJson = args[0]; RunTimeContext context = new RunTimeContext(contextJson); ToolManagerFactory tm = new ToolManagerFactory("path to manifest.xml"); //abstract AbiTool is concrete signFileTool AbiTool signFileTool = tm.GetTool("SignFile"); //factory makes commands for tools //signFile -> sign //signFile -> validate //KW -> scan //KW -> upload //... AbiToolCommandFactory abiToolCmdFactory = new AbiSignFileCommandFactory(signFileTool, context.getByName("Signing")); //abstract command "is a" concrete sign command AbiCmd signCmd = abiToolCmdFactory.CreateCommand("sign"); //abstract result "is a" sign command result AbiCmdResult result = signCmd.DoWork("sign target in context"); //generate the output context from the current AbiCmdResult result.getContext().WriteToFile(); //pass result return code to user return(result.code); }
public AbiTool CreateTool(string toolName, ManifestEntry manifestEntry) { AbiTool result = null; switch (toolName) { //gonna be a huge nasty switch block, Activator would make this simpler but reflection can make heads blow up case "SignFile": //make the generic SignFile result = new SignFile(this.GetToolPath(manifestEntry)); break; case "SignTool": //make the generic SignFile result = new SignTool(this.GetToolPath(manifestEntry)); break; default: throw new Exception("Unsupported tool name!"); } return(result); }
public SignCommand(AbiTool tool, ContextObject context) : base(tool, context) { tuples = new List <Tuple <string, string> >(); }
public AbiSignFileCommandFactory(AbiTool tool, ContextObject context) : base(tool, context) { }
public AbiCmd(AbiTool tool, ContextObject context) { this.tool = tool; this.context = context; }
public AbiToolCommandFactory(AbiTool tool, ContextObject context) { this.tool = tool; this.context = context; }