コード例 #1
0
ファイル: ServiceAlias.cs プロジェクト: radtek/Oracle.Utils
        /// <remarks/>
        public virtual void initFromNVPair(NVPair nvpair)
        {
            if (nvpair.ListSize != 1)
            {
                throw new TnsException();
            }
            NVPair nvpair1 = nvpair.getListElement(0);

            if (nvpair1.Name.ToUpper().Equals("DESCRIPTION_LIST".ToUpper()))
            {
                child = f.create(3);
            }
            else if (nvpair1.Name.ToUpper().Equals("DESCRIPTION".ToUpper()))
            {
                child = f.create(2);
            }
            else if (nvpair1.Name.ToUpper().Equals("ADDRESS_LIST".ToUpper()))
            {
                child = f.create(1);
            }
            else if (nvpair1.Name.ToUpper().Equals("ADDRESS".ToUpper()))
            {
                child = f.create(0);
            }
            else
            {
                throw new TnsException();
            }
            child.initFromNVPair(nvpair1);
            name = nvpair.Name;
        }
コード例 #2
0
        /// <remarks/>
        public virtual void initFromNVPair(NVPair nvpair)
        {
            init();
            int i = nvpair.ListSize;

            if (i == 0)
            {
                throw new Exception();
            }
            for (int j = 0; j < i; j++)
            {
                childnv = nvpair.getListElement(j);
                if (childnv.Name.ToUpper().Equals("SOURCE_ROUTE".ToUpper()))
                {
                    sourceRoute = childnv.Atom.ToUpper().Equals("yes".ToUpper()) || childnv.Atom.ToUpper().Equals("on".ToUpper()) ||
                                  childnv.Atom.ToUpper().Equals("true".ToUpper());
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("LOAD_BALANCE".ToUpper()))
                {
                    loadBalance = childnv.Atom.ToUpper().Equals("yes".ToUpper()) || childnv.Atom.ToUpper().Equals("on".ToUpper()) ||
                                  childnv.Atom.ToUpper().Equals("true".ToUpper());
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("FAILOVER".ToUpper()))
                {
                    failover = childnv.Atom.ToUpper().Equals("yes".ToUpper()) || childnv.Atom.ToUpper().Equals("on".ToUpper()) ||
                               childnv.Atom.ToUpper().Equals("true".ToUpper());
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("ADDRESS".ToUpper()))
                {
                    child = f.create(0);
                    child.initFromNVPair(childnv);
                    children.Add(child);
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("ADDRESS_LIST".ToUpper()))
                {
                    child = f.create(1);
                    child.initFromNVPair(childnv);
                    children.Add(child);
                }
                else
                {
                    throw new Exception();
                }
            }

            if (children.Count == 0)
            {
                throw new Exception();
            }
            else
            {
                return;
            }
        }
コード例 #3
0
        /// <remarks/>
        public virtual NVPair findNVPair(NVPair nvpair, String s)
        {
            if (nvpair == null || nvpair.RHSType != NVPair.RHS_LIST)
            {
                return(null);
            }
            for (int i = 0; i < nvpair.ListSize; i++)
            {
                NVPair nvpair1 = nvpair.getListElement(i);
                if (s.ToUpper().Equals(nvpair1.Name.ToUpper()))
                {
                    return(nvpair1);
                }
            }

            return(null);
        }
コード例 #4
0
 /// <remarks/>
 public virtual NVPair findNVPairRecurse(NVPair nvpair, String s)
 {
     if (nvpair == null || s.ToUpper().Equals(nvpair.Name.ToUpper()))
     {
         return(nvpair);
     }
     if (nvpair.RHSType == NVPair.RHS_ATOM)
     {
         return(null);
     }
     for (int i = 0; i < nvpair.ListSize; i++)
     {
         NVPair nvpair1 = findNVPairRecurse(nvpair.getListElement(i), s);
         if (nvpair1 != null)
         {
             return(nvpair1);
         }
     }
     return(null);
 }
