Пример #1
1
void
Server::run(int argc, char** argv)
{
#ifdef ICE_STATIC_LIBS
    Ice::registerIceDiscovery();
#endif

    Ice::CommunicatorHolder communicator = initialize(argc, argv);
    Ice::PropertiesPtr properties = communicator->getProperties();

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

    properties->setProperty("ControlAdapter.Endpoints", getTestEndpoint(num));

    {
        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), Ice::stringToIdentity(os.str()));
    }
    adapter->activate();

    serverReady();

    communicator->waitForShutdown();
}
Пример #2
1
void
Server::run(int argc, char** argv)
{
    setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI));
    setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI));
    Ice::CommunicatorHolder communicator = initialize(argc, argv);
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("TEST"));
    adapter->add(ICE_MAKE_SHARED(Test1::WstringClassI), Ice::stringToIdentity("WSTRING1"));
    adapter->add(ICE_MAKE_SHARED(Test2::WstringClassI), Ice::stringToIdentity("WSTRING2"));

    adapter->activate();
    serverReady();
    communicator->waitForShutdown();
}
Пример #3
1
void
Server::run(int argc, char** argv)
{
    Ice::PropertiesPtr properties = createTestProperties(argc, argv);

#if TARGET_OS_IPHONE != 0
    //
    // COMPILERFIX: Disable connect timeout introduced for
    // workaround to iOS device hangs when using SSL
    //
    properties->setProperty("Ice.Override.ConnectTimeout", "");
#endif

    //
    // This test kills connections, so we don't want warnings.
    //
    properties->setProperty("Ice.Warn.Connections", "0");

    //
    // The client sends large messages to cause the transport
    // buffers to fill up.
    //
    properties->setProperty("Ice.MessageSizeMax", "20000");

    //
    // Limit the recv buffer size, this test relies on the socket
    // send() blocking after sending a given amount of data.
    //
    properties->setProperty("Ice.TCP.RcvSize", "50000");

    Ice::CommunicatorHolder communicator = initialize(argc, argv, properties);

    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
    communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
    communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(TimeoutI), Ice::stringToIdentity("timeout"));
    adapter->activate();

    Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
    controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
    controllerAdapter->activate();

    serverReady();
    communicator->waitForShutdown();
}
Пример #4
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(ICE_MAKE_SHARED(TestIntfI,communicator), Ice::stringToIdentity("TEST"));
    adapter->add(ICE_MAKE_SHARED(Test1::WstringClassI), Ice::stringToIdentity("WSTRING1"));
    adapter->add(ICE_MAKE_SHARED(Test2::WstringClassI), Ice::stringToIdentity("WSTRING2"));

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

    return EXIT_SUCCESS;
}
Пример #5
0
void
RegistryI::setupNullPermissionsVerifier(const Ice::ObjectAdapterPtr& registryAdapter)
{
    Identity nullPermVerifId;
    nullPermVerifId.category = _instanceName;
    nullPermVerifId.name = "NullPermissionsVerifier";
    _nullPermissionsVerifier = Glacier2::PermissionsVerifierPrx::uncheckedCast(
        registryAdapter->add(new NullPermissionsVerifierI(), nullPermVerifId)->ice_collocationOptimized(true));

    Identity nullSSLPermVerifId;
    nullSSLPermVerifId.category = _instanceName;
    nullSSLPermVerifId.name = "NullSSLPermissionsVerifier";
    _nullSSLPermissionsVerifier = Glacier2::SSLPermissionsVerifierPrx::uncheckedCast(
        registryAdapter->add(new NullSSLPermissionsVerifierI(), nullSSLPermVerifId)->ice_collocationOptimized(true));
}
Пример #6
0
int YKTServer::run( int argc, char* argv[] )
{
  Ice::PropertiesPtr properties = communicator()->getProperties();

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

  Ice::Identity id = communicator()->stringToIdentity( properties->getProperty("Identity") );
  transfer::CallServerPtr callserver = new Server(_currentCtx);
  //adapter->add( new Server( _currentCtx ),  );
  adapter->add( callserver, id );

  adapter->activate();

  //Ice::PropertiesPtr prop = communicator()->getProperties();
  string port = properties->getPropertyWithDefault( "queue.port", "10010" );
  string maxcount = properties->getPropertyWithDefault( "queue.processcount", "5" );

  std::size_t iport = atoi( port.c_str() );
  std::size_t imax = atoi( maxcount.c_str() );

  queue_manager_inst::get()->update_properties( properties );
  LOG(INFO,"start signal handler");
  signal(SIGINT,signal_handler);
  signal(SIGTERM,signal_handler);//kill 命令的捕获
  if( queue_manager_inst::get()->start( iport ) )
  {
    return -1;
  }
  communicator()->waitForShutdown();
  queue_manager_inst::get()->stop();
  return EXIT_SUCCESS;
}
Пример #7
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;
}
Пример #8
0
    virtual int
    run(int argc, char* argv[])
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties();
        initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");

        loadConfig(initData.properties);
        initData.logger = getLogger();
        setCommunicator(Ice::initialize(argc, argv, initData));

        Ice::ObjectFactoryPtr factory = new MyObjectFactory;
        communicator()->addObjectFactory(factory, "::Test::I");
        communicator()->addObjectFactory(factory, "::Test::J");
        communicator()->addObjectFactory(factory, "::Test::H");

        Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
        InitialPtr initial = new InitialI(adapter);
        adapter->add(initial, communicator()->stringToIdentity("initial"));
        adapter->activate();

