Пример #1
0
        static public RProject saveAs(RProjectDetails details, ProjectDropOptions 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));
            data.Append("&name=" + HttpUtility.UrlEncode(details.name));
            data.Append("&descr=" + HttpUtility.UrlEncode(details.descr));
            data.Append("&longdescr=" + HttpUtility.UrlEncode(details.longdescr));
            data.Append("&projectcookie=" + HttpUtility.UrlEncode(details.cookie));
            data.Append("&shared=" + details.sharedUsers.ToString());

            if (!(options == null))
            {
                data.Append("&dropworkspace=" + options.dropWorkspace.ToString());
                data.Append("&dropdirectory=" + options.dropDirectory.ToString());
                data.Append("&drophistory=" + options.dropHistory.ToString());
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            RProject returnValue = default(RProject);

            returnValue = new RProject(jresponse, client);
            return(returnValue);
        }
Пример #2
0
        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);
        }
        public static String downloadFiles(RProjectDetails details, List<String> files, RClient client, String uri)
        {
            String returnValue = "";
            StringBuilder filenames = new StringBuilder();

            if (!(files == null))
            {
                if (files.Count > 0)
                {
                    foreach (var s in files)
                    {
                        filenames.Append(HttpUtility.UrlEncode(s) + ",");
                    }
                    filenames.Remove(filenames.Length - 1, 1);
                }
            }

            if (filenames.Length > 0)
            {
                returnValue = client.URL + uri + "/" + details.id + "/" + HttpUtility.UrlEncode(filenames.ToString()) + ";jsessionid=" + client.Cookie.Value;
            }
            else
            {
                returnValue = client.URL + uri + "/" + details.id + ";jsessionid=" + client.Cookie.Value;
            }

            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 RRepositoryFile storeObject(RProjectDetails details, String name, Boolean sharedUser, Boolean published, String restricted, String descr, Boolean versioning, RClient client, String uri)
        {
            RRepositoryFile returnValue = default(RRepositoryFile);
            StringBuilder   data        = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&name=" + HttpUtility.UrlEncode(name));
            data.Append("&descr=" + HttpUtility.UrlEncode(descr));
            data.Append("&version=" + versioning.ToString());
            data.Append("&shared=" + sharedUser.ToString());
            data.Append("&published=" + published.ToString());
            data.Append("&restricted=" + HttpUtility.UrlEncode(restricted));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(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);
        }
        public static 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;
        }
Пример #7
0
        static public RProjectFile writeFile(RProjectDetails details, String text, DirectoryUploadOptions options, RClient client, String uri)
        {
            RProjectFile  returnValue = default(RProjectFile);
            StringBuilder data        = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&text=" + HttpUtility.UrlEncode(text));
            if (!(options == null))
            {
                data.Append("&filename=" + HttpUtility.UrlEncode(options.filename));
                data.Append("&descr=" + HttpUtility.UrlEncode(options.descr));
                data.Append("&overwrite=" + options.overwrite.ToString());
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            if (!(jresponse.JSONMarkup["directory"] == null))
            {
                JObject jdir = jresponse.JSONMarkup["directory"].Value <JObject>();
                if (!(jdir["file"] == null))
                {
                    JObject jfile = jdir["file"].Value <JObject>();
                    returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id);
                }
            }

            return(returnValue);
        }
        public static 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;
        }
Пример #9
0
        static public RProjectFile uploadFile(RProjectDetails details, String file, DirectoryUploadOptions options, RClient client, String uri)
        {
            RProjectFile  returnValue = default(RProjectFile);
            StringBuilder data        = new StringBuilder();
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            parameters.Add("format", "json");
            parameters.Add("project", HttpUtility.UrlEncode(details.id));

            //create the input String
            if (!(options == null))
            {
                parameters.Add("filename", HttpUtility.UrlEncode(options.filename));
                parameters.Add("descr", HttpUtility.UrlEncode(options.descr));
                parameters.Add("overwrite", options.overwrite.ToString());
            }
            else
            {
                parameters.Add("filename", HttpUtility.UrlEncode(Path.GetFileName(file)));
            }
            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTFileUploadPost(uri, parameters, file, ref client);

            if (!(jresponse.JSONMarkup["directory"] == null))
            {
                JObject jdir = jresponse.JSONMarkup["directory"].Value <JObject>();
                if (!(jdir["file"] == null))
                {
                    JObject jfile = jdir["file"].Value <JObject>();
                    returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id);
                }
            }

            return(returnValue);
        }
