Changeset 4699

Show
Ignore:
Timestamp:
06/12/08 11:26:46 (6 months ago)
Author:
xmlhacker
Message:

added a bit more info to the output

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/nuxleus/Source/CodeSamples/AwsSdbSOAP_Test/Program.cs

    r4697 r4699  
    1212using System.Xml.Linq; 
    1313using VVMF.SOA.Common; 
     14using System.Collections; 
    1415 
    1516namespace AwsSdbSOAP_Test { 
     
    3132            scope += exShield.Scope; 
    3233 
    33             logger.Message = "DoSomething()"; 
     34            logger.Message = "Processing SOAP requests"; 
    3435 
    3536            // Inject code to scope 
    3637            scope.Begin = () => { 
    37                 PutAttributes().ExecuteAndWait(); 
     38                PutAttributes(scope).ExecuteAndWait(); 
    3839            }; 
    3940 
     
    5859        } 
    5960 
    60         static IEnumerable<IAsync> PutAttributes() { 
     61        static IEnumerable<IAsync> PutAttributes(Scope scope) { 
    6162 
    62             List<XElement> responseList = new List<XElement>(); 
     63            Dictionary<XElement, XElement> responseList = new Dictionary<XElement, XElement>(); 
    6364 
    6465            SimpleDBService service = new SimpleDBService(); 
     
    8485 
    8586            Console.WriteLine("Completed all in:\t {0}ms", stopwatch.ElapsedMilliseconds); 
    86             Console.WriteLine("There are a total of {0} XElement objects in the result list", responseList.Count); 
     87            Console.WriteLine("There are a total of {0} result objects in the result dictionary", responseList.Count); 
     88 
     89            int c = 1; 
     90            IEnumerator responseEnumerator = responseList.GetEnumerator(); 
     91 
     92            while (responseEnumerator.MoveNext()){ 
     93                KeyValuePair<XElement,XElement> responseItem = (KeyValuePair<XElement,XElement>)responseEnumerator.Current; 
     94                Console.WriteLine(".......................... Begin Message {0} ............................", c); 
     95                Console.WriteLine("\n"); 
     96                Console.WriteLine("[Message {0} Sent]", c); 
     97                responseItem.Key.Save(Console.Out); 
     98                Console.WriteLine("\n"); 
     99                Console.WriteLine("[Message {0} Received]", c); 
     100                responseItem.Value.Save(Console.Out); 
     101                Console.WriteLine("\n"); 
     102                Console.WriteLine(".......................... End Message {0} ............................", c); 
     103                c++; 
     104            } 
    87105        } 
    88106    } 
  • trunk/nuxleus/Source/Dependencies/Scope/Scope/Scope.cs

    r4696 r4699  
    44using System.Text; 
    55 
    6 namespace VVMF.SOA.Common 
    7 
    8     public struct Scope 
    9     { 
     6namespace VVMF.SOA.Common { 
     7    public struct Scope { 
    108        public delegate Chain Chain(Chain code); 
    119 
    1210        public delegate void Block(); 
    1311 
    14         public Scope(params Chain[] codes) 
    15         { 
     12        public Scope(params Chain[] codes) { 
    1613            this.code = null; 
    17             if (codes != null) 
    18             { 
    19                 foreach (Chain code in codes) 
    20                 { 
     14            if (codes != null) { 
     15                foreach (Chain code in codes) { 
    2116                    AddCode(code); 
    2217                } 
     
    2419        } 
    2520 
    26         public Scope(params Scope[] others) 
    27         { 
     21        public Scope(params Scope[] others) { 
    2822            this.code = null; 
    29             if (others != null) 
    30             { 
    31                 foreach (Scope other in others) 
    32                 { 
     23            if (others != null) { 
     24                foreach (Scope other in others) { 
    3325                    AddCode(other.code); 
    3426                } 
     
    3830        Chain code; 
    3931 
    40         private static Chain BlockToChain(Block code) 
    41         { 
    42             return c => 
    43             { 
     32        private static Chain BlockToChain(Block code) { 
     33            return c => { 
    4434                code(); 
    4535                return null; 
     
    4737        } 
    4838 
    49         private void AddCode(Chain otherCode) 
    50         { 
    51             if (otherCode != null) 
    52             { 
     39        private void AddCode(Chain otherCode) { 
     40            if (otherCode != null) { 
    5341                Chain thisCode = this.code; 
    54                 if (thisCode == null) 
    55                 { 
     42                if (thisCode == null) { 
    5643                    this.code = otherCode; 
    57                 } 
    58                 else 
    59                 { 
     44                } else { 
    6045                    this.code = (c) => otherCode(thisCode(c)); 
    6146                } 
     
    6348        } 
    6449 
    65         public Block Begin 
    66         { 
    67             set 
    68             { 
    69                 if (value == null) throw new ArgumentNullException("value"); 
    70                 if (code != null) 
    71                 { 
     50        public Block Begin { 
     51            set { 
     52                if (value == null) 
     53                    throw new ArgumentNullException("value"); 
     54                if (code != null) { 
    7255                    code(BlockToChain(value))(null); 
    7356                } 
     
    7558        } 
    7659 
    77         public static Scope operator +(Scope scope1, Scope scope2) 
    78         { 
     60        public static Scope operator +(Scope scope1, Scope scope2) { 
    7961            Scope result = new Scope(scope1); 
    8062            result.AddCode(scope2.code); 
     
    8264        } 
    8365 
    84         public static Scope operator +(Scope scope, Chain code) 
    85         { 
     66        public static Scope operator +(Scope scope, Chain code) { 
    8667            Scope result = new Scope(scope); 
    8768            result.AddCode(code); 
     
    8970        } 
    9071 
    91         public static implicit operator Scope(Chain code) 
    92         { 
     72        public static implicit operator Scope(Chain code) { 
    9373            return new Scope(code); 
    9474        } 
    9575 
    96         public static implicit operator Chain(Scope scope) 
    97         { 
     76        public static implicit operator Chain(Scope scope) { 
    9877            return scope.code; 
    9978        } 
  • trunk/nuxleus/Source/Nuxleus.Extension.Aws/SimpleDB/SimpleDBService.cs

    r4698 r4699  
    2121    public struct SimpleDBService { 
    2222 
    23         public XContainer GetMessage(RequestType requestType, params string[] paramArray) { 
     23        public XElement GetMessage(RequestType requestType, params string[] paramArray) { 
    2424 
    2525            XNamespace s = "http://schemas.xmlsoap.org/soap/envelope/"; 
    2626 
    27             XContainer awsSOAPMessage = 
     27            XElement awsSOAPMessage = 
    2828                new XElement(s + "Envelope", 
    2929                    new XElement(s + "Body", 
     
    8686        } 
    8787 
    88         public StreamReader MakeRequest(RequestType requestType, XContainer message) { 
     88        public StreamReader MakeRequest(RequestType requestType, XElement message) { 
    8989 
    9090            string rType = LabelAttribute.FromMember(requestType); 
     
    128128        } 
    129129 
    130         public static IEnumerable<IAsync> MakeSoapRequestAsync<T>(RequestType requestType, XContainer message, List<T> responseList) { 
     130        public static IEnumerable<IAsync> MakeSoapRequestAsync<T>(RequestType requestType, XElement message, Dictionary<XElement,T> responseList) { 
    131131 
    132132            string rType = LabelAttribute.FromMember(requestType); 
     
    148148                if (xreader.IsStartElement()) { 
    149149                    output.Append(xreader.ReadOuterXml()); 
    150                     Console.WriteLine("Output: {0} :/Output", output.ToString()); 
    151150                    buffer = encoding.GetBytes(output.ToString()); 
    152151                } 
     
    166165 
    167166            using (Stream newStream = request.GetRequestStream()) { 
    168                 try { 
     167 
    169168                    newStream.Write(buffer, 0, contentLength); 
    170169                    Async<WebResponse> response = request.GetResponseAsync(); 
     
    174173                    Async<T> responseObject = stream.ReadToEndAsync<T>().ExecuteAsync<T>(); 
    175174                    yield return responseObject; 
    176                     responseList.Add(responseObject.Result); 
    177                     //} finally (System.Net.WebException e) { 
    178                     //    Console.WriteLine("Failed! Reason: {0}, Message: {1}", e.Response, e.Message); 
    179                     //    return new StreamReader(e.Response.GetResponseStream()); 
    180                     //} 
    181                 } finally { 
    182                      
    183                 } 
     175                    responseList.Add(message, responseObject.Result); 
    184176            } 
    185177