/// <summary> /// Constructor for initialization /// </summary> public RestAPI() { // Logger.LogWrite(EskimoDBLogLevel.Verbose, "Creating"); DependencyInjection di = DependencyInjection.GetInstance(); mockRootServer = (IRootServer)di.CreateObject("root", new object[]{ this,new WSDualHttpBinding(),"http://localhost:8080/root"}); mockAuthServer = (IAuthServer)di.CreateObject("auth", new object[]{ null,new BasicHttpBinding(),"http://149.119.196.45:8080/IComm"}); m_PutDataSetCalled = false; m_PutQueryInfoCalled = false; m_QueryResult = new QueryResult(0, null, null); m_id = null; m_QueryDataset = new QueryDataset(new System.Collections.Generic.List<Type>(), new System.Collections.Generic.List<string>()); m_lines = 0; m_IterateToTheEnd = 0; m_CallGetResult = true; m_startLine = 0; m_RowsPerTime = 5; m_IterateIndex = 0; m_FinalLines = 0; m_Table = new Tables(); }
bool Release(IRootServer svc) { string id = "demoID", token = "demo auth token"; QueryResult queryResult = svc.Release(id, token); if (queryResult != null) return true; return false; }
bool ExecQuery(IRootServer svc) { string query = "create db dbname;", token = "demo auth token"; QueryResult queryResult = svc.ExecQuery(query, token); if (queryResult != null) return true; return false; }
bool getResult(IRootServer svc) { string id = "demoID", token = "demo auth token"; int startLine = 1, numberOfLines = 10; QueryResult queryResult = svc.GetResult(id, startLine, numberOfLines, token); if (queryResult != null) return true; return false; }
private bool Connect(String host) { Console.WriteLine("Connecting to PractiSES root server ({0})...", host); rootServer = (IRootServer)Activator.GetObject(typeof(IRootServer), "http://" + host + ":88/PractiSES_Root"); try { if (rootServer.Hello()) { Console.WriteLine("Connected to PractiSES root server."); } } catch (Exception e) { Console.WriteLine("Unable to connect to PractiSES root server."); return(false); } /*Console.Write("Domain Name: "); * String domainName = Console.ReadLine(); * GetCertificate(domainName);*/ return(true); }
/*private X509Certificate2 GetCertificate(String domainName) * { * return rootServer.GetCertificate(domainName); * }*/ private bool ConnectRootServer(String host) { ActionLog_Write("Connecting to PractiSES root server (" + host + ")..."); Console.WriteLine("Connecting to PractiSES root server ({0})...", host); rootServer = (IRootServer)Activator.GetObject(typeof(IRootServer), "http://" + host + ":88/PractiSES_Root"); try { if (rootServer.Hello()) { ActionLog_Write("Connected to PractiSES root server.."); Console.WriteLine("Connected to PractiSES root server."); } } catch (Exception e) { Console.WriteLine(e.Message + "\nUnable to connect to PractiSES root server."); return(false); } return(true); }
/// <summary> /// Configuring the client api by creating objects using the dependency framework /// </summary> public void ConfigClient() { Logger.LogWrite("Creating instance of DI to cinfigure client api"); di = DependencyInjection.GetInstance(); mockRootServer = (IRootServer)di.CreateObject("root", new object[]{ this,new WSDualHttpBinding(),rootHostAddress}); mockAuthServer = (IAuthServer)di.CreateObject("auth", new object[]{ null,new BasicHttpBinding(),authHostAddress}); }
private bool Connect(String host) { Console.WriteLine("Connecting to PractiSES root server ({0})...", host); rootServer = (IRootServer)Activator.GetObject(typeof(IRootServer), "http://" + host + ":88/PractiSES_Root"); try { if (rootServer.Hello()) { Console.WriteLine("Connected to PractiSES root server."); } } catch(Exception e) { Console.WriteLine("Unable to connect to PractiSES root server."); return false; } /*Console.Write("Domain Name: "); String domainName = Console.ReadLine(); GetCertificate(domainName);*/ return true; }
/*private X509Certificate2 GetCertificate(String domainName) { return rootServer.GetCertificate(domainName); }*/ private bool ConnectRootServer(String host) { ActionLog_Write("Connecting to PractiSES root server (" + host + ")..."); Console.WriteLine("Connecting to PractiSES root server ({0})...", host); rootServer = (IRootServer)Activator.GetObject(typeof(IRootServer), "http://" + host + ":88/PractiSES_Root"); try { if (rootServer.Hello()) { ActionLog_Write("Connected to PractiSES root server.."); Console.WriteLine("Connected to PractiSES root server."); } } catch (Exception e) { Console.WriteLine(e.Message + "\nUnable to connect to PractiSES root server."); return false; } return true; }