/// <summary>
        /// Initializes a new instance of the <see cref="StorageManager"/> class.
        /// </summary>
        /// <param name="connectionString">Azure storage connection string</param>
        /// <param name="tableType">The type of tables to interact with</param>
        /// <param name="runId">Uniquely identifies an execution of the OBA service</param>
        public StorageManager(string connectionString, TableNames.TableType tableType, string runId)
        {
            // setup access to Azure Tables
            CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(connectionString);
            CloudTableClient    tableClient         = cloudStorageAccount.CreateCloudTableClient();

            // instantiate every one of the stores
            switch (tableType)
            {
            // Download table stores data received from OBA servers.
            case TableNames.TableType.Download:
            // Diff table stores diffs between a download table and a publish table.
            case TableNames.TableType.Diff:
            // Publish table stores data that has been published to Embedded Social.
            case TableNames.TableType.Publish:
                this.RegionsListStore = new RegionsListStore(tableClient, tableType, runId);
                this.RegionStore      = new RegionStore(tableClient, tableType, runId);
                this.AgencyStore      = new AgencyStore(tableClient, tableType, runId);
                this.RouteStore       = new RouteStore(tableClient, tableType, runId);
                this.StopStore        = new StopStore(tableClient, tableType, runId);
                break;

            // DownloadMetada table stores bookkeeping records of download activity.
            case TableNames.TableType.DownloadMetadata:
                this.DownloadMetadataStore = new DownloadMetadataStore(tableClient, tableType, runId);
                break;

            // DiffMetadata table stores bookkeeping records of diff activity.
            case TableNames.TableType.DiffMetadata:
                this.DiffMetadataStore = new DiffMetadataStore(tableClient, tableType, runId);
                break;

            // PublishMetadata table stores bookkeeping records of publish activity.
            case TableNames.TableType.PublishMetadata:
                this.PublishMetadataStore = new PublishMetadataStore(tableClient, tableType, runId);
                break;

            // Metadata table stores bookkeeping records of overall activity in this service.
            case TableNames.TableType.Metadata:
                // not implemented yet
                throw new ArgumentOutOfRangeException("tableType");

            default:
                throw new ArgumentOutOfRangeException("tableType");
            }
        }
Exemple #2
0
        /// <summary>
        /// Constructs the name of a table
        /// </summary>
        /// <param name="tableType">type of table</param>
        /// <param name="runId">uniquely identifies a run</param>
        /// <returns>the name of a table</returns>
        public static string TableName(TableNames.TableType tableType, string runId)
        {
            switch (tableType)
            {
            // Download table stores data received from OBA servers.
            case TableNames.TableType.Download:
                return(tableType.ToString() + runId);

            // DownloadMetada table stores bookkeeping records of download activity.
            case TableNames.TableType.DownloadMetadata:
                return(tableType.ToString());

            // Diff table stores diffs between a download table and a publish table.
            case TableNames.TableType.Diff:
                return(tableType.ToString() + runId);

            // DiffMetadata table stores bookkeeping records of diff activity.
            case TableNames.TableType.DiffMetadata:
                return(tableType.ToString());

            // Publish table stores data that has been published to Embedded Social.
            case TableNames.TableType.Publish:
                return(tableType.ToString());

            // PublishMetadata table stores bookkeeping records of publish activity.
            case TableNames.TableType.PublishMetadata:
                return(tableType.ToString());

            // Metadata table stores bookkeeping records of overall activity in this service.
            case TableNames.TableType.Metadata:
                return(tableType.ToString());

            default:
                throw new ArgumentOutOfRangeException("tableType");
            }
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DownloadMetadataStore"/> class.
 /// </summary>
 /// <param name="cloudTableClient">client to Azure Table</param>
 /// <param name="tableType">type of table</param>
 /// <param name="runId">uniquely identifies an execution of the OBA service</param>
 public DownloadMetadataStore(CloudTableClient cloudTableClient, TableNames.TableType tableType, string runId)
     : base(cloudTableClient, TableNames.TableName(tableType, runId))
 {
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RegionStore"/> class.
 /// </summary>
 /// <param name="cloudTableClient">client to Azure Table</param>
 /// <param name="tableType">type of table</param>
 /// <param name="runId">uniquely identifies an execution of the OBA service</param>
 public RegionStore(CloudTableClient cloudTableClient, TableNames.TableType tableType, string runId)
     : base(cloudTableClient, TableNames.TableName(tableType, runId))
 {
 }