예제 #1
0
        /// <summary>
        /// ctor
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="logPath">tracking file path </param>
        /// <param name="wfHost">Workflow service host name</param>
        /// <param name="wfPersistanceDb">connection string, where WF persistance happens</param>
        public XMLFileTrackingChannel(TrackingParameters parameters, string wfHost, string logPath, string wfPersistanceDb)
        {
            _parameters      = parameters;
            _wfPersistanceDb = wfPersistanceDb;
            _workflowID      = parameters.InstanceId.ToString();
            _logLocation     = logPath;
            _wfHost          = wfHost;

            if (!Directory.Exists(_logLocation))
            {
                Directory.CreateDirectory(_logLocation);
            }

            //Start- Save Wf definition
            if (_persistanceHelper == null)
            {
                _persistanceHelper = new XMLFilePersistence(
                    Path.Combine(_logLocation, _workflowID + "_def.xml"),
                    Path.Combine(_logLocation, _workflowID + ".xml"),
                    _wfPersistanceDb
                    );

                //We will save Wf definition, if wf is new or it has been updated
                if (_persistanceHelper.IsNewOrUpdatedWfDefinition(_parameters.RootActivity))
                {
                    DateTime wfCompilationTimestamp =
                        _persistanceHelper.GetWfCompilationTimestamp(_parameters.RootActivity);

                    ActivitySummary rootActivitySummary = BuildRootActivitySummary();
                    String          activityXml         = BuildActivityXml(rootActivitySummary, wfCompilationTimestamp);
                    _persistanceHelper.PersistWfDefinitionXml(activityXml);
                }
            }
            //End- Save Wf definition
        }
예제 #2
0
 public SimpleTrackingChannel(TrackingParameters parameters)
 {
     trackingParameters = parameters;
     trackingDataFile   = TrackingDataFilePrefix + parameters.InstanceId.ToString() + ".txt";
     Console.WriteLine("Saving tracking information to " + trackingDataFile);
     streamWriter           = File.CreateText(trackingDataFile);
     streamWriter.AutoFlush = true;
 }
예제 #3
0
 protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
 {
     // Returns the channel that the runtime tracking infrastructure uses
     // to send tracking records to the tracking service.
     // For this sample a channel is returned that dumps the tracking record
     // to the command window using Console.WriteLine().
     return(new TrackingChannelSample(parameters));
 }
예제 #4
0
        ///<summary>
        ///Must be overridden in the derived class, and when implemented, returns the channel that the runtime tracking infrastructure uses to send tracking records to the tracking service.
        ///</summary>
        ///
        ///<returns>
        ///The <see cref="T:System.Workflow.Runtime.Tracking.TrackingChannel"></see> that is used to send tracking records to the tracking service.
        ///</returns>
        ///
        ///<param name="parameters">The <see cref="T:System.Workflow.Runtime.Tracking.TrackingParameters"></see> associated with the workflow instance.</param>
        protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
        {
            IAdoResourceProvider resourceProvider = ResourceProvider as IAdoResourceProvider;

            if (resourceProvider == null)
            {
                throw new ArgumentException(RM.Get_Error_NotIAdoResourceProvider());
            }

            return(new AdoTrackingChannel(resourceProvider, valueReader, nameResolver, parameters));
        }
예제 #5
0
        /// <summary>
        /// Construct a <see cref="GenericTrackingChannel" /> using
        /// the specified <see cref="IResourceProvider" /> for providing
        /// resources necessary for manipulating the underlying persistence store.
        /// </summary>
        /// <param name="resourceProvider">
        /// A <see cref="IResourceProvider" /> responsible for providing
        /// resources necessary for manipulating the underlying persistence store.
        /// </param>
        /// <param name="trackingParameters">
        /// <see cref="TrackingParameters" /> from the <see cref="TrackingService" />.
        /// </param>
        protected GenericTrackingChannel(IResourceProvider resourceProvider, TrackingParameters trackingParameters)
        {
            if (resourceProvider == null)
            {
                throw new ArgumentNullException("resourceProvider");
            }

            if (trackingParameters == null)
            {
                throw new ArgumentNullException("trackingParameters");
            }

            this.resourceProvider   = resourceProvider;
            this.trackingParameters = trackingParameters;
        }
