| Abstract First Steps XML Network Interface Java Doc Real World Example FAQ Download Contact |
| A: | Yes, the Apache License, Version 2.0 allows this. There is no license fee to pay. |
| 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());
}
}
|
| 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(...)
|
| A: | See Contact |
| A: | See http://forge.ow2.org/projects/javaservice/ and http://javaservice.ow2.org/js_doc_frame.html. |
| 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 ... |