[mapguide-commits] r8452 - in trunk/Tools/Maestro: . Generated Maestro Maestro/packages Maestro.Base/Editor Maestro.Editors Maestro.Editors/Common Maestro.Editors/Common/Expression Maestro.Editors/FeatureSource/Preview Maestro.Login MaestroAPITests OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/CoordinateSystem OSGeo.MapGuide.MaestroAPI/Mapping OSGeo.MapGuide.MaestroAPI/ObjectModels OSGeo.MapGuide.MaestroAPI/Resource/Conversion OSGeo.MapGuide.MaestroAPI/Services OSGeo.MapGuide.MaestroAPI.Http OSGeo.MapGuide.MaestroAPI.Http/Commands OSGeo.MapGuide.MaestroAPI.Local OSGeo.MapGuide.MaestroAPI.Native OSGeo.MapGuide.MaestroAPI.Rest OSGeo.MapGuide.MaestroAPI.Rest/Properties
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Nov 20 08:51:51 PST 2014
Author: jng
Date: 2014-11-20 08:51:51 -0800 (Thu, 20 Nov 2014)
New Revision: 8452
Added:
trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.Designer.cs
trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.cs
trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.resx
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/OSGeo.MapGuide.MaestroAPI.Rest.csproj
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Properties/
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Properties/AssemblyInfo.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCapabilities.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemCatalog.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemCategory.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemDefinition.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestException.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Strings.Designer.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Strings.resx
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/packages.config
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/FdoCapabilities.cs
Modified:
trunk/Tools/Maestro/Generated/FdoProviderCapabilities-1.1.0.designer.cs
trunk/Tools/Maestro/Maestro.Base/Editor/FsEditorOptionPanel.cs
trunk/Tools/Maestro/Maestro.Editors/Common/Expression/FdoExpressionCompletionDataProvider.cs
trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/PreviewPane.cs
trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Strings.resx
trunk/Tools/Maestro/Maestro.Login/LoginDialog.cs
trunk/Tools/Maestro/Maestro.Login/LoginDialog.designer.cs
trunk/Tools/Maestro/Maestro.Login/LoginDialog.resx
trunk/Tools/Maestro/Maestro.Login/Maestro.Login.csproj
trunk/Tools/Maestro/Maestro/Maestro.csproj
trunk/Tools/Maestro/Maestro/Maestro_All.sln
trunk/Tools/Maestro/Maestro/packages/
trunk/Tools/Maestro/Maestro/packages/repositories.config
trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/Commands/HttpCreateRuntimeMap.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/Commands/HttpDescribeRuntimeMap.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Check.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ConnectionProviders.xml
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemBase.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CredentialWriter.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/ResourceList.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ImageSymbolConverter.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
Log:
This submission includes the following changes:
- #2506: Add first cut of mapguide-rest connection provider
- #2506: Add login dialog support for creating a mapguide-rest connection
- #2504: Modify the IFeatureService.GetProviderCapabilities method to return an IFdoProviderCapabilities interface. This allows us to support both v1.0.0 and v1.1.0 versions of the schema.
- Enhance the Expression Editor to:
- Show all signatures of a function in the functions menu
- Show all signatures of a function in auto-complete window
- Show more detailed auto-complete tooltips, including argument descriptions.
Modified: trunk/Tools/Maestro/Generated/FdoProviderCapabilities-1.1.0.designer.cs
===================================================================
--- trunk/Tools/Maestro/Generated/FdoProviderCapabilities-1.1.0.designer.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Generated/FdoProviderCapabilities-1.1.0.designer.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -4,7 +4,7 @@
// <NameSpace>OSGeo.MapGuide.ObjectModels.Capabilities</NameSpace><Collection>BindingList</Collection><codeType>CSharp</codeType><EnableDataBinding>True</EnableDataBinding><EnableLasyLoading>False</EnableLasyLoading><HidePrivateFieldInIDE>True</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net20</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><AutomaticProperties>False</AutomaticProperties><DisableDebug>False</DisableDebug><CustomUsings></CustomUsings><ExcludeIncludedTypes>False</ExcludeIncludedTypes><EnableInitial
izeFields>True</EnableInitializeFields>
// </auto-generated>
// ------------------------------------------------------------------------------
-namespace OSGeo.MapGuide.ObjectModels.Capabilities {
+namespace OSGeo.MapGuide.ObjectModels.Capabilities_1_1_0 {
using System;
using System.Diagnostics;
using System.Xml.Serialization;
Modified: trunk/Tools/Maestro/Maestro/Maestro.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro/Maestro.csproj 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro/Maestro.csproj 2014-11-20 16:51:51 UTC (rev 8452)
@@ -472,6 +472,10 @@
<Project>{F4420153-9DF3-4407-AD65-E8ABED2B6E25}</Project>
<Name>OSGeo.MapGuide.MaestroAPI.Native32-2.2.0</Name>
</ProjectReference>
+ <ProjectReference Include="..\OSGeo.MapGuide.MaestroAPI.Rest\OSGeo.MapGuide.MaestroAPI.Rest.csproj">
+ <Project>{f112d03d-797b-4e31-ace5-ebb412eb08bd}</Project>
+ <Name>OSGeo.MapGuide.MaestroAPI.Rest</Name>
+ </ProjectReference>
<ProjectReference Include="..\Thirdparty\SharpDevelop\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name>
Modified: trunk/Tools/Maestro/Maestro/Maestro_All.sln
===================================================================
--- trunk/Tools/Maestro/Maestro/Maestro_All.sln 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro/Maestro_All.sln 2014-11-20 16:51:51 UTC (rev 8452)
@@ -1,6 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Express 2012 for Windows Desktop
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
+MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\Thirdparty\SharpDevelop\ICSharpCode.Core\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.WinForms", "..\Thirdparty\SharpDevelop\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj", "{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}"
@@ -160,6 +162,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MpuCalc", "..\MpuCalc\MpuCalc.csproj", "{43B01C27-E0D2-439B-83ED-8C814ED1526A}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.MaestroAPI.Rest", "..\OSGeo.MapGuide.MaestroAPI.Rest\OSGeo.MapGuide.MaestroAPI.Rest.csproj", "{F112D03D-797B-4E31-ACE5-EBB412EB08BD}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -358,6 +362,10 @@
{43B01C27-E0D2-439B-83ED-8C814ED1526A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43B01C27-E0D2-439B-83ED-8C814ED1526A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43B01C27-E0D2-439B-83ED-8C814ED1526A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F112D03D-797B-4E31-ACE5-EBB412EB08BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F112D03D-797B-4E31-ACE5-EBB412EB08BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F112D03D-797B-4E31-ACE5-EBB412EB08BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F112D03D-797B-4E31-ACE5-EBB412EB08BD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Property changes on: trunk/Tools/Maestro/Maestro/packages
___________________________________________________________________
Modified: svn:ignore
- DockPanelSuite.2.9.0.0
fleesharp.0.9.27-pre
IronPython.2.7.4
IronPython.StdLib.2.7.4
NUnit.2.6.3
SharpZipLib.0.86.0
TreeViewAdv.1.7.0.0
mapguide-api-base-x86.2.5.2.7949
mg-desktop-net40-x86.2.5.2.7949
mg-desktop-viewer-net40-x86.2.5.2.7949
+ DockPanelSuite.2.9.0.0
fleesharp.0.9.27-pre
IronPython.2.7.4
IronPython.StdLib.2.7.4
NUnit.2.6.3
SharpZipLib.0.86.0
TreeViewAdv.1.7.0.0
mapguide-api-base-x86.2.5.2.7949
mg-desktop-net40-x86.2.5.2.7949
mg-desktop-viewer-net40-x86.2.5.2.7949
RestSharp.105.0.1
Modified: trunk/Tools/Maestro/Maestro/packages/repositories.config
===================================================================
--- trunk/Tools/Maestro/Maestro/packages/repositories.config 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro/packages/repositories.config 2014-11-20 16:51:51 UTC (rev 8452)
@@ -11,6 +11,7 @@
<repository path="..\..\MaestroAPITests\packages.config" />
<repository path="..\..\MpuCalc\packages.config" />
<repository path="..\..\OSGeo.MapGuide.MaestroAPI.Local\packages.config" />
+ <repository path="..\..\OSGeo.MapGuide.MaestroAPI.Rest\packages.config" />
<repository path="..\..\OSGeo.MapGuide.MaestroAPI\packages.config" />
<repository path="..\packages.config" />
</repositories>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/FsEditorOptionPanel.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/FsEditorOptionPanel.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/FsEditorOptionPanel.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -48,7 +48,7 @@
}
private IFeatureSource _fs;
- private FdoProviderCapabilities _caps;
+ private IFdoProviderCapabilities _caps;
private IFeatureService _fsvc;
private IResourceService _rsvc;
private IEditorService _edsvc;
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/Expression/FdoExpressionCompletionDataProvider.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/Expression/FdoExpressionCompletionDataProvider.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/Expression/FdoExpressionCompletionDataProvider.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -43,9 +43,9 @@
internal class FdoExpressionCompletionDataProvider : ICompletionDataProvider
{
private ClassDefinition _klass;
- private FdoProviderCapabilities _caps;
+ private IFdoProviderCapabilities _caps;
- public FdoExpressionCompletionDataProvider(ClassDefinition cls, FdoProviderCapabilities caps)
+ public FdoExpressionCompletionDataProvider(ClassDefinition cls, IFdoProviderCapabilities caps)
{
_klass = cls;
_caps = caps;
@@ -182,13 +182,17 @@
{
foreach (var func in GetMatchingFdoFunctions(name))
{
- var member = CreateFdoFunctionDescriptor(func);
- int highlightLength = 0;
- if (func.ArgumentDefinitionList.Count > 0)
+ foreach (var sign in func.Signatures)
{
- highlightLength = func.ArgumentDefinitionList[0].Name.Length + 2; // [ and ]
+ var member = CreateFdoFunctionSignatureDescriptor(func, sign);
+ int highlightLength = 0;
+ var args = sign.Arguments;
+ if (args.Length > 0)
+ {
+ highlightLength = args[0].Name.Length + 2; // [ and ]
+ }
+ items.Add(new FdoCompletionData(name, member.Name, member.Description, member.AppendText, highlightLength, 0));
}
- items.Add(new FdoCompletionData(name, member.Name, member.Description, member.AppendText, highlightLength, 0));
}
foreach (var member in GetMatchingClassProperties(name))
{
@@ -225,9 +229,9 @@
public string AppendText;
}
- private IEnumerable<FdoProviderCapabilitiesExpressionFunctionDefinition> GetMatchingFdoFunctions(string name)
+ private IEnumerable<IFdoFunctionDefintion> GetMatchingFdoFunctions(string name)
{
- foreach (var func in _caps.Expression.FunctionDefinitionList.Concat(Utility.GetStylizationFunctions()))
+ foreach (var func in _caps.Expression.SupportedFunctions.Concat(Utility.GetStylizationFunctions()))
{
if (func.Name.StartsWith(name))
yield return func;
@@ -236,7 +240,7 @@
private IEnumerable<Descriptor> GetMatchingFdoConditions(string name)
{
- foreach (var cond in _caps.Filter.Condition)
+ foreach (var cond in _caps.Filter.ConditionTypes)
{
if (cond.ToString().ToUpper().StartsWith(name))
{
@@ -247,9 +251,9 @@
}
}
- private Descriptor CreateFdoConditionDescriptor(FdoProviderCapabilitiesFilterType cond)
+ private Descriptor CreateFdoConditionDescriptor(string cond)
{
- if (cond == FdoProviderCapabilitiesFilterType.Null)
+ if (cond == "Null") //NOXLATE
{
return new Descriptor()
{
@@ -257,7 +261,7 @@
Description = "[property] NULL" //NOXLATE
};
}
- else if (cond == FdoProviderCapabilitiesFilterType.In)
+ else if (cond == "In") //NOXLATE
{
return new Descriptor()
{
@@ -266,7 +270,7 @@
AppendText = " ([value1], [value2])" //NOXLATE
};
}
- else if (cond == FdoProviderCapabilitiesFilterType.Like)
+ else if (cond == "Like") //NOXLATE
{
return new Descriptor()
{
@@ -300,15 +304,15 @@
private IEnumerable<Descriptor> GetMatchingFdoOperators(string name)
{
- foreach (var op in _caps.Filter.Distance)
+ foreach (var op in _caps.Filter.DistanceOperations)
{
- var opName = op.ToString().ToUpper();
+ var opName = op.ToUpper();
if (opName.StartsWith(name))
yield return CreateBinaryDistanceOperator(opName);
}
- foreach (var op in _caps.Filter.Spatial)
+ foreach (var op in _caps.Filter.SpatialOperations)
{
- var opName = op.ToString().ToUpper();
+ var opName = op.ToUpper();
if (opName.StartsWith(name))
yield return CreateBinarySpatialOperator(opName);
}
@@ -323,23 +327,41 @@
}
}
- private Descriptor CreateFdoFunctionDescriptor(FdoProviderCapabilitiesExpressionFunctionDefinition func)
+ private Descriptor CreateFdoFunctionSignatureDescriptor(IFdoFunctionDefintion func, IFdoFunctionDefintionSignature sig)
{
var desc = new Descriptor();
- desc.Name = func.Name;
string fmt = "{0}({1})"; //NOXLATE
List<string> args = new List<string>();
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
+ foreach (var argDef in sig.Arguments)
{
args.Add(argDef.Name.Trim());
}
string argsStr = StringifyFunctionArgs(args);
+ string argDesc = DescribeSignature(sig);
string expr = string.Format(fmt, func.Name, argsStr); //NOXLATE
- desc.Description = string.Format(Strings.ExprEditorFunctionDesc, expr, func.Description, func.ReturnType, Environment.NewLine);
- desc.AppendText = "(" + argsStr + ")";
+ desc.Name = expr;
+ desc.Description = string.Format(Strings.ExprEditorFunctionDesc, expr, func.Description, argDesc, sig.ReturnType, Environment.NewLine);
+ desc.AppendText = "";
return desc;
}
+ internal static string DescribeSignature(IFdoFunctionDefintionSignature sig)
+ {
+ string argDesc = Strings.None;
+ var args = sig.Arguments;
+ if (args.Length > 0)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append(Environment.NewLine);
+ foreach (var argDef in sig.Arguments)
+ {
+ sb.AppendFormat(" [{0}] - {1}{2}", argDef.Name, argDef.Description, Environment.NewLine);
+ }
+ argDesc = sb.ToString();
+ }
+ return argDesc;
+ }
+
internal static string StringifyFunctionArgs(List<string> args)
{
string argsStr = args.Count > 0 ? "[" + string.Join("], [", args.ToArray()) + "]" : string.Empty; //NOXLATE
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -22,6 +22,7 @@
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.Linq;
using System.Text;
using System.Windows.Forms;
using OSGeo.MapGuide.MaestroAPI;
@@ -44,7 +45,7 @@
private ClassDefinition _cls;
private IEditorService _edSvc;
private string m_featureSource = null;
- private FdoProviderCapabilities _caps;
+ private IFdoProviderCapabilities _caps;
private ITextEditor _editor;
/// <summary>
@@ -88,7 +89,7 @@
/// <param name="cls">The class definition.</param>
/// <param name="featuresSourceId">The FeatureSource id.</param>
/// <param name="attachStylizationFunctions">if set to <c>true</c> stylization functions are also attached</param>
- public void Initialize(IEditorService edSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
+ public void Initialize(IEditorService edSvc, IFdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
{
try
{
@@ -126,85 +127,126 @@
if (ColumnName.Items.Count > 0)
ColumnName.SelectedIndex = 0;
- //Functions
- SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition> sortedFuncs = new SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition>();
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in caps.Expression.FunctionDefinitionList)
+ LoadFunctions(caps, attachStylizationFunctions);
+ }
+ catch
+ {
+ }
+ }
+
+ internal static IFdoFunctionDefintionSignature[] MakeUniqueSignatures(IFdoFunctionDefintion func)
+ {
+ var dict = new Dictionary<string, IFdoFunctionDefintionSignature>();
+ foreach (var sig in func.Signatures)
+ {
+ string fmt = "{0}({1})"; //NOXLATE
+ List<string> args = new List<string>();
+ foreach (var argDef in sig.Arguments)
{
+ args.Add(argDef.Name.Trim());
+ }
+ string expr = string.Format(fmt, func.Name, FdoExpressionCompletionDataProvider.StringifyFunctionArgs(args));
+ if (!dict.ContainsKey(expr))
+ dict[expr] = sig;
+ }
+ return dict.Values.ToArray();
+ }
+
+ private void LoadFunctions(IFdoProviderCapabilities caps, bool attachStylizationFunctions)
+ {
+ //Functions
+ var sortedFuncs = new SortedList<string, IFdoFunctionDefintion>();
+ foreach (var func in caps.Expression.SupportedFunctions)
+ {
+ sortedFuncs.Add(func.Name, func);
+ }
+
+ if (attachStylizationFunctions)
+ {
+ foreach (var func in Utility.GetStylizationFunctions())
+ {
sortedFuncs.Add(func.Name, func);
}
+ }
- if (attachStylizationFunctions)
+ foreach (var func in sortedFuncs.Values)
+ {
+ string name = func.Name;
+ string desc = func.Description;
+
+ ToolStripItemCollection parent = btnFunctions.DropDown.Items;
+ var sigs = MakeUniqueSignatures(func);
+ if (sigs.Length > 1)
{
- foreach (var func in Utility.GetStylizationFunctions())
- {
- sortedFuncs.Add(func.Name, func);
- }
+ ToolStripMenuItem btn = new ToolStripMenuItem();
+ btn.Name = string.Format(Strings.MultiSigFunction, name, sigs.Length);
+ btn.Text = string.Format(Strings.MultiSigFunction, name, sigs.Length);
+ btn.ToolTipText = desc;
+
+ btnFunctions.DropDown.Items.Add(btn);
+ parent = btn.DropDown.Items;
}
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in sortedFuncs.Values)
+ foreach (var sig in sigs)
{
- string name = func.Name;
- ToolStripButton btn = new ToolStripButton();
+ ToolStripMenuItem btn = new ToolStripMenuItem();
btn.Name = name;
- btn.Text = name;
- btn.ToolTipText = func.Description;
+ btn.ToolTipText = desc;
string fmt = "{0}({1})"; //NOXLATE
List<string> args = new List<string>();
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
+ foreach (var argDef in sig.Arguments)
{
args.Add(argDef.Name.Trim());
}
string expr = string.Format(fmt, name, FdoExpressionCompletionDataProvider.StringifyFunctionArgs(args));
- btn.Click += delegate
+ btn.Text = expr;
+ btn.Click += (s, e) =>
{
InsertText(expr);
};
- btnFunctions.DropDown.Items.Add(btn);
+ parent.Add(btn);
}
+ }
- //Spatial Operators
- foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Spatial)
+ //Spatial Operators
+ foreach (var op in caps.Filter.SpatialOperations)
+ {
+ string name = op.ToUpper();
+ ToolStripButton btn = new ToolStripButton();
+ btn.Name = btn.Text = btn.ToolTipText = op;
+ btn.Click += (s, e) =>
{
- string name = op.ToString().ToUpper();
- ToolStripButton btn = new ToolStripButton();
- btn.Name = btn.Text = btn.ToolTipText = op.ToString();
- btn.Click += delegate
- {
- InsertSpatialFilter(name);
- };
- btnSpatial.DropDown.Items.Add(btn);
- }
+ InsertSpatialFilter(name);
+ };
+ btnSpatial.DropDown.Items.Add(btn);
+ }
- //Distance Operators
- foreach (FdoProviderCapabilitiesFilterOperation1 op in caps.Filter.Distance)
+ //Distance Operators
+ foreach (var op in caps.Filter.DistanceOperations)
+ {
+ string name = op.ToUpper();
+ ToolStripButton btn = new ToolStripButton();
+ btn.Name = btn.Text = btn.ToolTipText = op;
+ btn.Click += (s, e) =>
{
- string name = op.ToString().ToUpper();
- ToolStripButton btn = new ToolStripButton();
- btn.Name = btn.Text = btn.ToolTipText = op.ToString();
- btn.Click += delegate
- {
- InsertSpatialFilter(name);
- };
- btnDistance.DropDown.Items.Add(btn);
- }
+ InsertSpatialFilter(name);
+ };
+ btnDistance.DropDown.Items.Add(btn);
+ }
- //Conditional Operators
- foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Condition)
+ //Conditional Operators
+ foreach (var op in caps.Filter.ConditionTypes)
+ {
+ string name = op.ToUpper();
+ ToolStripButton btn = new ToolStripButton();
+ btn.Name = btn.Text = btn.ToolTipText = op;
+ btn.Click += (s, e) =>
{
- string name = op.ToString().ToUpper();
- ToolStripButton btn = new ToolStripButton();
- btn.Name = btn.Text = btn.ToolTipText = op.ToString();
- btn.Click += delegate
- {
- InsertSpatialFilter(name);
- };
- btnCondition.DropDown.Items.Add(btn);
- }
+ InsertSpatialFilter(name);
+ };
+ btnCondition.DropDown.Items.Add(btn);
}
- catch
- {
- }
}
private void OKBtn_Click(object sender, EventArgs e)
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -41,7 +41,7 @@
/// <param name="cls"></param>
/// <param name="featuresSourceId"></param>
/// <param name="attachStylizationFunctions"></param>
- void Initialize(IEditorService edSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions);
+ void Initialize(IEditorService edSvc, IFdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions);
/// <summary>
/// Gets or sets the FDO expression
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -110,7 +110,7 @@
/// <param name="cls">The class definition.</param>
/// <param name="featuresSourceId">The features source id.</param>
/// <param name="attachStylizationFunctions">If true, Stylization FDO functions will be included</param>
- public void Initialize(IEditorService edSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
+ public void Initialize(IEditorService edSvc, IFdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
{
try
{
@@ -153,8 +153,8 @@
//TODO: Figure out how to translate the enums into something usefull
//Functions
- SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition> sortedFuncs = new SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition>();
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in caps.Expression.FunctionDefinitionList)
+ var sortedFuncs = new SortedList<string, IFdoFunctionDefintion>();
+ foreach (var func in caps.Expression.SupportedFunctions)
{
sortedFuncs.Add(func.Name, func);
}
@@ -167,36 +167,55 @@
}
}
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in sortedFuncs.Values)
+ foreach (var func in sortedFuncs.Values)
{
string name = func.Name;
- ToolStripButton btn = new ToolStripButton();
- btn.Name = name;
- btn.Text = name;
- btn.ToolTipText = func.Description;
- string fmt = "{0}({1})";
- List<string> args = new List<string>();
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
+ string desc = func.Description;
+
+ ToolStripItemCollection parent = btnFunctions.DropDown.Items;
+ var sigs = ExpressionEditor.MakeUniqueSignatures(func);
+ if (sigs.Length > 1)
{
- args.Add(argDef.Name.Trim());
+ ToolStripMenuItem btn = new ToolStripMenuItem();
+ btn.Name = string.Format(Strings.MultiSigFunction, name, sigs.Length);
+ btn.Text = string.Format(Strings.MultiSigFunction, name, sigs.Length);
+ btn.ToolTipText = desc;
+
+ btnFunctions.DropDown.Items.Add(btn);
+ parent = btn.DropDown.Items;
}
- string expr = string.Format(fmt, name, string.Join(", ", args.ToArray()));
- btn.Click += delegate
+
+ foreach (var sig in sigs)
{
- InsertText(expr);
- };
- btnFunctions.DropDown.Items.Add(btn);
+ ToolStripMenuItem btn = new ToolStripMenuItem();
+ btn.Name = name;
+ btn.ToolTipText = desc;
+
+ string fmt = "{0}({1})"; //NOXLATE
+ List<string> args = new List<string>();
+ foreach (var argDef in sig.Arguments)
+ {
+ args.Add(argDef.Name.Trim());
+ }
+ string expr = string.Format(fmt, name, FdoExpressionCompletionDataProvider.StringifyFunctionArgs(args));
+ btn.Text = expr + " : " + sig.ReturnType;
+ btn.Click += (s, e) =>
+ {
+ InsertText(expr);
+ };
+ parent.Add(btn);
+ }
}
- LoadCompletableFunctions(caps.Expression.FunctionDefinitionList);
+ LoadCompletableFunctions(caps.Expression.SupportedFunctions);
if (attachStylizationFunctions)
LoadCompletableFunctions(GetStylizationFunctions());
//Spatial Operators
- foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Spatial)
+ foreach (var op in caps.Filter.SpatialOperations)
{
- string name = op.ToString().ToUpper();
+ string name = op.ToUpper();
ToolStripButton btn = new ToolStripButton();
- btn.Name = btn.Text = btn.ToolTipText = op.ToString();
+ btn.Name = btn.Text = btn.ToolTipText = op;
btn.Click += delegate
{
InsertFilter(name);
@@ -205,11 +224,11 @@
}
//Distance Operators
- foreach (FdoProviderCapabilitiesFilterOperation1 op in caps.Filter.Distance)
+ foreach (var op in caps.Filter.DistanceOperations)
{
- string name = op.ToString().ToUpper();
+ string name = op.ToUpper();
ToolStripButton btn = new ToolStripButton();
- btn.Name = btn.Text = btn.ToolTipText = op.ToString();
+ btn.Name = btn.Text = btn.ToolTipText = op;
btn.Click += delegate
{
InsertFilter(name);
@@ -218,11 +237,11 @@
}
//Conditional Operators
- foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Condition)
+ foreach (var op in caps.Filter.ConditionTypes)
{
- string name = op.ToString().ToUpper();
+ string name = op.ToUpper();
ToolStripButton btn = new ToolStripButton();
- btn.Name = btn.Text = btn.ToolTipText = op.ToString();
+ btn.Name = btn.Text = btn.ToolTipText = op;
btn.Click += delegate
{
InsertFilter(name);
@@ -500,7 +519,7 @@
this.Close();
}
- private SortedList<string, AutoCompleteItem> _autoCompleteItems = new SortedList<string, AutoCompleteItem>();
+ private SortedList<string, List<AutoCompleteItem>> _autoCompleteItems = new SortedList<string, List<AutoCompleteItem>>();
private ImageListBox _autoBox;
enum AutoCompleteItemType : int
@@ -570,13 +589,23 @@
/// </summary>
class FunctionItem : AutoCompleteItem
{
- private FdoProviderCapabilitiesExpressionFunctionDefinition _func;
+ private IFdoFunctionDefintion _func;
+ private IFdoFunctionDefintionSignature _sig;
- public FunctionItem(FdoProviderCapabilitiesExpressionFunctionDefinition fd)
+ private string _insertExpr;
+
+ private FunctionItem(IFdoFunctionDefintion fd, IFdoFunctionDefintionSignature sig)
{
_func = fd;
+ _sig = sig;
}
+ public FunctionItem(IFdoFunctionDefintion fd, IFdoFunctionDefintionSignature sig, string insertExpr)
+ : this(fd, sig)
+ {
+ _insertExpr = insertExpr;
+ }
+
public override AutoCompleteItemType Type
{
get { return AutoCompleteItemType.Function; }
@@ -584,7 +613,7 @@
public override string Name
{
- get { return _func.Name; }
+ get { return _insertExpr; } // _func.Name; }
}
private string _ttText;
@@ -594,7 +623,11 @@
get
{
if (string.IsNullOrEmpty(_ttText))
- _ttText = string.Format(Strings.FunctionTooltip, GetReturnTypeString(), _func.Name, GetArgumentString(), _func.Description);
+ {
+ string argDesc = FdoExpressionCompletionDataProvider.DescribeSignature(_sig);
+ _ttText = string.Format(Strings.ExprEditorFunctionDesc, _insertExpr, _func.Description, argDesc, _sig.ReturnType, Environment.NewLine);
+ }
+ //_ttText = string.Format(Strings.FunctionTooltip, GetReturnTypeString(), _func.Name, GetArgumentString(), _func.Description);
return _ttText;
}
@@ -607,7 +640,7 @@
if (string.IsNullOrEmpty(_argStr))
{
List<string> tokens = new List<string>();
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in _func.ArgumentDefinitionList)
+ foreach (var argDef in _sig.Arguments)
{
tokens.Add("[" + argDef.Name.Trim() + "]");
}
@@ -618,14 +651,14 @@
private string GetReturnTypeString()
{
- return _func.ReturnType;
+ return _sig.ReturnType;
}
public override string AutoCompleteText
{
get
{
- return this.Name + "(" + GetArgumentString() + ")";
+ return _insertExpr; //return this.Name + "(" + GetArgumentString() + ")";
}
}
}
@@ -718,15 +751,30 @@
{
foreach (var col in cols)
{
- _autoCompleteItems[col.Name] = new PropertyItem(col);
+ if (!_autoCompleteItems.ContainsKey(col.Name))
+ _autoCompleteItems[col.Name] = new List<AutoCompleteItem>();
+ _autoCompleteItems[col.Name].Add(new PropertyItem(col));
}
}
- private void LoadCompletableFunctions(IEnumerable<FdoProviderCapabilitiesExpressionFunctionDefinition> funcs)
+ private void LoadCompletableFunctions(IEnumerable<IFdoFunctionDefintion> funcs)
{
- foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in funcs)
+ foreach (var func in funcs)
{
- _autoCompleteItems[func.Name] = new FunctionItem(func);
+ var sigs = ExpressionEditor.MakeUniqueSignatures(func);
+ foreach (var sig in sigs)
+ {
+ string fmt = "{0}({1})"; //NOXLATE
+ List<string> args = new List<string>();
+ foreach (var argDef in sig.Arguments)
+ {
+ args.Add(argDef.Name.Trim());
+ }
+ string expr = string.Format(fmt, func.Name, FdoExpressionCompletionDataProvider.StringifyFunctionArgs(args));
+ if (!_autoCompleteItems.ContainsKey(func.Name))
+ _autoCompleteItems[func.Name] = new List<AutoCompleteItem>();
+ _autoCompleteItems[func.Name].Add(new FunctionItem(func, sig, expr));
+ }
}
}
@@ -822,6 +870,13 @@
_autoCompleteTooltip.Hide(this);
}
}
+ else if (code == Keys.Up || code == Keys.Down)
+ {
+ if (_autoBox.Visible)
+ {
+ e.SuppressKeyPress = true;
+ }
+ }
else if (code == Keys.Enter || code == Keys.Return)
{
if (_autoBox.Visible && _autoBox.SelectedItems.Count == 1)
@@ -896,7 +951,7 @@
{
bool alpha = (code >= Keys.A && code <= Keys.Z);
bool numeric = (code >= Keys.D0 && code <= Keys.D9) || (code >= Keys.NumPad0 && code <= Keys.NumPad9);
- if (alpha || numeric)
+ if (alpha || numeric || e.KeyData == Keys.ShiftKey)
{
string context;
char? c = GetContextBuffer(out context);
@@ -913,7 +968,7 @@
{
if (key.ToLower().StartsWith(text.Trim().ToLower()))
{
- ati.Add(_autoCompleteItems[key]);
+ ati.AddRange(_autoCompleteItems[key]);
}
}
return ati;
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/LocalFeatureSourcePreviewCtrl.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -76,7 +76,7 @@
set;
}
- private FdoProviderCapabilities _caps;
+ private IFdoProviderCapabilities _caps;
class SchemaNodeTag
{
@@ -116,7 +116,7 @@
/// </summary>
/// <param name="fsId">The fs id.</param>
/// <param name="caps">The caps.</param>
- public void ReloadTree(string fsId, FdoProviderCapabilities caps)
+ public void ReloadTree(string fsId, IFdoProviderCapabilities caps)
{
currentFsId = fsId;
_caps = caps;
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/PreviewPane.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/PreviewPane.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/PreviewPane.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -47,7 +47,7 @@
private IFeatureService _featSvc;
private string _fsId;
- public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IEditorService edSvc, FdoProviderCapabilities caps)
+ public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IEditorService edSvc, IFdoProviderCapabilities caps)
: this()
{
_fsId = fsId;
Modified: trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/FeatureSource/Preview/StandardQueryCtrl.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -45,7 +45,7 @@
private IEditorService _edSvc;
private string _fsId;
private ClassDefinition _cls;
- private FdoProviderCapabilities _caps;
+ private IFdoProviderCapabilities _caps;
/// <summary>
/// Initializes a new instance of the <see cref="StandardQueryCtrl"/> class.
@@ -54,7 +54,7 @@
/// <param name="edSvc">The editor service.</param>
/// <param name="cls">The CLS.</param>
/// <param name="caps">The caps.</param>
- public StandardQueryCtrl(string fsId, IEditorService edSvc, ClassDefinition cls, FdoProviderCapabilities caps)
+ public StandardQueryCtrl(string fsId, IEditorService edSvc, ClassDefinition cls, IFdoProviderCapabilities caps)
: this()
{
_fsId = fsId;
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -646,7 +646,7 @@
}
/// <summary>
- /// Looks up a localized string similar to {0}{3}{1}{3}Returns: {2}.
+ /// Looks up a localized string similar to {0}{4}Description:{1}{4}Arguments:{2}{4}Returns: {3}.
/// </summary>
internal static string ExprEditorFunctionDesc {
get {
@@ -1724,6 +1724,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to {0} ({1} signatures).
+ /// </summary>
+ internal static string MultiSigFunction {
+ get {
+ return ResourceManager.GetString("MultiSigFunction", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to New Flyout.
/// </summary>
internal static string NewFlyout {
@@ -1796,6 +1805,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to None.
+ /// </summary>
+ internal static string None {
+ get {
+ return ResourceManager.GetString("None", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Non-supported WKT.
/// </summary>
internal static string NonMapGuideSupportedCsWkt {
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2014-11-20 16:51:51 UTC (rev 8452)
@@ -1380,7 +1380,7 @@
<value>Property: {0}{2}Type: {1}</value>
</data>
<data name="ExprEditorFunctionDesc" xml:space="preserve">
- <value>{0}{3}{1}{3}Returns: {2}</value>
+ <value>{0}{4}Description:{1}{4}Arguments:{2}{4}Returns: {3}</value>
</data>
<data name="Func_ARGB_AValueDescription" xml:space="preserve">
<value>Alpha value</value>
@@ -1631,4 +1631,10 @@
<data name="OptionsSyncedToDocument" xml:space="preserve">
<value>Options synced back to document</value>
</data>
+ <data name="MultiSigFunction" xml:space="preserve">
+ <value>{0} ({1} signatures)</value>
+ </data>
+ <data name="None" xml:space="preserve">
+ <value>None</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Login/LoginDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Login/LoginDialog.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Login/LoginDialog.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -47,6 +47,7 @@
private LocalLoginCtrl _local;
private LocalNativeStubCtrl _localNativeStub;
private LocalStubCtrl _localStub;
+ private RestLoginCtrl _rest;
/// <summary>
/// Initializes a new instance of the <see cref="LoginDialog"/> class.
@@ -59,29 +60,34 @@
_local = new LocalLoginCtrl() { Dock = DockStyle.Fill };
_localNativeStub = new LocalNativeStubCtrl() { Dock = DockStyle.Fill };
_localStub = new LocalStubCtrl() { Dock = DockStyle.Fill };
+ _rest = new RestLoginCtrl() { Dock = DockStyle.Fill };
_controls = new ILoginCtrl[]
{
_http,
_localNative,
_local,
_localNativeStub,
- _localStub
+ _localStub,
+ _rest
};
_controls[0].EnableOk += OnEnableOk;
_controls[1].EnableOk += OnEnableOk;
_controls[2].EnableOk += OnEnableOk;
_controls[3].EnableOk += OnEnableOk;
_controls[4].EnableOk += OnEnableOk;
+ _controls[5].EnableOk += OnEnableOk;
_controls[0].CheckSavedPassword += (sender, e) => { chkSavePassword.Checked = true; };
_controls[1].CheckSavedPassword += (sender, e) => { chkSavePassword.Checked = true; };
_controls[2].CheckSavedPassword += (sender, e) => { chkSavePassword.Checked = true; };
_controls[3].CheckSavedPassword += (sender, e) => { chkSavePassword.Checked = true; };
_controls[4].CheckSavedPassword += (sender, e) => { chkSavePassword.Checked = true; };
+ _controls[5].CheckSavedPassword += (sender, e) => { chkSavePassword.Checked = true; };
_controls[0].DisabledOk += OnDisableOk;
_controls[1].DisabledOk += OnDisableOk;
_controls[2].DisabledOk += OnDisableOk;
_controls[3].DisabledOk += OnDisableOk;
_controls[4].DisabledOk += OnDisableOk;
+ _controls[5].DisabledOk += OnDisableOk;
}
/// <summary>
@@ -205,6 +211,11 @@
UpdateLoginControl();
}
+ private void rdRest_CheckedChanged(object sender, EventArgs e)
+ {
+ UpdateLoginControl();
+ }
+
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
@@ -295,6 +306,15 @@
builder["Locale"] = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName; //NOXLATE
_conn = ConnectionProviderRegistry.CreateConnection("Maestro.LocalNative", builder.ToString()); //NOXLATE
}
+ else if (_selectedIndex == 5) //REST
+ {
+ System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
+ builder["Url"] = _rest.Endpoint;
+ builder["Username"] = _rest.Username; //NOXLATE
+ builder["Password"] = _rest.Password; //NOXLATE
+ builder["Locale"] = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName; //NOXLATE
+ _conn = ConnectionProviderRegistry.CreateConnection("Maestro.Rest", builder.ToString()); //NOXLATE
+ }
else //Local
{
NameValueCollection param = new NameValueCollection();
@@ -332,6 +352,12 @@
SetLoginControl((Control)_controls[_selectedIndex]);
_controls[_selectedIndex].UpdateLoginStatus();
}
+ else if (rdRest.Checked)
+ {
+ _selectedIndex = 5;
+ SetLoginControl((Control)_controls[_selectedIndex]);
+ _controls[_selectedIndex].UpdateLoginStatus();
+ }
else if (rdTcpIp.Checked)
{
if (ConnectionProviderRegistry.GetInvocationCount("Maestro.LocalNative") == 0)
Modified: trunk/Tools/Maestro/Maestro.Login/LoginDialog.designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Login/LoginDialog.designer.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Login/LoginDialog.designer.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -36,6 +36,7 @@
this.rdTcpIp = new System.Windows.Forms.RadioButton();
this.loginPanel = new System.Windows.Forms.Panel();
this.rdLocal = new System.Windows.Forms.RadioButton();
+ this.rdRest = new System.Windows.Forms.RadioButton();
this.SuspendLayout();
//
// chkSavePassword
@@ -85,10 +86,19 @@
this.rdLocal.UseVisualStyleBackColor = true;
this.rdLocal.CheckedChanged += new System.EventHandler(this.rdLocal_CheckedChanged);
//
+ // rdRest
+ //
+ resources.ApplyResources(this.rdRest, "rdRest");
+ this.rdRest.Name = "rdRest";
+ this.rdRest.TabStop = true;
+ this.rdRest.UseVisualStyleBackColor = true;
+ this.rdRest.CheckedChanged += new System.EventHandler(this.rdRest_CheckedChanged);
+ //
// LoginDialog
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
resources.ApplyResources(this, "$this");
+ this.Controls.Add(this.rdRest);
this.Controls.Add(this.rdLocal);
this.Controls.Add(this.loginPanel);
this.Controls.Add(this.rdTcpIp);
@@ -114,5 +124,6 @@
private System.Windows.Forms.RadioButton rdTcpIp;
private System.Windows.Forms.Panel loginPanel;
private System.Windows.Forms.RadioButton rdLocal;
+ private System.Windows.Forms.RadioButton rdRest;
}
}
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Login/LoginDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Login/LoginDialog.resx 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Login/LoginDialog.resx 2014-11-20 16:51:51 UTC (rev 8452)
@@ -148,7 +148,7 @@
<value>$this</value>
</data>
<data name=">>chkSavePassword.ZOrder" xml:space="preserve">
- <value>4</value>
+ <value>5</value>
</data>
<data name="btnCancel.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
<value>System</value>
@@ -178,7 +178,7 @@
<value>$this</value>
</data>
<data name=">>btnCancel.ZOrder" xml:space="preserve">
- <value>5</value>
+ <value>6</value>
</data>
<data name="btnOK.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
@@ -211,7 +211,7 @@
<value>$this</value>
</data>
<data name=">>btnOK.ZOrder" xml:space="preserve">
- <value>6</value>
+ <value>7</value>
</data>
<data name="rdHttp.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -238,13 +238,13 @@
<value>$this</value>
</data>
<data name=">>rdHttp.ZOrder" xml:space="preserve">
- <value>3</value>
+ <value>4</value>
</data>
<data name="rdTcpIp.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="rdTcpIp.Location" type="System.Drawing.Point, System.Drawing">
- <value>61, 202</value>
+ <value>158, 202</value>
</data>
<data name="rdTcpIp.Size" type="System.Drawing.Size, System.Drawing">
<value>121, 17</value>
@@ -265,7 +265,7 @@
<value>$this</value>
</data>
<data name=">>rdTcpIp.ZOrder" xml:space="preserve">
- <value>2</value>
+ <value>3</value>
</data>
<data name="loginPanel.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value>
@@ -286,13 +286,13 @@
<value>$this</value>
</data>
<data name=">>loginPanel.ZOrder" xml:space="preserve">
- <value>1</value>
+ <value>2</value>
</data>
<data name="rdLocal.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="rdLocal.Location" type="System.Drawing.Point, System.Drawing">
- <value>206, 202</value>
+ <value>285, 202</value>
</data>
<data name="rdLocal.Size" type="System.Drawing.Size, System.Drawing">
<value>101, 17</value>
@@ -313,6 +313,36 @@
<value>$this</value>
</data>
<data name=">>rdLocal.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="rdRest.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="rdRest.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
+ <value>NoControl</value>
+ </data>
+ <data name="rdRest.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 202</value>
+ </data>
+ <data name="rdRest.Size" type="System.Drawing.Size, System.Drawing">
+ <value>134, 17</value>
+ </data>
+ <data name="rdRest.TabIndex" type="System.Int32, mscorlib">
+ <value>20</value>
+ </data>
+ <data name="rdRest.Text" xml:space="preserve">
+ <value>Connect via REST API</value>
+ </data>
+ <data name=">>rdRest.Name" xml:space="preserve">
+ <value>rdRest</value>
+ </data>
+ <data name=">>rdRest.Type" xml:space="preserve">
+ <value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>rdRest.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>rdRest.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Modified: trunk/Tools/Maestro/Maestro.Login/Maestro.Login.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Login/Maestro.Login.csproj 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/Maestro.Login/Maestro.Login.csproj 2014-11-20 16:51:51 UTC (rev 8452)
@@ -106,6 +106,12 @@
<Compile Include="NsDoc.cs" />
<Compile Include="PreferedSite.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="RestLoginCtrl.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="RestLoginCtrl.Designer.cs">
+ <DependentUpon>RestLoginCtrl.cs</DependentUpon>
+ </Compile>
<Compile Include="Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -136,6 +142,9 @@
<DependentUpon>LocalNativeLoginCtrl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="RestLoginCtrl.resx">
+ <DependentUpon>RestLoginCtrl.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
Added: trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.Designer.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,153 @@
+namespace Maestro.Login
+{
+ partial class RestLoginCtrl
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.txtPassword = new System.Windows.Forms.TextBox();
+ this.txtUsername = new System.Windows.Forms.TextBox();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtEndpoint = new System.Windows.Forms.TextBox();
+ this.cmbLanguage = new System.Windows.Forms.ComboBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // txtPassword
+ //
+ this.txtPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtPassword.Location = new System.Drawing.Point(83, 55);
+ this.txtPassword.Name = "txtPassword";
+ this.txtPassword.PasswordChar = '*';
+ this.txtPassword.Size = new System.Drawing.Size(229, 20);
+ this.txtPassword.TabIndex = 2;
+ this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
+ //
+ // txtUsername
+ //
+ this.txtUsername.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtUsername.Location = new System.Drawing.Point(83, 29);
+ this.txtUsername.Name = "txtUsername";
+ this.txtUsername.Size = new System.Drawing.Size(229, 20);
+ this.txtUsername.TabIndex = 1;
+ this.txtUsername.TextChanged += new System.EventHandler(this.txtUsername_TextChanged);
+ //
+ // label4
+ //
+ this.label4.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.label4.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.label4.Location = new System.Drawing.Point(3, 55);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(74, 16);
+ this.label4.TabIndex = 27;
+ this.label4.Text = "Password";
+ //
+ // label3
+ //
+ this.label3.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.label3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.label3.Location = new System.Drawing.Point(3, 29);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(74, 16);
+ this.label3.TabIndex = 26;
+ this.label3.Text = "Username";
+ //
+ // label2
+ //
+ this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.label2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.label2.Location = new System.Drawing.Point(3, 3);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(74, 16);
+ this.label2.TabIndex = 24;
+ this.label2.Text = "Endpoint";
+ //
+ // txtEndpoint
+ //
+ this.txtEndpoint.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtEndpoint.Location = new System.Drawing.Point(83, 3);
+ this.txtEndpoint.Name = "txtEndpoint";
+ this.txtEndpoint.Size = new System.Drawing.Size(229, 20);
+ this.txtEndpoint.TabIndex = 0;
+ this.txtEndpoint.Text = "http://localhost/mapguide/rest/v1";
+ this.txtEndpoint.TextChanged += new System.EventHandler(this.txtEndpoint_TextChanged);
+ //
+ // cmbLanguage
+ //
+ this.cmbLanguage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.cmbLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cmbLanguage.Location = new System.Drawing.Point(83, 81);
+ this.cmbLanguage.Name = "cmbLanguage";
+ this.cmbLanguage.Size = new System.Drawing.Size(229, 21);
+ this.cmbLanguage.TabIndex = 3;
+ //
+ // label5
+ //
+ this.label5.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.label5.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.label5.Location = new System.Drawing.Point(3, 81);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(74, 16);
+ this.label5.TabIndex = 30;
+ this.label5.Text = "Language";
+ //
+ // RestLoginCtrl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.cmbLanguage);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.txtPassword);
+ this.Controls.Add(this.txtUsername);
+ this.Controls.Add(this.txtEndpoint);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Name = "RestLoginCtrl";
+ this.Size = new System.Drawing.Size(315, 106);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox txtPassword;
+ private System.Windows.Forms.TextBox txtUsername;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtEndpoint;
+ private System.Windows.Forms.ComboBox cmbLanguage;
+ private System.Windows.Forms.Label label5;
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,145 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using System.Globalization;
+
+namespace Maestro.Login
+{
+ public partial class RestLoginCtrl : UserControl, ILoginCtrl
+ {
+ private bool _loading = true;
+
+ public RestLoginCtrl()
+ {
+ InitializeComponent();
+ }
+
+ public string Username
+ {
+ get { return txtUsername.Text; }
+ }
+
+ public string Password
+ {
+ get { return txtPassword.Text; }
+ }
+
+ public string Endpoint
+ {
+ get { return txtEndpoint.Text; }
+ }
+
+ public string Language
+ {
+ get
+ {
+ var ci = cmbLanguage.SelectedItem as CultureInfo;
+ if (ci != null)
+ {
+ return ci.TwoLetterISOLanguageName;
+ }
+ return null;
+ }
+ }
+
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+
+ List<CultureInfo> supported = new List<CultureInfo>();
+ supported.Add(CultureInfo.GetCultureInfo("en-US")); //NOXLATE
+
+ //Probe for language bundles and add them as well
+ System.Text.RegularExpressions.Regex cix = new System.Text.RegularExpressions.Regex("[A-z][A-z](\\-[A-z][A-z])?"); //NOXLATE
+ foreach (string f in System.IO.Directory.GetDirectories(Application.StartupPath))
+ {
+ if (cix.Match(System.IO.Path.GetFileName(f)).Length == System.IO.Path.GetFileName(f).Length)
+ {
+ try
+ {
+ supported.Add(System.Globalization.CultureInfo.GetCultureInfo(System.IO.Path.GetFileName(f)));
+ }
+ catch { }
+ }
+ }
+
+ cmbLanguage.DisplayMember = "DisplayName"; //NOXLATE
+ cmbLanguage.ValueMember = "Name"; //NOXLATE
+
+ //Set default language based on current thread culture
+ int selected = -1;
+ foreach (var ci in supported)
+ {
+ int index = cmbLanguage.Items.Add(ci);
+ if (string.Compare(ci.Name, System.Threading.Thread.CurrentThread.CurrentUICulture.Name, true) == 0)
+ {
+ selected = index;
+ }
+ }
+
+ if (selected >= 0)
+ cmbLanguage.SelectedIndex = selected;
+
+ _loading = false;
+ UpdateLoginStatus();
+ }
+
+ public CultureInfo SelectedCulture
+ {
+ get { return cmbLanguage.SelectedItem as CultureInfo; }
+ }
+
+ public void UpdateLoginStatus()
+ {
+ if (this.Username.Trim().Length > 0 && this.Endpoint.Trim().Length > 0)
+ EnableOk(this, EventArgs.Empty);
+ else
+ DisabledOk(this, EventArgs.Empty);
+ }
+
+ public event EventHandler EnableOk;
+
+ public event EventHandler DisabledOk;
+
+ public event EventHandler CheckSavedPassword;
+
+ private void txtUsername_TextChanged(object sender, EventArgs e)
+ {
+ UpdateLoginStatus();
+ }
+
+ private void txtEndpoint_TextChanged(object sender, EventArgs e)
+ {
+ UpdateLoginStatus();
+ }
+
+ private void txtPassword_TextChanged(object sender, EventArgs e)
+ {
+ UpdateLoginStatus();
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.Login/RestLoginCtrl.resx 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -279,7 +279,7 @@
class MockFeatureService : IFeatureService
{
- public OSGeo.MapGuide.ObjectModels.Capabilities.FdoProviderCapabilities GetProviderCapabilities(string provider)
+ public OSGeo.MapGuide.ObjectModels.Capabilities.IFdoProviderCapabilities GetProviderCapabilities(string provider)
{
throw new NotImplementedException();
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Check.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Check.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Check.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -17,6 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
+using OSGeo.MapGuide.MaestroAPI.Resource;
using System;
using System.Collections.Generic;
using System.Text;
@@ -137,5 +138,16 @@
if (!bInRange)
throw new PreconditionException(Strings.PrecondFailure + msg);
}
+
+ /// <summary>
+ /// Check that the given argument is a folder resource id
+ /// </summary>
+ /// <param name="folderid">The folder resource id to check</param>
+ /// <param name="name">The argument name</param>
+ public static void IsFolderArgument(string folderid, string name)
+ {
+ if (!ResourceIdentifier.IsFolderResource(folderid))
+ throw new ArgumentException(string.Format(Strings.NotAFolder, folderid), name);
+ }
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ConnectionProviders.xml
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ConnectionProviders.xml 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ConnectionProviders.xml 2014-11-20 16:51:51 UTC (rev 8452)
@@ -6,6 +6,12 @@
<Assembly>OSGeo.MapGuide.MaestroAPI.Http.dll</Assembly>
<Type>OSGeo.MapGuide.MaestroAPI.HttpServerConnection</Type>
</ConnectionProvider>
+ <ConnectionProvider>
+ <Name>Maestro.Rest</Name>
+ <Description>Connection using the mapguide-rest API</Description>
+ <Assembly>OSGeo.MapGuide.MaestroAPI.Rest.dll</Assembly>
+ <Type>OSGeo.MapGuide.MaestroAPI.RestConnection</Type>
+ </ConnectionProvider>
<!--
If you want to use the Maestro.LocalNative provider, register the desired
LocalNative provider assembly here.
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemBase.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemBase.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemBase.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -23,6 +23,7 @@
using GeoAPI.CoordinateSystems;
using ProjNet.CoordinateSystems;
using GeoAPI.Geometries;
+using ObjCommon = OSGeo.MapGuide.ObjectModels.Common;
using GisSharpBlog.NetTopologySuite.Geometries;
namespace OSGeo.MapGuide.MaestroAPI.CoordinateSystem
@@ -89,7 +90,7 @@
/// <param name="bbox">The map bounding box</param>
/// <param name="size">The size of the image</param>
/// <returns>The scale</returns>
- public double CalculateScale(ObjectModels.Common.IEnvelope bbox, System.Drawing.Size size)
+ public double CalculateScale(ObjCommon.IEnvelope bbox, System.Drawing.Size size)
{
Check.NotNull(bbox, "bbox");
return CalculateScale(new Envelope(bbox.MinX, bbox.MaxX, bbox.MinY, bbox.MaxY), size);
@@ -110,7 +111,7 @@
/// <param name="scale">The scale to fit</param>
/// <param name="size">The size to fit to</param>
/// <returns>A bounding box with the correct ratio</returns>
- public ObjectModels.Common.IEnvelope AdjustBoundingBox(ObjectModels.Common.IEnvelope bbox, double scale, System.Drawing.Size size)
+ public ObjCommon.IEnvelope AdjustBoundingBox(ObjCommon.IEnvelope bbox, double scale, System.Drawing.Size size)
{
Check.NotNull(bbox, "bbox");
var env = AdjustBoundingBox(new Envelope(bbox.MinX, bbox.MaxX, bbox.MinY, bbox.MaxY), scale, size);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CredentialWriter.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CredentialWriter.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/CredentialWriter.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -23,6 +23,7 @@
using System.Text;
using System.Diagnostics;
using System.IO;
+using ObjCommon = OSGeo.MapGuide.ObjectModels.Common;
using OSGeo.MapGuide.ObjectModels.FeatureSource;
namespace OSGeo.MapGuide.MaestroAPI
@@ -48,7 +49,7 @@
throw new ArgumentException(Strings.ErrorNoResourceIdAttached);
using (var stream = CredentialWriter.Write(username, password))
{
- fs.SetResourceData(StringConstants.MgUserCredentialsResourceData, ObjectModels.Common.ResourceDataType.String, stream);
+ fs.SetResourceData(StringConstants.MgUserCredentialsResourceData, ObjCommon.ResourceDataType.String, stream);
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -1820,6 +1820,11 @@
return newMdf;
}
+
+ public void ComputeCenterAndScale(double x1, double y1, double x2, double y2, int width, int height, out double x, out double y, out double scale)
+ {
+ throw new NotImplementedException();
+ }
}
/// <summary>
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2014-11-20 16:51:51 UTC (rev 8452)
@@ -102,6 +102,9 @@
<Compile Include="..\Generated\FdoProviderCapabilities-1.0.0.designer.cs">
<Link>ObjectModels\FdoProviderCapabilities-1.0.0.designer.cs</Link>
</Compile>
+ <Compile Include="..\Generated\FdoProviderCapabilities-1.1.0.designer.cs">
+ <Link>ObjectModels\FdoProviderCapabilities-1.1.0.designer.cs</Link>
+ </Compile>
<Compile Include="..\Generated\FdoSpatialContextList-1.0.0.designer.cs">
<Link>ObjectModels\FdoSpatialContextList-1.0.0.designer.cs</Link>
</Compile>
@@ -258,6 +261,7 @@
<Compile Include="CsHelper.cs" />
<Compile Include="NsDoc.cs" />
<Compile Include="ObjectModels\CommonTypes.cs" />
+ <Compile Include="ObjectModels\FdoCapabilities.cs" />
<Compile Include="ObjectModels\IFdoSpatialContext.cs" />
<Compile Include="ObjectModels\LongTransaction.cs" />
<Compile Include="ObjectModels\NsDoc.cs" />
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/FdoCapabilities.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/FdoCapabilities.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/FdoCapabilities.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,436 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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.Linq;
+using System.Text;
+using System.Xml.Serialization;
+
+namespace OSGeo.MapGuide.ObjectModels.Capabilities
+{
+ public interface IFdoCommandCapabilities
+ {
+ string[] SupportedCommands { get; }
+ bool SupportsParameters { get; }
+ bool SupportsTimeout { get; }
+ }
+
+ public interface IFdoConnectionCapabilities
+ {
+ string[] SupportedSpatialContextExtentTypes { get; }
+ bool SupportsConfiguration { get; }
+ bool SupportsLocking { get; }
+ bool SupportsLongTransactions { get; }
+ bool SupportsSQL { get; }
+ bool SupportsTimeout { get; }
+ bool SupportsTransactions { get; }
+ string ThreadCapability { get; }
+ }
+
+ public interface IFdoExpressionCapabilities
+ {
+ IFdoFunctionDefintion[] SupportedFunctions { get; }
+ string[] ExpressionTypes { get; }
+ }
+
+ public interface IFdoFunctionArgumentDefinition
+ {
+ string Name { get; }
+ string Description { get; }
+ }
+
+ public interface IFdoFunctionDefintionSignature
+ {
+ IFdoFunctionArgumentDefinition[] Arguments { get; }
+ string ReturnType { get; }
+ }
+
+ public interface IFdoFunctionDefintion
+ {
+ string Name { get; }
+ string Description { get; }
+ IFdoFunctionDefintionSignature[] Signatures { get; }
+ }
+
+ public interface IFdoFilterCapabilities
+ {
+ string[] ConditionTypes { get; }
+ string[] DistanceOperations { get; }
+ string[] SpatialOperations { get; }
+
+ bool SupportsGeodesicDistance { get; }
+ bool SupportsNonLiteralGeometricOperations { get; }
+ }
+
+ public interface IFdoGeometryCapabilities
+ {
+ string[] SupportedComponentTypes { get; }
+ string Dimensionality { get; }
+ string[] SupportedGeometryTypes { get; }
+ }
+
+ public interface IFdoRasterCapabilities
+ {
+ bool SupportsRaster { get; }
+ bool SupportsStitching { get; }
+ bool SupportsSubsampling { get; }
+ }
+
+ public interface IFdoSchemaCapabilities
+ {
+ string[] SupportedClassTypes { get; }
+ string[] SupportedDataTypes { get; }
+ bool SupportsAssociationProperties { get; }
+ bool SupportsInheritance { get; }
+ bool SupportsMultipleSchemas { get; }
+ bool SupportsNetworkModel { get; }
+ bool SupportsObjectProperties { get; }
+ bool SupportsSchemaOverrides { get; }
+ }
+
+ public interface IFdoProviderCapabilities
+ {
+ IFdoCommandCapabilities Command { get; }
+ IFdoConnectionCapabilities Connection { get; }
+ IFdoExpressionCapabilities Expression { get; }
+ IFdoFilterCapabilities Filter { get; }
+ IFdoGeometryCapabilities Geometry { get; }
+ IFdoRasterCapabilities Raster { get; }
+ IFdoSchemaCapabilities Schema { get; }
+ }
+
+ partial class FdoProviderCapabilities : IFdoProviderCapabilities
+ {
+ IFdoCommandCapabilities IFdoProviderCapabilities.Command
+ {
+ get { return this.Command; }
+ }
+
+ IFdoConnectionCapabilities IFdoProviderCapabilities.Connection
+ {
+ get { return this.Connection; }
+ }
+
+ IFdoExpressionCapabilities IFdoProviderCapabilities.Expression
+ {
+ get { return this.Expression; }
+ }
+
+ IFdoFilterCapabilities IFdoProviderCapabilities.Filter
+ {
+ get { return this.Filter; }
+ }
+
+ IFdoGeometryCapabilities IFdoProviderCapabilities.Geometry
+ {
+ get { return this.Geometry; }
+ }
+
+ IFdoRasterCapabilities IFdoProviderCapabilities.Raster
+ {
+ get { return this.Raster; }
+ }
+
+ IFdoSchemaCapabilities IFdoProviderCapabilities.Schema
+ {
+ get { return this.Schema; }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesCommand : IFdoCommandCapabilities
+ {
+ string[] IFdoCommandCapabilities.SupportedCommands
+ {
+ get { return this.SupportedCommands.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesConnection : IFdoConnectionCapabilities
+ {
+ [XmlIgnore]
+ public string[] SupportedSpatialContextExtentTypes
+ {
+ get { return this.SpatialContextExtent.Select(x => x.ToString()).ToArray(); }
+ }
+
+ string IFdoConnectionCapabilities.ThreadCapability
+ {
+ get { return this.ThreadCapability.ToString(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesExpressionFunctionDefinition : IFdoFunctionDefintion, IFdoFunctionDefintionSignature
+ {
+ [XmlIgnore]
+ public IFdoFunctionArgumentDefinition[] Arguments
+ {
+ get { return this.ArgumentDefinitionList.ToArray(); }
+ }
+
+
+ [XmlIgnore]
+ public IFdoFunctionDefintionSignature[] Signatures
+ {
+ get { return new IFdoFunctionDefintionSignature[] { this }; }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition : IFdoFunctionArgumentDefinition
+ {
+
+ }
+
+ partial class FdoProviderCapabilitiesExpression : IFdoExpressionCapabilities
+ {
+ [XmlIgnore]
+ public IFdoFunctionDefintion[] SupportedFunctions
+ {
+ get { return this.FunctionDefinitionList.ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] ExpressionTypes
+ {
+ get { return this.Type.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesFilter : IFdoFilterCapabilities
+ {
+ [XmlIgnore]
+ public string[] ConditionTypes
+ {
+ get { return this.Condition.Select(x => x.ToString()).ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] DistanceOperations
+ {
+ get { return this.Distance.Select(x => x.ToString()).ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] SpatialOperations
+ {
+ get { return this.Spatial.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesGeometry : IFdoGeometryCapabilities
+ {
+ [XmlIgnore]
+ public string[] SupportedComponentTypes
+ {
+ get { return this.Components.Select(x => x.ToString()).ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] SupportedGeometryTypes
+ {
+ get { return this.Types.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesRaster : IFdoRasterCapabilities
+ {
+
+ }
+
+ partial class FdoProviderCapabilitiesSchema : IFdoSchemaCapabilities
+ {
+ [XmlIgnore]
+ public string[] SupportedClassTypes
+ {
+ get { return this.Class.Select(x => x.ToString()).ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] SupportedDataTypes
+ {
+ get { return this.Data.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+}
+
+namespace OSGeo.MapGuide.ObjectModels.Capabilities_1_1_0
+{
+ using OSGeo.MapGuide.ObjectModels.Capabilities;
+
+ partial class FdoProviderCapabilities : IFdoProviderCapabilities
+ {
+ IFdoCommandCapabilities IFdoProviderCapabilities.Command
+ {
+ get { return this.Command; }
+ }
+
+ IFdoConnectionCapabilities IFdoProviderCapabilities.Connection
+ {
+ get { return this.Connection; }
+ }
+
+ IFdoExpressionCapabilities IFdoProviderCapabilities.Expression
+ {
+ get { return this.Expression; }
+ }
+
+ IFdoFilterCapabilities IFdoProviderCapabilities.Filter
+ {
+ get { return this.Filter; }
+ }
+
+ IFdoGeometryCapabilities IFdoProviderCapabilities.Geometry
+ {
+ get { return this.Geometry; }
+ }
+
+ IFdoRasterCapabilities IFdoProviderCapabilities.Raster
+ {
+ get { return this.Raster; }
+ }
+
+ IFdoSchemaCapabilities IFdoProviderCapabilities.Schema
+ {
+ get { return this.Schema; }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesCommand : IFdoCommandCapabilities
+ {
+ string[] IFdoCommandCapabilities.SupportedCommands
+ {
+ get { return this.SupportedCommands.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesConnection : IFdoConnectionCapabilities
+ {
+ [XmlIgnore]
+ public string[] SupportedSpatialContextExtentTypes
+ {
+ get { return this.SpatialContextExtent.Select(x => x.ToString()).ToArray(); }
+ }
+
+ string IFdoConnectionCapabilities.ThreadCapability
+ {
+ get { return this.ThreadCapability.ToString(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesExpressionFunctionDefinition : IFdoFunctionDefintion
+ {
+ [XmlIgnore]
+ public IFdoFunctionDefintionSignature[] Signatures
+ {
+ get { return this.SignatureDefinitionCollection.ToArray(); }
+ }
+ }
+
+
+ partial class FdoProviderCapabilitiesExpressionFunctionDefinitionSignatureDefinition : IFdoFunctionDefintionSignature
+ {
+ [XmlIgnore]
+ public IFdoFunctionArgumentDefinition[] Arguments
+ {
+ get { return this.ArgumentDefinitionList.ArgumentDefinition.ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string ReturnType
+ {
+ get { return this.DataType.ToString(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesExpressionFunctionDefinitionSignatureDefinitionArgumentDefinitionListArgumentDefinition : IFdoFunctionArgumentDefinition
+ {
+
+ }
+
+ partial class FdoProviderCapabilitiesExpression : IFdoExpressionCapabilities
+ {
+ [XmlIgnore]
+ public IFdoFunctionDefintion[] SupportedFunctions
+ {
+ get { return this.FunctionDefinitionList.ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] ExpressionTypes
+ {
+ get { return this.Type.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesFilter : IFdoFilterCapabilities
+ {
+ [XmlIgnore]
+ public string[] ConditionTypes
+ {
+ get { return this.Condition.Select(x => x.ToString()).ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] DistanceOperations
+ {
+ get { return this.Distance.Select(x => x.ToString()).ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] SpatialOperations
+ {
+ get { return this.Spatial.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesGeometry : IFdoGeometryCapabilities
+ {
+ [XmlIgnore]
+ public string[] SupportedComponentTypes
+ {
+ get { return this.Components.Select(x => x.ToString()).ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] SupportedGeometryTypes
+ {
+ get { return this.Types.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+
+ partial class FdoProviderCapabilitiesRaster : IFdoRasterCapabilities
+ {
+
+ }
+
+ partial class FdoProviderCapabilitiesSchema : IFdoSchemaCapabilities
+ {
+ [XmlIgnore]
+ public string[] SupportedClassTypes
+ {
+ get { return this.Class.Select(x => x.ToString()).ToArray(); }
+ }
+
+ [XmlIgnore]
+ public string[] SupportedDataTypes
+ {
+ get { return this.Data.Select(x => x.ToString()).ToArray(); }
+ }
+ }
+}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/ResourceList.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/ResourceList.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/ResourceList.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -47,7 +47,11 @@
};
}
- internal ResourceDocumentHeaderType() { }
+ /// <summary>
+ /// For internal use only. Made public to satisfy serialization requirements. Use <see cref="M:OSGeo.MapGuide.ObjectModels.ResourceDocumentHeaderType.CreateDefault"/> to
+ /// create new instances
+ /// </summary>
+ public ResourceDocumentHeaderType() { }
//Required for saving/updating
@@ -69,7 +73,11 @@
};
}
- internal ResourceFolderHeaderType() { }
+ /// <summary>
+ /// For internal use only. Made public to satisfy serialization requirements. Use <see cref="M:OSGeo.MapGuide.ObjectModels.ResourceDocumentHeaderType.CreateDefault"/> to
+ /// create new instances
+ /// </summary>
+ public ResourceFolderHeaderType() { }
//Required for saving/updating
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ImageSymbolConverter.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ImageSymbolConverter.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ImageSymbolConverter.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -19,6 +19,7 @@
#endregion
using OSGeo.MapGuide.MaestroAPI.Services;
using OSGeo.MapGuide.ObjectModels;
+using ObjCommon = OSGeo.MapGuide.ObjectModels.Common;
using OSGeo.MapGuide.ObjectModels.DrawingSource;
using OSGeo.MapGuide.ObjectModels.SymbolLibrary;
using System;
@@ -128,7 +129,7 @@
}
}
- private void ExtractSymbol(string targetFolder, IDrawingService drawSvc, IDrawingSource ds, ObjectModels.Common.DrawingSectionListSection sect, ObjectModels.Common.DrawingSectionResourceListSectionResource res)
+ private void ExtractSymbol(string targetFolder, IDrawingService drawSvc, IDrawingSource ds, ObjCommon.DrawingSectionListSection sect, ObjCommon.DrawingSectionResourceListSectionResource res)
{
using (var rs = drawSvc.GetSectionResource(ds.ResourceID, res.Href))
{
@@ -168,7 +169,7 @@
{
img.Save(ms, ImageFormat.Png);
ms.Position = 0L; //Rewind
- _conn.ResourceService.SetResourceData(targetId, dataName, ObjectModels.Common.ResourceDataType.File, ms);
+ _conn.ResourceService.SetResourceData(targetId, dataName, ObjCommon.ResourceDataType.File, ms);
}
Trace.TraceInformation("Extracted symbol: " + targetId);
@@ -222,7 +223,7 @@
using (dwf)
{
- conn.ResourceService.SetResourceData(ds.ResourceID, "symbols.dwf", OSGeo.MapGuide.ObjectModels.Common.ResourceDataType.File, dwf); //NOXLATE
+ conn.ResourceService.SetResourceData(ds.ResourceID, "symbols.dwf", ObjCommon.ResourceDataType.File, dwf); //NOXLATE
}
return ds;
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -45,7 +45,7 @@
/// </summary>
/// <param name="provider"></param>
/// <returns></returns>
- OSGeo.MapGuide.ObjectModels.Capabilities.FdoProviderCapabilities GetProviderCapabilities(string provider);
+ OSGeo.MapGuide.ObjectModels.Capabilities.IFdoProviderCapabilities GetProviderCapabilities(string provider);
/// <summary>
/// Gets an array of all registered providers
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -1287,7 +1287,7 @@
/// Returns the list of known FDO stylization expression functions
/// </summary>
/// <returns></returns>
- public static IEnumerable<FdoProviderCapabilitiesExpressionFunctionDefinition> GetStylizationFunctions()
+ public static IEnumerable<IFdoFunctionDefintion> GetStylizationFunctions()
{
//ARGB
yield return new FdoProviderCapabilitiesExpressionFunctionDefinition()
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/Commands/HttpCreateRuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/Commands/HttpCreateRuntimeMap.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/Commands/HttpCreateRuntimeMap.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -18,6 +18,7 @@
//
#endregion
using OSGeo.MapGuide.MaestroAPI.Commands;
+using OSGeo.MapGuide.ObjectModels.RuntimeMap;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -88,7 +89,7 @@
get { return _conn; }
}
- public ObjectModels.RuntimeMap.IRuntimeMapInfo Execute()
+ public IRuntimeMapInfo Execute()
{
return _conn.CreateRuntimeMap(
this.MapDefinition,
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/Commands/HttpDescribeRuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/Commands/HttpDescribeRuntimeMap.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/Commands/HttpDescribeRuntimeMap.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -18,6 +18,7 @@
//
#endregion
using OSGeo.MapGuide.MaestroAPI.Commands;
+using OSGeo.MapGuide.ObjectModels.RuntimeMap;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -81,7 +82,7 @@
get { return _conn; }
}
- public ObjectModels.RuntimeMap.IRuntimeMapInfo Execute()
+ public IRuntimeMapInfo Execute()
{
return _conn.DescribeRuntimeMap(
this.Name,
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -32,6 +32,7 @@
using OSGeo.MapGuide.ObjectModels.ApplicationDefinition_1_0_0;
using OSGeo.MapGuide.ObjectModels.Capabilities;
using OSGeo.MapGuide.ObjectModels.Common;
+using OSGeo.MapGuide.ObjectModels.RuntimeMap;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -63,7 +64,6 @@
//These only change after server reboot, so it is probably safe to cache them
private FeatureProviderRegistry m_featureProviders = null; //SHARED
- private Hashtable m_cachedProviderCapabilities = null; //SHARED
private Version m_siteVersion; //SHARED
private bool mAnonymousUser = false;
@@ -71,7 +71,7 @@
internal HttpServerConnection()
: base()
{
- m_cachedProviderCapabilities = new Hashtable();
+
}
internal HttpServerConnection(RequestBuilder builder)
@@ -1020,7 +1020,7 @@
OnResourceAdded(newpath);
}
- public override System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, Color selectionColor, int behavior)
+ public override System.IO.Stream RenderDynamicOverlay(Mapping.RuntimeMap map, MapSelection selection, string format, Color selectionColor, int behavior)
{
//This API was introduced in MGOS 2.1 so this won't work with older versions
if (this.SiteVersion < new Version(2, 1, 0))
@@ -1032,7 +1032,7 @@
return this.OpenRead(req);
}
- public override System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, bool keepSelection)
+ public override System.IO.Stream RenderDynamicOverlay(Mapping.RuntimeMap map, MapSelection selection, string format, bool keepSelection)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.Net.WebRequest req = m_reqBuilder.GetDynamicMapOverlayImage(map.Name, (selection == null ? string.Empty : selection.ToXml()), format, ms);
@@ -1053,7 +1053,7 @@
}
}
- public Stream RenderMapLegend(RuntimeMap map, int width, int height, System.Drawing.Color backgroundColor, string format)
+ public Stream RenderMapLegend(Mapping.RuntimeMap map, int width, int height, System.Drawing.Color backgroundColor, string format)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
string req = m_reqBuilder.RenderMapLegend(map.Name, width, height, ColorTranslator.ToHtml(backgroundColor), format);
@@ -1061,7 +1061,7 @@
return this.OpenRead(req);
}
- public override System.IO.Stream RenderRuntimeMap(RuntimeMap map, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
+ public override System.IO.Stream RenderRuntimeMap(Mapping.RuntimeMap map, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
{
var resourceId = map.ResourceID;
ResourceIdentifier.Validate(resourceId, ResourceTypes.RuntimeMap);
@@ -1093,7 +1093,7 @@
#endif
}
- public override System.IO.Stream RenderRuntimeMap(RuntimeMap map, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
+ public override System.IO.Stream RenderRuntimeMap(Mapping.RuntimeMap map, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
{
var resourceId = map.ResourceID;
ResourceIdentifier.Validate(resourceId, ResourceTypes.RuntimeMap);
@@ -1289,7 +1289,6 @@
m_siteVersion = new Version(((SiteVersion)DeserializeObject(typeof(SiteVersion), wc.OpenRead(reqb.GetSiteVersion()))).Version);
m_featureProviders = null;
- m_cachedProviderCapabilities = null;
m_reqBuilder = reqb;
}
@@ -1595,9 +1594,6 @@
{
if (m_featureProviders != null)
m_featureProviders = null;
-
- if (m_cachedProviderCapabilities != null)
- m_cachedProviderCapabilities = null;
}
}
@@ -1802,18 +1798,11 @@
}
}
- public FdoProviderCapabilities GetProviderCapabilities(string provider)
+ public IFdoProviderCapabilities GetProviderCapabilities(string provider)
{
- if (m_cachedProviderCapabilities == null)
- m_cachedProviderCapabilities = new Hashtable();
-
- if (m_cachedProviderCapabilities.ContainsKey(provider))
- return (FdoProviderCapabilities)m_cachedProviderCapabilities[provider];
-
string req = m_reqBuilder.GetProviderCapabilities(provider);
- //TODO: Cache?
- FdoProviderCapabilities o = (FdoProviderCapabilities)DeserializeObject(typeof(FdoProviderCapabilities), this.OpenRead(req));
+ var o = DeserializeObject<OSGeo.MapGuide.ObjectModels.Capabilities_1_1_0.FdoProviderCapabilities>(this.OpenRead(req));
return o;
}
@@ -1880,7 +1869,7 @@
}
}
- public override string QueryMapFeatures(RuntimeMap map, int maxFeatures, string wkt, bool persist, string selectionVariant, QueryMapOptions extraOptions)
+ public override string QueryMapFeatures(Mapping.RuntimeMap map, int maxFeatures, string wkt, bool persist, string selectionVariant, QueryMapOptions extraOptions)
{
string runtimeMapName = map.Name;
//The request may execeed the url limit of the server, when large geometries
@@ -1998,7 +1987,7 @@
}
}
- internal ObjectModels.RuntimeMap.IRuntimeMapInfo DescribeRuntimeMap(string mapName, int requestedFeatures, int iconsPerScaleRange, string iconFormat, int iconWidth, int iconHeight)
+ internal IRuntimeMapInfo DescribeRuntimeMap(string mapName, int requestedFeatures, int iconsPerScaleRange, string iconFormat, int iconWidth, int iconHeight)
{
var req = m_reqBuilder.DescribeRuntimeMap(mapName, requestedFeatures, iconsPerScaleRange, iconFormat, iconWidth, iconHeight);
using (var s = this.OpenRead(req))
@@ -2008,7 +1997,7 @@
}
}
- internal ObjectModels.RuntimeMap.IRuntimeMapInfo CreateRuntimeMap(string mapDefinition, string targetMapName, int requestedFeatures, int iconsPerScaleRange, string iconFormat, int iconWidth, int iconHeight)
+ internal IRuntimeMapInfo CreateRuntimeMap(string mapDefinition, string targetMapName, int requestedFeatures, int iconsPerScaleRange, string iconFormat, int iconWidth, int iconHeight)
{
var req = m_reqBuilder.CreateRuntimeMap(mapDefinition, targetMapName, requestedFeatures, iconsPerScaleRange, iconFormat, iconWidth, iconHeight);
using (var s = this.OpenRead(req))
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -637,7 +637,7 @@
{
NameValueCollection param = new NameValueCollection();
param.Add("OPERATION", "GETPROVIDERCAPABILITIES");
- param.Add("VERSION", "1.0.0");
+ param.Add("VERSION", "2.0.0");
param.Add("SESSION", m_sessionID);
param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -26,7 +26,6 @@
using OSGeo.MapGuide.ObjectModels.Common;
using OSGeo.MapGuide.MaestroAPI.Resource;
using OSGeo.MapGuide.MaestroAPI.Exceptions;
-using OSGeo.MapGuide.ObjectModels.Capabilities;
using OSGeo.MapGuide.MaestroAPI.Feature;
using OSGeo.MapGuide.MaestroAPI.Schema;
using System.IO;
@@ -37,6 +36,9 @@
using OSGeo.MapGuide.MaestroAPI.Mapping;
using OSGeo.MapGuide.ObjectModels.FeatureSource;
using OSGeo.MapGuide.MaestroAPI.SchemaOverrides;
+using OSGeo.MapGuide.ObjectModels.MapDefinition;
+using OSGeo.MapGuide.ObjectModels.LayerDefinition;
+using OSGeo.MapGuide.ObjectModels.Capabilities;
namespace OSGeo.MapGuide.MaestroAPI.Local
{
@@ -675,10 +677,10 @@
throw new CustomPropertyNotFoundException();
}
- public FdoProviderCapabilities GetProviderCapabilities(string provider)
+ public IFdoProviderCapabilities GetProviderCapabilities(string provider)
{
var fes = GetFeatureService();
- var res = (FdoProviderCapabilities)base.DeserializeObject(typeof(FdoProviderCapabilities), new MgReadOnlyStream(() => fes.GetCapabilities(provider)));
+ var res = (IFdoProviderCapabilities)base.DeserializeObject(typeof(OSGeo.MapGuide.ObjectModels.Capabilities_1_1_0.FdoProviderCapabilities), new MgReadOnlyStream(() => fes.GetCapabilities(provider)));
LogMethodCall("MgFeatureService::GetProviderCapabilities", true, provider);
return res;
}
@@ -1060,7 +1062,7 @@
throw new NotSupportedException();
}
- public override Mapping.RuntimeMap CreateMap(string runtimeMapResourceId, ObjectModels.MapDefinition.IMapDefinition mdf, double metersPerUnit, bool suppressErrors)
+ public override Mapping.RuntimeMap CreateMap(string runtimeMapResourceId, IMapDefinition mdf, double metersPerUnit, bool suppressErrors)
{
var mdfId = new MgResourceIdentifier(mdf.ResourceID);
var implMap = new MgdMap(mdfId);
@@ -1070,7 +1072,7 @@
return map;
}
- public override Mapping.RuntimeMapGroup CreateMapGroup(Mapping.RuntimeMap parent, ObjectModels.MapDefinition.IBaseMapGroup group)
+ public override Mapping.RuntimeMapGroup CreateMapGroup(Mapping.RuntimeMap parent, IBaseMapGroup group)
{
var impl = parent as LocalRuntimeMap;
if (impl == null)
@@ -1086,7 +1088,7 @@
return new LocalRuntimeMapGroup(impl, rtGroup);
}
- public override Mapping.RuntimeMapGroup CreateMapGroup(Mapping.RuntimeMap parent, ObjectModels.MapDefinition.IMapLayerGroup group)
+ public override Mapping.RuntimeMapGroup CreateMapGroup(Mapping.RuntimeMap parent, IMapLayerGroup group)
{
var impl = parent as LocalRuntimeMap;
if (impl == null)
@@ -1123,7 +1125,7 @@
return new LocalRuntimeMapGroup(impl, group);
}
- public override Mapping.RuntimeMapLayer CreateMapLayer(Mapping.RuntimeMap parent, ObjectModels.LayerDefinition.ILayerDefinition ldf, bool suppressErrors)
+ public override Mapping.RuntimeMapLayer CreateMapLayer(Mapping.RuntimeMap parent, ILayerDefinition ldf, bool suppressErrors)
{
var impl = parent as LocalRuntimeMap;
if (impl == null)
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -26,6 +26,7 @@
using OSGeo.MapGuide.ObjectModels;
using OSGeo.MapGuide.MaestroAPI.Services;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
+using OSGeo.MapGuide.ObjectModels.Common;
namespace OSGeo.MapGuide.MaestroAPI.Local
{
@@ -127,7 +128,7 @@
}
}
- public override ObjectModels.Common.IEnvelope DataExtent
+ public override IEnvelope DataExtent
{
get
{
@@ -199,7 +200,7 @@
}
}
- public override ObjectModels.Common.IEnvelope MapExtent
+ public override IEnvelope MapExtent
{
get
{
@@ -233,7 +234,7 @@
}
}
- public override ObjectModels.Common.IPoint2D ViewCenter
+ public override IPoint2D ViewCenter
{
get
{
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs 2014-11-17 07:39:36 UTC (rev 8451)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -157,12 +157,12 @@
}
public override string SessionID
- {
- get
- {
- return m_sessionId;
- }
- }
+ {
+ get
+ {
+ return m_sessionId;
+ }
+ }
private void LogMethodCall(string method, bool success, params object[] values)
{
@@ -172,10 +172,10 @@
OnRequestDispatched(method + "(" + string.Join(", ", strValues) + ") " + ((success) ? "Success" : "Failure"));
}
- public override ResourceList GetRepositoryResources(string startingpoint, string type, int depth, bool computeChildren)
- {
- if (type == null)
- type = "";
+ public override ResourceList GetRepositoryResources(string startingpoint, string type, int depth, bool computeChildren)
+ {
+ if (type == null)
+ type = "";
MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
GetByteReaderMethod fetch = () =>
{
@@ -184,13 +184,13 @@
};
LogMethodCall("MgResourceService::EnumerateResources", true, startingpoint, depth.ToString(), type, computeChildren.ToString());
return (ResourceList)base.DeserializeObject<ResourceList>(new MgReadOnlyStream(fetch));
- }
+ }
- public override FeatureProviderRegistryFeatureProvider[] FeatureProviders
- {
- get
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ public override FeatureProviderRegistryFeatureProvider[] FeatureProviders
+ {
+ get
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
GetByteReaderMethod fetch = () =>
{
return fes.GetFeatureProviders();
@@ -198,47 +198,47 @@
LogMethodCall("MgFeatureService::GetFeatureProviders", true);
var reg = base.DeserializeObject<FeatureProviderRegistry>(new MgReadOnlyStream(fetch));
return reg.FeatureProvider.ToArray();
- }
- }
+ }
+ }
- public string TestConnection(string providername, System.Collections.Specialized.NameValueCollection parameters)
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
- System.Text.StringBuilder sb = new System.Text.StringBuilder();
- if (parameters != null)
- {
- foreach(System.Collections.DictionaryEntry de in parameters)
- sb.Append((string)de.Key + "=" + (string)de.Value + "\t");
- if (sb.Length > 0)
- sb.Length--;
- }
- var res = fes.TestConnection(providername, sb.ToString()) ? "True" : "Unspecified errors";
+ public string TestConnection(string providername, System.Collections.Specialized.NameValueCollection parameters)
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ if (parameters != null)
+ {
+ foreach(System.Collections.DictionaryEntry de in parameters)
+ sb.Append((string)de.Key + "=" + (string)de.Value + "\t");
+ if (sb.Length > 0)
+ sb.Length--;
+ }
+ var res = fes.TestConnection(providername, sb.ToString()) ? "True" : "Unspecified errors";
LogMethodCall("MgFeatureService::TestConnection", true, providername, sb.ToString());
return res;
- }
+ }
- public override string TestConnection(string featuresource)
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
- var res = fes.TestConnection(new MgResourceIdentifier(featuresource)) ? "True" : "Unspecified errors";
+ public override string TestConnection(string featuresource)
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ var res = fes.TestConnection(new MgResourceIdentifier(featuresource)) ? "True" : "Unspecified errors";
LogMethodCall("MgFeatureService::TestConnection", true, featuresource);
return res;
- }
+ }
- public FdoProviderCapabilities GetProviderCapabilities(string provider)
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ public IFdoProviderCapabilities GetProviderCapabilities(string provider)
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
GetByteReaderMethod fetch = () =>
{
return fes.GetCapabilities(provider);
};
LogMethodCall("MgFeatureService::GetProviderCapabilities", true, provider);
- return base.DeserializeObject<FdoProviderCapabilities>(new MgReadOnlyStream(fetch));
- }
+ return base.DeserializeObject<OSGeo.MapGuide.ObjectModels.Capabilities_1_1_0.FdoProviderCapabilities>(new MgReadOnlyStream(fetch));
+ }
- public override System.IO.Stream GetResourceData(string resourceID, string dataname)
- {
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ public override System.IO.Stream GetResourceData(string resourceID, string dataname)
+ {
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
GetByteReaderMethod fetch = () =>
{
MgResourceIdentifier resId = new MgResourceIdentifier(resourceID);
@@ -246,11 +246,11 @@
};
LogMethodCall("MgResourceService::GetResourceData", true, resourceID, dataname);
return new MgReadOnlyStream(fetch);
- }
+ }
- public override Stream GetResourceXmlData(string resourceID)
- {
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ public override Stream GetResourceXmlData(string resourceID)
+ {
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
GetByteReaderMethod fetch = () =>
{
MgResourceIdentifier resId = new MgResourceIdentifier(resourceID);
@@ -258,13 +258,13 @@
};
LogMethodCall("MgResourceService::GetResourceContent", true, resourceID);
return new MgReadOnlyStream(fetch);
- }
+ }
- public override void SetResourceXmlData(string resourceid, System.IO.Stream content, System.IO.Stream header)
- {
+ public override void SetResourceXmlData(string resourceid, System.IO.Stream content, System.IO.Stream header)
+ {
bool exists = ResourceExists(resourceid);
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
byte[] bufHeader = header == null ? new byte[0] : Utility.StreamAsArray(header);
byte[] bufContent = content == null ? new byte[0] : Utility.StreamAsArray(content);
@@ -276,7 +276,7 @@
OnResourceUpdated(resourceid);
else
OnResourceAdded(resourceid);
- }
+ }
public IReader ExecuteSqlQuery(string featureSourceID, string sql)
{
@@ -286,16 +286,16 @@
return new LocalNativeSqlReader(reader);
}
- public override IFeatureReader QueryFeatureSource(string resourceID, string schema, string query, string[] columns, System.Collections.Specialized.NameValueCollection computedProperties)
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
- MgFeatureQueryOptions mgf = new MgFeatureQueryOptions();
- if (query != null)
- mgf.SetFilter(query);
+ public override IFeatureReader QueryFeatureSource(string resourceID, string schema, string query, string[] columns, System.Collections.Specialized.NameValueCollection computedProperties)
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ MgFeatureQueryOptions mgf = new MgFeatureQueryOptions();
+ if (query != null)
+ mgf.SetFilter(query);
- if (columns != null && columns.Length != 0)
- foreach(string s in columns)
- mgf.AddFeatureProperty(s);
+ if (columns != null && columns.Length != 0)
+ foreach(string s in columns)
+ mgf.AddFeatureProperty(s);
if (computedProperties != null && computedProperties.Count > 0)
foreach (string s in computedProperties.Keys)
@@ -305,8 +305,8 @@
LogMethodCall("MgFeatureService::SelectFeatures", true, resourceID, schema, "MgFeatureQueryOptions");
- return new LocalNativeFeatureReader(mr);
- }
+ return new LocalNativeFeatureReader(mr);
+ }
private IReader AggregateQueryFeatureSourceCore(string resourceID, string schema, string query, string[] columns, System.Collections.Specialized.NameValueCollection computedProperties)
{
@@ -341,14 +341,14 @@
}
protected override FeatureSourceDescription DescribeFeatureSourceInternal(string resourceID)
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
- System.IO.MemoryStream ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(fes.DescribeSchemaAsXml(new MgResourceIdentifier(resourceID), "")));
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ System.IO.MemoryStream ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(fes.DescribeSchemaAsXml(new MgResourceIdentifier(resourceID), "")));
LogMethodCall("MgFeatureService::DescribeSchemaAsXml", true, resourceID, "");
- return new FeatureSourceDescription(ms);
- }
+ return new FeatureSourceDescription(ms);
+ }
public override FeatureSchema DescribeFeatureSourcePartial(string resourceID, string schema, string[] classNames)
{
@@ -365,28 +365,28 @@
}
public override FeatureSchema DescribeFeatureSource(string resourceID, string schema)
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
if (schema != null && schema.IndexOf(":") > 0)
schema = schema.Split(':')[0];
- System.IO.MemoryStream ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(fes.DescribeSchemaAsXml(new MgResourceIdentifier(resourceID), schema)));
+ System.IO.MemoryStream ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(fes.DescribeSchemaAsXml(new MgResourceIdentifier(resourceID), schema)));
LogMethodCall("MgFeatureService::DescribeSchemaAsXml", true, resourceID, schema);
return new FeatureSourceDescription(ms).Schemas[0];
- }
+ }
- public void DeleteResourceData(string resourceID, string dataname)
- {
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
- res.DeleteResourceData(new MgResourceIdentifier(resourceID), dataname);
+ public void DeleteResourceData(string resourceID, string dataname)
+ {
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ res.DeleteResourceData(new MgResourceIdentifier(resourceID), dataname);
LogMethodCall("MgResourceService::DeleteResourceData", true, resourceID, dataname);
- }
+ }
- public ResourceDataList EnumerateResourceData(string resourceID)
- {
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ public ResourceDataList EnumerateResourceData(string resourceID)
+ {
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
GetByteReaderMethod fetch = () =>
{
MgResourceIdentifier resId = new MgResourceIdentifier(resourceID);
@@ -394,24 +394,24 @@
};
LogMethodCall("MgResourceService::EnumerateResourceData", true, resourceID);
return base.DeserializeObject<ResourceDataList>(new MgReadOnlyStream(fetch));
- }
+ }
- public override void DeleteResource(string resourceID)
- {
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
- res.DeleteResource(new MgResourceIdentifier(resourceID));
+ public override void DeleteResource(string resourceID)
+ {
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ res.DeleteResource(new MgResourceIdentifier(resourceID));
LogMethodCall("MgResourceService::DeleteResource", true, resourceID);
OnResourceDeleted(resourceID);
- }
+ }
private Version m_siteVersion;
- public override Version SiteVersion
- {
- get
- {
+ public override Version SiteVersion
+ {
+ get
+ {
#if MG220
return SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS2_2);
#elif MG210
@@ -456,7 +456,7 @@
return m_siteVersion;
#endif
}
- }
+ }
private LocalNativeMpuCalculator m_calc;
@@ -472,7 +472,7 @@
//TODO: Figure out a strategy for cache invalidation
public ICoordinateSystemCatalog CoordinateSystemCatalog
- {
+ {
get
{
if (this.SiteVersion < OSGeo.MapGuide.MaestroAPI.SiteVersions.GetVersion(OSGeo.MapGuide.MaestroAPI.KnownSiteVersions.MapGuideOS1_2))
@@ -486,17 +486,17 @@
}
}
- public string DisplayName
- {
- get
- {
- return this.Connection.GetSite().GetCurrentSiteAddress();
- }
- }
+ public string DisplayName
+ {
+ get
+ {
+ return this.Connection.GetSite().GetCurrentSiteAddress();
+ }
+ }
- public override ResourceReferenceList EnumerateResourceReferences(string resourceid)
- {
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ public override ResourceReferenceList EnumerateResourceReferences(string resourceid)
+ {
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
GetByteReaderMethod fetch = () =>
{
MgResourceIdentifier resId = new MgResourceIdentifier(resourceid);
@@ -504,14 +504,14 @@
};
LogMethodCall("MgResourceService::EnumerateReferences", true, resourceid);
return base.DeserializeObject<ResourceReferenceList>(new MgReadOnlyStream(fetch));
- }
+ }
- public override void CopyResource(string oldpath, string newpath, bool overwrite)
- {
+ public override void CopyResource(string oldpath, string newpath, bool overwrite)
+ {
bool exists = ResourceExists(newpath);
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
- res.CopyResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ res.CopyResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
LogMethodCall("MgResourceService::CopyResource", true, oldpath, newpath, overwrite.ToString());
@@ -519,19 +519,19 @@
OnResourceUpdated(newpath);
else
OnResourceAdded(newpath);
- }
+ }
- public override void CopyFolder(string oldpath, string newpath, bool overwrite)
- {
+ public override void CopyFolder(string oldpath, string newpath, bool overwrite)
+ {
bool exists = ResourceExists(newpath);
- if (!oldpath.EndsWith("/"))
- oldpath += "/";
- if (!newpath.EndsWith("/"))
- newpath += "/";
+ if (!oldpath.EndsWith("/"))
+ oldpath += "/";
+ if (!newpath.EndsWith("/"))
+ newpath += "/";
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
- res.CopyResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ res.CopyResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
LogMethodCall("MgResourceService::CopyResource", true, oldpath, newpath, overwrite.ToString());
@@ -539,14 +539,14 @@
OnResourceUpdated(newpath);
else
OnResourceAdded(newpath);
- }
+ }
- public override void MoveResource(string oldpath, string newpath, bool overwrite)
- {
+ public override void MoveResource(string oldpath, string newpath, bool overwrite)
+ {
bool exists = ResourceExists(newpath);
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
- res.MoveResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ res.MoveResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
LogMethodCall("MgResourceService::MoveResource", true, oldpath, newpath, overwrite.ToString());
@@ -555,19 +555,19 @@
OnResourceUpdated(newpath);
else
OnResourceAdded(newpath);
- }
+ }
- public override void MoveFolder(string oldpath, string newpath, bool overwrite)
- {
+ public override void MoveFolder(string oldpath, string newpath, bool overwrite)
+ {
bool exists = ResourceExists(newpath);
- if (!oldpath.EndsWith("/"))
- oldpath += "/";
- if (!newpath.EndsWith("/"))
- newpath += "/";
+ if (!oldpath.EndsWith("/"))
+ oldpath += "/";
+ if (!newpath.EndsWith("/"))
+ newpath += "/";
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
- res.MoveResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ res.MoveResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
LogMethodCall("MgResourceService::MoveResource", true, oldpath, newpath, overwrite.ToString());
@@ -576,30 +576,30 @@
OnResourceUpdated(newpath);
else
OnResourceAdded(newpath);
- }
+ }
public override System.IO.Stream RenderRuntimeMap(RuntimeMap rtmap, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
- {
+ {
var resourceId = rtmap.ResourceID;
- MgRenderingService rnd = this.Connection.CreateService(MgServiceType.RenderingService) as MgRenderingService;
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
- MgGeometryFactory gf = new MgGeometryFactory();
+ MgRenderingService rnd = this.Connection.CreateService(MgServiceType.RenderingService) as MgRenderingService;
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ MgGeometryFactory gf = new MgGeometryFactory();
- string mapname = new ResourceIdentifier(resourceId).Path;
+ string mapname = new ResourceIdentifier(resourceId).Path;
GetByteReaderMethod fetch = () =>
{
MgMap map = new MgMap();
- map.Open(res, mapname);
- MgSelection sel = new MgSelection(map);
+ map.Open(res, mapname);
+ MgSelection sel = new MgSelection(map);
//The color accepted by MgColor has alpha as the last value, but the returned has alpha first
- MgColor color = new MgColor(Utility.ParseHTMLColor(map.GetBackgroundColor()));
+ MgColor color = new MgColor(Utility.ParseHTMLColor(map.GetBackgroundColor()));
MgCoordinate coord = gf.CreateCoordinateXY(x, y);
return rnd.RenderMap(map, sel, coord, scale, width, height, color, format, true);
};
LogMethodCall("MgRenderingService::RenderMap", true, "MgMap", "MgSelection", "MgPoint("+ x + "," + y + ")", scale.ToString(), width.ToString(), height.ToString(), "MgColor", format, true.ToString());
return new MgReadOnlyStream(fetch);
- }
+ }
public override System.IO.Stream RenderRuntimeMap(RuntimeMap rtmap, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
{
@@ -684,21 +684,21 @@
return new MgReadOnlyStream(fetch);
}
- public override bool IsSessionExpiredException(Exception ex)
- {
- return ex != null && ex.GetType() == typeof(OSGeo.MapGuide.MgSessionExpiredException) || ex.GetType() == typeof(OSGeo.MapGuide.MgSessionNotFoundException);
- }
+ public override bool IsSessionExpiredException(Exception ex)
+ {
+ return ex != null && ex.GetType() == typeof(OSGeo.MapGuide.MgSessionExpiredException) || ex.GetType() == typeof(OSGeo.MapGuide.MgSessionNotFoundException);
+ }
- /// <summary>
- /// Returns the spatial info for a given featuresource
- /// </summary>
- /// <param name="resourceID">The ID of the resource to query</param>
- /// <param name="activeOnly">Query only active items</param>
- /// <returns>A list of spatial contexts</returns>
- public override FdoSpatialContextList GetSpatialContextInfo(string resourceID, bool activeOnly)
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
- MgSpatialContextReader rd = fes.GetSpatialContexts(new MgResourceIdentifier(resourceID), activeOnly);
+ /// <summary>
+ /// Returns the spatial info for a given featuresource
+ /// </summary>
+ /// <param name="resourceID">The ID of the resource to query</param>
+ /// <param name="activeOnly">Query only active items</param>
+ /// <returns>A list of spatial contexts</returns>
+ public override FdoSpatialContextList GetSpatialContextInfo(string resourceID, bool activeOnly)
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ MgSpatialContextReader rd = fes.GetSpatialContexts(new MgResourceIdentifier(resourceID), activeOnly);
GetByteReaderMethod fetch = () =>
{
@@ -706,24 +706,24 @@
};
LogMethodCall("MgFeatureService::GetSpatialContexts", true, resourceID, activeOnly.ToString());
return base.DeserializeObject<FdoSpatialContextList>(new MgReadOnlyStream(fetch));
- }
+ }
- /// <summary>
- /// Gets the names of the identity properties from a feature
- /// </summary>
- /// <param name="resourceID">The resourceID for the FeatureSource</param>
- /// <param name="classname">The classname of the feature, including schema</param>
- /// <returns>A string array with the found identities</returns>
- public override string[] GetIdentityProperties(string resourceID, string classname)
- {
- MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
- string[] parts = classname.Split(':');
+ /// <summary>
+ /// Gets the names of the identity properties from a feature
+ /// </summary>
+ /// <param name="resourceID">The resourceID for the FeatureSource</param>
+ /// <param name="classname">The classname of the feature, including schema</param>
+ /// <returns>A string array with the found identities</returns>
+ public override string[] GetIdentityProperties(string resourceID, string classname)
+ {
+ MgFeatureService fes = this.Connection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
+ string[] parts = classname.Split(':');
MgResourceIdentifier resId = new MgResourceIdentifier(resourceID);
-
- if (parts.Length == 1)
- parts = new string[] { classname };
- else if (parts.Length != 2)
- throw new Exception("Unable to parse classname into class and schema: " + classname);
+
+ if (parts.Length == 1)
+ parts = new string[] { classname };
+ else if (parts.Length != 2)
+ throw new Exception("Unable to parse classname into class and schema: " + classname);
MgClassDefinition cls = fes.GetClassDefinition(resId, parts[0], parts[1]);
if (cls == null)
@@ -737,57 +737,57 @@
res[i] = (props[i] as MgProperty).Name;
return res;
- }
+ }
- /// <summary>
- /// Restarts the server session, and creates a new session ID
- /// </summary>
- /// <param name="throwException">If set to true, the call throws an exception if the call failed</param>
- /// <returns>True if the creation succeed, false otherwise</returns>
- protected override bool RestartSessionInternal(bool throwException)
- {
- if (m_username == null || m_password == null)
- if (throwException)
- throw new Exception("Cannot recreate session, because connection was not opened with username and password");
- else
- return false;
+ /// <summary>
+ /// Restarts the server session, and creates a new session ID
+ /// </summary>
+ /// <param name="throwException">If set to true, the call throws an exception if the call failed</param>
+ /// <returns>True if the creation succeed, false otherwise</returns>
+ protected override bool RestartSessionInternal(bool throwException)
+ {
+ if (m_username == null || m_password == null)
+ if (throwException)
+ throw new Exception("Cannot recreate session, because connection was not opened with username and password");
+ else
+ return false;
- try
- {
- MgUserInformation mgui = new MgUserInformation(m_username, m_password);
- if (m_locale != null)
- mgui.SetLocale(m_locale);
- else
- mgui.SetLocale("en");
- MgSiteConnection con = new MgSiteConnection();
- con.Open(mgui);
- string s = con.GetSite().CreateSession();
- if (s == null || s.Trim().Length == 0)
- throw new Exception("Failed to retrieve new session identifier");
+ try
+ {
+ MgUserInformation mgui = new MgUserInformation(m_username, m_password);
+ if (m_locale != null)
+ mgui.SetLocale(m_locale);
+ else
+ mgui.SetLocale("en");
+ MgSiteConnection con = new MgSiteConnection();
+ con.Open(mgui);
+ string s = con.GetSite().CreateSession();
+ if (s == null || s.Trim().Length == 0)
+ throw new Exception("Failed to retrieve new session identifier");
- m_sessionId = s;
- m_con = con;
- return true;
- }
- catch
- {
- if (throwException)
- throw;
- else
- return false;
- }
- }
+ m_sessionId = s;
+ m_con = con;
+ return true;
+ }
+ catch
+ {
+ if (throwException)
+ throw;
+ else
+ return false;
+ }
+ }
- /// <summary>
- /// Enumerates all unmanaged folders, meaning alias'ed folders
- /// </summary>
- /// <param name="type">The type of data to return</param>
- /// <param name="filter">A filter applied to the items</param>
- /// <param name="recursive">True if the list should contains recursive results</param>
- /// <param name="startpath">The path to retrieve the data from</param>
- /// <returns>A list of unmanaged data</returns>
- public override UnmanagedDataList EnumerateUnmanagedData(string startpath, string filter, bool recursive, UnmanagedDataTypes type)
- {
+ /// <summary>
+ /// Enumerates all unmanaged folders, meaning alias'ed folders
+ /// </summary>
+ /// <param name="type">The type of data to return</param>
+ /// <param name="filter">A filter applied to the items</param>
+ /// <param name="recursive">True if the list should contains recursive results</param>
+ /// <param name="startpath">The path to retrieve the data from</param>
+ /// <returns>A list of unmanaged data</returns>
+ public override UnmanagedDataList EnumerateUnmanagedData(string startpath, string filter, bool recursive, UnmanagedDataTypes type)
+ {
MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
GetByteReaderMethod fetch = () =>
{
@@ -795,7 +795,7 @@
};
LogMethodCall("MgResourceService::EnumerateUnmanagedData", true, startpath, recursive, type.ToString(), filter);
return base.DeserializeObject<UnmanagedDataList>(new MgReadOnlyStream(fetch));
- }
+ }
public override void UpdateRepository(string resourceId, ResourceFolderHeaderType header)
{
@@ -818,7 +818,7 @@
public override object GetFolderOrResourceHeader(string resourceID)
{
- MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
+ MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
GetByteReaderMethod fetch = () =>
{
MgResourceIdentifier resId = new MgResourceIdentifier(resourceID);
Property changes on: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest
___________________________________________________________________
Added: svn:ignore
+ bin
obj
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/OSGeo.MapGuide.MaestroAPI.Rest.csproj
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/OSGeo.MapGuide.MaestroAPI.Rest.csproj (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/OSGeo.MapGuide.MaestroAPI.Rest.csproj 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{F112D03D-797B-4E31-ACE5-EBB412EB08BD}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>OSGeo.MapGuide.MaestroAPI.Rest</RootNamespace>
+ <AssemblyName>OSGeo.MapGuide.MaestroAPI.Rest</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\Maestro\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\SDK\bin\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\SDK\bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="RestSharp">
+ <HintPath>..\Maestro\packages\RestSharp.105.0.1\lib\net4-client\RestSharp.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="RestCapabilities.cs" />
+ <Compile Include="RestConnection.cs" />
+ <Compile Include="RestCoordinateSystemCatalog.cs" />
+ <Compile Include="RestCoordinateSystemCategory.cs" />
+ <Compile Include="RestCoordinateSystemDefinition.cs" />
+ <Compile Include="RestException.cs" />
+ <Compile Include="Strings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Strings.resx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\OSGeo.MapGuide.MaestroAPI\OSGeo.MapGuide.MaestroAPI.csproj">
+ <Project>{80fa3158-8b5f-48d1-a393-0378afe48a7e}</Project>
+ <Name>OSGeo.MapGuide.MaestroAPI</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Strings.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Strings.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+ <PropertyGroup>
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+ </PropertyGroup>
+ <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
+ </Target>
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Properties/AssemblyInfo.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Properties/AssemblyInfo.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,24 @@
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Rest;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OSGeo.MapGuide.MaestroAPI.Rest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyProduct("OSGeo.MapGuide.MaestroAPI.Rest")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b4e157a5-d3ff-482a-88ad-a353906ac919")]
+
+[assembly: MaestroApiProvider("Maestro.Rest", "Maestro mapguide-rest API Provider", typeof(RestConnection), true, false)]
\ No newline at end of file
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCapabilities.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCapabilities.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCapabilities.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,60 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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 OSGeo.MapGuide.MaestroAPI.Capability;
+using OSGeo.MapGuide.MaestroAPI.Commands;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Rest
+{
+ public class RestCapabilities : ConnectionCapabilities
+ {
+ internal RestCapabilities(IServerConnection parent) : base(parent)
+ {
+
+ }
+
+ public override int[] SupportedCommands
+ {
+ get
+ {
+ return new int[]
+ {
+ (int)CommandType.DescribeRuntimeMap,
+ (int)CommandType.DeleteFeatures,
+ (int)CommandType.InsertFeature,
+ (int)CommandType.UpdateFeatures
+ };
+ }
+ }
+
+ public override bool SupportsResourcePreviews
+ {
+ get { return true; }
+ }
+
+ public override bool IsMultithreaded
+ {
+ get { return false; }
+ }
+ }
+}
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestConnection.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestConnection.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,1076 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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 OSGeo.MapGuide.MaestroAPI.Resource;
+using OSGeo.MapGuide.MaestroAPI.Schema;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using OSGeo.MapGuide.ObjectModels.Capabilities;
+using OSGeo.MapGuide.ObjectModels.Common;
+using RestSharp;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Rest
+{
+ /// <summary>
+ /// RestConnection providers a IServerConnection interface to the mapguide-rest REST API
+ /// </summary>
+ public class RestConnection : MgServerConnectionBase,
+ IServerConnection,
+ IFeatureService,
+ IResourceService
+ {
+ public const string PARAM_URL = "Url";
+ public const string PARAM_USERNAME = "Username";
+ public const string PARAM_PASSWORD = "Password";
+
+ private string _restRootUrl;
+
+ internal RestClient MakeClient()
+ {
+ return new RestClient(_restRootUrl);
+ }
+
+ private RestRequest MakeRequest(string part, Method method = Method.GET)
+ {
+ var req = new RestRequest(part, method);
+ req.AddParameter("session", this.SessionID);
+ return req;
+ }
+
+ private void LogResponse(IRestResponse resp)
+ {
+ OnRequestDispatched(string.Format("{0} {1} - {2}", resp.Request.Method, resp.Request.Resource, resp.StatusCode));
+ }
+
+ private IRestResponse ExecuteRequest(RestClient client, IRestRequest req)
+ {
+ var resp = client.Execute(req);
+ LogResponse(resp);
+ return resp;
+ }
+
+ private IRestResponse<T> ExecuteRequest<T>(RestClient client, IRestRequest req) where T : class, new()
+ {
+ var resp = client.Execute<T>(req);
+ LogResponse(resp);
+ return resp;
+ }
+
+ internal RestConnection()
+ {
+
+ }
+
+ //This is the constructor used by ConnectionProviderRegistry.CreateConnection
+
+ internal RestConnection(NameValueCollection initParams)
+ : this()
+ {
+ if (initParams[PARAM_URL] == null)
+ throw new ArgumentException("Missing required connection parameter: " + PARAM_URL);
+
+ string pwd = initParams[PARAM_PASSWORD] ?? string.Empty;
+ if (initParams[PARAM_USERNAME] == null)
+ throw new ArgumentException("Missing required connection parameter: " + PARAM_USERNAME);
+
+ _restRootUrl = initParams[PARAM_URL];
+ m_username = initParams[PARAM_USERNAME];
+ m_password = pwd;
+
+ var client = MakeClient();
+ client.Authenticator = new HttpBasicAuthenticator(m_username, m_password);
+
+ var req = new RestRequest("session", Method.POST);
+ var resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ _sessionId = resp.Content;
+ CheckAndRaiseSessionChanged(null, _sessionId);
+
+ lock (SyncRoot)
+ {
+ req = MakeRequest("site/version", Method.GET);
+ req.AddParameter("session", _sessionId);
+
+ resp = ExecuteRequest(client, req);
+
+ _siteVersion = new Version(resp.Content);
+ _providers = null;
+ }
+ }
+
+ public override string ProviderName
+ {
+ get { return "Maestro.Rest"; }
+ }
+
+ public override System.Collections.Specialized.NameValueCollection CloneParameters
+ {
+ get
+ {
+ var nvc = new NameValueCollection();
+ nvc[PARAM_URL] = _restRootUrl;
+ nvc[CommandLineArguments.Provider] = this.ProviderName;
+ nvc[CommandLineArguments.Session] = this.SessionID;
+ return nvc;
+ }
+ }
+
+ private string _sessionId;
+
+ public override string SessionID
+ {
+ get
+ {
+ return _sessionId;
+ }
+ }
+
+ protected override IServerConnection GetInterface()
+ {
+ return this;
+ }
+
+ public override void Dispose()
+ {
+
+ }
+
+ public override IServerConnection Clone()
+ {
+ return new RestConnection();
+ }
+
+ internal void ValidateResponse(IRestResponse resp)
+ {
+ int status = (int)resp.StatusCode;
+ //Throw if status code is not in the 200-series
+ if (status < 200 || status > 299)
+ throw new RestServiceException(resp.Content, resp.ContentType);
+ }
+
+ private System.IO.Stream FetchRuntimeMapRepresentationAsStream(Mapping.RuntimeMap rtMap, string representationSuffix)
+ {
+ return FetchRuntimeMapRepresentationAsStream(rtMap, representationSuffix, null);
+ }
+
+ private System.IO.Stream FetchRuntimeMapRepresentationAsStream(Mapping.RuntimeMap rtMap, string representationSuffix, Action<IRestRequest> applyParametersCallback)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("session/{sessionId}/{mapName}.Map" + representationSuffix, Method.GET);
+ req.AddUrlSegment("sessionId", rtMap.SessionId);
+ req.AddUrlSegment("mapName", rtMap.Name);
+ if (applyParametersCallback != null)
+ applyParametersCallback(req);
+
+ //NOTE: RestSharp either doesn't support streamed responses or they do and it is not compatible with our current API signatures
+ return new MemoryStream(client.DownloadData(req));
+ }
+
+ private T FetchRuntimeMapRepresentation<T>(Mapping.RuntimeMap rtMap, string representationSuffix) where T : class, new()
+ {
+ return FetchRuntimeMapRepresentation<T>(rtMap, representationSuffix, null);
+ }
+
+ private T FetchRuntimeMapRepresentation<T>(Mapping.RuntimeMap rtMap, string representationSuffix, Action<IRestRequest> applyParametersCallback) where T : class, new()
+ {
+ var client = MakeClient();
+ var req = MakeRequest("session/{sessionId}/{mapName}.Map" + representationSuffix, Method.GET);
+ req.AddUrlSegment("sessionId", rtMap.SessionId);
+ req.AddUrlSegment("mapName", rtMap.Name);
+ if (applyParametersCallback != null)
+ applyParametersCallback(req);
+
+ IRestResponse<T> resp = ExecuteRequest<T>(client, req);
+ ValidateResponse(resp);
+ return GetData(resp);
+ }
+
+ private string FetchResourceRepresentationAsString(string resourceid, string representationSuffix)
+ {
+ return FetchResourceRepresentationAsString(resourceid, representationSuffix, null);
+ }
+
+ private string FetchResourceRepresentationAsString(string resourceid, string representationSuffix, Action<IRestRequest> applyParametersCallback)
+ {
+ var client = MakeClient();
+ ResourceIdentifier ri = new ResourceIdentifier(resourceid);
+ RestRequest req = null;
+ if (ri.IsInLibrary)
+ {
+ req = MakeRequest("library/{resourcePath}" + representationSuffix, Method.GET);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddParameter("session", this.SessionID);
+ if (applyParametersCallback != null)
+ applyParametersCallback(req);
+ }
+ else //session
+ {
+ req = MakeRequest("session/{sessionId}/{resourcePath}" + representationSuffix, Method.GET);
+ req.AddUrlSegment("sessionId", this.SessionID);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ if (applyParametersCallback != null)
+ applyParametersCallback(req);
+ }
+
+ //NOTE: RestSharp either doesn't support streamed responses or they do and it is not compatible with our current API signatures
+ var resp = ExecuteRequest(client, req);
+ return resp.Content;
+ }
+
+ private System.IO.Stream FetchResourceRepresentationAsStream(string resourceid, string representationSuffix)
+ {
+ return FetchResourceRepresentationAsStream(resourceid, representationSuffix, null);
+ }
+
+ private System.IO.Stream FetchResourceRepresentationAsStream(string resourceid, string representationSuffix, Action<IRestRequest> applyParametersCallback)
+ {
+ var client = MakeClient();
+ ResourceIdentifier ri = new ResourceIdentifier(resourceid);
+ RestRequest req = null;
+ if (ri.IsInLibrary)
+ {
+ req = MakeRequest("library/{resourcePath}" + representationSuffix, Method.GET);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddParameter("session", this.SessionID);
+ if (applyParametersCallback != null)
+ applyParametersCallback(req);
+ }
+ else //session
+ {
+ req = MakeRequest("session/{sessionId}/{resourcePath}" + representationSuffix, Method.GET);
+ req.AddUrlSegment("sessionId", this.SessionID);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ if (applyParametersCallback != null)
+ applyParametersCallback(req);
+ }
+
+ //NOTE: RestSharp either doesn't support streamed responses or they do and it is not compatible with our current API signatures
+ return new MemoryStream(client.DownloadData(req));
+ }
+
+ private T FetchResourceRepresentation<T>(string resourceid, string representationSuffix) where T : class, new()
+ {
+ return FetchResourceRepresentation<T>(resourceid, representationSuffix, null);
+ }
+
+ private T FetchResourceRepresentation<T>(string resourceid, string representationSuffix, Action<IRestRequest> applyParametersCallback) where T : class, new()
+ {
+ var client = MakeClient();
+ ResourceIdentifier ri = new ResourceIdentifier(resourceid);
+ RestRequest req = null;
+ if (ri.IsInLibrary)
+ {
+ req = MakeRequest("library/{resourcePath}" + representationSuffix, Method.GET);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddParameter("session", this.SessionID);
+ if (applyParametersCallback != null)
+ applyParametersCallback(req);
+ }
+ else //session
+ {
+ req = MakeRequest("session/{sessionId}/{resourcePath}" + representationSuffix, Method.GET);
+ req.AddUrlSegment("sessionId", this.SessionID);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ if (applyParametersCallback != null)
+ applyParametersCallback(req);
+ }
+
+ IRestResponse<T> resp = ExecuteRequest<T>(client, req);
+ ValidateResponse(resp);
+ return GetData(resp);
+ }
+
+ public override System.IO.Stream GetResourceXmlData(string resourceID)
+ {
+ return FetchResourceRepresentationAsStream(resourceID, "/content.xml");
+ }
+
+ public override void DeleteResource(string resourceid)
+ {
+ var client = MakeClient();
+ ResourceIdentifier ri = new ResourceIdentifier(resourceid);
+ RestRequest req = null;
+ if (ri.IsInLibrary)
+ {
+ req = MakeRequest("library/{resourcePath}", Method.DELETE);
+ req.AddParameter("session", this.SessionID);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ }
+ else //session
+ {
+ req = MakeRequest("session/{sessionId}/{resourcePath}", Method.DELETE);
+ req.AddUrlSegment("sessionId", this.SessionID);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ }
+
+ IRestResponse resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ }
+
+ private T GetData<T>(IRestResponse<T> resp)
+ {
+ //HACK: It seems we can't trust RestSharp to properly deserialize the XML content
+ //(ie. The .Data property will not be what we expect) so delegate to our existing deserializer
+ using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(resp.Content)))
+ {
+ return DeserializeObject<T>(ms);
+ }
+ }
+
+ public override ResourceList GetRepositoryResources(string startingpoint, string type, int depth, bool computeChildren)
+ {
+ Check.IsFolderArgument(startingpoint, "startingpoint");
+ ResourceIdentifier ri = new ResourceIdentifier(startingpoint);
+ if (ri.IsInSessionRepository)
+ {
+ //Can't enumerate session folders
+ throw new NotSupportedException();
+ }
+ else
+ {
+ if (startingpoint == "Library://")
+ {
+ var req = MakeRequest("library/list.xml", Method.GET);
+ req.AddParameter("session", this.SessionID);
+ req.AddParameter("type", type);
+ req.AddParameter("depth", depth);
+ req.AddParameter("computechildren", computeChildren ? 1 : 0);
+
+ var client = MakeClient();
+ IRestResponse<ResourceList> resp = ExecuteRequest<ResourceList>(client, req);
+ ValidateResponse(resp);
+ return GetData(resp);
+ }
+ else
+ {
+ return FetchResourceRepresentation<ResourceList>(startingpoint, "/list.xml", (req) =>
+ {
+ req.AddParameter("type", type);
+ req.AddParameter("depth", depth);
+ req.AddParameter("computechildren", computeChildren ? 1 : 0);
+ });
+ }
+ }
+ }
+
+ public override ResourceReferenceList EnumerateResourceReferences(string resourceid)
+ {
+ return FetchResourceRepresentation<ResourceReferenceList>(resourceid, "/references.xml");
+ }
+
+ public override void CopyResource(string oldpath, string newpath, bool overwrite)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("services/copyresource", Method.POST);
+ req.AddParameter("source", oldpath);
+ req.AddParameter("destination", newpath);
+ req.AddParameter("overwrite", overwrite ? 1 : 0);
+ var resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ }
+
+ public override void CopyFolder(string oldpath, string newpath, bool overwrite)
+ {
+ Check.IsFolderArgument(oldpath, "oldpath");
+ Check.IsFolderArgument(newpath, "newpath");
+ CopyResource(oldpath, newpath, overwrite);
+ }
+
+ public override void MoveResource(string oldpath, string newpath, bool overwrite)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("services/moveresource", Method.POST);
+ req.AddParameter("source", oldpath);
+ req.AddParameter("destination", newpath);
+ req.AddParameter("overwrite", overwrite ? 1 : 0);
+ req.AddParameter("cascade", 1);
+ var resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ }
+
+ public override void MoveFolder(string oldpath, string newpath, bool overwrite)
+ {
+ Check.IsFolderArgument(oldpath, "oldpath");
+ Check.IsFolderArgument(newpath, "newpath");
+ MoveResource(oldpath, newpath, overwrite);
+ }
+
+ public override System.IO.Stream GetResourceData(string resourceID, string dataname)
+ {
+ return FetchResourceRepresentationAsStream(resourceID, "/data/{dataName}", (req) =>
+ {
+ req.AddUrlSegment("dataName", dataname);
+ });
+ }
+
+ public override void SetResourceData(string resourceid, string dataname, ResourceDataType datatype, System.IO.Stream stream, Utility.StreamCopyProgressDelegate callback)
+ {
+ var client = MakeClient();
+ ResourceIdentifier ri = new ResourceIdentifier(resourceid);
+ RestRequest req = null;
+ if (ri.IsInLibrary)
+ {
+ req = MakeRequest("library/{resourcePath}/data/{dataName}", Method.DELETE);
+ req.AddParameter("session", this.SessionID);
+ req.AddParameter("datatype", datatype.ToString());
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddUrlSegment("dataName", dataname);
+ req.AddFile("file", (os) => {
+ Utility.CopyStream(stream, os, callback, 1024);
+ }, dataname);
+ }
+ else //session
+ {
+ req = MakeRequest("session/{sessionId}/{resourcePath}", Method.DELETE);
+ req.AddUrlSegment("sessionId", this.SessionID);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddParameter("datatype", datatype.ToString());
+ req.AddFile("file", (os) =>
+ {
+ Utility.CopyStream(stream, os, callback, 1024);
+ }, dataname);
+ }
+
+ IRestResponse resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ }
+
+ public override void UploadPackage(string filename, Utility.StreamCopyProgressDelegate callback)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("library");
+ req.AddFile("package", (os) => {
+ using (var fr = File.OpenRead(filename))
+ {
+ Utility.CopyStream(fr, os, callback, 1024);
+ }
+ }, filename);
+ IRestResponse resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ }
+
+ public override void UpdateRepository(string resourceId, ResourceFolderHeaderType header)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override object GetFolderOrResourceHeader(string resourceId)
+ {
+ if (ResourceIdentifier.IsFolderResource(resourceId))
+ return FetchResourceRepresentation<ResourceFolderHeaderType>(resourceId, "/header.xml");
+ else
+ return FetchResourceRepresentation<ResourceDocumentHeaderType>(resourceId, "/header.xml");
+ }
+
+ public override void SetResourceXmlData(string resourceId, System.IO.Stream content, System.IO.Stream header)
+ {
+ var client = MakeClient();
+ var ri = new ResourceIdentifier(resourceId);
+ RestRequest req = null;
+ if (ri.IsInLibrary)
+ {
+ req = MakeRequest("library/{resourcePath}/contentorheader", Method.POST);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddParameter("session", this.SessionID);
+ if (content != null)
+ {
+ req.AddFile("content", (os) =>
+ {
+ content.CopyTo(os);
+ }, "content");
+ }
+ if (header != null)
+ {
+ req.AddFile("header", (os) =>
+ {
+ header.CopyTo(os);
+ }, "header");
+ }
+ }
+ else //Session-based
+ {
+ req = MakeRequest("session/{sessionId}/{resourcePath}/contentorheader", Method.POST);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddUrlSegment("session", this.SessionID);
+ using (var sr = new StreamReader(content))
+ {
+ req.AddParameter("text/xml", sr.ReadToEnd(), ParameterType.RequestBody);
+ }
+ if (content != null)
+ {
+ req.AddFile("content", (os) =>
+ {
+ content.CopyTo(os);
+ }, "content");
+ }
+ if (header != null)
+ {
+ req.AddFile("header", (os) =>
+ {
+ header.CopyTo(os);
+ }, "header");
+ }
+ }
+ }
+
+ public override UnmanagedDataList EnumerateUnmanagedData(string startpath, string filter, bool recursive, UnmanagedDataTypes type)
+ {
+ var client = MakeClient();
+ RestRequest req = MakeRequest("services/listunmanageddata.xml", Method.POST);
+ req.AddParameter("path", startpath);
+ req.AddParameter("type", type);
+ req.AddParameter("filter", filter);
+ req.AddParameter("recursive", recursive ? 1 : 0);
+
+ IRestResponse<UnmanagedDataList> resp = ExecuteRequest<UnmanagedDataList>(client, req);
+ ValidateResponse(resp);
+ return GetData(resp);
+ }
+
+ public void DeleteResourceData(string resourceID, string dataname)
+ {
+ var client = MakeClient();
+ ResourceIdentifier ri = new ResourceIdentifier(resourceID);
+ RestRequest req = null;
+ if (ri.IsInLibrary)
+ {
+ req = MakeRequest("library/{resourcePath}/data/{dataName}", Method.DELETE);
+ req.AddParameter("session", this.SessionID);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddUrlSegment("dataName", dataname);
+ }
+ else //session
+ {
+ req = MakeRequest("session/{sessionId}/{resourcePath}/data/{dataName}", Method.DELETE);
+ req.AddUrlSegment("sessionId", this.SessionID);
+ req.AddUrlSegment("resourcePath", ri.Path + "." + ri.ResourceType);
+ req.AddUrlSegment("dataName", dataname);
+ }
+
+ IRestResponse resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ }
+
+ public ResourceDataList EnumerateResourceData(string resourceID)
+ {
+ return FetchResourceRepresentation<ResourceDataList>(resourceID, "/datalist.xml");
+ }
+
+ public override string TestConnection(string featuresource)
+ {
+ using (var sr = new StreamReader(FetchResourceRepresentationAsStream(featuresource, "/status")))
+ {
+ return sr.ReadToEnd();
+ }
+ }
+
+ private FeatureProviderRegistryFeatureProvider[] _providers;
+
+ public override FeatureProviderRegistryFeatureProvider[] FeatureProviders
+ {
+ get
+ {
+ lock(SyncRoot)
+ {
+ if (_providers != null)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("providers.xml", Method.GET);
+ var resp = ExecuteRequest<FeatureProviderRegistry>(client, req);
+ _providers = resp.Data.FeatureProvider.ToArray();
+ }
+ }
+ return _providers;
+ }
+ }
+
+ public override FdoSpatialContextList GetSpatialContextInfo(string resourceID, bool activeOnly /* unused */)
+ {
+ return FetchResourceRepresentation<FdoSpatialContextList>(resourceID, "/spatialcontexts.xml");
+ }
+
+ public override string[] GetIdentityProperties(string resourceID, string qualifiedClassName)
+ {
+ string schemaName = null;
+ string className = qualifiedClassName;
+ if (qualifiedClassName.Contains(":"))
+ {
+ string [] tokens = qualifiedClassName.Split(':');
+ if (tokens.Length == 2)
+ {
+ schemaName = tokens[0];
+ className = tokens[1];
+ }
+ }
+ var clsDef = GetClassDefinitionInternal(resourceID, schemaName, className);
+ return clsDef.IdentityProperties.Select(x => x.Name).ToArray();
+ }
+
+ public override Schema.FeatureSchema DescribeFeatureSource(string resourceID, string schema)
+ {
+ using (var xml = FetchResourceRepresentationAsStream(resourceID, "/schema.xml/{schemaName}", (req) =>
+ {
+ req.AddUrlSegment("schemaName", schema);
+ }))
+ {
+ var fsd = new FeatureSourceDescription(xml);
+ return fsd.GetSchema(schema);
+ }
+ }
+
+ public override Schema.FeatureSchema DescribeFeatureSourcePartial(string resourceID, string schema, string[] classNames)
+ {
+ using (var xml = FetchResourceRepresentationAsStream(resourceID, "/schema.xml/{schemaName}", (req) =>
+ {
+ req.AddUrlSegment("schemaName", schema);
+ req.AddParameter("classnames", string.Join(",", classNames));
+ }))
+ {
+ var fsd = new FeatureSourceDescription(xml);
+ return fsd.GetSchema(schema);
+ }
+ }
+
+ protected override Schema.FeatureSourceDescription DescribeFeatureSourceInternal(string resourceId)
+ {
+ var schemas = FetchResourceRepresentation<OSGeo.MapGuide.ObjectModels.Common.StringCollection>(resourceId, "schemas.xml");
+ if (schemas.Item.Count > 0)
+ {
+ using (var xml = FetchResourceRepresentationAsStream(resourceId, "/schema.xml/{schemaName}", (req) =>
+ {
+ req.AddUrlSegment("schemaName", schemas.Item[0]);
+ }))
+ {
+ return new FeatureSourceDescription(xml);
+ }
+ }
+ return null;
+ }
+
+ protected override Schema.ClassDefinition GetClassDefinitionInternal(string resourceId, string schemaName, string className)
+ {
+ using (var xml = FetchResourceRepresentationAsStream(resourceId, "/classdef.xml/{schemaName}/{className}"))
+ {
+ var fsd = new FeatureSourceDescription(xml);
+ //We can't just assume first class item is the one, as ones that do not take
+ //class name hints will return the full schema
+ var schema = fsd.GetSchema(schemaName);
+ if (schema != null)
+ {
+ if (schema.Classes.Count > 1)
+ {
+ ClassDefinition ret = null;
+ foreach (var cls in schema.Classes)
+ {
+ if (cls.Name == className)
+ ret = cls;
+ }
+ return ret;
+ }
+ else
+ {
+ return schema.GetClass(className);
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public override Feature.IReader AggregateQueryFeatureSource(string resourceID, string schema, string filter, string[] columns)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override Feature.IReader AggregateQueryFeatureSource(string resourceID, string schema, string filter, System.Collections.Specialized.NameValueCollection aggregateFunctions)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override DataStoreList EnumerateDataStores(string providerName, string partialConnString)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("services/enumeratedatastores", Method.POST);
+ req.AddParameter("provider", providerName);
+ req.AddParameter("connection", partialConnString);
+ var resp = ExecuteRequest<DataStoreList>(client, req);
+ return GetData(resp);
+ }
+
+ public override string[] GetSchemas(string resourceId)
+ {
+ var resp = FetchResourceRepresentation<OSGeo.MapGuide.ObjectModels.Common.StringCollection>(resourceId, "/schemas.xml");
+ if (resp.Item != null)
+ return resp.Item.ToArray();
+ else
+ return new string[0];
+ }
+
+ public override string[] GetClassNames(string resourceId, string schemaName)
+ {
+ var resp = FetchResourceRepresentation<OSGeo.MapGuide.ObjectModels.Common.StringCollection>(resourceId, "/classes.xml/{schemaName}", (req) =>
+ {
+ req.AddParameter("schemaName", schemaName);
+ });
+ if (resp.Item != null)
+ return resp.Item.ToArray();
+ else
+ return new string[0];
+ }
+
+ public override ILongTransactionList GetLongTransactions(string resourceId, bool activeOnly)
+ {
+ return FetchResourceRepresentation<FdoLongTransactionList>(resourceId, "/longtransactions", (req) =>
+ {
+ req.AddParameter("active", activeOnly ? 1 : 0);
+ });
+ }
+
+ public override SchemaOverrides.ConfigurationDocument GetSchemaMapping(string provider, string partialConnString)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("services/getschemamapping.xml", Method.GET);
+ req.AddParameter("provider", provider);
+ req.AddParameter("connection", partialConnString);
+ var resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ return SchemaOverrides.ConfigurationDocument.LoadXml(resp.Content);
+ }
+
+ public override Feature.IFeatureReader QueryFeatureSource(string resourceID, string className, string filter, string[] propertyNames, System.Collections.Specialized.NameValueCollection computedProperties)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IFdoProviderCapabilities GetProviderCapabilities(string provider)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("providers/{provider}/capabilities.xml", Method.GET);
+ req.AddUrlSegment("provider", provider);
+ var resp = ExecuteRequest<OSGeo.MapGuide.ObjectModels.Capabilities_1_1_0.FdoProviderCapabilities>(client, req);
+ ValidateResponse(resp);
+ return GetData(resp);
+ }
+
+ public string TestConnection(string providerName, NameValueCollection parameters)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("services/testconnection/{providerName}", Method.POST);
+ req.AddUrlSegment("providerName", providerName);
+ foreach (string key in parameters.Keys)
+ {
+ req.AddParameter(key, parameters[key]);
+ }
+ var resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ return resp.Content;
+ }
+
+ public string[] GetConnectionPropertyValues(string providerName, string propertyName, string partialConnectionString)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("providers/{provider}/connectvalues.xml/{property}", Method.GET);
+ req.AddUrlSegment("provider", providerName);
+ req.AddUrlSegment("property", propertyName);
+
+ req.AddParameter("session", this.SessionID);
+ req.AddParameter("connection", partialConnectionString);
+ var resp = ExecuteRequest<OSGeo.MapGuide.ObjectModels.Common.StringCollection>(client, req);
+ ValidateResponse(resp);
+ return GetData(resp).Item.ToArray();
+ }
+
+ public Feature.IReader ExecuteSqlQuery(string featureSourceID, string sql)
+ {
+ throw new NotSupportedException();
+ }
+
+ private Version _siteVersion;
+
+ public override Version SiteVersion
+ {
+ get
+ {
+ return _siteVersion;
+ }
+ }
+
+ public override string[] GetCustomPropertyNames()
+ {
+ return new string[0];
+ }
+
+ public override Type GetCustomPropertyType(string name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void SetCustomProperty(string name, object value)
+ {
+
+ }
+
+ public override object GetCustomProperty(string name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IFeatureService FeatureService
+ {
+ get { return this; }
+ }
+
+ public IResourceService ResourceService
+ {
+ get { return this; }
+ }
+
+ public IConnectionCapabilities Capabilities
+ {
+ get { return new RestCapabilities(this); }
+ }
+
+ public override bool IsSessionExpiredException(Exception ex)
+ {
+ if (ex != null && ex.GetType() == typeof(System.Net.WebException))
+ {
+ System.Net.WebException wex = (System.Net.WebException)ex;
+ if (wex.Message.ToLower().IndexOf("session expired") >= 0 || wex.Message.ToLower().IndexOf("session not found") >= 0 || wex.Message.ToLower().IndexOf("mgsessionexpiredexception") >= 0)
+ return true;
+ }
+ return false;
+ }
+
+ private readonly object SyncRoot = new object();
+
+ protected override bool RestartSessionInternal(bool throwException)
+ {
+ if (m_username == null || m_password == null)
+ if (throwException)
+ throw new Exception("Cannot recreate session, because connection was not opened with username and password");
+ else
+ return false;
+
+ string oldSessionId = _sessionId;
+
+ try
+ {
+ var client = MakeClient();
+ client.Authenticator = new HttpBasicAuthenticator(m_username, m_password);
+
+ var req = MakeRequest("session", Method.POST);
+ var resp = ExecuteRequest(client, req);
+ ValidateResponse(resp);
+ _sessionId = resp.Content;
+ CheckAndRaiseSessionChanged(oldSessionId, _sessionId);
+
+ //Reset cached items
+ lock (SyncRoot)
+ {
+ req = MakeRequest("site/version", Method.GET);
+ req.AddParameter("session", _sessionId);
+
+ resp = ExecuteRequest(client, req);
+
+ _siteVersion = new Version(resp.Content);
+ _providers = null;
+ }
+
+ return true;
+ }
+ catch
+ {
+ if (throwException)
+ throw;
+ else
+ return false;
+ }
+ }
+
+ public override SiteInformation GetSiteInfo()
+ {
+ var client = MakeClient();
+ var req = MakeRequest("site/info.xml", Method.GET);
+ req.AddParameter("session", this.SessionID);
+ var resp = ExecuteRequest<SiteInformation>(client, req);
+ return GetData(resp);
+ }
+
+ public override UserList EnumerateUsers(string group)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("site/groups/{groupName}/users.xml", Method.GET);
+ req.AddUrlSegment("groupName", group);
+ req.AddParameter("session", this.SessionID);
+ var resp = ExecuteRequest<UserList>(client, req);
+ return GetData(resp);
+ }
+
+ public override GroupList EnumerateGroups()
+ {
+ var client = MakeClient();
+ var req = MakeRequest("site/groups.xml", Method.GET);
+ req.AddParameter("session", this.SessionID);
+ var resp = ExecuteRequest<GroupList>(client, req);
+ return GetData(resp);
+ }
+
+ public override string QueryMapFeatures(Mapping.RuntimeMap rtMap, int maxFeatures, string wkt, bool persist, string selectionVariant, QueryMapOptions extraOptions)
+ {
+ var client = MakeClient();
+ var req = MakeRequest("session/{sessionId}/{mapName}.Selection", Method.PUT);
+ req.AddUrlSegment("sessionId", this.SessionID);
+ req.AddUrlSegment("mapName", rtMap.Name);
+
+ req.AddParameter("maxfeatures", maxFeatures);
+ req.AddParameter("geometry", wkt);
+ req.AddParameter("persist", persist ? 1 : 0);
+ req.AddParameter("selectionvariant", selectionVariant);
+
+ //The Maestro API signature is spec'd for the pre-2.6 QUERYMAPFEATURES
+ req.AddParameter("requestdata", 4 | 8);
+
+ if (extraOptions != null)
+ {
+ req.AddParameter("featurefilter", extraOptions.FeatureFilter);
+ req.AddParameter("layerattributefilter", (int)extraOptions.LayerAttributeFilter);
+ req.AddParameter("layernames", extraOptions.LayerNames);
+ }
+
+ var resp = ExecuteRequest(client, req);
+ return resp.Content;
+ }
+
+ public override System.Drawing.Image GetLegendImage(double scale, string layerdefinition, int themeIndex, int type, int width, int height, string format)
+ {
+ return System.Drawing.Image.FromStream(FetchResourceRepresentationAsStream(layerdefinition, "/legend/{scale}/{geomType}/{themecat}/icon.{type}", (req) =>
+ {
+ req.AddUrlSegment("scale", scale.ToString(CultureInfo.InvariantCulture));
+ req.AddUrlSegment("geomType", type.ToString(CultureInfo.InvariantCulture));
+ req.AddUrlSegment("themecat", themeIndex.ToString(CultureInfo.InvariantCulture));
+ req.AddUrlSegment("type", format.ToLower());
+
+ req.AddParameter("width", width);
+ req.AddParameter("height", height);
+ }));
+ }
+
+ public override Stream RenderRuntimeMap(Mapping.RuntimeMap map, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
+ {
+ return FetchRuntimeMapRepresentationAsStream(map, "/image.{type}", (req) =>
+ {
+ req.AddUrlSegment("type", format.ToLower());
+
+ req.AddParameter("x", x);
+ req.AddParameter("y", y);
+ req.AddParameter("scale", scale);
+ req.AddParameter("width", width);
+ req.AddParameter("height", height);
+ req.AddParameter("dpi", dpi);
+ req.AddParameter("clip", clip ? 1 : 0);
+ });
+ }
+
+ public override Stream RenderRuntimeMap(Mapping.RuntimeMap map, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
+ {
+ double x, y, scale;
+ map.ComputeCenterAndScale(x1, y1, x2, y2, width, height, out x, out y, out scale);
+
+ return FetchRuntimeMapRepresentationAsStream(map, "/image.{type}", (req) =>
+ {
+ req.AddUrlSegment("type", format.ToLower());
+ req.AddParameter("x", x);
+ req.AddParameter("y", y);
+ req.AddParameter("scale", scale);
+ req.AddParameter("width", width);
+ req.AddParameter("height", height);
+ req.AddParameter("dpi", dpi);
+ req.AddParameter("clip", clip ? 1 : 0);
+ });
+ }
+
+ public override Stream RenderDynamicOverlay(Mapping.RuntimeMap map, Mapping.MapSelection selection, string format, bool keepSelection)
+ {
+ return FetchRuntimeMapRepresentationAsStream(map, "/overlayimage.{type}", (req) =>
+ {
+ req.AddUrlSegment("type", format.ToLower());
+
+ req.AddParameter("keepselection", keepSelection ? 1 : 0);
+ });
+ }
+
+ public override Stream RenderDynamicOverlay(Mapping.RuntimeMap map, Mapping.MapSelection selection, string format, System.Drawing.Color selectionColor, int behaviour)
+ {
+ return FetchRuntimeMapRepresentationAsStream(map, "/overlayimage.{type}", (req) =>
+ {
+ req.AddUrlSegment("type", format.ToLower());
+
+ req.AddParameter("selectioncolor", Utility.SerializeHTMLColorRGBA(selectionColor, true));
+ req.AddParameter("behavior", behaviour);
+ });
+ }
+
+ public override Stream GetTile(string mapdefinition, string baselayergroup, int col, int row, int scaleindex, string format)
+ {
+ return FetchResourceRepresentationAsStream(mapdefinition, "/tile.{type}/{groupName}/{scale}/{col}/{row}", (req) =>
+ {
+ req.AddUrlSegment("type", format.ToLower());
+ req.AddUrlSegment("groupName", baselayergroup);
+ req.AddUrlSegment("scale", scaleindex.ToString(CultureInfo.InvariantCulture));
+ req.AddUrlSegment("col", col.ToString(CultureInfo.InvariantCulture));
+ req.AddUrlSegment("row", row.ToString(CultureInfo.InvariantCulture));
+ });
+ }
+
+ public IService GetService(int serviceType)
+ {
+ ServiceType st = (ServiceType)serviceType;
+ switch (st)
+ {
+ case ServiceType.Feature:
+ return this;
+ case ServiceType.Resource:
+ return this;
+ default:
+ throw new ArgumentException(string.Format(Strings.InvalidOrUnsupportedServiceType, serviceType), "serviceType");
+ }
+ }
+
+ public CoordinateSystem.ICoordinateSystemCatalog CoordinateSystemCatalog
+ {
+ get { return new RestCoordinateSystemCatalog(this); }
+ }
+
+ public string DisplayName
+ {
+ get
+ {
+ return _restRootUrl + " (v" + this.SiteVersion.ToString() + ")";
+ }
+ }
+ }
+}
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemCatalog.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemCatalog.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemCatalog.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,167 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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 OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
+using RestSharp;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OSGeo.MapGuide.MaestroAPI.Rest
+{
+ public class RestCoordinateSystemCatalog : CoordinateSystemCatalog
+ {
+ private string _libraryName;
+ private CoordinateSystemCategory[] _categories;
+ private RestConnection _conn;
+
+ internal RestCoordinateSystemCatalog(RestConnection conn)
+ {
+ _conn = conn;
+ }
+
+ public override CoordinateSystemDefinitionBase CreateEmptyCoordinateSystem()
+ {
+ return new RestCoordinateSystemDefinition();
+ }
+
+ public override CoordinateSystemCategory[] Categories
+ {
+ get
+ {
+ if (_categories == null)
+ {
+ var client = _conn.MakeClient();
+ var req = new RestRequest("coordsys/categories", Method.GET);
+ var resp = client.Execute(req);
+
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(resp.Content);
+ XmlNodeList lst = doc.SelectNodes("StringCollection/Item");
+ CoordinateSystemCategory[] data = new CoordinateSystemCategory[lst.Count];
+ for (int i = 0; i < lst.Count; i++)
+ data[i] = new RestCoordinateSystemCategory(this, lst[i].InnerText);
+ _categories = data;
+ }
+
+ return _categories;
+ }
+ }
+
+ public override string LibraryName
+ {
+ get
+ {
+ if (_libraryName == null)
+ {
+ var client = _conn.MakeClient();
+ var req = new RestRequest("coordsys/libraryName", Method.GET);
+ var resp = client.Execute(req);
+
+ _libraryName = resp.Content;
+ }
+ return _libraryName;
+ }
+ }
+
+ public override string ConvertCoordinateSystemCodeToWkt(string coordcode)
+ {
+ var client = _conn.MakeClient();
+ var req = new RestRequest("coordsys/mentor/{csCode}/wkt", Method.GET);
+ req.AddUrlSegment("csCode", coordcode);
+ var resp = client.Execute(req);
+ return resp.Content;
+ }
+
+ public override string ConvertEpsgCodeToWkt(string epsg)
+ {
+ var client = _conn.MakeClient();
+ var req = new RestRequest("coordsys/epsg/{epsg}/wkt", Method.GET);
+ req.AddUrlSegment("epsg", epsg);
+ var resp = client.Execute(req);
+ return resp.Content;
+ }
+
+ public override string ConvertWktToCoordinateSystemCode(string wkt)
+ {
+ var client = _conn.MakeClient();
+ var req = new RestRequest("coordsys/wkttomentor", Method.POST);
+ req.AddParameter("wkt", wkt);
+ var resp = client.Execute(req);
+ return resp.Content;
+ }
+
+ public override string ConvertWktToEpsgCode(string wkt)
+ {
+ var client = _conn.MakeClient();
+ var req = new RestRequest("coordsys/wkttoepsg", Method.POST);
+ req.AddParameter("wkt", wkt);
+ var resp = client.Execute(req);
+ return resp.Content;
+ }
+
+ public override CoordinateSystemDefinitionBase[] EnumerateCoordinateSystems(string category)
+ {
+ CoordinateSystemCategory cat = null;
+ foreach (CoordinateSystemCategory csc in this.Categories)
+ {
+ if (csc.Name == category)
+ {
+ cat = csc;
+ break;
+ }
+ }
+
+ if (cat == null)
+ return new CoordinateSystemDefinitionBase[0];
+
+
+ var client = _conn.MakeClient();
+ var req = new RestRequest("coordsys/category/{category}.xml", Method.POST);
+ req.AddUrlSegment("category", category);
+ var resp = client.Execute(req);
+
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(resp.Content);
+ XmlNodeList lst = doc.SelectNodes("BatchPropertyCollection/PropertyCollection");
+ CoordinateSystemDefinitionBase[] data = new CoordinateSystemDefinitionBase[lst.Count];
+ for (int i = 0; i < lst.Count; i++)
+ data[i] = new RestCoordinateSystemDefinition(cat, lst[i]);
+
+ return data;
+ }
+
+ public override bool IsValid(string wkt)
+ {
+ var client = _conn.MakeClient();
+ var req = new RestRequest("coordsys/validatewkt", Method.POST);
+ req.AddParameter("wkt", wkt);
+ var resp = client.Execute(req);
+ _conn.ValidateResponse(resp);
+ return bool.Parse(resp.Content);
+ }
+
+ public override bool IsLoaded
+ {
+ get { return _categories != null; }
+ }
+ }
+}
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemCategory.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemCategory.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemCategory.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,32 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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 OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Rest
+{
+ public class RestCoordinateSystemCategory : CoordinateSystemCategory
+ {
+ public RestCoordinateSystemCategory(ICoordinateSystemCatalog parent, string name) : base(parent, name) { }
+ }
+}
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemDefinition.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestCoordinateSystemDefinition.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,68 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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 OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OSGeo.MapGuide.MaestroAPI.Rest
+{
+ public class RestCoordinateSystemDefinition : CoordinateSystemDefinitionBase
+ {
+ internal RestCoordinateSystemDefinition() { }
+
+ internal RestCoordinateSystemDefinition(CoordinateSystemCategory parent, XmlNode topnode)
+ : base(parent)
+ {
+ foreach (XmlNode node in topnode.ChildNodes)
+ {
+ switch (node["Name"].InnerText.ToLower())
+ {
+ case "code":
+ m_code = node["Value"].InnerText;
+ break;
+ case "description":
+ m_description = node["Value"].InnerText;
+ break;
+ case "projection":
+ m_projection = node["Value"].InnerText;
+ break;
+ case "projection description":
+ m_projectionDescription = node["Value"].InnerText;
+ break;
+ case "Datum":
+ m_datum = node["Value"].InnerText;
+ break;
+ case "datum description":
+ m_datumDescription = node["Value"].InnerText;
+ break;
+ case "ellipsoid":
+ m_ellipsoid = node["Value"].InnerText;
+ break;
+ case "ellipsoid description":
+ m_ellipsoidDescription = node["Value"].InnerText;
+ break;
+ }
+ }
+ }
+ }
+}
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestException.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestException.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/RestException.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,48 @@
+#region Disclaimer / License
+// Copyright (C) 2014, 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.Linq;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Rest
+{
+ [Serializable]
+ public class RestServiceException : Exception
+ {
+ private string content;
+ private string mimeType;
+
+ public RestServiceException() { }
+ public RestServiceException(string message) : base(message) { }
+ public RestServiceException(string message, Exception inner) : base(message, inner) { }
+ protected RestServiceException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context) { }
+
+ public RestServiceException(string content, string mimeType)
+ {
+ // TODO: Complete member initialization
+ this.content = content;
+ this.mimeType = mimeType;
+ }
+ }
+}
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Strings.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Strings.Designer.cs 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,72 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.34209
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OSGeo.MapGuide.MaestroAPI.Rest {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Strings {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Strings() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OSGeo.MapGuide.MaestroAPI.Rest.Strings", typeof(Strings).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid or unsupported service type: {0}.
+ /// </summary>
+ internal static string InvalidOrUnsupportedServiceType {
+ get {
+ return ResourceManager.GetString("InvalidOrUnsupportedServiceType", resourceCulture);
+ }
+ }
+ }
+}
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Strings.resx
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Strings.resx (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/Strings.resx 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="InvalidOrUnsupportedServiceType" xml:space="preserve">
+ <value>Invalid or unsupported service type: {0}</value>
+ </data>
+</root>
\ No newline at end of file
Added: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/packages.config
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/packages.config (rev 0)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Rest/packages.config 2014-11-20 16:51:51 UTC (rev 8452)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="RestSharp" version="105.0.1" targetFramework="net40-Client" />
+</packages>
\ No newline at end of file
More information about the mapguide-commits
mailing list