1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
// **********************************************************************
//
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#include <Ice/Initialize.h>
#include <Ice/Instance.h>
#include <Ice/ProtocolPluginFacade.h>
#include <Ice/EndpointFactoryManager.h>
#include <PluginI.h>
#include <EndpointFactory.h>
using namespace std;
class TestPluginI : public PluginI
{
public:
TestPluginI(const Ice::CommunicatorPtr&);
virtual void initialize();
virtual void destroy();
virtual ConfigurationPtr getConfiguration();
private:
const Ice::CommunicatorPtr _communicator;
const ConfigurationPtr _configuration;
};
//
// Plugin factory function.
//
extern "C"
{
ICE_DECLSPEC_EXPORT Ice::Plugin*
createTestTransport(const Ice::CommunicatorPtr& communicator, const string& name, const Ice::StringSeq& args)
{
return new TestPluginI(communicator);
}
}
TestPluginI::TestPluginI(const Ice::CommunicatorPtr& communicator) :
_communicator(communicator),
_configuration(new Configuration())
{
}
void
TestPluginI::initialize()
{
IceInternal::ProtocolPluginFacadePtr facade = IceInternal::getProtocolPluginFacade(_communicator);
for(Ice::Short s = 0; s < 100; ++s)
{
IceInternal::EndpointFactoryPtr factory = facade->getEndpointFactory(s);
if(factory)
{
facade->addEndpointFactory(new EndpointFactory(factory));
}
}
}
void
TestPluginI::destroy()
{
}
ConfigurationPtr
TestPluginI::getConfiguration()
{
return _configuration;
}
|