powered by Jive Software

Fastpath configuration w/o admin console

I’m trying the configure fastpath and openfire automaticly with MySQL triggers, but…

I’ve already achieved the agent creation.

But the workgroup creation is proving to be difficult.

I’ve only got to see the new workgroup inserted on the fpWorkgroup table by restarting openfire (but this is not a possibility to me as I want to hotchange the groups w/o affecting others).

Any idea? (I’m thinking of dropping the mysql trigger idea and go for a monitoring java program that detects changes and perform the necessary http petitions to Fastpath’s JSPs)

Already got by using http petitions to the JSPs by using Apache httpcomponents (posting the basic code hoping someone can find it useful.)

//Client configuration

DefaultHttpClient httpclient = new DefaultHttpClient();

//haven’t tested other values

httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY, “compatibility”);


 HttpPost httpost = new HttpPost("[http://urlOpenfire:9090/login.jsp](http://urlOpenfire:9090/login.jsp)");

List nvps = new ArrayList();

nvps.add(new BasicNameValuePair(“username”, “admin”));

nvps.add(new BasicNameValuePair(“password”, “pass”));

nvps.add(new BasicNameValuePair(“login”, “true”));

httpost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8));

HttpResponse response = httpclient.execute(httpost);


//Create group

    httpost = new HttpPost("[http://urlOpenfire:9090/plugins/fastpath/workgroup-create.jsp](http://urlOpenfire:9090/plugins/fastpath/workgroup-create.jsp)");

nvps = new ArrayList();

nvps.add(new BasicNameValuePair(“create”, “1”));

nvps.add(new BasicNameValuePair(“wgName”, “coolApacheTest”));

nvps.add(new BasicNameValuePair(“description”, “cool test”));

nvps.add(new BasicNameValuePair(“agents”, “iAmCool”));

httpost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8));

response = httpclient.execute(httpost);


// Error handling

boolean found = false;

for (Header h : response.getAllHeaders()) {

if (h.getName().equals(“Location”)) {

if (h.getValue().indexOf(“success”) >= 0) {

found = true;






if (!found) {

System.out.println(“The group was not created”);

InputStream is = response.getEntity().getContent();

BufferedReader read = new BufferedReader(new InputStreamReader(is));

String line = “”;

StringBuffer sb = new StringBuffer();

while ((line = read.readLine()) != null) {




String xml = sb.toString();

xml = xml.substring(xml.indexOf("<div class=“jive-error”));

xml = xml.substring(0, xml.indexOf("") + “”.length());


StringReader reader = new StringReader(xml);

InputSource inputSource = new InputSource(reader);

Document doc = null;

try {

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder parser = factory.newDocumentBuilder();

// Crear documento a partir de la fuente de datos del string XML

doc = parser.parse(inputSource);

NodeList nl = doc.getElementsByTagName(“td”);

for (int nli = 0; nli < nl.getLength(); nli++) {

Node n = nl.item(nli);

if (n.getAttributes().getNamedItem(“class”).getNodeValue().equals("jive-icon-label ")) {

System.out.println(“Cause:”+n.getChildNodes().item(0).getNodeValue().trim().toS tring());



} catch (Exception e) {




// logout

    HttpGet logoutPet = new HttpGet("[http://urlOpenfire:9090/index.jsp?logout=true](http://urlOpenfire:9090/index.jsp?logout=true)");

response = httpclient.execute(logoutPet);