Exemplo n.º 1
0
Arquivo: Proxy.cs Projeto: shawvi/ice
 /// <summary>Creates a clone of this proxy, with a new identity and optionally other options. The clone
 /// is identical to this proxy except for its identity and other options set through parameters.</summary>
 /// <param name="prx">The source proxy.</param>
 /// <param name="identity">The identity of the clone.</param>
 /// <param name="factory">The proxy factory used to manufacture the clone.</param>
 /// <param name="adapterId">The adapter ID of the clone (optional).</param>
 /// <param name="cacheConnection">Determines whether or not the clone caches its connection (optional).</param>
 /// <param name="clearLocator">When set to true, the clone does not have an associated locator proxy (optional).
 /// </param>
 /// <param name="clearRouter">When set to true, the clone does not have an associated router proxy (optional).
 /// </param>
 /// <param name="collocationOptimized">Determines whether or not the clone can use collocation optimization
 /// (optional).</param>
 /// <param name="compress">Determines whether or not the clone compresses requests (optional).</param>
 /// <param name="connectionId">The connection ID of the clone (optional).</param>
 /// <param name="connectionTimeout">The connection timeout of the clone (optional).</param>
 /// <param name="context">The context of the clone (optional).</param>
 /// <param name="encoding">The encoding of the clone (optional).</param>
 /// <param name="endpointSelection">The encoding selection policy of the clone (optional).</param>
 /// <param name="endpoints">The endpoints of the clone (optional).</param>
 /// <param name="facet">The facet of the clone (optional).</param>
 /// <param name="fixedConnection">The connection of the clone (optional). When specified, the clone is a fixed
 /// proxy. You can clone a non-fixed proxy into a fixed proxy but not vice-versa.</param>
 /// <param name="invocationMode">The invocation mode of the clone (optional).</param>
 /// <param name="invocationTimeout">The invocation timeout of the clone (optional).</param>
 /// <param name="locator">The locator proxy of the clone (optional).</param>
 /// <param name="locatorCacheTimeout">The locator cache timeout of the clone (optional).</param>
 /// <param name="oneway">Determines whether the clone is oneway or twoway (optional). This is a simplified
 /// version of the invocationMode parameter.</param>
 /// <param name="preferSecure">Determines whether the clone prefers secure connections over non-secure
 /// connections (optional).</param>
 /// <param name="protocol">The Ice protocol of the clone (optional).</param>
 /// <param name="router">The router proxy of the clone (optional).</param>
 /// <param name="secure">The secure option of the clone (optional).</param>
 /// <returns>A new proxy manufactured by the proxy factory (see factory parameter).</returns>
 public static T Clone <T>(this IObjectPrx prx,
                           Identity identity,
                           ProxyFactory <T> factory,
                           string?adapterId          = null,
                           bool?cacheConnection      = null,
                           bool clearLocator         = false,
                           bool clearRouter          = false,
                           bool?collocationOptimized = null,
                           bool?compress             = null,
                           string?connectionId       = null,
                           int?connectionTimeout     = null,
                           IReadOnlyDictionary <string, string>?context = null,
                           Encoding?encoding = null,
                           EndpointSelectionType?endpointSelection = null,
                           IEndpoint[]?endpoints         = null,
                           string?facet                  = null,
                           Connection?fixedConnection    = null,
                           InvocationMode?invocationMode = null,
                           int?invocationTimeout         = null,
                           ILocatorPrx?locator           = null,
                           int?locatorCacheTimeout       = null,
                           bool?oneway       = null,
                           bool?preferSecure = null,
                           Protocol?protocol = null,
                           IRouterPrx?router = null,
                           bool?secure       = null) where T : class, IObjectPrx
 {
     return(factory(prx.IceReference.Clone(adapterId,
                                           cacheConnection,
                                           clearLocator,
                                           clearRouter,
                                           collocationOptimized,
                                           compress,
                                           connectionId,
                                           connectionTimeout,
                                           context,
                                           encoding,
                                           endpointSelection,
                                           endpoints?.Select(e => (Endpoint)e).ToArray(),
                                           facet,
                                           fixedConnection,
                                           identity,
                                           invocationMode,
                                           invocationTimeout,
                                           locator,
                                           locatorCacheTimeout,
                                           oneway,
                                           preferSecure,
                                           protocol,
                                           router,
                                           secure)));
 }
