#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 using System; using System.Collections.Generic; using System.Text; using ObjCommon = OSGeo.MapGuide.ObjectModels.Common; using OSGeo.MapGuide.MaestroAPI.Resource; using System.IO; namespace OSGeo.MapGuide.MaestroAPI.Services { /// /// Provides services for accessing resources in a repository /// /// /// Note that provides /// built-in access to resource and feature services. Using the /// method is not necessary /// public interface IResourceService : IService { /// /// Raised when a resource is added /// event ResourceEventHandler ResourceAdded; /// /// Raised when a resource is deleted. Note if a folder is deleted, this will /// only be raised for the folder and not its children. Also note that this is /// raised on any move operations as the original source is for all intents and /// purposes, deleted. /// event ResourceEventHandler ResourceDeleted; /// /// Raised when a resource is updated /// event ResourceEventHandler ResourceUpdated; /// /// Gets a listing of resources in this repository. This performs a full listing /// /// ObjCommon.ResourceList GetRepositoryResources(); /// /// Gets a listing of resources in this repository /// /// /// ObjCommon.ResourceList GetRepositoryResources(int depth); /// /// Gets a listing of resources in this repository /// /// /// /// ObjCommon.ResourceList GetRepositoryResources(string startingpoint, int depth); /// /// Gets a listing of resources in this repository /// /// /// ObjCommon.ResourceList GetRepositoryResources(string startingpoint); /// /// Gets a listing of resources in this repository /// /// /// /// ObjCommon.ResourceList GetRepositoryResources(string startingpoint, string type); /// /// Gets a listing of resources in this repository /// /// /// /// /// ObjCommon.ResourceList GetRepositoryResources(string startingpoint, string type, int depth); /// /// Gets a listing of resources in this repository /// /// /// /// /// /// ObjCommon.ResourceList GetRepositoryResources(string startingpoint, string type, int depth, bool computeChildren); /// /// Converts the specified XML stream to a strongly typed object /// /// /// /// T DeserializeObject(System.IO.Stream data); /// /// Serializes the specified object to the specified stream /// /// /// void SerializeObject(object o, System.IO.Stream stream); /// /// Gets the stream of the attached data of the specified resource /// /// /// /// System.IO.Stream GetResourceData(string resourceID, string dataname); /// /// Gets the document header of the specified resource /// /// /// ObjCommon.ResourceDocumentHeaderType GetResourceHeader(string resourceID); /// /// Gets the folder header of the specified resource /// /// /// ObjCommon.ResourceFolderHeaderType GetFolderHeader(string resourceID); /// /// Gets the raw XML stream of the specified resource id /// /// /// Stream GetResourceXmlData(string resourceID); /// /// Gets a typed resource object from the specified resource id /// /// /// IResource GetResource(string resourceID); /// /// Forces a timestamp update of the specified resource. This is akin to /// setting the resource's content using its existing content. /// /// void Touch(string resourceID); /// /// Sets the resource data of a specified resource /// /// For the HTTP implementation of this API, the input stream must be seekable /// /// /// /// void SetResourceData(string resourceid, string dataname, ObjCommon.ResourceDataType datatype, System.IO.Stream stream); /// /// Sets the resource data of a specified resource /// /// For the HTTP implementation of this API, the input stream must be seekable /// /// /// /// /// void SetResourceData(string resourceid, string dataname, ObjCommon.ResourceDataType datatype, System.IO.Stream stream, Utility.StreamCopyProgressDelegate callback); /// /// Sets the raw XML data of the specified resource /// /// /// void SetResourceXmlData(string resourceid, System.IO.Stream stream); /// /// Sets the header for the specified folder /// /// /// void SetFolderHeader(string resourceID, ObjCommon.ResourceFolderHeaderType header); /// /// Sets the header for the specified resource /// /// /// void SetResourceHeader(string resourceID, ObjCommon.ResourceDocumentHeaderType header); /// /// Updates the repository /// /// /// void UpdateRepository(string resourceId, ObjCommon.ResourceFolderHeaderType header); /// /// Deletes the specified attached resource data /// /// /// void DeleteResourceData(string resourceID, string dataname); /// /// Gets a listing of all resource data attached to the specified resource /// /// /// ObjCommon.ResourceDataList EnumerateResourceData(string resourceID); /// /// Delete the specified resource. For folders, ensure the resource ID has a trailing slash "/" /// /// void DeleteResource(string resourceID); /// /// Gets a listing of all resources dependent on the specified resource /// /// /// ObjCommon.ResourceReferenceList EnumerateResourceReferences(string resourceid); /// /// Copies the specified resource to the specified path /// /// /// /// void CopyResource(string oldpath, string newpath, bool overwrite); /// /// Moves the specified resources to the specified path /// /// /// /// void MoveResource(string oldpath, string newpath, bool overwrite); /// /// Moves the specified resources to the specified path. Any resources referencing this resource /// are updated to reference the resource's new location /// /// /// /// /// /// bool MoveResourceWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress); /// /// Copies the specified folder to the specified path. Any resources referencing this folder /// are updated to reference the resources's new location /// /// /// /// /// /// bool CopyFolderWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress); /// /// Gets whether the specified resource id exists /// /// /// bool ResourceExists(string resourceid); /// /// Saves an object into the repository /// /// void SaveResource(IResource resource); /// /// Saves an object into the repository using the specified resource id. /// /// /// The parameter only instructs this method where to save the resource to. It does /// not modify the property of the input resource does not get /// updated as a result of this operation. /// /// The object to save /// The resourceId to save the object as void SaveResourceAs(IResource resource, string resourceid); /// /// 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 ObjCommon.UnmanagedDataList EnumerateUnmanagedData(string startpath, string filter, bool recursive, UnmanagedDataTypes type); /// /// Upload a MapGuide Package file to the server /// /// Name of the file to upload /// A callback argument used to display progress. May be null. void UploadPackage(string filename, Utility.StreamCopyProgressDelegate callback); } }