#region Disclaimer / License
// Copyright (C) 2006, Kenneth Skovhede
// http://www.hexad.dk, opensource@hexad.dk
//
// 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 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.Net;
using System.Xml;
using System.Collections.Specialized;
using System.Collections;
namespace OSGeo.MapGuide.MaestroAPI
{
///
/// Primary connection to the MapGuide Server
///
public interface ServerConnectionI
{
string SessionID { get; }
ResourceList RepositoryResources { get; }
ResourceList GetRepositoryResources();
ResourceList GetRepositoryResources(int depth);
ResourceList GetRepositoryResources(string startingpoint, int depth);
ResourceList GetRepositoryResources(string startingpoint);
ResourceList GetRepositoryResources(string startingpoint, string type);
ResourceList GetRepositoryResources(string startingpoint, string type, int depth);
FeatureProviderRegistryFeatureProviderCollection FeatureProviders { get; }
string TestConnection(string providername, NameValueCollection parameters);
string TestConnection(string featuresource);
string TestConnection(FeatureSource feature);
///
/// Gets or sets a value indicating if the session should automatically be restarted if it expires
///
bool AutoRestartSession { get; set; }
///
/// Placeholder for actual method call
///
void DescribeSchema();
///
/// Builds a resource Identifier, using path info
///
/// The initial absolute path, not including type or repository info, ea. Test/MyResource
/// The type of the resource
/// True if the item is found in the session
/// A string representing the resource identifier
string GetResourceIdentifier(string path, ResourceTypes type, bool fromSession);
///
/// Validates a resource identifier. Only validates the string, not the existence of the resource
///
/// The full resource identifier
/// The type of resource that is identified
void ValidateResourceID(string resourceid, ResourceTypes type);
OSGeo.MapGuide.MaestroAPI.WebLayout GetWebLayout(string resourceID);
OSGeo.MapGuide.MaestroAPI.MapDefinition GetMapDefinition(string resourceID);
OSGeo.MapGuide.MaestroAPI.LayerDefinition GetLayerDefinition(string resourceID);
OSGeo.MapGuide.MaestroAPI.ApplicationDefinition.ApplicationDefinitionType GetApplicationDefinition(string resourceID);
OSGeo.MapGuide.MaestroAPI.FdoProviderCapabilities GetProviderCapabilities(string provider);
System.IO.MemoryStream GetResourceData(string resourceID, string dataname);
OSGeo.MapGuide.MaestroAPI.FeatureSource GetFeatureSource(string resourceID);
byte[] GetResourceXmlData(string resourceID);
object GetResource(string resourceID);
///
/// Removes the version numbers from a providername
///
/// The name of the provider, with or without version numbers
/// The provider name without version numbers
string RemoveVersionFromProviderName(string providername);
///
/// Returns an installed provider, given the name of the provider
///
/// The name of the provider
/// The first matching provider or null
FeatureProviderRegistryFeatureProvider GetFeatureProvider(string providername);
System.IO.Stream GetMapDWF(string resourceID);
object DeserializeObject(Type type, System.IO.Stream data);
System.IO.MemoryStream SerializeObject(object o);
void SerializeObject(object o, System.IO.Stream stream);
Version MaxTestedVersion { get; }
void SetResourceData(string resourceid, string dataname, ResourceDataType datatype, System.IO.Stream stream);
void SetResourceXmlData(string resourceid, System.IO.Stream stream);
FeatureSetReader QueryFeatureSource(string resourceID, string schema, string query);
FeatureSetReader QueryFeatureSource(string resourceID, string schema);
FeatureSetReader QueryFeatureSource(string resourceID, string schema, string query, string[] columns);
FeatureSourceDescription DescribeFeatureSource(string resourceID);
FeatureSourceDescription DescribeFeatureSource(string resourceID, string schema);
FdoSpatialContextList GetSpatialContextInfo(string resourceID, bool activeOnly);
///
/// Creates a runtime map on the server
///
/// The target resource id for the runtime map
/// The mapdefinition to base the map on
void CreateRuntimeMap(string resourceID, string mapdefinition);
///
/// Creates a runtime map on the server
///
/// The target resource id for the runtime map
/// The mapdefinition to base the map on
void CreateRuntimeMap(string resourceID, MapDefinition map);
///
/// Creates a runtime map on the server
///
/// The target resource id for the runtime map
/// The mapdefinition to base the map on
void CreateRuntimeMap(string resourceID, RuntimeClasses.RuntimeMap map);
///
/// Updates an existing runtime map
///
/// The target resource id for the runtime map
/// The runtime map to update with
void SaveRuntimeMap(string resourceID, RuntimeClasses.RuntimeMap map);
void DeleteResourceData(string resourceID, string dataname);
ResourceDataList EnumerateResourceData(string resourceID);
void DeleteResource(string resourceID);
void DeleteFolder(string folderPath);
RuntimeClasses.RuntimeMap GetRuntimeMap(string resourceID);
Version SiteVersion { get; }
bool DisableValidation { get; set; }
CoordinateSystem CoordinateSystem { get; }
bool HasFolder(string folderpath);
void CreateFolder(string folderpath);
///
/// Gets a string that can be used to identify the server by a user
///
string DisplayName { get; }
ResourceReferenceList EnumerateResourceReferences(string resourceid);
void CopyResource(string oldpath, string newpath, bool overwrite);
void CopyFolder(string oldpath, string newpath, bool overwrite);
void MoveResource(string oldpath, string newpath, bool overwrite);
void MoveFolder(string oldpath, string newpath, bool overwrite);
bool MoveResourceWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress);
bool MoveFolderWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress);
bool CopyFolderWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress);
bool ResourceExists(string resourceid);
System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi);
///
/// Saves a WebLayout, using its originating resourceId
///
/// The WebLayout to save
void SaveResource(WebLayout resource);
///
/// Saves a FeatureSource, using its originating resourceId
///
/// The FeatureSource to save
void SaveResource(FeatureSource resource);
///
/// Saves a LayerDefinition, using its originating resourceId
///
/// The LayerDefinition to save
void SaveResource(LayerDefinition resource);
///
/// Saves a MapDefinition, using its originating resourceId
///
/// The MapDefintion to save
void SaveResource(MapDefinition resource);
///
/// Saves an object into the repository
///
/// The object to save
/// The resourceId to save the object as
void SaveResourceAs(object resource, string resourceid);
///
/// Saves a MapDefinition under a different resourceID
///
/// The MapDefinition to save
/// The new path of the MapDefinition
void SaveResourceAs(MapDefinition resource, string resourceid);
///
/// Saves a LayerDefinition under a different resourceID
///
/// The LayerDefinition to save
/// The new path of the LayerDefinition
void SaveResourceAs(LayerDefinition resource, string resourceid);
///
/// Saves a FeatureSource under a different resourceID
///
/// The FeatureSource to save
/// The new path of the FeatureSource
void SaveResourceAs(FeatureSource resource, string resourceid);
///
/// Saves a WebLayout under a different resourceID
///
/// The WebLayout to save
/// The new path of the WebLayout
void SaveResourceAs(WebLayout resource, string resourceid);
ApplicationDefinitionTemplateInfoSet GetApplicationTemplates();
///
/// Returns the avalible application widgets on the server
///
/// The avalible application widgets on the server
ApplicationDefinitionWidgetInfoSet GetApplicationWidgets();
///
/// Returns the avalible widget containers on the server
///
/// The avalible widget containers on the server
ApplicationDefinitionContainerInfoSet GetApplicationContainers();
///
/// Gets the resource type from a resourceID
///
/// The resourceID for the resource
/// The type of the given item, throws an exception if the type does not exist
Type GetResourceType(string resourceID);
///
/// Gets the resource type from a resourceID
///
/// The resourceID for the resource
/// The type of the given item, returns null if no such type exists
Type TryGetResourceType(string resourceID);
///
/// Gets the names of the identity properties from a feature
///
/// The resourceID for the FeatureSource
/// The classname of the feature, including schema
/// A string array with the found identities
string[] GetIdentityProperties(string resourceID, string classname);
///
/// Gets the name of a resource, given its identifier
///
/// The identifier to look for
/// True if path information should be include, false otherwise
/// The name of the resource
string GetResourceName(string identifier, bool includePath);
///
/// 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);
///
/// Sets the selection of a map
///
/// The resourceID of the runtime map
/// The selection xml
void SetSelectionXml(string runtimeMap, string selectionXml);
///
/// Gets the selection from a map
///
/// The resourceID of the runtime map
/// The selection xml
string GetSelectionXml(string runtimeMap);
///
/// Enumerates all unmanaged folders, meaning alias'ed folders
///
/// The type of data to return
/// A filter applied to the items
/// True if the list should contains recursive results
/// The path to retrieve the data from
/// A list of unmanaged data
UnmanagedDataList EnumerateUnmanagedData(string startpath, string filter, bool recursive, UnmanagedDataTypes type);
}
}