Represents a service action which is the single unit of work that can occur in a dynamic service. This could be stored procedure invocation in a data store or a webservice call or a static Service Method invocation that will occur locally on the service
Inheritance: Dev2.DynamicServices.Objects.Base.DynamicServiceObjectBase, IDisposable
        public DynamicService CreateServiceEntry()
        {
            DynamicService newDs = new DynamicService { Name = HandlesType(), DataListSpecification = new StringBuilder("<DataList><OldCategory ColumnIODirection=\"Input\"/><NewCategory ColumnIODirection=\"Input\"/><ResourceType ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>") };
            ServiceAction sa = new ServiceAction { Name = HandlesType(), ActionType = enActionType.InvokeManagementDynamicService, SourceMethod = HandlesType() };
            newDs.Actions.Add(sa);

            return newDs;
        }
 public void RemoteWorkflowExecutionContainer_UnitTest_ConstructorWithNullResourceCatalog_ArgumentNullException()
 {
     var sa = new ServiceAction();
     var dataObj = new Mock<IDSFDataObject>();
     var workspace = new Mock<IWorkspace>();
     var esbChannel = new Mock<IEsbChannel>();
     new RemoteWorkflowExecutionContainerMock(sa, dataObj.Object, workspace.Object, esbChannel.Object, null);
 }
Exemplo n.º 3
0
        public DynamicService CreateServiceEntry()
        {
            var findResourcesByIdAction = new ServiceAction { Name = HandlesType(), SourceMethod = HandlesType(), ActionType = enActionType.InvokeManagementDynamicService };

            var findResourcesByIdService = new DynamicService { Name = HandlesType(), DataListSpecification = new StringBuilder("<DataList><GuidCsv ColumnIODirection=\"Input\"/><ResourceType ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>") };
            findResourcesByIdService.Actions.Add(findResourcesByIdAction);

            return findResourcesByIdService;
        }
 protected EsbExecutionContainer(ServiceAction sa, IDSFDataObject dataObject, IWorkspace theWorkspace, IEsbChannel esbChannel, EsbExecuteRequest request)
 {
     ServiceAction = sa;
     DataObject = dataObject;
     TheWorkspace = theWorkspace;
     EsbChannel = esbChannel;
     Request = request;
     DataObject.EsbChannel = EsbChannel;
 }
Exemplo n.º 5
0
        public DynamicService CreateServiceEntry()
        {
            var getLatestAction = new ServiceAction { Name = HandlesType(), ActionType = enActionType.InvokeManagementDynamicService, SourceMethod = HandlesType() };

            var getLatestService = new DynamicService { Name = HandlesType(), DataListSpecification = new StringBuilder("<DataList><EditedItemsXml ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>") };
            getLatestService.Actions.Add(getLatestAction);

            return getLatestService;
        }
 public RemoteWorkflowExecutionContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace workspace, IEsbChannel esbChannel, IResourceCatalog resourceCatalog)
     : base(sa, dataObj, workspace, esbChannel)
 {
     if (resourceCatalog == null)
     {
         throw new ArgumentNullException("resourceCatalog");
     }
     _resourceCatalog = resourceCatalog;
 }
        public DynamicService CreateServiceEntry()
        {
            DynamicService deployResourceDynamicService = new DynamicService { Name = HandlesType(), DataListSpecification = new StringBuilder("<DataList><ResourceDefinition ColumnIODirection=\"Input\"/><Roles ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>") };

            ServiceAction deployResourceServiceAction = new ServiceAction { Name = HandlesType(), ActionType = enActionType.InvokeManagementDynamicService, SourceMethod = HandlesType() };

            deployResourceDynamicService.Actions.Add(deployResourceServiceAction);

            return deployResourceDynamicService;
        }
        public DynamicService CreateServiceEntry()
        {
            DynamicService findNetworkComputersService = new DynamicService { Name = HandlesType(), DataListSpecification = new StringBuilder("<DataList><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>") };

            ServiceAction findNetworkComputersAction = new ServiceAction { Name = HandlesType(), ActionType = enActionType.InvokeManagementDynamicService, SourceMethod = HandlesType() };

            findNetworkComputersService.Actions.Add(findNetworkComputersAction);

            return findNetworkComputersService;
        }
        public DynamicService CreateServiceEntry()
        {
            DynamicService getScheduledResourcesService = new DynamicService { Name = HandlesType(), DataListSpecification = new StringBuilder("<DataList></DataList>") };

            ServiceAction getScheduledResourcesAction = new ServiceAction { Name = HandlesType(), ActionType = enActionType.InvokeManagementDynamicService, SourceName = HandlesType(), SourceMethod = HandlesType() };

            getScheduledResourcesService.Actions.Add(getScheduledResourcesAction);

            return getScheduledResourcesService;
        }
        public DynamicService CreateServiceEntry()
        {
            var findServices = new DynamicService { Name = HandlesType(), DataListSpecification = new StringBuilder("<DataList><itemToAdd ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>") };

            var fetchItemsAction = new ServiceAction { Name = HandlesType(), ActionType = enActionType.InvokeManagementDynamicService, SourceMethod = HandlesType() };

            findServices.Actions.Add(fetchItemsAction);

            return findServices;
        }
