static public List <RProject> listProjects(Boolean sortByLastModified, Boolean showPublicProjects, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&publicprojectsalso=" + showPublicProjects.ToString()); data.Append("&publicprojectsonly=false"); data.Append("&isordered=" + sortByLastModified.ToString()); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RProject> returnValue = new List <RProject>(); //Parse the response if (!(jresponse.JSONMarkup["projects"] == null)) { JArray jvalues = jresponse.JSONMarkup["projects"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RProject(new JSONResponse(j.Value <JObject>(), true, "", 0), client)); } } } return(returnValue); }
static public List <RData> getObject(RProjectDetails details, List <String> objectNames, Boolean encodeDataFramePrimitiveAsVector, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); if (!(objectNames == null)) { if (objectNames.Count > 0) { data.Append("&name="); foreach (var s in objectNames) { data.Append(HttpUtility.UrlEncode(s) + ","); } data.Remove(data.Length - 1, 1); } } data.Append("&encodeDataFramePrimitiveAsVector=" + encodeDataFramePrimitiveAsVector.ToString()); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RData> returnValue = new List <RData>(); returnValue = JSONUtilities.parseRObjects(jresponse.JSONMarkup); return(returnValue); }
static public List <RProjectFile> listFiles(RProjectDetails details, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RProjectFile> returnValue = new List <RProjectFile>(); if (!(jresponse.JSONMarkup["directory"] == null)) { JObject jdir = jresponse.JSONMarkup["directory"].Value <JObject>(); if (!(jdir["files"] == null)) { JArray jvalues = jdir["files"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RProjectFile(new JSONResponse(j.Value <JObject>(), true, "", 0), client, details.id)); } } } } return(returnValue); }
/// <summary> /// Lists the results associated with this Execution /// </summary> /// <returns>List of RProjectResult objects</returns> /// <remarks></remarks> public List <RProjectResult> listResults() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RPROJECTEXECUTERESULTLIST; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&execution=" + HttpUtility.UrlEncode(m_executionDetails.id)); data.Append("&project=" + HttpUtility.UrlEncode(m_projectDetails.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref m_client); List <RProjectResult> returnValue = new List <RProjectResult>(); if (!(jresponse.JSONMarkup["execution"] == null)) { JObject jexec = jresponse.JSONMarkup["execution"].Value <JObject>(); if (!(jexec["results"] == null)) { JArray jvalues = jexec["results"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RProjectResult(new JSONResponse(j.Value <JObject>(), true, "", 0), m_client)); } } } } return(returnValue); }
static public List <RJob> listJobs(RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RJob> returnValue = new List <RJob>(); if (!(jresponse.JSONMarkup["jobs"] == null)) { JArray jvalues = jresponse.JSONMarkup["jobs"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RJob(new JSONResponse(j.Value <JObject>(), true, "", 0), client)); } } } return(returnValue); }
static public String ping(RProjectDetails details, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); RProjectDetails projectDetails = default(RProjectDetails); RProjectBaseImpl.parseProject(jresponse, ref projectDetails); String returnValue = ""; if (!(projectDetails == null)) { returnValue = System.Convert.ToString(projectDetails.islive); } else { returnValue = System.Convert.ToString(false); } return(returnValue); }
static public RRepositoryFile fetchFile(String filename, String author, String directory, String version, RClient client, String uri) { RRepositoryFile returnValue = default(RRepositoryFile); StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&filename=" + HttpUtility.UrlEncode(filename)); data.Append("&directory=" + HttpUtility.UrlEncode(directory)); data.Append("&author=" + HttpUtility.UrlEncode(author)); data.Append("&version=" + HttpUtility.UrlEncode(version)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["file"] == null)) { JObject jfile = jrepo["file"].Value <JObject>(); returnValue = new RRepositoryFile(new JSONResponse(jfile, true, "", 0), client); } } return(returnValue); }
/// <summary> /// Interrupts the current execution on the HTTP blackbox project associated /// with the current HTTP session. /// </summary> public void interruptScript() { StringBuilder data = new StringBuilder(); String uri = Constants.RREPOSITORYSCRIPTINTERRUPT; data.Append(Constants.FORMAT_JSON); //call the server RClient client = this; JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); }
static public List <RRepositoryDirectory> listDirectories(Boolean userfiles, Boolean archived, Boolean sharedUsers, Boolean published, Boolean external, String directory, String category, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&userfiles=" + userfiles.ToString()); data.Append("&archived=" + archived.ToString()); data.Append("&shared=" + sharedUsers.ToString()); data.Append("&published=" + published.ToString()); data.Append("&external=" + external.ToString()); data.Append("&directory=" + HttpUtility.UrlEncode(directory.Trim())); data.Append("&categoryFilter=" + HttpUtility.UrlEncode(category.Trim())); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RRepositoryDirectory> returnValue = new List <RRepositoryDirectory>(); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["directories"] == null)) { JObject jdirs = jrepo["directories"].Value <JObject>(); if (!(jdirs["user"] == null)) { JArray jvalues = jdirs["user"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RRepositoryDirectory(new JSONResponse(j.Value <JObject>(), true, "", 0), client)); } } } if (!(jdirs["system"] == null)) { JArray jvalues = jdirs["system"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RRepositoryDirectory(new JSONResponse(j.Value <JObject>(), true, "", 0), client)); } } } } } return(returnValue); }
static public String export(RProjectDetails details, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); String returnValue = System.Convert.ToString(HttpUtility.UrlEncode(uri + "/" + details.id + ";jsessionid=" + client.Cookie.Value)); return(returnValue); }
static public RProjectDetails about(RProjectDetails details, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); RProjectDetails returnValue = default(RProjectDetails); parseProject(jresponse, ref returnValue); return(returnValue); }
/// <summary> /// Gets an RJob object for a give job identifier /// </summary> /// <param name="jobId">job identifier</param> /// <returns>RJob object</returns> /// <remarks></remarks> public RJob queryJob(String jobId) { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RJOBQUERY; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&job=" + HttpUtility.UrlEncode(jobId)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref m_client); return(new RJob(jresponse, m_client)); }
static public String getConsole(RProjectDetails details, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); String console = ""; parseConsole(jresponse, ref console); return(console); }
/// <summary> /// Gets the details associated with this user /// </summary> /// <returns>RUserDetails object</returns> /// <remarks></remarks> public RUserDetails about() { StringBuilder data = new StringBuilder(); RUserDetails userDetails = null; //set the url String uri = Constants.RUSERABOUT; //create the input String data.Append(Constants.FORMAT_JSON); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref m_client); parseUser(jresponse, ref userDetails); return(userDetails); }
/// <summary> /// Gets the URL associated with this Project File /// </summary> /// <returns>URL of project file</returns> /// <remarks></remarks> public String download() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RPROJECTDIRECTORYDOWNLOAD; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + m_project); data.Append("&name=" + HttpUtility.UrlEncode(m_fileDetails.filename)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref m_client); String returnValue = System.Convert.ToString(HttpUtility.UrlEncode(uri + "/" + m_project + "/" + m_fileDetails.filename + ";jsessionid=" + m_client.Cookie.Value)); return(returnValue); }
/// <summary> /// Gets the URL of the results associated with this Execution /// </summary> /// <returns>URL of the results</returns> /// <remarks></remarks> public String downloadResults() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RPROJECTEXECUTERESULTDOWNLOAD; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&execution=" + HttpUtility.UrlEncode(m_executionDetails.id)); data.Append("&project=" + HttpUtility.UrlEncode(m_projectDetails.id)); data.Append("&name=" + ""); data.Append("&inline=false"); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref m_client); String returnValue = System.Convert.ToString(HttpUtility.UrlEncode(uri + "/" + m_projectDetails.id + "/" + m_executionDetails.id + ";jsessionid=" + m_client.Cookie.Value)); return(returnValue); }
static public List <RProjectExecution> getHistory(RProjectDetails details, ProjectHistoryOptions options, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); if (!(options == null)) { if (options.depthFilter < 1 || options.depthFilter > 500) { options.depthFilter = 250; } data.Append("&filterdepth=" + options.depthFilter.ToString()); data.Append("&filtertag=" + HttpUtility.UrlEncode(options.tagfilter)); data.Append("&reversed=" + options.reversed.ToString()); } else { data.Append("&filterdepth=250"); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RProjectExecution> returnValue = new List <RProjectExecution>(); if (!(jresponse.JSONMarkup["history"] == null)) { JArray jvalues = jresponse.JSONMarkup["history"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RProjectExecution(new JSONResponse(j.Value <JObject>(), true, "", 0), client)); } } } return(returnValue); }
/// <summary> /// Retrieve the versions of a repository file /// </summary> /// <returns>List of RRepositoryFile objects</returns> /// <remarks></remarks> public List <RRepositoryFile> versions() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RREPOSITORYFILELIST; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&ispublic=false"); data.Append("&isordered=false"); data.Append("&filename=" + HttpUtility.UrlEncode(m_fileDetails.filename)); data.Append("&directory=" + HttpUtility.UrlEncode(m_fileDetails.directory)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref m_client); List <RRepositoryFile> returnValue = new List <RRepositoryFile>(); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["files"] == null)) { JArray jvalues = jrepo["files"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RRepositoryFile(new JSONResponse(j.Value <JObject>(), true, "", 0), m_client)); } } } } return(returnValue); }
static public List <RData> listObjects(RProjectDetails details, ProjectWorkspaceOptions options, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); if (!(options == null)) { data.Append("&root=" + HttpUtility.UrlEncode(options.alternateRoot)); data.Append("&filter=" + HttpUtility.UrlEncode(options.startsWithFilter)); data.Append("&clazz=" + HttpUtility.UrlEncode(options.classFilter)); data.Append("&pagesize=" + options.pagesize.ToString()); data.Append("&pageoffset=" + options.pageoffset.ToString()); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTGet(uri, data.ToString(), ref client); List <RData> returnValue = JSONUtilities.parseRObjects(jresponse.JSONMarkup); return(returnValue); }