public RemoteObjectAdapterI(Ice.ObjectAdapter adapter) { _adapter = adapter; _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), Ice.Util.stringToIdentity("test"))); _adapter.activate(); }
internal TestI(Ice.ObjectAdapter adapter1, Ice.ObjectAdapter adapter2, ServerLocatorRegistry registry) { _adapter1 = adapter1; _adapter2 = adapter2; _registry = registry; _registry.addObject(_adapter1.add(new HelloI(), adapter1.getCommunicator().stringToIdentity("hello"))); }
public void start(string name, Ice.Communicator communicator, string[] args) { _adapter = communicator.createObjectAdapter("Hello-" + name); string helloIdentity = communicator.getProperties().getProperty("Hello.Identity"); _adapter.add(new HelloI(name), Ice.Util.stringToIdentity(helloIdentity)); _adapter.activate(); }
private static int run(string[] args, Ice.Communicator communicator) { int port = 0; for (int i = 0; i < args.Length; i++) { if (args[i][0] == '-') { System.Console.Error.WriteLine("Server: unknown option `" + args[i] + "'"); usage(); return(1); } if (port != 0) { System.Console.Error.WriteLine("Server: only one port can be specified"); usage(); return(1); } try { port = System.Int32.Parse(args[i]); } catch (System.FormatException) { System.Console.Error.WriteLine("Server: invalid port"); usage(); return(1); } } if (port <= 0) { System.Console.Error.WriteLine("Server: no port specified"); usage(); return(1); } communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object obj = new TestI(); adapter.add(obj, communicator.stringToIdentity("test")); adapter.activate(); communicator.waitForShutdown(); return(0); }
public override int run(string[] args) { int port = 0; for (int i = 0; i < args.Length; i++) { if (args[i][0] == '-') { Console.Error.WriteLine("Server: unknown option `" + args[i] + "'"); usage(); return(1); } if (port != 0) { Console.Error.WriteLine("Server: only one port can be specified"); usage(); return(1); } try { port = int.Parse(args[i]); } catch (FormatException) { Console.Error.WriteLine("Server: invalid port"); usage(); return(1); } } if (port <= 0) { Console.Error.WriteLine("Server: no port specified"); usage(); return(1); } communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(port)); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object obj = new TestI(); adapter.add(obj, Ice.Util.stringToIdentity("test")); adapter.activate(); communicator().waitForShutdown(); return(0); }
public override int run(string[] args) { if (args.Length > 0) { System.Console.Error.WriteLine(appName() + ": too many arguments"); return(1); } Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server"); adapter.add(new CallbackSenderI(), communicator().stringToIdentity("callbackSender")); adapter.activate(); Console.Out.WriteLine("start"); communicator().waitForShutdown(); return(0); }
public override int run(string[] args) { communicator().getProperties().setProperty("TestAdapter.AdapterId", "test"); communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. if (prx.ice_getConnection() != null) { throw new Exception(); } AllTests.allTests(this); return(0); }
public override void run(string[] args) { using (var communicator = initialize(ref args)) { // // We don't want connection warnings because of the timeout test. // communicator.getProperties().setProperty("Ice.Warn.Connections", "0"); communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new Test.MyDerivedClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); communicator.waitForShutdown(); } }
public override int run(string[] args) { communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new TimeoutI(), Ice.Util.stringToIdentity("timeout")); adapter.activate(); Ice.ObjectAdapter controllerAdapter = communicator().createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); communicator().waitForShutdown(); return(0); }
public override int run(string[] args) { communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); adapter.add(d, Ice.Util.stringToIdentity("d")); adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD"); Ice.Object f = new FI(); adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF"); Ice.Object h = new HI(communicator()); adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); adapter.activate(); communicator().waitForShutdown(); return(0); }
private static int run(string[] args, Ice.Communicator communicator) { communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), communicator.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. adapter2.add(new TestControllerI(adapter), communicator.stringToIdentity("testController")); //adapter2.activate(); // Don't activate OA to ensure collocation is used. AllTests.allTests(communicator); return(0); }
private static int run(string[] args, Ice.Communicator communicator) { communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); adapter.add(d, communicator.stringToIdentity("d")); adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD"); Ice.Object f = new FI(); adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF"); Ice.Object h = new HI(communicator); adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH"); adapter.activate(); communicator.waitForShutdown(); return(0); }
public override int run(string[] args) { communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Collocated test doesn't need to activate the OA adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Collocated test doesn't need to activate the OA AllTests.allTests(this, true); return(0); }
public override int run(string[] args) { if (args.Length > 0) { System.Console.Error.WriteLine(appName() + ": too many arguments"); return(1); } Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Server"); NestedPrx self = NestedPrxHelper.uncheckedCast(adapter.createProxy(communicator().stringToIdentity("nestedServer"))); adapter.add(new NestedI(self), communicator().stringToIdentity("nestedServer")); adapter.activate(); communicator().waitForShutdown(); return(0); }
private static int run(string[] args, Ice.Communicator communicator) { communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Collocated test doesn't need to activate the OA adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Collocated test doesn't need to activate the OA AllTests.allTests(communicator, true); return(0); }
private static int run(string[] args, Ice.Communicator communicator) { communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), communicator.stringToIdentity("test")); adapter.activate(); adapter2.add(new TestControllerI(adapter), communicator.stringToIdentity("testController")); adapter2.activate(); communicator.waitForShutdown(); return(0); }
public override int run(string[] args) { if (args.Length > 0) { System.Console.Error.WriteLine(appName() + ": too many arguments"); return(1); } communicator().getValueFactoryManager().add(ValueFactory.create, Demo.Printer.ice_staticId()); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Value"); Ice.Object @object = new InitialI(adapter); adapter.add(@object, communicator().stringToIdentity("initial")); adapter.activate(); communicator().waitForShutdown(); return(0); }
public override int run(string[] args) { if (args.Length < 1) { Console.Error.WriteLine("Usage: server testdir"); return(1); } communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0, "tcp")); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Identity id = Ice.Util.stringToIdentity("factory"); adapter.add(new ServerFactoryI(args[0] + "/../certs"), id); adapter.activate(); communicator().waitForShutdown(); return(0); }
private static int run(String[] args, Ice.Communicator communicator) { communicator.getProperties().setProperty("TestAdapter.AdapterId", "test"); communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. if (prx.ice_getConnection() != null) { throw new Exception(); } AllTests.allTests(communicator); return(0); }
public override int run(string[] args) { Ice.Properties properties = communicator().getProperties(); int num = 0; try { num = args.Length == 1 ? Int32.Parse(args[0]) : 0; } catch (FormatException) { } properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num, "tcp")); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter"); adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control")); adapter.activate(); if (num == 0) { properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(num, "udp")); Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter"); adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test")); adapter2.activate(); } StringBuilder endpoint = new StringBuilder(); if (properties.getProperty("Ice.IPv6").Equals("1")) { endpoint.Append("udp -h \"ff15::1:1\" -p "); } else { endpoint.Append("udp -h 239.255.1.1 -p "); } endpoint.Append(getTestPort(properties, 10)); properties.setProperty("McastTestAdapter.Endpoints", endpoint.ToString()); Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter"); mcastAdapter.add(new TestIntfI(), Ice.Util.stringToIdentity("test")); mcastAdapter.activate(); communicator().waitForShutdown(); return(0); }
public override void run(string[] args) { var initData = new InitializationData(); initData.typeIdNamespaces = new string[] { "Ice.exceptions.TypeId" }; initData.properties = createTestProperties(ref args); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max using (var communicator = initialize(initData)) { communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object obj = new ThrowerI(); adapter.add(obj, Ice.Util.stringToIdentity("thrower")); AllTests.allTests(this); } }
static void Main(string[] args) { try { Ice.Communicator communicator = Ice.Util.initialize(); Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints( "converter", "tcp -p 10000"); adapter.add(new ConverterI(), communicator.stringToIdentity("converter")); adapter.activate(); communicator.waitForShutdown(); communicator.destroy(); } catch (System.Exception ex) { System.Console.Error.WriteLine(ex); System.Environment.Exit(1); } }
public override void run(string[] args) { using (var communicator = initialize(ref args)) { communicator.getProperties().parseCommandLineOptions("TestAdapter", args); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); string id = communicator.getProperties().getPropertyWithDefault("Identity", "test"); adapter.add(new TestI(), Ice.Util.stringToIdentity(id)); try { adapter.activate(); } catch (Ice.ObjectAdapterDeactivatedException) { } communicator.waitForShutdown(); } }
public override void run(string[] args) { using (var communicator = initialize(ref args)) { if (args.Length < 1) { throw new ArgumentException("Usage: server testdir"); } communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0, "tcp")); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Identity id = Ice.Util.stringToIdentity("factory"); adapter.add(new ServerFactoryI(args[0] + "/../certs"), id); adapter.activate(); communicator.waitForShutdown(); } }
public static int Main(string[] args) { try { Ice.Communicator communicator = Ice.Util.initialize(ref args); Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "tcp -p 10000"); adapter.add(new HelloI(), communicator.stringToIdentity("hello")); adapter.activate(); communicator.waitForShutdown(); communicator.destroy(); return(0); } catch (System.Exception ex) { System.Console.Error.WriteLine(ex); return(1); } }
public override void run(string[] args) { using (var communicator = initialize(ref args)) { communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); adapter.add(d, Ice.Util.stringToIdentity("d")); adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD"); Ice.Object f = new FI(); adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF"); Ice.Object h = new HI(communicator); adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); adapter.activate(); serverReady(); communicator.waitForShutdown(); } }
private void Setcallback() { callbackAdapter = FaceServices.FaceProxy.Ic.createObjectAdapterWithEndpoints("callback-receiver", "default"); Ice.Object callbackServant = new ConnectorDisp(FaceBack); callbackAdapter.add(callbackServant, FaceServices.FaceProxy.Ic.stringToIdentity("callbackReceiver")); callbackAdapter.activate(); ConnectionListenerPrx listenerPxy = null; var objectPxy = callbackAdapter.createProxy(FaceServices.FaceProxy.Ic.stringToIdentity("callbackReceiver")); listenerPxy = ConnectionListenerPrxHelper.checkedCast(objectPxy); FaceServices.FaceProxy.initConnectionListener(listenerPxy); Item("set callback ok"); }
public static void createServer(String proxyName) { try { Ice.Communicator communicator = Ice.Util.initialize(); Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints( "proxyName", "tcp -p 10003"); adapter.add(new RemoteLogI(), communicator.stringToIdentity(proxyName)); adapter.activate(); communicator.waitForShutdown(); communicator.destroy(); } catch (System.Exception ex) { System.Console.Error.WriteLine(ex); System.Environment.Exit(1); } }
public override int run(string[] args) { args = communicator().getProperties().parseCommandLineOptions("TestAdapter", args); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); string id = communicator().getProperties().getPropertyWithDefault("Identity", "test"); adapter.add(new TestI(), Ice.Util.stringToIdentity(id)); shutdownOnInterrupt(); try { adapter.activate(); } catch (Ice.ObjectAdapterDeactivatedException) { } communicator().waitForShutdown(); return(0); }
public override void run(string[] args) { Ice.Properties properties = createTestProperties(ref args); properties.setProperty("Ice.ServerIdleTime", "120"); int port = 0; for (int i = 0; i < args.Length; i++) { if (args[i][0] == '-') { throw new ArgumentException("Server: unknown option `" + args[i] + "'"); } if (port != 0) { throw new ArgumentException("Server: only one port can be specified"); } try { port = int.Parse(args[i]); } catch (FormatException) { throw new ArgumentException("Server: invalid port"); } } if (port <= 0) { throw new ArgumentException("Server: no port specified"); } using (var communicator = initialize(properties)) { communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(port)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object obj = new TestI(); adapter.add(obj, Ice.Util.stringToIdentity("test")); adapter.activate(); communicator.waitForShutdown(); } }
public override void run(string[] args) { var properties = createTestProperties(ref args); properties.setProperty("Ice.Package.Test", "Ice.facets"); using (var communicator = initialize(properties)) { communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); adapter.add(d, Ice.Util.stringToIdentity("d")); adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD"); Ice.Object f = new FI(); adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF"); Ice.Object h = new HI(communicator); adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); AllTests.allTests(this); } }
public override void run(string[] args) { var initData = new InitializationData(); initData.typeIdNamespaces = new string[] { "Ice.operations.TypeId" }; initData.properties = createTestProperties(ref args); // // We don't want connection warnings because of the timeout test. // initData.properties.setProperty("Ice.Warn.Connections", "0"); using (var communicator = initialize(initData)) { communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); serverReady(); communicator.waitForShutdown(); } }
public override int run(string[] args) { if (args.Length > 0) { System.Console.Error.WriteLine(appName() + ": too many arguments"); return(1); } callbackOnInterrupt(); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello"); _workQueue = new WorkQueue(); adapter.add(new HelloI(_workQueue), communicator().stringToIdentity("hello")); _workQueue.Start(); adapter.activate(); communicator().waitForShutdown(); _workQueue.Join(); return(0); }
public void Initialize(IScene scene) { try { if (!m_enabled) return; IMurmurService service = scene.RequestModuleInterface<IMurmurService>(); if (service == null) return; MurmurConfig config = service.GetConfiguration(scene.RegionInfo.RegionName); if (config == null) return; bool justStarted = false; if (!m_started) { justStarted = true; m_started = true; // retrieve configuration variables m_murmurd_host = config.MurmurHost; m_server_version = config.ServerVersion; //Fix the callback URL, its our IP, so we deal with it IConfig m_config = m_source.Configs["MurmurService"]; if (m_config != null) config.IceCB = m_config.GetString("murmur_ice_cb", "tcp -h 127.0.0.1"); // Admin interface required values if (String.IsNullOrEmpty(m_murmurd_host)) { m_log.Error("[MurmurVoice] plugin disabled: incomplete configuration"); return; } Ice.Communicator comm = Ice.Util.initialize(); if (config.GlacierEnabled) { router = RouterPrxHelper.uncheckedCast(comm.stringToProxy(config.GlacierIce)); comm.setDefaultRouter(router); router.createSession(config.GlacierUser, config.GlacierPass); } MetaPrx meta = MetaPrxHelper.checkedCast(comm.stringToProxy(config.MetaIce)); // Create the adapter comm.getProperties().setProperty("Ice.PrintAdapterReady", "0"); adapter = config.GlacierEnabled ? comm.createObjectAdapterWithRouter("Callback.Client", comm.getDefaultRouter()) : comm.createObjectAdapterWithEndpoints("Callback.Client", config.IceCB); adapter.activate(); // Create identity and callback for Metaserver Ice.Identity metaCallbackIdent = new Ice.Identity {name = "metaCallback"}; if (router != null) metaCallbackIdent.category = router.getCategoryForClient(); MetaCallbackPrx meta_callback = MetaCallbackPrxHelper.checkedCast(adapter.add(new MetaCallbackImpl(), metaCallbackIdent)); meta.addCallback(meta_callback); m_log.InfoFormat("[MurmurVoice] using murmur server ice '{0}'", config.MetaIce); // create a server and figure out the port name Dictionary<string, string> defaults = meta.getDefaultConf(); m_server = ServerPrxHelper.checkedCast(meta.getServer(config.ServerID)); // start thread to ping glacier2 router and/or determine if con$ m_keepalive = new KeepAlive(m_server); ThreadStart ka_d = new ThreadStart(m_keepalive.StartPinging); m_keepalive_t = new Thread(ka_d); m_keepalive_t.Start(); // first check the conf for a port, if not then use server id and default port to find the right one. string conf_port = m_server.getConf("port"); if (!String.IsNullOrEmpty(conf_port)) m_murmurd_port = Convert.ToInt32(conf_port); else m_murmurd_port = Convert.ToInt32(defaults["port"]) + config.ServerID - 1; try { m_server.start(); } catch { } } // starts the server and gets a callback ServerManager manager = new ServerManager(m_server, config.ChannelName); // Create identity and callback for this current server AddServerCallback(scene, new ServerCallbackImpl(manager)); AddServerManager(scene, manager); if (justStarted) { Ice.Identity serverCallbackIdent = new Ice.Identity {name = "serverCallback"}; if (router != null) serverCallbackIdent.category = router.getCategoryForClient(); m_server.addCallback(ServerCallbackPrxHelper.checkedCast(adapter.add(GetServerCallback(scene), serverCallbackIdent))); } // Show information on console for debugging purposes m_log.InfoFormat("[MurmurVoice] using murmur server '{0}:{1}', sid '{2}'", m_murmurd_host, m_murmurd_port, config.ServerID); m_log.Info("[MurmurVoice] plugin enabled"); m_enabled = true; } catch (Exception e) { m_log.ErrorFormat("[MurmurVoice] plugin initialization failed: {0}", e); return; } }
/// <summary> /// Initializes a new instance of the /// <see cref="T:Ferda.Modules.BoxModuleI"/> class. /// </summary> /// <param name="boxInfo">The box info.</param> /// <param name="myIdentity">My identity.</param> /// <param name="myFactoryProxy">My factory proxy.</param> /// <param name="manager">The manager.</param> /// <param name="adapter">The adapter.</param> /// <param name="localePrefs">The localization preferences.</param> public BoxModuleI(IBoxInfo boxInfo, Ice.Identity myIdentity, BoxModuleFactoryPrx myFactoryProxy, Ferda.ModulesManager.ManagersEnginePrx manager, Ice.ObjectAdapter adapter, string[] localePrefs) { System.Diagnostics.Debug.WriteLine("BoxModuleI Constructor (entering): " + boxInfo.Identifier); // initializes inner fields by specified parameters this.boxInfo = boxInfo; this.iceIdentity = myIdentity; this.stringIceIdentity = Ice.Util.identityToString(IceIdentity); this.myFactoryProxy = myFactoryProxy; this.manager = manager; this.adapter = adapter; this.localePrefs = localePrefs; // add the new box module to the specified adapter adapter.add(this, this.iceIdentity); // get my proxy this.myProxy = BoxModulePrxHelper.uncheckedCast(adapter.createProxy(myIdentity)); // initializes box module`s functions object this.boxInfo.CreateFunctions(this, out this.functionsIceObj, out this.functionsIObj); this.functionsIObj.setBoxModuleInfo(this, this.boxInfo); this.functionsObjPrx = Ice.ObjectPrxHelper.uncheckedCast(adapter.addWithUUID(this.functionsIceObj)); // initializes properties this.properties = new Dictionary<string, PropertyValue>(); foreach (string propertyName in boxInfo.GetPropertiesNames()) { if (!boxInfo.IsPropertyReadOnly(propertyName)) { this.setProperty(propertyName, boxInfo.GetPropertyDefaultValue(propertyName)); } } // initializes sockets (connections and functions) this.connections = new Dictionary<string, Dictionary<string, BoxModulePrx>>(); foreach (string socketName in boxInfo.GetSocketNames()) { connections[socketName] = new Dictionary<string, BoxModulePrx>(); } System.Diagnostics.Debug.WriteLine("BoxModuleI Constructor (leaving): " + this.boxInfo.Identifier); }
public void start(string name, Ice.Communicator communicator, string[] args) { _adapter = communicator.createObjectAdapter(name); _adapter.add(new HelloI(), Ice.Util.stringToIdentity("hello")); _adapter.activate(); }
public void initialize() { Ice.Properties properties = _communicator.getProperties(); bool ipv4 = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0; bool preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0; string address; if(ipv4 && !preferIPv6) { address = properties.getPropertyWithDefault("IceDiscovery.Address", "239.255.0.1"); } else { address = properties.getPropertyWithDefault("IceDiscovery.Address", "ff15::1"); } int port = properties.getPropertyAsIntWithDefault("IceDiscovery.Port", 4061); string intf = properties.getProperty("IceDiscovery.Interface"); if(properties.getProperty("IceDiscovery.Multicast.Endpoints").Length == 0) { StringBuilder s = new StringBuilder(); s.Append("udp -h \"").Append(address).Append("\" -p ").Append(port); if(intf.Length != 0) { s.Append(" --interface \"").Append(intf).Append("\""); } properties.setProperty("IceDiscovery.Multicast.Endpoints", s.ToString()); } if(properties.getProperty("IceDiscovery.Reply.Endpoints").Length == 0) { StringBuilder s = new StringBuilder(); s.Append("udp"); if(intf.Length != 0) { s.Append(" -h \"").Append(intf).Append("\""); } properties.setProperty("IceDiscovery.Reply.Endpoints", s.ToString()); } if(properties.getProperty("IceDiscovery.Locator.Endpoints").Length == 0) { properties.setProperty("IceDiscovery.Locator.AdapterId", Guid.NewGuid().ToString()); } _multicastAdapter = _communicator.createObjectAdapter("IceDiscovery.Multicast"); _replyAdapter = _communicator.createObjectAdapter("IceDiscovery.Reply"); _locatorAdapter = _communicator.createObjectAdapter("IceDiscovery.Locator"); // // Setup locatory registry. // LocatorRegistryI locatorRegistry = new LocatorRegistryI(_communicator); Ice.LocatorRegistryPrx locatorRegistryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast( _locatorAdapter.addWithUUID(locatorRegistry)); string lookupEndpoints = properties.getProperty("IceDiscovery.Lookup"); if(lookupEndpoints.Length == 0) { lookupEndpoints = "udp -h \"" + address + "\" -p " + port; if(intf.Length > 0) { lookupEndpoints += " --interface \"" + intf + "\""; } } Ice.ObjectPrx lookupPrx = _communicator.stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints); lookupPrx = lookupPrx.ice_collocationOptimized(false); try { lookupPrx.ice_getConnection(); } catch(Ice.LocalException ex) { StringBuilder b = new StringBuilder(); b.Append("IceDiscovery is unable to establish a multicast connection:\n"); b.Append("proxy = "); b.Append(lookupPrx.ToString()); b.Append('\n'); b.Append(ex.ToString()); throw new Ice.PluginInitializationException(b.ToString()); } // // Add lookup and lookup reply Ice objects // LookupI lookup = new LookupI(locatorRegistry, LookupPrxHelper.uncheckedCast(lookupPrx), properties); _multicastAdapter.add(lookup, Ice.Util.stringToIdentity("IceDiscovery/Lookup")); Ice.ObjectPrx lookupReply = _replyAdapter.addWithUUID(new LookupReplyI(lookup)).ice_datagram(); lookup.setLookupReply(LookupReplyPrxHelper.uncheckedCast(lookupReply)); // // Setup locator on the communicator. // Ice.ObjectPrx loc; loc = _locatorAdapter.addWithUUID( new LocatorI(lookup, Ice.LocatorRegistryPrxHelper.uncheckedCast(locatorRegistryPrx))); _communicator.setDefaultLocator(Ice.LocatorPrxHelper.uncheckedCast(loc)); _multicastAdapter.activate(); _replyAdapter.activate(); _locatorAdapter.activate(); }