wiki:Maestro3CustomCommands

Version 1 (modified by jng, 14 years ago) ( diff )

--

Custom Commands

The problem

The current ServerConnectionI interface is a monolithic interface. It is hard to add functionality that may not be possible on certain implementations. A flexible way to extend functionality is required.

The solution

Taking a page out of the FDO API, we will use a command-based API for defining custom functionality

public interface ICommand
{
    ...
    IServerConnection Parent { get; }
}

public interface IServerConnection
{
    ...
 
    ICommand CreateCommand(int commandType);

    ...
}

A capability API will also be made available so that certain implementations can advertise what commands they support.

Through this command mechanism, we can then define custom commands that certain implementations of IServerConnection may or may not choose to implement.

For example, Bulk copying.

// Copies features from one feature source to another
public interface IBulkCopy : ICommand
{
    string SourceFeatureSource { get; set; }

    string TargetFeatureSource { get; set; }

    void AddMapping(BulkCopyMapping mapping);

    void Execute(IBulkCopyProgressCallback callback);
}

public class BulkCopyMapping
{
    public string SourceFeatureClass { get; set; }
    public string TargetFeatureClass { get; set; }

    ...
}

Another example, re-projecting features

// Selects features from the specified feature class and re-projects them to the
// target coordinate system.
public interface IReprojectFeatures : ICommand
{
    public string SourceFeatureSource { get; set; }

    public string SourceFeatureClass { get; set; }

    public string Filter { get; set; }

    public string SourceCoordinateSystem { get; set; }

    public string TargetCoordinateSystem { get; set; }

    public void Execute(IReprojectFeaturesCallback callback);
}

These are just some examples off the top of my head, but a whole stack of geo-processing functionality could be made available through such an approach.

Note: See TracWiki for help on using the wiki.