settings = new PeerCustomResolverSettings ();
}
- private PeerCustomResolverBindingElement (
- PeerCustomResolverBindingElement other)
+ public PeerCustomResolverBindingElement (PeerCustomResolverBindingElement other)
: base (other)
{
ReferralPolicy = other.ReferralPolicy;
BindingContext context;
PeerCustomResolverSettings settings;
+ public EndpointAddress Address {
+ get { return settings.Address; }
+ set { settings.Address = value; }
+ }
+
+ public Binding Binding {
+ get { return settings.Binding; }
+ set { settings.Binding = value; }
+ }
+
[MonoTODO]
public override PeerReferralPolicy ReferralPolicy { get; set; }
+ public override bool CanBuildChannelFactory<TChannel> (BindingContext context)
+ {
+ return context.CanBuildInnerChannelFactory<TChannel> ();
+ }
+
public override IChannelFactory<TChannel> BuildChannelFactory<TChannel> (
BindingContext context)
{
return cf;
}
+ public override bool CanBuildChannelListener<TChannel> (BindingContext context)
+ {
+ return context.CanBuildInnerChannelListener<TChannel> ();
+ }
+
public override IChannelListener<TChannel>
BuildChannelListener<TChannel> (
BindingContext context)
public PeerCustomResolver (ServiceEndpoint endpoint)
{
+ if (endpoint == null)
+ throw new ArgumentNullException ("endpoint");
client = new ChannelFactory<ICustomPeerResolverClient> (endpoint).CreateChannel ();
}
public override object Register (string meshId,
PeerNodeAddress nodeAddress, TimeSpan timeout)
{
+ if (String.IsNullOrEmpty (meshId))
+ throw new ArgumentNullException ("meshId");
+ if (nodeAddress == null)
+ throw new ArgumentNullException ("nodeAddress");
+ if (timeout <= TimeSpan.Zero)
+ throw new ArgumentException (String.Format ("Timeout value must be positive value. It was {0}", timeout));
+
client.OperationTimeout = timeout;
preserved_mesh_id = meshId;
return client.Register (new RegisterInfo (client_id, meshId, nodeAddress)).RegistrationId;
public override ReadOnlyCollection<PeerNodeAddress> Resolve (
string meshId, int maxAddresses, TimeSpan timeout)
{
+ if (String.IsNullOrEmpty (meshId))
+ throw new ArgumentNullException ("meshId");
+ if (maxAddresses <= 0)
+ throw new ArgumentOutOfRangeException ("maxAddresses must be positive integer");
+ if (timeout <= TimeSpan.Zero)
+ throw new ArgumentException (String.Format ("Timeout value must be positive value. It was {0}", timeout));
+
client.OperationTimeout = timeout;
return new ReadOnlyCollection<PeerNodeAddress> (client.Resolve (new ResolveInfo (client_id, meshId, maxAddresses)).Addresses ?? new PeerNodeAddress [0]);
}
public override void Unregister (object registrationId,
TimeSpan timeout)
{
+ if (timeout <= TimeSpan.Zero)
+ throw new ArgumentException (String.Format ("Timeout value must be positive value. It was {0}", timeout));
+
client.OperationTimeout = timeout;
preserved_mesh_id = null;
client.Unregister (new UnregisterInfo (preserved_mesh_id, (Guid) registrationId));
public override void Update (object registrationId,
PeerNodeAddress updatedNodeAddress, TimeSpan timeout)
{
+ if (timeout <= TimeSpan.Zero)
+ throw new ArgumentException (String.Format ("Timeout value must be positive value. It was {0}", timeout));
+
client.OperationTimeout = timeout;
client.Update (new UpdateInfo ((Guid) registrationId, client_id, preserved_mesh_id, updatedNodeAddress));
}