Common CustomDataSource
Common_CustomDataSource_CSharp\CustomDataSource_CSharp\REXMLDataSource_CSharp\GISDataSource.cs
// Copyright 2007 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
//

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Collections;
using ESRI.ArcGIS.ADF.Web.DataSources;

namespace REXMLDataSource_CSharp
{
    public class GISDataSource : IGISDataSource
    {

        public GISDataSource() { }

        public GISDataSource(string name, string dataSourceDefinition) : this(name, string.Empty, dataSourceDefinition) { }

        public GISDataSource(string name, string identity, string dataSourceDefinition)
        {
            this.name = name;
            this.identity = identity;
            this.dataSourceDefinition = dataSourceDefinition;
        }

        #region IGISDataSource implementation

        private Hashtable m_state;
        private string name = string.Empty;
        private string dataSourceDefinition = string.Empty;
        private string identity = string.Empty;
        private Page page = null;
        private GISResourceCollection resources = new GISResourceCollection();

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string DataSourceDefinition
        {
            get { return dataSourceDefinition; }
            set
            {
                if (dataSourceDefinition != value)
                {
                    dataSourceDefinition = value;
                }
            }
        }

        public string Identity
        {
            get { return identity; }
            set { identity = value; }
        }

        public Page Page
        {
            get { return page; }
            set { page = value; }
        }

        public GISResourceCollection Resources
        {
            get { return resources; }
            set { resources = value; }
        }

        bool _initialized = false;

        public bool Initialized
        {
            get { return _initialized; }
        }

        public void LoadState(Hashtable state)
        {
            m_state = state;

        }

        public void Initialize()
        {
            _initialized = true;
        }

        public Hashtable SaveState()
        {
            return m_state;
        }

        public void Dispose()
        {
            _initialized = false;
        }

        public Hashtable State
        {
            get
            {
                return m_state;
            }
        }

        public string[] GetAvailableResourceDefinitions(System.Type resourceType)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public IGISResource CreateResource(string resourceDefinition, string name)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion
    }
}