/* * XML é visto como um array de bytes, chamado data. * esse array é salvo em "path" e lido por AppLoader gerando um objeto Component Type, * passado ao DGAC */ public string deployHashComponent(byte[] data, string userName, string password, string curDir, bool flag_compile) { try { string filename = Path.GetTempFileName(); File.WriteAllBytes(filename, data); if (data != null) { ComponentType c = LoaderApp.DeserializeObject(filename); int res; if (c.header.baseType != null && c.header.baseType.extensionType.ItemElementName == ItemChoiceType.implements) { res = BackEnd.registerConcreteComponentTransaction(c, userName, password, curDir, flag_compile); } else { res = BackEnd.registerAbstractComponentTransaction(c, userName, password, curDir, flag_compile); } if (res >= 0) { string component_reference = c.header.packagePath + "." + c.header.name; File.Copy(filename, Constants.PATH_TEMP_WORKER + component_reference + ".hpe", true); } } } catch (Exception e) { Console.Error.WriteLine(e.Message); return("-- Message -- \n " + e.Message + "\n\n -- Stack Trace --\n" + e.StackTrace + "\n\n -- Inner Exception -- \n" + e.InnerException); } return(null); }
public string deploy(string config_contents) { int res = -1; try { string filename = Path.GetTempFileName(); File.WriteAllText(filename, config_contents); ComponentType c = LoaderApp.DeserializeObject(filename); if (c.header.baseType != null && c.header.baseType.extensionType.ItemElementName == ItemChoiceType.implements) { res = BackEnd.registerConcreteComponentTransaction(c, null, null, ""); } else { res = BackEnd.registerAbstractComponentTransaction(c, null, null, ""); } if (res >= 0) { string component_reference = c.header.packagePath + "." + c.header.name; File.Copy(filename, Constants.PATH_TEMP_WORKER + component_reference + ".hpe", true); } } catch (Exception e) { Console.Error.WriteLine(e.Message); return("-- Message -- \n " + e.Message + "\n\n -- Stack Trace --\n" + e.StackTrace + "\n\n -- Inner Exception -- \n" + e.InnerException); } return("deployed " + res); }
public static String deployHashComponent(byte[] data) { string filename = "newConfig"; string path = Constants.PATH_TEMP_WORKER + filename + ".xml"; if (data != null) { FileUtil.saveByteArrayIntoFile(data, path); ComponentType c = LoaderApp.DeserializeObject(path); dgac.registerConcreteComponent(c, null, null, null); } return("ok"); }
/* * XML é visto como um array de bytes, chamado data. * esse array é salvo em "path" e lido por AppLoader gerando um objeto Component Type, * passado ao DGAC */ public string deployHashConfiguration(byte[] data, byte[] hcl_data, string userName, string password, string curDir) { Console.WriteLine("deployHashConfiguration"); Console.WriteLine("hcl_data is null ? {0} ! {1}", hcl_data == null, data == null); try { string filename = "newConfig"; string path = Constants.PATH_TEMP_WORKER + filename + ".xml"; if (data != null) { FileUtil.saveByteArrayIntoFile(data, path); ComponentType c = LoaderApp.DeserializeObject(path); int id_abstract = BackEnd.registerAbstractComponent(c, userName, password, curDir); BackEnd.updateConfiguration(id_abstract, hcl_data); } } catch (Exception e) { Console.Error.WriteLine(e.Message); return("-- Message -- \n " + e.Message + "\n\n -- Stack Trace --\n" + e.StackTrace + "\n\n -- Inner Exception -- \n" + e.InnerException); } return(null); }