Example #1
0
 public DataService(string name, string flowId, bool isActive, ServiceType serviceType, ExecutableInfo pluginInfo,
                    DataServicePublishFlags publishFlags)
 {
     _name         = name;
     _flowId       = flowId;
     _isActive     = isActive;
     _type         = serviceType;
     _pluginInfo   = pluginInfo;
     _publishFlags = publishFlags;
     _args         = new Dictionary <string, string>();
     _dataSources  = new Dictionary <string, DataProviderInfo>();
 }
        protected virtual IList <TypedParameter> GetDataServiceParameters(string serviceName, IList <TransactionTrackingQueryParameter> possibleParameters,
                                                                          out DataServicePublishFlags publishFlags)
        {
            publishFlags = DataServicePublishFlags.PublishToEndpointVersion20;

            List <TypedParameter> typedParameters = new List <TypedParameter>(possibleParameters.Count);

            foreach (TransactionTrackingQueryParameter parameter in possibleParameters)
            {
                TypedParameter typedParameter = new TypedParameter(parameter.ToString());
                switch (parameter)
                {
                case TransactionTrackingQueryParameter.TransactionId:
                case TransactionTrackingQueryParameter.Dataflow:
                case TransactionTrackingQueryParameter.Userid:
                case TransactionTrackingQueryParameter.Recipients:
                case TransactionTrackingQueryParameter.Organization:
                    typedParameter.IsRequired = false;
                    typedParameter.Type       = typeof(string);
                    break;

                case TransactionTrackingQueryParameter.toDate:
                case TransactionTrackingQueryParameter.fromDate:
                    typedParameter.IsRequired = false;
                    typedParameter.Type       = typeof(DateTime);
                    break;

                case TransactionTrackingQueryParameter.Status:
                    typedParameter.IsRequired       = false;
                    typedParameter.Type             = typeof(string);
                    typedParameter.AcceptableValues = CollectionUtils.CreateObjectList(EnumUtils.GetAllDescriptions <CommonTransactionStatusCode>());
                    break;

                case TransactionTrackingQueryParameter.Type:
                    typedParameter.IsRequired       = false;
                    typedParameter.Type             = typeof(string);
                    typedParameter.AcceptableValues = CollectionUtils.CreateObjectList(CollectionUtils.CreateStringList(NodeMethod.Download,
                                                                                                                        NodeMethod.Execute,
                                                                                                                        NodeMethod.GetStatus,
                                                                                                                        NodeMethod.Notify,
                                                                                                                        NodeMethod.Query,
                                                                                                                        NodeMethod.Solicit,
                                                                                                                        NodeMethod.Submit));
                    break;
                }
                typedParameters.Add(typedParameter);
            }
            return(typedParameters);
        }
Example #3
0
        /// <summary>
        /// Return the Query, Solicit, or Execute data service parameters for this plugin.
        /// </summary>
        public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
        {
            List <TypedParameter> parameters = new List <TypedParameter>();

            parameters.Add(new TypedParameter("Force Refresh", "If true, this task will always refresh the user list.  If false, this task will only refresh the user list if it has expired from the cache.",
                                              false, typeof(bool), false));
            publishFlags = DataServicePublishFlags.DoNotPublish;
            return(parameters);
        }
Example #4
0
 /// <summary>
 /// Return the Query, Solicit, or Execute data service parameters for specified data service.
 /// This method should NOT call GetServiceImplementation().
 /// </summary>
 public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
 {
     publishFlags = DataServicePublishFlags.PublishToEndpointVersion11And20;
     return(null);
 }
        public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
        {
            IList <TransactionTrackingQueryParameter> possibleParameters = EnumUtils.GetAllEnumValues <TransactionTrackingQueryParameter>();

            return(GetDataServiceParameters(serviceName, possibleParameters, out publishFlags));
        }
        public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
        {
            IList <TransactionTrackingQueryParameter> possibleParameters = new TransactionTrackingQueryParameter[] { TransactionTrackingQueryParameter.TransactionId };

            return(GetDataServiceParameters(serviceName, possibleParameters, out publishFlags));
        }
 /// <summary>
 /// Return the Query, Solicit, or Execute data service parameters for specified data service.
 /// This method should NOT call GetServiceImplementation().
 /// </summary>
 /// <param name="serviceName">Name of service</param>
 /// <param name="publishFlags"></param>
 /// <returns></returns>
 public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
 {
     publishFlags = DataServicePublishFlags.DoNotPublish;
     return(null);
 }