Exemplo n.º 2
0
Arquivo: Proxy.cs Projeto: shawvi/ice
        /// <summary>Creates a clone of this proxy. The clone is identical to this proxy except for options set
        /// through parameters. This method returns this proxy instead of a new proxy in the event none of the options
        /// specified through the parameters change this proxy's options.</summary>
        /// <param name="prx">The source proxy.</param>
        /// <param name="adapterId">The adapter ID of the clone (optional).</param>
        /// <param name="cacheConnection">Determines whether or not the clone caches its connection (optional).</param>
        /// <param name="clearLocator">When set to true, the clone does not have an associated locator proxy (optional).
        /// </param>
        /// <param name="clearRouter">When set to true, the clone does not have an associated router proxy (optional).
        /// </param>
        /// <param name="collocationOptimized">Determines whether or not the clone can use collocation optimization
        /// (optional).</param>
        /// <param name="compress">Determines whether or not the clone compresses requests (optional).</param>
        /// <param name="connectionId">The connection ID of the clone (optional).</param>
        /// <param name="connectionTimeout">The connection timeout of the clone (optional).</param>
        /// <param name="context">The context of the clone (optional).</param>
        /// <param name="encoding">The encoding of the clone (optional).</param>
        /// <param name="endpointSelection">The encoding selection policy of the clone (optional).</param>
        /// <param name="endpoints">The endpoints of the clone (optional).</param>
        /// <param name="fixedConnection">The connection of the clone (optional). When specified, the clone is a fixed
        /// proxy. You can clone a non-fixed proxy into a fixed proxy but not vice-versa.</param>
        /// <param name="invocationMode">The invocation mode of the clone (optional).</param>
        /// <param name="invocationTimeout">The invocation timeout of the clone (optional).</param>
        /// <param name="locator">The locator proxy of the clone (optional).</param>
        /// <param name="locatorCacheTimeout">The locator cache timeout of the clone (optional).</param>
        /// <param name="oneway">Determines whether the clone is oneway or twoway (optional). This is a simplified
        /// version of the invocationMode parameter.</param>
        /// <param name="preferSecure">Determines whether the clone prefers secure connections over non-secure
        /// connections (optional).</param>
        /// <param name="protocol">The Ice protocol of the clone (optional).</param>
        /// <param name="router">The router proxy of the clone (optional).</param>
        /// <param name="secure">The secure option of the clone (optional).</param>
        /// <returns>A new proxy with the same type as this proxy.</returns>
        public static T Clone <T>(this T prx,
                                  string?adapterId          = null,
                                  bool?cacheConnection      = null,
                                  bool clearLocator         = false,
                                  bool clearRouter          = false,
                                  bool?collocationOptimized = null,
                                  bool?compress             = null,
                                  string?connectionId       = null,
                                  int?connectionTimeout     = null,
                                  IReadOnlyDictionary <string, string>?context = null,
                                  Encoding?encoding = null,
                                  EndpointSelectionType?endpointSelection = null,
                                  IEndpoint[]?endpoints         = null,
                                  Connection?fixedConnection    = null,
                                  InvocationMode?invocationMode = null,
                                  int?invocationTimeout         = null,
                                  ILocatorPrx?locator           = null,
                                  int?locatorCacheTimeout       = null,
                                  bool?oneway       = null,
                                  bool?preferSecure = null,
                                  Protocol?protocol = null,
                                  IRouterPrx?router = null,
                                  bool?secure       = null) where T : IObjectPrx
        {
            Reference clone = prx.IceReference.Clone(adapterId,
                                                     cacheConnection,
                                                     clearLocator,
                                                     clearRouter,
                                                     collocationOptimized,
                                                     compress,
                                                     connectionId,
                                                     connectionTimeout,
                                                     context,
                                                     encoding,
                                                     endpointSelection,
                                                     endpoints?.Select(e => (Endpoint)e).ToArray(),
                                                     facet: null,
                                                     fixedConnection,
                                                     identity: null,
                                                     invocationMode,
                                                     invocationTimeout,
                                                     locator,
                                                     locatorCacheTimeout,
                                                     oneway,
                                                     preferSecure,
                                                     protocol,
                                                     router,
                                                     secure);

            // Reference.Clone never returns a new reference == to itself.
            return(ReferenceEquals(clone, prx.IceReference) ? prx : (T)prx.Clone(clone));
        }
