Ejemplo n.º 1
0
 public void InvokeFlowRuleCode(ManagementAgent ma, FlowRule rule, CSEntry csentry, MVEntry mventry)
 {
     Tracer.TraceInformation("enter-invokeflowrulecode {0}", rule.Name);
     try
     {
         FlowRuleCode r = (FlowRuleCode)rule;
         if (r.Direction.Equals(Direction.Import))
         {
             ma.InvokeMapAttributesForImport(r.Name, csentry, mventry);
         }
         else
         {
             ma.InvokeMapAttributesForExport(r.Name, csentry, mventry);
         }
         r = null;
     }
     catch (Exception ex)
     {
         Tracer.TraceError("invokeflowrulecode {0}", ex.GetBaseException());
         throw ex;
     }
     finally
     {
         Tracer.TraceInformation("exit-invokeflowrulecode {0}", rule.Name);
     }
 }
Ejemplo n.º 2
0
        DeprovisionAction IMASynchronization.Deprovision(CSEntry csentry)
        {
            Tracer.TraceInformation("enter-deprovision");
            Tracer.Indent();

            List <DeprovisionRule> rules = null;

            try
            {
                string maName = csentry.MA.Name;
                Tracer.TraceInformation("ma: {1}, dn: {2}", maName, csentry.DN);

                ManagementAgent ma = config.ManagementAgent.Where(m => m.Name.Equals(maName)).FirstOrDefault();
                if (ma == null)
                {
                    throw new NotImplementedException("management-agent-" + maName + "-not-found");
                }

                rules = ma.Deprovision.DeprovisionRule.ToList <DeprovisionRule>();

                if (rules == null)
                {
                    Tracer.TraceInformation("no-rules-defined-returning-default-action", ma.Deprovision.DefaultAction);
                    return(FromOperation(ma.Deprovision.DefaultAction));
                }

                foreach (DeprovisionRule r in rules)
                {
                    Tracer.TraceInformation("found-rule name: {0}, description: {1}", r.Name, r.Description);
                }

                //DeprovisionRule rule = rules.Where(ru => ru.Conditions.AreMet(csentry, mventry)).FirstOrDefault();

                return(FromOperation(ma.Deprovision.DefaultAction));
            }
            catch (Exception ex)
            {
                Tracer.TraceError("deprovision {0}", ex.GetBaseException());
                throw ex;
            }
            finally
            {
                if (rules != null)
                {
                    rules.Clear();
                    rules = null;
                }

                Tracer.Unindent();
                Tracer.TraceInformation("exit-deprovision");
            }
        }
Ejemplo n.º 3
0
        void IMASynchronization.MapAttributesForJoin(string FlowRuleName, CSEntry csentry, ref ValueCollection values)
        {
            Tracer.TraceInformation("enter-mapattributesforjoin [{0}]", FlowRuleName);

            JoinRule rule = null;

            try
            {
                string maName = csentry.MA.Name;
                Tracer.TraceInformation("csentry: dn: {0}, ma: {1}, rule: {2}", csentry.DN, maName, FlowRuleName);

                ManagementAgent ma = config.ManagementAgent.Where(m => m.Name.Equals(maName)).FirstOrDefault();
                if (ma == null)
                {
                    throw new NotImplementedException("management-agent-" + maName + "-not-found");
                }
                foreach (JoinRule r in ma.JoinRule)
                {
                    Tracer.TraceInformation("found-rule {0}", r.Name);
                }
                rule = ma.JoinRule.FirstOrDefault(r => r.Name.Equals(FlowRuleName));

                if (rule == null)
                {
                    throw new DeclineMappingException("rule-'" + FlowRuleName + "'-not-found-on-ma-" + maName);
                }

                InvokeMapJoinRule(rule, csentry, ref values);

                rule = null;
            }
            catch (Exception ex)
            {
                Tracer.TraceError("mapattributesforjoin {0}", ex.GetBaseException());
                throw ex;
            }
            finally
            {
                Tracer.TraceInformation("exit-mapattributesforjoin [{0}]", FlowRuleName);
            }
        }
Ejemplo n.º 4
0
        public void MapAttributesForImportExportDetached(string FlowRuleName, CSEntry csentry, MVEntry mventry, Direction direction)
        {
            Tracer.TraceInformation("enter-mapattributesforimportexportdetached [{0}]", direction);

            List <FlowRule> rules = null;

            try
            {
                string maName = csentry.MA.Name;
                Tracer.TraceInformation("mvobjectid: {0}, ma: {1}, rule: {2}", mventry.ObjectID, maName, FlowRuleName);

                ManagementAgent ma = config.ManagementAgent.Where(m => m.Name.Equals(maName)).FirstOrDefault();
                if (ma == null)
                {
                    throw new NotImplementedException("management-agent-" + maName + "-not-found");
                }
                rules = ma.FlowRule.Where(r => r.Name.Equals(FlowRuleName) && r.Direction.Equals(direction)).ToList <FlowRule>();
                if (rules == null)
                {
                    throw new NotImplementedException(direction.ToString() + "-rule-'" + FlowRuleName + "'-not-found-on-ma-" + maName);
                }
                foreach (FlowRule r in rules)
                {
                    Tracer.TraceInformation("found-rule name: {0}, description: {1}", r.Name, r.Description);
                }
                FlowRule rule = rules.Where(ru => ru.Conditions.AreMet(csentry, mventry)).FirstOrDefault();
                if (rule == null)
                {
                    throw new DeclineMappingException("no-" + direction.ToString() + "-rule-'" + FlowRuleName + "'-found-on-ma-'" + maName + "'-where-conditions-were-met");
                }

                #region FlowRuleDefault
                if (rule.GetType().Equals(typeof(FlowRule)))
                {
                    InvokeFlowRule(rule, csentry, mventry);
                    return;
                }
                #endregion
                #region FlowRuleCode
                if (rule.GetType().Equals(typeof(FlowRuleCode)))
                {
                    InvokeFlowRuleCode(ma, rule, csentry, mventry);
                    return;
                }
                #endregion

                rule = null;
            }
            catch (Exception ex)
            {
                Tracer.TraceError("mapattributesforimportexportdetached {0}", ex.GetBaseException());
                throw ex;
            }
            finally
            {
                if (rules != null)
                {
                    rules.Clear();
                    rules = null;
                }
                Tracer.TraceInformation("exit-mapattributesforimportexportdetached [{0}]", direction);
            }
        }