public RouteAction Handle(ICall call)
 {
     var callSpecification = _callSpecificationFactory.CreateFrom(call, _matchArgs);
     if (!_receivedCalls.FindMatchingCalls(callSpecification).Any())
     {
         _exceptionThrower.Throw(callSpecification, GetAllReceivedCallsToMethod(call));
     }
     return RouteAction.Continue();
 }
Beispiel #2
0
		public bool IsTriggered(ICall call, DateTime triggerDate)
		{
			if( new TimeSpan(triggerDate.Ticks - call.Date.Ticks).TotalMilliseconds >= _delay)
				return true;
			
			return false;
		}
        RouteAction ICallHandler.Handle(ICall call)
        {
            if (!HasResultFor(call))
                action();

            return RouteAction.Continue();
        }
 public bool IsSatisfiedBy(ICall call)
 {
     if (_methodInfo != call.GetMethodInfo()) return false;
     if (HasDifferentNumberOfArguments(call)) return false;
     if (NonMatchingArguments(call).Any()) return false;
     return true;
 }
 public object GetResult(ICall call)
 {
     return _results
             .Reverse()
             .First(x => x.IsResultFor(call))
             .GetResult(_callInfoFactory.Create(call));
 }
 public RouteAction Handle(ICall call)
 {
     var target = call.Target();
     var callSpec = _callSpecificationFactory.CreateFrom(call, MatchArgs.AsSpecifiedInCall);
     _context.AddToQuery(target, callSpec);
     return RouteAction.Continue();
 }
		public void Expect( ICall call )
		{
			if ( expectedCalls == null )
				expectedCalls = new ArrayList();

			expectedCalls.Add( call );
		}
 private ICode HandleCall(ICall call, Func<Expr, IEnumerable<Expr>, ICode> fnNew) {
     if (call.CallMethod.Name == "DeepCopyValueType") {
         // HACK
         return call;
     }
     var obj = (Expr)this.Visit(call.Obj);
     var argsInfo = call.Args.Select((arg, i) => new { arg, parameterType = call.CallMethod.Parameters[i].ParameterType }).ToArray();
     var args = this.HandleList(argsInfo, argInfo => {
         if (!argInfo.parameterType.IsValueType) {
             return argInfo;
         }
         var arg = argInfo.arg;
         var type = arg.Type;
         if (type.IsNonPrimitiveValueType() && !type.IsRuntimeHandle() && !type.IsEnum()) {
             return new { arg = InternalFunctions.ValueTypeDeepCopyIfRequired(arg.Type, () => arg) ?? arg, parameterType = argInfo.parameterType };
         } else {
             return argInfo;
         }
     }).NullThru(x => x.Select(y => y.arg).ToArray());
     if (obj != call.Obj || args != null) {
         return fnNew(obj, args ?? call.Args);
     } else {
         return call;
     }
 }
Beispiel #9
0
 public static Expr op_Equality(ICall call) {
     var ctx = call.Ctx;
     var a = call.Args.ElementAt(0);
     var b = call.Args.ElementAt(1);
     var expr = new ExprBinary(ctx, BinaryOp.Equal, ctx.Boolean, a, b);
     return expr;
 }
 public RouteAction Handle(ICall call)
 {
     var callSpec = _callSpecificationFactory.CreateFrom(call, MatchArgs.AsSpecifiedInCall);
     _pendingCallSpecification.Set(callSpec);
     _callActions.Add(callSpec);
     return RouteAction.Continue();
 }
 public IEnumerable<ArgumentMatchInfo> NonMatchingArguments(ICall call)
 {
     var arguments = call.GetArguments();
     return arguments
             .Select((arg, index) => new ArgumentMatchInfo(index, arg, _argumentSpecifications[index]))
             .Where(x => !x.IsMatch);
 }
Beispiel #12
0
		public bool TriggeredExecution(ICall call)
		{
			foreach(ITrigger trigger in _triggers)
			{
				if(!trigger.IsTriggered(call, DateTime.Now))
					return false;
			}
			
			_log.Info("Actionpack '{0}' is triggered for call '{1}'", _name, call);
			
			foreach(IAction action in _actions)
			{
				try
				{
					_log.Info("started action '{0}'", action.GetType());
					action.Execute(call);
					_log.Info("Completed action '{0}'", action.GetType());
				}
				catch(Exception e)
				{
					_log.ErrorException(string.Format("Error executing action '{0}'",action.GetType()), e);
				}
			}
			
			return true;
		}
