Beispiel #1
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    Ice::ObjectFactoryPtr factory = new MyObjectFactory;
    communicator->addObjectFactory(factory, "::Test::B");
    communicator->addObjectFactory(factory, "::Test::C");
    communicator->addObjectFactory(factory, "::Test::D");
    communicator->addObjectFactory(factory, "::Test::E");
    communicator->addObjectFactory(factory, "::Test::F");
    communicator->addObjectFactory(factory, "::Test::I");
    communicator->addObjectFactory(factory, "::Test::J");
    communicator->addObjectFactory(factory, "::Test::H");

    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    InitialPtr initial = new InitialI(adapter);
    adapter->add(initial, communicator->stringToIdentity("initial"));
    UnexpectedObjectExceptionTestIPtr uoet = new UnexpectedObjectExceptionTestI;
    adapter->add(uoet, communicator->stringToIdentity("uoet"));
    InitialPrx allTests(const Ice::CommunicatorPtr&);
    allTests(communicator);
    // We must call shutdown even in the collocated case for cyclic dependency cleanup
    initial->shutdown(Ice::Current());
    return EXIT_SUCCESS;
}
Beispiel #2
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    IceUtil::TimerPtr timer = new IceUtil::Timer();

    communicator->getProperties()->setProperty("TestAdapter1.Endpoints", getTestEndpoint(communicator, 0) + ":udp");
    communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.Size", "5");
    communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
    communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
    communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.Serialize", "0");
    Ice::ObjectAdapterPtr adapter1 = communicator->createObjectAdapter("TestAdapter1");
    adapter1->add(ICE_MAKE_SHARED(HoldI, timer, adapter1), communicator->stringToIdentity("hold"));

    communicator->getProperties()->setProperty("TestAdapter2.Endpoints", getTestEndpoint(communicator, 1) + ":udp");
    communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.Size", "5");
    communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
    communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
    communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.Serialize", "1");
    Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("TestAdapter2");
    adapter2->add(ICE_MAKE_SHARED(HoldI, timer, adapter2), communicator->stringToIdentity("hold"));

    adapter1->activate();
    adapter2->activate();

    TEST_READY

    communicator->waitForShutdown();

    timer->destroy();

    return EXIT_SUCCESS;
}
Beispiel #3
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1, "tcp"));
    communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("ControllerAdapter");

#ifdef ICE_CPP11_MAPPING
    shared_ptr<PluginI> plugin = dynamic_pointer_cast<PluginI>(communicator->getPluginManager()->getPlugin("Test"));
#else
    PluginI* plugin = dynamic_cast<PluginI*>(communicator->getPluginManager()->getPlugin("Test").get());
#endif
    assert(plugin);
    ConfigurationPtr configuration = plugin->getConfiguration();
    BackgroundControllerIPtr backgroundController = ICE_MAKE_SHARED(BackgroundControllerI, adapter, configuration);

    adapter->add(ICE_MAKE_SHARED(BackgroundI, backgroundController), communicator->stringToIdentity("background"));
    adapter->add(ICE_MAKE_SHARED(LocatorI, backgroundController), communicator->stringToIdentity("locator"));
    adapter->add(ICE_MAKE_SHARED(RouterI, backgroundController), communicator->stringToIdentity("router"));
    adapter->activate();

    adapter2->add(backgroundController, communicator->stringToIdentity("backgroundController"));
    adapter2->activate();

    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
Beispiel #4
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
#ifdef ICE_CPP11_MAPPING
    communicator->getValueFactoryManager()->add(makeFactory<II>(), "::Test::I");
    communicator->getValueFactoryManager()->add(makeFactory<JI>(), "::Test::J");
    communicator->getValueFactoryManager()->add(makeFactory<HI>(), "::Test::H");
#else
    Ice::ValueFactoryPtr factory = new MyValueFactory;
    communicator->getValueFactoryManager()->add(factory, "::Test::I");
    communicator->getValueFactoryManager()->add(factory, "::Test::J");
    communicator->getValueFactoryManager()->add(factory, "::Test::H");