Example #8
0
        /// <summary>
        /// Return the Query, Solicit, or Execute data service parameters for specified data service.
        /// This method should NOT call GetServiceImplementation().
        /// </summary>
        public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
        {
            List <TypedParameter> list = (List <TypedParameter>)base.GetDataServiceParameters(serviceName, out publishFlags);

            publishFlags = DataServicePublishFlags.PublishToEndpointVersion11And20;
            list.Add(new TypedParameter("ActivityStartDate", "Data will be returned where Activity Start Date is equal to or later than this date", false, typeof(DateTime), true));
            return(list);
        }
        /// <summary>
        /// Return the Query, Solicit, or Execute data service parameters for specified data service.
        /// This method should NOT call GetServiceImplementation().
        /// </summary>
        public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
        {
            Type       runType   = null;
            MethodInfo runMethod = null;

            ParameterInfo[] runParams = null;

            Assembly assembly = GetRunMethod(out runType, out runMethod, out runParams);

            List <TypedParameter> list = null;

            if (!CollectionUtils.IsNullOrEmpty(runParams) && (runParams.Length > 2))
            {
                list = new List <TypedParameter>(runParams.Length);
                for (int i = 1; i < runParams.Length - 1; ++i)
                {
                    ParameterInfo runParam  = runParams[i];
                    string        paramName = ParamNameFromRunParamName(runParam.Name);
                    list.Add(new TypedParameter(paramName, paramName, true, typeof(string), true));
                }
            }
            publishFlags = DataServicePublishFlags.PublishToEndpointVersion11And20;
            return(list);
        }
Example #10
0
        /// <summary>
        /// Return the Query, Solicit, or Execute data service parameters for specified data service.
        /// This method should NOT call GetServiceImplementation().
        /// </summary>
        public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
        {
            List <TypedParameter> list = new List <TypedParameter>(4);

            list.Add(new TypedParameter(PARAM_START_DATE_KEY, "Start date for returned data (YYYY-MM-DD)", true, typeof(DateTime), true));
            list.Add(new TypedParameter(PARAM_END_DATE_KEY, "End date for returned data (YYYY-MM-DD)", true, typeof(DateTime), true));
            list.Add(new TypedParameter(PARAM_SITE_ID_KEY, "If specified, the site id for returned data", false, typeof(string), true));
            list.Add(new TypedParameter(PARAM_COUNTY_CODE_KEY, "If specified, the county code for returned data", false, typeof(string), true));
            publishFlags = DataServicePublishFlags.PublishToEndpointVersion11And20;
            return(list);
        }
Example #11
0
        /// <summary>
        /// Return the Query, Solicit, or Execute data service parameters for specified data service.
        /// This method should NOT call GetServiceImplementation().
        /// </summary>
        public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
        {
            publishFlags = DataServicePublishFlags.PublishToEndpointVersion11And20;
            List <TypedParameter> list = new List <TypedParameter>(1);

            var typedParameter = new TypedParameter(SERVICE_CATEGORY_KEY, "The service category to return (AllServices, Solicit, Query, Execute or Submit)",
                                                    true, typeof(string), true, SERVICE_CATEGORY_ALL_SERVICES);
            List <object> acceptableValues = new List <object>(10);

            acceptableValues.Add("AllServices");
            acceptableValues.AddRange(CollectionUtils.CreateObjectList(NodeMethod.Execute, NodeMethod.Query, NodeMethod.Solicit, NodeMethod.Submit));
            typedParameter.AcceptableValues = acceptableValues;
            list.Add(typedParameter);
            return(list);
        }