Beispiel #13
0
 public void OnFailure(ICall call, Java.IO.IOException exception)
 {
     if (onFailure != null)
     {
         onFailure(call, exception);
     }
 }
Beispiel #14
0
 public void OnResponse(ICall call, Response response)
 {
     if (onResponse != null)
     {
         onResponse(call, response);
     }
 }
Beispiel #15
0
 public void InvokeMatchingActions(ICall call)
 {
     var callInfo = _callInfoFactory.Create(call);
     foreach (var action in _actions.Where(x => x.IsSatisfiedBy(call)))
     {
         action.Invoke(callInfo);
     }
 }
 public RouteAction Handle(ICall call)
 {
     if (_callResults.HasResultFor(call))
     {
         return RouteAction.Return(_callResults.GetResult(call));
     }
     return RouteAction.Continue();
 }
 public object Handle(ICall call)
 {
     _routeParts.GetPart<EventSubscriptionHandler>().Handle(call);
     _routeParts.GetPart<PropertySetterHandler>().Handle(call);
     _routeParts.GetPart<DoActionsCallHandler>().Handle(call);
     _routeParts.GetPart<RecordCallHandler>().Handle(call);
     return _routeParts.GetPart<ReturnConfiguredResultHandler>().Handle(call);
 }
 public RouteAction Handle(ICall call)
 {
     var type = call.GetReturnType();
     var compatibleProviders = _autoValueProviders.Where(x => x.CanProvideValueFor(type)).FirstOrNothing();
     return compatibleProviders.Fold(
         RouteAction.Continue,
         ReturnValueUsingProvider(call, type));
 }
Beispiel #19
0
        public DtmfEventArgs(ICall call, int digit)
        {
            Helper.GuardNotNull(call);
            Helper.GuardPositiveInt(call.Id);

            Digit = Convert.ToChar(digit);
            CallId = call.Id;
        }
        public RouteAction Handle(ICall call)
        {
            // We want the proxies to respond to the base object methods (e.g. Equals, GetHashCode)
            if (call.GetMethodInfo().GetBaseDefinition().DeclaringType == typeof(object))
                return RouteAction.Return(call.CallOriginalMethod());

            return RouteAction.Continue();
        }
 private void If(ICall call, Func<ICall, Predicate<EventInfo>> meetsThisSpecification, Action<string, object> takeThisAction)
 {
     var events = GetEvents(call, meetsThisSpecification);
     if (events.Any())
     {
         takeThisAction(events.First().Name, call.GetArguments()[0]);
     }            
 }
Beispiel #22
0
 public RingEventArgs(bool ringOn, ICall call)
 {
     Helper.GuardNotNull(call);
     Helper.GuardPositiveInt(call.Id);
     RingOn = ringOn;
     IsRingback = !call.IsIncoming;
     CallId = call.Id;
 }
        private string FormatCall(ICall call, bool isAcrossMultipleTargets, TypeInstanceNumberLookup instanceLookup)
        {
            var s = _callFormatter.Format(call.GetMethodInfo(), FormatArgs(call.GetArguments()));
            if (!isAcrossMultipleTargets) return s;

            var target = call.Target();
            var methodInfo = call.GetMethodInfo();
            return FormatCallForInstance(instanceLookup, target, methodInfo, s);
        }
 private Func<IAutoValueProvider, RouteAction> ReturnValueUsingProvider(ICall call, Type type)
 {
     return provider =>
     {
         var valueToReturn = provider.GetValue(type);
         ConfigureCall.SetResultForCall(call, new ReturnValue(valueToReturn), MatchArgs.AsSpecifiedInCall);
         return RouteAction.Return(valueToReturn);
     };
 }
 public IEnumerable<int> NonMatchingArgumentIndicies(ICall call)
 {
     var arguments = call.GetArguments();
     for (var i = 0; i < arguments.Length; i++)
     {
         var argumentMatchesSpecification = ArgIsSpecifiedAndMatchesSpec(arguments[i], i);
         if (!argumentMatchesSpecification) yield return i;
     }
 }
        public RouteAction Handle(ICall call)
        {
            if (!_required) return RouteAction.Continue();
            if (_callBaseExclusions.IsExcluded(call)) return RouteAction.Continue();

            return call
                    .TryCallBase()
                    .Fold(RouteAction.Continue, RouteAction.Return);
        }
 public ICallSpecification CreateFrom(ICall call, MatchArgs matchArgs)
 {
     var methodInfo = call.GetMethodInfo();
     var argumentSpecs = call.GetArgumentSpecifications();
     var arguments = call.GetOriginalArguments();
     var parameterInfos = call.GetParameterInfos();
     var argumentSpecificationsForCall = _argumentSpecificationsFactory.Create(argumentSpecs, arguments, parameterInfos, matchArgs);
     return new CallSpecification(methodInfo, argumentSpecificationsForCall);
 }