예제 #6
0
        /// <summary>
        /// Create an instance of the <see cref="AdoTrackingChannel" />
        /// with the specified <see cref="IAdoResourceProvider" />, <see cref="ITrackingNameResolver" />
        /// and <see cref="IAdoValueReader" />.
        /// </summary>
        /// <param name="resourceProvider">
        /// An <see cref="IAdoResourceProvider" /> that provides resources
        /// for manipulating the underlying tracking store.
        /// </param>
        /// <param name="valueReader">
        /// An <see cref="IAdoValueReader" /> that is responsible for
        /// reading values from the underlying tracking store.
        /// </param>
        /// <param name="nameResolver">
        /// An <see cref="ITrackingNameResolver" /> that is responsible for
        /// resolving names for the underlying tracking store.
        /// </param>
        /// <param name="trackingParameters">
        /// <see cref="TrackingParameters" /> from the <see cref="TrackingService" />.
        /// </param>
        public AdoTrackingChannel(IAdoResourceProvider resourceProvider,
                                  IAdoValueReader valueReader, ITrackingNameResolver nameResolver,
                                  TrackingParameters trackingParameters) : base(resourceProvider,
                                                                                trackingParameters)
        {
            if (valueReader == null)
            {
                throw new ArgumentNullException("valueReader");
            }

            if (nameResolver == null)
            {
                throw new ArgumentNullException("nameResolver");
            }

            _valueReader  = valueReader;
            _nameResolver = nameResolver;
        }
            public TerminationTrackingChannel(TrackingParameters parameters, string source)
            {
                if (null == parameters)
                {
                    throw new ArgumentNullException("parameters");
                }

                if (null == source)
                {
                    throw new ArgumentNullException("source");
                }

                if (0 == source.Length)
                {
                    throw new ArgumentException("EventSource cannot be null or empty.", "source");
                }

                sourceValue     = source;
                parametersValue = parameters;
            }
예제 #8
0
    public static void loadConfigs(TrackingManager myScript)
    {
        if (!Directory.Exists(Application.dataPath + "/StreamingAssets"))
        {
            Directory.CreateDirectory(Application.dataPath + "/StreamingAssets");
        }

        string path = Application.dataPath + "/StreamingAssets/tracking_Params.json";

        try
        {
            StreamReader       reader = new StreamReader(path, false);
            string             json   = reader.ReadToEnd();
            TrackingParameters obj    = JsonUtility.FromJson <TrackingParameters>(json);
            reader.Close();
            myScript.tracking = obj;
        } catch
        {
            Debug.LogWarning("Config file was empty.");
            myScript.tracking = new TrackingParameters();
        }
    }
 public ConsoleTrackingChannel(TrackingParameters parameters)
 {
     this.parameters = parameters;
 }
 protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
 {
     //return a tracking channel to receive runtime events
     return(new ConsoleTrackingChannel(parameters));
 }
 /// <summary>
 /// Returns a tracking channel that will receive instnce terminated events.
 /// </summary>
 protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
 {
     return(new TerminationTrackingChannel(parameters, source));
 }
예제 #12
0
 public PropertyTrackingChannel(TrackingParameters trackingParams, PropertyTrackingService service)
 {
     _trackingService = service;
     _parameters      = trackingParams;
 }
        private List <TrackingChannelWrapper> GetChannels(Activity schedule, WorkflowExecutor exec, Guid instanceID, Type workflowType, ref TrackingListenerBroker broker)
        {
            if (this._services == null)
            {
                return(null);
            }
            bool flag = false;

            if (broker == null)
            {
                broker = new TrackingListenerBroker();
                flag   = true;
            }
            List <TrackingChannelWrapper> list             = new List <TrackingChannelWrapper>();
            List <string>          callPath                = null;
            Guid                   empty                   = Guid.Empty;
            Guid                   context                 = this.GetContext(exec.RootActivity);
            Guid                   callerContextGuid       = Guid.Empty;
            Guid                   callerParentContextGuid = Guid.Empty;
            TrackingCallingState   trackingCallingState    = exec.TrackingCallingState;
            TrackingListenerBroker broker1                 = (TrackingListenerBroker)exec.RootActivity.GetValue(WorkflowExecutor.TrackingListenerBrokerProperty);
            IList <string>         collection              = (trackingCallingState != null) ? trackingCallingState.CallerActivityPathProxy : null;

            if ((collection != null) && (collection.Count > 0))
            {
                callPath                = new List <string>(collection);
                empty                   = trackingCallingState.CallerWorkflowInstanceId;
                callerContextGuid       = trackingCallingState.CallerContextGuid;
                callerParentContextGuid = trackingCallingState.CallerParentContextGuid;
            }
            TrackingParameters parameters = new TrackingParameters(instanceID, workflowType, exec.WorkflowDefinition, callPath, empty, context, callerContextGuid, callerParentContextGuid);

            for (int i = 0; i < this._services.Count; i++)
            {
                TrackingChannel   trackingChannel     = null;
                Type              trackingServiceType = this._services[i].GetType();
                RTTrackingProfile profile             = null;
                if (flag)
                {
                    profile = this._profileManager.GetProfile(this._services[i], schedule);
                    if (profile == null)
                    {
                        continue;
                    }
                    broker.AddService(trackingServiceType, profile.Version);
                }
                else
                {
                    if (!broker.ContainsService(trackingServiceType))
                    {
                        continue;
                    }
                    if (broker.IsProfileInstance(trackingServiceType))
                    {
                        profile = this._profileManager.GetProfile(this._services[i], schedule, instanceID);
                        if (profile == null)
                        {
                            throw new InvalidOperationException(ExecutionStringManager.MissingProfileForService + trackingServiceType.ToString());
                        }
                        profile.IsPrivate = true;
                    }
                    else
                    {
                        Version version;
                        if (!broker.TryGetProfileVersionId(trackingServiceType, out version))
                        {
                            continue;
                        }
                        profile = this._profileManager.GetProfile(this._services[i], schedule, version);
                        if (profile == null)
                        {
                            throw new InvalidOperationException(ExecutionStringManager.MissingProfileForService + trackingServiceType.ToString() + ExecutionStringManager.MissingProfileForVersion + version.ToString());
                        }
                        if (broker.IsProfilePrivate(trackingServiceType))
                        {
                            profile           = profile.Clone();
                            profile.IsPrivate = true;
                        }
                    }
                }
                trackingChannel = this._services[i].GetTrackingChannel(parameters);
                if (trackingChannel == null)
                {
                    throw new InvalidOperationException(ExecutionStringManager.NullChannel);
                }
                list.Add(new TrackingChannelWrapper(trackingChannel, this._services[i].GetType(), workflowType, profile));
            }
            return(list);
        }
