Exemplo n.º 1
0
        public virtual System.Collections.Generic.IList <Net.Vpc.Upa.Impl.Config.DefaultConfigFilterItem> GetDefaultConfigFilterItem(string url)
        {
            System.Collections.Generic.IList <Net.Vpc.Upa.Impl.Config.DefaultConfigFilterItem> found = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, System.Collections.Generic.IList <Net.Vpc.Upa.Impl.Config.DefaultConfigFilterItem> >(cache, url);
            if (found == null)
            {
                found = new System.Collections.Generic.List <Net.Vpc.Upa.Impl.Config.DefaultConfigFilterItem>();
                foreach (Net.Vpc.Upa.Impl.Config.DefaultConfigFilterItem defaultConfigFilterItem in items)
                {
                    if (defaultConfigFilterItem.GetLibFilter().Accept(url))
                    {
                        Net.Vpc.Upa.Impl.Util.Classpath.PatternListClassNameFilter p = defaultConfigFilterItem.GetTypeFilter();
                        if (p.GetUserPatterns().Length == 0)
                        {
                            found.Add(defaultConfigFilterItem);
                        }
                        else
                        {
                            foreach (string pattern in p.GetUserPatterns())
                            {
                                System.Text.StringBuilder prefix = new System.Text.StringBuilder();
                                char[] patternCharArray          = pattern.ToCharArray();
                                int    x         = 0;
                                bool   exitWhile = false;
                                while (!exitWhile && x < patternCharArray.Length)
                                {
                                    char c = patternCharArray[x];
                                    switch (c)
                                    {
                                    case '*':
                                    case '?':
                                    {
                                        if ((prefix).Length > 0 && prefix.ToString().EndsWith("."))
                                        {
                                        }
                                        else
                                        {
                                            while ((prefix).Length > 0 && !prefix.ToString().EndsWith("."))
                                            {
                                                prefix.Remove((prefix).Length - 1, 1);
                                            }
                                        }
                                        exitWhile = true;
                                        break;
                                    }

                                    default:
                                    {
                                        prefix.Append(patternCharArray[x]);
                                        break;
                                    }
                                    }
                                    x++;
                                }
                                if ((prefix).Length > 0)
                                {
                                    string rr = prefix.ToString().Replace('.', '/');
                                    Net.Vpc.Upa.Impl.Util.Classpath.ClassPathRoot cr = new Net.Vpc.Upa.Impl.Util.Classpath.ClassPathRoot(url);
                                    try {
                                        if (cr.Contains(rr))
                                        {
                                            found.Add(defaultConfigFilterItem);
                                            break;
                                        }
                                    } catch (System.Exception e) {
                                        log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter(null, e));
                                    }
                                }
                                else
                                {
                                    found.Add(defaultConfigFilterItem);
                                    break;
                                }
                            }
                        }
                    }
                }
                cache[url] = found;
            }
            return(found);
        }
Exemplo n.º 2
0
 public DefaultConfigFilterItem(Net.Vpc.Upa.Impl.Util.Classpath.PatternListLibNameFilter libFilter, Net.Vpc.Upa.Impl.Util.Classpath.PatternListClassNameFilter typeFilter)
 {
     this.typeFilter = typeFilter;
     this.libFilter  = libFilter;
 }