[mapguide-commits] r4901 - in sandbox/maestro-2.5:
OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/Services
OSGeo.MapGuide.MaestroAPI.Http
OSGeo.MapGuide.MaestroAPI.Http/Properties
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon May 17 21:17:58 EDT 2010
Author: jng
Date: 2010-05-17 21:17:57 -0400 (Mon, 17 May 2010)
New Revision: 4901
Modified:
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/Properties/AssemblyInfo.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/MaestroApiProviderAttribute.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IDrawingService.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IService.cs
Log:
- Mark maestro http assembly with MaestroApiProviderAttribute and change ConnectionProviderRegistry to probe for this attribute
- Cleanup service interface
- Add stubbed drawing service interface to http connection
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs 2010-05-18 00:26:06 UTC (rev 4900)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs 2010-05-18 01:17:57 UTC (rev 4901)
@@ -30,11 +30,13 @@
{
public string Name { get; private set; }
public string Description { get; private set; }
+ public bool IsMultiPlatform { get; private set; }
- internal ConnectionProviderEntry(string name, string desc)
+ internal ConnectionProviderEntry(string name, string desc, bool multiPlatform)
{
this.Name = name;
this.Description = desc;
+ this.IsMultiPlatform = multiPlatform;
}
}
@@ -77,10 +79,16 @@
try
{
Assembly asm = Assembly.LoadFrom(dll);
- Type t = asm.GetType(type);
+ MaestroApiProviderAttribute[] attr = asm.GetCustomAttributes(typeof(MaestroApiProviderAttribute), true) as MaestroApiProviderAttribute[];
+ if (attr != null && attr.Length == 1)
+ {
+ name = attr[0].Name.ToUpper();
+ desc = attr[0].Description;
+ _ctors[name] = attr[0].ImplType;
+ _providers.Add(new ConnectionProviderEntry(name, desc, attr[0].IsMultiPlatform));
+ }
- _ctors[name] = t;
- _providers.Add(new ConnectionProviderEntry(name, desc));
+
}
catch
{
@@ -126,6 +134,10 @@
if (!_ctors.ContainsKey(name))
throw new ArgumentException("Provider not registered: " + provider);
+ ConnectionProviderEntry prv = FindProvider(provider);
+ if (prv != null && !prv.IsMultiPlatform && !Platform.IsWindows)
+ throw new NotSupportedException("The specified provider is not usable in your operating system");
+
Type t = _ctors[name];
NameValueCollection initParams = ParseConnectionString(connectionString);
@@ -134,5 +146,16 @@
IServerConnection conn = (IServerConnection)t.InvokeMember(null, flags, null, null, new object[] { initParams });
return conn;
}
+
+ private static ConnectionProviderEntry FindProvider(string provider)
+ {
+ foreach (var prv in _providers)
+ {
+ if (prv.Name == provider)
+ return prv;
+ }
+
+ return null;
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs 2010-05-18 00:26:06 UTC (rev 4900)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs 2010-05-18 01:17:57 UTC (rev 4901)
@@ -107,17 +107,6 @@
bool RestartSession(bool throwException);
/// <summary>
- /// Executes the specified load procedure. If this load procedure has not been executed before,
- /// it will update the load procedure resource with the list of resource ids created. On subsequent
- /// executions, it will only create or update resources from this list.
- /// </summary>
- /// <param name="resourceID"></param>
- /// <param name="ignoreUnsupportedFeatures"></param>
- /// <param name="callback"></param>
- /// <returns>A list of resource IDs that were created or updated from the execution of this load procedure</returns>
- string[] ExecuteLoadProcedure(string resourceID, bool ignoreUnsupportedFeatures, LengthyOperationProgressCallBack callback);
-
- /// <summary>
/// Enumerates the names of all custom properties for this connection
/// </summary>
/// <returns></returns>
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/MaestroApiProviderAttribute.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/MaestroApiProviderAttribute.cs 2010-05-18 00:26:06 UTC (rev 4900)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/MaestroApiProviderAttribute.cs 2010-05-18 01:17:57 UTC (rev 4901)
@@ -29,11 +29,12 @@
[AttributeUsage(AttributeTargets.Assembly)]
public class MaestroApiProviderAttribute : Attribute
{
- public MaestroApiProviderAttribute(string name, string description, Type implType)
+ public MaestroApiProviderAttribute(string name, string description, Type implType, bool multiPlatform)
{
this.Name = name;
this.Description = description;
this.ImplType = implType;
+ this.IsMultiPlatform = multiPlatform;
}
/// <summary>
@@ -47,6 +48,11 @@
public string Description { get; set; }
/// <summary>
+ /// Indicates whether this implementation can be used on non-windows environments (eg. Mono)
+ /// </summary>
+ public bool IsMultiPlatform { get; set; }
+
+ /// <summary>
/// The type that implements our main server connection interface
/// </summary>
public Type ImplType { get; set; }
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IDrawingService.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IDrawingService.cs 2010-05-18 00:26:06 UTC (rev 4900)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IDrawingService.cs 2010-05-18 01:17:57 UTC (rev 4901)
@@ -20,13 +20,82 @@
using System;
using System.Collections.Generic;
using System.Text;
+using OSGeo.MapGuide.ObjectModels.Common;
namespace OSGeo.MapGuide.MaestroAPI.Services
{
/// <summary>
- /// Provides services for accessing drawing data
+ /// Allows low level access to DWF (Design Web Format) data stored in a resource repository as part of a drawing source.
/// </summary>
public interface IDrawingService : IService
{
+ /// <summary>
+ /// Gets the manifest.xml document which describes the supported document interfaces, the document properties, the sections and their contents, and section dependencies.
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <returns></returns>
+ System.IO.Stream DescribeDrawing(string resourceID);
+
+ /// <summary>
+ /// Gets the names of the layers in a DWF section.
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <param name="sectionName"></param>
+ /// <returns></returns>
+ string[] EnumerateLayers(string resourceID, string sectionName);
+
+ /// <summary>
+ /// Enumerates the resources of a DWF section (sometimes called a sheet).
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <param name="sectionName"></param>
+ /// <returns></returns>
+ DrawingSectionResourceList EnumerateSectionResources(string resourceID, string sectionName);
+
+ /// <summary>
+ /// Enumerates only the ePlot sections (sheets) in a DWF.
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <returns></returns>
+ DrawingSectionList EnumerateSections(string resourceID);
+
+ /// <summary>
+ /// Gets the coordinate system assigned to the DWF drawing.
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <returns></returns>
+ string GetCoordinateSpace(string resourceID);
+
+ /// <summary>
+ /// Returns the DWF stream for a drawing specified by resource identifier.
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <returns></returns>
+ System.IO.Stream GetDrawing(string resourceID);
+
+ /// <summary>
+ /// Gets a layer from a particular section of a DWF.
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <param name="sectionName"></param>
+ /// <param name="layerName"></param>
+ /// <returns></returns>
+ System.IO.Stream GetLayer(string resourceID, string sectionName, string layerName);
+
+ /// <summary>
+ /// Gets a DWF containing only the requested section (sometimes called a sheet).
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <param name="sectionName"></param>
+ /// <returns></returns>
+ System.IO.Stream GetSection(string resourceID, string sectionName);
+
+ /// <summary>
+ /// Gets a specific resource from the DWF.
+ /// </summary>
+ /// <param name="resourceID"></param>
+ /// <param name="resourceName"></param>
+ /// <returns></returns>
+ System.IO.Stream GetSectionResource(string resourceID, string resourceName);
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IService.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IService.cs 2010-05-18 00:26:06 UTC (rev 4900)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Services/IService.cs 2010-05-18 01:17:57 UTC (rev 4901)
@@ -25,6 +25,6 @@
{
public interface IService
{
- int ServiceType { get; }
+
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2010-05-18 00:26:06 UTC (rev 4900)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2010-05-18 01:17:57 UTC (rev 4901)
@@ -46,7 +46,8 @@
IFeatureService,
IResourceService,
ITileService,
- IMappingService
+ IMappingService,
+ IDrawingService
{
private WebClient m_wc;
private RequestBuilder m_reqBuilder;
@@ -1536,12 +1537,6 @@
throw new NotImplementedException();
}
- public string[] ExecuteLoadProcedure(string resourceID, bool ignoreUnsupportedFeatures, LengthyOperationProgressCallBack callback)
- {
- throw new NotImplementedException();
- }
-
-
public void SaveResource(OSGeo.MapGuide.MaestroAPI.Resource.IResource resource)
{
throw new NotImplementedException();
@@ -1552,11 +1547,6 @@
throw new NotImplementedException();
}
- public int ServiceType
- {
- get { throw new NotImplementedException(); }
- }
-
const string PROP_USER_AGENT = "UserAgent";
public override string[] GetCustomPropertyNames()
@@ -1592,5 +1582,50 @@
{
return this;
}
+
+ public System.IO.Stream DescribeDrawing(string resourceID)
+ {
+ throw new NotImplementedException();
+ }
+
+ public string[] EnumerateLayers(string resourceID, string sectionName)
+ {
+ throw new NotImplementedException();
+ }
+
+ public DrawingSectionResourceList EnumerateSectionResources(string resourceID, string sectionName)
+ {
+ throw new NotImplementedException();
+ }
+
+ public DrawingSectionList EnumerateSections(string resourceID)
+ {
+ throw new NotImplementedException();
+ }
+
+ public string GetCoordinateSpace(string resourceID)
+ {
+ throw new NotImplementedException();
+ }
+
+ public System.IO.Stream GetDrawing(string resourceID)
+ {
+ throw new NotImplementedException();
+ }
+
+ public System.IO.Stream GetLayer(string resourceID, string sectionName, string layerName)
+ {
+ throw new NotImplementedException();
+ }
+
+ public System.IO.Stream GetSection(string resourceID, string sectionName)
+ {
+ throw new NotImplementedException();
+ }
+
+ public System.IO.Stream GetSectionResource(string resourceID, string resourceName)
+ {
+ throw new NotImplementedException();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/Properties/AssemblyInfo.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/Properties/AssemblyInfo.cs 2010-05-18 00:26:06 UTC (rev 4900)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/Properties/AssemblyInfo.cs 2010-05-18 01:17:57 UTC (rev 4901)
@@ -1,6 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using OSGeo.MapGuide.MaestroAPI;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@@ -36,4 +37,6 @@
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("MaestroAPITests")]
-[assembly: InternalsVisibleTo("MaestroBaseTests")]
\ No newline at end of file
+[assembly: InternalsVisibleTo("MaestroBaseTests")]
+
+[assembly: MaestroApiProvider("Maestro.Http", "Maestro HTTP API", typeof(HttpServerConnection), true)]
\ No newline at end of file
More information about the mapguide-commits
mailing list