Esempio n. 1
0
        /// <summary>
        /// get the Auth Token from Server which can be used for any operation later.
        /// </summary>
        /// <returns>True if token generated
        /// False otherwise
        /// </returns>
        public Boolean getAuthorizationToken()
        {
            try
            {
                GetHTTPRequest request = new GetHTTPRequest(this);
                request.createHTTPRequest(Resource1.AuthRequest);
                ExecutionResult executionResult = request.executeRequest();
                token = executionResult.response.Headers
                    [CommonConstants.X_AUTH_TOKEN_CONSTANT];
                if (token != null)
                {
                    return true;
                }
                else
                {
                    return false;

                }
            }
            catch (ExceptionHandler)
            {
                return false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieve the details of container from JSON repsonse
        /// </summary>
        private void toString()
        {
            try
            {
                GetHTTPRequest request = new GetHTTPRequest(this.client);
                request.createHTTPRequest(path, Resource1.ContainerRequest);
                ExecutionResult executionResult = request.executeRequest();
                childrenRange = JSONParser.getFieldValue("childrenRange",
                    executionResult.responseFromServer);
                objectName = JSONParser.getFieldValue("objectName",
                    executionResult.responseFromServer);
                capabilitiesURI = JSONParser.getFieldValue("capabilitiesURI",
                    executionResult.responseFromServer);
                parentURI = JSONParser.getFieldValue("parentURI",
                    executionResult.responseFromServer);
                parentURI = parentURI.Remove(parentURI.Length - 1);
                metadata = new Metadata(JSONParser.getFieldValue("metadata",
                    executionResult.responseFromServer));
                objectType = JSONParser.getFieldValue("objectType",
                    executionResult.responseFromServer);
                children = JSONParser.getChildren(JSONParser.getFieldValue("children",
                    executionResult.responseFromServer));

            }
            catch (ExceptionHandler)
            { }
        }
Esempio n. 3
0
 /// <summary>
 /// Display contents of the account
 /// </summary>
 public List<String> displayAccountContents()
 {
     GetHTTPRequest request = new GetHTTPRequest(this.client);
     request.createHTTPRequest(Resource1.AccountRequest);
     ExecutionResult executionResult = request.executeRequest();
     List<String> contents = JSONParser.getChildren(JSONParser.getFieldValue("children",executionResult.responseFromServer));
     return contents;
 }
Esempio n. 4
0
 /// <summary>
 /// Returns Value of the Object
 /// </summary>
 /// <returns>String containing Value of the Object</returns>
 public String getValue()
 {
     GetHTTPRequest request = new GetHTTPRequest(this.client);
     request.createHTTPRequest(path, Resource1.ObjectRequest);
     ExecutionResult executionResult = request.executeRequest();
     String value = JSONParser.getFieldValue("value", executionResult.responseFromServer);
     byte[] objectValue = Convert.FromBase64String(value);
     value = System.Text.Encoding.UTF8.GetString(objectValue);
     return value;
 }