Пример #10
0
        static public String downloadFiles(RProjectDetails details, List <String> files, RClient client, String uri)
        {
            String        returnValue = "";
            StringBuilder filenames   = new StringBuilder();

            if (!(files == null))
            {
                if (files.Count > 0)
                {
                    foreach (var s in files)
                    {
                        filenames.Append(HttpUtility.UrlEncode(s) + ",");
                    }
                    filenames.Remove(filenames.Length - 1, 1);
                }
            }


            if (filenames.Length > 0)
            {
                returnValue = client.URL + uri + "/" + details.id + "/" + HttpUtility.UrlEncode(filenames.ToString()) + ";jsessionid=" + client.Cookie.Value;
            }
            else
            {
                returnValue = client.URL + uri + "/" + details.id + ";jsessionid=" + client.Cookie.Value;
            }

            return(returnValue);
        }
Пример #11
0
        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);
        }
Пример #12
0
        static public RProjectFile loadFile(RProjectDetails details, RRepositoryFile file, RClient client, String uri)
        {
            RProjectFile  returnValue = default(RProjectFile);
            StringBuilder data        = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&filename=" + HttpUtility.UrlEncode(file.about().filename));
            data.Append("&directory=" + HttpUtility.UrlEncode(file.about().directory));
            data.Append("&author=" + HttpUtility.UrlEncode(file.about().author));
            data.Append("&version=" + HttpUtility.UrlEncode(file.about().version));
            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            if (!(jresponse.JSONMarkup["directory"] == null))
            {
                JObject jdir = jresponse.JSONMarkup["directory"].Value <JObject>();
                if (!(jdir["file"] == null))
                {
                    JObject jfile = jdir["file"].Value <JObject>();
                    returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id);
                }
            }

            return(returnValue);
        }
Пример #13
0
        /// <summary>
        /// Gets the details associated with this project
        /// </summary>
        /// <returns>RProjectDetails object</returns>
        /// <remarks></remarks>
        public RProjectDetails about()
        {
            RProjectDetails returnValue = default(RProjectDetails);

            returnValue = RProjectBaseImpl.about(m_projectDetails, m_client, Constants.RPROJECTABOUT);

            return(returnValue);
        }
Пример #14
0
        static public void interruptExecution(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.callRESTPost(uri, data.ToString(), ref client);
        }
        public static void delete(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.callRESTPost(uri, data.ToString(), ref client);
        }
        static public void transferObject(RProjectDetails details, String name, String url, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&name=" + HttpUtility.UrlEncode(name));
            data.Append("&url=" + HttpUtility.UrlEncode(url));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
        static public void uploadObject(RProjectDetails details, String name, String filename, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();
            Dictionary <String, String> parameters = new Dictionary <String, String>();

            //create the input String
            parameters.Add("format", "json");
            parameters.Add("project", HttpUtility.UrlEncode(details.id));
            parameters.Add("name", HttpUtility.UrlEncode(name));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTFileUploadPost(uri, parameters, filename, ref client);
        }
        public static 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;
        }
Пример #19
0
        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);
        }
        public static 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;
        }
Пример #21
0
        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);
        }
