Esempio n. 1
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeObjectsResponse response = new DescribeObjectsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("pipelineObjects", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <PipelineObject, PipelineObjectUnmarshaller>(
                        PipelineObjectUnmarshaller.GetInstance());
                    response.PipelineObjects = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("marker", targetDepth))
                {
                    response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("hasMoreResults", targetDepth))
                {
                    response.HasMoreResults = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Esempio n. 2
0
 public static PipelineObjectUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new PipelineObjectUnmarshaller();
     }
     return(instance);
 }
        public DescribeObjectsResult Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeObjectsResult describeObjectsResult = new DescribeObjectsResult();

            describeObjectsResult.PipelineObjects = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("PipelineObjects", targetDepth))
                    {
                        describeObjectsResult.PipelineObjects = new List <PipelineObject>();
                        PipelineObjectUnmarshaller unmarshaller = PipelineObjectUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                describeObjectsResult.PipelineObjects.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Marker", targetDepth))
                    {
                        describeObjectsResult.Marker = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("HasMoreResults", targetDepth))
                    {
                        describeObjectsResult.HasMoreResults = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(describeObjectsResult);
                }
            }


            return(describeObjectsResult);
        }
Esempio n. 4
0
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeObjectsResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("pipelineObjects", targetDepth))
                {
                    context.Read();
                    response.PipelineObjects = new List <PipelineObject>();
                    PipelineObjectUnmarshaller unmarshaller = PipelineObjectUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.PipelineObjects.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("marker", targetDepth))
                {
                    context.Read();
                    response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("hasMoreResults", targetDepth))
                {
                    context.Read();
                    response.HasMoreResults = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }
        public TaskObject Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            TaskObject taskObject = new TaskObject();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("taskId", targetDepth))
                {
                    taskObject.TaskId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("pipelineId", targetDepth))
                {
                    taskObject.PipelineId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("attemptId", targetDepth))
                {
                    taskObject.AttemptId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("objects", targetDepth))
                {
                    var unmarshaller = new DictionaryUnmarshaller <String, PipelineObject, StringUnmarshaller, PipelineObjectUnmarshaller>(
                        StringUnmarshaller.GetInstance(), PipelineObjectUnmarshaller.GetInstance());
                    taskObject.Objects = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

            return(taskObject);
        }
Esempio n. 6
0
        public GetPipelineDefinitionResult Unmarshall(JsonUnmarshallerContext context)
        {
            GetPipelineDefinitionResult getPipelineDefinitionResult = new GetPipelineDefinitionResult();

            getPipelineDefinitionResult.PipelineObjects = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("PipelineObjects", targetDepth))
                    {
                        getPipelineDefinitionResult.PipelineObjects = new List <PipelineObject>();
                        PipelineObjectUnmarshaller unmarshaller = PipelineObjectUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                getPipelineDefinitionResult.PipelineObjects.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(getPipelineDefinitionResult);
                }
            }


            return(getPipelineDefinitionResult);
        }
Esempio n. 7
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetPipelineDefinitionResponse response = new GetPipelineDefinitionResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("pipelineObjects", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <PipelineObject, PipelineObjectUnmarshaller>(
                        PipelineObjectUnmarshaller.GetInstance());
                    response.PipelineObjects = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

            return(response);
        }
Esempio n. 8
0
        public TaskObject Unmarshall(JsonUnmarshallerContext context)
        {
            TaskObject taskObject = new TaskObject();

            taskObject.Objects = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("TaskId", targetDepth))
                    {
                        taskObject.TaskId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("PipelineId", targetDepth))
                    {
                        taskObject.PipelineId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("AttemptId", targetDepth))
                    {
                        taskObject.AttemptId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Objects", targetDepth))
                    {
                        taskObject.Objects = new Dictionary <String, PipelineObject>();
                        KeyValueUnmarshaller <string, PipelineObject, StringUnmarshaller, PipelineObjectUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, PipelineObject, StringUnmarshaller, PipelineObjectUnmarshaller>(StringUnmarshaller.GetInstance(), PipelineObjectUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, PipelineObject> kvp = unmarshaller.Unmarshall(context);
                                taskObject.Objects.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(taskObject);
                }
            }


            return(taskObject);
        }
        public TaskObject Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            TaskObject taskObject = new TaskObject();



            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("taskId", targetDepth))
                {
                    context.Read();
                    taskObject.TaskId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("pipelineId", targetDepth))
                {
                    context.Read();
                    taskObject.PipelineId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("attemptId", targetDepth))
                {
                    context.Read();
                    taskObject.AttemptId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("objects", targetDepth))
                {
                    context.Read();
                    taskObject.Objects = new Dictionary <String, PipelineObject>();
                    KeyValueUnmarshaller <string, PipelineObject, StringUnmarshaller, PipelineObjectUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, PipelineObject, StringUnmarshaller, PipelineObjectUnmarshaller>(StringUnmarshaller.GetInstance(), PipelineObjectUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, PipelineObject> kvp = unmarshaller.Unmarshall(context);
                        taskObject.Objects.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return(taskObject);
                }
            }


            return(taskObject);
        }