Exemplo n.º 3
0
        public static IObjectPrx Clone(this IObjectPrx prx,
                                       string facet,
                                       string?adapterId          = null,
                                       bool clearLocator         = false,
                                       bool clearRouter          = false,
                                       bool?collocationOptimized = null,
                                       bool?compress             = null,
                                       bool?connectionCached     = null,
                                       string?connectionId       = null,
                                       int?connectionTimeout     = null,
                                       IReadOnlyDictionary <string, string>?context = null,
                                       Encoding?encoding = null,
                                       EndpointSelectionType?endpointSelectionType = null,
                                       IEndpoint[]?endpoints         = null,
                                       Connection?fixedConnection    = null,
                                       InvocationMode?invocationMode = null,
                                       int?invocationTimeout         = null,
                                       ILocatorPrx?locator           = null,
                                       int?locatorCacheTimeout       = null,
                                       bool?oneway       = null,
                                       bool?preferSecure = null,
                                       IRouterPrx?router = null,
                                       bool?secure       = null)
        {
            Reference reference = prx.IceReference.Clone(
                null,
                facet,
                adapterId,
                clearLocator,
                clearRouter,
                collocationOptimized,
                compress,
                connectionCached,
                connectionId,
                connectionTimeout,
                context,
                encoding,
                endpointSelectionType,
                endpoints,
                fixedConnection,
                invocationMode,
                invocationTimeout,
                locator,
                locatorCacheTimeout,
                oneway,
                preferSecure,
                router,
                secure);

            return(reference.Equals(prx.IceReference) ? prx : prx.Clone(reference));
        }
Exemplo n.º 4
0
 /// <summary>Creates a clone of this proxy, with a new facet and optionally other options. The clone is
 /// identical to this proxy except for its facet and other options set through parameters.</summary>
 /// <param name="prx">The source proxy.</param>
 /// <param name="facet">The facet of the clone.</param>
 /// <param name="factory">The proxy factory used to manufacture the clone.</param>
 /// <param name="adapterId">The adapter ID of the clone (optional).</param>
 /// <param name="cacheConnection">Determines whether or not the clone caches its connection (optional).</param>
 /// <param name="clearLocator">When set to true, the clone does not have an associated locator proxy (optional).
 /// </param>
 /// <param name="clearRouter">When set to true, the clone does not have an associated router proxy (optional).
 /// </param>
 /// <param name="compress">Determines whether or not the clone compresses requests (optional).</param>
 /// <param name="connectionId">The connection ID of the clone (optional).</param>
 /// <param name="connectionTimeout">The connection timeout of the clone (optional).</param>
 /// <param name="context">The context of the clone (optional).</param>
 /// <param name="encoding">The encoding of the clone (optional).</param>
 /// <param name="endpointSelection">The encoding selection policy of the clone (optional).</param>
 /// <param name="endpoints">The endpoints of the clone (optional).</param>
 /// <param name="fixedConnection">The connection of the clone (optional). When specified, the clone is a fixed
 /// proxy. You can clone a non-fixed proxy into a fixed proxy but not vice-versa.</param>
 /// <param name="invocationMode">The invocation mode of the clone (optional).</param>
 /// <param name="invocationTimeout">The invocation timeout of the clone (optional).</param>
 /// <param name="locator">The locator proxy of the clone (optional).</param>
 /// <param name="locatorCacheTimeout">The locator cache timeout of the clone (optional).</param>
 /// <param name="oneway">Determines whether the clone is oneway or twoway (optional). This is a simplified
 /// version of the invocationMode parameter.</param>
 /// <param name="preferNonSecure">Determines whether the clone prefers non-secure connections over secure
 /// connections (optional).</param>
 /// <param name="protocol">The Ice protocol of the clone (optional).</param>
 /// <param name="router">The router proxy of the clone (optional).</param>
 /// <returns>A new proxy manufactured by the proxy factory (see factory parameter).</returns>
 public static T Clone <T>(this IObjectPrx prx,
                           string facet,
                           ProxyFactory <T> factory,
                           string?adapterId      = null,
                           bool?cacheConnection  = null,
                           bool clearLocator     = false,
                           bool clearRouter      = false,
                           bool?compress         = null,
                           string?connectionId   = null,
                           int?connectionTimeout = null,
                           IReadOnlyDictionary <string, string>?context = null,
                           Encoding?encoding = null,
                           EndpointSelectionType?endpointSelection = null,
                           IEnumerable <Endpoint>?endpoints        = null,
                           Connection?fixedConnection    = null,
                           InvocationMode?invocationMode = null,
                           int?invocationTimeout         = null,
                           ILocatorPrx?locator           = null,
                           TimeSpan?locatorCacheTimeout  = null,
                           bool?oneway          = null,
                           bool?preferNonSecure = null,
                           Protocol?protocol    = null,
                           IRouterPrx?router    = null) where T : class, IObjectPrx
 {
     return(factory(prx.IceReference.Clone(adapterId,
                                           cacheConnection,
                                           clearLocator,
                                           clearRouter,
                                           compress,
                                           connectionId,
                                           connectionTimeout,
                                           context,
                                           encoding,
                                           endpointSelection,
                                           endpoints,
                                           facet,
                                           fixedConnection,
                                           identity: null,
                                           invocationMode,
                                           invocationTimeout,
                                           locator,
                                           locatorCacheTimeout,
                                           oneway,
                                           preferNonSecure,
                                           protocol,
                                           router)));
 }