#endif

    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(InitialI, adapter), communicator->stringToIdentity("initial"));
    adapter->add(ICE_MAKE_SHARED(TestIntfI), communicator->stringToIdentity("test"));

    adapter->add(ICE_MAKE_SHARED(UnexpectedObjectExceptionTestI), communicator->stringToIdentity("uoet"));
    adapter->activate();
    TEST_READY
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
Beispiel #5
0
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(new TestIntfI(communicator), communicator->stringToIdentity("test"));
    adapter->add(new Test1::WstringClassI, communicator->stringToIdentity("wstring1"));
    adapter->add(new Test2::WstringClassI, communicator->stringToIdentity("wstring2"));

    adapter->activate();
    communicator->waitForShutdown();

    return EXIT_SUCCESS;
}
Beispiel #6
0
void
ServerManagerI::startServer(const Ice::Current&)
{
    for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i)
    {
        (*i)->waitForShutdown();
        (*i)->destroy();
    }
    _communicators.clear();

    //
    // Simulate a server: create a new communicator and object
    // adapter. The object adapter is started on a system allocated
    // port. The configuration used here contains the Ice.Locator
    // configuration variable. The new object adapter will register
    // its endpoints with the locator and create references containing
    // the adapter id instead of the endpoints.
    //
    Ice::CommunicatorPtr serverCommunicator = Ice::initialize(_initData);
    _communicators.push_back(serverCommunicator);

    //
    // Use fixed port to ensure that OA re-activation doesn't re-use previous port from
    // another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter).
    //
    {
        std::ostringstream os;
        os << "default -p " << _nextPort++;
        serverCommunicator->getProperties()->setProperty("TestAdapter.Endpoints", os.str());
    }
    {
        std::ostringstream os;
        os << "default -p " << _nextPort++;
        serverCommunicator->getProperties()->setProperty("TestAdapter2.Endpoints", os.str());
    }

    Ice::ObjectAdapterPtr adapter = serverCommunicator->createObjectAdapter("TestAdapter");
    Ice::ObjectAdapterPtr adapter2 = serverCommunicator->createObjectAdapter("TestAdapter2");

    Ice::ObjectPrxPtr locator = serverCommunicator->stringToProxy("locator:default -p 12010");
    adapter->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator));
    adapter2->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator));

    Ice::ObjectPtr object = ICE_MAKE_SHARED(TestI, adapter, adapter2, _registry);
    _registry->addObject(adapter->add(object, serverCommunicator->stringToIdentity("test")));
    _registry->addObject(adapter->add(object, serverCommunicator->stringToIdentity("test2")));
    adapter->add(object, serverCommunicator->stringToIdentity("test3"));

    adapter->activate();
    adapter2->activate();
}
Beispiel #7
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(new TestIntfI(communicator), communicator->stringToIdentity("test"));
    adapter->add(new Test1::WstringClassI, communicator->stringToIdentity("wstring1"));
    adapter->add(new Test2::WstringClassI, communicator->stringToIdentity("wstring2"));

    adapter->activate();
    TEST_READY
    communicator->waitForShutdown();

    return EXIT_SUCCESS;
}
Beispiel #8
0
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
    Ice::PropertiesPtr properties = communicator->getProperties();

    int num = argc == 2 ? atoi(argv[1]) : 0;

    {
        ostringstream os;
        os << "default -p " << (12010 + num);
        properties->setProperty("ControlAdapter.Endpoints", os.str());
    }
    {
        ostringstream os;
        os << "control" << num;
        properties->setProperty("ControlAdapter.AdapterId", os.str());
    }
    properties->setProperty("ControlAdapter.ThreadPool.Size", "1");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ControlAdapter");
    {
        ostringstream os;
        os << "controller" << num;
        adapter->add(ICE_MAKE_SHARED(ControllerI), communicator->stringToIdentity(os.str()));
    }
    adapter->activate();

    TEST_READY

    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
