Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ControllerBuilder"/> class.
        /// </summary>
        /// <param name="mappingStoreConnectionSettings">
        /// The mapping store connection settings.
        /// </param>
        /// <param name="defaultHeader">
        /// The default header.
        /// </param>
        public ControllerBuilder(ConnectionStringSettings mappingStoreConnectionSettings, IHeader defaultHeader)
        {
            if (mappingStoreConnectionSettings == null)
            {
                _log.Error("No connection string defined. Please check the web.config.");
                throw new ArgumentNullException("mappingStoreConnectionSettings");
            }

            var dataRetrieverCore = new DataRetrieverCore(defaultHeader, mappingStoreConnectionSettings, SdmxSchemaEnumType.VersionTwo);
            var dataRetrieverV21  = new DataRetrieverCore(defaultHeader, mappingStoreConnectionSettings, SdmxSchemaEnumType.VersionTwoPointOne);

            this._retrievalWithCrossWriter    = dataRetrieverCore;
            this._retrievalWithWriter         = dataRetrieverCore;
            this._retrievalWithWriterv21      = dataRetrieverV21;
            this._advancedRetrievalWithWriter = dataRetrieverV21;

            // structure search factories
            IStructureSearchManagerFactory <IAdvancedMutableStructureSearchManager>     advancedFactory    = new AdvancedMutableStructureSearchManagerFactory();
            IStructureSearchManagerFactory <IAuthAdvancedMutableStructureSearchManager> autAdvancedFactory = new AuthAdvancedMutableStructureSearchManagerFactory();

            IStructureSearchManagerFactory <IMutableStructureSearchManager>     structureSearchManager = new MutableStructureSearchManagerFactory();
            IStructureSearchManagerFactory <IAuthMutableStructureSearchManager> autFactory             = new AuthMutableStructureSearchManagerFactory();

            // advanced structure search managers
            this._advancedMutableStructureSearchManager     = advancedFactory.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV21);
            this._authAdvancedMutableStructureSearchManager = autAdvancedFactory.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV21);

            // simple structure search managers
            this._mutableStructureSearchManagerV20     = structureSearchManager.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV20);
            this._authMutableStructureSearchManagerV20 = autFactory.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV20);

            this._mutableStructureSearchManagerV21       = structureSearchManager.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV21);
            this._authMutableStructureSearchManagerV21   = autFactory.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV21);
            this._mappingStoreSdmxObjectRetrievalManager = new MappingStoreSdmxObjectRetrievalManager(mappingStoreConnectionSettings);
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StructureRequestRestController{TWriter}"/> class.
 /// </summary>
 /// <param name="responseGenerator">
 /// The response generator.
 /// </param>
 /// <param name="structureSearchManager">
 /// The structure Search Manager.
 /// </param>
 /// <param name="authStructureSearchManager">
 /// The AUTH Structure Search Manager.
 /// </param>
 /// <param name="dataflowPrincipal">
 /// The dataflow principal.
 /// </param>
 /// <exception cref="SdmxSemmanticException">
 /// Operation not accepted with query used
 /// </exception>
 public StructureRequestRestController(
     IResponseGenerator <TWriter, ISdmxObjects> responseGenerator,
     IMutableStructureSearchManager structureSearchManager,
     IAuthMutableStructureSearchManager authStructureSearchManager,
     DataflowPrincipal dataflowPrincipal)
     : base(responseGenerator, dataflowPrincipal)
 {
     this._structureSearchManager     = structureSearchManager;
     this._authStructureSearchManager = authStructureSearchManager;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthStructureRetrieverAvailableData"/> class. 
        /// </summary>
        /// <exception cref="System.ArgumentNullException">
        /// defaultHeader is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// connectionStringSettings is null
        /// </exception>
        /// <exception cref="StructureRetrieverException">
        /// Could not establish a connection to the mapping store DB
        ///     <see cref="StructureRetrieverException.ErrorType"/>
        ///     is set to
        ///     <see cref="StructureRetrieverErrorTypes.MappingStoreConnectionError"/>
        /// </exception>
        /// <param name="connectionStringSettings">
        /// The connection to the "Mapping Store", from which the SDMX Structural metadata will be retrieved
        /// </param>
        /// <param name="sdmxSchema">
        /// The SDMX Schema.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// defaultHeader or connectionStringSettings is null
        /// </exception>
        public AuthStructureRetrieverAvailableData(ConnectionStringSettings connectionStringSettings, SdmxSchema sdmxSchema)
        {
            if (connectionStringSettings == null)
            {
                throw new ArgumentNullException("connectionStringSettings");
            }

            IStructureSearchManagerFactory<IAuthMutableStructureSearchManager> factory = new AuthMutableStructureSearchManagerFactory();

            this._authStructureRetriever = factory.GetStructureSearchManager(connectionStringSettings, sdmxSchema);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StructureRequestV20Controller{TWriter}"/> class.
        /// </summary>
        /// <param name="responseGenerator">
        /// The response generator.
        /// </param>
        /// <param name="structureSearchManager">
        /// The structure search manager.
        /// </param>
        /// <param name="authStructureSearchManager">
        /// The authentication structure search manager.
        /// </param>
        /// <param name="dataflowPrincipal">
        /// The dataflow principal.
        /// </param>
        /// <exception cref="SdmxSemmanticException">
        /// Operation not accepted with query used
        /// </exception>
        public StructureRequestV20Controller(
            IResponseGenerator <TWriter, ISdmxObjects> responseGenerator,
            IMutableStructureSearchManager structureSearchManager,
            IAuthMutableStructureSearchManager authStructureSearchManager,
            DataflowPrincipal dataflowPrincipal)
            : base(responseGenerator, dataflowPrincipal)
        {
            this._structureSearchManager     = structureSearchManager;
            this._authStructureSearchManager = authStructureSearchManager;
            SdmxSchema sdmxSchemaV20 = SdmxSchema.GetFromEnum(SdmxSchemaEnumType.VersionTwo);

            this._manager = new QueryParsingManager(sdmxSchemaV20.EnumType, new QueryBuilder(null, new ConstrainQueryBuilderV2(), null));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ControllerBuilder"/> class.
        /// </summary>
        /// <param name="mappingStoreConnectionSettings">
        /// The mapping store connection settings.
        /// </param>
        /// <param name="defaultHeader">
        /// The default header.
        /// </param>
        public CsvZipControllerBuilder(ConnectionStringSettings mappingStoreConnectionSettings, IHeader defaultHeader)
        {
            if (mappingStoreConnectionSettings == null)
            {
                _log.Error("No connection string defined. Please check the web.config.");
                throw new ArgumentNullException("mappingStoreConnectionSettings");
            }

            var dataRetrieverCore = new DataRetrieverCore(defaultHeader, mappingStoreConnectionSettings, SdmxSchemaEnumType.VersionTwo);
            var dataRetrieverV21 = new DataRetrieverCore(defaultHeader, mappingStoreConnectionSettings, SdmxSchemaEnumType.VersionTwoPointOne);
            var dataRetrieverCsvZip = new CsvZipDataRetrieverCore(defaultHeader, mappingStoreConnectionSettings, SdmxSchemaEnumType.VersionTwoPointOne);
            this._retrievalWithCrossWriter = dataRetrieverCore;
            this._retrievalWithWriter = dataRetrieverCore;
            this._retrievalWithWriterv21 = dataRetrieverCsvZip;
            this._advancedRetrievalWithWriter = dataRetrieverV21;

            //andrea
            this._retrievalTabular = dataRetrieverCore;

            // structure search factories
            IStructureSearchManagerFactory<IAdvancedMutableStructureSearchManager> advancedFactory = new AdvancedMutableStructureSearchManagerFactory();
            IStructureSearchManagerFactory<IAuthAdvancedMutableStructureSearchManager> autAdvancedFactory = new AuthAdvancedMutableStructureSearchManagerFactory();

            IStructureSearchManagerFactory<IMutableStructureSearchManager> structureSearchManager = new MutableStructureSearchManagerFactory();
            IStructureSearchManagerFactory<IAuthMutableStructureSearchManager> autFactory = new AuthMutableStructureSearchManagerFactory();

            // advanced structure search managers 
            this._advancedMutableStructureSearchManager = advancedFactory.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV21);
            this._authAdvancedMutableStructureSearchManager = autAdvancedFactory.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV21);

            // simple structure search managers
            this._mutableStructureSearchManagerV20 = structureSearchManager.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV20);
            this._authMutableStructureSearchManagerV20 = autFactory.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV20);

            this._mutableStructureSearchManagerV21 = structureSearchManager.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV21);
            this._authMutableStructureSearchManagerV21 = autFactory.GetStructureSearchManager(mappingStoreConnectionSettings, _sdmxSchemaV21);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SriRetrieverFactory" /> class.
        /// </summary>
        /// <exception cref="StructureRetrieverException">Could not establish a connection to the mapping store DB
        /// <see cref="P:Estat.Nsi.StructureRetriever.StructureRetrieverException.ErrorType" />
        /// is set to                  <see cref="F:Estat.Nsi.StructureRetriever.StructureRetrieverErrorTypes.MappingStoreConnectionError" /></exception>
        public SriRetrieverFactory()
        {
            var defaultHeader = SettingsManager.Header;
            var settingsManager = new MappingStoreSettingsManager();
            var mappingStoreConnectionSettings = settingsManager.MappingStoreConnectionSettings;
            if (mappingStoreConnectionSettings != null)
            {
                // Data Retriever initialization
                var dataRetrieverSdmxv20Behaviour = new DataRetrieverCore(defaultHeader, mappingStoreConnectionSettings, SdmxSchemaEnumType.VersionTwo);
                var dataRetrieverSdmxV21Behaviour = new DataRetrieverCore(defaultHeader, mappingStoreConnectionSettings, SdmxSchemaEnumType.VersionTwoPointOne);

                // SDMX v2.0 WS Soap for SDMX v2.0 CrossSectional data (does not throw No Results when no data is found).
                this._sdmxv20XSDataRetrievalForWs20 = dataRetrieverSdmxv20Behaviour;

                // SDMX v2.1 WS REST for SDMX v2.0 CrossSectional data (throws No Results when no data is found).
                this._sdmxV20XSDataRetrieverForRest = dataRetrieverSdmxV21Behaviour;
                this._dataRetrievalForWs20 = dataRetrieverSdmxv20Behaviour;
                this._dataRetrievalForRest = dataRetrieverSdmxV21Behaviour;
                this._dataRetrieverForWs21 = dataRetrieverSdmxV21Behaviour;

                // advanced structure search managers  (SDMX v2.1 SOAP)
                SdmxSchema sdmxSchemaV21 = SdmxSchema.GetFromEnum(SdmxSchemaEnumType.VersionTwoPointOne);
                this._structureRetrievalForWs21 = new Estat.Nsi.StructureRetriever.Manager.AdvancedStructureRetriever(mappingStoreConnectionSettings);
                this._authStructureRetrievalForWs21 = new AuthAdvancedStructureRetriever(mappingStoreConnectionSettings);

                // simple structure search managers (SDMX v2.0 SOAP)
                SdmxSchema sdmxSchemaV20 = SdmxSchema.GetFromEnum(SdmxSchemaEnumType.VersionTwo);
                this._structureRetrievalForWs20 = new StructureRetrieverAvailableData(mappingStoreConnectionSettings, sdmxSchemaV20);
                this._authStructureRetrievalForWs20 = new AuthStructureRetrieverAvailableData(mappingStoreConnectionSettings, sdmxSchemaV20);

                // structure search manager (SDMX v2.1 REST)
                this._structureRetrievalForRest = new StructureRetrieverAvailableData(mappingStoreConnectionSettings, sdmxSchemaV21);
                this._authStructureRetrievalForRest = new AuthStructureRetrieverAvailableData(mappingStoreConnectionSettings, sdmxSchemaV21);
                this._mappingStoreSdmxObjectRetrievalManager = new MappingStoreSdmxObjectRetrievalManager(mappingStoreConnectionSettings);
            }
        }