Exemplo n.º 11
0
        public DynamicService CreateServiceEntry()
        {
            DynamicService ds = new DynamicService {Name = HandlesType()};

            ServiceAction action = new ServiceAction
                {
                    Name = HandlesType(),
                    SourceMethod = HandlesType(),
                    ActionType = enActionType.InvokeManagementDynamicService,
                    DataListSpecification = new StringBuilder("<DataList><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>")
                };

            ds.Actions.Add(action);

            return ds;
        }
        public DynamicService CreateServiceEntry()
        {
            var dynamicService = new DynamicService
            {
                Name = HandlesType(),
                DataListSpecification = new StringBuilder("<DataList><LoggingSettings ColumnIODirection=\"Input\"></LoggingSettings><Result/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>")
            };

            var serviceAction = new ServiceAction
            {
                Name = HandlesType(),
                ActionType = enActionType.InvokeManagementDynamicService,
                SourceMethod = HandlesType()
            };

            dynamicService.Actions.Add(serviceAction);

            return dynamicService;
        }
 public InternalServiceContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace theWorkspace, IEsbChannel esbChannel, EsbExecuteRequest request)
     : base(sa, dataObj, theWorkspace, esbChannel, request)
 {
     var dataListTO = new DataListTO(sa.DataListSpecification.ToString());
     if(request.Args == null)
     {
         request.Args = new Dictionary<string, StringBuilder>();
         foreach(var input in dataListTO.Inputs)
         {
             var warewolfEvalResult = dataObj.Environment.Eval(DataListUtil.AddBracketsToValueIfNotExist(input),0,false);
             if(warewolfEvalResult.IsWarewolfAtomResult)
             {
                 var scalarResult = warewolfEvalResult as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomResult;
                 if(scalarResult != null && !scalarResult.Item.IsNothing)
                 {
                     request.Args.Add(input, new StringBuilder(scalarResult.Item.ToString()));
                 }
             }
         }
     }
 }
 public DatabaseServiceContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace workspace, IEsbChannel esbChannel)
     : base(sa, dataObj, workspace, esbChannel)
 {
     _databaseServiceExecution = new DatabaseServiceExecution(dataObj);
 }
        static RemoteWorkflowExecutionContainerMock CreateExecutionContainer(IResourceCatalog resourceCatalog, string dataListShape = "<DataList></DataList>", string dataListData = "")
        {

            var dataObj = new Mock<IDSFDataObject>();
            dataObj.Setup(d => d.EnvironmentID).Returns(_connection.ResourceID);
            dataObj.Setup(d => d.ServiceName).Returns("Test");
            dataObj.Setup(d => d.RemoteInvokeResultShape).Returns(new StringBuilder("<ADL><NumericGUID></NumericGUID></ADL>"));
            dataObj.Setup(d => d.Environment).Returns(new ExecutionEnvironment());
            ExecutionEnvironmentUtils.UpdateEnvironmentFromXmlPayload(dataObj.Object,new StringBuilder(dataListData),dataListShape, 0);
            var sa = new ServiceAction();
            var workspace = new Mock<IWorkspace>();
            var esbChannel = new Mock<IEsbChannel>();

            var container = new RemoteWorkflowExecutionContainerMock(sa, dataObj.Object, workspace.Object, esbChannel.Object, resourceCatalog)
            {
                GetRequestRespsonse = "<DataList><NumericGUID>74272317-2264-4564-3988-700350008298</NumericGUID></DataList>"
            };
            return container;
        }