Exemplo n.º 5
0
        /// <summary>Creates a clone of this proxy. The clone is identical to this proxy except for options set
        /// through parameters. This method returns this proxy instead of a new proxy in the event none of the options
        /// specified through the parameters change this proxy's options.</summary>
        /// <param name="prx">The source proxy.</param>
        /// <param name="cacheConnection">Determines whether or not the clone caches its connection (optional).</param>
        /// <param name="clearLocator">When set to true, the clone does not have an associated locator proxy (optional).
        /// </param>
        /// <param name="clearRouter">When set to true, the clone does not have an associated router proxy (optional).
        /// </param>
        /// <param name="connectionId">The connection ID of the clone (optional).</param>
        /// <param name="context">The context of the clone (optional).</param>
        /// <param name="encoding">The encoding of the clone (optional).</param>
        /// <param name="endpointSelection">The encoding selection policy of the clone (optional).</param>
        /// <param name="endpoints">The endpoints of the clone (optional).</param>
        /// <param name="fixedConnection">The connection of the clone (optional). When specified, the clone is a fixed
        /// proxy. You can clone a non-fixed proxy into a fixed proxy but not vice-versa.</param>
        /// <param name="invocationMode">The invocation mode of the clone (optional). Applies only to ice1 proxies.
        /// </param>
        /// <param name="invocationTimeout">The invocation timeout of the clone (optional).</param>
        /// <param name="location">The location of the clone (optional).</param>
        /// <param name="locator">The locator proxy of the clone (optional).</param>
        /// <param name="locatorCacheTimeout">The locator cache timeout of the clone (optional).</param>
        /// <param name="oneway">Determines whether the clone is oneway or twoway (optional).</param>
        /// <param name="preferNonSecure">Determines whether the clone prefers non-secure connections over secure
        /// connections (optional).</param>
        /// <param name="router">The router proxy of the clone (optional).</param>
        /// <returns>A new proxy with the same type as this proxy.</returns>
        public static T Clone <T>(
            this T prx,
            bool?cacheConnection = null,
            bool clearLocator    = false,
            bool clearRouter     = false,
            string?connectionId  = null,
            IReadOnlyDictionary <string, string>?context = null,
            Encoding?encoding = null,
            EndpointSelectionType?endpointSelection = null,
            IEnumerable <Endpoint>?endpoints        = null,
            Connection?fixedConnection    = null,
            InvocationMode?invocationMode = null,
            TimeSpan?invocationTimeout    = null,
            IEnumerable <string>?location = null,
            ILocatorPrx?locator           = null,
            TimeSpan?locatorCacheTimeout  = null,
            bool?oneway          = null,
            bool?preferNonSecure = null,
            IRouterPrx?router    = null) where T : IObjectPrx
        {
            Reference clone = prx.IceReference.Clone(cacheConnection,
                                                     clearLocator,
                                                     clearRouter,
                                                     connectionId,
                                                     context,
                                                     encoding,
                                                     endpointSelection,
                                                     endpoints,
                                                     facet: null,
                                                     fixedConnection,
                                                     identity: null,
                                                     identityAndFacet: null,
                                                     invocationMode,
                                                     invocationTimeout,
                                                     location,
                                                     locator,
                                                     locatorCacheTimeout,
                                                     oneway,
                                                     preferNonSecure,
                                                     router);

            // Reference.Clone never returns a new reference == to itself.
            return(ReferenceEquals(clone, prx.IceReference) ? prx : (T)prx.Clone(clone));
        }
