Esempio n. 1
0
 private void RegisterExtension(IKernelExtension kernelExtension)
 {
     if (kernelExtension is IStaticContentSource source)
     {
         var name = source.Name;
         _providers.GetOrAdd(name, key => new EmbeddedFileProvider(source.GetType().Assembly));
     }
 }
Esempio n. 2
0
 public void registExtension(IKernelExtension extension)
 {
     if (!Extension_Target_Name.Equals(extension.ExtentionTargetName))
     {
         return;
     }
     if (Extension_Point_TransitionInstanceEventListener.Equals(extension.ExtentionPointName))
     {
         if (extension is IEdgeInstanceEventListener)
         {
             this.eventListeners.Add((IEdgeInstanceEventListener)extension);
         }
         else
         {
             throw new Exception("Error:When construct the TransitionInstance,the extension MUST be a instance of ITransitionInstanceEventListener");
         }
     }
 }
Esempio n. 3
0
 //TODO extesion是单态还是多实例?单态应该效率高一些。
 public override void registExtension(IKernelExtension extension)
 {
     if (!Extension_Target_Name.Equals(extension.ExtentionTargetName))
     {
         throw new Exception("Error:When construct the ActivityInstance,the Extension_Target_Name is mismatching");
     }
     if (Extension_Point_NodeInstanceEventListener.Equals(extension.ExtentionPointName))
     {
         if (extension is INodeInstanceEventListener)
         {
             this.EventListeners.Add((INodeInstanceEventListener)extension);
         }
         else
         {
             throw new Exception("Error:When construct the ActivityInstance,the extension MUST be a instance of INodeInstanceEventListener");
         }
     }
 }
Esempio n. 4
0
 // TODO extesion是单态还是多实例?单态应该效率高一些。
 public override void registExtension(IKernelExtension extension)
 {
     // System.out.println("====extension class is
     // "+extension.getClass().Name);
     if (!Extension_Target_Name.Equals(extension.ExtentionTargetName))
     {
         throw new Exception("Error:When construct the StartNodeInstance,the Extension_Target_Name is mismatching");
     }
     if (Extension_Point_NodeInstanceEventListener.Equals(extension.ExtentionPointName))
     {
         if (extension is INodeInstanceEventListener)
         {
             this.EventListeners.Add((INodeInstanceEventListener)extension);
         }
         else
         {
             throw new Exception("Error:When construct the StartNodeInstance,the extension MUST be a instance of INodeInstanceEventListener");
         }
     }
 }
Esempio n. 5
0
        /// <summary>wangmj  初始化一个工作流网实例,将引擎的扩展属性,注入到对应的工作流元素中</summary>
        /// <param name="process"></param>
        /// <param name="kenelExtensions"></param>
        public NetInstance(WorkflowProcess process, Dictionary <String, List <IKernelExtension> > kenelExtensions)
        {
            this.workflowProcess = process;

            //开始节点
            StartNode startNode = workflowProcess.StartNode;

            StartNodeInstance = new StartNodeInstance(startNode);
            List <IKernelExtension> extensionList = kenelExtensions[StartNodeInstance.ExtensionTargetName];

            for (int i = 0; extensionList != null && i < extensionList.Count; i++)
            {
                IKernelExtension extension = extensionList[i];
                StartNodeInstance.registExtension(extension);
            }
            //this.StartNodeInstance = StartNodeInstance; 自身赋值自身没用。
            wfElementInstanceMap.Add(startNode.Id, StartNodeInstance);

            //活动节点activity
            List <Activity> activities = workflowProcess.Activities;

            for (int i = 0; i < activities.Count; i++)
            {
                Activity         activity         = (Activity)activities[i];
                ActivityInstance activityInstance = new ActivityInstance(activity);
                extensionList = kenelExtensions[activityInstance.ExtensionTargetName];
                for (int j = 0; extensionList != null && j < extensionList.Count; j++)
                {
                    IKernelExtension extension = extensionList[j];
                    activityInstance.registExtension(extension);
                }
                wfElementInstanceMap.Add(activity.Id, activityInstance);
            }

            //同步器节点
            List <Synchronizer> synchronizers = workflowProcess.Synchronizers;

            for (int i = 0; i < synchronizers.Count; i++)
            {
                Synchronizer         synchronizer         = (Synchronizer)synchronizers[i];
                SynchronizerInstance synchronizerInstance = new SynchronizerInstance(synchronizer);
                extensionList = kenelExtensions[synchronizerInstance.ExtensionTargetName];
                for (int j = 0; extensionList != null && j < extensionList.Count; j++)
                {
                    IKernelExtension extension = extensionList[j];
                    synchronizerInstance.registExtension(extension);
                }
                wfElementInstanceMap.Add(synchronizer.Id, synchronizerInstance);
            }

            //结束节点
            List <EndNode> endNodes = workflowProcess.EndNodes;

            //        List<EndNodeInstance> endNodeInstances = netInstance.getEndNodeInstances();
            for (int i = 0; i < endNodes.Count; i++)
            {
                EndNode         endNode         = endNodes[i];
                EndNodeInstance endNodeInstance = new EndNodeInstance(endNode);
                //            endNodeInstances.add(endNodeInstance);
                extensionList = kenelExtensions[endNodeInstance.ExtensionTargetName];
                for (int j = 0; extensionList != null && j < extensionList.Count; j++)
                {
                    IKernelExtension extension = extensionList[j];
                    endNodeInstance.registExtension(extension);
                }
                wfElementInstanceMap.Add(endNode.Id, endNodeInstance);
            }

            //转移线
            List <Transition> transitions = workflowProcess.Transitions;

            for (int i = 0; i < transitions.Count; i++)
            {
                Transition         transition         = (Transition)transitions[i];
                TransitionInstance transitionInstance = new TransitionInstance(transition);

                String fromNodeId = transition.FromNode.Id;
                if (fromNodeId != null)
                {
                    INodeInstance enteringNodeInstance = (INodeInstance)wfElementInstanceMap[fromNodeId];
                    if (enteringNodeInstance != null)
                    {
                        enteringNodeInstance.AddLeavingTransitionInstance(transitionInstance);
                        transitionInstance.EnteringNodeInstance = enteringNodeInstance;
                    }
                }

                String toNodeId = transition.ToNode.Id;
                if (toNodeId != null)
                {
                    INodeInstance leavingNodeInstance = (INodeInstance)wfElementInstanceMap[toNodeId];
                    if (leavingNodeInstance != null)
                    {
                        leavingNodeInstance.AddEnteringTransitionInstance(transitionInstance);
                        transitionInstance.LeavingNodeInstance = leavingNodeInstance;
                    }
                }
                extensionList = kenelExtensions[transitionInstance.ExtensionTargetName];
                for (int j = 0; extensionList != null && j < extensionList.Count; j++)
                {
                    IKernelExtension extension = extensionList[j];
                    transitionInstance.registExtension(extension);
                }
                wfElementInstanceMap.Add(transitionInstance.Id, transitionInstance);
            }

            //循环线
            List <Loop> loops = workflowProcess.Loops;

            for (int i = 0; i < loops.Count; i++)
            {
                Loop         loop         = (Loop)loops[i];
                LoopInstance loopInstance = new LoopInstance(loop);

                String fromNodeId = loop.FromNode.Id;
                if (fromNodeId != null)
                {
                    INodeInstance enteringNodeInstance = (INodeInstance)wfElementInstanceMap[fromNodeId];
                    if (enteringNodeInstance != null)
                    {
                        enteringNodeInstance.AddLeavingLoopInstance(loopInstance);
                        loopInstance.EnteringNodeInstance = enteringNodeInstance;
                    }
                }

                String toNodeId = loop.ToNode.Id;
                if (toNodeId != null)
                {
                    INodeInstance leavingNodeInstance = (INodeInstance)wfElementInstanceMap[toNodeId];
                    if (leavingNodeInstance != null)
                    {
                        leavingNodeInstance.AddEnteringLoopInstance(loopInstance);
                        loopInstance.LeavingNodeInstance = leavingNodeInstance;
                    }
                }
                extensionList = kenelExtensions[loopInstance.ExtensionTargetName];
                for (int j = 0; extensionList != null && j < extensionList.Count; j++)
                {
                    IKernelExtension extension = extensionList[j];
                    loopInstance.registExtension(extension);
                }
                wfElementInstanceMap.Add(loopInstance.Id, loopInstance);
            }
        }
