예제 #1
0
        public string Get()
        {
            string AuthorizedName;

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_publisher_assertions_get");

            sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID);
            sp.Parameters.Add("@authorizedName", SqlDbType.NVarChar, UDDI.Constants.Lengths.AuthorizedName, ParameterDirection.Output);

            sp.Parameters.SetString("@PUID", Context.User.ID);

            SqlDataReaderAccessor reader = sp.ExecuteReader();

            try
            {
                while (reader.Read())
                {
                    Add(
                        reader.GetGuidString("fromKey"),
                        reader.GetGuidString("toKey"),
                        reader.GetGuidString("keyName"),
                        reader.GetGuidString("keyValue"),
                        reader.GetKeyFromGuid("tModelKey"));
                }
            }
            finally
            {
                reader.Close();
            }
            AuthorizedName = sp.Parameters.GetString("@authorizedName");
            return(AuthorizedName);
        }
예제 #2
0
        static ArrayList GetBusinessEntities()
        {
            ArrayList businessKeyList = new ArrayList();

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();

            sp.ProcedureName = "net_find_businessKeysWithDiscoveryURLs";

            SqlDataReaderAccessor reader = sp.ExecuteReader();

            ArrayList businessEntities = new ArrayList();

            try
            {
                while (reader.Read())
                {
                    BusinessEntity businessEntity = new BusinessEntity(reader.GetGuidString(0));
                    businessEntities.Add(businessEntity);
                }
            }
            finally
            {
                reader.Close();
            }

            return(businessEntities);
        }
예제 #3
0
        public void GetForCurrentPublisher()
        {
            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_publisher_businessInfos_get");

            sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID);
            sp.Parameters.SetString("@PUID", Context.User.ID);

            SqlDataReaderAccessor reader = sp.ExecuteReader();

            try
            {
                while (reader.Read())
                {
                    Add(reader.GetGuidString("businessKey"));
                }
            }
            finally
            {
                reader.Close();
            }

            foreach (BusinessInfo businessInfo in this)
            {
                businessInfo.Get(true);
            }
        }
예제 #4
0
 public void Read(SqlDataReaderAccessor reader)
 {
     //
     // Get the keys of the services for this business ID
     //
     while (reader.Read())
     {
         Add(reader.GetGuidString(0));
     }
 }
예제 #5
0
        public void Get()
        {
            Debug.Enter();

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();

            sp.ProcedureName = "UI_getPublisher";

            sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID);
            sp.Parameters.SetString("@PUID", Puid);

            SqlDataReaderAccessor reader = sp.ExecuteReader();

            Exists = false;

            try
            {
                if (reader.Read())
                {
                    int flag;

                    IsoLangCode   = reader.GetString(1);
                    Name          = reader.GetString(2);
                    Email         = reader.GetString(3);
                    Phone         = reader.GetString(4);
                    CompanyName   = reader.GetString(5);
                    AltPhone      = reader.GetString(6);
                    AddressLine1  = reader.GetString(7);
                    AddressLine2  = reader.GetString(8);
                    City          = reader.GetString(9);
                    StateProvince = reader.GetString(10);
                    PostalCode    = reader.GetString(11);
                    Country       = reader.GetString(12);
                    flag          = reader.GetInt(13);
                    SecurityToken = reader.GetGuidString(14);

                    TrackPassport = (0x00 == (flag & 0x02));
                    Validated     = (0x01 == (flag & 0x01));

                    Exists = true;
                }
            }
            finally
            {
                reader.Close();
            }

            Debug.Leave();
        }
예제 #6
0
        public void Get(bool activeOperatorsOnly)
        {
            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();

            sp.ProcedureName = "net_operators_get";

            SqlDataReaderAccessor reader = sp.ExecuteReader();

            try
            {
                this.Clear();

                while (reader.Read())
                {
                    OperatorStatus operatorStatus = (OperatorStatus)reader.GetShort("operatorStatusID");
                    string         name           = reader.GetString("name");

                    if (!activeOperatorsOnly ||
                        OperatorStatus.New == operatorStatus ||
                        OperatorStatus.Normal == operatorStatus)
                    {
                        this.Add(
                            reader.GetGuidString("operatorKey"),
                            operatorStatus,
                            name,
                            reader.GetString("soapReplicationURL"));
                    }
                    else
                    {
                        Debug.Write(
                            SeverityType.Info,
                            CategoryType.Replication,
                            String.Format(
                                "Removing operator '{0}' with status '{1}' from list of replication operators",
                                name,
                                operatorStatus.ToString()));
                    }
                }
            }
            finally
            {
                reader.Close();
            }
        }
