UriScheme
Inheritance: FanObj
Exemplo n.º 1
0
        public static UriScheme find(string scheme, bool check)
        {
            // check cache
            lock (m_cache)
            {
                UriScheme cached = (UriScheme)m_cache[scheme];
                if (cached != null)
                {
                    return(cached);
                }
            }

            try
            {
                // lookup scheme type (avoid building index for common types)
                Type t = null;
                if (scheme == "fan")
                {
                    t = Sys.FanSchemeType;
                }
                if (scheme == "file")
                {
                    t = Sys.FileSchemeType;
                }
                if (t == null)
                {
                    string qname = (string)Env.cur().index("sys.uriScheme." + scheme).first();
                    if (qname == null)
                    {
                        throw UnresolvedErr.make().val;
                    }
                    t = Type.find(qname);
                }

                // allocate instance
                UriScheme s = (UriScheme)t.make();
                s.m_scheme = scheme;

                // add to cache
                lock (m_cache)
                {
                    UriScheme cached = (UriScheme)m_cache[scheme];
                    if (cached != null)
                    {
                        return(cached);
                    }
                    m_cache[scheme] = s;
                }

                return(s);
            }
            catch (UnresolvedErr.Val) {}
            catch (System.Exception e) { Err.dumpStack(e); }

            if (!check)
            {
                return(null);
            }
            throw UnresolvedErr.make("Unknown scheme: " + scheme).val;
        }
Exemplo n.º 2
0
 public static void make_(UriScheme self)
 {
 }
Exemplo n.º 3
0
 public static void make_(UriScheme self)
 {
 }