Author: fmantek
Date: Wed May 16 01:41:09 2007
New Revision: 159

Added:
   trunk/clients/cs/samples/execrequest/
   trunk/clients/cs/samples/execrequest/App.ico   (contents, props changed)
   trunk/clients/cs/samples/execrequest/AssemblyInfo.cs   (contents, props 
changed)
   trunk/clients/cs/samples/execrequest/main.cs   (contents, props changed)
Modified:
   trunk/clients/cs/RELEASE_NOTES.txt
   trunk/clients/cs/src/gacl/aclentry.cs
   trunk/clients/cs/src/gacl/aclnamespace.cs
   trunk/clients/cs/src/gacl/aclrole.cs
   trunk/clients/cs/src/gacl/aclscope.cs

Log:
Added stream based tool. Changed nametable name in ACL dlls. Fixed issue in 
persistence of acl scope

Modified: trunk/clients/cs/RELEASE_NOTES.txt
==============================================================================
--- trunk/clients/cs/RELEASE_NOTES.txt  (original)
+++ trunk/clients/cs/RELEASE_NOTES.txt  Wed May 16 01:41:09 2007
@@ -1,3 +1,4 @@
+
 == 1.0.9.8 ==
 - fixed a parsing bug in SpreadsheetService
 - fixed a bug in GDataRequestException that would prevent AppsException from 
accessing the server's response.
@@ -9,7 +10,7 @@
 - added ACL support. This resulted in changes in the CalendarService.Query 
method - as a CalendarService
   can now return an EventFeed or an AccessControlFeed is returns now an 
AtomFeed that you can cast to what
   you are expecting.
-
+- added a cmd line tool to query/insert/update to a service based on streams
 
 == 1.0.9.7 ==
 - fixed an incorrect trace statement in request.cs that had the result of 
disabling reading the error response.

Added: trunk/clients/cs/samples/execrequest/App.ico
==============================================================================
Binary file. No diff available.

Added: trunk/clients/cs/samples/execrequest/AssemblyInfo.cs
==============================================================================
--- (empty file)
+++ trunk/clients/cs/samples/execrequest/AssemblyInfo.cs        Wed May 16 
01:41:09 2007
@@ -0,0 +1,31 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the 
+// Microsoft .NET Framework documentation for more information on assembly 
signing.
+//
+// Use the attributes below to control which key is used for signing. 
+//
+// Notes: 
+//   (*) If no key is specified, the assembly is not signed.
+//   (*) KeyName refers to a key that has been installed in the Crypto Service
+//       Provider (CSP) on your machine. KeyFile refers to a file which 
contains
+//       a key.
+//   (*) If the KeyFile and the KeyName values are both specified, the 
+//       following processing occurs:
+//       (1) If the KeyName can be found in the CSP, that key is used.
+//       (2) If the KeyName does not exist and the KeyFile does exist, the key 
+//           in the KeyFile is installed into the CSP and used.
+//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) 
utility.
+//       When specifying the KeyFile, the location of the KeyFile should be
+//       relative to the project output directory which is
+//       %Project Directory%\obj\<configuration>. For example, if your KeyFile 
is
+//       located in the project directory, you would specify the 
AssemblyKeyFile 
+//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+//       documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]

