Beispiel #1
0
        /// <summary>
        /// 依赖关系解析
        /// </summary>
        /// <param name="bundles"></param>
        /// <returns></returns>
        protected override bool ResolveDependent(IList <AbstractBundle> bundles)
        {
            // 构造解析树
            ResolverTree tree = ResolverTree.Parse(framework, this, bundles);

            // 如果构造失败,则清空集合,解析失败
            if (tree == null)
            {
                bundles.Clear();
                return(false);
            }
            // 获取有序的已解析的插件类表
            IList <AbstractBundle> newBundles = tree.QueryBundlesInOrder();

            if (newBundles == null || newBundles.Count == 0)
            {
                bundles.Clear();
                return(false);
            }
            // 清空当前集合列表
            bundles.Clear();
            BundleUtil.Combine(bundles, newBundles);

            return(true);
        }
Beispiel #2
0
 public ResolverNode(ResolverTree resolverAdmin, AbstractBundle bundle, ResolverNode depencyProviderBy)
 {
     this.resolverAdmin      = resolverAdmin;
     this.depencyProvidersBy = new ResolverNodeCollection();
     dependencies            = new ResolverNodeCollection();
     this.bundle             = bundle;
     this.depencyProvidersBy.Add(depencyProviderBy);
 }
Beispiel #3
0
        /// <summary>
        /// 根据插件列表创建解析管理器
        /// </summary>
        /// <param name="bundle"></param>
        /// <returns></returns>
        public static ResolverTree Parse(Framework framework, ResolverImpl resolver, IList <AbstractBundle> bundles)
        {
            Hashtable    cache = new Hashtable();
            ResolverTree admin = new ResolverTree(framework, resolver);

            foreach (AbstractBundle bundle in bundles)
            {
                if (!cache.Contains(bundle.ToString()))
                {
                    ResolverNode resolverBundle = admin.CreateResolverBundle(bundle);
                    if (resolverBundle != null)
                    {
                        //resolver.ResolveBundleStartPolicy(resolverBundle, ActivatorPolicy.Lazy);
                        admin.resolvers.Add(resolverBundle);
                        cache.Add(bundle.ToString(), bundle);
                    }
                }
            }
            return(admin);
        }