#ifndef _WIN32_WCE
        communicator()->waitForShutdown();
#endif

        return EXIT_SUCCESS;
    }
Пример #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;
}
Пример #10
0
void
ServiceI::start(const string& name, const CommunicatorPtr& communicator, const StringSeq& args)
{
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name + "OA");
    adapter->add(new TestI(args), communicator->stringToIdentity("test"));
    adapter->activate();
}
Пример #11
0
DetectorPrx initIceConnection(const std::string& detectorNameStr,
                              Ice::Identity& det_cb,
                              DetectorCallbackHandlerPtr cr)
{
  
  initIce(detectorNameStr);
  
  Ice::PropertiesPtr props = iceComm->getProperties();
  std::string proxStr = detectorNameStr + ".Proxy";
  DetectorPrx detector = NULL;
  try
  {
  
    detector = DetectorPrx::checkedCast(
        iceComm->propertyToProxy(proxStr)->ice_twoway());
  }
  catch (const IceUtil::NullHandleException& e)
  {
    localAndClientMsg( VLogger::ERROR, NULL, "Invalid proxy: '%s'. %s\n", 
                       detectorNameStr.c_str(), e.what());
    return NULL;
  }

  Ice::ObjectAdapterPtr adapter = iceComm->createObjectAdapter("");
  det_cb.name = IceUtil::generateUUID();
  det_cb.category = "";
  adapter->add(cr, det_cb);
  adapter->activate();
  detector->ice_getConnection()->setAdapter(adapter);    
  
  // note that we need an ObjectAdapter to permit bidirectional communication
  // if we want to get past firewalls without Glacier2
  
  return detector;  // Success
}
Пример #12
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;
}
Пример #13
0
int
CallbackServer::run(int argc, char* argv[])
{
    if(argc > 1)
    {
        cerr << appName() << ": too many arguments" << endl;
        return EXIT_FAILURE;
    }

    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Server");
    CallbackSenderIPtr sender = new CallbackSenderI(communicator());
    adapter->add(sender, communicator()->stringToIdentity("sender"));
    adapter->activate();

    sender->start();
    try
    {
        communicator()->waitForShutdown();
    }
    catch(...)
    {
        sender->destroy();
        throw;
    }
    sender->destroy();

    return EXIT_SUCCESS;
}
Пример #14
0
    virtual int
    run(int argc, char* argv[])
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties();
        initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");

        loadConfig(initData.properties);
        initData.logger = getLogger();
        setCommunicator(Ice::initialize(argc, argv, initData));

        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();

#ifndef _WIN32_WCE
        communicator()->waitForShutdown();
#endif

        return EXIT_SUCCESS;
    }
