Пример #1
0
        /// <summary>creates an IOR for the object described by the Url url</summary>
        /// <param name="url">an url of the form IOR:--hex-- or iiop://addr/key</param>
        /// <param name="targetType">if the url contains no info about the target type, use this type</param>
        public Ior CreateIorForUrl(string url, string repositoryId)
        {
            Ior ior = null;

            if (IsIorString(url))
            {
                ior = new Ior(url);
            }
            else if (url.StartsWith("iiop"))
            {
                // iiop1.0, iiop1.1, iiop1.2 (=iiop); extract version in protocol tag
                IiopLoc iiopLoc = new IiopLoc(url, m_codec,
                                              m_defaultAdditionalTaggedComponents);
                // now create an IOR with the above information
                ior = new Ior(repositoryId, iiopLoc.GetProfiles());
            }
            else if (url.StartsWith("corbaloc"))
            {
                Corbaloc loc = new Corbaloc(url, m_codec,
                                            m_defaultAdditionalTaggedComponents);
                IorProfile[] profiles = loc.GetProfiles();
                ior = new Ior(repositoryId, profiles);
            }
            else
            {
                throw new INV_OBJREF(1963, CompletionStatus.Completed_MayBe);
            }
            return(ior);
        }
Пример #2
0
        public void TestIiopSslLoc()
        {
            string  testIiopLoc = "iiop-ssl://elca.ch:1234/test";
            IiopLoc parsed      = new IiopLoc(testIiopLoc, m_codec,
                                              new object[] { m_defaultCodeSetTaggedComponent });

            Assert.AreEqual("test", parsed.ObjectUri);
            Assert.AreEqual(1, parsed.GetProfiles().Length);
            Assert.AreEqual(typeof(InternetIiopProfile), parsed.GetProfiles()[0].GetType());
            InternetIiopProfile prof = (InternetIiopProfile)(parsed.GetProfiles()[0]);

            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(2, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(0, prof.Port);

            testIiopLoc = "iiop-ssl1.1://elca.ch:1234/test";
            parsed      = new IiopLoc(testIiopLoc, m_codec,
                                      new object[] { m_defaultCodeSetTaggedComponent });
            Assert.AreEqual("test", parsed.ObjectUri);
            Assert.AreEqual(1, parsed.GetProfiles().Length);
            Assert.AreEqual(typeof(InternetIiopProfile), parsed.GetProfiles()[0].GetType());
            prof = (InternetIiopProfile)(parsed.GetProfiles()[0]);
            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(1, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(0, prof.Port);
            Assert.IsTrue(prof.TaggedComponents.ContainsTaggedComponent(
                              CodeSetService.SERVICE_ID));
            Assert.IsTrue(prof.TaggedComponents.ContainsTaggedComponent(
                              TAG_SSL_SEC_TRANS.ConstVal));
        }
Пример #3
0
        public void TestParseUrlSsl()
        {
            string  testIiopLoc = "iiop-ssl://elca.ch:1234/test";
            IiopLoc parsed      = new IiopLoc(testIiopLoc, m_codec,
                                              new object[] { m_defaultCodeSetTaggedComponent });
            string      objectUri;
            GiopVersion version;
            Uri         channelUri = parsed.ParseUrl(out objectUri, out version);

            Assert.AreEqual("test", objectUri, "object uri");
            Assert.AreEqual(1, version.Major, "version major");
            Assert.AreEqual(2, version.Minor, "version minor");
            Assert.AreEqual("iiop-ssl1.2://elca.ch:1234/",
                            channelUri.AbsoluteUri, "channel uri");
        }
Пример #4
0
        /// <summary>
        /// This method parses an url for the IIOP channel.
        /// It extracts the channel URI and the objectURI
        /// </summary>
        /// <param name="url">the url to parse</param>
        /// <param name="objectURI">the objectURI</param>
        /// <returns>the channel-Uri</returns>
        internal Uri ParseUrl(string url, out string objectUri,
                              out GiopVersion version)
        {
            Uri uri = null;

            if (url.StartsWith("iiop"))
            {
                IiopLoc iiopLoc = new IiopLoc(url, m_codec,
                                              m_defaultAdditionalTaggedComponents);
                uri = iiopLoc.ParseUrl(out objectUri, out version);
            }
            else if (url.StartsWith("IOR"))
            {
                Ior ior = new Ior(url);
                IInternetIiopProfile profile = ior.FindInternetIiopProfile();
                if (profile != null)
                {
                    uri = new Uri("iiop" + profile.Version.Major + "." + profile.Version.Minor +
                                  Uri.SchemeDelimiter + profile.HostName + ":" + profile.Port);
                    objectUri = IorUtil.GetObjectUriForObjectKey(profile.ObjectKey);
                    version   = profile.Version;
                }
                else
                {
                    uri       = null;
                    objectUri = null;
                    version   = new GiopVersion(1, 0);
                }
            }
            else if (url.StartsWith("corbaloc"))
            {
                Corbaloc loc = new Corbaloc(url, m_codec,
                                            m_defaultAdditionalTaggedComponents);
                uri = loc.ParseUrl(out objectUri, out version);
            }
            else
            {
                // not possible
                uri       = null;
                objectUri = null;
                version   = new GiopVersion(1, 0);
            }
            return(uri);
        }