Author: fmantek
Date: Tue May 22 03:14:18 2007
New Revision: 161
Modified:
trunk/clients/cs/RELEASE_NOTES.txt
trunk/clients/cs/src/gacl/aclfeed.cs
trunk/clients/cs/src/gcalendar/calendarservice.cs
trunk/clients/cs/src/gspreadsheet/gdataspreadsheetsnametable.cs
trunk/clients/cs/src/gspreadsheet/spreadsheetservice.cs
Log:
several more changes to the spreadsheet dlls. Added AclQuery class
Modified: trunk/clients/cs/RELEASE_NOTES.txt
==============================================================================
--- trunk/clients/cs/RELEASE_NOTES.txt (original)
+++ trunk/clients/cs/RELEASE_NOTES.txt Tue May 22 03:14:18 2007
@@ -9,8 +9,11 @@
and added correctly to the ExtensionElements
- 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.
+ you are expecting. Added Query overloads to accept EventQuery or AclQuery
and return the appropriate
+ Feeds
- added a cmd line tool to query/insert/update to a service based on streams
+- modified the Spreadsheet service to use the new scheme of service
subclassing. This should fix a bundle of issues
+ with regard to entry castings.
== 1.0.9.7 ==
- fixed an incorrect trace statement in request.cs that had the result of
disabling reading the error response.
Modified: trunk/clients/cs/src/gacl/aclfeed.cs
==============================================================================
--- trunk/clients/cs/src/gacl/aclfeed.cs (original)
+++ trunk/clients/cs/src/gacl/aclfeed.cs Tue May 22 03:14:18 2007
@@ -22,6 +22,18 @@
namespace Google.GData.AccessControl
{
+
+ //////////////////////////////////////////////////////////////////////
+ /// <summary>
+ /// A subclass of FeedQuery, to create an ACL query URI.
+ /// currently only exists to allow a Service.Query overload that
+ /// creates an ACL feed
+ /// </summary>
+ //////////////////////////////////////////////////////////////////////
+ public class AclQuery : FeedQuery
+ {
+ }
+
//////////////////////////////////////////////////////////////////////
/// <summary>
/// AccessControlFeed customization class
Modified: trunk/clients/cs/src/gcalendar/calendarservice.cs
==============================================================================
--- trunk/clients/cs/src/gcalendar/calendarservice.cs (original)
+++ trunk/clients/cs/src/gcalendar/calendarservice.cs Tue May 22 03:14:18 2007
@@ -47,7 +47,25 @@
this.NewFeed += new ServiceEventHandler(this.OnNewFeed);
}
-
+ /// <summary>
+ /// overloaded to create typed version of Query
+ /// </summary>
+ /// <param name="feedQuery"></param>
+ /// <returns>EventFeed</returns>
+ public EventFeed Query(EventQuery feedQuery)
+ {
+ return base.Query(feedQuery) as EventFeed;
+ }
+
+ /// <summary>
+ /// overloaded to create typed version of Query
+ /// </summary>
+ /// <param name="feedQuery"></param>
+ /// <returns>EventFeed</returns>
+ public AclFeed Query(AclQuery feedQuery)
+ {
+ return base.Query(feedQuery) as AclFeed;
+ }
//////////////////////////////////////////////////////////////////////
/// <summary>eventchaining. We catch this by from the base service,
which
/// would not by default create an atomFeed</summary>
Modified: trunk/clients/cs/src/gspreadsheet/gdataspreadsheetsnametable.cs
==============================================================================
--- trunk/clients/cs/src/gspreadsheet/gdataspreadsheetsnametable.cs
(original)
+++ trunk/clients/cs/src/gspreadsheet/gdataspreadsheetsnametable.cs Tue May
22 03:14:18 2007
@@ -28,6 +28,15 @@
/// </summary>
public class GDataSpreadsheetsNameTable : GDataParserNameTable
{
+ /// <summary>indicates a spreadsheet feed in the URI</summary>
+ public const string FeedSpreadsheet = "spreadsheets";
+ /// <summary>indicates a worksheet feed in the URI</summary>
+ public const string FeedWorksheet = "worksheets";
+ /// <summary>indicates a list feed in the URI</summary>
+ public const string FeedList = "list";
+ /// <summary>indicates a cell feed in the URI</summary>
+ public const string FeedCell = "cells";
+
/// <summary>Spreadsheets namespace</summary>
public const string NSGSpreadsheets =
"http://schemas.google.com/spreadsheets/2006";
@@ -53,17 +62,15 @@
public const string WorksheetRel = NSGSpreadsheetsPrefix +
"worksheetsfeed";
/// <summary>The spreadsheet prefix </summary>
- public const string Spreadsheet = NSGSpreadsheetsPrefix +
"spreadsheet";
+ public const string Spreadsheet = NSGSpreadsheetsPrefix +
FeedSpreadsheet;
/// <summary>The cell prefix </summary>
- public const string Cell = NSGSpreadsheetsPrefix + "cell";
-
+ public const string Cell = NSGSpreadsheetsPrefix + FeedCell;
/// <summary>The list prefix </summary>
- public const string List = NSGSpreadsheetsPrefix + "list";
+ public const string List = NSGSpreadsheetsPrefix + FeedList;
/// <summary>The worksheet prefix </summary>
- public const string Worksheet = NSGSpreadsheetsPrefix + "worksheet";
-
+ public const string Worksheet = NSGSpreadsheetsPrefix + FeedWorksheet;
/// <summary>The sources prefix </summary>
public const string Source = NSGSpreadsheetsPrefix + "source";
Modified: trunk/clients/cs/src/gspreadsheet/spreadsheetservice.cs
==============================================================================
--- trunk/clients/cs/src/gspreadsheet/spreadsheetservice.cs (original)
+++ trunk/clients/cs/src/gspreadsheet/spreadsheetservice.cs Tue May 22
03:14:18 2007
@@ -37,6 +37,8 @@
/// <summary>The Spreadsheets service's name</summary>
public const string GSpreadsheetsService = "wise";
+
+
/// <summary>
/// Constructor
/// </summary>
@@ -45,12 +47,8 @@
public SpreadsheetsService(string applicationName)
: base(GSpreadsheetsService, applicationName, GSpreadsheetsAgent)
{
- this.NewAtomEntry += new
FeedParserEventHandler(this.OnParsedNewCellEntry);
- this.NewExtensionElement += new
ExtensionElementEventHandler(this.OnNewCellExtensionElement);
-
- this.NewAtomEntry += new
FeedParserEventHandler(this.OnParsedNewListEntry);
- this.NewExtensionElement += new
ExtensionElementEventHandler(this.OnNewListExtensionElement);
- }
+ this.NewFeed += new ServiceEventHandler(this.OnNewFeed);
+ }
/// <summary>
/// overwritten Query method
@@ -59,11 +57,7 @@
/// <returns>the retrieved CellFeed</returns>
public CellFeed Query(CellQuery feedQuery)
{
- Stream feedStream = Query(feedQuery.Uri);
- CellFeed feed = new CellFeed(feedQuery.Uri, this);
- feed.Parse(feedStream, AlternativeFormat.Atom);
- feedStream.Close();
- return feed;
+ return base.Query(feedQuery) as CellFeed;
}
/// <summary>
@@ -73,11 +67,7 @@
/// <returns>the retrieved ListFeed</returns>
public ListFeed Query(ListQuery feedQuery)
{
- Stream feedStream = Query(feedQuery.Uri);
- ListFeed feed = new ListFeed(feedQuery.Uri, this);
- feed.Parse(feedStream, AlternativeFormat.Atom);
- feedStream.Close();
- return feed;
+ return base.Query(feedQuery) as ListFeed;
}
/// <summary>
@@ -87,11 +77,7 @@
/// <returns>the retrieved SpreadsheetFeed</returns>
public SpreadsheetFeed Query(SpreadsheetQuery feedQuery)
{
- Stream feedStream = Query(feedQuery.Uri);
- SpreadsheetFeed feed = new SpreadsheetFeed(feedQuery.Uri, this);
- feed.Parse(feedStream, AlternativeFormat.Atom);
- feedStream.Close();
- return feed;
+ return base.Query(feedQuery) as SpreadsheetFeed;
}
/// <summary>
@@ -101,108 +87,44 @@
/// <returns>the retrieved WorksheetFeed</returns>
public WorksheetFeed Query(WorksheetQuery feedQuery)
{
- Stream feedStream = Query(feedQuery.Uri);
- WorksheetFeed feed = new WorksheetFeed(feedQuery.Uri, this);
- feed.Parse(feedStream, AlternativeFormat.Atom);
- feedStream.Close();
- return feed;
+ return base.Query(feedQuery) as WorksheetFeed;
}
- /// <summary>
- /// Event handler. Called when a new cell entry is parsed.
- /// </summary>
- /// <param name="sender">the object that's sending the evet</param>
- /// <param name="e">FeedParserEventArguments, holds the
feedentry</param>
- protected void OnParsedNewCellEntry(object sender, FeedParserEventArgs
e)
+ //////////////////////////////////////////////////////////////////////
+ /// <summary>eventchaining. We catch this by from the base service,
which
+ /// would not by default create an atomFeed</summary>
+ /// <param name="sender"> the object which send the event</param>
+ /// <param name="e">FeedParserEventArguments, holds the
feedentry</param>
+ /// <returns> </returns>
+ //////////////////////////////////////////////////////////////////////
+ protected void OnNewFeed(object sender, ServiceEventArgs e)
{
+ Tracing.TraceMsg("Created new Spreadsheet Feed");
if (e == null)
{
- throw new ArgumentNullException("e");
+ throw new ArgumentNullException("e");
}
- if (e.CreatingEntry == true)
+ if (e.Uri.AbsoluteUri.IndexOf("/" +
+ GDataSpreadsheetsNameTable.FeedCell + "/") != -1)
{
- e.Entry = new CellEntry();
- }
- }
-
- /// <summary>
- /// Event handler. Called for a cell extension element.
- /// </summary>
- /// <param name="sender">the object that's sending the event</param>
- /// <param name="e">FeedParserEventArguments, holds the
feedentry</param>
- protected void OnNewCellExtensionElement(object sender,
ExtensionElementEventArgs e)
- {
- AtomFeedParser parser = sender as AtomFeedParser;
-
- if (e == null)
- {
- throw new ArgumentNullException("e");
- }
- if (String.Compare(e.ExtensionElement.NamespaceURI,
BaseNameTable.gNamespace, true) == 0)
+ e.Feed = new CellFeed(e.Uri, e.Service);
+ }
+ else if (e.Uri.AbsoluteUri.IndexOf("/" +
+ GDataSpreadsheetsNameTable.FeedList + "/") != -1)
{
- // found G namespace
- e.DiscardEntry = true;
-
- if (e.Base.XmlName == AtomParserNameTable.XmlFeedElement)
- {
- }
- else if (e.Base.XmlName ==
AtomParserNameTable.XmlAtomEntryElement)
- {
- CellEntry cellEntry = e.Base as CellEntry;
- if (cellEntry != null)
- {
- cellEntry.Parse(e, parser);
- }
- }
+ e.Feed = new ListFeed(e.Uri, e.Service);
}
- }
-
- /// <summary>
- /// Event handler. Called when a new list entry is parsed.
- /// </summary>
- /// <param name="sender">the object that's sending the evet</param>
- /// <param name="e">FeedParserEventArguments, holds the
feedentry</param>
- protected void OnParsedNewListEntry(object sender, FeedParserEventArgs
e)
- {
- if (e == null)
- {
- throw new ArgumentNullException("e");
- }
- if (e.CreatingEntry == true)
- {
- e.Entry = new ListEntry();
- }
- }
-
- /// <summary>
- /// Event handler. Called for a list extension element.
- /// </summary>
- /// <param name="sender">the object that's sending the event</param>
- /// <param name="e">FeedParserEventArguments, holds the
feedentry</param>
- protected void OnNewListExtensionElement(object sender,
ExtensionElementEventArgs e)
- {
- if (e == null)
+ else if(e.Uri.AbsoluteUri.IndexOf("/" +
+ GDataSpreadsheetsNameTable.FeedSpreadsheet + "/") != -1)
{
- throw new ArgumentNullException("e");
+ e.Feed = new SpreadsheetFeed(e.Uri, e.Service);
}
- if (String.Compare(e.ExtensionElement.NamespaceURI,
GDataSpreadsheetsNameTable.NSGSpreadsheetsExtended, true) == 0)
+ else if(e.Uri.AbsoluteUri.IndexOf("/" +
+ GDataSpreadsheetsNameTable.FeedWorksheet + "/") != -1)
{
- // found G namespace
- e.DiscardEntry = true;
- AtomFeedParser parser = sender as AtomFeedParser;
-
- if (e.Base.XmlName == AtomParserNameTable.XmlFeedElement)
- {
- }
- else if (e.Base.XmlName ==
AtomParserNameTable.XmlAtomEntryElement)
- {
- ListEntry ListEntry = e.Base as ListEntry;
- if (ListEntry != null)
- {
- ListEntry.Parse(e, parser);
- }
- }
+ e.Feed = new WorksheetFeed(e.Uri, e.Service);
}
}
+
/////////////////////////////////////////////////////////////////////////////
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---