#region Disclaimer / License
// Copyright (C) 2010, Jackie Ng
// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie@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 Disclaimer / License
using OSGeo.MapGuide.MaestroAPI.Commands;
using OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
using OSGeo.MapGuide.MaestroAPI.Services;
using OSGeo.MapGuide.ObjectModels.LoadProcedure;
using System;
using System.Collections.Specialized;
namespace OSGeo.MapGuide.MaestroAPI
{
///
///
/// MapGuide Platform connection interface. This is the root object of the Maestro API which typically
/// represents a session with a MapGuide Server. Connections are created through the
/// class.
///
///
/// All implementations supports the base services of the MapGuide Geospatial API:
///
///
/// -
/// Resource Service () for manipulation of repositories and resources
///
/// -
/// Feature Service () an abstraction layer for querying feature data in technology-independent manner.
///
/// -
/// Coordinate System Catalog ( for querying coordinate systems and for translating WKT, cs code and EPSG codes to other forms
///
///
///
/// Additional services are supported at various levels depending on the implementation.
/// The property provides information about
/// what features, services and resource types are not supported.
///
///
public interface IServerConnection
{
///
/// Gets the preview URL generator.
///
/// Each call will return a new instance
/// The preview URL generator. Returns null if this connection does not support browser-based resource previews
Resource.Preview.IResourcePreviewUrlGenerator GetPreviewUrlGenerator();
///
/// Gets the name of the provider of this implementation
///
string ProviderName { get; }
///
/// Gets a collection of name-value parameters required to create another copy
/// of this connection via the
///
/// Each invocation returns a new instance
///
NameValueCollection CloneParameters { get; }
///
/// Returns a clone copy of this connection
///
///
IServerConnection Clone();
///
/// Executes the specified load procedure
///
///
///
///
///
string[] ExecuteLoadProcedure(ILoadProcedure loadProc, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback, bool ignoreUnsupportedFeatures);
///
/// Executes the load procedure indicated by the specified resource id
///
///
///
///
///
string[] ExecuteLoadProcedure(string resourceID, OSGeo.MapGuide.MaestroAPI.LengthyOperationProgressCallBack callback, bool ignoreUnsupportedFeatures);
///
/// Gets the feature service
///
IFeatureService FeatureService { get; }
///
/// Gets the resource service
///
IResourceService ResourceService { get; }
///
/// Creates a command of the specified type
///
///
/// Some commands may not be supported by the connection. You can find out if the connection supports a particular command through the
///
/// The type of command to create. See for allowed values
///
ICommand CreateCommand(int commandType);
///
/// Gets the capabilities for this connection. The capabilities describes
/// what commands and services are supported by this connection
///
IConnectionCapabilities Capabilities { get; }
///
/// Gets the session ID for this connection
///
string SessionID { get; }
///
/// Raised when the session ID has changed
///
event EventHandler SessionIDChanged;
///
/// Gets or sets a value indicating if the session should automatically be restarted if it expires
///
bool AutoRestartSession { get; set; }
///
/// Gets the service based on the given type
///
///
/// Some commands may not be supported by the connection. You can find out if the connection supports a particular command through the
///
/// The type of service to create. See for allowed values
///
IService GetService(int serviceType);
///
/// Gets the max tested version
///
Version MaxTestedVersion { get; }
///
/// Gets the version of the site we're connected to
///
Version SiteVersion { get; }
///
/// Enables/Disables resource validation
///
bool DisableValidation { get; set; }
///
/// Gets the coordinate system catalog
///
ICoordinateSystemCatalog CoordinateSystemCatalog { get; }
///
/// Gets a string that can be used to identify the server by a user
///
string DisplayName { get; }
///
/// Restarts the server session, and creates a new session ID
///
void RestartSession();
///
/// Restarts the server session, and creates a new session ID
///
/// If set to true, the call throws an exception if the call failed
/// True if the creation succeed, false otherwise
bool RestartSession(bool throwException);
///
/// Enumerates the names of all custom properties for this connection
///
///
string[] GetCustomPropertyNames();
///
/// Gets the type of the specified property name
///
///
///
Type GetCustomPropertyType(string name);
///
/// Sets the value of the specified property name
///
///
///
void SetCustomProperty(string name, object value);
///
/// Gets the value of the specified property name
///
///
///
object GetCustomProperty(string name);
///
/// Raised when a outbound request has been dispatched
///
event RequestEventHandler RequestDispatched;
///
/// Returns a meters-per-unit calculator
///
///
IMpuCalculator GetCalculator();
}
///
///
///
public delegate void RequestEventHandler(object sender, RequestEventArgs e);
///
/// event object containing dispatched request infromation
///
public class RequestEventArgs : EventArgs
{
///
/// Gets or sets the data.
///
/// The data.
public string Data { get; }
///
/// Initializes a new instance of the class.
///
/// The data.
public RequestEventArgs(string data)
{
this.Data = data;
}
}
}