[mapguide-commits] r4858 - in sandbox/maestro-2.5: . Generated
Maestro MaestroAPITests MaestroAPITests/Properties
OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/Capability
OSGeo.MapGuide.MaestroAPI/Commands
OSGeo.MapGuide.MaestroAPI/CoordinateSystem
OSGeo.MapGuide.MaestroAPI/Exceptions
OSGeo.MapGuide.MaestroAPI/Mapping
OSGeo.MapGuide.MaestroAPI/ObjectModels
OSGeo.MapGuide.MaestroAPI/Properties
OSGeo.MapGuide.MaestroAPI/Resource
OSGeo.MapGuide.MaestroAPI/Resource/Conversion
OSGeo.MapGuide.MaestroAPI/Serialization
OSGeo.MapGuide.MaestroAPI.Http
OSGeo.MapGuide.MaestroAPI.Http/Properties
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed May 12 12:16:22 EDT 2010
Author: jng
Date: 2010-05-12 12:16:21 -0400 (Wed, 12 May 2010)
New Revision: 4858
Added:
sandbox/maestro-2.5/MaestroAPITests/
sandbox/maestro-2.5/MaestroAPITests/CapabilityTests.cs
sandbox/maestro-2.5/MaestroAPITests/FeatureReaderTests.cs
sandbox/maestro-2.5/MaestroAPITests/MaestroAPITests.csproj
sandbox/maestro-2.5/MaestroAPITests/Properties/
sandbox/maestro-2.5/MaestroAPITests/Properties/AssemblyInfo.cs
sandbox/maestro-2.5/MaestroAPITests/ResourceTests.cs
sandbox/maestro-2.5/MaestroAPITests/RuntimeMapTests.cs
sandbox/maestro-2.5/MaestroAPITests/SerializationTests.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Capability/
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Capability/ConnectionCapabilities.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ConnectionProviders.xml
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/MaestroException.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/ResourceConversionException.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/IResourceConverter.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ResourceConverter.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ResourceUpgrader.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IVersionedEntity.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceContentVersionChecker.cs
Modified:
sandbox/maestro-2.5/Generated/
sandbox/maestro-2.5/Maestro/Maestro.sln
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystem.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystemCatalog.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystemCategory.cs
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/
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystem.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemCatalog.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemCategory.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/ICoordinateSystemCatalog.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IConnectionCapabilities.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Mapping/MapSelectionBase.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapBase.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/AssemblyInfo.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceIdentifier.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceTypeDescriptor.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/Enums.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/IBinarySerializeable.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinaryDeserializer.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinarySerializer.cs
sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
Log:
- Rename CoordinateSystem to CoordinateSystemBase to avoid namespace ambiguity
- Added resource conversion APIs (no implementations yet)
- Added unit tests for resource related APIs
- Make IResource extend from ICloneable to allow resource cloning via the interface.
- Re-org existing MaestroAPI classes into the new namespaces
Property changes on: sandbox/maestro-2.5/Generated
___________________________________________________________________
Added: svn:ignore
+ bin
obj
Modified: sandbox/maestro-2.5/Maestro/Maestro.sln
===================================================================
--- sandbox/maestro-2.5/Maestro/Maestro.sln 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/Maestro/Maestro.sln 2010-05-12 16:16:21 UTC (rev 4858)
@@ -41,6 +41,10 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OSGeo.MapGuide.ObjectModels.WebLayout-1.1.0", "..\Generated\OSGeo.MapGuide.ObjectModels.WebLayout-1.1.0.csproj", "{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Unit Tests", "Unit Tests", "{499D2A40-7BEB-4578-9148-0D19F45A1858}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaestroAPITests", "..\MaestroAPITests\MaestroAPITests.csproj", "{351D49A3-2E4A-4EC3-AFC2-D56598F44F51}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -103,6 +107,10 @@
{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {351D49A3-2E4A-4EC3-AFC2-D56598F44F51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {351D49A3-2E4A-4EC3-AFC2-D56598F44F51}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {351D49A3-2E4A-4EC3-AFC2-D56598F44F51}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {351D49A3-2E4A-4EC3-AFC2-D56598F44F51}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -123,5 +131,6 @@
{D525B343-66D6-4D6B-9A55-78A173D94A51} = {81BF310C-0BBC-41F0-ADA5-B201D9769AFC}
{BF6E996E-27AF-44CD-B3CF-A40874E15B2E} = {81BF310C-0BBC-41F0-ADA5-B201D9769AFC}
{0A93ACA8-5B21-44E6-B0B7-5D1E72D3A6A2} = {81BF310C-0BBC-41F0-ADA5-B201D9769AFC}
+ {351D49A3-2E4A-4EC3-AFC2-D56598F44F51} = {499D2A40-7BEB-4578-9148-0D19F45A1858}
EndGlobalSection
EndGlobal
Added: sandbox/maestro-2.5/MaestroAPITests/CapabilityTests.cs
===================================================================
--- sandbox/maestro-2.5/MaestroAPITests/CapabilityTests.cs (rev 0)
+++ sandbox/maestro-2.5/MaestroAPITests/CapabilityTests.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,32 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+
+namespace MaestroAPITests
+{
+ [TestFixture]
+ public class CapabilityTests
+ {
+
+ }
+}
Added: sandbox/maestro-2.5/MaestroAPITests/FeatureReaderTests.cs
===================================================================
--- sandbox/maestro-2.5/MaestroAPITests/FeatureReaderTests.cs (rev 0)
+++ sandbox/maestro-2.5/MaestroAPITests/FeatureReaderTests.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,48 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+
+namespace MaestroAPITests
+{
+ [TestFixture]
+ public class FeatureReaderTests
+ {
+ [Test]
+ public void TestXmlFeatureNullValues()
+ {
+ //Simulate post-#708 SELECTFEATURES and verify reader properly handles null values in response
+ }
+
+ [Test]
+ public void TestXmlAggregateNullValues()
+ {
+ //Simulate post-#708 SELECTAGGREGATES and verify reader properly handles null values in response
+ }
+
+ [Test]
+ public void TestXmlSqlNullValues()
+ {
+ //Simulate post-#708 EXECUTESQL and verify reader properly handles null values in response
+ }
+ }
+}
Added: sandbox/maestro-2.5/MaestroAPITests/MaestroAPITests.csproj
===================================================================
--- sandbox/maestro-2.5/MaestroAPITests/MaestroAPITests.csproj (rev 0)
+++ sandbox/maestro-2.5/MaestroAPITests/MaestroAPITests.csproj 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{351D49A3-2E4A-4EC3-AFC2-D56598F44F51}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>MaestroAPITests</RootNamespace>
+ <AssemblyName>MaestroAPITests</AssemblyName>
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</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>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="NMock2, Version=2.0.0.44, Culture=neutral, PublicKeyToken=37d3be0adc87c2b7, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\Thirdparty\NMock\bin\NMock2.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\Thirdparty\NUnit\bin\net-2.0\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CapabilityTests.cs" />
+ <Compile Include="FeatureReaderTests.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="ResourceTests.cs" />
+ <Compile Include="RuntimeMapTests.cs" />
+ <Compile Include="SerializationTests.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\OSGeo.MapGuide.MaestroAPI.Http\OSGeo.MapGuide.MaestroAPI.Http.csproj">
+ <Project>{6EF1E775-444B-4E5F-87FB-D687C43A68D7}</Project>
+ <Name>OSGeo.MapGuide.MaestroAPI.Http</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\OSGeo.MapGuide.MaestroAPI\OSGeo.MapGuide.MaestroAPI.csproj">
+ <Project>{80FA3158-8B5F-48D1-A393-0378AFE48A7E}</Project>
+ <Name>OSGeo.MapGuide.MaestroAPI</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- 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: sandbox/maestro-2.5/MaestroAPITests/Properties/AssemblyInfo.cs
===================================================================
--- sandbox/maestro-2.5/MaestroAPITests/Properties/AssemblyInfo.cs (rev 0)
+++ sandbox/maestro-2.5/MaestroAPITests/Properties/AssemblyInfo.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,36 @@
+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("MaestroAPITests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MaestroAPITests")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[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("fa78a351-95a7-4967-a200-bf10036511c8")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: sandbox/maestro-2.5/MaestroAPITests/ResourceTests.cs
===================================================================
--- sandbox/maestro-2.5/MaestroAPITests/ResourceTests.cs (rev 0)
+++ sandbox/maestro-2.5/MaestroAPITests/ResourceTests.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,265 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
+using OSGeo.MapGuide.ObjectModels.FeatureSource;
+using OSGeo.MapGuide.ObjectModels.LayerDefinition;
+using OSGeo.MapGuide.ObjectModels.MapDefinition;
+using OSGeo.MapGuide.ObjectModels.WebLayout;
+using OSGeo.MapGuide.ObjectModels.SymbolLibrary;
+using OSGeo.MapGuide.ObjectModels.SymbolDefinition;
+using OSGeo.MapGuide.ObjectModels.PrintLayout;
+using OSGeo.MapGuide.MaestroAPI.Exceptions;
+using OSGeo.MapGuide.MaestroAPI.Resource.Conversion;
+using NMock2;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+
+namespace MaestroAPITests
+{
+ [TestFixture]
+ public class ResourceTests
+ {
+ private Mockery _mocks;
+
+ [Test]
+ public void TestCloning()
+ {
+ //Generated classes have built in Clone() methods. Verify they check out
+
+ var app = new ApplicationDefinitionType();
+ var app2 = app.Clone();
+ Assert.AreNotSame(app, app2);
+
+ var fs = new FeatureSourceType();
+ var fs2 = fs.Clone();
+ Assert.AreNotSame(fs, fs2);
+
+ var ld = new LayerDefinition();
+ var ld2 = ld.Clone();
+ Assert.AreNotSame(ld, ld2);
+
+ var md = new MapDefinition();
+ var md2 = md.Clone();
+ Assert.AreNotSame(md, md2);
+
+ var wl = new WebLayoutType();
+ var wl2 = wl.Clone();
+ Assert.AreNotSame(wl, wl2);
+
+ var sl = new SymbolLibraryType();
+ var sl2 = sl.Clone();
+ Assert.AreNotSame(sl, sl2);
+
+ var ssd = new SimpleSymbolDefinition();
+ var ssd2 = ssd.Clone();
+ Assert.AreNotSame(ssd, ssd2);
+
+ var csd = new CompoundSymbolDefinition();
+ var csd2 = csd.Clone();
+ Assert.AreNotSame(csd, csd2);
+
+ var pl = new PrintLayout();
+ var pl2 = pl.Clone();
+ Assert.AreNotSame(pl, pl2);
+ }
+
+ [Test]
+ public void TestNoConversionOnIdenticalVersion()
+ {
+ //Verify origial reference is returned if we're converting a resource to the same version
+
+ var conv = new ResourceConverter(new List<IResourceConverter>());
+ var targetVer = new Version(1, 0, 0);
+
+ var app = new ApplicationDefinitionType();
+ var app2 = conv.Upgrade(app, targetVer);
+ Assert.AreSame(app, app2);
+
+ var fs = new FeatureSourceType();
+ var fs2 = conv.Upgrade(fs, targetVer);
+ Assert.AreSame(fs, fs2);
+
+ var ld = new LayerDefinition();
+ var ld2 = conv.Upgrade(ld, targetVer);
+ Assert.AreSame(ld, ld2);
+
+ var md = new MapDefinition();
+ var md2 = conv.Upgrade(md, targetVer);
+ Assert.AreSame(md, md2);
+
+ var wl = new WebLayoutType();
+ var wl2 = conv.Upgrade(wl, targetVer);
+ Assert.AreSame(wl, wl2);
+
+ var sl = new SymbolLibraryType();
+ var sl2 = conv.Upgrade(sl, targetVer);
+ Assert.AreSame(sl, sl2);
+
+ var ssd = new SimpleSymbolDefinition();
+ var ssd2 = conv.Upgrade(ssd, targetVer);
+ Assert.AreSame(ssd, ssd2);
+
+ var csd = new CompoundSymbolDefinition();
+ var csd2 = conv.Upgrade(csd, targetVer);
+ Assert.AreSame(csd, csd2);
+
+ var pl = new PrintLayout();
+ var pl2 = conv.Upgrade(pl, targetVer);
+ Assert.AreSame(pl, pl2);
+ }
+
+ [Test]
+ public void TestSingleUpgrade()
+ {
+ _mocks = new Mockery();
+
+ var orig = _mocks.NewMock<IResource>();
+ Stub.On(orig).GetProperty("ResourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(orig).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(orig).Method("Clone").WithAnyArguments().Will(Return.Value(orig));
+
+ var res2 = _mocks.NewMock<IResource>();
+ Stub.On(res2).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(res2).GetProperty("ResourceVersion").Will(Return.Value(new Version(1, 1, 0)));
+
+ var upg = _mocks.NewMock<IResourceConverter>();
+ Stub.On(upg).GetProperty("SourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(upg).GetProperty("TargetVersion").Will(Return.Value(new Version(1, 1, 0)));
+ Stub.On(upg).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(upg).Method("Convert").WithAnyArguments().Will(Return.Value(res2));
+
+ var upgList = new List<IResourceConverter>();
+ upgList.Add(upg);
+ var conv = new ResourceConverter(upgList);
+
+ var obj = conv.Upgrade(orig, new Version(1, 1, 0));
+ Assert.AreEqual(obj.ResourceVersion, new Version(1, 1, 0));
+
+ try
+ {
+ //No 1.0.0 -> 1.2.0 converter registered. Should fail.
+ obj = conv.Upgrade(orig, new Version(1, 2, 0));
+ Assert.Fail("An exception should've been thrown (no upgrade path)");
+ }
+ catch (ResourceConversionException)
+ {
+
+ }
+ }
+
+ [Test]
+ [ExpectedException(typeof(ResourceConversionException))]
+ public void TestClashingUpgraders()
+ {
+ _mocks = new Mockery();
+ var upg = _mocks.NewMock<IResourceConverter>();
+ Stub.On(upg).GetProperty("SourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(upg).GetProperty("TargetVersion").Will(Return.Value(new Version(1, 1, 0)));
+ Stub.On(upg).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+
+ var upg2 = _mocks.NewMock<IResourceConverter>();
+ Stub.On(upg2).GetProperty("SourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(upg2).GetProperty("TargetVersion").Will(Return.Value(new Version(1, 3, 0)));
+ Stub.On(upg2).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+
+ var upgList = new List<IResourceConverter>();
+ upgList.Add(upg);
+ upgList.Add(upg2);
+ var conv = new ResourceConverter(upgList);
+ }
+
+ [Test]
+ public void TestIncrementalUpgrade()
+ {
+ //Verify a resource is upgraded to the correct version
+ //when going through multiple upgraders
+
+ _mocks = new Mockery();
+
+ var orig = _mocks.NewMock<IResource>();
+ Stub.On(orig).GetProperty("ResourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(orig).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(orig).Method("Clone").WithAnyArguments().Will(Return.Value(orig));
+
+ var orig11 = _mocks.NewMock<IResource>();
+ Stub.On(orig11).GetProperty("ResourceVersion").Will(Return.Value(new Version(1, 1, 0)));
+ Stub.On(orig11).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(orig11).Method("Clone").WithAnyArguments().Will(Return.Value(orig11));
+
+ var orig12 = _mocks.NewMock<IResource>();
+ Stub.On(orig12).GetProperty("ResourceVersion").Will(Return.Value(new Version(1, 2, 0)));
+ Stub.On(orig12).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(orig12).Method("Clone").WithAnyArguments().Will(Return.Value(orig12));
+
+ var upg = _mocks.NewMock<IResourceConverter>();
+ Stub.On(upg).GetProperty("SourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(upg).GetProperty("TargetVersion").Will(Return.Value(new Version(1, 1, 0)));
+ Stub.On(upg).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(upg).Method("Convert").WithAnyArguments().Will(Return.Value(orig11));
+
+ var upg2 = _mocks.NewMock<IResourceConverter>();
+ Stub.On(upg2).GetProperty("SourceVersion").Will(Return.Value(new Version(1, 1, 0)));
+ Stub.On(upg2).GetProperty("TargetVersion").Will(Return.Value(new Version(1, 2, 0)));
+ Stub.On(upg2).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(upg2).Method("Convert").WithAnyArguments().Will(Return.Value(orig12));
+
+ var upgList = new List<IResourceConverter>() { upg, upg2 };
+ var conv = new ResourceConverter(upgList);
+
+ var obj = conv.Upgrade(orig, new Version(1, 2, 0));
+ Assert.AreEqual(obj.ResourceVersion, new Version(1, 2, 0));
+ }
+
+ [Test]
+ [ExpectedException(typeof(ResourceConversionException))]
+ public void TestBrokenUpgradePath()
+ {
+ //Verify exception thrown when there is a version gap
+ //in the upgrade path
+
+ _mocks = new Mockery();
+ var upg = _mocks.NewMock<IResourceConverter>();
+ Stub.On(upg).GetProperty("SourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(upg).GetProperty("TargetVersion").Will(Return.Value(new Version(1, 1, 0)));
+ Stub.On(upg).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+
+ var upg2 = _mocks.NewMock<IResourceConverter>();
+ Stub.On(upg2).GetProperty("SourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(upg2).GetProperty("TargetVersion").Will(Return.Value(new Version(1, 3, 0)));
+ Stub.On(upg2).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+
+ var orig = _mocks.NewMock<IResource>();
+ Stub.On(orig).GetProperty("ResourceVersion").Will(Return.Value(new Version(1, 0, 0)));
+ Stub.On(orig).GetProperty("ResourceType").Will(Return.Value("LayerDefinition"));
+ Stub.On(orig).Method("Clone").WithAnyArguments().Will(Return.Value(orig));
+
+ var upgList = new List<IResourceConverter>();
+ upgList.Add(upg);
+ upgList.Add(upg2);
+ var conv = new ResourceConverter(upgList);
+
+ //There's no 1.1.0 -> 1.2.0 upgrader registered. This should fail.
+ var obj = conv.Upgrade(orig, new Version(1, 3, 0));
+ }
+ }
+}
Added: sandbox/maestro-2.5/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- sandbox/maestro-2.5/MaestroAPITests/RuntimeMapTests.cs (rev 0)
+++ sandbox/maestro-2.5/MaestroAPITests/RuntimeMapTests.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,31 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+
+namespace MaestroAPITests
+{
+ [TestFixture]
+ public class RuntimeMapTests
+ {
+ }
+}
Added: sandbox/maestro-2.5/MaestroAPITests/SerializationTests.cs
===================================================================
--- sandbox/maestro-2.5/MaestroAPITests/SerializationTests.cs (rev 0)
+++ sandbox/maestro-2.5/MaestroAPITests/SerializationTests.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,45 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+
+namespace MaestroAPITests
+{
+ [TestFixture]
+ public class SerializationTests
+ {
+ [Test]
+ public void TestPreMg22FdoCapabilities()
+ {
+ //MGOS <= 2.2 returned different xml from a GETCAPABILITIES
+ //call even though the schema was the same. Verify capabilities
+ //are read properly regardless of version
+ }
+
+ [Test]
+ public void TestResourceContentVersionInspection()
+ {
+ //Verify our ResoureContentVersionChecker can correctly read the
+ //version numbers of resource content streams
+ }
+ }
+}
Property changes on: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI
___________________________________________________________________
Added: svn:ignore
+ bin
obj
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Capability/ConnectionCapabilities.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Capability/ConnectionCapabilities.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Capability/ConnectionCapabilities.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,50 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Capability
+{
+ public abstract class ConnectionCapabilities : IConnectionCapabilities
+ {
+ private static readonly Version V_1_0_0 = new Version(1, 0, 0);
+
+ public virtual Version GetMaxSupportedResourceVersion(string resourceType)
+ {
+ return V_1_0_0;
+ }
+
+ public abstract int[] SupportedCommands
+ {
+ get;
+ }
+
+ public abstract int[] SupportedServices
+ {
+ get;
+ }
+
+ public virtual bool SupportsResourcePreviews
+ {
+ get { return false; }
+ }
+ }
+}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Commands/ExecuteLoadProcedure.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -25,6 +25,7 @@
using OSGeo.MapGuide.ObjectModels.FeatureSource;
using OSGeo.MapGuide.ObjectModels.Common;
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
+using OSGeo.MapGuide.MaestroAPI.Resource;
namespace OSGeo.MapGuide.MaestroAPI.Commands
{
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ConnectionProviders.xml
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ConnectionProviders.xml (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ConnectionProviders.xml 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ConnectionProviderRegistry>
+ <ConnectionProvider>
+ <Name>Maestro.Http</Name>
+ <Description>Connection using the mapagent http API</Description>
+ <Assembly>OSGeo.MapGuide.MaestroAPI.dll</Assembly>
+ <Type>OSGeo.MapGuide.MaestroAPI.HttpServerConnection</Type>
+ </ConnectionProvider>
+ <ConnectionProvider>
+ <Name>Maestro.LocalNative</Name>
+ <Description>Connection using the MapGuide Web API</Description>
+ <Assembly>OSGeo.MapGuide.MaestroAPI.dll</Assembly>
+ <Type>OSGeo.MapGuide.MaestroAPI.LocalNativeConnection</Type>
+ </ConnectionProvider>
+</ConnectionProviderRegistry>
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystem.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystem.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystem.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -22,9 +22,9 @@
using System.Text;
using System.Xml;
-namespace OSGeo.MapGuide.MaestroAPI
+namespace OSGeo.MapGuide.MaestroAPI.CoordinateSystem
{
- public abstract class CoordinateSystem
+ public abstract class CoordinateSystemBase
{
protected CoordinateSystemCategory m_parent;
protected string m_code;
@@ -39,9 +39,9 @@
protected string m_wkt = null;
protected string m_epsg = null;
- protected CoordinateSystem() { }
+ protected CoordinateSystemBase() { }
- protected CoordinateSystem(CoordinateSystemCategory parent)
+ protected CoordinateSystemBase(CoordinateSystemCategory parent)
{
m_parent = parent;
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemCatalog.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemCatalog.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemCatalog.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -21,18 +21,18 @@
using System.Collections.Generic;
using System.Text;
-namespace OSGeo.MapGuide.MaestroAPI
+namespace OSGeo.MapGuide.MaestroAPI.CoordinateSystem
{
public abstract class CoordinateSystemCatalog : ICoordinateSystemCatalog
{
- public virtual CoordinateSystem[] Coordsys
+ public virtual CoordinateSystemBase[] Coordsys
{
get
{
- List<CoordinateSystem> items = new List<CoordinateSystem>();
+ List<CoordinateSystemBase> items = new List<CoordinateSystemBase>();
foreach (CoordinateSystemCategory cat in this.Categories)
{
- foreach (CoordinateSystem coord in cat.Items)
+ foreach (CoordinateSystemBase coord in cat.Items)
{
items.Add(coord);
}
@@ -41,13 +41,13 @@
}
}
- public virtual CoordinateSystem FindCoordSys(string coordcode)
+ public virtual CoordinateSystemBase FindCoordSys(string coordcode)
{
try
{
foreach (CoordinateSystemCategory cat in this.Categories)
{
- foreach (CoordinateSystem coord in cat.Items)
+ foreach (CoordinateSystemBase coord in cat.Items)
{
if (coord.Code == coordcode)
return coord;
@@ -61,7 +61,7 @@
return null;
}
- public abstract CoordinateSystem CreateEmptyCoordinateSystem();
+ public abstract CoordinateSystemBase CreateEmptyCoordinateSystem();
public abstract CoordinateSystemCategory[] Categories { get; }
@@ -75,7 +75,7 @@
public abstract string ConvertWktToEpsgCode(string wkt);
- public abstract CoordinateSystem[] EnumerateCoordinateSystems(string category);
+ public abstract CoordinateSystemBase[] EnumerateCoordinateSystems(string category);
public abstract bool IsValid(string wkt);
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemCategory.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemCategory.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/CoordinateSystemCategory.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -21,13 +21,13 @@
using System.Collections.Generic;
using System.Text;
-namespace OSGeo.MapGuide.MaestroAPI
+namespace OSGeo.MapGuide.MaestroAPI.CoordinateSystem
{
public abstract class CoordinateSystemCategory
{
private ICoordinateSystemCatalog _parent;
private string m_name;
- private CoordinateSystem[] m_items;
+ private CoordinateSystemBase[] m_items;
public CoordinateSystemCategory(ICoordinateSystemCatalog parent, string name)
{
@@ -39,7 +39,7 @@
internal ICoordinateSystemCatalog Parent { get { return _parent; } }
- public CoordinateSystem[] Items
+ public CoordinateSystemBase[] Items
{
get
{
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/ICoordinateSystemCatalog.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/ICoordinateSystemCatalog.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/CoordinateSystem/ICoordinateSystemCatalog.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -18,7 +18,7 @@
//
#endregion
using System;
-namespace OSGeo.MapGuide.MaestroAPI
+namespace OSGeo.MapGuide.MaestroAPI.CoordinateSystem
{
public interface ICoordinateSystemCatalog
{
@@ -27,10 +27,10 @@
string ConvertEpsgCodeToWkt(string epsg);
string ConvertWktToCoordinateSystemCode(string wkt);
string ConvertWktToEpsgCode(string wkt);
- CoordinateSystem[] Coordsys { get; }
- CoordinateSystem[] EnumerateCoordinateSystems(string category);
- CoordinateSystem FindCoordSys(string coordcode);
- CoordinateSystem CreateEmptyCoordinateSystem();
+ CoordinateSystemBase[] Coordsys { get; }
+ CoordinateSystemBase[] EnumerateCoordinateSystems(string category);
+ CoordinateSystemBase FindCoordSys(string coordcode);
+ CoordinateSystemBase CreateEmptyCoordinateSystem();
bool IsValid(string wkt);
string LibraryName { get; }
bool IsLoaded { get; }
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/MaestroException.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/MaestroException.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/MaestroException.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,47 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Exceptions
+{
+ /// <summary>
+ /// Represents the base class of all exceptions that can be thrown from the Maestro API
+ /// </summary>
+ [global::System.Serializable]
+ public class MaestroException : Exception
+ {
+ //
+ // For guidelines regarding the creation of new exception types, see
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
+ // and
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
+ //
+
+ public MaestroException() { }
+ public MaestroException(string message) : base(message) { }
+ public MaestroException(string message, Exception inner) : base(message, inner) { }
+ protected MaestroException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context) { }
+ }
+}
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/ResourceConversionException.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/ResourceConversionException.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Exceptions/ResourceConversionException.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,47 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Exceptions
+{
+ /// <summary>
+ /// Used to indicate failures in resource upgrades/downgrades
+ /// </summary>
+ [global::System.Serializable]
+ public class ResourceConversionException : MaestroException
+ {
+ //
+ // For guidelines regarding the creation of new exception types, see
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
+ // and
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
+ //
+
+ public ResourceConversionException() { }
+ public ResourceConversionException(string message) : base(message) { }
+ public ResourceConversionException(string message, Exception inner) : base(message, inner) { }
+ protected ResourceConversionException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context) { }
+ }
+}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IConnectionCapabilities.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IConnectionCapabilities.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IConnectionCapabilities.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -26,6 +26,18 @@
public interface IConnectionCapabilities
{
/// <summary>
+ /// Gets the highest supported resource version.
+ /// </summary>
+ /// <param name="resourceType"></param>
+ /// <returns></returns>
+ Version GetMaxSupportedResourceVersion(string resourceType);
+
+ /// <summary>
+ /// Gets an array of supported commands
+ /// </summary>
+ int[] SupportedCommands { get; }
+
+ /// <summary>
/// Gets an array of supported services
/// </summary>
int[] SupportedServices { get; }
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -22,6 +22,7 @@
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Services;
using OSGeo.MapGuide.MaestroAPI.Commands;
+using OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
namespace OSGeo.MapGuide.MaestroAPI
{
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Mapping/MapSelectionBase.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Mapping/MapSelectionBase.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Mapping/MapSelectionBase.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -20,6 +20,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using OSGeo.MapGuide.MaestroAPI.Serialization;
namespace OSGeo.MapGuide.MaestroAPI.Mapping
{
@@ -30,7 +31,7 @@
public MapSelectionBase(string xml)
{ }
- public void Serialize(OSGeo.MapGuide.MaestroAPI.BinarySerializer.MgBinarySerializer serializer)
+ public void Serialize(MgBinarySerializer serializer)
{
throw new NotImplementedException();
}
@@ -46,7 +47,7 @@
throw new NotImplementedException();
}
- public void Deserialize(OSGeo.MapGuide.MaestroAPI.BinarySerializer.MgBinaryDeserializer deserializer)
+ public void Deserialize(MgBinaryDeserializer deserializer)
{
throw new NotImplementedException();
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapBase.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapBase.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapBase.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.ObjectModels.MapDefinition;
+using OSGeo.MapGuide.MaestroAPI.Serialization;
namespace OSGeo.MapGuide.MaestroAPI.Mapping
{
@@ -39,7 +40,7 @@
public RuntimeMapBase(MapDefinition mapDef) { }
- public static RuntimeMapBase Deserialize(OSGeo.MapGuide.MaestroAPI.BinarySerializer.MgBinaryDeserializer mgBinaryDeserializer)
+ public static RuntimeMapBase Deserialize(MgBinaryDeserializer mgBinaryDeserializer)
{
throw new NotImplementedException();
}
@@ -56,17 +57,17 @@
private set;
}
- public void DeserializeLayerData(OSGeo.MapGuide.MaestroAPI.BinarySerializer.MgBinaryDeserializer mgBinaryDeserializer)
+ public void DeserializeLayerData(MgBinaryDeserializer mgBinaryDeserializer)
{
throw new NotImplementedException();
}
- public void Serialize(OSGeo.MapGuide.MaestroAPI.BinarySerializer.MgBinarySerializer mgBinarySerializer)
+ public void Serialize(MgBinarySerializer mgBinarySerializer)
{
throw new NotImplementedException();
}
- public void SerializeLayerData(OSGeo.MapGuide.MaestroAPI.BinarySerializer.MgBinarySerializer mgBinarySerializer)
+ public void SerializeLayerData(MgBinarySerializer mgBinarySerializer)
{
throw new NotImplementedException();
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2010-05-12 16:16:21 UTC (rev 4858)
@@ -162,10 +162,13 @@
<Link>ObjectModels\WebLayout-1.0.0.designer.cs</Link>
</Compile>
<Compile Include="BindingListExtensions.cs" />
+ <Compile Include="Capability\ConnectionCapabilities.cs" />
<Compile Include="Commands\CommandType.cs" />
<Compile Include="Commands\ExecuteLoadProcedure.cs" />
<Compile Include="Commands\GetCapabilities.cs" />
<Compile Include="Commands\ICommand.cs" />
+ <Compile Include="Exceptions\MaestroException.cs" />
+ <Compile Include="Exceptions\ResourceConversionException.cs" />
<Compile Include="IConnectionCapabilities.cs" />
<Compile Include="MaestroApiProviderAttribute.cs" />
<Compile Include="ConnectionProviderRegistry.cs" />
@@ -186,12 +189,23 @@
<Compile Include="ObjectModels\LayerDefinition.cs" />
<Compile Include="ObjectModels\LoadProcedure.cs" />
<Compile Include="ObjectModels\MapDefinition.cs" />
+ <Compile Include="ObjectModels\PrintLayout.cs" />
<Compile Include="ObjectModels\SymbolDefinition.cs" />
<Compile Include="ObjectModels\SymbolLibrary.cs" />
<Compile Include="ObjectModels\WebLayout.cs" />
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Resource\Conversion\IResourceConverter.cs" />
+ <Compile Include="Resource\Conversion\ResourceConverter.cs" />
+ <Compile Include="Resource\Conversion\ResourceUpgrader.cs" />
<Compile Include="Resource\IResource.cs" />
+ <Compile Include="Resource\IVersionedEntity.cs" />
<Compile Include="Resource\ResourceIdentifier.cs" />
<Compile Include="Resource\ResourceTypeDescriptor.cs" />
+ <Compile Include="Resource\ResourceContentVersionChecker.cs" />
<Compile Include="Serialization\Enums.cs" />
<Compile Include="Serialization\IBinarySerializeable.cs" />
<Compile Include="Serialization\MgBinaryDeserializer.cs" />
@@ -278,7 +292,11 @@
<Content Include="ObjectModels\readme.txt" />
</ItemGroup>
<ItemGroup>
- <Folder Include="Resource\Conversion\" />
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/ApplicationDefinition.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -64,5 +64,10 @@
return RES_VERSION;
}
}
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/FeatureSource.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -64,5 +64,10 @@
return RES_VERSION;
}
}
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LayerDefinition.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -64,5 +64,10 @@
return RES_VERSION;
}
}
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/LoadProcedure.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -64,5 +64,10 @@
return RES_VERSION;
}
}
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -66,6 +66,11 @@
}
internal void SortGroupList() { }
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
}
partial class MapLayerType
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/PrintLayout.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,73 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+
+namespace OSGeo.MapGuide.ObjectModels.PrintLayout
+{
+ partial class PrintLayout : IResource
+ {
+ private static readonly Version RES_VERSION = new Version(1, 0, 0);
+
+ public OSGeo.MapGuide.MaestroAPI.IServerConnection CurrentConnection
+ {
+ get;
+ internal set;
+ }
+
+ private string _resId;
+
+ public string ResourceID
+ {
+ get
+ {
+ return _resId;
+ }
+ set
+ {
+ _resId = value;
+ this.OnPropertyChanged("ResourceID");
+ }
+ }
+
+ public string ResourceType
+ {
+ get
+ {
+ return "PrintLayout";
+ }
+ }
+
+ public Version ResourceVersion
+ {
+ get
+ {
+ return RES_VERSION;
+ }
+ }
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
+ }
+}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolDefinition.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -64,5 +64,10 @@
return RES_VERSION;
}
}
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/SymbolLibrary.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -64,5 +64,10 @@
return RES_VERSION;
}
}
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ObjectModels/WebLayout.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -64,5 +64,10 @@
return RES_VERSION;
}
}
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/AssemblyInfo.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/AssemblyInfo.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/AssemblyInfo.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -34,3 +34,5 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+
+[assembly: InternalsVisibleTo("MaestroAPITests")]
\ No newline at end of file
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,108 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace OSGeo.MapGuide.MaestroAPI.Properties {
+ 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", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <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.Properties.Resources", typeof(Resources).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 Resource cannot be downgraded. It is already older than the version this converter can downgrade to.
+ /// </summary>
+ internal static string ERR_CANNOT_DOWNGRADE_OLDER_RESOURCE {
+ get {
+ return ResourceManager.GetString("ERR_CANNOT_DOWNGRADE_OLDER_RESOURCE", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Resource cannot be upgraded. It is already newer than what this converter can upgrade to.
+ /// </summary>
+ internal static string ERR_CANNOT_UPGRADE_NEWER_RESOURCE {
+ get {
+ return ResourceManager.GetString("ERR_CANNOT_UPGRADE_NEWER_RESOURCE", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A resource converter for {0} is already registered.
+ /// </summary>
+ internal static string ERR_CONVERTER_ALREADY_REGISTERED {
+ get {
+ return ResourceManager.GetString("ERR_CONVERTER_ALREADY_REGISTERED", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to There is no downgrade path to the desired resource version.
+ /// </summary>
+ internal static string ERR_NO_DOWNGRADE_PATH {
+ get {
+ return ResourceManager.GetString("ERR_NO_DOWNGRADE_PATH", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to There is no upgrade path to the desired resource version.
+ /// </summary>
+ internal static string ERR_NO_UPGRADE_PATH {
+ get {
+ return ResourceManager.GetString("ERR_NO_UPGRADE_PATH", resourceCulture);
+ }
+ }
+ }
+}
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,135 @@
+<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="ERR_CANNOT_DOWNGRADE_OLDER_RESOURCE" xml:space="preserve">
+ <value>Resource cannot be downgraded. It is already older than the version this converter can downgrade to</value>
+ </data>
+ <data name="ERR_CANNOT_UPGRADE_NEWER_RESOURCE" xml:space="preserve">
+ <value>Resource cannot be upgraded. It is already newer than what this converter can upgrade to</value>
+ </data>
+ <data name="ERR_CONVERTER_ALREADY_REGISTERED" xml:space="preserve">
+ <value>A resource converter for {0} is already registered</value>
+ </data>
+ <data name="ERR_NO_DOWNGRADE_PATH" xml:space="preserve">
+ <value>There is no downgrade path to the desired resource version</value>
+ </data>
+ <data name="ERR_NO_UPGRADE_PATH" xml:space="preserve">
+ <value>There is no upgrade path to the desired resource version</value>
+ </data>
+</root>
\ No newline at end of file
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/IResourceConverter.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/IResourceConverter.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/IResourceConverter.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,60 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Resource.Conversion
+{
+ public interface IResourceConversionService
+ {
+ /// <summary>
+ /// Upgrades the resource
+ /// </summary>
+ /// <param name="resource"></param>
+ /// <returns></returns>
+ IResource Upgrade(IResource resource, Version targetVersion);
+ }
+
+ public interface IResourceConverter
+ {
+ /// <summary>
+ /// Gets the type of resource this can convert
+ /// </summary>
+ string ResourceType { get; }
+
+ /// <summary>
+ /// Gets the version this converter can convert from
+ /// </summary>
+ Version SourceVersion { get; }
+
+ /// <summary>
+ /// Gets the version this converter will convert to
+ /// </summary>
+ Version TargetVersion { get; }
+
+ /// <summary>
+ /// Converts the resource
+ /// </summary>
+ /// <param name="resource"></param>
+ /// <returns></returns>
+ IResource Convert(IResource resource);
+ }
+}
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ResourceConverter.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ResourceConverter.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ResourceConverter.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,104 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OSGeo.MapGuide.MaestroAPI.Exceptions;
+
+namespace OSGeo.MapGuide.MaestroAPI.Resource.Conversion
+{
+ public class ResourceConverter : IResourceConversionService
+ {
+ private IList<IResourceConverter> _upgraders;
+
+ internal ResourceConverter(IList<IResourceConverter> upgraders)
+ {
+ ValidateConverterList(upgraders);
+ _upgraders = upgraders;
+ }
+
+ private void ValidateConverterList(IList<IResourceConverter> upgraders)
+ {
+ var conv = new Dictionary<ResourceTypeDescriptor, IResourceConverter>();
+ foreach (var upg in upgraders)
+ {
+ var desc = new ResourceTypeDescriptor(upg.ResourceType, upg.SourceVersion.ToString());
+ if (conv.ContainsKey(desc))
+ throw new ResourceConversionException(string.Format(Properties.Resources.ERR_CONVERTER_ALREADY_REGISTERED, upg.ResourceType + " " + upg.SourceVersion));
+
+ conv.Add(desc, upg);
+ }
+ }
+
+ private IResourceConverter FindUpgrader(string resourceType, Version source)
+ {
+ foreach (var conv in _upgraders)
+ {
+ if (conv.SourceVersion == source && conv.ResourceType == resourceType)
+ return conv;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// Performs the upgrade of a given resource. If the versions differ
+ /// by more than one revision, the upgrade is done incrementally. (eg. Upgrading
+ /// a 1.0.0 Layer Definition to 1.2.0 will go from:
+ /// - 1.0.0 to 1.1.0
+ /// - 1.1.0 to 1.2.0
+ ///
+ /// If the target version matches the resource's version, the original resource is returned
+ /// </summary>
+ /// <param name="resource"></param>
+ /// <param name="version"></param>
+ /// <returns></returns>
+ public IResource Upgrade(IResource resource, Version version)
+ {
+ if (resource.ResourceVersion == version)
+ return resource;
+
+ string rt = resource.ResourceType;
+ IResource res = (IResource)resource.Clone();
+ Version currentVer = res.ResourceVersion;
+ //Construct the upgrade path
+ List<IResourceConverter> upgradePath = new List<IResourceConverter>();
+ while (currentVer < version)
+ {
+ var conv = FindUpgrader(rt, currentVer);
+ if (conv == null)
+ break;
+
+ upgradePath.Add(conv);
+ currentVer = conv.TargetVersion;
+ }
+
+ if (currentVer != version)
+ {
+ throw new ResourceConversionException(Properties.Resources.ERR_NO_UPGRADE_PATH);
+ }
+
+ for (int i = 0; i < upgradePath.Count; i++)
+ {
+ res = upgradePath[i].Convert(res);
+ }
+ return res;
+ }
+ }
+}
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ResourceUpgrader.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ResourceUpgrader.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/Conversion/ResourceUpgrader.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,66 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Resource.Conversion
+{
+ public abstract class ResourceUpgrader<T> : IResourceConverter where T : IResource
+ {
+ public abstract Version TargetVersion
+ {
+ get;
+ }
+
+ public T Convert(T resource)
+ {
+ if (resource.ResourceVersion > this.TargetVersion)
+ throw new InvalidOperationException(Properties.Resources.ERR_CANNOT_UPGRADE_NEWER_RESOURCE);
+
+ if (resource.ResourceVersion == this.TargetVersion)
+ return resource;
+
+ return Upgrade(resource);
+ }
+
+ /// <summary>
+ /// Upgrades the resource to the target version
+ /// </summary>
+ /// <param name="resource"></param>
+ /// <returns></returns>
+ protected abstract T Upgrade(T resource);
+
+ public IResource Convert(IResource resource)
+ {
+ return Convert((T)resource);
+ }
+
+ public abstract Version SourceVersion
+ {
+ get;
+ }
+
+ public abstract string ResourceType
+ {
+ get;
+ }
+ }
+}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IResource.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -23,14 +23,12 @@
namespace OSGeo.MapGuide.MaestroAPI.Resource
{
- public interface IResource
+ public interface IResource : IVersionedEntity, ICloneable
{
IServerConnection CurrentConnection { get; }
string ResourceID { get; set; }
string ResourceType { get; }
-
- Version ResourceVersion { get; }
}
}
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IVersionedEntity.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IVersionedEntity.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/IVersionedEntity.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,30 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI.Resource
+{
+ public interface IVersionedEntity
+ {
+ Version ResourceVersion { get; }
+ }
+}
Added: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceContentVersionChecker.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceContentVersionChecker.cs (rev 0)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceContentVersionChecker.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -0,0 +1,72 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Xml;
+
+namespace OSGeo.MapGuide.MaestroAPI.Resource
+{
+ /// <summary>
+ /// Inspects a resource content stream to determine the version of the resource content within
+ ///
+ /// The stream to be inspected is copied and the inspection is made on the copy
+ /// </summary>
+ public sealed class ResourceContentVersionChecker : IDisposable
+ {
+ private XmlReader _reader;
+ private MemoryStream _stream;
+
+ /// <summary>
+ /// Constructor
+ /// </summary>
+ /// <param name="stream">The resource content stream. Inspection is done on a copy of this stream</param>
+ public ResourceContentVersionChecker(Stream stream)
+ {
+ _stream = new MemoryStream();
+ Utility.CopyStream(stream, _stream);
+ _reader = new XmlTextReader(_stream);
+ }
+
+ /// <summary>
+ /// Gets the resource content version
+ /// </summary>
+ /// <returns></returns>
+ public Version GetVersion()
+ {
+ Version v = new Version(1, 0, 0);
+
+ //Inspect the stream up to the version attribute
+ //Parse this attribute and return it
+
+ return v;
+ }
+
+ /// <summary>
+ /// Disposes this instance
+ /// </summary>
+ public void Dispose()
+ {
+ _reader.Close();
+ _stream.Dispose();
+ }
+ }
+}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceIdentifier.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceIdentifier.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceIdentifier.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -21,7 +21,7 @@
using System.Collections.Generic;
using System.Text;
-namespace OSGeo.MapGuide.MaestroAPI
+namespace OSGeo.MapGuide.MaestroAPI.Resource
{
/// <summary>
/// This class contains all the required code for maintaining resource identifiers.
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceTypeDescriptor.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceTypeDescriptor.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Resource/ResourceTypeDescriptor.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -25,6 +25,12 @@
{
public class ResourceTypeDescriptor
{
+ public ResourceTypeDescriptor(string resType, string ver)
+ {
+ this.ResourceType = resType;
+ this.Version = ver;
+ }
+
public string ResourceType { get; set; }
public string Version { get; set; }
@@ -42,5 +48,10 @@
{
return this.ResourceType + this.Version;
}
+
+ public override int GetHashCode()
+ {
+ return this.ToString().GetHashCode();
+ }
}
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/Enums.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/Enums.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/Enums.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -22,7 +22,7 @@
//This file contains a copy/conversion of some of the internal MapGuide Header files
//This file is prone to breaking if the MapGuide Server is changed
-namespace OSGeo.MapGuide.MaestroAPI.BinarySerializer
+namespace OSGeo.MapGuide.MaestroAPI.Serialization
{
internal enum MgPacketHeader
: uint
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/IBinarySerializeable.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/IBinarySerializeable.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/IBinarySerializeable.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -19,7 +19,7 @@
#endregion
using System;
-namespace OSGeo.MapGuide.MaestroAPI.BinarySerializer
+namespace OSGeo.MapGuide.MaestroAPI.Serialization
{
/// <summary>
/// An object that can be serialized, using the internal MapGuide format, must implement this interface
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinaryDeserializer.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinaryDeserializer.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinaryDeserializer.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -20,7 +20,7 @@
using System;
using System.IO;
-namespace OSGeo.MapGuide.MaestroAPI.BinarySerializer
+namespace OSGeo.MapGuide.MaestroAPI.Serialization
{
/// <summary>
/// A utility for serializing objects to the internal MapGuide Format
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinarySerializer.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinarySerializer.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinarySerializer.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -20,7 +20,7 @@
using System;
using System.IO;
-namespace OSGeo.MapGuide.MaestroAPI.BinarySerializer
+namespace OSGeo.MapGuide.MaestroAPI.Serialization
{
/// <summary>
/// A utility for deserializing data in the internal MapGuide format.
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -27,6 +27,7 @@
using ObjCommon = OSGeo.MapGuide.ObjectModels.Common;
using AppDef = OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
using OSGeo.MapGuide.ObjectModels.Capabilities;
+using OSGeo.MapGuide.MaestroAPI.Resource;
namespace OSGeo.MapGuide.MaestroAPI
{
Property changes on: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http
___________________________________________________________________
Added: svn:ignore
+ bin
obj
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystem.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystem.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystem.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -43,11 +43,12 @@
namespace OSGeo.MapGuide.MaestroAPI
{
+ using CoordinateSystem;
/// <summary>
/// Interface to MapGuide coordinate system functions.
/// Only works with server > 1.2, since the coordinate mapping is not avalible through Http on older versions
/// </summary>
- public class HttpCoordinateSystem : CoordinateSystem
+ public class HttpCoordinateSystem : CoordinateSystem.CoordinateSystemBase
{
internal HttpCoordinateSystem() : base() { }
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystemCatalog.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystemCatalog.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystemCatalog.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Text;
using System.Xml;
+using OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
namespace OSGeo.MapGuide.MaestroAPI
{
@@ -105,7 +106,7 @@
public override bool IsLoaded { get { return m_categories != null; } }
- public override CoordinateSystem[] EnumerateCoordinateSystems(string category)
+ public override CoordinateSystem.CoordinateSystemBase[] EnumerateCoordinateSystems(string category)
{
CoordinateSystemCategory cat = null;
foreach (CoordinateSystemCategory csc in this.Categories)
@@ -118,20 +119,20 @@
}
if (cat == null)
- return new CoordinateSystem[0];
+ return new CoordinateSystemBase[0];
string req = this.RequestBuilder.EnumerateCoordinateSystems(category);
XmlDocument doc = new XmlDocument();
doc.Load(m_con.WebClient.OpenRead(req));
XmlNodeList lst = doc.SelectNodes("BatchPropertyCollection/PropertyCollection");
- CoordinateSystem[] data = new CoordinateSystem[lst.Count];
+ CoordinateSystemBase[] data = new CoordinateSystemBase[lst.Count];
for (int i = 0; i < lst.Count; i++)
data[i] = new HttpCoordinateSystem(cat, lst[i]);
return data;
}
- public override CoordinateSystem CreateEmptyCoordinateSystem()
+ public override CoordinateSystem.CoordinateSystemBase CreateEmptyCoordinateSystem()
{
return new HttpCoordinateSystem();
}
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystemCategory.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystemCategory.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpCoordinateSystemCategory.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -20,6 +20,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
namespace OSGeo.MapGuide.MaestroAPI
{
Modified: sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2010-05-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -29,6 +29,9 @@
using OSGeo.MapGuide.MaestroAPI.Mapping;
using OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
using OSGeo.MapGuide.MaestroAPI.Commands;
+using OSGeo.MapGuide.MaestroAPI.Resource;
+using OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
+using OSGeo.MapGuide.MaestroAPI.Serialization;
namespace OSGeo.MapGuide.MaestroAPI
{
@@ -659,7 +662,7 @@
SetResourceXmlData(selectionID, new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(RuntimeMapBase.RUNTIMEMAP_SELECTION_XML)));
System.IO.MemoryStream ms = new System.IO.MemoryStream();
- BinarySerializer.MgBinarySerializer serializer = new BinarySerializer.MgBinarySerializer(ms, m_siteVersion);
+ MgBinarySerializer serializer = new MgBinarySerializer(ms, m_siteVersion);
MapSelectionBase sel = new MapSelectionBase();
sel.Serialize(serializer);
ms.Position = 0;
@@ -697,11 +700,11 @@
try
{
- map.Serialize(new BinarySerializer.MgBinarySerializer(ms, this.SiteVersion));
+ map.Serialize(new MgBinarySerializer(ms, this.SiteVersion));
if (this.SiteVersion >= SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2))
{
ms2 = new System.IO.MemoryStream();
- map.SerializeLayerData(new BinarySerializer.MgBinarySerializer(ms2, this.SiteVersion));
+ map.SerializeLayerData(new MgBinarySerializer(ms2, this.SiteVersion));
}
SetResourceData(resourceID, "RuntimeData", ResourceDataType.Stream, ms);
@@ -761,9 +764,9 @@
if (!resourceID.StartsWith("Session:" + this.m_reqBuilder.SessionID + "//") || !resourceID.EndsWith(".Map"))
throw new Exception("Runtime maps must be in the current session repository");
- RuntimeMapBase m = RuntimeMapBase.Deserialize(new BinarySerializer.MgBinaryDeserializer(this.GetResourceData(resourceID, "RuntimeData"), this.SiteVersion));
+ RuntimeMapBase m = RuntimeMapBase.Deserialize(new MgBinaryDeserializer(this.GetResourceData(resourceID, "RuntimeData"), this.SiteVersion));
if (this.SiteVersion >= SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2))
- m.DeserializeLayerData(new BinarySerializer.MgBinaryDeserializer(this.GetResourceData(resourceID, "LayerGroupData"), this.SiteVersion));
+ m.DeserializeLayerData(new MgBinaryDeserializer(this.GetResourceData(resourceID, "LayerGroupData"), this.SiteVersion));
m.CurrentConnection = this;
return m;
@@ -1242,7 +1245,7 @@
//SetResourceXmlData(selectionID, new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(RUNTIMEMAP_SELECTION_XML)));
System.IO.MemoryStream ms = new System.IO.MemoryStream();
- BinarySerializer.MgBinarySerializer serializer = new BinarySerializer.MgBinarySerializer(ms, m_siteVersion);
+ MgBinarySerializer serializer = new MgBinarySerializer(ms, m_siteVersion);
MapSelectionBase sel = new MapSelectionBase(selectionXml);
sel.Serialize(serializer);
ms.Position = 0;
@@ -1259,7 +1262,7 @@
ResourceIdentifier.Validate(runtimeMap, ResourceTypes.RuntimeMap);
string selectionID = runtimeMap.Substring(0, runtimeMap.LastIndexOf(".")) + ".Selection";
System.IO.MemoryStream ms = GetResourceData(selectionID, "RuntimeData");
- BinarySerializer.MgBinaryDeserializer deserializer = new BinarySerializer.MgBinaryDeserializer(ms, m_siteVersion);
+ MgBinaryDeserializer deserializer = new MgBinaryDeserializer(ms, m_siteVersion);
MapSelectionBase sel = new MapSelectionBase();
sel.Deserialize(deserializer);
return sel.SelectionXml;
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-12 15:32:57 UTC (rev 4857)
+++ sandbox/maestro-2.5/OSGeo.MapGuide.MaestroAPI.Http/Properties/AssemblyInfo.cs 2010-05-12 16:16:21 UTC (rev 4858)
@@ -33,4 +33,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyFileVersion("1.0.0.0")]
+
+[assembly: InternalsVisibleTo("MaestroAPITests")]
\ No newline at end of file
More information about the mapguide-commits
mailing list