Ejemplo n.º 1
0
        /// <summary>
        /// Builds the generic data controller for SDMX V20.
        /// </summary>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{XmlNode,XmlWriter}"/>.
        /// </returns>
        public IController <XmlNode, XmlWriter> BuildGenericDataV20(DataflowPrincipal principal)
        {
            var compactDataFormat = _genericDataFormat;
            var sdmxSchemaV20     = _sdmxSchemaV20;

            return(this.GetSimpleDataController(compactDataFormat, sdmxSchemaV20, principal));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds the cross sectional data controller for SDMX V20.
        /// </summary>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{XmlNode,XmlWriter}"/>.
        /// </returns>
        public IController <XmlNode, XmlWriter> BuildCrossSectionalDataV20(DataflowPrincipal principal)
        {
            var compactDataFormat = _crossSectional;
            var sdmxSchemaV20     = _sdmxSchemaV20;

            return(this.GetSimpleDataController(compactDataFormat, sdmxSchemaV20, principal));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the mutable objects from rest.
        /// </summary>
        /// <param name="input">
        /// The input.
        /// </param>
        /// <param name="dataflowPrincipal">
        /// The dataflow principal.
        /// </param>
        /// <returns>
        /// The <see cref="IMutableObjects"/>.
        /// </returns>
        private IMutableObjects GetMutableObjectsRest(IRestStructureQuery input, DataflowPrincipal dataflowPrincipal)
        {
            IMutableObjects mutableObjects = dataflowPrincipal != null
                                                 ? this._authStructureSearchManager.GetMaintainables(input, dataflowPrincipal.AllowedDataflows.ToList())
                                                 : this._structureSearchManager.GetMaintainables(input);

            return(mutableObjects);
        }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Builds the Advanced Structure controller for SDMX V21 SOAP.
        /// </summary>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <param name="soapOperation">
        /// The SOAP operation.
        /// </param>
        /// <returns>
        /// The <see cref="IController{XmlNode,XmlWriter}"/>.
        /// </returns>
        public IController <Message, XmlWriter> BuildAdvancedQueryStructureV21(DataflowPrincipal principal, SoapOperation soapOperation)
        {
            IWriterBuilder <IStructureWriterManager, XmlWriter> structureManagerBuilder = new StructureBuilder(WebServiceEndpoint.StandardEndpoint, _sdmxSchemaV21);
            IResponseGenerator <XmlWriter, ISdmxObjects>        responseGenerator       = new StructureResponseGenerator(structureManagerBuilder, StructureOutputFormatEnumType.SdmxV21StructureDocument);
            var structureRequestController = new StructureRequestV21AdvancedController <XmlWriter>(
                responseGenerator,
                this._authAdvancedMutableStructureSearchManager,
                this._advancedMutableStructureSearchManager,
                principal,
                soapOperation);

            return(structureRequestController);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StructureRequestV21AdvancedController{TWriter}"/> class.
        /// </summary>
        /// <param name="responseGenerator">
        /// The response generator.
        /// </param>
        /// <param name="authStructureSearchManager">
        /// The authentication structure search manager.
        /// </param>
        /// <param name="structureSearchManager">
        /// The structure search manager.
        /// </param>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <param name="soapOperation">
        /// The SOAP operation.
        /// </param>
        /// <exception cref="SdmxSemmanticException">
        /// Operation not accepted with query used
        /// </exception>
        public StructureRequestV21AdvancedController(
            IResponseGenerator <TWriter, ISdmxObjects> responseGenerator,
            IAuthAdvancedMutableStructureSearchManager authStructureSearchManager,
            IAdvancedMutableStructureSearchManager structureSearchManager,
            DataflowPrincipal principal,
            SoapOperation soapOperation)
            : base(responseGenerator, principal)
        {
            this._authStructureSearchManager = authStructureSearchManager;
            this._structureSearchManager     = structureSearchManager;
            SdmxSchema sdmxSchemaV21 = SdmxSchema.GetFromEnum(SdmxSchemaEnumType.VersionTwoPointOne);

            this._manager  = new QueryParsingManager(sdmxSchemaV21.EnumType);
            this._rootNode = soapOperation.GetQueryRootElementV21();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Gets the mutable objects V20.
        /// </summary>
        /// <param name="input">
        /// The input.
        /// </param>
        /// <param name="dataflowPrincipal">
        /// The dataflow principal.
        /// </param>
        /// <returns>
        /// The <see cref="IMutableObjects"/>.
        /// </returns>
        /// <exception cref="SdmxSemmanticException">
        /// Operation not accepted
        /// </exception>
        private IMutableObjects GetMutableObjectsV21(IReadableDataLocation input, DataflowPrincipal dataflowPrincipal)
        {
            IQueryWorkspace queryWorkspace = this._manager.ParseQueries(input);

            if (queryWorkspace == null)
            {
                // throw new SdmxSemmanticException(Properties.Resources.MissingRegistryOrInvalidSoap);
                throw new SdmxSemmanticException(Resources.ErrorOperationNotAccepted);
            }

            IMutableObjects mutableObjects = dataflowPrincipal != null
                                                 ? this._authStructureSearchManager.GetMaintainables(queryWorkspace.ComplexStructureQuery, dataflowPrincipal.AllowedDataflows.ToList())
                                                 : this._structureSearchManager.GetMaintainables(queryWorkspace.ComplexStructureQuery);

            return(mutableObjects);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets the simple data controller for SDMX v2.0 SOAP or REST.
        /// </summary>
        /// <param name="dataFormat">
        /// The compact data format.
        /// </param>
        /// <param name="sdmxSchema">
        /// The SDMX schema V20.
        /// </param>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{XmlNode,XmlWriter}"/>.
        /// </returns>
        private SimpleDataController <XmlWriter> GetSimpleDataController(BaseDataFormat dataFormat, SdmxSchema sdmxSchema, DataflowPrincipal principal)
        {
            DataRequestValidator dataRequestValidator;
            IResponseGenerator <XmlWriter, IDataQuery> simpleDataResponseGenerator;

            if (dataFormat.EnumType == BaseDataFormatEnumType.CrossSectional)
            {
                if (sdmxSchema.EnumType != SdmxSchemaEnumType.VersionTwo)
                {
                    throw new SdmxSemmanticException("Impossible request. Requested CrossSectional for SDMX v2.1.");
                }

                var dataWriterBuilder = new CrossDataWriterBuilder();
                simpleDataResponseGenerator = new SimpleCrossDataResponseGenerator <XmlWriter>(this._retrievalWithCrossWriter, dataWriterBuilder);
                dataRequestValidator        = new DataRequestValidator(_crossSectional, _sdmxSchemaV20);
            }
            else
            {
                var dataWriterBuilder = new DataWriterBuilder(dataFormat, sdmxSchema);
                simpleDataResponseGenerator = new SimpleDataResponseGenerator <XmlWriter>(this.GetDataRetrievalWithWriter(sdmxSchema.EnumType), dataWriterBuilder);
                dataRequestValidator        = new DataRequestValidator(dataFormat, sdmxSchema);
            }

            var dataController = new DataController <IDataQuery, XmlWriter>(simpleDataResponseGenerator);
            IDataflowLogManager dataflowLogManager = new DataflowLogManager(dataFormat);
            var requestLogDataController           = new RequestLogDataController <IDataQuery, XmlWriter>(dataController, dataflowLogManager);

            var validatingDataController = new ValidatingDataController <IDataQuery, XmlWriter>(requestLogDataController, dataRequestValidator);
            var authDataController       = new AuthDataController <IDataQuery, XmlWriter>(validatingDataController, principal);

            var simpleDataController = new SimpleDataController <XmlWriter>(authDataController, this._mappingStoreSdmxObjectRetrievalManager);

            return(simpleDataController);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Gets the Advanced (SDMX v2.1 SOAP) data controller.
        /// </summary>
        /// <param name="dataFormat">
        /// The compact data format.
        /// </param>
        /// <param name="sdmxSchema">
        /// The SDMX schema V20.
        /// </param>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{XmlNode,XmlWriter}"/>.
        /// </returns>
        private IController <Message, XmlWriter> GetAdvancedDataController(BaseDataFormat dataFormat, SdmxSchema sdmxSchema, DataflowPrincipal principal)
        {
            var dataWriterBuilder     = new DataWriterBuilder(dataFormat, sdmxSchema);
            var dataResponseGenerator = new AdvancedDataResponseGenerator <XmlWriter>(this._advancedRetrievalWithWriter, dataWriterBuilder);
            var operation             = dataFormat.GetSoapOperation(SdmxSchemaEnumType.VersionTwoPointOne);

            var dataController = new DataController <IComplexDataQuery, XmlWriter>(dataResponseGenerator);
            IDataflowLogManager dataflowLogManager = new DataflowLogManager(dataFormat);
            var requestLogDataController           = new RequestLogDataController <IComplexDataQuery, XmlWriter>(dataController, dataflowLogManager);

            var validatingDataController = new ValidatingDataController <IComplexDataQuery, XmlWriter>(requestLogDataController, new DataRequestValidator(dataFormat, sdmxSchema));
            var authDataController       = new AuthDataController <IComplexDataQuery, XmlWriter>(validatingDataController, principal);

            return(new AdvancedDataController <XmlWriter>(operation, authDataController, this._mappingStoreSdmxObjectRetrievalManager));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Builds the query structure for SDMX v20 SOAP requests
        /// </summary>
        /// <param name="endpoint">
        /// The endpoint.
        /// </param>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{XElement,XmlWriter}"/>.
        /// </returns>
        public IController <Message, XmlWriter> BuildQueryStructureV20FromMessage(WebServiceEndpoint endpoint, DataflowPrincipal principal)
        {
            IWriterBuilder <IStructureWriterManager, XmlWriter> structureManagerBuilder = new StructureBuilder(endpoint, _sdmxSchemaV20);
            IResponseGenerator <XmlWriter, ISdmxObjects>        responseGenerator       = new StructureResponseGenerator(structureManagerBuilder, StructureOutputFormatEnumType.SdmxV2RegistryQueryResponseDocument);
            var structureRequestController = new StructureRequestV20Controller <XmlWriter>(
                responseGenerator,
                this._mutableStructureSearchManagerV20,
                this._authMutableStructureSearchManagerV20,
                principal);

            return(structureRequestController);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Builds the generic data controller for SDMX V21.
        /// </summary>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <param name="dataFormat">
        /// The data format.
        /// </param>
        /// <returns>
        /// The <see cref="IController{XmlNode,XmlWriter}"/>.
        /// </returns>
        public IController <Message, XmlWriter> BuildDataV21Advanced(DataflowPrincipal principal, BaseDataFormat dataFormat)
        {
            var sdmxSchema = _sdmxSchemaV21;

            return(this.GetAdvancedDataController(dataFormat, sdmxSchema, principal));
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Builds the generic data controller for SDMX V21.
 /// </summary>
 /// <param name="principal">
 /// The principal.
 /// </param>
 /// <param name="baseDataFormat">
 /// The base data format.
 /// </param>
 /// <returns>
 /// The <see cref="IController{XElement,XmlWriter}"/>.
 /// </returns>
 /// <exception cref="SdmxSemmanticException">
 /// Impossible request. Requested CrossSectional for SDMX v2.1.
 /// </exception>
 public IController <Message, XmlWriter> BuildDataV20FromMessage(DataflowPrincipal principal, BaseDataFormat baseDataFormat)
 {
     return(this.GetSimpleDataController(baseDataFormat, _sdmxSchemaV20, principal));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Builds the generic data controller for SDMX V21.
 /// </summary>
 /// <param name="principal">
 /// The principal.
 /// </param>
 /// <param name="baseDataFormat">
 /// The base data format.
 /// </param>
 /// <param name="sdmxSchema">
 /// The SDMX schema.
 /// </param>
 /// <returns>
 /// The <see cref="IController{XmlNode,XmlWriter}"/>.
 /// </returns>
 /// <exception cref="SdmxSemmanticException">
 /// Impossible request. Requested CrossSectional for SDMX v2.1.
 /// </exception>
 public IController <IRestDataQuery, XmlWriter> BuildDataRest(DataflowPrincipal principal, BaseDataFormat baseDataFormat, SdmxSchema sdmxSchema)
 {
     return(this.GetSimpleDataController(baseDataFormat, sdmxSchema, principal));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryStructureController{TWriter}"/> class.
 /// </summary>
 /// <param name="responseGenerator">
 /// The response generator.
 /// </param>
 /// <param name="dataflowPrincipal">
 /// The dataflow principal.
 /// </param>
 /// <exception cref="SdmxSemmanticException">
 /// Operation not accepted with query used
 /// </exception>
 protected QueryStructureController(IResponseGenerator <TWriter, ISdmxObjects> responseGenerator, DataflowPrincipal dataflowPrincipal)
 {
     this._responseGenerator = responseGenerator;
     this._dataflowPrincipal = dataflowPrincipal;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthDataController{TQuery, TWriter}"/> class.
 /// </summary>
 /// <param name="controller">The controller.</param>
 /// <param name="principal">The principal.</param>
 public AuthDataController(IController <TQuery, TWriter> controller, DataflowPrincipal principal) : base(controller)
 {
     this._principal = principal;
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Builds the query structure for REST for the specified <paramref name="schema"/>.
        /// </summary>
        /// <param name="schema">
        /// The SDMX schema version.
        /// </param>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{IRestStructureQuery,XmlWriter}"/>.
        /// </returns>
        public IController <IRestStructureQuery, XmlWriter> BuildQueryStructureRest(SdmxSchema schema, DataflowPrincipal principal)
        {
            IWriterBuilder <IStructureWriterManager, XmlWriter> structureManagerBuilder = new StructureBuilder(WebServiceEndpoint.StandardEndpoint, schema);
            StructureOutputFormatEnumType outputFormat;

            IAuthMutableStructureSearchManager authMutableStructureSearchManager;
            IMutableStructureSearchManager     mutableStructureSearchManager;

            switch (schema.EnumType)
            {
            case SdmxSchemaEnumType.VersionTwo:
                authMutableStructureSearchManager = this._authMutableStructureSearchManagerV20;
                mutableStructureSearchManager     = this._mutableStructureSearchManagerV20;
                outputFormat = StructureOutputFormatEnumType.SdmxV2StructureDocument;

                break;

            default:
                authMutableStructureSearchManager = this._authMutableStructureSearchManagerV21;
                mutableStructureSearchManager     = this._mutableStructureSearchManagerV21;
                outputFormat = StructureOutputFormatEnumType.SdmxV21StructureDocument;

                break;
            }

            IResponseGenerator <XmlWriter, ISdmxObjects> responseGenerator = new StructureResponseGenerator(structureManagerBuilder, outputFormat);
            var structureRequestController = new StructureRequestRestController <XmlWriter>(responseGenerator, mutableStructureSearchManager, authMutableStructureSearchManager, principal);

            return(structureRequestController);
        }