예제 #7
0
        private void CheckCertificate(SoapMessage message)
        {
            HttpClientCertificate httpCert    = HttpContext.Current.Request.ClientCertificate;
            X509Certificate       requestCert = new X509Certificate(httpCert.Certificate);

            Debug.Verify(!Utility.StringEmpty(httpCert.Issuer), "UDDI_ERROR_FATALERROR_CLIENTCERTREQUIRED");
            Debug.Verify(!Utility.StringEmpty(httpCert.Subject), "UDDI_ERROR_FATALERROR_CLIENTCERTREQUIRED");

            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_operatorCert_get");

            sp.Parameters.Add("@certSerialNo", SqlDbType.NVarChar, UDDI.Constants.Lengths.CertSerialNo);

            sp.Parameters.SetString("@certSerialNo", requestCert.GetSerialNumberString());

            SqlDataReaderAccessor reader = sp.ExecuteReader();

            try
            {
                if (reader.Read())
                {
                    Context.RemoteOperator = reader.GetGuidString("operatorKey");

                    byte[] operatorCertRaw = reader.GetBinary("certificate");
                    byte[] requestCertRaw  = httpCert.Certificate;

                    Debug.Verify(
                        null != operatorCertRaw,
                        "UDDI_ERROR_FATALERROR_CLIENTCERTNOTSTORED",
                        ErrorType.E_fatalError,
                        Context.RemoteOperator);

                    if (operatorCertRaw.Length != requestCertRaw.Length)
                    {
                        throw new UDDIException(
                                  ErrorType.E_unknownUser,
                                  "UDDI_ERROR_UNKNOWNUSER_UNKOWNCERT");
                    }

                    for (int i = 0; i < operatorCertRaw.Length; i++)
                    {
                        if (operatorCertRaw[i] != requestCertRaw[i])
                        {
                            throw new UDDIException(
                                      ErrorType.E_unknownUser,
                                      "UDDI_ERROR_UNKNOWNUSER_UNKOWNCERT");
                        }
                    }

                    /*
                     * TODO: Check to see if this works instead
                     *
                     *
                     * X509Certificate operatorCert = new X509Certificate( operatorCertRaw );
                     * X509Certificate requestCert = new X509Certificate( requestCertRaw );
                     *
                     * if( !requestCert.Equals( operatorCert ) )
                     * {
                     *      throw new UDDIException(
                     *              ErrorType.E_unknownUser,
                     *              "Unknown certificate" );
                     * }
                     */
                }
                else
                {
                    throw new UDDIException(
                              ErrorType.E_unknownUser,
                              "UDDI_ERROR_UNKNOWNUSER_UNKOWNCERT");
                }
            }
            finally
            {
                reader.Close();
            }
        }