Exemplo n.º 16
0
        public DynamicService CreateServiceEntry()
        {
            var addScheduledResourceService = new DynamicService
                {
                    Name = HandlesType(),
                    DataListSpecification = new StringBuilder("<DataList><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>")
                };

            var addScheduledResourceAction = new ServiceAction
                {
                    Name = HandlesType(),
                    ActionType = enActionType.InvokeManagementDynamicService,
                    SourceMethod = HandlesType()
                };


            addScheduledResourceService.Actions.Add(addScheduledResourceAction);

            return addScheduledResourceService;
        }
 protected EsbExecutionContainer(ServiceAction sa, IDSFDataObject dataObject, IWorkspace theWorkspace, IEsbChannel esbChannel)
     : this(sa, dataObject, theWorkspace, esbChannel, null)
 {
 }
 // ReSharper disable once TooManyDependencies
 public WebServiceContainerMock(ServiceAction sa, IDSFDataObject dataObj, IWorkspace theWorkspace, IEsbChannel esbChannel)
     : base(sa, dataObj, theWorkspace, esbChannel)
 {
 }
Exemplo n.º 19
0
        public DynamicService CreateServiceEntry()
        {
            var ds = new DynamicService
            {
                Name = HandlesType(),
                DataListSpecification = new StringBuilder(@"<DataList><ResourceId ColumnIODirection=""Input""/><GetDependsOnMe ColumnIODirection=""Input""/><Dev2System.ManagmentServicePayload ColumnIODirection=""Both""></Dev2System.ManagmentServicePayload></DataList>")
            };

            var sa = new ServiceAction
            {
                Name = HandlesType(),
                ActionType = enActionType.InvokeManagementDynamicService,
                SourceMethod = HandlesType()
            };

            ds.Actions.Add(sa);

            return ds;

        }
Exemplo n.º 20
0
        public DynamicService CreateServiceEntry()
        {
            var checkPermissionsService = new DynamicService
            {
                Name = HandlesType(),
                DataListSpecification = new StringBuilder("<DataList><FilePath ColumnIODirection=\"Input\"><Username ColumnIODirection=\"Input\"/><Password ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>")
            };

            var checkPermissionsServiceAction = new ServiceAction
            {
                Name = HandlesType(),
                ActionType = enActionType.InvokeManagementDynamicService,
                SourceMethod = HandlesType()
            };

            checkPermissionsService.Actions.Add(checkPermissionsServiceAction);

            return checkPermissionsService;
        }
Exemplo n.º 21
0
 public PluginServiceContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace theWorkspace, IEsbChannel esbChannel)
     : base(sa, dataObj, theWorkspace, esbChannel)
 {
     _pluginServiceExecution = new PluginServiceExecution(dataObj, true);
 }
 // BUG 9304 - 2013.05.08 - TWR - Added IWorkflowHelper parameter to facilitate testing
 public WfExecutionContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace theWorkspace, IEsbChannel esbChannel, IWorkflowHelper workflowHelper)
     : base(sa, dataObj, theWorkspace, esbChannel)
 {
     _workflowHelper = workflowHelper;
 }
 public WfExecutionContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace theWorkspace, IEsbChannel esbChannel)
     : this(sa, dataObj, theWorkspace, esbChannel, new WorkflowHelper())
 {
   
 }