Example #12
0
        protected NetworkNodeType GetServices(ServiceType returnServiceTypes)
        {
            LatLongRectangle    nodeBox             = _settingsProvider.NodeBoundingBox;
            EndpointVersionType endpointVersionType =
                _transactionManager.GetTransactionEndpointVersionType(_dataRequest.TransactionId);

            if (endpointVersionType == EndpointVersionType.Undefined)
            {
                endpointVersionType = EndpointVersionType.EN20;
            }
            Dictionary <ServiceType, NodeMethodTypeCode> publishServiceTypeMap = new Dictionary <ServiceType, NodeMethodTypeCode>();

            if (EnumUtils.IsFlagSet(returnServiceTypes, ServiceType.Query))
            {
                publishServiceTypeMap.Add(ServiceType.Query, NodeMethodTypeCode.Query);
            }
            if (EnumUtils.IsFlagSet(returnServiceTypes, ServiceType.Solicit))
            {
                publishServiceTypeMap.Add(ServiceType.Solicit, NodeMethodTypeCode.Solicit);
            }
            if (EnumUtils.IsFlagSet(returnServiceTypes, ServiceType.Submit))
            {
                publishServiceTypeMap.Add(ServiceType.Submit, NodeMethodTypeCode.Submit);
            }
            if (EnumUtils.IsFlagSet(returnServiceTypes, ServiceType.Execute))
            {
                publishServiceTypeMap.Add(ServiceType.Execute, NodeMethodTypeCode.Execute);
            }
            if (publishServiceTypeMap.Count == 0)
            {
                throw new ArgumentException(string.Format("Invalid ServiceType specified: \"{0}\"", returnServiceTypes));
            }

            NetworkNodeType networkNodeType = new NetworkNodeType();

            networkNodeType.NodeServiceList    = new ServiceDescriptionListTypeService[0];
            networkNodeType.BoundingBoxDetails = new NodeBoundingBoxType();
            networkNodeType.BoundingBoxDetails.BoundingCoordinateNorth = nodeBox.North;
            networkNodeType.BoundingBoxDetails.BoundingCoordinateEast  = nodeBox.East;
            networkNodeType.BoundingBoxDetails.BoundingCoordinateSouth = nodeBox.South;
            networkNodeType.BoundingBoxDetails.BoundingCoordinateWest  = nodeBox.West;
            if (endpointVersionType == EndpointVersionType.EN20)
            {
                networkNodeType.NodeAddress           = _settingsProvider.Endpoint20Url;
                networkNodeType.NodeVersionIdentifier = NodeVersionCode.Item20;
            }
            else
            {
                networkNodeType.NodeAddress           = _settingsProvider.Endpoint11Url;
                networkNodeType.NodeVersionIdentifier = NodeVersionCode.Item11;
            }
            networkNodeType.NodeContact = _settingsProvider.NodeAdminEmail;
            if (_settingsProvider.IsProductionNode)
            {
                networkNodeType.NodeDeploymentTypeCode = NodeStageCode.Production;
            }
            else
            {
                networkNodeType.NodeDeploymentTypeCode = NodeStageCode.Development;
            }
            networkNodeType.NodeIdentifier         = _settingsProvider.NodeId + " - " + (_settingsProvider.IsProductionNode ? "Prod" : "Test");
            networkNodeType.NodeName               = networkNodeType.NodeIdentifier;
            networkNodeType.OrganizationIdentifier = _settingsProvider.NodeOrganizationName;
            networkNodeType.NodeStatus             = NodeStatusCode.Operational;

            string username = _transactionManager.GetTransactionUsername(_dataRequest.TransactionId);

            AppendAuditLogEvent("Loading information for all data flows for user: {0}", username);
            IList <DataFlow> dataFlows = _flowManager.GetAllDataFlows(true, true);


            if (!CollectionUtils.IsNullOrEmpty(dataFlows))
            {
                AppendAuditLogEvent("Loaded information for {0} data flows for user: {1}", dataFlows.Count.ToString(), username);

                DataServicePublishFlags validPublishFlags = (endpointVersionType == EndpointVersionType.EN20) ?
                                                            DataServicePublishFlags.PublishToEndpointVersion20 : DataServicePublishFlags.PublishToEndpointVersion11;
                List <ServiceDescriptionListTypeService> services = null;
                foreach (DataFlow dataFlow in dataFlows)
                {
                    if (!CollectionUtils.IsNullOrEmpty(dataFlow.Services))
                    {
                        foreach (DataService dataService in dataFlow.Services)
                        {
                            if (EnumUtils.IsFlagSet(dataService.PublishFlags, validPublishFlags) && dataService.IsActive &&
                                (dataService.PluginInfo != null) && !string.IsNullOrEmpty(dataService.PluginInfo.ImplementingClassName))
                            {
                                foreach (KeyValuePair <ServiceType, NodeMethodTypeCode> pair in publishServiceTypeMap)
                                {
                                    if (EnumUtils.IsFlagSet(dataService.Type, pair.Key))
                                    {
                                        ServiceDescriptionListTypeService nodeService = new ServiceDescriptionListTypeService();
                                        nodeService.Dataflow           = dataFlow.FlowName;
                                        nodeService.MethodName         = pair.Value;
                                        nodeService.ServiceDescription = string.Format("{0} - {1} Service", dataFlow.FlowName,
                                                                                       dataService.Name);
                                        nodeService.ServiceDocumentURL = dataFlow.InfoUrl;
                                        nodeService.ServiceIdentifier  = dataService.Name;

                                        int publishParamCount = GetPublishParamCount(dataService.ServiceParameters);
                                        if (publishParamCount > 0)
                                        {
                                            nodeService.Parameter = new RequestParameterType[publishParamCount];
                                            for (int i = 0, index = 0; i < dataService.ServiceParameters.Count; ++i)
                                            {
                                                TypedParameter typedParameter = dataService.ServiceParameters[i];
                                                if (typedParameter.DoPublishParam)
                                                {
                                                    RequestParameterType requestParameter = new RequestParameterType();
                                                    requestParameter.ParameterName              = typedParameter.Name;
                                                    requestParameter.ParameterSortIndex         = index.ToString();
                                                    requestParameter.ParameterRequiredIndicator = typedParameter.IsRequired;
                                                    nodeService.Parameter[index++]              = requestParameter;
                                                }
                                            }
                                        }

                                        CollectionUtils.Add(nodeService, ref services);
                                    }
                                }
                            }
                        }
                    }
                }
                if (!CollectionUtils.IsNullOrEmpty(services))
                {
                    services.Sort(delegate(ServiceDescriptionListTypeService s1, ServiceDescriptionListTypeService s2)
                    {
                        int result = string.Compare(s1.Dataflow, s2.Dataflow);
                        if (result != 0)
                        {
                            return(result);
                        }
                        result = string.Compare(s1.ServiceIdentifier, s2.ServiceIdentifier);
                        if (result != 0)
                        {
                            return(result);
                        }
                        return(string.Compare(s1.MethodName.ToString(), s2.MethodName.ToString()));
                    });
                    networkNodeType.NodeServiceList = services.ToArray();
                }
            }

            return(networkNodeType);
        }
        /// <summary>
        /// Return the Query, Solicit, or Execute data service parameters for specified data service.
        /// This method should NOT call GetServiceImplementation().
        /// </summary>
        public override IList <TypedParameter> GetDataServiceParameters(string serviceName, out DataServicePublishFlags publishFlags)
        {
            List <TypedParameter> list = null;

            string[] names = null;
            if (string.Equals(serviceName, AQSServiceType.AQDEMonitorData.ToString(), StringComparison.InvariantCultureIgnoreCase))
            {
                names = Enum.GetNames(typeof(MonitorDataArgType));
            }
            else if (string.Equals(serviceName, AQSServiceType.AQDERawData.ToString(), StringComparison.InvariantCultureIgnoreCase))
            {
                names = Enum.GetNames(typeof(RawDataArgType));
            }
            if (names != null)
            {
                list = new List <TypedParameter>(names.Length);
                for (int i = 0; i < names.Length; ++i)
                {
                    list.Add(new TypedParameter(string.Format("P{0} - {1}", (i + 1).ToString("D2"), names[i]),
                                                names[i], true, typeof(string), true));
                }
                publishFlags = DataServicePublishFlags.PublishToEndpointVersion11And20;
            }
            else
            {
                publishFlags = DataServicePublishFlags.DoNotPublish;
            }
            return(list);
        }