예제 #8
0
        /// ****************************************************************
        ///   public Get
        /// ----------------------------------------------------------------
        ///   <summary>
        ///   </summary>
        /// ****************************************************************
        ///
        public ChangeRecordDetail Get()
        {
            Debug.VerifySetting("OperatorKey");

            ChangeRecordDetail detail = new ChangeRecordDetail();

            try
            {
                //
                // Get the list of known operators.
                //
                StringCollection operators = new StringCollection();

                SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();

                sp.ProcedureName = "net_operators_get";
                SqlDataReaderAccessor reader = sp.ExecuteReader();

                try
                {
                    while (reader.Read())
                    {
                        operators.Add(reader.GetGuidString("operatorKey"));
                    }
                }
                finally
                {
                    reader.Close();
                }

                //
                // Set the search criteria for change records.
                //
                foreach (string operatorKey in operators)
                {
                    long startUSN;
                    long stopUSN;

                    startUSN = 0;
                    foreach (ChangeRecordVector mark in ChangesAlreadySeen)
                    {
                        if (0 == String.Compare(operatorKey, mark.NodeID, true))
                        {
                            startUSN = mark.OriginatingUSN + 1;
                            break;
                        }
                    }

                    stopUSN = System.Int64.MaxValue;
                    foreach (ChangeRecordVector mark in ResponseLimitVector)
                    {
                        if (0 == String.Compare(operatorKey, mark.NodeID, true))
                        {
                            stopUSN = mark.OriginatingUSN;
                            break;
                        }
                    }

                    FindChangeRecords.SetRange(operatorKey, startUSN, stopUSN);
                }

                //
                // Retrieve the change records.
                //
                int limit = Config.GetInt("Replication.ResponseLimitCountDefault");

                if (ResponseLimitCount >= 0 && ResponseLimitCount <= limit)
                {
                    limit = ResponseLimitCount;
                }

                reader = FindChangeRecords.RetrieveResults(limit);

                try
                {
                    while (reader.Read())
                    {
                        XmlSerializer serializer = null;

                        switch ((ChangeRecordPayloadType)reader.GetShort("changeTypeID"))
                        {
                        case ChangeRecordPayloadType.ChangeRecordNull:
                            serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordNull));
                            break;

                        case ChangeRecordPayloadType.ChangeRecordNewData:
                            serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordNewData));
                            break;

                        case ChangeRecordPayloadType.ChangeRecordDelete:
                            serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordDelete));
                            break;

                        case ChangeRecordPayloadType.ChangeRecordPublisherAssertion:
                            serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordPublisherAssertion));
                            break;

                        case ChangeRecordPayloadType.ChangeRecordHide:
                            serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordHide));
                            break;

                        case ChangeRecordPayloadType.ChangeRecordDeleteAssertion:
                            serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordDeleteAssertion));
                            break;

                        case ChangeRecordPayloadType.ChangeRecordAcknowledgement:
                            serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordAcknowledgement));
                            break;

                        case ChangeRecordPayloadType.ChangeRecordCorrection:
                            serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordCorrection));
                            break;
                        }

                        StringReader stringReader = new StringReader(reader.GetString("changeData"));

                        try
                        {
                            ChangeRecord changeRecord = new ChangeRecord();

                            changeRecord.AcknowledgementRequested = (reader.GetInt("flag") & (int)ChangeRecordFlags.AcknowledgementRequested) > 0;
                            changeRecord.ChangeID.NodeID          = reader.GetString("OperatorKey");
                            changeRecord.ChangeID.OriginatingUSN  = reader.GetLong("USN");

                            ChangeRecordBase changeRecordBase = ( ChangeRecordBase )serializer.Deserialize(stringReader);
                            if (changeRecordBase is ChangeRecordCorrection)
                            {
                                //
                                // The query to find change records will do correction 'fixups'.  That is, the changeData of this
                                // change record will be replaced with the changeData from the correction.  The problem with this is
                                // that the original change data will now look like a correction.  To distinguish these types of
                                // change records, we look to see if the OriginatingUSN's match.  If the OriginatingUSN's match,
                                // we want they payload of the change record in this correction.  This payload will contain the
                                // corrected data that we want.
                                //
                                ChangeRecordCorrection changeRecordCorrection = ( ChangeRecordCorrection )changeRecordBase;
                                if (changeRecordCorrection.ChangeRecord.ChangeID.OriginatingUSN == changeRecord.ChangeID.OriginatingUSN)
                                {
                                    changeRecordBase = changeRecordCorrection.ChangeRecord.Payload;
                                }
                            }

                            changeRecord.Payload = changeRecordBase;

                            detail.ChangeRecords.Add(changeRecord);
                        }
                        finally
                        {
                            stringReader.Close();
                        }
                    }
                }
                finally
                {
                    reader.Close();
                }
            }
            catch (Exception e)
            {
                Debug.OperatorMessage(
                    SeverityType.Error,
                    CategoryType.Replication,
                    OperatorMessageType.None,
                    "Could not retrieve change records:\r\n" + e.ToString());

                FindChangeRecords.CleanUp();
                throw;
            }

            return(detail);
        }
예제 #9
0
        public void Get(CompletionStatusType completionStatus)
        {
            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_publisher_assertionStatus_get");

            sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID);
            sp.Parameters.SetString("@PUID", Context.User.ID);

            if (CompletionStatusType.Uninitialized != completionStatus)
            {
                //
                // If the completion status was not specified get all
                // of the assertions by not specifying a completionStatus value
                // in the stored procedure.
                //
                sp.Parameters.Add("@completionStatus", SqlDbType.Int);
                sp.Parameters.SetInt("@completionStatus", (int)completionStatus);
            }

            SqlDataReaderAccessor reader = sp.ExecuteReader();

            try
            {
                while (reader.Read())
                {
                    KeyedReference keyedReference = new KeyedReference(
                        reader.GetString("keyName"),
                        reader.GetString("keyValue"),
                        reader.GetKeyFromGuid("tModelKey"));

                    CompletionStatusType status =
                        (CompletionStatusType)reader.GetInt("flag");

                    string fromKey = reader.GetGuidString("fromKey");
                    string toKey   = reader.GetGuidString("toKey");

                    int ownerFlag = reader.GetInt("ownerFlag");

                    KeysOwned keysOwned = new KeysOwned();

                    if (0x02 == (ownerFlag & 0x02))
                    {
                        keysOwned.FromKey = fromKey;
                    }

                    if (0x01 == (ownerFlag & 0x01))
                    {
                        keysOwned.ToKey = toKey;
                    }

                    this.Add(
                        new AssertionStatusItem(
                            status,
                            fromKey,
                            toKey,
                            keyedReference,
                            keysOwned));
                }
            }
            finally
            {
                reader.Close();
            }
        }