Пример #15
0
        /**
         * Главная процедура
         **/
        virtual int run(int, char* [])
        {
            // Получаем адаптер
            Ice::ObjectAdapterPtr adapter = 
                communicator()->createObjectAdapterWithEndpoints("MaximaWorkerAdapter", "default -p 31337");

            //И регистриуем наш объект
            Ice::ObjectPtr object = new MaximaWorkerImpl();
            Ice::ObjectPrx objPrx = adapter->add(object, communicator()->stringToIdentity("MaximaWorker"));
            adapter->activate();

            //Получаем объект диспетчера
            //TODO: приделать сюда указание хоста.
            Ice::ObjectPrx obj = 
                communicator()->stringToProxy("MaximaDispatcher:default -p 31338");
            MaximaLib::MaximaDispatcherPrx disp = MaximaLib::MaximaDispatcherPrx::checkedCast(obj);

            if(!disp)
                throw "Wrong disp";

            // Регистриуемся в диспетчере
            MaximaLib::MaximaWorkerPrx wrkPrx = MaximaLib::MaximaWorkerPrx::uncheckedCast(objPrx);
            disp->registerWorker(wrkPrx);
 
            // Продожаем работать, пока нас не прервут.
            communicator()->waitForShutdown();
        }
Пример #16
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;
}
Пример #17
0
bool
RegistryI::setupUserAccountMapper(const Ice::ObjectAdapterPtr& registryAdapter)
{
    Ice::PropertiesPtr properties = _communicator->getProperties();

    //
    // Setup file user account mapper object if the property is set.
    //
    string userAccountFileProperty = properties->getProperty("IceGrid.Registry.UserAccounts");
    if(!userAccountFileProperty.empty())
    {
        try
        {
            Identity mapperId;
            mapperId.category = _instanceName;
            mapperId.name = "RegistryUserAccountMapper";
            if(!_master)
            {
                mapperId.name += "-" + _replicaName;
            }
            registryAdapter->add(new FileUserAccountMapperI(userAccountFileProperty), mapperId);
            _wellKnownObjects->add(registryAdapter->createProxy(mapperId), UserAccountMapper::ice_staticId());
        }
        catch(const std::string& msg)
        {
            Error out(_communicator->getLogger());
            out << msg;
            return false;
        }
    }
    return true;
}
Пример #18
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;
}
Пример #19
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.
}
Пример #20
0
bool MyService::start(int argc, char* argv[]) {
	_adapter = communicator()->createObjectAdapterWithEndpoints(SVRADAPTER,URL);
	Ice::ObjectPtr object = new UserI;
	plogger = communicator()->getLogger();
	_adapter->add(object, communicator()->stringToIdentity(SVRID));
	_adapter->activate();
	return true;
}
Пример #21
0
QueryPrx
RegistryI::setupQuery(const Ice::ObjectAdapterPtr& clientAdapter)
{
    Identity queryId;
    queryId.category = _instanceName;
    queryId.name = "Query";
    return QueryPrx::uncheckedCast(clientAdapter->add(new QueryI(_communicator, _database), queryId));
}
Пример #22
0
 virtual int run(int, char*[])
 {
     Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PermissionsVerifier");
     adapter->add(new PermissionsVerifierI, communicator()->stringToIdentity("PermissionsVerifier"));
     adapter->activate();
     communicator()->waitForShutdown();
     return EXIT_SUCCESS;
 }
