Commit e822aa62 authored by Spiros Koulouzis's avatar Spiros Koulouzis

Added properties

parent fb964b1c
No preview for this file type
No preview for this file type
jar.file.path=bin/ProvisioningCore.jar
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.uva.sne.drip.drip.provisioner.RPCServer /home/alogo/workspace/DRIP/drip-provisioner/etc/provisioner.properties</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.uva.sne.drip.drip.provisioner.RPCServer /home/alogo/workspace/DRIP/drip-provisioner/etc/provisioner.properties</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.uva.sne.drip.drip.provisioner.RPCServer /home/alogo/workspace/DRIP/drip-provisioner/etc/provisioner.properties</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
</actions>
......@@ -19,7 +19,10 @@ import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -31,9 +34,26 @@ import java.util.logging.Logger;
public class RPCServer {
private static final String RPC_QUEUE_NAME = "provisioner_queue";
private static final String HOST = "127.0.0.1";
private static String HOST = "127.0.0.1";
public static void main(String[] argv) {
Properties prop = new Properties();
if (argv.length >= 1) {
try {
prop.load(new FileInputStream(argv[0]));
} catch (IOException ex) {
Logger.getLogger(RPCServer.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
String resourceName = "provisioner.properies";
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try (InputStream resourceStream = loader.getResourceAsStream(resourceName)) {
prop.load(resourceStream);
} catch (IOException ex) {
Logger.getLogger(RPCServer.class.getName()).log(Level.SEVERE, null, ex);
}
}
HOST = prop.getProperty("rabbitmq.host", "127.0.0.1");
start();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment