IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFeedbackPtr& feedback) :
_feedback(feedback),
_dataDir(communicator->getProperties()->getPropertyWithDefault("IcePatch2.Directory", ".")),
_thorough(communicator->getProperties()->getPropertyAsInt("IcePatch2.Thorough") > 0),
_chunkSize(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.ChunkSize", 100)),
_remove(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.Remove", 1)),
_log(0)
{
PropertiesPtr properties = communicator->getProperties();
const char* endpointsProperty = "IcePatch2.Endpoints";
string endpoints = properties->getProperty(endpointsProperty);
ObjectPrx serverBase;
Identity id;
id.category = properties->getPropertyWithDefault("IcePatch2.InstanceName", "IcePatch2");
id.name = "server";
if(endpoints.empty())
serverBase = communicator->stringToProxy("\"" + communicator->identityToString(id) + "\" ");
else
serverBase = communicator->stringToProxy("\"" + communicator->identityToString(id) + "\" :" + endpoints);
FileServerPrx server = FileServerPrx::checkedCast(serverBase);
if(!server)
{
throw "proxy `" + communicator->identityToString(id) + ':' + endpoints + "' is not a file server.";
}
init(server);
}