Beispiel #28
0
 public ICall CreateCallToPropertyGetterFromSetterCall(ICall callToSetter)
 {
     var propertyInfo = GetPropertyFromSetterCallOrNull(callToSetter);
     if (!PropertySetterExistsAndHasAGetMethod(propertyInfo))
     {
         throw new InvalidOperationException("Could not find a GetMethod for \"" + callToSetter.GetMethodInfo() + "\"");
     }
     var getter = propertyInfo.GetGetMethod();
     return new CallToPropertyGetter(getter, callToSetter.Target());
 }
Beispiel #29
0
        public object Route(ICall call)
        {
            _context.LastCallRouter(this);
            if (_context.IsQuerying) { UseQueryRouteForNextCall(); }
            else if (IsSpecifyingACall(call)) { UseRecordCallSpecRouteForNextCall(); }

            var routeToUseForThisCall = _currentRoute;
            UseDefaultRouteForNextCall();
            return routeToUseForThisCall.Handle(call);
        }
 public object Handle(ICall call)
 {
     var actions = _callActions.MatchingActions(call);
     var callInfo = _callInfoFactory.Create(call);
     foreach (var action in actions)
     {
         action(callInfo);
     }
     return null;
 }
Beispiel #31
0
 public RouteAction Handle(ICall call)
 {
     call.AssignSequenceNumber(_generator.Next());
     _callCollection.Add(call);
     return(RouteAction.Continue());
 }
Beispiel #32
0
 public bool IsResultFor(ICall call) => _callSpecification.IsSatisfiedBy(call);
Beispiel #33
0
 public override void OnCallStarted(ICall call)
 {
     Log.Debug(TAG, "OnCallStarted " + call);
 }
Beispiel #34
0
 private PropertyInfo GetPropertyFromSetterCallOrNull(ICall call)
 {
     return(call.GetMethodInfo().GetPropertyFromSetterCallOrNull());
 }
Beispiel #35
0
        /// <summary>
        /// Event fired when call has been updated.
        /// </summary>
        /// <param name="sender">Call object.</param>
        /// <param name="args">Event args containing the old values and the new values.</param>
        private void CallOnUpdated(ICall sender, ResourceEventArgs <Call> args)
        {
            var outcome = Serializer.SerializeObject(sender.Resource);

            this.OutcomesLogMostRecentFirst.AddFirst("Call Updated:\n" + outcome);
        }
Beispiel #36
0
 public AppPoolWatcher(ICall call, IEmail email, ISMS sms)
 {
     this.call  = call;
     this.email = email;
     this.sms   = sms;
 }
Beispiel #37
0
 public void Esclate(ICall call)
 {
 }
Beispiel #38
0
 public void OnFailure(ICall p0, Throwable p1)
 {
 }
 public CallWrapper(ICall call)
 {
     Call = call;
 }
 public ClientMethodInvoker(ICall call)
 {
     _call = call;
 }
Beispiel #41
0
 public override void Context()
 {
     _call        = mock <ICall>();
     _callResults = mock <ICallResults>();
 }
            static async ValueTask <T> SlowExecuteValueCall(SingleThreadInvoker @this, ICall <T> call)
            {
                await @this.WaitForExecutionSlot();

                try
                {
                    return(await call.Invoke());
                }
                finally
                {
                    @this.ReturnExecutionSlot();
                }
            }
 public void Delete()
 {
     Call = null;
 }
 private void Call(ICall call)
 {
     SimCardHolder.Call(call);
 }
Beispiel #45
0
 protected abstract object?[] WorkOutRequiredArguments(ICall call);
Beispiel #46
0
 public async Task DoStep(Step settings, ICall call)
 {
     call.Logger.Info($"Stop recording {call.CallState.GetIncomingLineId()}");
     await call.RecordingManager.StopRecordingOnLine(call.CallState.GetIncomingLineId());
 }