Exemplo n.º 24
0
        private void MapServiceActionDependencies(ServiceAction serviceAction, ServiceLocator serviceLocator)
        {

            serviceAction.Service = GetService(serviceAction.ServiceName, serviceAction.ServiceID, serviceLocator);
            if(!string.IsNullOrWhiteSpace(serviceAction.SourceName))
            {
                serviceAction.Source = serviceLocator.FindSourceByName(serviceAction.SourceName, _workspace.ID);
            }
        }
        public DynamicService CreateServiceEntry()
        {
            var workspaceItemService = new DynamicService { Name = HandlesType(), DataListSpecification = new StringBuilder("<DataList><IsLocalSave ColumnIODirection=\"Input\"/><ItemXml ColumnIODirection=\"Input\"/><Roles ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>") };

            var workspaceItemAction = new ServiceAction { Name = HandlesType(), ActionType = enActionType.InvokeManagementDynamicService, SourceMethod = HandlesType() };
            workspaceItemService.Actions.Add(workspaceItemAction);

            return workspaceItemService;
        }
 public WebServiceContainerMockWithError(ServiceAction sa, IDSFDataObject dsfDataObject, IWorkspace workspace, IEsbChannel esbChannel)
     : base(sa, dsfDataObject, workspace, esbChannel)
 {
 }
 /// <summary>
 /// Need to add loc property to AbstractActivity ;)
 /// </summary>
 /// <param name="sa"></param>
 /// <param name="dataObj"></param>
 /// <param name="workspace"></param>
 /// <param name="esbChannel"></param>
 public RemoteWorkflowExecutionContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace workspace, IEsbChannel esbChannel)
     : this(sa, dataObj, workspace, esbChannel, ResourceCatalog.Instance)
 {
 }
        public List<DynamicServiceObjectBase> GenerateServiceGraph(StringBuilder serviceData)
        {
            if(serviceData == null || serviceData.Length == 0)
            {
                throw new ArgumentException("serviceData");
            }

            List<DynamicServiceObjectBase> result = new List<DynamicServiceObjectBase>();
            var xe = serviceData.ToXElement();

            if(IsSource(serviceData))
            {
                Source src = new Source();
                var tmp = src as DynamicServiceObjectBase;
                ServiceMetaData.ExtractMetaData(xe, ref tmp);

                var typeOf = xe.AttributeSafe("ResourceType");

                enSourceType sourceType;
                src.Type = !Enum.TryParse(typeOf, out sourceType) ? enSourceType.Unknown : sourceType;

                src.ConnectionString = xe.AttributeSafe("ConnectionString");
                var tmpUri = xe.AttributeSafe("Uri");
                if(!string.IsNullOrEmpty(tmpUri))
                {
                    src.WebServiceUri = new Uri(tmpUri);
                }

                src.AssemblyName = xe.AttributeSafe("AssemblyName");
                src.AssemblyLocation = xe.AttributeSafe("AssemblyLocation");

                // PBI 6597: TWR - added source ID check
                var id = ServiceMetaData.SetID(ref xe);
                src.ID = id;
                src.ResourceDefinition = serviceData;

                result.Add(src);

            }
            else
            {
                DynamicService ds = new DynamicService();
                var tmp = ds as DynamicServiceObjectBase;
                ServiceMetaData.ExtractMetaData(xe, ref tmp);

                // set the resource def ;)
                ds.ResourceDefinition = serviceData;

                var actions = xe.Element("Actions");
                XElement action = actions != null ? actions.Element("Action") : xe.Element("Action");

                if(action != null)
                {
                    ServiceAction sa = new ServiceAction { Name = action.AttributeSafe("Name"), ResourceDefinition = serviceData };

                    // Set service action ;)
                    enActionType actionType;
                    var typeOf = action.AttributeSafe("Type");
                    if(Enum.TryParse(typeOf, out actionType))
                    {
                        sa.ActionType = actionType;
                    }

                    var element = action.Element("Outputs");
                    if(element != null)
                    {
                        sa.OutputSpecification = element.Value;
                    }

                    // set name and id ;)
                    sa.ServiceName = ds.Name;
                    var id = ServiceMetaData.SetID(ref xe);
                    ds.ID = id;

                    if(IsWorkflow(serviceData))
                    {
                        // Convert to StringBuilder
                        var xElement = action.Element("XamlDefinition");
                        if(xElement != null)
                        {
                            var def = xElement.ToStringBuilder();
                            def = def.Replace("<XamlDefinition>", "").Replace("</XamlDefinition>", "");
                            sa.XamlDefinition = def.Unescape();
                        }

                        var dataList = xe.Element("DataList");
                        if(dataList != null)
                        {
                            ds.DataListSpecification = dataList.ToStringBuilder();
                        }
                    }
                    else
                    {
                        if(sa.ActionType == enActionType.InvokeStoredProc)
                        {
                            int timeout;
                            Int32.TryParse(action.AttributeSafe("CommandTimeout"), out timeout);
                            sa.CommandTimeout = timeout;
                        }

                        var xElement = action.Element("OutputDescription");
                        if(xElement != null)
                        {
                            sa.OutputDescription = xElement.Value;
                        }

                        // process inputs and outputs ;)
                        var inputs = action.Element("Inputs");

                        if(inputs != null)
                        {
                            var inputCollection = inputs.Elements("Input");

                            foreach(var inputItem in inputCollection)
                            {
                                bool emptyToNull;
                                bool.TryParse(inputItem.AttributeSafe("EmptyToNull"), out emptyToNull);

                                ServiceActionInput sai = new ServiceActionInput
                                {
                                    Name = inputItem.AttributeSafe("Name"),
                                    Source = inputItem.AttributeSafe("Source"),
                                    DefaultValue = inputItem.AttributeSafe("DefaultValue"),
                                    EmptyToNull = emptyToNull,
                                    NativeType = inputItem.AttributeSafe("NativeType")
                                };

                                if(string.IsNullOrEmpty(sai.NativeType))
                                {
                                    sai.NativeType = "object";
                                }

                                // handle validators ;)
                                var validators = inputItem.Elements("Validator");
                                foreach(var validator in validators)
                                {
                                    Validator v = new Validator();

                                    enValidationType validatorType;
                                    v.ValidatorType = !Enum.TryParse(validator.AttributeSafe("Type"), out validatorType) ? enValidationType.Required : validatorType;

                                    sai.Validators.Add(v);
                                }

                                sa.ServiceActionInputs.Add(sai);
                            }
                        }
                    }

                    // add the action
                    ds.Actions.Add(sa);
                    result.Add(ds);
                }

            }

            return result;
        }