예제 #14
0
 protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
 {
     return(new Budget2TrackingChannel(parameters));
 }
예제 #15
0
 protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
 {
     throw new NotImplementedException();
 }
 public Budget2TrackingChannel(TrackingParameters parameters)
 {
     _parameters = parameters;
 }
예제 #17
0
 public TrackingChannelSample(TrackingParameters parameters)
 {
     this.parameters = parameters;
 }
예제 #18
0
 /// <summary>
 /// Retrieve the tracking channel
 /// </summary>
 /// <param name="parameters"></param>
 /// <returns></returns>
 protected override TrackingChannel GetTrackingChannel(
     TrackingParameters parameters)
 {
     //return an instance of the custom tracking channel
     return(new ConsoleTrackingChannel());
 }
예제 #19
0
 protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
 {
     return(new XMLFileTrackingChannel(parameters, GetMachineName() + "-" + Process.GetCurrentProcess().ProcessName, _logLocation, _wfPersistanceName));
 }
예제 #20
0
 protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
 {
     return(new PropertyTrackingChannel(parameters, this));
 }
        internal void ReloadProfiles(WorkflowExecutor exec, Guid instanceId, ref TrackingListenerBroker broker, ref List <TrackingChannelWrapper> channels)
        {
            Type workflowType = exec.WorkflowDefinition.GetType();

            foreach (TrackingService service in this._services)
            {
                TrackingProfile        profile = null;
                TrackingChannelWrapper wrapper = null;
                if (service.TryReloadProfile(workflowType, instanceId, out profile))
                {
                    bool flag  = false;
                    int  index = 0;
                    while (index < channels.Count)
                    {
                        if (service.GetType() == channels[index].TrackingServiceType)
                        {
                            wrapper = channels[index];
                            flag    = true;
                            break;
                        }
                        index++;
                    }
                    if (profile == null)
                    {
                        if (flag)
                        {
                            broker.RemoveService(wrapper.TrackingServiceType);
                            channels.RemoveAt(index);
                        }
                    }
                    else
                    {
                        RTTrackingProfile profile2 = new RTTrackingProfile(profile, exec.WorkflowDefinition, workflowType)
                        {
                            IsPrivate = true
                        };
                        if (!flag)
                        {
                            List <string>        callPath                = null;
                            Guid                 empty                   = Guid.Empty;
                            TrackingCallingState trackingCallingState    = exec.TrackingCallingState;
                            IList <string>       collection              = null;
                            Guid                 context                 = this.GetContext(exec.RootActivity);
                            Guid                 callerContextGuid       = Guid.Empty;
                            Guid                 callerParentContextGuid = Guid.Empty;
                            if (trackingCallingState != null)
                            {
                                collection = trackingCallingState.CallerActivityPathProxy;
                                if ((collection != null) && (collection.Count > 0))
                                {
                                    callPath                = new List <string>(collection);
                                    empty                   = trackingCallingState.CallerWorkflowInstanceId;
                                    callerContextGuid       = trackingCallingState.CallerContextGuid;
                                    callerParentContextGuid = trackingCallingState.CallerParentContextGuid;
                                }
                            }
                            TrackingParameters     parameters = new TrackingParameters(instanceId, workflowType, exec.WorkflowDefinition, callPath, empty, context, callerContextGuid, callerParentContextGuid);
                            TrackingChannelWrapper item       = new TrackingChannelWrapper(service.GetTrackingChannel(parameters), service.GetType(), workflowType, profile2);
                            channels.Add(item);
                            Type type = service.GetType();
                            broker.AddService(type, profile2.Version);
                            broker.MakeProfileInstance(type);
                        }
                        else
                        {
                            wrapper.SetTrackingProfile(profile2);
                            broker.MakeProfileInstance(wrapper.TrackingServiceType);
                        }
                    }
                }
            }
        }