Added: trunk/clients/cs/samples/execrequest/main.cs
==============================================================================
--- (empty file)
+++ trunk/clients/cs/samples/execrequest/main.cs        Wed May 16 01:41:09 2007
@@ -0,0 +1,108 @@
+/* Copyright (c) 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+#define USE_TRACING
+#define DEBUG
+
+using System;
+using System.IO;
+using System.Xml; 
+using System.Net; 
+using Google.GData.Client;
+using Google.GData.Extensions;
+using Google.GData.Calendar;
+
+
+namespace Google.GData.Client.Samples
+{
+    /// <summary>
+    /// simple pull app for a calendar
+    /// </summary>
+    class ExecRequest
+    {
+        /// <summary>name of this application</summary>
+        public const string ApplicationName = "ExecRequest/1.0.0";  
+            
+        /// <summary>
+        /// The main entry point for the application.
+        /// </summary>
+        [STAThread]
+        static void Main(string[] args)
+        {
+            if (args.Length < 5)
+            {
+                Console.WriteLine("Not enough parameters. Usage is ExecRequest 
<service> <cmd> <uri> <username> <password>, where cmd is QUERY, UPDATE, 
INSERT, DELETE");
+                return; 
+            }
+
+            string s         = args[0];
+            string cmd       = args[1];
+
+            string targetUri = args[2];
+
+            string userName = args[3];
+            string passWord = args[4];
+            
+
+            Service service = new Service(s, ApplicationName);
+            service.setUserCredentials(userName, passWord);
+
+            try
+            {
+                if (cmd.Equals("QUERY"))
+                {
+                    Stream result = service.Query(new Uri(targetUri));
+                    DumpStream(result);
+                }
+                if (cmd.Equals("DELETE"))
+                {
+                    service.Delete(new Uri(targetUri));
+                    Console.WriteLine("successfully deleted: " + targetUri);
+                }
+                if (cmd.Equals("POST"))
+                {
+                    String input = Console.In.ReadToEnd();
+                    Console.Write(input);
+                    service.StreamSend(new Uri(targetUri), input, 
GDataRequestType.Insert);
+                }
+                if (cmd.Equals("UPDATE"))
+                {
+                    String input = Console.In.ReadToEnd();
+                    Console.Write(input);
+                    service.StreamSend(new Uri(targetUri), input, 
GDataRequestType.Update);
+                }
+            } catch (GDataRequestException e)
+            {
+                HttpWebResponse response = e.Response as HttpWebResponse;
+                Console.WriteLine("Error executing request for Verb: " + cmd + 
", Errorcode: " + response.StatusCode);
+                Console.WriteLine(response.StatusDescription);
+                Console.WriteLine(e.ResponseString);
+            }
+        }
+
+
+       static void DumpStream(Stream s) 
+        {
+            const int size = 4096;
+            byte[] bytes = new byte[4096];
+            int numBytes;
+    
+            while((numBytes = s.Read(bytes, 0, size)) > 0)
+            {
+                String responseData = 
System.Text.Encoding.ASCII.GetString(bytes, 0, numBytes);
+                Console.Write(responseData);
+            }
+        }
+    }
+}

Modified: trunk/clients/cs/src/gacl/aclentry.cs
==============================================================================
--- trunk/clients/cs/src/gacl/aclentry.cs       (original)
+++ trunk/clients/cs/src/gacl/aclentry.cs       Wed May 16 01:41:09 2007
@@ -40,7 +40,7 @@
         /// Category used to label entries that contain AccessControl 
extension data.
         /// </summary>
         public static AtomCategory ACL_CATEGORY =
-        new AtomCategory(AccessControlNameTable.ACL_KIND, new 
AtomUri(BaseNameTable.gKind));
+        new AtomCategory(AclNameTable.ACL_KIND, new 
AtomUri(BaseNameTable.gKind));
 
         /// <summary>
         /// Constructs a new AccessControlEntry instance with the appropriate 
category
@@ -109,16 +109,16 @@
             Tracing.TraceCall("AclEntry:Parse is called:" + e);
             XmlNode node = e.ExtensionElement;
  
-            if (String.Compare(node.NamespaceURI, 
AccessControlNameTable.gAclNamespace, true) == 0)
+            if (String.Compare(node.NamespaceURI, AclNameTable.gAclNamespace, 
true) == 0)
             {
                 // Parse a Role Element
-                if (node.LocalName == AccessControlNameTable.XmlAclRoleElement)
+                if (node.LocalName == AclNameTable.XmlAclRoleElement)
                 {
                     this.Role = AclRole.parse(node);
                     e.DiscardEntry = true;
                 }
                 // Parse a Where Element
-                else if (node.LocalName == 
AccessControlNameTable.XmlAclScopeElement)
+                else if (node.LocalName == AclNameTable.XmlAclScopeElement)
                 {
                     this.Scope = AclScope.parse(node);
                     e.DiscardEntry = true;

Modified: trunk/clients/cs/src/gacl/aclnamespace.cs
==============================================================================
--- trunk/clients/cs/src/gacl/aclnamespace.cs   (original)
+++ trunk/clients/cs/src/gacl/aclnamespace.cs   Wed May 16 01:41:09 2007
@@ -23,7 +23,7 @@
     ///////////////////////////////////////////////////////////////////////
     /// <summary>Google Access Control List namespace</summary>
     ///////////////////////////////////////////////////////////////////////
-    public class AccessControlNameTable : BaseNameTable
+    public class AclNameTable : BaseNameTable
     {
         /// <summary>default access control namespace</summary> 
         public const string gAclNamespace = 
"http://schemas.google.com/acl/2007";;

Modified: trunk/clients/cs/src/gacl/aclrole.cs
==============================================================================
--- trunk/clients/cs/src/gacl/aclrole.cs        (original)
+++ trunk/clients/cs/src/gacl/aclrole.cs        Wed May 16 01:41:09 2007
@@ -32,15 +32,15 @@
         /// <summary>string constant for the none role</summary>
         public const string ROLE_NONE =  "none";
         /// <summary>string constant for the read only role</summary>
-        public const string CALENDAR_ROLE_READ = 
AccessControlNameTable.gAclCalPrefix+ "read";
+        public const string CALENDAR_ROLE_READ = AclNameTable.gAclCalPrefix+ 
"read";
         /// <summary>string constant for the free/busy role</summary>
-        public const string CALENDAR_ROLE_FREEBUSY = 
AccessControlNameTable.gAclCalPrefix+ "freebusy";
+        public const string CALENDAR_ROLE_FREEBUSY = 
AclNameTable.gAclCalPrefix+ "freebusy";
         /// <summary>string constant for the editor role</summary>
-        public const string CALENDAR_ROLE_EDITOR = 
AccessControlNameTable.gAclCalPrefix+ "editor";
+        public const string CALENDAR_ROLE_EDITOR = AclNameTable.gAclCalPrefix+ 
"editor";
         /// <summary>string constant for the owner role</summary>
-        public const string CALENDAR_ROLE_OWNER = 
AccessControlNameTable.gAclCalPrefix+ "owner";
+        public const string CALENDAR_ROLE_OWNER = AclNameTable.gAclCalPrefix+ 
"owner";
         /// <summary>string constant for the root role</summary>
-        public const string CALENDAR_ROLE_ROOT = 
AccessControlNameTable.gAclCalPrefix+ "root";
+        public const string CALENDAR_ROLE_ROOT = AclNameTable.gAclCalPrefix+ 
"root";
 
         /// <summary>object constant for the none role</summary>
         public static AclRole ACL_NONE = new AclRole(ROLE_NONE);
@@ -59,7 +59,7 @@
         ///  default constructor
         /// </summary>
         public AclRole()
-        : base(AccessControlNameTable.XmlAclRoleElement)
+        : base(AclNameTable.XmlAclRoleElement)
         {
         }
 
@@ -68,7 +68,7 @@
         /// </summary>
         /// <param name="value">transparency value</param>
         public AclRole(string value)
-        : base(AccessControlNameTable.XmlAclRoleElement, value)
+        : base(AclNameTable.XmlAclRoleElement, value)
         {
         }
 
@@ -77,14 +77,14 @@
         //////////////////////////////////////////////////////////////////////
         public override string XmlNamespace
         {
-            get { return AccessControlNameTable.gAclNamespace; }
+            get { return AclNameTable.gAclNamespace; }
         }
         //////////////////////////////////////////////////////////////////////
         /// <summary>Returns the constant representing this XML 
element.</summary> 
         //////////////////////////////////////////////////////////////////////
         public override string XmlNamespacePrefix
         {
-            get { return AccessControlNameTable.gAclAlias; }
+            get { return AclNameTable.gAclAlias; }
         }
 
         /// <summary>
@@ -96,8 +96,8 @@
         {
             AclRole role = null;
             Tracing.TraceMsg("Parsing a gAcl:AclRole");
-            if (String.Compare(node.NamespaceURI, 
AccessControlNameTable.gAclNamespace, true) == 0
-                && String.Compare(node.LocalName, 
AccessControlNameTable.XmlAclRoleElement) == 0)
+            if (String.Compare(node.NamespaceURI, AclNameTable.gAclNamespace, 
true) == 0
+                && String.Compare(node.LocalName, 
AclNameTable.XmlAclRoleElement) == 0)
             {
                 role = new AclRole();
                 if (node.Attributes != null)

Modified: trunk/clients/cs/src/gacl/aclscope.cs
==============================================================================
--- trunk/clients/cs/src/gacl/aclscope.cs       (original)
+++ trunk/clients/cs/src/gacl/aclscope.cs       Wed May 16 01:41:09 2007
@@ -45,7 +45,7 @@
         //////////////////////////////////////////////////////////////////////
         public string XmlName
         {
-            get { return AccessControlNameTable.XmlAclScopeElement; }
+            get { return AclNameTable.XmlAclScopeElement; }
         }
 
 
@@ -97,19 +97,19 @@
         {
             AclScope scope = null;
             Tracing.TraceMsg("Parsing a gAcl:AclScope" + node);
-            if (String.Compare(node.NamespaceURI, 
AccessControlNameTable.gAclNamespace, true) == 0
-                && String.Compare(node.LocalName, 
AccessControlNameTable.XmlAclScopeElement) == 0)
+            if (String.Compare(node.NamespaceURI, AclNameTable.gAclNamespace, 
true) == 0
+                && String.Compare(node.LocalName, 
AclNameTable.XmlAclScopeElement) == 0)
             {
                 scope = new AclScope();
                 if (node.Attributes != null)
                 {
-                    if 
(node.Attributes[AccessControlNameTable.XmlAttributeValue] != null)
+                    if (node.Attributes[AclNameTable.XmlAttributeValue] != 
null)
                     {
-                        scope.Value = 
node.Attributes[AccessControlNameTable.XmlAttributeValue].Value;
+                        scope.Value = 
node.Attributes[AclNameTable.XmlAttributeValue].Value;
                     }
-                    if 
(node.Attributes[AccessControlNameTable.XmlAttributeType] != null)
+                    if (node.Attributes[AclNameTable.XmlAttributeType] != null)
                     {
-                        scope.Type = 
node.Attributes[AccessControlNameTable.XmlAttributeType].Value;
+                        scope.Type = 
node.Attributes[AclNameTable.XmlAttributeType].Value;
                     }
                     Tracing.TraceMsg("AclScope parsed, value = " + scope.Value 
+ ", type= " + scope.Type);
                 }
@@ -127,14 +127,14 @@
             if (Utilities.IsPersistable(this.type) ||
                 Utilities.IsPersistable(this.value))
             {
-                writer.WriteStartElement(AccessControlNameTable.gAclAlias, 
XmlName, AccessControlNameTable.gAclNamespace);
+                writer.WriteStartElement(AclNameTable.gAclAlias, XmlName, 
AclNameTable.gAclNamespace);
                 if (Utilities.IsPersistable(this.type))
                 {
-                    
writer.WriteAttributeString(AccessControlNameTable.XmlAttributeType, this.type);
+                    writer.WriteAttributeString(AclNameTable.XmlAttributeType, 
this.type);
                 }
                 if (Utilities.IsPersistable(this.value))
                 {
-                    
writer.WriteAttributeString(AccessControlNameTable.XmlAttributeValue, 
this.type);
+                    
writer.WriteAttributeString(AclNameTable.XmlAttributeValue, this.value);
                 }
                 writer.WriteEndElement();
             }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to