pmonframe logo
  Abstract   First Steps   XML Network Interface   Java Doc   Real World Example   FAQ   Download   Contact  

Frequently Asked Questions (FAQ)

  1. Can I use pmonframe in a commercial (closed source) application?
  2. How complex is the smallest client program that I can write?
  3. How complex is the smallest server program that I can write?
  4. I've found a bug, where do I report it?
  5. How can I start a pmonframe server as a Windows Service?
  6. Can I place advertisement on the pmonframe website?
FAQ #1: Can I use pmonframe in a commercial (closed source) application?
A: Yes, the Apache License, Version 2.0 allows this. There is no license fee to pay.
 
FAQ #2: How complex is the smallest client program that I can write?
A:
import org.w3c.dom.Document;

import org.pmonframe.client.XMLClientRequest;
import org.pmonframe.client.HttpConnection;
import org.pmonframe.client.XMLGenericValueParser;
import org.pmonframe.client.GenericValueData;
import org.pmonframe.util.Lib;

public class Client {
  public static void main(String[] args) {
    String xmlRequest = XMLClientRequest.getLatestValuesSinceSeconds("CPU", 300);
    Document doc = HttpConnection.doRequestToServer("127.0.0.1", 39002, xmlRequest, false);
    XMLGenericValueParser valueParser = new XMLGenericValueParser(doc);
    GenericValueData[] values = valueParser.getValueData();
    for (int x = 0; x < values.length; x++)
      System.out.println(Lib.getDateAndTime(values[x].getTimestamp()) + "  " + values[x].getValue());
    }
  }
 
FAQ #3: How complex is the smallest server program that I can write?
A:
import org.pmonframe.server.HttpServer;
import org.pmonframe.data.MeasuringDataTree;
import org.pmonframe.data.MeasurementCollection;
import org.pmonframe.data.PercentValue;

public class Server extends HttpServer {

  public Server(String serverAbbreviation) {
    super(serverAbbreviation);
    }

  public Server(String serverAbbreviation, int serverPort) {
    super(serverAbbreviation, serverPort);
    }

  public static void main(String[] args) {
    Server server = new Server("TESTSRV", 39002);
    server.start();

    MeasuringDataTree dataTree = server.getMeasuringDataTree();
    MeasurementCollection cpuCollection = dataTree.createMeasurementCollection("CPU", "CPU Usage in Percent", "Percent", MeasurementCollection.DATA_TYPE_PERCENT_VALUE);

    server.markAsOperable(true);

    try {
      while (true) {
        PercentValue cpuValue = new PercentValue((float) Math.random() * 100.0f); // *
        cpuCollection.addValue(cpuValue);
        sleep(2000);
        }
      }
    catch (Exception e) {
      e.printStackTrace();
      }
    }
  }
// * must be replaced by code which collects real data. You may also use JNI or, if there is no other solution, java.lang.Runtime.exec(...)
 
FAQ #4: I've found a bug, where do I report it?
A: See Contact
 
FAQ #5: How can I start a pmonframe server as a Windows Service?
A: See http://forge.ow2.org/projects/javaservice/ and http://javaservice.ow2.org/js_doc_frame.html.
 
FAQ #6: Can I place advertisements on the pmonframe website?
A: No - but wait: YES! We do not accept normal advertisements; however, you can donate source code for other real world clients and servers, licensed under the Apache license or under the LGPL license. In such cases, we will publish on our website a link to your company or organization, and if you wish your contact information also.
Note: we accept source code on any topic; for example, collecting weather data, magnetic flux densities ...
 

© 2010 pmonframe.org     Licensed under the Apache License, Version 2.0
Unless required by applicable law or agreed to in writing, this web page is published on an "as is" basis, without warranties or conditions of any kind, either express or implied.