[mapguide-commits] r4875 - in sandbox/maestro-2.5: Maestro.Base
Maestro.Base/Editor Maestro.Base/Services Maestro.Base/UI
OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/ObjectModels
OSGeo.MapGuide.MaestroAPI/Resource
OSGeo.MapGuide.MaestroAPI/Services OSGeo.MapGuide.MaestroAPI.Http
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri May 14 02:10:32 EDT 2010
Author: jng
Date: 2010-05-14 02:10:27 -0400 (Fri, 14 May 2010)
New Revision: 4875
Added:
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCapabilities.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs
Modified:
sandbox/maestro-2.5/Maestro.Base/Editor/EditorContentBase.cs
sandbox/maestro-2.5/Maestro.Base/Services/OpenResourceManager.cs
sandbox/maestro-2.5/Maestro.Base/TabFactory.cs
sandbox/maestro-2.5/Maestro.Base/UI/RepositoryTreeModel.cs
sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.Designer.cs
sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.cs
sandbox/maestro-2.5/Maestro.Base/ZonedContainer.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/OSGeo.MapGuide.MaestroAPI.Http.csproj
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ResourceItems.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IVersionedEntity.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IResourceService.cs
Log:
We can now open resources with the default XML editor! Save functionality isn't there yet.
Modified: sandbox/maestro-2.5/Maestro.Base/Editor/EditorContentBase.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Editor/EditorContentBase.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/Maestro.Base/Editor/EditorContentBase.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -36,6 +36,7 @@
_resource = value;
this.Title = ResourceIdentifier.GetName(_resource.ResourceID);
this.Description = _resource.ResourceID;
+ this.Connection = _resource.CurrentConnection;
Bind(value);
}
}
Modified: sandbox/maestro-2.5/Maestro.Base/Services/OpenResourceManager.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/Services/OpenResourceManager.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/Maestro.Base/Services/OpenResourceManager.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -22,28 +22,50 @@
using System.Text;
using ICSharpCode.Core;
using Maestro.Base.UI;
+using OSGeo.MapGuide.MaestroAPI;
+using Maestro.Base.Editor;
+using OSGeo.MapGuide.MaestroAPI.Resource;
namespace Maestro.Base.Services
{
public class OpenResourceManager : ServiceBase
{
+ private Dictionary<string, IEditorViewContent> _openItems;
+
public override void Initialize()
{
base.Initialize();
+ _openItems = new Dictionary<string, IEditorViewContent>();
LoggingService.Info(Properties.Resources.Service_Init_Open_Resource_Manager);
}
- public void Open(RepositoryItem item)
+ public void Open(RepositoryItem item, IServerConnection conn)
{
if (item.IsFolder)
return;
- throw new NotImplementedException();
+ if (!_openItems.ContainsKey(item.ResourceId))
+ {
+ var svc = ServiceRegistry.GetService<ViewContentManager>();
+ var ed = svc.OpenContent<XmlEditor>(ViewRegion.Document);
+ IResource res = (IResource)conn.ResourceService.GetResource(item.ResourceId);
+ ed.Resource = res;
+ _openItems[item.ResourceId] = ed;
+ ed.ViewContentClosing += (sender, e) =>
+ {
+ _openItems.Remove(item.ResourceId);
+ };
+ }
+ _openItems[item.ResourceId].Activate();
}
- public void Open(RepositoryItem [] items)
+ public void Open(RepositoryItem[] items, IServerConnection conn)
{
- throw new NotImplementedException();
+ foreach (var item in items)
+ {
+ if (!item.IsFolder)
+ Open(item, conn);
+ }
}
}
}
Modified: sandbox/maestro-2.5/Maestro.Base/TabFactory.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/TabFactory.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/Maestro.Base/TabFactory.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -49,6 +49,30 @@
{
page.ToolTipText = content.Description;
};
+ content.ViewContentActivating += (sender, e) =>
+ {
+ //Find matching hidden tab entry, and restore
+ HiddenTab hiddenTab = null;
+ foreach (var htab in _hiddenTabs)
+ {
+ if (htab.Tab == page)
+ {
+ hiddenTab = htab;
+ }
+ }
+ if (hiddenTab != null)
+ {
+ hiddenTab.Parent.TabPages.Add(page);
+ hiddenTab.Parent.SelectedTab = page;
+ _hiddenTabs.Remove(hiddenTab);
+ }
+ else //Wasn't hidden in the first place
+ {
+ var tabs = page.Parent as TabControl;
+ if (tabs != null)
+ tabs.SelectedTab = page;
+ }
+ };
if (content.AllowUserClose)
{
content.ViewContentClosing += (sender, e) =>
@@ -63,30 +87,6 @@
}
else
{
- content.ViewContentActivating += (sender, e) =>
- {
- //Find matching hidden tab entry, and restore
- HiddenTab hiddenTab = null;
- foreach (var htab in _hiddenTabs)
- {
- if (htab.Tab == page)
- {
- hiddenTab = htab;
- }
- }
- if (hiddenTab != null)
- {
- hiddenTab.Parent.TabPages.Add(page);
- hiddenTab.Parent.SelectedTab = page;
- _hiddenTabs.Remove(hiddenTab);
- }
- else //Wasn't hidden in the first place
- {
- var tabs = page.Parent as TabControl;
- if (tabs != null)
- tabs.SelectedTab = page;
- }
- };
content.ViewContentHiding += (sender, e) =>
{
//Store in hidden tabs collection
Modified: sandbox/maestro-2.5/Maestro.Base/UI/RepositoryTreeModel.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/UI/RepositoryTreeModel.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/Maestro.Base/UI/RepositoryTreeModel.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -49,6 +49,26 @@
get { return _item.Name; }
}
+ public string ResourceType
+ {
+ get { return _item.ResourceType; }
+ }
+
+ public string Owner
+ {
+ get { return _item.Owner; }
+ }
+
+ public DateTime CreatedDate
+ {
+ get { return _item.CreatedDate; }
+ }
+
+ public DateTime ModifiedDate
+ {
+ get { return _item.ModifiedDate; }
+ }
+
public bool IsFolder
{
get { return _item.IsFolder; }
@@ -58,38 +78,47 @@
{
get
{
- if (_item.IsFolder)
+ switch (_item.ResourceType)
{
- return Properties.Resources.folder_horizontal;
+ case "DrawingSource":
+ return Properties.Resources.blueprints;
+ case "FeatureSource":
+ return Properties.Resources.database_share;
+ case "Folder":
+ return Properties.Resources.folder_horizontal;
+ case "LayerDefinition":
+ return Properties.Resources.layer;
+ case "MapDefinition":
+ return Properties.Resources.map;
+ case "WebLayout":
+ return Properties.Resources.application_browser;
+ case "ApplicationDefinition":
+ return Properties.Resources.applications_stack;
+ case "SymbolLibrary":
+ return Properties.Resources.images_stack;
+ case "PrintLayout":
+ return Properties.Resources.printer;
+ default:
+ return Properties.Resources.document;
}
- else
- {
- switch (_item.ResourceType)
- {
- case "DrawingSource":
- return Properties.Resources.blueprints;
- case "FeatureSource":
- return Properties.Resources.database_share;
- case "LayerDefinition":
- return Properties.Resources.layer;
- case "MapDefinition":
- return Properties.Resources.map;
- case "WebLayout":
- return Properties.Resources.application_browser;
- case "ApplicationDefinition":
- return Properties.Resources.applications_stack;
- case "SymbolLibrary":
- return Properties.Resources.images_stack;
- case "PrintLayout":
- return Properties.Resources.printer;
- default:
- return Properties.Resources.document;
- }
- }
}
}
}
+ public class RepositoryItemToolTipProvider : IToolTipProvider
+ {
+ public string GetToolTip(TreeNodeAdv node, Aga.Controls.Tree.NodeControls.NodeControl nodeControl)
+ {
+ RepositoryItem item = node.Tag as RepositoryItem;
+ if (item != null)
+ {
+ return string.Format("Resource Name: {1}{0}Resource Type: {2}{0}Created: {3}{0}Last Modified: {4}{0}Owner: {5}", Environment.NewLine, item.Name, item.ResourceType, item.CreatedDate, item.ModifiedDate, item.Owner);
+ }
+ return string.Empty;
+ }
+ }
+
+
/// <summary>
/// Defines the repository model for the treeview
/// </summary>
Modified: sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.Designer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.Designer.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.Designer.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -58,6 +58,7 @@
this.trvResources.NodeControls.Add(this.ndResource);
this.trvResources.SelectedNode = null;
this.trvResources.SelectionMode = Aga.Controls.Tree.TreeSelectionMode.MultiSameParent;
+ this.trvResources.ShowNodeToolTips = true;
this.trvResources.Size = new System.Drawing.Size(233, 458);
this.trvResources.TabIndex = 2;
this.trvResources.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.trvResources_MouseDoubleClick);
Modified: sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/Maestro.Base/UI/SiteExplorer.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -27,17 +27,21 @@
using ICSharpCode.Core.WinForms;
using Aga.Controls.Tree;
using Maestro.Base.Services;
+using OSGeo.MapGuide.MaestroAPI;
namespace Maestro.Base.UI
{
public partial class SiteExplorer : ViewContentBase, ISiteExplorer
{
+ private IServerConnection _conn;
+
/// <summary>
/// Internal use only. Do not invoke directly. Use <see cref="ViewContentManager"/> for that
/// </summary>
public SiteExplorer()
{
InitializeComponent();
+ ndResource.ToolTipProvider = new RepositoryItemToolTipProvider();
}
public string ConnectionName
@@ -60,9 +64,9 @@
tsSiteExplorer.Items.AddRange(ts);
var mgr = ServiceRegistry.GetService<ServerConnectionManager>();
- var conn = mgr.GetConnection(this.ConnectionName);
+ _conn = mgr.GetConnection(this.ConnectionName);
- var model = new RepositoryTreeModel(conn);
+ var model = new RepositoryTreeModel(_conn);
trvResources.Model = model;
}
@@ -96,7 +100,7 @@
if (item != null && !item.IsFolder)
{
var resMgr = ServiceRegistry.GetService<OpenResourceManager>();
- resMgr.Open(item);
+ resMgr.Open(item, _conn);
}
}
}
Modified: sandbox/maestro-2.5/Maestro.Base/ZonedContainer.cs
===================================================================
--- sandbox/maestro-2.5/Maestro.Base/ZonedContainer.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/Maestro.Base/ZonedContainer.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -154,7 +154,9 @@
TabPage page = (TabPage)tc.TabPages[tc.SelectedIndex];
//The tag specifies whether the user can manually close this tab
if (page.Tag != null && ((IViewContent)page.Tag).AllowUserClose)
- tc.TabPages.Remove(page);
+ {
+ ((IViewContent)page.Tag).Close();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2010-05-14 06:10:27 UTC (rev 4875)
@@ -186,6 +186,7 @@
<Compile Include="Mapping\RuntimeLayerBase.cs" />
<Compile Include="Mapping\RuntimeMapBase.cs" />
<Compile Include="ObjectModels\ApplicationDefinition.cs" />
+ <Compile Include="ObjectModels\DrawingSource.cs" />
<Compile Include="ObjectModels\FeatureSource.cs" />
<Compile Include="ObjectModels\LayerDefinition.cs" />
<Compile Include="ObjectModels\LoadProcedure.cs" />
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.ApplicationDefinition
{
@@ -28,14 +29,16 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
- internal set;
+ set;
}
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/DrawingSource.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -0,0 +1,78 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
+
+namespace OSGeo.MapGuide.ObjectModels.Common
+{
+ partial class DrawingSource : IResource
+ {
+ private static readonly Version RES_VERSION = new Version(1, 0, 0);
+
+ [XmlIgnore]
+ public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
+ {
+ get;
+ set;
+ }
+
+ private string _resId;
+
+ [XmlIgnore]
+ public string ResourceID
+ {
+ get
+ {
+ return _resId;
+ }
+ set
+ {
+ _resId = value;
+ this.OnPropertyChanged("ResourceID");
+ }
+ }
+
+ [XmlIgnore]
+ public string ResourceType
+ {
+ get
+ {
+ return "DrawingSource";
+ }
+ }
+
+ [XmlIgnore]
+ public Version ResourceVersion
+ {
+ get
+ {
+ return RES_VERSION;
+ }
+ }
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
+ }
+}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.FeatureSource
{
@@ -28,14 +29,16 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
- internal set;
+ set;
}
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.LayerDefinition
{
@@ -28,14 +29,16 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
- internal set;
+ set;
}
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.LoadProcedure
{
@@ -28,14 +29,16 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
- internal set;
+ set;
}
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.MapDefinition
{
@@ -28,6 +29,7 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
@@ -36,6 +38,7 @@
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.PrintLayout
{
@@ -28,14 +29,16 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
- internal set;
+ set;
}
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ResourceItems.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ResourceItems.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ResourceItems.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -33,6 +33,12 @@
string ResourceType { get; }
bool IsFolder { get; }
+
+ string Owner { get; }
+
+ DateTime CreatedDate { get; }
+
+ DateTime ModifiedDate { get; }
}
partial class ResourceList
@@ -68,7 +74,7 @@
get { return ResourceIdentifier.GetName(this.ResourceId); }
}
- public string ResourceType { get { return ResourceIdentifier.GetExtension(this.ResourceId); } }
+ public string ResourceType { get { return "Folder"; } }
public bool IsFolder { get { return true; } }
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.SymbolDefinition
{
@@ -28,14 +29,16 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
- internal set;
+ set;
}
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.SymbolLibrary
{
@@ -28,14 +29,16 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
- internal set;
+ set;
}
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.ObjectModels.WebLayout
{
@@ -28,14 +29,16 @@
{
private static readonly Version RES_VERSION = new Version(1, 0, 0);
+ [XmlIgnore]
public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
{
get;
- internal set;
+ set;
}
private string _resId;
+ [XmlIgnore]
public string ResourceID
{
get
@@ -49,6 +52,7 @@
}
}
+ [XmlIgnore]
public string ResourceType
{
get
@@ -57,6 +61,7 @@
}
}
+ [XmlIgnore]
public Version ResourceVersion
{
get
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -20,12 +20,13 @@
using System;
using System.Collections.Generic;
using System.Text;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.MaestroAPI.Resource
{
public interface IResource : IVersionedEntity, ICloneable
{
- IServerConnection CurrentConnection { get; }
+ IServerConnection CurrentConnection { get; set; }
string ResourceID { get; set; }
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IVersionedEntity.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IVersionedEntity.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IVersionedEntity.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -20,6 +20,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using System.Xml.Serialization;
namespace OSGeo.MapGuide.MaestroAPI.Resource
{
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -364,34 +364,22 @@
/// </summary>
/// <param name="resourceID">The full resourceID of the item to retrieve.</param>
/// <returns>A deserialized object.</returns>
- virtual public object GetResource(string resourceID)
+ virtual public IResource GetResource(string resourceID)
{
Type type = GetResourceType(resourceID);
if (type == null)
throw new Exception("Unable to find type for " + resourceID);
- object o = DeserializeObject(type, new System.IO.MemoryStream(GetResourceXmlData(resourceID)));
+ IResource o = (IResource)DeserializeObject(type, new System.IO.MemoryStream(GetResourceXmlData(resourceID)));
+ o.CurrentConnection = GetInterface();
+ o.ResourceID = resourceID;
- System.Reflection.MethodInfo mi = type.GetMethod("SetResourceId");
- if (mi != null)
- mi.Invoke(o, new object[] {resourceID});
-
- mi = type.GetMethod("SetConnection");
- if (mi != null)
- mi.Invoke(o, new object[] {this});
-
- System.Reflection.PropertyInfo pi = type.GetProperty("ResourceId");
- if (pi != null && pi.CanWrite)
- pi.SetValue(o, resourceID, null);
-
- pi = type.GetProperty("CurrentConnection");
- if (pi != null && pi.CanWrite)
- pi.SetValue(o, this, null);
-
return o;
}
+ protected abstract IServerConnection GetInterface();
+
/// <summary>
/// Removes the version numbers from a providername
/// </summary>
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IResourceService.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IResourceService.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IResourceService.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -74,7 +74,7 @@
ObjCommon.ResourceFolderHeaderType GetFolderHeader(string resourceID);
byte[] GetResourceXmlData(string resourceID);
- object GetResource(string resourceID);
+ IResource GetResource(string resourceID);
void SetResourceData(string resourceid, string dataname, ObjCommon.ResourceDataType datatype, System.IO.Stream stream);
void SetResourceData(string resourceid, string dataname, ObjCommon.ResourceDataType datatype, System.IO.Stream stream, Utility.StreamCopyProgressDelegate callback);
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCapabilities.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCapabilities.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCapabilities.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -0,0 +1,102 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI.Services;
+
+namespace OSGeo.MapGuide.MaestroAPI.Http
+{
+ internal class HttpCapabilities : IConnectionCapabilities
+ {
+ private HttpServerConnection _parent;
+
+ internal HttpCapabilities(HttpServerConnection parent)
+ {
+ _parent = parent;
+ }
+
+ public Version GetMaxSupportedResourceVersion(string resourceType)
+ {
+ Version ver = new Version(1, 0, 0);
+ switch (resourceType)
+ {
+ case "LayerDefinition":
+ ver = GetMaxLayerDefinitionVersion();
+ break;
+ case "WebLayout":
+ ver = GetMaxWebLayoutVersion();
+ break;
+ case "SymbolDefinition":
+ ver = GetMaxSymbolDefinitionVersion();
+ break;
+ }
+ return ver;
+ }
+
+ private Version GetMaxSymbolDefinitionVersion()
+ {
+ //TODO: There are more versions. Just gotta work out which ones
+ return new Version(1, 0, 0);
+ }
+
+ private Version GetMaxWebLayoutVersion()
+ {
+ if (_parent.SiteVersion >= new Version(2, 2))
+ return new Version(1, 1, 0);
+ return new Version(1, 0, 0);
+ }
+
+ private Version GetMaxLayerDefinitionVersion()
+ {
+ //TODO: There are more versions. Just gotta work out which ones
+ return new Version(1, 0, 0);
+ }
+
+ public int[] SupportedCommands
+ {
+ get
+ {
+ //TODO: Work out what this can/can't do
+ return new int[0];
+ }
+ }
+
+ public int[] SupportedServices
+ {
+ get
+ {
+ return new int[] {
+ (int)ServiceType.Resource,
+ (int)ServiceType.Feature,
+ (int)ServiceType.Fusion,
+ (int)ServiceType.Mapping,
+ (int)ServiceType.Tile
+ //(int)ServiceType.Drawing
+ };
+ }
+ }
+
+ public bool SupportsResourcePreviews
+ {
+ get { return true; }
+ }
+ }
+}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2010-05-14 06:10:27 UTC (rev 4875)
@@ -33,6 +33,7 @@
using OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
using OSGeo.MapGuide.MaestroAPI.Serialization;
using OSGeo.MapGuide.MaestroAPI.Exceptions;
+using OSGeo.MapGuide.MaestroAPI.Http;
namespace OSGeo.MapGuide.MaestroAPI
{
@@ -1524,7 +1525,7 @@
public IConnectionCapabilities Capabilities
{
- get { throw new NotImplementedException(); }
+ get { return new HttpCapabilities(this); }
}
public IService GetService(int serviceType)
@@ -1583,5 +1584,10 @@
else
throw new CustomPropertyNotFoundException();
}
+
+ protected override IServerConnection GetInterface()
+ {
+ return this;
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/OSGeo.MapGuide.MaestroAPI.Http.csproj
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/OSGeo.MapGuide.MaestroAPI.Http.csproj 2010-05-14 03:58:35 UTC (rev 4874)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/OSGeo.MapGuide.MaestroAPI.Http.csproj 2010-05-14 06:10:27 UTC (rev 4875)
@@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
+ <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6EF1E775-444B-4E5F-87FB-D687C43A68D7}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -38,6 +38,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="HttpCapabilities.cs" />
<Compile Include="HttpCoordinateSystem.cs" />
<Compile Include="HttpCoordinateSystemCatalog.cs" />
<Compile Include="HttpCoordinateSystemCategory.cs" />
More information about the mapguide-commits
mailing list