PerformURLPOST() public method

Perform a POST to the cloud.
public PerformURLPOST ( bool async, String service, String>.IDictionary args ) : void
async bool True if this request should be asynchronous.
service String The service.
args String>.IDictionary The POST arguments.
return void
Esempio n. 1
0
        /// <summary>
        /// Publish the specified file.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="publishedPath">Where to publish the file.</param>
        public void PublishFile(Stream stream, String publishedPath)
        {
            String       uri     = this.session + "publish" + publishedPath;
            CloudRequest request = new CloudRequest();

            request.PerformURLPOST(uri, stream);
        }
Esempio n. 2
0
        /// <summary>
        /// Connect to the Encog cloud.
        /// </summary>
        /// <param name="uid">The user id.</param>
        /// <param name="pwd">The password.</param>
        public void Connect(String uid, String pwd)
        {
            CloudRequest request = new CloudRequest();
            IDictionary <String, String> args = new Dictionary <String, String>();

            args["uid"] = uid;
            args["pwd"] = pwd;
            request.PerformURLPOST(false, ConstructService("login"), args);
            if (!"success".Equals(request.Status))
            {
                throw new EncogCloudError(request.Message);
            }
            this.session = request.Session;
        }
Esempio n. 3
0
        /// <summary>
        /// Set the status for this task.
        /// </summary>
        /// <param name="status">The status for this task.</param>
        public void SetStatus(String status)
        {
            if (this.taskURL == null)
            {
                throw new EncogCloudError("Can't set status for inactive task.");
            }

            CloudRequest request = new CloudRequest();
            String       url     = this.taskURL + "update";

            IDictionary <String, String> args = new Dictionary <String, String>();

            args["status"] = status;
            request.PerformURLPOST(true, url, args);
        }
Esempio n. 4
0
        /// <summary>
        /// Setup this task.
        /// </summary>
        /// <param name="name">The name of this task.</param>
        public void Init(String name)
        {
            if (this.cloud.Session == null)
            {
                throw new EncogCloudError(
                          "Session must be established before a task is created.");
            }

            CloudRequest request = new CloudRequest();
            String       url     = this.cloud.Session;

            url += "task/create";
            IDictionary <String, String> args = new Dictionary <String, String>();

            args["name"]   = name;
            args["status"] = "Starting...";
            request.PerformURLPOST(false, url, args);
            this.taskURL = this.cloud.Session + "task/"
                           + request.GetResponseProperty("id") + "/";
        }
Esempio n. 5
0
        /// <summary>
        /// Stop this task.
        /// </summary>
        /// <param name="finalStatus">The final status for this task.</param>
        public void Stop(String finalStatus)
        {
            if (this.taskURL == null)
            {
                throw new EncogCloudError("Can't stop inactive task.");
            }

            // send final status
            CloudRequest request = new CloudRequest();
            String       url     = this.taskURL + "update";

            IDictionary <String, String> args = new Dictionary <String, String>();

            args["status"] = finalStatus;
            request.PerformURLPOST(false, url, args);

            // stop
            url     = this.taskURL + "stop";
            request = new CloudRequest();
            request.PerformURLGET(false, url);
        }
Esempio n. 6
0
 /// <summary>
 /// Connect to the Encog cloud.
 /// </summary>
 /// <param name="uid">The user id.</param>
 /// <param name="pwd">The password.</param>
 public void Connect(String uid, String pwd)
 {
     CloudRequest request = new CloudRequest();
     IDictionary<String, String> args = new Dictionary<String, String>();
     args["uid"] = uid;
     args["pwd"] = pwd;
     request.PerformURLPOST(false, ConstructService("login"), args);
     if (!"success".Equals(request.Status))
     {
         throw new EncogCloudError(request.Message);
     }
     this.session = request.Session;
 }
Esempio n. 7
0
        /// <summary>
        /// Publish the specified file.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="publishedPath">Where to publish the file.</param>
        public void PublishFile(Stream stream, String publishedPath)
        {
            String uri = this.session + "publish" + publishedPath;
            CloudRequest request = new CloudRequest();
            request.PerformURLPOST(uri, stream);

        }
Esempio n. 8
0
        /// <summary>
        /// Setup this task. 
        /// </summary>
        /// <param name="name">The name of this task.</param>
        public void Init(String name)
        {

            if (this.cloud.Session == null)
            {
                throw new EncogCloudError(
                        "Session must be established before a task is created.");
            }

            CloudRequest request = new CloudRequest();
            String url = this.cloud.Session;
            url += "task/create";
            IDictionary<String, String> args = new Dictionary<String, String>();
            args["name"] = name;
            args["status"] = "Starting...";
            request.PerformURLPOST(false, url, args);
            this.taskURL = this.cloud.Session + "task/"
                    + request.GetResponseProperty("id") + "/";
        }
Esempio n. 9
0
        /// <summary>
        /// Stop this task. 
        /// </summary>
        /// <param name="finalStatus">The final status for this task.</param>
        public void Stop(String finalStatus)
        {
            if (this.taskURL == null)
            {
                throw new EncogCloudError("Can't stop inactive task.");
            }

            // send final status
            CloudRequest request = new CloudRequest();
            String url = this.taskURL + "update";

            IDictionary<String, String> args = new Dictionary<String, String>();
            args["status"] = finalStatus;
            request.PerformURLPOST(false, url, args);

            // stop
            url = this.taskURL + "stop";
            request = new CloudRequest();
            request.PerformURLGET(false, url);
        }
Esempio n. 10
0
        /// <summary>
        /// Set the status for this task. 
        /// </summary>
        /// <param name="status">The status for this task.</param>
        public void SetStatus(String status)
        {
            if (this.taskURL == null)
            {
                throw new EncogCloudError("Can't set status for inactive task.");
            }

            CloudRequest request = new CloudRequest();
            String url = this.taskURL + "update";

            IDictionary<String, String> args = new Dictionary<String, String>();
            args["status"] = status;
            request.PerformURLPOST(true, url, args);

        }