Exemplo n.º 29
0
        private EsbExecutionContainer GenerateContainer(ServiceAction serviceAction, IDSFDataObject dataObj, IWorkspace theWorkspace)
        {
            // set the ID for later use ;)
            dataObj.WorkspaceID = _workspace.ID;

            EsbExecutionContainer result = null;

            switch(serviceAction.ActionType)
            {
                case Common.Interfaces.Core.DynamicServices.enActionType.InvokeManagementDynamicService:
                    result = new InternalServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel, _request);
                    break;

                case Common.Interfaces.Core.DynamicServices.enActionType.InvokeStoredProc:
                    result = new DatabaseServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                    break;
                case Common.Interfaces.Core.DynamicServices.enActionType.InvokeWebService:
                    result = new WebServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                    break;

                case Common.Interfaces.Core.DynamicServices.enActionType.Plugin:
                    result = new PluginServiceContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                    break;

                case Common.Interfaces.Core.DynamicServices.enActionType.Workflow:
                    result = new WfExecutionContainer(serviceAction, dataObj, theWorkspace, _esbChannel);
                    break;

                case Common.Interfaces.Core.DynamicServices.enActionType.RemoteService:
                    result = new RemoteWorkflowExecutionContainer(serviceAction, dataObj, null, _esbChannel);
                    break;
            }

            return result;
        }
 public WebServiceContainer(ServiceAction sa, IDSFDataObject dataObj, IWorkspace theWorkspace, IEsbChannel esbChannel)
     : base(sa, dataObj, theWorkspace, esbChannel)
 {
     WebserviceExecution = new WebserviceExecution(dataObj, false);
 }