Archived
This forum has been archived. Please start a new discussion on GitHub.
Udpate an IceGrid configuration
Hello !
I am developping an application which use IceGrid. I would like to be able to update the IceGrid configuration, without change manually the XML file. I would like that my application do this automatically (throws command automatically) ? Is that possible ?
For exemple to create a new replica-group, a new serveur template with an adaptor... just with icegridadmin commands.
I read the "administration utilities" in the documentation but I didn't see commands for add objects, just for list and update them.
I discover the IceGridGUI.jar tool, it is possible to do all what I want ! But it is not automatisable, it is a GUI.
The third solution is to developp a tool which will update the XML file and than throw the command icegridadmin "application update file.xml", but it is not so practical.
What solutions are feasible and the best ? Is there any other solution ?
Thank you for your help !
Cheers,
Matthieu
Here my initial XML file :
<icegrid>
<application name="Simple">
<replica-group id="Rserv_point">
<load-balancing type="adaptive"/>
<object identity="affpoint" type="::Demo::Caracteristique"/>
</replica-group>
<server-template id="templ_point">
<parameter name="index"/>
<parameter name="exepath" default="java"/>
<server id="serv_point${index}" exe="${exepath}" activation="on-demand">
<option>Serverpoint</option>
<property name="Ice.MessageSizeMax" value="1000000000"/>
<adapter name="Aserv_point" endpoints="tcp" register-process="true" replica-group="Rserv_point"/>
</server>
</server-template>
<node name="node_serv_point_1">
<server-instance template="templ_point" index="1" exepath="java"/>
</node>
<node name="node_serv_point_2">
<server-instance template="templ_point" index="2" exepath="java"/>
</node>
</application>
</icegrid>
I am developping an application which use IceGrid. I would like to be able to update the IceGrid configuration, without change manually the XML file. I would like that my application do this automatically (throws command automatically) ? Is that possible ?
For exemple to create a new replica-group, a new serveur template with an adaptor... just with icegridadmin commands.
I read the "administration utilities" in the documentation but I didn't see commands for add objects, just for list and update them.
I discover the IceGridGUI.jar tool, it is possible to do all what I want ! But it is not automatisable, it is a GUI.
The third solution is to developp a tool which will update the XML file and than throw the command icegridadmin "application update file.xml", but it is not so practical.
What solutions are feasible and the best ? Is there any other solution ?
Thank you for your help !
Cheers,
Matthieu
Here my initial XML file :
<icegrid>
<application name="Simple">
<replica-group id="Rserv_point">
<load-balancing type="adaptive"/>
<object identity="affpoint" type="::Demo::Caracteristique"/>
</replica-group>
<server-template id="templ_point">
<parameter name="index"/>
<parameter name="exepath" default="java"/>
<server id="serv_point${index}" exe="${exepath}" activation="on-demand">
<option>Serverpoint</option>
<property name="Ice.MessageSizeMax" value="1000000000"/>
<adapter name="Aserv_point" endpoints="tcp" register-process="true" replica-group="Rserv_point"/>
</server>
</server-template>
<node name="node_serv_point_1">
<server-instance template="templ_point" index="1" exepath="java"/>
</node>
<node name="node_serv_point_2">
<server-instance template="templ_point" index="2" exepath="java"/>
</node>
</application>
</icegrid>
0
Comments
-
Bonjour Matthieu,
You can use the same API as the IceGridGUI: the IceGrid::Admin interface defined in slice/IceGrid/Admin.ice. To get a proxy on the IceGrid::Admin interface, you need to create an administrative session with IceGrid (see here for information on how to do this).
You can add/update/delete your IceGrid application using the addApplication/updateApplication/removeApplication methods of the IceGrid::Admin interface. These methods use a number of Slice descriptors defined in slice/IceGrid/Descriptor.ice to describe the updates to apply to an application or to create a new application. You should be able to add/update/remove replica groups, well-known objects using these descriptors.
Cheers,
Benoit.0 -
Oh, wonderful !!
That's exactly what I was looking for !
Thank you, Benoit !
Cheers,
Matthieu0 -
Hello !!
I tried to create an administration session...
#include <IceUtil/IceUtil.h>
#include <Ice/Ice.h>
#include <IceGrid/IceGrid.h>
#include <IceGrid/Admin.h>
#include <IceGrid/Session.h>
#include <string>
int main()
{
Ice::ObjectPrx base =communicator->stringToProxy("DemoIceGrid:tcp -p 12000");
IceGrid::RegistryPrx registry =IceGrid::RegistryPrx::checkedCast(base);
string username = "foo";
string password = "bar";
IceGrid::AdminSessionPrx session;
try {
session = registry->createAdminSession(username, password);
} catch (const IceGrid::PermissionDeniedException & ex) {
cout << "permission denied:\n" << ex.reason << endl;
}
return 0;
}
That the source from the documentation... when I compiled I have an error because the compiler don't know the object "communicator", that's normal !
I tried, as on the server to replace the line with : Ice::ObjectPrx base =communicator()->stringToProxy("DemoIceGrid:tcp -p 12000");
Then I tried : Ice::ObjectPrx base = Ice::CommunicatorPtr()->stringToProxy("DemoIceGrid:tcp -p 12000");
It compiled, but at the execution there is a IceUtil::NullHandleException error...
Can you help me ?
Cheers,
Matthieu0 -
You need to create the communicator, which can you do by calling Ice::initialize, or you can avoid that be using Ice::Application. In this case, I'm afraid there is no substitute for reading the manual, and studying the demos. Please look at demo/Ice/minimal, or demo/Ice/hello for some simple demo.0