Esempio n. 6
0
 // TODO extesion是单态还是多实例?单态应该效率高一些。
 public override void registExtension(IKernelExtension extension)
 {
     // System.out.println("====extension class is
     // "+extension.getClass().Name);
     if (!Extension_Target_Name.Equals(extension.ExtentionTargetName))
     {
         throw new Exception("Error:When construct the StartNodeInstance,the Extension_Target_Name is mismatching");
     }
     if (Extension_Point_NodeInstanceEventListener.Equals(extension.ExtentionPointName))
     {
         if (extension is INodeInstanceEventListener)
         {
             this.EventListeners.Add((INodeInstanceEventListener)extension);
         }
         else
         {
             throw new Exception("Error:When construct the StartNodeInstance,the extension MUST be a instance of INodeInstanceEventListener");
         }
     }
 }
Esempio n. 7
0
 public virtual void registExtension(IKernelExtension extension)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
 /*
  * (non-Javadoc)
  *
  * @see org.fireflow.kenel.plugin.IPlugable#registExtension(org.fireflow.kenel.plugin.IKenelExtension)
  */
 public override void registExtension(IKernelExtension extension)
 {
     if (!Extension_Target_Name.Equals(extension.ExtentionTargetName))
     {
         throw new Exception("Error:When construct the EndNodeInstance,the Extension_Target_Name is mismatching");
     }
     if (Extension_Point_NodeInstanceEventListener.Equals(extension.ExtentionPointName))
     {
         if (extension is INodeInstanceEventListener)
         {
             this.EventListeners.Add((INodeInstanceEventListener)extension);
         }
         else
         {
             throw new Exception("Error:When construct the EndNodeInstance,the extension MUST be a instance of INodeInstanceEventListener");
         }
     }
 }
Esempio n. 9
0
 public void registExtension(IKernelExtension extension)
 {
     if (!Extension_Target_Name.Equals(extension.ExtentionTargetName))
     {
         return;
     }
     if (Extension_Point_TransitionInstanceEventListener.Equals(extension.ExtentionPointName))
     {
         if (extension is IEdgeInstanceEventListener)
         {
             this.eventListeners.Add((IEdgeInstanceEventListener)extension);
         }
         else
         {
             throw new Exception("Error:When construct the TransitionInstance,the extension MUST be a instance of ITransitionInstanceEventListener");
         }
     }
 }
Esempio n. 10
0
 public virtual void registExtension(IKernelExtension extension)
 {
     throw new NotImplementedException();
 }
Esempio n. 11
0
 public KernelExtensionLoaded(IKernelExtension kernelExtension, KernelCommand command) : base(command)
 {
     KernelExtension = kernelExtension;
 }