Beispiel #9
0
int main(int argc, char* argv[])
{
    int status = 0;
    Ice::CommunicatorPtr ic;
    try {
        ic = Ice::initialize(argc, argv);
        Ice::ObjectAdapterPtr adapter
		= ic->createObjectAdapterWithEndpoints("lcdshow", "default -p 10000");
	ram::tortuga::SensorBoardI* board = new ram::tortuga::SensorBoardI();

	// Check if the board initialized correctly
	if (board->isInitialized()) {
	    Ice::ObjectPtr object = board;
	    adapter->add(object, ic->stringToIdentity("SensorBoard"));
	    adapter->activate();
	    ic->waitForShutdown();
	}
	delete board;
    } catch (const Ice::Exception& e) {
	std::cerr << e << std::endl;
        status = 1;
    } catch (const char* msg) {
	std::cerr << msg << std::endl;
        status = 1;
    }
    if (ic) {
        try {
            ic->destroy();
        } catch (const Ice::Exception& e) {
	    std::cerr << e << std::endl;
            status = 1;
        }
    }
    return status;
}
Beispiel #10
0
int
main(int argc, char* argv[])
{
int status = 0;
Ice::InitializationData id;
id.properties = Ice::createProperties(argc, argv);
id.properties->setProperty("Ice.ThreadPool.Server.Size", "50");
id.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "5000");
//    _communicator = Ice::initialize(id);
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(id);
Ice::ObjectAdapterPtr adapter
= ic->createObjectAdapterWithEndpoints(
"SimplePrinterAdapter", "default -p 10000");  //默认建立的是tcp 连接
Ice::ObjectPtr object = new PrinterI;
PrinterPrx spPrx = PrinterPrx::uncheckedCast(adapter->add(object, ic->stringToIdentity("SimplePrinter")));
cout << "PrinterPrx:" <<spPrx <<endl;
adapter->activate();
ic->waitForShutdown();
} catch (const Ice::Exception & e) {
cerr << e << endl;
status = 1;
} catch (const char * msg) {
cerr << msg << endl;
status = 1;
}
if (ic)
ic->destroy();
return status;
}
Beispiel #11
0
int main(int argc, char* argv[])
{
    int status = 0;
    Ice::CommunicatorPtr ic;
    try
    {
        ic = Ice::initialize(argc, argv);
        Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints(
                "SimplePrinterAdapter", "default -p 10000");
        Ice::ObjectPtr object = new PrinterI;
        adapter->add(object, ic->stringToIdentity("SimplePrinter"));
        adapter->activate();
        ic->waitForShutdown();
    }
    catch (const Ice::Exception& e)
    {
        std::cerr << e << std::endl;
        status = 1;
    }
    if (ic)
    {
        try
        {
            ic->destroy();
        }
        catch (const Ice::Exception& e)
        {
            std::cerr << e << std::endl;
            status = 1;
        }
    }
    return status;
}
Beispiel #12
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0) + ":udp");
    communicator->getProperties()->setProperty("Ice.Warn.Dispatch", "0");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");

    adapter->addServantLocator(ICE_MAKE_SHARED(ServantLocatorAMDI, ""), "");
    adapter->addServantLocator(ICE_MAKE_SHARED(ServantLocatorAMDI, "category"), "category");
    adapter->add(ICE_MAKE_SHARED(TestAMDI), communicator->stringToIdentity("asm"));
    adapter->add(ICE_MAKE_SHARED(TestActivationI), communicator->stringToIdentity("test/activation"));
    adapter->activate();
    TEST_READY
    adapter->waitForDeactivate();
    return EXIT_SUCCESS;
}
Beispiel #13
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("Ice.Warn.Dispatch", "0");
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->addServantLocator(ICE_MAKE_SHARED(ServantLocatorI, ""), "");
    adapter->addServantLocator(ICE_MAKE_SHARED(ServantLocatorI, "category"), "category");
    adapter->add(ICE_MAKE_SHARED(TestI), communicator->stringToIdentity("asm"));
    adapter->add(ICE_MAKE_SHARED(TestActivationI), communicator->stringToIdentity("test/activation"));

    Test::TestIntfPrxPtr allTests(const CommunicatorPtr&);
    allTests(communicator);

    return EXIT_SUCCESS;
}
void
HelloServiceI::start(const string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& /*args*/)
{
    _adapter = communicator->createObjectAdapter(name);
    Demo::HelloPtr hello = new HelloI;
    _adapter->add(hello, communicator->stringToIdentity("hello"));
    _adapter->activate();
}
Beispiel #15
0
 virtual void
 findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr& response, const string&,
                       const Ice::Current& current) const
 {
     _controller->checkCallPause(current);
     Ice::CommunicatorPtr communicator = current.adapter->getCommunicator();
     response->ice_response(current.adapter->createDirectProxy(communicator->stringToIdentity("dummy")));
 }
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
    communicator->getProperties()->setProperty("Ice.Warn.Dispatch", "0");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    
    adapter->addServantLocator(new ServantLocatorAMDI(""), "");
    adapter->addServantLocator(new ServantLocatorAMDI("category"), "category");
    adapter->add(new TestAMDI, communicator->stringToIdentity("asm"));
    adapter->add(new TestActivationI, communicator->stringToIdentity("test/activation"));
    adapter->activate();
    TEST_READY
    adapter->waitForDeactivate();
    return EXIT_SUCCESS;
}
Beispiel #17
0
void 
setupObjectAdapter(const Ice::CommunicatorPtr& communicator)
{
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("");
    Ice::ObjectPtr object = new RetryI;
    adapter->add(object, communicator->stringToIdentity("retry"));
    //adapter->activate(); // Don't activate OA to ensure collocation is used.
}
Beispiel #18
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("TestAdapter2");
    Ice::ObjectAdapterPtr adapter3 = communicator->createObjectAdapter("TestAdapter3");
    Ice::ObjectPtr object = new ThrowerI();
    adapter->add(object, communicator->stringToIdentity("thrower"));
    adapter2->add(object, communicator->stringToIdentity("thrower"));
    adapter3->add(object, communicator->stringToIdentity("thrower"));
    adapter->activate();
    adapter2->activate();
    adapter3->activate();
    TEST_READY
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
Beispiel #19
0
int main(int argc, char* argv[])
{
  int status = 0;
  Ice::CommunicatorPtr ic;
  try {
    ic = Ice::initialize(argc, argv);

    if (argc != 4) {
      cerr << "Usage: " << argv[0] << " servername NameService-host local-port\n";
      goto clean_up;
    }

    // Look up the name service.
    ostringstream ns_formatter;
    ns_formatter << "NameService:tcp -h " << argv[2] << " -p 9010";
    Ice::ObjectPrx base =
      ic->stringToProxy(ns_formatter.str().c_str());
    NameServicePrx ns = NameServicePrx::checkedCast(base);
    if (!ns)
      throw "Invalid NameService";

    // Create local chat display object and support infrastructure.
    ostringstream server_formatter;
    server_formatter << "tcp -p " << argv[3];
    Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints(
      "ChatterAdapter", server_formatter.str().c_str());
    Ice::ObjectPtr object = new RoomManager_impl(adapter);
    Ice::ObjectPrx server =
      adapter->add(object, ic->stringToIdentity("RoomManager"));
    adapter->activate();

    // Register object.
    // ns->registerName(argv[1], server);

    ic->waitForShutdown();
  }
  catch (const Ice::Exception& e) {
    cerr << e << endl;
    status = 1;
  }
  catch (const char* msg) {
    cerr << msg << endl;
    status = 1;
  }

 clean_up:
  // We must call ic->destroy() even if an exception is throw above.
  if (ic) {
    try {
      ic->destroy();
    }
    catch (const Ice::Exception& e) {
      cerr << e << endl;
      status = 1;
    }
  }
  return status;
}
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
    Ice::PropertiesPtr properties = communicator->getProperties();

    int num = argc == 2 ? atoi(argv[1]) : 0;

    ostringstream os;
    os << "tcp -p " << (12010 + num);
    properties->setProperty("ControlAdapter.Endpoints", os.str());
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ControlAdapter");
    adapter->add(new TestIntfI, communicator->stringToIdentity("control"));
    adapter->activate();

    if(num == 0)
    {
        properties->setProperty("TestAdapter.Endpoints", "udp -p 12010");
        Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("TestAdapter");
        adapter2->add(new TestIntfI, communicator->stringToIdentity("test"));
        adapter2->activate();
    }

    string endpoint;
    if(properties->getProperty("Ice.IPv6") == "1")
    {
#if defined(__APPLE__)
        endpoint = "udp -h \"ff02::1:1\" -p 12020 --interface \"lo0\"";
#else
        endpoint = "udp -h \"ff01::1:1\" -p 12020";
#endif
    }
    else
    {
        endpoint = "udp -h 239.255.1.1 -p 12020";
    }
    properties->setProperty("McastTestAdapter.Endpoints", endpoint);
    Ice::ObjectAdapterPtr mcastAdapter = communicator->createObjectAdapter("McastTestAdapter");
    mcastAdapter->add(new TestIntfI, communicator->stringToIdentity("test"));
    mcastAdapter->activate();

    TEST_READY

    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