Пример #22
0
        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);
        }
        static public void loadObject(RProjectDetails details, RRepositoryFile file, 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 (!(file == null))
            {
                data.Append("&filename=" + HttpUtility.UrlEncode(file.about().filename));
                data.Append("&directory=" + HttpUtility.UrlEncode(file.about().directory));
                data.Append("&author=" + HttpUtility.UrlEncode(file.about().author));
                data.Append("&version=" + HttpUtility.UrlEncode(file.about().version));
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
Пример #24
0
        static public RProjectDetails update(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));
            data.Append("&name=" + HttpUtility.UrlEncode(details.name));
            data.Append("&descr=" + HttpUtility.UrlEncode(details.descr));
            data.Append("&longdescr=" + HttpUtility.UrlEncode(details.longdescr));
            data.Append("&projectcookie=" + HttpUtility.UrlEncode(details.cookie));
            data.Append("&shared=" + details.sharedUsers.ToString());

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            RProjectDetails returnValue = default(RProjectDetails);

            parseProject(jresponse, ref returnValue);
            return(returnValue);
        }
        static public List <RProjectPackage> attachPackage(RProjectDetails details, List <String> packageNames, String repo, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&repo=" + HttpUtility.UrlEncode(repo));
            if (!(packageNames == null))
            {
                if (packageNames.Count > 0)
                {
                    data.Append("&name=");
                    foreach (var s in packageNames)
                    {
                        data.Append(HttpUtility.UrlEncode(s) + ",");
                    }
                    data.Remove(data.Length - 1, 1);
                }
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            List <RProjectPackage> returnValue = new List <RProjectPackage>();

            if (!(jresponse.JSONMarkup["packages"] == null))
            {
                JArray jvalues = jresponse.JSONMarkup["packages"].Value <JArray>();
                foreach (var j in jvalues)
                {
                    if (j.Type != JTokenType.Null)
                    {
                        returnValue.Add(new RProjectPackage(new JSONResponse(j.Value <JObject>(), true, "", 0), client));
                    }
                }
            }

            return(returnValue);
        }
Пример #26
0
        static public void parseProject(JSONResponse jresponse, ref RProjectDetails projectDetails)
        {
            List <String> authors  = new List <String>();
            JObject       jproject = default(JObject);

            if (jresponse.JSONMarkup["project"].Type == JTokenType.Object)
            {
                jproject = jresponse.JSONMarkup["project"].Value <JObject>();
            }
            else
            {
                jproject = jresponse.JSONMarkup;
            }
            if (!(jproject == null))
            {
                String  cookie      = JSONUtilities.trimXtraQuotes(jproject["cookie"].Value <string>());
                String  descr       = JSONUtilities.trimXtraQuotes(jproject["descr"].Value <string>());
                String  id          = JSONUtilities.trimXtraQuotes(jproject["project"].Value <string>());
                Boolean live        = jproject["live"].Value <bool>();
                Boolean sharedUsers = jproject["shared"].Value <bool>();
                String  longdescr   = JSONUtilities.trimXtraQuotes(jproject["longdescr"].Value <string>());
                String  modified    = JSONUtilities.trimXtraQuotes(jproject["lastmodified"].Value <string>());
                String  name        = JSONUtilities.trimXtraQuotes(jproject["name"].Value <string>());
                String  origin      = JSONUtilities.trimXtraQuotes(jproject["origin"].Value <string>());

                if (!(jproject["authors"] == null))
                {
                    JArray jvalues = jproject["authors"].Value <JArray>();
                    foreach (var j in jvalues)
                    {
                        if (j.Type != JTokenType.Null)
                        {
                            authors.Add(j.Value <String>());
                        }
                    }
                }

                projectDetails = new RProjectDetails(cookie, descr, id, live, longdescr, modified, name, origin, sharedUsers, authors);
            }
        }
Пример #27
0
        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);
        }
        public static List<RProjectPackage> attachPackage(RProjectDetails details, List<String> packageNames, String repo, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&repo=" + HttpUtility.UrlEncode(repo));
            if (!(packageNames == null))
            {
                if (packageNames.Count > 0)
                {
                    data.Append("&name=");
                    foreach (var s in packageNames)
                    {
                        data.Append(HttpUtility.UrlEncode(s) + ",");
                    }
                    data.Remove(data.Length - 1, 1);
                }
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            List<RProjectPackage> returnValue = new List<RProjectPackage>();

            if (!(jresponse.JSONMarkup["packages"] == null))
            {
                JArray jvalues = jresponse.JSONMarkup["packages"].Value<JArray>();
                foreach (var j in jvalues)
                {
                    if (j.Type != JTokenType.Null)
                    {
                        returnValue.Add(new RProjectPackage(new JSONResponse(j.Value<JObject>(), true, "", 0), client));
                    }
                }
            }

            return returnValue;
        }
        static public void deleteObject(RProjectDetails details, List <String> objectNames, 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);
                }
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
        public static void deleteObject(RProjectDetails details, List<String> objectNames, 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);
                }
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
        public static void close(RProjectDetails details, ProjectCloseOptions 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.dropOptions == null))
                {
                    data.Append("&dropworkspace=" + options.dropOptions.dropWorkspace.ToString());
                    data.Append("&dropdirectory=" + options.dropOptions.dropDirectory.ToString());
                    data.Append("&drophistory=" + options.dropOptions.dropHistory.ToString());
                }
                data.Append("&flushhistory=" + options.flushHistory.ToString());
                data.Append("&disableautosave=" + options.disableAutosave.ToString());
                data.Append("&projectcookie=" + options.cookie);
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
Пример #32
0
        static public void close(RProjectDetails details, ProjectCloseOptions 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.dropOptions == null))
                {
                    data.Append("&dropworkspace=" + options.dropOptions.dropWorkspace.ToString());
                    data.Append("&dropdirectory=" + options.dropOptions.dropDirectory.ToString());
                    data.Append("&drophistory=" + options.dropOptions.dropHistory.ToString());
                }
                data.Append("&flushhistory=" + options.flushHistory.ToString());
                data.Append("&disableautosave=" + options.disableAutosave.ToString());
                data.Append("&projectcookie=" + options.cookie);
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
        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);
        }
        static public void pushObject(RProjectDetails details, List <RData> inputs, 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 (!(inputs == null))
            {
                if (inputs.Count > 0)
                {
                    data.Append("&inputs=");
                    String sJSON = JSONSerialize.createJSONfromRData(inputs);
                    data.Append(HttpUtility.UrlEncode(sJSON));
                    if (HTTPUtilities.DEBUGMODE == true)
                    {
                        Console.Write(sJSON);
                    }
                }
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
        public static void parseProject(JSONResponse jresponse, ref RProjectDetails projectDetails)
        {
            List<String> authors = new List<String>();
            JObject jproject = default(JObject);

            if (jresponse.JSONMarkup["project"].Type == JTokenType.Object)
            {
                jproject = jresponse.JSONMarkup["project"].Value<JObject>();
            }
            else
            {
                jproject = jresponse.JSONMarkup;
            }
            if (!(jproject == null))
            {
                String cookie = JSONUtilities.trimXtraQuotes(jproject["cookie"].Value<string>());
                String descr = JSONUtilities.trimXtraQuotes(jproject["descr"].Value<string>());
                String id = JSONUtilities.trimXtraQuotes(jproject["project"].Value<string>());
                Boolean live = jproject["live"].Value<bool>();
                Boolean sharedUsers = jproject["shared"].Value<bool>();
                String longdescr = JSONUtilities.trimXtraQuotes(jproject["longdescr"].Value<string>());
                String modified = JSONUtilities.trimXtraQuotes(jproject["lastmodified"].Value<string>());
                String name = JSONUtilities.trimXtraQuotes(jproject["name"].Value<string>());
                String origin = JSONUtilities.trimXtraQuotes(jproject["origin"].Value<string>());

                if (!(jproject["authors"] == null))
                {
                    JArray jvalues = jproject["authors"].Value<JArray>();
                    foreach (var j in jvalues)
                    {
                        if (j.Type != JTokenType.Null)
                        {
                            authors.Add(j.Value<String>());
                        }
                    }
                }

                projectDetails = new RProjectDetails(cookie, descr, id, live, longdescr, modified, name, origin, sharedUsers, authors);

            }
        }
Пример #36
0
        static public RProjectExecution executeCode(RProjectDetails details, String code, ProjectExecutionOptions 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));
            data.Append("&code=" + HttpUtility.UrlEncode(code));

            if (!(options == null))
            {
                if (!(options.rinputs == null))
                {
                    if (options.rinputs.Count > 0)
                    {
                        data.Append("&inputs=");
                        String sJSON = JSONSerialize.createJSONfromRData(options.rinputs);
                        data.Append(HttpUtility.UrlEncode(sJSON));
                        if (HTTPUtilities.DEBUGMODE == true)
                        {
                            Console.Write(sJSON);
                        }
                    }
                }

                if (!(options.preloadDirectory == null))
                {
                    data.Append("&preloadfilename=" + HttpUtility.UrlEncode(options.preloadDirectory.filename));
                    data.Append("&preloadfiledirectory=" + HttpUtility.UrlEncode(options.preloadDirectory.directory));
                    data.Append("&preloadfileauthor=" + HttpUtility.UrlEncode(options.preloadDirectory.author));
                    data.Append("&preloadfileversion=" + HttpUtility.UrlEncode(options.preloadDirectory.version));
                }

                if (!(options.preloadWorkspace == null))
                {
                    data.Append("&preloadobjectname=" + HttpUtility.UrlEncode(options.preloadWorkspace.filename));
                    data.Append("&preloadobjectdirectory=" + HttpUtility.UrlEncode(options.preloadWorkspace.directory));
                    data.Append("&preloadobjectauthor=" + HttpUtility.UrlEncode(options.preloadWorkspace.author));
                    data.Append("&preloadobjectversion=" + HttpUtility.UrlEncode(options.preloadWorkspace.version));
                }

                if (!(options.adoptionOptions == null))
                {
                    data.Append("&adoptworkspace=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptWorkspace));
                    data.Append("&adoptdirectory=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptDirectory));
                    data.Append("&adoptpackages=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptPackages));
                }

                if (!(options.storageOptions == null))
                {
                    data.Append("&storefile=" + HttpUtility.UrlEncode(options.storageOptions.files));
                    data.Append("&storedirectory=" + HttpUtility.UrlEncode(options.storageOptions.directory));
                    data.Append("&storeobject=" + HttpUtility.UrlEncode(options.storageOptions.objects));
                    data.Append("&storeworkspace=" + HttpUtility.UrlEncode(options.storageOptions.workspace));
                    data.Append("&storenewversion=" + options.storageOptions.newVersion.ToString());
                    data.Append("&storepublic=" + options.storageOptions.published.ToString());
                }

                if (!(options.routputs == null))
                {
                    if (options.routputs.Count > 0)
                    {
                        data.Append("&robjects=");
                        foreach (var s in options.routputs)
                        {
                            data.Append(HttpUtility.UrlEncode(s) + ",");
                        }
                        data.Remove(data.Length - 1, 1);
                    }
                }

                data.Append("&echooff=" + options.echooff.ToString());
                data.Append("&consoleoff=" + options.consoleoff.ToString());
                data.Append("&tag=" + HttpUtility.UrlEncode(options.tag));
                data.Append("&graphics=" + HttpUtility.UrlEncode(options.graphicsDevice));
                data.Append("&graphicswidth=" + HttpUtility.UrlEncode(options.graphicsWidth.ToString()));
                data.Append("&graphicsheight=" + HttpUtility.UrlEncode(options.graphicsHeight.ToString()));
                data.Append("&nan=" + HttpUtility.UrlEncode(options.nan));
                data.Append("&infinity=" + HttpUtility.UrlEncode(options.infinity));
                data.Append("&encodeDataFramePrimitiveAsVector=" + options.encodeDataFramePrimitiveAsVector.ToString());
                data.Append("&enableConsoleEvents=" + options.enableConsoleEvents.ToString());
                data.Append("&preloadbydirectory=" + HttpUtility.UrlEncode(options.preloadByDirectory));
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            RProjectExecution returnValue = new RProjectExecution(jresponse, client);

            return(returnValue);
        }
Пример #37
0
        /// <summary>
        /// Saves the project
        /// </summary>
        /// <param name="details">RProjectDetails object describing the project</param>
        /// <returns>RProjectDetails object</returns>
        /// <remarks></remarks>
        public RProjectDetails save(RProjectDetails details)
        {
            m_projectDetails = RProjectBaseImpl.save(details, null, m_client, Constants.RPROJECTSAVE);

            return m_projectDetails;
        }
Пример #38
0
 private void parseScriptExecution(JSONResponse jresponse, ref RProjectExecutionDetails executionDetails, ref RProjectDetails projectDetails)
 {
     RProjectBaseImpl.parseProjectExecution(jresponse, ref executionDetails, ref projectDetails, m_client);
 }
        public static RProjectDetails update(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));
            data.Append("&name=" + HttpUtility.UrlEncode(details.name));
            data.Append("&descr=" + HttpUtility.UrlEncode(details.descr));
            data.Append("&longdescr=" + HttpUtility.UrlEncode(details.longdescr));
            data.Append("&projectcookie=" + HttpUtility.UrlEncode(details.cookie));
            data.Append("&shared=" + details.sharedUsers.ToString());

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            RProjectDetails returnValue = default(RProjectDetails);
            parseProject(jresponse, ref returnValue);
            return returnValue;
        }
        public static RProject saveAs(RProjectDetails details, ProjectDropOptions 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));
            data.Append("&name=" + HttpUtility.UrlEncode(details.name));
            data.Append("&descr=" + HttpUtility.UrlEncode(details.descr));
            data.Append("&longdescr=" + HttpUtility.UrlEncode(details.longdescr));
            data.Append("&projectcookie=" + HttpUtility.UrlEncode(details.cookie));
            data.Append("&shared=" + details.sharedUsers.ToString());

            if (!(options == null))
            {
                data.Append("&dropworkspace=" + options.dropWorkspace.ToString());
                data.Append("&dropdirectory=" + options.dropDirectory.ToString());
                data.Append("&drophistory=" + options.dropHistory.ToString());
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            RProject returnValue = default(RProject);
            returnValue = new RProject(jresponse, client);
            return returnValue;
        }
        public static void parseProjectExecution(JSONResponse jresponse, ref RProjectExecutionDetails executionDetails, ref RProjectDetails projectDetails, RClient client)
        {
            List<RProjectFile> projectfiles = new List<RProjectFile>();
            List<RRepositoryFile> repositoryFiles = new List<RRepositoryFile>();
            List<RProjectResult> results = new List<RProjectResult>();
            List<String> warnings = new List<String>();
            List<RData> workspaceObjects = new List<RData>();
            JArray jvalues;
            JObject jrepo;

            if (!(jresponse.JSONMarkup["execution"] == null))
            {
                JObject jscriptexec = jresponse.JSONMarkup["execution"].Value<JObject>();

                String code = JSONUtilities.trimXtraQuotes(jscriptexec["code"].Value<string>());
                long timeStart = jscriptexec["timeStart"].Value<long>();
                long timeCode = jscriptexec["timeCode"].Value<long>();
                long timeTotal = jscriptexec["timeTotal"].Value<long>();
                String tag = JSONUtilities.trimXtraQuotes(jscriptexec["tag"].Value<string>());
                String console = JSONUtilities.trimXtraQuotes(jscriptexec["console"].Value<string>());
                String errorDescr = jresponse.ErrorMsg;
                int errorCode = jresponse.ErrorCode;
                String id = JSONUtilities.trimXtraQuotes(jscriptexec["execution"].Value<string>());
                Boolean interrupted = Convert.ToBoolean(jscriptexec["interrupted"].Value<string>());

                if (!(jscriptexec["results"] == null))
                {
                    jvalues = jscriptexec["results"].Value<JArray>();
                    foreach (var j in jvalues)
                    {
                        if (j.Type != JTokenType.Null)
                        {
                            results.Add(new RProjectResult(new JSONResponse(j.Value<JObject>(), true, "", 0), client));
                        }
                    }
                }

                if (!(jscriptexec["artifacts"] == null))
                {
                    jvalues = jscriptexec["artifacts"].Value<JArray>();
                    foreach (var j in jvalues)
                    {
                        if (j.Type != JTokenType.Null)
                        {
                            projectfiles.Add(new RProjectFile(new JSONResponse(j.Value<JObject>(), true, "", 0), client, id));
                        }
                    }
                }

                if (!(jscriptexec["warnings"] == null))
                {
                    jvalues = jscriptexec["warnings"].Value<JArray>();
                    foreach (var j in jvalues)
                    {
                        if (j.Type != JTokenType.Null)
                        {
                            warnings.Add(j.Value<string>());
                        }
                    }
                }

                if (!(jscriptexec["repository"] == null))
                {
                    jrepo = jscriptexec["repository"].Value<JObject>();

                    if (!(jrepo["files"] == null))
                    {
                        jvalues = jrepo["files"].Value<JArray>();
                        foreach (var j in jvalues)
                        {
                            if (j.Type != JTokenType.Null)
                            {
                                repositoryFiles.Add(new RRepositoryFile(new JSONResponse(j.Value<JObject>(), true, "", 0), client));
                            }
                        }
                    }
                }

                workspaceObjects = JSONUtilities.parseRObjects(jresponse.JSONMarkup);
                parseProject(jresponse, ref projectDetails);

                executionDetails = new RProjectExecutionDetails(projectfiles, code, timeStart, timeCode, timeTotal, tag, console, errorDescr, errorCode, id, interrupted, null, results, warnings, workspaceObjects);

            }
        }
        public static RRepositoryFile storeObject(RProjectDetails details, String name, Boolean sharedUser, Boolean published, String restricted, String descr, Boolean versioning, RClient client, String uri)
        {
            RRepositoryFile returnValue = default(RRepositoryFile);
            StringBuilder data = new StringBuilder();

            //create the input String
            data.Append(Constants.FORMAT_JSON);
            data.Append("&project=" + HttpUtility.UrlEncode(details.id));
            data.Append("&name=" + HttpUtility.UrlEncode(name));
            data.Append("&descr=" + HttpUtility.UrlEncode(descr));
            data.Append("&version=" + versioning.ToString());
            data.Append("&shared=" + sharedUser.ToString());
            data.Append("&published=" + published.ToString());
            data.Append("&restricted=" + HttpUtility.UrlEncode(restricted));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(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;
        }
        public static void pushObject(RProjectDetails details, List<RData> inputs, 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 (!(inputs == null))
            {
                if (inputs.Count > 0)
                {
                    data.Append("&inputs=");
                    String sJSON = JSONSerialize.createJSONfromRData(inputs);
                    data.Append(HttpUtility.UrlEncode(sJSON));
                    if (HTTPUtilities.DEBUGMODE == true)
                    {
                        Console.Write(sJSON);
                    }
                }
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
        public static void loadObject(RProjectDetails details, RRepositoryFile file, 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 (!(file == null))
            {
                data.Append("&filename=" + HttpUtility.UrlEncode(file.about().filename));
                data.Append("&author=" + HttpUtility.UrlEncode(file.about().author));
                data.Append("&version=" + HttpUtility.UrlEncode(file.about().version));
            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);
        }
 private void parseScriptExecution(JSONResponse jresponse, ref RProjectExecutionDetails executionDetails, ref RProjectDetails projectDetails)
 {
     RProjectBaseImpl.parseProjectExecution(jresponse, ref executionDetails, ref projectDetails, m_client);
 }
        public static RProjectExecution executeCode(RProjectDetails details, String code, ProjectExecutionOptions 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));
            data.Append("&code=" + HttpUtility.UrlEncode(code));

            if (!(options == null))
            {

                if (!(options.rinputs == null))
                {
                    if (options.rinputs.Count > 0)
                    {
                        data.Append("&inputs=");
                        String sJSON = JSONSerialize.createJSONfromRData(options.rinputs);
                        data.Append(HttpUtility.UrlEncode(sJSON));
                        if (HTTPUtilities.DEBUGMODE == true)
                        {
                            Console.Write(sJSON);
                        }
                    }
                }

                if (!(options.preloadDirectory == null))
                {
                    data.Append("&preloadfilename=" + HttpUtility.UrlEncode(options.preloadDirectory.filename));
                    data.Append("&preloadfiledirectory=" + HttpUtility.UrlEncode(options.preloadDirectory.directory));
                    data.Append("&preloadfileauthor=" + HttpUtility.UrlEncode(options.preloadDirectory.author));
                    data.Append("&preloadfileversion=" + HttpUtility.UrlEncode(options.preloadDirectory.version));
                }

                if (!(options.preloadWorkspace == null))
                {
                    data.Append("&preloadobjectname=" + HttpUtility.UrlEncode(options.preloadWorkspace.filename));
                    data.Append("&preloadobjectdirectory=" + HttpUtility.UrlEncode(options.preloadWorkspace.directory));
                    data.Append("&preloadobjectauthor=" + HttpUtility.UrlEncode(options.preloadWorkspace.author));
                    data.Append("&preloadobjectversion=" + HttpUtility.UrlEncode(options.preloadWorkspace.version));
                }

                if (!(options.adoptionOptions == null))
                {
                    data.Append("&adoptworkspace=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptWorkspace));
                    data.Append("&adoptdirectory=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptDirectory));
                    data.Append("&adoptpackages=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptPackages));
                }

                if (!(options.storageOptions == null))
                {
                    data.Append("&storefile=" + HttpUtility.UrlEncode(options.storageOptions.files));
                    data.Append("&storedirectory=" + HttpUtility.UrlEncode(options.storageOptions.directory));
                    data.Append("&storeobject=" + HttpUtility.UrlEncode(options.storageOptions.objects));
                    data.Append("&storeworkspace=" + HttpUtility.UrlEncode(options.storageOptions.workspace));
                    data.Append("&storenewversion=" + options.storageOptions.newVersion.ToString());
                    data.Append("&storepublic=" + options.storageOptions.published.ToString());
                }

                if (!(options.routputs == null))
                {
                    if (options.routputs.Count > 0)
                    {
                        data.Append("&robjects=");
                        foreach (var s in options.routputs)
                        {
                            data.Append(HttpUtility.UrlEncode(s) + ",");
                        }
                        data.Remove(data.Length - 1, 1);
                    }
                }

                data.Append("&echooff=" + options.echooff.ToString());
                data.Append("&consoleoff=" + options.consoleoff.ToString());
                data.Append("&tag=" + HttpUtility.UrlEncode(options.tag));
                data.Append("&graphics=" + HttpUtility.UrlEncode(options.graphicsDevice));
                data.Append("&graphicswidth=" + HttpUtility.UrlEncode(options.graphicsWidth.ToString()));
                data.Append("&graphicsheight=" + HttpUtility.UrlEncode(options.graphicsHeight.ToString()));
                data.Append("&nan=" + HttpUtility.UrlEncode(options.nan));
                data.Append("&infinity=" + HttpUtility.UrlEncode(options.infinity));
                data.Append("&encodeDataFramePrimitiveAsVector=" + options.encodeDataFramePrimitiveAsVector.ToString());
                data.Append("&enableConsoleEvents=" + options.enableConsoleEvents.ToString());
                data.Append("&preloadbydirectory=" + HttpUtility.UrlEncode(options.preloadByDirectory));

            }

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client);

            RProjectExecution returnValue = new RProjectExecution(jresponse, client);

            return returnValue;
        }
        public static 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;
        }
Пример #48
0
 private void parseProject(JSONResponse jresponse, ref RProjectDetails m_projectDetails)
 {
     RProjectBaseImpl.parseProject(jresponse, ref m_projectDetails);
 }
Пример #49
0
        static public String downloadResults(RProjectDetails details, RClient client, String uri)
        {
            String returnValue = client.URL + uri + "/" + details.id + ";jsessionid=" + client.Cookie.Value;

            return(returnValue);
        }
        public static 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;
        }
Пример #51
0
        /// <summary>
        /// Updates the project
        /// </summary>
        /// <param name="details">RProjectDetails object describing the project</param>
        /// <returns>A RProjectDetails object with the updated project information</returns>
        /// <remarks></remarks>
        public RProjectDetails update(RProjectDetails details)
        {
            m_projectDetails = RProjectBaseImpl.update(details, m_client, Constants.RPROJECTABOUTUPDATE);

            return(m_projectDetails);
        }
Пример #52
0
        /// <summary>
        /// Saves a copy of the project
        /// </summary>
        /// <param name="details">RProjectDetails object describing the project</param>
        /// <returns>RProject object</returns>
        /// <remarks></remarks>
        public RProject saveAs(RProjectDetails details)
        {
            RProject returnValue = RProjectBaseImpl.saveAs(details, null, m_client, Constants.RPROJECTSAVEAS);

            return returnValue;
        }
        public static void uploadObject(RProjectDetails details, String name, String filename, RClient client, String uri)
        {
            StringBuilder data = new StringBuilder();
            Dictionary<String, String> parameters = new Dictionary<String, String>();

            //create the input String
            parameters.Add("format", "json");
            parameters.Add("project", HttpUtility.UrlEncode(details.id));
            parameters.Add("name", HttpUtility.UrlEncode(name));

            //call the server
            JSONResponse jresponse = HTTPUtilities.callRESTFileUploadPost(uri, parameters, filename, ref client);
        }
Пример #54
0
        /// <summary>
        /// Updates the project
        /// </summary>
        /// <param name="details">RProjectDetails object describing the project</param>
        /// <returns>A RProjectDetails object with the updated project information</returns>
        /// <remarks></remarks>
        public RProjectDetails update(RProjectDetails details)
        {
            m_projectDetails = RProjectBaseImpl.update(details, m_client, Constants.RPROJECTABOUTUPDATE);

            return m_projectDetails;
        }
Пример #55
0
        /// <summary>
        /// Saves the project
        /// </summary>
        /// <param name="details">RProjectDetails object describing the project</param>
        /// <param name="dropOptions">ProjectDropOptions object describing what to drop from the project</param>
        /// <returns>RProjectDetails object</returns>
        /// <remarks></remarks>
        public RProjectDetails save(RProjectDetails details, ProjectDropOptions dropOptions)
        {
            m_projectDetails = RProjectBaseImpl.save(details, dropOptions, m_client, Constants.RPROJECTSAVE);

            return m_projectDetails;
        }
        public static 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;
        }
Пример #57
0
        /// <summary>
        /// Saves a copy the project
        /// </summary>
        /// <param name="details">RProjectDetails object describing the project</param>
        /// <param name="dropOptions">ProjectDropOptions object describing what to drop from the project</param>
        /// <returns>RProject object</returns>
        /// <remarks></remarks>
        public RProject saveAs(RProjectDetails details, ProjectDropOptions dropOptions)
        {
            RProject returnValue = RProjectBaseImpl.saveAs(details, dropOptions, m_client, Constants.RPROJECTSAVEAS);

            return returnValue;
        }
        public static 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;
        }
Пример #59
0
 private void parseProject(JSONResponse jresponse, ref RProjectDetails m_projectDetails)
 {
     RProjectBaseImpl.parseProject(jresponse, ref m_projectDetails);
 }
        public static String downloadResults(RProjectDetails details, RClient client, String uri)
        {
            String returnValue = client.URL + uri + "/" + details.id + ";jsessionid=" + client.Cookie.Value;

            return returnValue;
        }