Ejemplo n.º 1
0
        public static IList <Uri> FromStream(IOrientdbResponse response, Stream stream, IOrientdbSerializer serializer)
        {
            var result = serializer.Deserialize <NodeInfoResponse>(stream);
            var l      = new List <Uri>();

            foreach (var kv in result.nodes.Values)
            {
                if (!kv.http_address.IsNullOrEmpty())
                {
                    l.Add(Parse("http", kv.http_address));
                }
                else if (!kv.https_address.IsNullOrEmpty())
                {
                    l.Add(Parse("https", kv.https_address));
                }
                else if (!kv.thrift_address.IsNullOrEmpty())
                {
                    l.Add(Parse("http", kv.thrift_address));
                }
            }
            return(l);
        }
Ejemplo n.º 2
0
        public static OrientdbResponse <TTo> CloneFrom <TTo>(IOrientdbResponse from, TTo to)
        {
            var response = new OrientdbResponse <TTo>(from.Settings)
            {
                OriginalException = from.OriginalException,
                HttpStatusCode    = from.HttpStatusCode,
                Request           = from.Request,
                RequestMethod     = from.RequestMethod,
                RequestUrl        = from.RequestUrl,
                Response          = to,
                ResponseRaw       = from.ResponseRaw,
                Serializer        = from.Settings.Serializer,
                Settings          = from.Settings,
                Success           = from.Success,
                Metrics           = from.Metrics
            };
            var tt = to as IResponseWithRequestInformation;

            if (tt != null)
            {
                tt.RequestInformation = response;
            }
            return(response);
        }
 protected static bool IsValidResponse(ITransportRequestState requestState, IOrientdbResponse streamResponse)
 {
     return(streamResponse.Success ||
            StatusCodeAllowed(requestState.RequestConfiguration, streamResponse.HttpStatusCode));
 }