Archived

This forum has been archived. Please start a new discussion on GitHub.

How to add/start/stop/remove a node by AdminSession?

Hi,
I run ICE in a simple mode: Regitry + Grid node, no IceBox, no Replica.

Few days ago I asked a question about service management in node, now I can add a new service to an existing node by AdminSession. After that I try to register a new node by AdminSession like this, the 'emptyApp' has no service:
`session = registry.createAdminSession("foo", "bar");

        AdminPrx admin = session.getAdmin();

        //init myApp
        ApplicationDescriptor myApp = new ApplicationDescriptor();
        myApp.name = "emptyApp";

        //init myNode
        NodeDescriptor myNode = new com.zeroc.IceGrid.NodeDescriptor();
        com.zeroc.IceGrid.PropertySetDescriptor  propertySet = new com.zeroc.IceGrid.PropertySetDescriptor();
        propertySet.properties = new ArrayList<>();
        propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("Ice.Default.Locator", "EchoIceGrid/Locator:tcp -p 4061"));
        propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("IceGrid.Node.Endpoints", "tcp"));
        propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("IceGrid.Node.Name", "myTestNode"));
        propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("IceGrid.Node.Data", "deploy/lmdb/myTestNode"));
        propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("IceGrid.Node.Output", "deploy/lmdb/myTestNode/log"));

        myNode.propertySets = new HashMap<String, com.zeroc.IceGrid.PropertySetDescriptor>();
        myNode.propertySets.put(nodeName, propertySet);

        //add myNode to myApp
        myApp.nodes = new HashMap<String, com.zeroc.IceGrid.NodeDescriptor>();
        myApp.nodes.put(nodeName, myNode);

        //add myApp to admin
        admin.addApplication(myApp);`

It seems to work fine, the IceGridGUI can show this new node, but this node is not running. I notice the admin has a func 'getNodeAdmin()', it looks like it can do something about node, but unfortunately it can't.
So I have another quesiton: how to add (start, stop, remove) a new node by AdminSession?
Thanks.

Comments