Beispiel #21
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectPtr d = ICE_MAKE_SHARED(DI);
    adapter->add(d, communicator->stringToIdentity("d"));
    adapter->addFacet(d, communicator->stringToIdentity("d"), "facetABCD");
    Ice::ObjectPtr f = ICE_MAKE_SHARED(FI);
    adapter->addFacet(f, communicator->stringToIdentity("d"), "facetEF");
    Ice::ObjectPtr h = ICE_MAKE_SHARED(HI, communicator);
    adapter->addFacet(h, communicator->stringToIdentity("d"), "facetGH");

    GPrxPtr allTests(const Ice::CommunicatorPtr&);
    allTests(communicator);

    return EXIT_SUCCESS;
}
Beispiel #22
0
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectPtr d = new DI;
    adapter->add(d, communicator->stringToIdentity("d"));
    adapter->addFacet(d, communicator->stringToIdentity("d"), "facetABCD");
    Ice::ObjectPtr f = new FI;
    adapter->addFacet(f, communicator->stringToIdentity("d"), "facetEF");
    Ice::ObjectPtr h = new HI(communicator);
    adapter->addFacet(h, communicator->stringToIdentity("d"), "facetGH");

    adapter->activate();
    communicator->waitForShutdown();

    return EXIT_SUCCESS;
}
Beispiel #23
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectPtr d = new DI;
    adapter->add(d, communicator->stringToIdentity("d"));
    adapter->addFacet(d, communicator->stringToIdentity("d"), "facetABCD");
    Ice::ObjectPtr f = new FI;
    adapter->addFacet(f, communicator->stringToIdentity("d"), "facetEF");
    Ice::ObjectPtr h = new HI(communicator);
    adapter->addFacet(h, communicator->stringToIdentity("d"), "facetGH");

    GPrx allTests(const Ice::CommunicatorPtr&);
    allTests(communicator);

    return EXIT_SUCCESS;
}
Beispiel #24
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectPtr object = new MetricsI;
    adapter->add(object, communicator->stringToIdentity("metrics"));
    adapter->activate();

    communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011");
    Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
    controllerAdapter->add(new ControllerI(adapter), communicator->stringToIdentity("controller"));
    controllerAdapter->activate();

    TEST_READY
    communicator->waitForShutdown();

    return EXIT_SUCCESS;
}
Beispiel #25
0
 virtual void
 findAdapterByIdAsync(string,
                      function<void(const shared_ptr<Ice::ObjectPrx>&)> response,
                      function<void(exception_ptr)>,
                      const Ice::Current& current) const
 {
     _controller->checkCallPause(current);
     Ice::CommunicatorPtr communicator = current.adapter->getCommunicator();
     response(current.adapter->createDirectProxy(communicator->stringToIdentity("dummy")));
 }