コード例 #5
0
        /// <remarks/>
        public virtual void initFromNVPair(NVPair nvpair)
        {
            init();
            int i = nvpair.ListSize;

            if (i == 0)
            {
                throw new TnsException();
            }
            for (int j = 0; j < i; j++)
            {
                childnv = nvpair.getListElement(j);
                if (childnv.Name.ToUpper().Equals("SOURCE_ROUTE".ToUpper()))
                {
                    sourceRoute = childnv.Atom.ToUpper().Equals("yes".ToUpper()) || childnv.Atom.ToUpper().Equals("on".ToUpper()) ||
                                  childnv.Atom.ToUpper().Equals("true".ToUpper());
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("LOAD_BALANCE".ToUpper()))
                {
                    loadBalance = childnv.Atom.ToUpper().Equals("yes".ToUpper()) || childnv.Atom.ToUpper().Equals("on".ToUpper()) ||
                                  childnv.Atom.ToUpper().Equals("true".ToUpper());
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("FAILOVER".ToUpper()))
                {
                    failover = childnv.Atom.ToUpper().Equals("yes".ToUpper()) || childnv.Atom.ToUpper().Equals("on".ToUpper()) ||
                               childnv.Atom.ToUpper().Equals("true".ToUpper());
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("ENABLE".ToUpper()))
                {
                    keepAlive = childnv.Atom.ToUpper().Equals("broken".ToUpper());
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("PROTOCOL_STACK".ToUpper()))
                {
                    protocolStacks.Add(childnv.ToString());
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("ADDRESS".ToUpper()))
                {
                    child = f.create(0);
                    child.initFromNVPair(childnv);
                    children.Add(child);
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("ADDRESS_LIST".ToUpper()))
                {
                    child = f.create(1);
                    child.initFromNVPair(childnv);
                    children.Add(child);
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("SDU".ToUpper()))
                {
                    SDU = childnv.Atom;
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("TDU".ToUpper()))
                {
                    TDU = childnv.Atom;
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("SEND_BUF_SIZE".ToUpper()))
                {
                    sendBufSize = childnv.Atom;
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("RECV_BUF_SIZE".ToUpper()))
                {
                    receiveBufSize = childnv.Atom;
                    continue;
                }
                if (childnv.Name.ToUpper().Equals("CONNECT_DATA".ToUpper()))
                {
                    connectData = childnv.valueToString();
                    int k = childnv.ListSize;
                    if (k == 0)
                    {
                        throw new TnsException();
                    }
                    int i1 = 0;
                    do
                    {
                        if (i1 >= k)
                        {
                            continue;
                        }
                        NVPair nvpair1 = childnv.getListElement(i1);
                        if (nvpair1.Name.ToUpper().Equals("SID".ToUpper()))
                        {
                            SID = nvpair1.Atom;
                        }
                        else if (nvpair1.Name.ToUpper().Equals("SERVER".ToUpper()))
                        {
                            server = nvpair1.Atom;
                        }
                        else if (nvpair1.Name.ToUpper().Equals("SERVICE_NAME".ToUpper()))
                        {
                            serviceName = nvpair1.Atom;
                        }
                        else if (nvpair1.Name.ToUpper().Equals("INSTANCE_NAME".ToUpper()))
                        {
                            instanceName = nvpair1.Atom;
                        }
                        else if (nvpair1.Name.ToUpper().Equals("HANDLER_NAME".ToUpper()))
                        {
                            handlerName = nvpair1.Atom;
                        }
                        else if (nvpair1.Name.ToUpper().Equals("ORACLE_HOME".ToUpper()))
                        {
                            oracleHome = nvpair1.Atom;
                        }
                        else if (nvpair1.Name.ToUpper().Equals("FAILOVER_MODE".ToUpper()))
                        {
                            failoverMode = childnv.getListElement(i1).ToString();
                        }
                        else if (nvpair1.Name.ToUpper().Equals("INSTANCE_ROLE".ToUpper()))
                        {
                            instanceRole = nvpair1.Atom;
                        }
                        else
                        {
                            String s1 = nvpair1.ToString().Trim();
                            s1 = s1.Substring(1, (s1.Length - 1) - (1));
                            extraConnInfo.Add(s1);
                        }
                        i1++;
                    } while (true);
                }
                if (childnv.Name.ToUpper().Equals("SECURITY".ToUpper()))
                {
                    int l = childnv.ListSize;
                    if (l == 0)
                    {
                        throw new TnsException();
                    }
                    int j1 = 0;
                    do
                    {
                        if (j1 >= l)
                        {
                            continue;
                        }
                        NVPair nvpair2 = childnv.getListElement(j1);
                        if (nvpair2.Name.ToUpper().Equals("AUTHENTICATION".ToUpper()))
                        {
                            authTypes = nvpair2.ToString();
                        }
                        if (nvpair2.Name.ToUpper().Equals("ssl_server_cert_dn".ToUpper()))
                        {
                            sslServerCertDN = nvpair2.Atom;
                            if (sslServerCertDN != null && sslServerCertDN.StartsWith("\"") && sslServerCertDN.EndsWith("\""))
                            {
                                sslServerCertDN = sslServerCertDN.Substring(1, (sslServerCertDN.Length - 1) - (1));
                            }
                        }
                        else
                        {
                            authParams.Add(nvpair2.ToString());
                        }
                        j1++;
                    } while (true);
                }
                if (childnv.Name.ToUpper().Equals("HS".ToUpper()) && childnv.Atom == null)
                {
                    try
                    {
                        childnv.Atom = "OK";
                    }
                    catch
                    {
                    }
                }
                String s = childnv.ToString().Trim();
                s = s.Substring(1, (s.Length - 1) - (1));
                extraInfo.Add(s);
            }
        }