< Summary

Information
Class: Ice.Internal.ReferenceFactory
Assembly: Ice
File(s): /_/csharp/src/Ice/Internal/ReferenceFactory.cs
Tag: 91_21789722663
Line coverage
83%
Covered lines: 280
Uncovered lines: 56
Coverable lines: 336
Total lines: 778
Line coverage: 83.3%
Branch coverage
74%
Covered branches: 147
Total branches: 197
Branch coverage: 74.6%
Method coverage
100%
Covered methods: 12
Total methods: 12
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
create(...)25%4.01490.91%
create(...)25%4.01490.91%
create(...)50%6.01692.86%
copy(...)25%4.25475%
create(...)80.31%289.3212778.41%
create(...)55.56%20.31880.77%
setDefaultRouter(...)75%4.07483.33%
getDefaultRouter()100%11100%
setDefaultLocator(...)75%4.07483.33%
getDefaultLocator()100%11100%
.ctor(...)100%11100%
create(...)88.46%26.532690.79%

File(s)

/_/csharp/src/Ice/Internal/ReferenceFactory.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Diagnostics;
 4using System.Text;
 5
 6namespace Ice.Internal;
 7
 8internal class ReferenceFactory
 9{
 10    internal Reference
 11    create(Ice.Identity ident, string facet, Reference tmpl, EndpointI[] endpoints)
 12    {
 113        if (ident.name.Length == 0 && ident.category.Length == 0)
 14        {
 015            return null;
 16        }
 17
 118        return create(
 119            ident,
 120            facet,
 121            tmpl.getMode(),
 122            tmpl.getProtocol(),
 123            tmpl.getEncoding(),
 124            endpoints,
 125            null,
 126            null);
 27    }
 28
 29    internal Reference
 30    create(Ice.Identity ident, string facet, Reference tmpl, string adapterId)
 31    {
 132        if (ident.name.Length == 0 && ident.category.Length == 0)
 33        {
 034            return null;
 35        }
 36
 37        //
 38        // Create new reference
 39        //
 140        return create(
 141            ident,
 142            facet,
 143            tmpl.getMode(),
 144            tmpl.getProtocol(),
 145            tmpl.getEncoding(),
 146            null,
 147            adapterId,
 148            null);
 49    }
 50
 51    internal Reference create(Ice.Identity ident, Ice.ConnectionI connection)
 52    {
 153        if (ident.name.Length == 0 && ident.category.Length == 0)
 54        {
 055            return null;
 56        }
 57
 58        //
 59        // Create new reference
 60        //
 161        return new FixedReference(
 162            _instance,
 163            _communicator,
 164            ident,
 165            "", // Facet
 166            connection.endpoint().datagram() ? Reference.Mode.ModeDatagram : Reference.Mode.ModeTwoway,
 167            compress: null,
 168            Protocol.Protocol_1_0,
 169            _instance.defaultsAndOverrides().defaultEncoding,
 170            connection,
 171            TimeSpan.FromMilliseconds(-1),
 172            null);
 73    }
 74
 75    internal Reference copy(Reference r)
 76    {
 177        Ice.Identity ident = r.getIdentity();
 178        if (ident.name.Length == 0 && ident.category.Length == 0)
 79        {
 080            return null;
 81        }
 182        return r.Clone();
 83    }
 84
 85    internal Reference create(string s, string propertyPrefix)
 86    {
 187        if (s.Length == 0)
 88        {
 189            return null;
 90        }
 91
 92        const string delim = " \t\n\r";
 93
 94        int beg;
 195        int end = 0;
 96
 197        beg = Ice.UtilInternal.StringUtil.findFirstNotOf(s, delim, end);
 198        if (beg == -1)
 99        {
 0100            throw new ParseException($"no non-whitespace characters found in proxy string '{s}'");
 101        }
 102
 1103        end = Ice.UtilInternal.StringUtil.checkQuote(s, beg);
 104
 105        //
 106        // Extract the identity, which may be enclosed in single
 107        // or double quotation marks.
 108        //
 109        string idstr;
 1110        if (end == -1)
 111        {
 1112            throw new ParseException($"mismatched quotes around identity in proxy string '{s}'");
 113        }
 1114        else if (end == 0)
 115        {
 1116            end = Ice.UtilInternal.StringUtil.findFirstOf(s, delim + ":@", beg);
 1117            if (end == -1)
 118            {
 1119                end = s.Length;
 120            }
 1121            idstr = s[beg..end];
 122        }
 123        else
 124        {
 1125            beg++; // Skip leading quote
 1126            idstr = s[beg..end];
 1127            end++; // Skip trailing quote
 128        }
 129
 1130        if (beg == end)
 131        {
 0132            throw new ParseException($"no identity in proxy string '{s}'");
 133        }
 134
 135        //
 136        // Parsing the identity may raise ParseException.
 137        //
 1138        Ice.Identity ident = Ice.Util.stringToIdentity(idstr);
 139
 1140        if (ident.name.Length == 0)
 141        {
 142            //
 143            // An identity with an empty name and a non-empty
 144            // category is illegal.
 145            //
 1146            if (ident.category.Length > 0)
 147            {
 0148                throw new ParseException("The category of a null Ice object identity must be empty.");
 149            }
 150            //
 151            // Treat a stringified proxy containing two double
 152            // quotes ("") the same as an empty string, i.e.,
 153            // a null proxy, but only if nothing follows the
 154            // quotes.
 155            //
 1156            else if (Ice.UtilInternal.StringUtil.findFirstNotOf(s, delim, end) != -1)
 157            {
 1158                throw new ParseException($"invalid characters after identity in proxy string '{s}'");
 159            }
 160            else
 161            {
 1162                return null;
 163            }
 164        }
 165
 1166        string facet = "";
 1167        Reference.Mode mode = Reference.Mode.ModeTwoway;
 1168        Ice.EncodingVersion encoding = _instance.defaultsAndOverrides().defaultEncoding;
 1169        Ice.ProtocolVersion protocol = Protocol.Protocol_1_0;
 170        while (true)
 171        {
 1172            beg = Ice.UtilInternal.StringUtil.findFirstNotOf(s, delim, end);
 1173            if (beg == -1)
 174            {
 175                break;
 176            }
 177
 1178            if (s[beg] == ':' || s[beg] == '@')
 179            {
 180                break;
 181            }
 182
 1183            end = Ice.UtilInternal.StringUtil.findFirstOf(s, delim + ":@", beg);
 1184            if (end == -1)
 185            {
 1186                end = s.Length;
 187            }
 188
 1189            if (beg == end)
 190            {
 191                break;
 192            }
 193
 1194            string option = s[beg..end];
 1195            if (option.Length != 2 || option[0] != '-')
 196            {
 1197                throw new ParseException($"expected a proxy option but found '{option}' in proxy string '{s}'");
 198            }
 199
 200            //
 201            // Check for the presence of an option argument. The
 202            // argument may be enclosed in single or double
 203            // quotation marks.
 204            //
 1205            string argument = null;
 1206            int argumentBeg = Ice.UtilInternal.StringUtil.findFirstNotOf(s, delim, end);
 1207            if (argumentBeg != -1)
 208            {
 1209                char ch = s[argumentBeg];
 1210                if (ch != '@' && ch != ':' && ch != '-')
 211                {
 1212                    beg = argumentBeg;
 1213                    end = Ice.UtilInternal.StringUtil.checkQuote(s, beg);
 1214                    if (end == -1)
 215                    {
 1216                        throw new ParseException(
 1217                            $"mismatched quotes around value for {option} option in proxy string '{s}'");
 218                    }
 1219                    else if (end == 0)
 220                    {
 1221                        end = Ice.UtilInternal.StringUtil.findFirstOf(s, delim + ":@", beg);
 1222                        if (end == -1)
 223                        {
 1224                            end = s.Length;
 225                        }
 1226                        argument = s[beg..end];
 227                    }
 228                    else
 229                    {
 1230                        beg++; // Skip leading quote
 1231                        argument = s[beg..end];
 1232                        end++; // Skip trailing quote
 233                    }
 234                }
 235            }
 236
 237            //
 238            // If any new options are added here,
 239            // Ice.Internal::Reference::toString() and its derived classes must be updated as well.
 240            //
 1241            switch (option[1])
 242            {
 243                case 'f':
 244                {
 1245                    if (argument == null)
 246                    {
 0247                        throw new ParseException($"no argument provided for -f option in proxy string '{s}'");
 248                    }
 249
 250                    try
 251                    {
 1252                        facet = Ice.UtilInternal.StringUtil.unescapeString(argument, 0, argument.Length, "");
 1253                    }
 0254                    catch (ArgumentException argEx)
 255                    {
 0256                        throw new ParseException($"invalid facet in proxy string '{s}'", argEx);
 257                    }
 258                    break;
 259                }
 260
 261                case 't':
 262                {
 1263                    if (argument != null)
 264                    {
 0265                        throw new ParseException(
 0266                            $"unexpected argument '{argument}' provided for -t option in proxy string '{s}'");
 267                    }
 1268                    mode = Reference.Mode.ModeTwoway;
 1269                    break;
 270                }
 271
 272                case 'o':
 273                {
 1274                    if (argument != null)
 275                    {
 0276                        throw new ParseException(
 0277                            $"unexpected argument '{argument}' provided for -o option in proxy string '{s}'");
 278                    }
 1279                    mode = Reference.Mode.ModeOneway;
 1280                    break;
 281                }
 282
 283                case 'O':
 284                {
 1285                    if (argument != null)
 286                    {
 0287                        throw new ParseException(
 0288                            $"unexpected argument '{argument}' provided for -O option in proxy string '{s}'");
 289                    }
 1290                    mode = Reference.Mode.ModeBatchOneway;
 1291                    break;
 292                }
 293
 294                case 'd':
 295                {
 1296                    if (argument != null)
 297                    {
 0298                        throw new ParseException(
 0299                            $"unexpected argument '{argument}' provided for -d option in proxy string '{s}'");
 300                    }
 1301                    mode = Reference.Mode.ModeDatagram;
 1302                    break;
 303                }
 304
 305                case 'D':
 306                {
 1307                    if (argument != null)
 308                    {
 0309                        throw new ParseException(
 0310                            $"unexpected argument '{argument}' provided for -D option in proxy string '{s}'");
 311                    }
 1312                    mode = Reference.Mode.ModeBatchDatagram;
 1313                    break;
 314                }
 315
 316                case 's':
 317                {
 1318                    if (argument != null)
 319                    {
 0320                        throw new ParseException(
 0321                            $"unexpected argument '{argument}' provided for -s option in proxy string '{s}'");
 322                    }
 323                    // Ignored. Only kept for backwards compatibility.
 324                    break;
 325                }
 326
 327                case 'e':
 328                {
 1329                    if (argument == null)
 330                    {
 0331                        throw new ParseException($"no argument provided for -e option in proxy string '{s}'");
 332                    }
 333
 334                    try
 335                    {
 1336                        encoding = Protocol.stringToEncodingVersion(argument);
 1337                    }
 0338                    catch (ParseException e)
 339                    {
 0340                        throw new ParseException($"invalid encoding version '{argument}' in proxy string '{s}'", e);
 341                    }
 342                    break;
 343                }
 344
 345                case 'p':
 346                {
 1347                    if (argument == null)
 348                    {
 0349                        throw new ParseException($"no argument provided for -p option in proxy string '{s}'");
 350                    }
 351
 352                    try
 353                    {
 1354                        protocol = Protocol.stringToProtocolVersion(argument);
 1355                    }
 0356                    catch (ParseException e)
 357                    {
 0358                        throw new ParseException($"invalid protocol version '{argument}' in proxy string '{s}'", e);
 359                    }
 360                    break;
 361                }
 362
 363                default:
 364                {
 0365                    throw new ParseException($"unknown option '{option}' in proxy string '{s}'");
 366                }
 367            }
 368        }
 369
 1370        if (beg == -1)
 371        {
 1372            return create(ident, facet, mode, protocol, encoding, null, null, propertyPrefix);
 373        }
 374
 1375        var endpoints = new List<EndpointI>();
 376
 1377        if (s[beg] == ':')
 378        {
 1379            var unknownEndpoints = new List<string>();
 1380            end = beg;
 381
 1382            while (end < s.Length && s[end] == ':')
 383            {
 1384                beg = end + 1;
 385
 1386                end = beg;
 1387                while (true)
 388                {
 1389                    end = s.IndexOf(':', end);
 1390                    if (end == -1)
 391                    {
 1392                        end = s.Length;
 1393                        break;
 394                    }
 395                    else
 396                    {
 1397                        bool quoted = false;
 1398                        int quote = beg;
 1399                        while (true)
 400                        {
 1401                            quote = s.IndexOf('\"', quote);
 1402                            if (quote == -1 || end < quote)
 403                            {
 404                                break;
 405                            }
 406                            else
 407                            {
 1408                                quote = s.IndexOf('\"', ++quote);
 1409                                if (quote == -1)
 410                                {
 411                                    break;
 412                                }
 1413                                else if (end < quote)
 414                                {
 1415                                    quoted = true;
 1416                                    break;
 417                                }
 1418                                ++quote;
 419                            }
 420                        }
 1421                        if (!quoted)
 422                        {
 423                            break;
 424                        }
 1425                        ++end;
 426                    }
 427                }
 428
 1429                string es = s[beg..end];
 1430                EndpointI endp = _instance.endpointFactoryManager().create(es, false);
 1431                if (endp != null)
 432                {
 1433                    endpoints.Add(endp);
 434                }
 435                else
 436                {
 1437                    unknownEndpoints.Add(es);
 438                }
 439            }
 1440            if (endpoints.Count == 0)
 441            {
 442                Debug.Assert(unknownEndpoints.Count > 0);
 1443                throw new ParseException($"invalid endpoint '{unknownEndpoints[0]}' in '{s}'");
 444            }
 1445            else if (unknownEndpoints.Count != 0 &&
 1446                    _instance.initializationData().properties.getIcePropertyAsInt("Ice.Warn.Endpoints") > 0)
 447            {
 0448                var msg = new StringBuilder("Proxy contains unknown endpoints:");
 0449                int sz = unknownEndpoints.Count;
 0450                for (int idx = 0; idx < sz; ++idx)
 451                {
 0452                    msg.Append(" `");
 0453                    msg.Append(unknownEndpoints[idx]);
 0454                    msg.Append('\'');
 455                }
 0456                _instance.initializationData().logger.warning(msg.ToString());
 457            }
 458
 1459            EndpointI[] ep = endpoints.ToArray();
 1460            return create(ident, facet, mode, protocol, encoding, ep, null, propertyPrefix);
 461        }
 1462        else if (s[beg] == '@')
 463        {
 1464            beg = Ice.UtilInternal.StringUtil.findFirstNotOf(s, delim, beg + 1);
 1465            if (beg == -1)
 466            {
 0467                throw new ParseException($"missing adapter ID in proxy string '{s}'");
 468            }
 469
 1470            end = Ice.UtilInternal.StringUtil.checkQuote(s, beg);
 471
 472            string adapterstr;
 1473            if (end == -1)
 474            {
 0475                throw new ParseException($"mismatched quotes around adapter ID in proxy string '{s}'");
 476            }
 1477            else if (end == 0)
 478            {
 1479                end = Ice.UtilInternal.StringUtil.findFirstOf(s, delim, beg);
 1480                if (end == -1)
 481                {
 1482                    end = s.Length;
 483                }
 1484                adapterstr = s[beg..end];
 485            }
 486            else
 487            {
 1488                beg++; // Skip leading quote
 1489                adapterstr = s[beg..end];
 1490                end++; // Skip trailing quote
 491            }
 492
 1493            if (end != s.Length && Ice.UtilInternal.StringUtil.findFirstNotOf(s, delim, end) != -1)
 494            {
 1495                throw new ParseException($"invalid characters after adapter ID in proxy string '{s}'");
 496            }
 497
 498            string adapter;
 499            try
 500            {
 1501                adapter = Ice.UtilInternal.StringUtil.unescapeString(adapterstr, 0, adapterstr.Length, "");
 1502            }
 0503            catch (ArgumentException argEx)
 504            {
 0505                throw new ParseException($"invalid adapter ID in proxy string '{s}'", argEx);
 506            }
 1507            if (adapter.Length == 0)
 508            {
 0509                throw new ParseException($"empty adapter ID in proxy string '{s}'");
 510            }
 1511            return create(ident, facet, mode, protocol, encoding, null, adapter, propertyPrefix);
 512        }
 513
 0514        throw new ParseException($"malformed proxy string '{s}'");
 515    }
 516
 517    internal Reference create(Ice.Identity ident, Ice.InputStream s)
 518    {
 519        //
 520        // Don't read the identity here. Operations calling this
 521        // constructor read the identity, and pass it as a parameter.
 522        //
 523
 1524        if (ident.name.Length == 0 && ident.category.Length == 0)
 525        {
 0526            return null;
 527        }
 528
 529        //
 530        // For compatibility with the old FacetPath.
 531        //
 1532        string[] facetPath = s.readStringSeq();
 533        string facet;
 1534        if (facetPath.Length > 0)
 535        {
 0536            if (facetPath.Length > 1)
 537            {
 0538                throw new MarshalException($"Received invalid facet path with {facetPath.Length} elements.");
 539            }
 0540            facet = facetPath[0];
 541        }
 542        else
 543        {
 1544            facet = "";
 545        }
 546
 1547        int mode = s.readByte();
 1548        if (mode < 0 || mode > (int)Reference.Mode.ModeBatchDatagram)
 549        {
 0550            throw new MarshalException($"Received invalid proxy mode {mode}");
 551        }
 552
 1553        _ = s.readBool(); // the secure field is no longer used
 554
 555        Ice.ProtocolVersion protocol;
 556        Ice.EncodingVersion encoding;
 1557        if (!s.getEncoding().Equals(Ice.Util.Encoding_1_0))
 558        {
 1559            protocol = new Ice.ProtocolVersion(s);
 1560            encoding = new Ice.EncodingVersion(s);
 561        }
 562        else
 563        {
 1564            protocol = Protocol.Protocol_1_0;
 1565            encoding = Ice.Util.Encoding_1_0;
 566        }
 567
 1568        EndpointI[] endpoints = null;
 1569        string adapterId = "";
 570
 1571        int sz = s.readSize();
 1572        if (sz > 0)
 573        {
 1574            endpoints = new EndpointI[sz];
 1575            for (int i = 0; i < sz; i++)
 576            {
 1577                endpoints[i] = _instance.endpointFactoryManager().read(s);
 578            }
 579        }
 580        else
 581        {
 1582            adapterId = s.readString();
 583        }
 584
 1585        return create(ident, facet, (Reference.Mode)mode, protocol, encoding, endpoints, adapterId, null);
 586    }
 587
 588    internal ReferenceFactory setDefaultRouter(Ice.RouterPrx defaultRouter)
 589    {
 1590        if (_defaultRouter == null ? defaultRouter == null : _defaultRouter.Equals(defaultRouter))
 591        {
 0592            return this;
 593        }
 594
 1595        var factory = new ReferenceFactory(_instance, _communicator);
 1596        factory._defaultLocator = _defaultLocator;
 1597        factory._defaultRouter = defaultRouter;
 1598        return factory;
 599    }
 600
 1601    internal Ice.RouterPrx getDefaultRouter() => _defaultRouter;
 602
 603    internal ReferenceFactory setDefaultLocator(Ice.LocatorPrx defaultLocator)
 604    {
 1605        if (_defaultLocator == null ? defaultLocator == null : _defaultLocator.Equals(defaultLocator))
 606        {
 0607            return this;
 608        }
 609
 1610        var factory = new ReferenceFactory(_instance, _communicator);
 1611        factory._defaultLocator = defaultLocator;
 1612        factory._defaultRouter = _defaultRouter;
 1613        return factory;
 614    }
 615
 1616    internal Ice.LocatorPrx getDefaultLocator() => _defaultLocator;
 617
 618    //
 619    // Only for use by Instance
 620    //
 1621    internal ReferenceFactory(Instance instance, Ice.Communicator communicator)
 622    {
 1623        _instance = instance;
 1624        _communicator = communicator;
 1625    }
 626
 627    private Reference create(
 628        Ice.Identity ident,
 629        string facet,
 630        Reference.Mode mode,
 631        Ice.ProtocolVersion protocol,
 632        Ice.EncodingVersion encoding,
 633        EndpointI[] endpoints,
 634        string adapterId,
 635        string propertyPrefix)
 636    {
 1637        DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
 638
 639        //
 640        // Default local proxy options.
 641        //
 1642        LocatorInfo locatorInfo = null;
 1643        if (_defaultLocator != null)
 644        {
 1645            if (!((Ice.ObjectPrxHelperBase)_defaultLocator).iceReference().getEncoding().Equals(encoding))
 646            {
 1647                locatorInfo = _instance.locatorManager().get(
 1648                    (Ice.LocatorPrx)_defaultLocator.ice_encodingVersion(encoding));
 649            }
 650            else
 651            {
 1652                locatorInfo = _instance.locatorManager().get(_defaultLocator);
 653            }
 654        }
 1655        RouterInfo routerInfo = _instance.routerManager().get(_defaultRouter);
 1656        bool collocOptimized = defaultsAndOverrides.defaultCollocationOptimization;
 1657        bool cacheConnection = true;
 1658        Ice.EndpointSelectionType endpointSelection = defaultsAndOverrides.defaultEndpointSelection;
 1659        TimeSpan locatorCacheTimeout = defaultsAndOverrides.defaultLocatorCacheTimeout;
 1660        TimeSpan invocationTimeout = defaultsAndOverrides.defaultInvocationTimeout;
 1661        Dictionary<string, string> context = null;
 662
 663        //
 664        // Override the defaults with the proxy properties if a property prefix is defined.
 665        //
 1666        if (propertyPrefix != null && propertyPrefix.Length > 0)
 667        {
 1668            Properties properties = _instance.initializationData().properties;
 669
 1670            Properties.validatePropertiesWithPrefix(propertyPrefix, properties, PropertyNames.ProxyProps);
 671
 672            string property;
 673
 1674            property = propertyPrefix + ".Locator";
 1675            Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(_communicator.propertyToProxy(property));
 1676            if (locator != null)
 677            {
 1678                if (!((Ice.ObjectPrxHelperBase)locator).iceReference().getEncoding().Equals(encoding))
 679                {
 0680                    locatorInfo = _instance.locatorManager().get(
 0681                        (Ice.LocatorPrx)locator.ice_encodingVersion(encoding));
 682                }
 683                else
 684                {
 1685                    locatorInfo = _instance.locatorManager().get(locator);
 686                }
 687            }
 688
 1689            property = propertyPrefix + ".Router";
 1690            Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(_communicator.propertyToProxy(property));
 1691            if (router != null)
 692            {
 1693                if (propertyPrefix.EndsWith(".Router", StringComparison.Ordinal))
 694                {
 0695                    string s = "`" + property + "=" + properties.getProperty(property) +
 0696                        "': cannot set a router on a router; setting ignored";
 0697                    _instance.initializationData().logger.warning(s);
 698                }
 699                else
 700                {
 1701                    routerInfo = _instance.routerManager().get(router);
 702                }
 703            }
 704
 1705            property = propertyPrefix + ".CollocationOptimized";
 1706            collocOptimized = properties.getPropertyAsIntWithDefault(property, collocOptimized ? 1 : 0) > 0;
 707
 1708            property = propertyPrefix + ".ConnectionCached";
 1709            cacheConnection = properties.getPropertyAsIntWithDefault(property, cacheConnection ? 1 : 0) > 0;
 710
 1711            property = propertyPrefix + ".EndpointSelection";
 1712            if (properties.getProperty(property).Length > 0)
 713            {
 1714                string type = properties.getProperty(property);
 1715                if (type == "Random")
 716                {
 1717                    endpointSelection = Ice.EndpointSelectionType.Random;
 718                }
 1719                else if (type == "Ordered")
 720                {
 1721                    endpointSelection = Ice.EndpointSelectionType.Ordered;
 722                }
 723                else
 724                {
 0725                    throw new ParseException(
 0726                        $"illegal value '{type}' in property '{property}'; expected 'Random' or 'Ordered'");
 727                }
 728            }
 729
 1730            property = propertyPrefix + ".LocatorCacheTimeout";
 1731            locatorCacheTimeout = TimeSpan.FromSeconds(
 1732                properties.getPropertyAsIntWithDefault(property, (int)locatorCacheTimeout.TotalSeconds));
 733
 1734            property = propertyPrefix + ".InvocationTimeout";
 1735            invocationTimeout = TimeSpan.FromMilliseconds(
 1736                properties.getPropertyAsIntWithDefault(property, (int)invocationTimeout.TotalMilliseconds));
 737
 1738            property = propertyPrefix + ".Context.";
 1739            Dictionary<string, string> contexts = properties.getPropertiesForPrefix(property);
 1740            if (contexts.Count != 0)
 741            {
 1742                context = new Dictionary<string, string>();
 1743                foreach (KeyValuePair<string, string> e in contexts)
 744                {
 1745                    context.Add(e.Key[property.Length..], e.Value);
 746                }
 747            }
 748        }
 749
 750        //
 751        // Create new reference
 752        //
 1753        return new RoutableReference(
 1754            _instance,
 1755            _communicator,
 1756            ident,
 1757            facet,
 1758            mode,
 1759            compress: null,
 1760            protocol,
 1761            encoding,
 1762            endpoints,
 1763            adapterId,
 1764            locatorInfo,
 1765            routerInfo,
 1766            collocOptimized,
 1767            cacheConnection,
 1768            endpointSelection,
 1769            locatorCacheTimeout,
 1770            invocationTimeout,
 1771            context);
 772    }
 773
 774    private readonly Instance _instance;
 775    private readonly Ice.Communicator _communicator;
 776    private Ice.RouterPrx _defaultRouter;
 777    private Ice.LocatorPrx _defaultLocator;
 778}