Beispiel #47
0
 public void ProcessCall(ICall call)
 {
     call.Status = CallStatus.Processing;
     Console.WriteLine($"Manager: {this.EmployeeID} is Prcessing call {call.CallID}");
     call.Status = CallStatus.Accomplished;
 }
Beispiel #48
0
    private void Connect()
    {
        DebugLog.AddEntry("connecting...");

        // create network config
        if (networkConfig == null)
        {
            networkConfig = CreateNetworkConfig(account);
        }

        // setup caller
        caller = UnityCallFactory.Instance.Create(networkConfig);
        if (caller == null)
        {
            Debug.Log("Failed to create caller");
            return;
        }

        caller.LocalFrameEvents = true;
        caller.CallEvent       += HandleCallEvent;

        // setup media config
        if (mediaConfig == null)
        {
            mediaConfig = CreateMediaConfig();

            // prefer the external video device
            if (UnityCallFactory.Instance.CanSelectVideoDevice())
            {
                string[] videoDevices = UnityCallFactory.Instance.GetVideoDevices();

                // show all video device names
                for (int i = 0; i < videoDevices.Length; i++)
                {
                    var name = videoDevices[i];
                    DebugLog.AddEntry("video device #" + i + ": " + name);
                }

                var preferredDevice = PlayerPrefs.GetInt(PREFS.VIDEO_DEVICE);
                if (preferredDevice < videoDevices.Length)
                {
                    mediaConfig.VideoDeviceName = videoDevices[preferredDevice];
                }
                else
                {
                    // use defualt device if the preferred device is out of range
                    mediaConfig.VideoDeviceName = videoDevices[0];
                }
            }
            else
            {
                mediaConfig.VideoDeviceName = UnityCallFactory.Instance.GetDefaultVideoDevice();
            }
            DebugLog.AddEntry("Using video device: " + mediaConfig.VideoDeviceName);
        }

        caller.Configure(mediaConfig);

        // start listening...
        if (Globals.role == Role.Therapist)
        {
            DebugLog.AddEntry("server listening for connections on " + account.address + "...");
            SetStatusMessageText("Listening for connections on " + account.address + "...");
            caller.Listen(account.address);
        }
        else
        {
            DebugLog.AddEntry("client connecting to " + account.address + "...");
            SetStatusMessageText("Connecting to " + account.address + "...");
            caller.Call(account.address);
        }
    }
 public bool IsSatisfiedBy(ICall call)
 {
     return(_callSpecification.IsSatisfiedBy(call));
 }
Beispiel #50
0
 public CallStateMachine(ICall call, IPromptPlayer promptPlayer)
 {
     _call         = call;
     _promptPlayer = promptPlayer;
 }
 public void OnResponse(ICall p0, Response p1)
 {
     tcs.TrySetResult(p1);
 }
Beispiel #52
0
 private static bool NotCompleteMethod(ICall call)
 {
     return(call.GetMethodInfo().Name != "Complete");
 }
Beispiel #53
0
 /// <summary>
 /// Gets the request rquid from the call if it exists.
 /// Otherwise it creates and sets it.
 /// </summary>
 protected string GetRequestRquId(ICall call)
 {
     return(GeneralUtility.GetRequestRquId(call));
 }
Beispiel #54
0
 public MyConsole()
 {
     m_items.Add("test", ICall.Create(Test));
 }
Beispiel #55
0
 public override void OnCallEndedWithError(ICall call, CallException callException)
 {
     Log.Debug(TAG, "OnCallEndedWithError " + call);
 }
Beispiel #56
0
 public IMessageBuilder InDialogOf(ICall call)
 {
     Helper.GuardNotNull(call);
     _dialog = call;
     return(this);
 }
Beispiel #57
0
 private static bool ReturnsVoidFrom(ICall call)
 {
     return(call.GetReturnType() == typeof(void));
 }
 public void Push(ICall call)
 {
     _stack.Push(call);
 }
Beispiel #59
0
 public RouteAction Handle(ICall call) => _handler.Invoke(call);
 /// <inheritdoc/>
 protected override void CallOnUpdated(ICall sender, ResourceEventArgs <Call> args)
 {
     this.statusData?.UpdateBotMeetingStatus(sender.Resource.State);
 }