Пример #23
0
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;
}
Пример #24
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;
}
Пример #25
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;
}
Пример #26
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 << "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;
}
Пример #27
0
void
RegistryI::setupAdminSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter, 
                                    const Ice::ObjectAdapterPtr& sessionManagerAdapter,
                                    const IceGrid::LocatorPrx& locator,
                                    bool nowarn)
{
    assert(_reaper);
    _adminSessionFactory = new AdminSessionFactory(sessionManagerAdapter, _database, _reaper, this);

    if(sessionManagerAdapter)
    {
        Identity adminSessionMgrId;
        adminSessionMgrId.category = _instanceName;
        adminSessionMgrId.name = "AdminSessionManager";
        Identity sslAdmSessionMgrId;
        sslAdmSessionMgrId.category = _instanceName;
        sslAdmSessionMgrId.name = "AdminSSLSessionManager";
        if(!_master)
        {
            adminSessionMgrId.name += "-" + _replicaName;
            sslAdmSessionMgrId.name += "-" + _replicaName;
        }

        sessionManagerAdapter->add(new AdminSessionManagerI(_adminSessionFactory), adminSessionMgrId);
        sessionManagerAdapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslAdmSessionMgrId);
        
        _wellKnownObjects->add(sessionManagerAdapter->createProxy(adminSessionMgrId), 
                               Glacier2::SessionManager::ice_staticId());
        _wellKnownObjects->add(sessionManagerAdapter->createProxy(sslAdmSessionMgrId), 
                               Glacier2::SSLSessionManager::ice_staticId());
    }

    Ice::PropertiesPtr properties = _communicator->getProperties();

    _adminVerifier = getPermissionsVerifier(registryAdapter,
                                            locator,
                                            "IceGrid.Registry.AdminPermissionsVerifier",
                                            properties->getProperty("IceGrid.Registry.AdminCryptPasswords"),
                                            nowarn);

    _sslAdminVerifier =
        getSSLPermissionsVerifier(locator, 
                                  "IceGrid.Registry.AdminSSLPermissionsVerifier", 
                                  nowarn);
}
Пример #28
0
int
run(int, char**, const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& observer)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics"));
    //adapter->activate(); // Don't activate OA to ensure collocation is used.

    communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1));
    Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
    controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
    //controllerAdapter->activate(); // Don't activate OA to ensure collocation is used.

    MetricsPrxPtr allTests(const Ice::CommunicatorPtr&, const CommunicatorObserverIPtr&);
    MetricsPrxPtr metrics = allTests(communicator, observer);
    metrics->shutdown();
    return EXIT_SUCCESS;
}
Пример #29
0
//-----------------------------------------------------------------------------
//  Proxy Start-up
//-----------------------------------------------------------------------------
bool mtsManagerProxyClient::StartProxy(mtsManagerLocal * proxyOwner)
{
    // Initialize Ice object
    IceInitialize();

    if (!InitSuccessFlag) {
        LogError(mtsManagerProxyClient, "ICE proxy client initialization failed");
        return false;
    }

    // Client configuration for bidirectional communication
    Ice::ObjectAdapterPtr adapter = IceCommunicator->createObjectAdapter("");
    Ice::Identity id;
    id.name = GetIceGUID();
    id.category = "";

    mtsManagerProxy::ManagerClientPtr client =
        new ManagerClientI(IceCommunicator, IceLogger, ManagerServerProxy, this);
    adapter->add(client, id);
    adapter->activate();
    ManagerServerProxy->ice_getConnection()->setAdapter(adapter);

    // Set an implicit context (per proxy context)
    IceCommunicator->getImplicitContext()->put(
        mtsManagerProxyServer::GetConnectionIDKey(), IceCommunicator->identityToString(id));

    // Set proxy owner and name of this proxy object
    SetProxyOwner(proxyOwner);

    // Connect to server proxy through adding this ICE proxy to server proxy
    if (!ManagerServerProxy->AddClient(GetProxyName(), id)) {
        LogError(mtsManagerProxyClient, "AddClient() failed: duplicate proxy name or identity");
        return false;
    }

    // Thread arguments for a worker thread
    ThreadArgumentsInfo.Proxy = this;
    ThreadArgumentsInfo.Runner = mtsManagerProxyClient::Runner;

    // Set a short name of this thread as "MPC" (Manager Proxy Client) to meet
    // the requirement that some of operating system have -- only a few characters
    // can be used as a thread name (e.g. Linux RTAI)
    std::stringstream ss;
    ss << "MPC" << mtsManagerProxyClient::InstanceCounter++;
    std::string threadName = ss.str();

    // Create worker thread (will get started later)
    WorkerThread.Create<ProxyWorker<mtsManagerLocal>, ThreadArguments<mtsManagerLocal>*>(
        &ProxyWorkerInfo, &ProxyWorker<mtsManagerLocal>::Run, &ThreadArgumentsInfo, threadName.c_str());

#if IMPROVE_ICE_THREADING
    // Wait for Ice thread to start
    IceThreadInitEvent->Wait();
#endif

    return true;
}
Пример #30
0
void
Filesystem::NodeI::activate(const Ice::ObjectAdapterPtr& a)
{
    NodePrx thisNode = NodePrx::uncheckedCast(a->add(this, _id));
    if(_parent)
    {
        _parent->addChild(thisNode);
    }
}