beautypg.com

Adding a gsa unification node, Retrieving a node configuration, Retrieving all node configurations – Google Search Appliance Administrative API Developers Guide: Java User Manual

Page 49

background image

Google Search Appliance: Administrative API Developer’s Guide: Java

49

Adding a GSA Unification Node

Add a GSA Unification node as follows:

// Create an entry to hold properties to insert
GsaEntry insertEntry = new GsaEntry();
insertEntry.setId(entryUrl);

// In the following example code, add a secondary
// node with arbitrary values for the various settings.
// Add properties to insertEntry
insertEntry.addGsaContent("entryID", "node_appliance_id");
insertEntry.addGsaContent("nodeType", "SECONDARY");
insertEntry.addGsaContent("federationNetworkIP", "10.0.0.2");
insertEntry.addGsaContent("secretToken", "token");
insertEntry.addGsaContent("hostname", "corp.domain.x.com");
insertEntry.addGsaContent("scoringBias", "20");

// Send the request
myClient.insertEntry("federation", insertEntry);

Retrieving a Node Configuration

Retrieve the configuration information for a GSA Unification node as follows:

// Send a request and print the response
GsaEntry myEntry = myClient.getEntry("federation", "applianceId");
String type = myEntry.getGsaContent("nodeType");
System.out.println("Node Type: " + type);
System.out.println("GSA Unification Network IP: " +

myEntry.getGsaContent("federationNetworkIP"));

System.out.println("Host Name: " + myEntry.getGsaContent("hostname"));
System.out.println("Secret Token: " + myEntry.getGsaContent("secretToken"));
System.out.println("Scoring Bias: " + myEntry.getGsaContent("scoringBias"));

if (type.equals("SECONDARY")) {

System.out.println("Remote Front End: " +

myEntry.getGsaContent("remoteFrontend"));

System.out.println("Node Timeout: " + myEntry.getGsaContent("slaveTimeout"));

}

if (type.equals("PRIMARY") || type.equals("PRIMARY_AND_SECONDARY")) {

System.out.println("Secondary Nodes: " +

myEntry.getGsaContent("secondaryNodes"));

}

Retrieving All Node Configurations

Retrieve information on all GSA Unification nodes as follows:

// Send the request and print the response
GsaFeed myFeed = myClient.getFeed("federation");

for (GsaEntry gsaEntry : myFeed.getEntries()) {

// Process each entry

}