Beispiel #26
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    Ice::ObjectFactoryPtr factory = new MyObjectFactory;
    communicator->addObjectFactory(factory, "::Test::I");
    communicator->addObjectFactory(factory, "::Test::J");
    communicator->addObjectFactory(factory, "::Test::H");

    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    InitialPtr initial = new InitialI(adapter);
    adapter->add(initial, communicator->stringToIdentity("initial"));
    UnexpectedObjectExceptionTestIPtr uoet = new UnexpectedObjectExceptionTestI;
    adapter->add(uoet, communicator->stringToIdentity("uoet"));
    adapter->activate();
    TEST_READY
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
Beispiel #27
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(new InitialI(), communicator->stringToIdentity("initial"));
    adapter->activate();
    TEST_READY
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
Beispiel #28
0
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test"));
    adapter->activate();

    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
void
IGFaceDetectorIceServiceI::start(const string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args)
{
    _adapter = communicator->createObjectAdapter("IGFaceDetectorIce-" + name);

    
    string helloIdentity = communicator->getProperties()->getProperty("IGFaceDetectorIce.Identity");

    IGFaceDetector::IGFaceDetectorIcePtr hello = new IGFaceDetectorIceI(name);
    _adapter->add(hello, communicator->stringToIdentity(helloIdentity));
    _adapter->activate();
}
Beispiel #30
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectPtr object = ICE_MAKE_SHARED(InitialI, adapter);
    adapter->add(object, communicator->stringToIdentity("initial"));
    adapter->activate();
    TEST_READY
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}