Exemplo n.º 6
0
 /// <summary>Creates a clone of this proxy, with a new identity and optionally other options. The clone
 /// is identical to this proxy except for its identity and other options set through parameters.</summary>
 /// <param name="prx">The source proxy.</param>
 /// <param name="factory">The proxy factory used to manufacture the clone.</param>
 /// <param name="cacheConnection">Determines whether or not the clone caches its connection (optional).</param>
 /// <param name="clearLocator">When set to true, the clone does not have an associated locator proxy (optional).
 /// </param>
 /// <param name="clearRouter">When set to true, the clone does not have an associated router proxy (optional).
 /// </param>
 /// <param name="connectionId">The connection ID of the clone (optional).</param>
 /// <param name="context">The context of the clone (optional).</param>
 /// <param name="encoding">The encoding of the clone (optional).</param>
 /// <param name="endpointSelection">The encoding selection policy of the clone (optional).</param>
 /// <param name="endpoints">The endpoints of the clone (optional).</param>
 /// <param name="facet">The facet of the clone (optional).</param>
 /// <param name="fixedConnection">The connection of the clone (optional). When specified, the clone is a fixed
 /// proxy. You can clone a non-fixed proxy into a fixed proxy but not vice-versa.</param>
 /// <param name="identity">The identity of the clone.</param>
 /// <param name="identityAndFacet">A relative URI string [category/]identity[#facet].</param>
 /// <param name="invocationMode">The invocation mode of the clone (optional). Applies only to ice1 proxies.
 /// </param>
 /// <param name="location">The location of the clone (optional).</param>
 /// <param name="locator">The locator proxy of the clone (optional).</param>
 /// <param name="locatorCacheTimeout">The locator cache timeout of the clone (optional).</param>
 /// <param name="oneway">Determines whether the clone is oneway or twoway (optional).</param>
 /// <param name="preferNonSecure">Determines whether the clone prefers non-secure connections over secure
 /// connections (optional).</param>
 /// <param name="router">The router proxy of the clone (optional).</param>
 /// <returns>A new proxy manufactured by the proxy factory (see factory parameter).</returns>
 public static T Clone <T>(
     this IObjectPrx prx,
     ProxyFactory <T> factory,
     bool?cacheConnection = null,
     bool clearLocator    = false,
     bool clearRouter     = false,
     string?connectionId  = null,
     IReadOnlyDictionary <string, string>?context = null,
     Encoding?encoding = null,
     EndpointSelectionType?endpointSelection = null,
     IEnumerable <Endpoint>?endpoints        = null,
     string?facet = null,
     Connection?fixedConnection    = null,
     Identity?identity             = null,
     string?identityAndFacet       = null,
     InvocationMode?invocationMode = null,
     IEnumerable <string>?location = null,
     ILocatorPrx?locator           = null,
     TimeSpan?locatorCacheTimeout  = null,
     bool?oneway          = null,
     bool?preferNonSecure = null,
     IRouterPrx?router    = null) where T : class, IObjectPrx =>
 factory(prx.IceReference.Clone(cacheConnection,
                                clearLocator,
                                clearRouter,
                                connectionId,
                                context,
                                encoding,
                                endpointSelection,
                                endpoints,
                                facet,
                                fixedConnection,
                                identity,
                                identityAndFacet,
                                invocationMode,
                                location,
                                locator,
                                locatorCacheTimeout,
                                oneway,
                                preferNonSecure,
                                router));