Archived
This forum has been archived. Please start a new discussion on GitHub.
How to use IceGrid and IcePatch2 in a Project
Hi
I have a problem to ask for help. Although I have found a solution,but I think this is not the official way to solve my problem.
I want to use IcePatch2 to download files from the server, and server is activate by IceGridRegistry. There is only a "Ice.Default.Locator" property in the communicator to Locat the server.IcePatch2 needs "Endpoints" property to find the server and I don't know the server's IP,port property except the Registry's locator property .
I download Ice3.4.0 in the Source Distributions. I modified Ice's source code in the C:\Ice-3.4.0\cpp\src\IcePatch2Lib\ClientUtil.cpp. Please notice the red marked section.
It worked after I modified the source code. And client's comunicator only have a Locator property without Endpoints.
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);
}
I have a problem to ask for help. Although I have found a solution,but I think this is not the official way to solve my problem.
I want to use IcePatch2 to download files from the server, and server is activate by IceGridRegistry. There is only a "Ice.Default.Locator" property in the communicator to Locat the server.IcePatch2 needs "Endpoints" property to find the server and I don't know the server's IP,port property except the Registry's locator property .
I download Ice3.4.0 in the Source Distributions. I modified Ice's source code in the C:\Ice-3.4.0\cpp\src\IcePatch2Lib\ClientUtil.cpp. Please notice the red marked section.
It worked after I modified the source code. And client's comunicator only have a Locator property without Endpoints.
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);
}
0
Comments
-
Hi Jiant Tao,
This appears to be a limitation of icepatch2client. Thank you for bringing this to our attention.
Best regards,
Bernard0