/// <summary> /// Obtain a BAM interception policy for a given business activity. /// </summary> /// <param name="activityName"> /// Name of the business activity /// </param> /// <param name="stepName"> /// The name of the current BAM activity step. /// </param> /// <param name="policyName"> /// The policy Name. /// </param> /// <param name="version"> /// The version. /// </param> /// <returns> /// A sub-classed activity interceptor configuration object containing the configuration for tracking points. /// </returns> public BamActivityStep GetInterceptionPolicy(string activityName, string stepName, string policyName, string version) { try { Debug.Write("[ResolutionService] Called GetInterceptionPolicy"); // Check parameters if (string.IsNullOrWhiteSpace(activityName)) { throw new EsbResolutionServiceException(Resources.ExceptionBamActivityParameter); } // Is not in the cache we need to excecute the policy on BRE and then put on the cache Version ver = null; if (!string.IsNullOrWhiteSpace(version)) { ver = new Version(version); } // Execute the policy var policyResultFact = BusinessRuleEnginePolicyEvaluator.GetBamActivityPolicy(policyName, ver, activityName, stepName); Debug.Write("[ResolutionService] - Returned a BAM interception policy from BRE."); return(policyResultFact); } catch (Exception ex) { EventLog.WriteEntry("ESBResolutionService", ex.ToString(), EventLogEntryType.Error, 2); throw; } }
/// <summary> /// Execute the policy and returns the info related, the information is then cached. /// </summary> /// <param name="request"> /// The request made to the resolver service. /// </param> /// <returns> /// An interchange document containing resolved values. /// </returns> public ResolveResponse Resolve(ResolveRequest request) { try { // Check parameters if (string.IsNullOrEmpty(request.PolicyName)) { throw new EsbResolutionServiceException(Resources.ExceptionPolicyNameInvalid); } // Is not in the cache we need to excecute the policy on BRE and then put on the cache Version ver = null; if (!string.IsNullOrEmpty(request.Version)) { ver = new Version(request.Version); } // Execute the policy var policyResultFacts = BusinessRuleEnginePolicyEvaluator.Eval( request.PolicyName, ver, request.ProviderName, request.ServiceName, request.BindingAccessPoint, request.BindingUrlType, request.MessageType, request.OperationName, request.MessageRole, request.Parameters, request.MessageDirection); Debug.Write("[ResolutionService] Resolve - Returned # directives from BRE: '" + policyResultFacts.Directives.Count + "'"); return(new ResolveResponse { Interchange = policyResultFacts }); } catch (Exception ex) { EventLog.WriteEntry("ESBResolutionService", ex.ToString(), EventLogEntryType.Error, 1); throw; } }