本文整理汇总了C#中Ice.Identity类的典型用法代码示例。如果您正苦于以下问题:C# Identity类的具体用法?C# Identity怎么用?C# Identity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Identity类属于Ice命名空间,在下文中一共展示了Identity类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: removeObject
removeObject(string oaName, string id, Ice.Current current)
{
Debug.Assert(_adapters.ContainsKey(oaName));
Ice.Identity identity = new Ice.Identity();
identity.name = id;
_adapters[oaName].remove(identity);
}
开发者ID:joshmoore,项目名称:ice,代码行数:7,代码来源:TestI.cs
示例2: addObject
addObject(string oaName, string id, Ice.Current current)
{
Debug.Assert(_adapters.ContainsKey(oaName));
Ice.Identity identity = new Ice.Identity();
identity.name = id;
_adapters[oaName].add(new TestIntfI(), identity);
}
开发者ID:joshmoore,项目名称:ice,代码行数:7,代码来源:TestI.cs
示例3: run
public override int run(string[] args)
{
if(args.Length > 0)
{
Console.Error.WriteLine(appName() + ": too many arguments");
return 1;
}
var server = CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("CallbackSender.Proxy"));
if(server == null)
{
Console.Error.WriteLine("invalid proxy");
return 1;
}
var adapter = communicator().createObjectAdapter("");
var ident = new Ice.Identity();
ident.name = Guid.NewGuid().ToString();
ident.category = "";
adapter.add(new CallbackReceiverI(), ident);
adapter.activate();
server.ice_getConnection().setAdapter(adapter);
server.addClient(ident);
communicator().waitForShutdown();
return 0;
}
开发者ID:zhangwei5095,项目名称:zeroc-ice-demos,代码行数:27,代码来源:Client.cs
示例4: FileI
public FileI(string name, DirectoryI parent)
{
_name = name;
_parent = parent;
_destroyed = false;
_id = new Identity();
_id.name = Guid.NewGuid().ToString();
}
开发者ID:RonsonNamek,项目名称:ice-demos,代码行数:8,代码来源:FileI.cs
示例5: DirectoryI
// DirectoryI constructor
public DirectoryI(Ice.Communicator communicator, string name, DirectoryI parent)
{
_name = name;
_parent = parent;
//
// Create an identity. The root directory has the fixed identity "RootDir"
//
_id = new Ice.Identity();
_id.name = _parent != null ? System.Guid.NewGuid().ToString() : "RootDir";
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:12,代码来源:DirectoryI.cs
示例6: FileI
// FileI constructor
public FileI(Ice.Communicator communicator, string name, DirectoryI parent)
{
_name = name;
_parent = parent;
Debug.Assert(_parent != null);
//
// Create an identity
//
_id = new Ice.Identity();
_id.name = System.Guid.NewGuid().ToString();
}
开发者ID:zhangwei5095,项目名称:zeroc-ice-demos,代码行数:14,代码来源:FileI.cs
示例7: DirectoryI
// DirectoryI constructor. parent == null indicates root directory.
public DirectoryI(string name, DirectoryI parent)
{
_name = name;
_parent = parent;
_id = new Identity();
_destroyed = false;
_contents = new Dictionary<string, NodeI>();
if(parent == null)
{
_id.name = "RootDir";
}
else
{
_id.name = Guid.NewGuid().ToString();
}
}
开发者ID:zhangwei5095,项目名称:zeroc-ice-demos,代码行数:18,代码来源:DirectoryI.cs
示例8: run
public override int run(string[] args)
{
//
// Terminate cleanly on receipt of a signal.
//
shutdownOnInterrupt();
//
// Create an object adapter
//
Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints(
"LifecycleFilesystem", "default -h localhost -p 10000");
//
// Create the root directory.
//
DirectoryI root = new DirectoryI();
Ice.Identity id = new Ice.Identity();
id.name = "RootDir";
adapter.add(root, id);
//
// All objects are created, allow client requests now.
//
adapter.activate();
//
// Wait until we are done.
//
communicator().waitForShutdown();
if(interrupted())
{
System.Console.Error.WriteLine(appName() + ": received signal, shutting down");
}
return 0;
}
开发者ID:Radulfr,项目名称:zeroc-ice,代码行数:37,代码来源:Server.cs
示例9: ice_identity
/// <summary>
/// Creates a new proxy that is identical to this proxy, except for the per-proxy context.
/// <param name="newIdentity">The identity for the new proxy.</param>
/// <returns>The proxy with the new identity.</returns>
/// </summary>
public ObjectPrx ice_identity(Identity newIdentity)
{
if(newIdentity.name.Length == 0)
{
throw new IllegalIdentityException();
}
if(newIdentity.Equals(_reference.getIdentity()))
{
return this;
}
else
{
ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
proxy.setup(_reference.changeIdentity(newIdentity));
return proxy;
}
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:22,代码来源:Proxy.cs
示例10: allTests
allTests(Ice.Communicator communicator)
{
Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost");
oa.activate();
Ice.Object servant = new MyObjectI();
//
// Register default servant with category "foo"
//
oa.addDefaultServant(servant, "foo");
//
// Start test
//
Console.Out.Write("testing single category... ");
Console.Out.Flush();
Ice.Object r = oa.findDefaultServant("foo");
test(r == servant);
r = oa.findDefaultServant("bar");
test(r == null);
Ice.Identity identity = new Ice.Identity();
identity.category = "foo";
string[] names = new string[] { "foo", "bar", "x", "y", "abcdefg" };
Test.MyObjectPrx prx = null;
for(int idx = 0; idx < 5; ++idx)
{
identity.name = names[idx];
prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
prx.ice_ping();
test(prx.getName() == names[idx]);
}
identity.name = "ObjectNotExist";
prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
try
{
prx.ice_ping();
test(false);
}
catch(Ice.ObjectNotExistException)
{
// Expected
}
try
{
prx.getName();
test(false);
}
catch(Ice.ObjectNotExistException)
{
// Expected
}
identity.name = "FacetNotExist";
prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
try
{
prx.ice_ping();
test(false);
}
catch(Ice.FacetNotExistException)
{
// Expected
}
try
{
prx.getName();
test(false);
}
catch(Ice.FacetNotExistException)
{
// Expected
}
identity.category = "bar";
for(int idx = 0; idx < 5; idx++)
{
identity.name = names[idx];
prx = Test.MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
try
{
prx.ice_ping();
test(false);
}
catch(Ice.ObjectNotExistException)
{
// Expected
}
try
{
//.........这里部分代码省略.........
开发者ID:pedia,项目名称:zeroc-ice,代码行数:101,代码来源:AllTests.cs
示例11: allTests
public static void allTests(Ice.Communicator communicator)
#endif
{
ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast(
communicator.stringToProxy("ServerManager :default -p 12010"));
test(manager != null);
TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator());
test(locator != null);
TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry());
test(registry != null);
Write("testing stringToProxy... ");
Flush();
Ice.ObjectPrx @base = communicator.stringToProxy("test @ TestAdapter");
Ice.ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter");
Ice.ObjectPrx base3 = communicator.stringToProxy("test");
Ice.ObjectPrx base4 = communicator.stringToProxy("ServerManager");
Ice.ObjectPrx base5 = communicator.stringToProxy("test2");
Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter");
WriteLine("ok");
Write("testing ice_locator and ice_getLocator... ");
test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
Ice.LocatorPrx anotherLocator =
Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator"));
@base = @base.ice_locator(anotherLocator);
test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0);
communicator.setDefaultLocator(null);
@base = communicator.stringToProxy("test @ TestAdapter");
test(@base.ice_getLocator() == null);
@base = @base.ice_locator(anotherLocator);
test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0);
communicator.setDefaultLocator(locator);
@base = communicator.stringToProxy("test @ TestAdapter");
test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
//
// We also test ice_router/ice_getRouter (perhaps we should add a
// test/Ice/router test?)
//
test(@base.ice_getRouter() == null);
Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter"));
@base = @base.ice_router(anotherRouter);
test(Ice.Util.proxyIdentityCompare(@base.ice_getRouter(), anotherRouter) == 0);
Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter"));
communicator.setDefaultRouter(router);
@base = communicator.stringToProxy("test @ TestAdapter");
test(Ice.Util.proxyIdentityCompare(@base.ice_getRouter(), communicator.getDefaultRouter()) == 0);
communicator.setDefaultRouter(null);
@base = communicator.stringToProxy("test @ TestAdapter");
test(@base.ice_getRouter() == null);
WriteLine("ok");
Write("starting server... ");
Flush();
manager.startServer();
WriteLine("ok");
Write("testing checked cast... ");
Flush();
TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base);
test(obj != null);
TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2);
test(obj2 != null);
TestIntfPrx obj3 = TestIntfPrxHelper.checkedCast(base3);
test(obj3 != null);
ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4);
test(obj4 != null);
TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5);
test(obj5 != null);
TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6);
test(obj6 != null);
WriteLine("ok");
Write("testing [email protected] indirect proxy... ");
Flush();
obj.shutdown();
manager.startServer();
try
{
obj2.ice_ping();
}
catch(Ice.LocalException)
{
test(false);
}
WriteLine("ok");
Write("testing [email protected] indirect proxy... ");
Flush();
obj.shutdown();
manager.startServer();
try
{
obj6.ice_ping();
}
catch(Ice.LocalException)
{
test(false);
}
//.........这里部分代码省略.........
开发者ID:Crysty-Yui,项目名称:ice,代码行数:101,代码来源:AllTests.cs
示例12: run
public override int run(string[] args)
{
Ice.ObjectPrx routerBase;
{
Console.Out.Write("testing stringToProxy for router... ");
Console.Out.Flush();
routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347");
Console.Out.WriteLine("ok");
}
Glacier2.RouterPrx router;
{
Console.Out.Write("testing checked cast for router... ");
Console.Out.Flush();
router = Glacier2.RouterPrxHelper.checkedCast(routerBase);
test(router != null);
Console.Out.WriteLine("ok");
}
{
Console.Out.Write("testing router finder... ");
Console.Out.Flush();
Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast(
communicator().stringToProxy("Ice/RouterFinder:default -p 12347"));
test(finder.getRouter().ice_getIdentity().Equals(router.ice_getIdentity()));
Console.Out.WriteLine("ok");
}
{
Console.Out.Write("installing router with communicator... ");
Console.Out.Flush();
communicator().setDefaultRouter(router);
Console.Out.WriteLine("ok");
}
{
Console.Out.Write("getting the session timeout... ");
Console.Out.Flush();
long timeout = router.getSessionTimeout();
test(timeout == 30);
Console.Out.WriteLine("ok");
}
Ice.ObjectPrx @base;
{
Console.Out.Write("testing stringToProxy for server object... ");
Console.Out.Flush();
@base = communicator().stringToProxy("c1/callback:tcp -p 12010");
Console.Out.WriteLine("ok");
}
{
Console.Out.Write("trying to ping server before session creation... ");
Console.Out.Flush();
try
{
@base.ice_ping();
test(false);
}
catch(Ice.ConnectionLostException)
{
Console.Out.WriteLine("ok");
}
catch(Ice.SocketException)
{
test(false);
}
}
{
Console.Out.Write("trying to create session with wrong password... ");
Console.Out.Flush();
try
{
router.createSession("userid", "xxx");
test(false);
}
catch(Glacier2.PermissionDeniedException)
{
Console.Out.WriteLine("ok");
}
catch(Glacier2.CannotCreateSessionException)
{
test(false);
}
}
{
Console.Out.Write("trying to destroy non-existing session... ");
Console.Out.Flush();
try
{
router.destroySession();
test(false);
}
//.........这里部分代码省略.........
开发者ID:joshmoore,项目名称:ice,代码行数:101,代码来源:Client.cs
示例13: createProxy
public ObjectPrx createProxy(Identity ident)
{
//
// Create a reference and return a reverse proxy for this
// reference.
//
return _instance.proxyFactory().referenceToProxy(_instance.referenceFactory().create(ident, this));
}
开发者ID:alexmnazarenko,项目名称:ice,代码行数:8,代码来源:ConnectionI.cs
示例14: identityToString
/// <summary>
/// Converts an object identity to a string.
/// </summary>
/// <param name="ident">The object identity to convert.</param>
/// <returns>The string representation of the object identity.</returns>
public static string identityToString(Identity ident)
{
if(ident.category == null || ident.category.Length == 0)
{
return IceUtilInternal.StringUtil.escapeString(ident.name, "/");
}
else
{
return IceUtilInternal.StringUtil.escapeString(ident.category, "/") + '/' +
IceUtilInternal.StringUtil.escapeString(ident.name, "/");
}
}
开发者ID:pedia,项目名称:zeroc-ice,代码行数:17,代码来源:Util.cs
示例15: stringToIdentity
/// <summary>
/// Converts a string to an object identity.
/// </summary>
/// <param name="s">The string to convert.</param>
/// <returns>The converted object identity.</returns>
public static Identity stringToIdentity(string s)
{
Identity ident = new Identity();
//
// Find unescaped separator; note that the string may contain an escaped
// backslash before the separator.
//
int slash = -1, pos = 0;
while((pos = s.IndexOf((System.Char) '/', pos)) != -1)
{
int escapes = 0;
while(pos - escapes > 0 && s[pos - escapes - 1] == '\\')
{
escapes++;
}
//
// We ignore escaped escapes
//
if(escapes % 2 == 0)
{
if(slash == -1)
{
slash = pos;
}
else
{
//
// Extra unescaped slash found.
//
IdentityParseException ex = new IdentityParseException();
ex.str = "unescaped backslash in identity `" + s + "'";
throw ex;
}
}
pos++;
}
if(slash == -1)
{
ident.category = "";
try
{
ident.name = IceUtilInternal.StringUtil.unescapeString(s, 0, s.Length);
}
catch(System.ArgumentException e)
{
IdentityParseException ex = new IdentityParseException();
ex.str = "invalid identity name `" + s + "': " + e.Message;
throw ex;
}
}
else
{
try
{
ident.category = IceUtilInternal.StringUtil.unescapeString(s, 0, slash);
}
catch(System.ArgumentException e)
{
IdentityParseException ex = new IdentityParseException();
ex.str = "invalid category in identity `" + s + "': " + e.Message;
throw ex;
}
if(slash + 1 < s.Length)
{
try
{
ident.name = IceUtilInternal.StringUtil.unescapeString(s, slash + 1, s.Length);
}
catch(System.ArgumentException e)
{
IdentityParseException ex = new IdentityParseException();
ex.str = "invalid name in identity `" + s + "': " + e.Message;
throw ex;
}
}
else
{
ident.name = "";
}
}
return ident;
}
开发者ID:pedia,项目名称:zeroc-ice,代码行数:91,代码来源:Util.cs
示例16: runWithSession
public override int runWithSession(string[] args)
{
if(args.Length > 0)
{
Console.Error.WriteLine(appName() + ": too many arguments");
return 1;
}
Ice.Identity callbackReceiverIdent = createCallbackIdentity("callbackReceiver");
Ice.Identity callbackReceiverFakeIdent = new Ice.Identity("fake", "callbackReceiver");
Ice.ObjectPrx @base = communicator().propertyToProxy("Callback.Proxy");
CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base);
CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway());
CallbackPrx batchOneway = CallbackPrxHelper.uncheckedCast(twoway.ice_batchOneway());
objectAdapter().add(new CallbackReceiverI(), callbackReceiverFakeIdent);
CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
objectAdapter().add(new CallbackReceiverI(), callbackReceiverIdent));
CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
menu();
string line = null;
string @override = null;
bool fake = false;
do
{
Console.Write("==> ");
Console.Out.Flush();
line = Console.In.ReadLine();
if(line == null)
{
break;
}
if(line.Equals("t"))
{
Dictionary<string, string> context = new Dictionary<string, string>();
context["_fwd"] = "t";
if(@override != null)
{
context["_ovrd"] = @override;
}
twoway.initiateCallback(twowayR, context);
}
else if(line.Equals("o"))
{
Dictionary<string, string> context = new Dictionary<string, string>();
context["_fwd"] = "o";
if(@override != null)
{
context["_ovrd"] = @override;
}
oneway.initiateCallback(onewayR, context);
}
else if(line.Equals("O"))
{
Dictionary<string, string> context = new Dictionary<string, string>();
context["_fwd"] = "O";
if(@override != null)
{
context["_ovrd"] = @override;
}
batchOneway.initiateCallback(onewayR, context);
}
else if(line.Equals("f"))
{
batchOneway.ice_flushBatchRequests();
}
else if(line.Equals("v"))
{
if(@override == null)
{
@override = "some_value";
Console.WriteLine("override context field is now `" + @override + "'");
}
else
{
@override = null;
Console.WriteLine("override context field is empty");
}
}
else if(line.Equals("F"))
{
fake = !fake;
if(fake)
{
twowayR = CallbackReceiverPrxHelper.uncheckedCast(
twowayR.ice_identity(callbackReceiverFakeIdent));
onewayR = CallbackReceiverPrxHelper.uncheckedCast(
onewayR.ice_identity(callbackReceiverFakeIdent));
}
else
{
twowayR = CallbackReceiverPrxHelper.uncheckedCast(
twowayR.ice_identity(callbackReceiverIdent));
//.........这里部分代码省略.........
开发者ID:RonsonNamek,项目名称:ice-demos,代码行数:101,代码来源:Client.cs
示例17: allTests
public static void allTests(Ice.Communicator communicator)
{
Console.Out.Write("testing stringToProxy... ");
Console.Out.Flush();
String rf = "test @ TestAdapter";
Ice.ObjectPrx @base = communicator.stringToProxy(rf);
test(@base != null);
Console.Out.WriteLine("ok");
Console.Out.Write("testing IceGrid.Locator is present... ");
IceGrid.LocatorPrx locator = IceGrid.LocatorPrxHelper.uncheckedCast(@base);
test(locator != null);
Console.Out.WriteLine("ok");
Console.Out.Write("testing checked cast... ");
Console.Out.Flush();
TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base);
test(obj != null);
test(obj.Equals(@base));
Console.Out.WriteLine("ok");
Console.Out.Write("pinging server... ");
Console.Out.Flush();
obj.ice_ping();
Console.Out.WriteLine("ok");
Console.Out.Write("testing locator finder... ");
Ice.Identity finderId = new Ice.Identity();
finderId.category = "Ice";
finderId.name = "LocatorFinder";
Ice.LocatorFinderPrx finder = Ice.LocatorFinderPrxHelper.checkedCast(
communicator.getDefaultLocator().ice_identity(finderId));
test(finder.getLocator() != null);
Console.Out.WriteLine("ok");
Console.Out.Write("testing discovery... ");
{
// Add test well-known object
IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast(
communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry"));
test(registry != null);
try
{
IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar");
session.getAdmin().addObjectWithType(@base, "::Test");
session.destroy();
}
catch(Ice.UserException)
{
test(false);
}
//
// Ensure the IceGrid discovery locator can discover the
// registries and make sure locator requests are forwarded.
//
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = communicator.getProperties().ice_clone_();
initData.properties.setProperty("Ice.Default.Locator", "");
initData.properties.setProperty("Ice.Plugin.IceGridDiscovery", "IceGrid:IceGrid.DiscoveryPluginFactoryI");
if(IceInternal.AssemblyUtil.osx_ &&
initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0)
{
initData.properties.setProperty("IceGridDiscovery.Interface", "::1");
}
initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter");
initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default");
Ice.Communicator com = Ice.Util.initialize(initData);
test(com.getDefaultLocator() != null);
com.stringToProxy("test @ TestAdapter").ice_ping();
com.stringToProxy("test").ice_ping();
test(com.getDefaultLocator().getRegistry() != null);
test(IceGrid.LocatorPrxHelper.uncheckedCast(com.getDefaultLocator()).getLocalRegistry() != null);
test(IceGrid.LocatorPrxHelper.uncheckedCast(com.getDefaultLocator()).getLocalQuery() != null);
Ice.ObjectAdapter adapter = com.createObjectAdapter("AdapterForDiscoveryTest");
adapter.activate();
adapter.deactivate();
com.destroy();
//
// Now, ensure that the IceGrid discovery locator correctly
// handles failure to find a locator.
//
initData.properties.setProperty("IceGridDiscovery.InstanceName", "unknown");
initData.properties.setProperty("IceGridDiscovery.RetryCount", "1");
initData.properties.setProperty("IceGridDiscovery.Timeout", "100");
com = Ice.Util.initialize(initData);
test(com.getDefaultLocator() != null);
try
{
com.stringToProxy("test @ TestAdapter").ice_ping();
}
catch(Ice.NoEndpointException)
{
}
try
//.........这里部分代码省略.........
开发者ID:pedia,项目名称:zeroc-ice,代码行数:101,代码来源:AllTests.cs
示例18: run
//.........这里部分代码省略.........
}
//
// Retrieve the topic.
//
IceStorm.TopicPrx topic;
try
{
topic = manager.retrieve(topicName);
}
catch(IceStorm.NoSuchTopic)
{
try
{
topic = manager.create(topicName);
}
catch(IceStorm.TopicExists)
{
Console.WriteLine("temporary error. try again.");
return 1;
}
}
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Clock.Subscriber");
//
// Add a servant for the Ice object. If --id is used the
// identity comes from the command line, otherwise a UUID is
// used.
//
// id is not directly altered since it is used below to
// detect whether subscribeAndGetPublisher can raise
// AlreadySubscribed.
//
Ice.Identity subId = new Ice.Identity(id, "");
if(subId.name == null)
{
subId.name = Guid.NewGuid().ToString();
}
Ice.ObjectPrx subscriber = adapter.add(new ClockI(), subId);
//
// Activate the object adapter before subscribing.
//
adapter.activate();
Dictionary<string, string> qos = new Dictionary<string, string>();
if(retryCount != null)
{
qos["retryCount"] = retryCount;
}
//
// Set up the proxy.
//
if(option.Equals("Datagram"))
{
if(batch)
{
subscriber = subscriber.ice_batchDatagram();
}
else
{
subscriber = subscriber.ice_datagram();
}
}
else if(option.Equals("Twoway"))
{
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:67,代码来源:Subscriber.cs
注:本文中的Ice.Identity类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论