[mapguide-commits] r7173 - in trunk/Tools/Maestro: Maestro.Editors/MapDefinition MgCooker OSGeo.MapGuide.MaestroAPI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Oct 30 22:23:04 PDT 2012
Author: jng
Date: 2012-10-30 22:23:03 -0700 (Tue, 30 Oct 2012)
New Revision: 7173
Modified:
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
trunk/Tools/Maestro/MgCooker/MgCooker.csproj
trunk/Tools/Maestro/MgCooker/Program.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs
Log:
MgCooker: Add support for --provider and --connection-params parameters. With these two parameters (and #2019) we can now invoke MgCooker from the Map Definition editor using existing url/sessionid without needing to spring up a login dialog.
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2012-10-31 04:57:53 UTC (rev 7172)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2012-10-31 05:23:03 UTC (rev 7173)
@@ -1444,11 +1444,9 @@
return;
}
- //HACK: This will ask for login again because we don't store username/password and MgCooker does not
- //support initialization from a session id yet. But at least MgCooker will launch with the correct
- //map definition loaded
_edSvc.RunProcess("MgCooker",
- "--mapagent=" + conn.GetCustomProperty("BaseUrl"),
+ "--provider=Maestro.Http",
+ "--connection-params=\"Url=" + conn.GetCustomProperty("BaseUrl").ToString() + ";SessionId=" + conn.SessionID + "\"",
"--mapdefinitions=" + _edSvc.ResourceID);
}
Modified: trunk/Tools/Maestro/MgCooker/MgCooker.csproj
===================================================================
--- trunk/Tools/Maestro/MgCooker/MgCooker.csproj 2012-10-31 04:57:53 UTC (rev 7172)
+++ trunk/Tools/Maestro/MgCooker/MgCooker.csproj 2012-10-31 05:23:03 UTC (rev 7173)
@@ -53,14 +53,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Maestro.Login, Version=3.0.0.5475, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\SDK\bin\Maestro.Login.dll</HintPath>
- </Reference>
- <Reference Include="OSGeo.MapGuide.MaestroAPI, Version=3.0.0.5475, Culture=neutral, PublicKeyToken=f526c48929fda856, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\SDK\bin\OSGeo.MapGuide.MaestroAPI.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
@@ -146,10 +138,18 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\Maestro.Login\Maestro.Login.csproj">
+ <Project>{07588440-5f9f-4c30-aa06-9cf30ba6dde6}</Project>
+ <Name>Maestro.Login</Name>
+ </ProjectReference>
<ProjectReference Include="..\OSGeo.MapGuide.ExtendedObjectModels\OSGeo.MapGuide.ExtendedObjectModels.csproj">
- <Project>{B3A2B816-9F41-4857-A111-09D2DF2550D6}</Project>
+ <Project>{b3a2b816-9f41-4857-a111-09d2df2550d6}</Project>
<Name>OSGeo.MapGuide.ExtendedObjectModels</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.
Modified: trunk/Tools/Maestro/MgCooker/Program.cs
===================================================================
--- trunk/Tools/Maestro/MgCooker/Program.cs 2012-10-31 04:57:53 UTC (rev 7172)
+++ trunk/Tools/Maestro/MgCooker/Program.cs 2012-10-31 05:23:03 UTC (rev 7173)
@@ -156,18 +156,27 @@
{
if (largs.IndexOf("/commandline") < 0 && largs.IndexOf("commandline") < 0)
{
- var frm = new LoginDialog();
- if (frm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
- return;
+ if (opts.ContainsKey("provider") && opts.ContainsKey("connection-params"))
+ {
+ var initP = ConnectionProviderRegistry.ParseConnectionString(opts["connection-params"]);
+ connection = ConnectionProviderRegistry.CreateConnection(opts["provider"], initP);
+ sr = new SetupRun(connection, maps, opts);
+ }
+ else
+ {
+ var frm = new LoginDialog();
+ if (frm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
+ return;
- connection = frm.Connection;
+ connection = frm.Connection;
+ sr = new SetupRun(frm.Username, frm.Password, connection, maps, opts);
+ }
try
{
mapagent = connection.GetCustomProperty("BaseUrl").ToString();
}
catch { }
-
- sr = new SetupRun(frm.Username, frm.Password, connection, maps, opts);
+
}
}
@@ -184,6 +193,12 @@
connection = ConnectionProviderRegistry.CreateConnection("Maestro.Http", initP);
}
+ else if (opts.ContainsKey("provider") && opts.ContainsKey("connection-params"))
+ {
+ initP = ConnectionProviderRegistry.ParseConnectionString(opts["connection-params"]);
+
+ connection = ConnectionProviderRegistry.CreateConnection(opts["provider"], initP);
+ }
else
{
string serverconfig = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "webconfig.ini");
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs 2012-10-31 04:57:53 UTC (rev 7172)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ConnectionProviderRegistry.cs 2012-10-31 05:23:03 UTC (rev 7173)
@@ -187,7 +187,12 @@
}
}
- internal static NameValueCollection ParseConnectionString(string connectionString)
+ /// <summary>
+ /// Parses the given Maestro connection string into a <see cref="T:System.Collections.Specialized.NameValueCollection"/>
+ /// </summary>
+ /// <param name="connectionString"></param>
+ /// <returns></returns>
+ public static NameValueCollection ParseConnectionString(string connectionString)
{
var builder = new DbConnectionStringBuilder();
builder.ConnectionString = connectionString;
More information about the mapguide-commits
mailing list