configurable asterix properties
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
index 1721666..9facf0a 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
@@ -41,7 +41,7 @@
public class EventDriver {
public static final String CLIENT_NODE_ID = "client_node";
- public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, "127.0.0.1", null, null, null, null, null, null);
+ public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, "127.0.0.1", null, null, null, null);
private static String eventsDir;
private static Events events;
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
index 6d89c88..39e1a2f 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
@@ -51,19 +51,21 @@
if (p.getKey().equals("JAVA_HOME")) {
String val = node.getJavaHome() == null ? p.getValue() : node.getJavaHome();
envBuffer.append(p.getKey() + "=" + val + " ");
- } else if (p.getKey().equals("JAVA_OPTS")) {
+ } else if (p.getKey().equals("NC_JAVA_OPTS") && !node.getId().equals(cluster.getMasterNode().getId())) {
StringBuilder builder = new StringBuilder();
builder.append("\"");
- String javaOpts = (node.getJavaOpts() == null ? cluster.getJavaOpts() : node.getJavaOpts());
+ String javaOpts = p.getValue();
if (javaOpts != null) {
builder.append(javaOpts);
}
- if (cluster.isDebugEnabled() != null && cluster.isDebugEnabled().booleanValue()) {
- BigInteger debugPort = node.getDebug() == null ? cluster.getDebug() : node.getDebug();
- if (debugPort != null) {
- builder.append("-Xdebug -Xrunjdwp:transport=dt_socket,address=" + debugPort.intValue()
- + "," + "server=y,suspend=n");
- }
+ builder.append("\"");
+ envBuffer.append(p.getKey() + "=" + builder + " ");
+ } else if (p.getKey().equals("CC_JAVA_OPTS") && node.getId().equals(cluster.getMasterNode().getId())) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("\"");
+ String javaOpts = p.getValue();
+ if (javaOpts != null) {
+ builder.append(javaOpts);
}
builder.append("\"");
envBuffer.append(p.getKey() + "=" + builder + " ");
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
index 0761c7f..81fabac 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
@@ -36,251 +36,230 @@
public class EventUtil {
- public static final String EVENTS_DIR = "events";
- public static final String CLUSTER_CONF = "config/cluster.xml";
- public static final String PATTERN_CONF = "config/pattern.xml";
- public static final DateFormat dateFormat = new SimpleDateFormat(
- "yyyy/MM/dd HH:mm:ss");
+ public static final String EVENTS_DIR = "events";
+ public static final String CLUSTER_CONF = "config/cluster.xml";
+ public static final String PATTERN_CONF = "config/pattern.xml";
+ public static final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
- private static final String IP_LOCATION = "IP_LOCATION";
- private static final String CLUSTER_ENV = "ENV";
- private static final String SCRIPT = "SCRIPT";
- private static final String ARGS = "ARGS";
- private static final String EXECUTE_SCRIPT = "events/execute.sh";
- private static final String LOCALHOST = "localhost";
- private static final String LOCALHOST_IP = "127.0.0.1";
+ private static final String IP_LOCATION = "IP_LOCATION";
+ private static final String CLUSTER_ENV = "ENV";
+ private static final String SCRIPT = "SCRIPT";
+ private static final String ARGS = "ARGS";
+ private static final String EXECUTE_SCRIPT = "events/execute.sh";
+ private static final String LOCALHOST = "localhost";
+ private static final String LOCALHOST_IP = "127.0.0.1";
- public static Cluster getCluster(String clusterConfigurationPath)
- throws JAXBException {
- File file = new File(clusterConfigurationPath);
- JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
- Unmarshaller unmarshaller = ctx.createUnmarshaller();
- Cluster cluster = (Cluster) unmarshaller.unmarshal(file);
- if (cluster.getMasterNode().getClusterIp().equals(LOCALHOST)) {
- cluster.getMasterNode().setClusterIp(LOCALHOST_IP);
- }
- for (Node node : cluster.getNode()) {
- if (node.getClusterIp().equals(LOCALHOST)) {
- node.setClusterIp(LOCALHOST_IP);
- }
- }
- return cluster;
- }
+ public static Cluster getCluster(String clusterConfigurationPath) throws JAXBException {
+ File file = new File(clusterConfigurationPath);
+ JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
+ Unmarshaller unmarshaller = ctx.createUnmarshaller();
+ Cluster cluster = (Cluster) unmarshaller.unmarshal(file);
+ if (cluster.getMasterNode().getClusterIp().equals(LOCALHOST)) {
+ cluster.getMasterNode().setClusterIp(LOCALHOST_IP);
+ }
+ for (Node node : cluster.getNode()) {
+ if (node.getClusterIp().equals(LOCALHOST)) {
+ node.setClusterIp(LOCALHOST_IP);
+ }
+ }
+ return cluster;
+ }
- public static long parseTimeInterval(ValueType v, String unit)
- throws IllegalArgumentException {
- int val = 0;
- switch (v.getType()) {
- case ABS:
- val = Integer.parseInt(v.getAbsoluteValue());
- break;
- case RANDOM_MIN_MAX:
- val = Randomizer.getInstance().getRandomInt(v.getMin(), v.getMax());
- break;
- case RANDOM_RANGE:
- String[] values = v.getRangeSet();
- val = Integer.parseInt(values[Randomizer.getInstance()
- .getRandomInt(0, values.length - 1)]);
- break;
- }
- return computeInterval(val, unit);
- }
+ public static long parseTimeInterval(ValueType v, String unit) throws IllegalArgumentException {
+ int val = 0;
+ switch (v.getType()) {
+ case ABS:
+ val = Integer.parseInt(v.getAbsoluteValue());
+ break;
+ case RANDOM_MIN_MAX:
+ val = Randomizer.getInstance().getRandomInt(v.getMin(), v.getMax());
+ break;
+ case RANDOM_RANGE:
+ String[] values = v.getRangeSet();
+ val = Integer.parseInt(values[Randomizer.getInstance().getRandomInt(0, values.length - 1)]);
+ break;
+ }
+ return computeInterval(val, unit);
+ }
- public static long parseTimeInterval(String v, String unit)
- throws IllegalArgumentException {
- int value = Integer.parseInt(v);
- return computeInterval(value, unit);
- }
+ public static long parseTimeInterval(String v, String unit) throws IllegalArgumentException {
+ int value = Integer.parseInt(v);
+ return computeInterval(value, unit);
+ }
- private static long computeInterval(int val, String unit) {
- int vmult = 1;
- if ("hr".equalsIgnoreCase(unit)) {
- vmult = 3600 * 1000;
- } else if ("min".equalsIgnoreCase(unit)) {
- vmult = 60 * 1000;
- } else if ("sec".equalsIgnoreCase(unit)) {
- vmult = 1000;
- } else
- throw new IllegalArgumentException(
- " invalid unit value specified for frequency (hr,min,sec)");
- return val * vmult;
+ private static long computeInterval(int val, String unit) {
+ int vmult = 1;
+ if ("hr".equalsIgnoreCase(unit)) {
+ vmult = 3600 * 1000;
+ } else if ("min".equalsIgnoreCase(unit)) {
+ vmult = 60 * 1000;
+ } else if ("sec".equalsIgnoreCase(unit)) {
+ vmult = 1000;
+ } else
+ throw new IllegalArgumentException(" invalid unit value specified for frequency (hr,min,sec)");
+ return val * vmult;
- }
+ }
- public static Event getEvent(Pattern pattern, Events events) {
- for (Event event : events.getEvent()) {
- if (event.getType().equals(pattern.getEvent().getType())) {
- return event;
- }
- }
- throw new IllegalArgumentException(" Unknown event type"
- + pattern.getEvent().getType());
- }
+ public static Event getEvent(Pattern pattern, Events events) {
+ for (Event event : events.getEvent()) {
+ if (event.getType().equals(pattern.getEvent().getType())) {
+ return event;
+ }
+ }
+ throw new IllegalArgumentException(" Unknown event type" + pattern.getEvent().getType());
+ }
- public static Node getEventLocation(Pattern pattern,
- List<Node> candidateLocations, Cluster cluster) {
- ValueType value = new ValueType(pattern.getEvent().getNodeid()
- .getValue());
- Node location = null;
- Type vtype = value.getType();
+ public static Node getEventLocation(Pattern pattern, List<Node> candidateLocations, Cluster cluster) {
+ ValueType value = new ValueType(pattern.getEvent().getNodeid().getValue());
+ Node location = null;
+ Type vtype = value.getType();
- switch (vtype) {
- case ABS:
- location = getNodeFromId(value.getAbsoluteValue(), cluster);
- break;
- case RANDOM_RANGE:
- int nodeIndex = Randomizer.getInstance().getRandomInt(0,
- candidateLocations.size() - 1);
- location = candidateLocations.get(nodeIndex);
- break;
- case RANDOM_MIN_MAX:
- throw new IllegalStateException(
- " Canont configure a min max value range for location");
- }
- return location;
+ switch (vtype) {
+ case ABS:
+ location = getNodeFromId(value.getAbsoluteValue(), cluster);
+ break;
+ case RANDOM_RANGE:
+ int nodeIndex = Randomizer.getInstance().getRandomInt(0, candidateLocations.size() - 1);
+ location = candidateLocations.get(nodeIndex);
+ break;
+ case RANDOM_MIN_MAX:
+ throw new IllegalStateException(" Canont configure a min max value range for location");
+ }
+ return location;
- }
+ }
- public static List<Node> getCandidateLocations(Pattern pattern,
- Cluster cluster) {
- ValueType value = new ValueType(pattern.getEvent().getNodeid()
- .getValue());
- List<Node> candidateList = new ArrayList<Node>();
- switch (value.getType()) {
- case ABS:
- candidateList.add(getNodeFromId(value.getAbsoluteValue(), cluster));
- break;
- case RANDOM_RANGE:
- boolean anyOption = false;
- String[] values = value.getRangeSet();
- for (String v : values) {
- if (v.equalsIgnoreCase("ANY")) {
- anyOption = true;
- }
- }
- if (anyOption) {
- for (Node node : cluster.getNode()) {
- candidateList.add(node);
- }
- } else {
- boolean found = false;
- for (String v : values) {
- for (Node node : cluster.getNode()) {
- if (node.getId().equals(v)) {
- candidateList.add(node);
- found = true;
- break;
- }
- }
- if (!found) {
- throw new IllegalStateException("Unknonw nodeId : " + v);
- }
- found = false;
- }
+ public static List<Node> getCandidateLocations(Pattern pattern, Cluster cluster) {
+ ValueType value = new ValueType(pattern.getEvent().getNodeid().getValue());
+ List<Node> candidateList = new ArrayList<Node>();
+ switch (value.getType()) {
+ case ABS:
+ candidateList.add(getNodeFromId(value.getAbsoluteValue(), cluster));
+ break;
+ case RANDOM_RANGE:
+ boolean anyOption = false;
+ String[] values = value.getRangeSet();
+ for (String v : values) {
+ if (v.equalsIgnoreCase("ANY")) {
+ anyOption = true;
+ }
+ }
+ if (anyOption) {
+ for (Node node : cluster.getNode()) {
+ candidateList.add(node);
+ }
+ } else {
+ boolean found = false;
+ for (String v : values) {
+ for (Node node : cluster.getNode()) {
+ if (node.getId().equals(v)) {
+ candidateList.add(node);
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ throw new IllegalStateException("Unknonw nodeId : " + v);
+ }
+ found = false;
+ }
- }
- String[] excluded = value.getRangeExcluded();
- if (excluded != null && excluded.length > 0) {
- List<Node> markedForRemoval = new ArrayList<Node>();
- for (String exclusion : excluded) {
- for (Node node : candidateList) {
- if (node.getId().equals(exclusion)) {
- markedForRemoval.add(node);
- }
- }
- }
- candidateList.removeAll(markedForRemoval);
- }
- break;
- case RANDOM_MIN_MAX:
- throw new IllegalStateException(
- " Invalid value configured for location");
- }
- return candidateList;
- }
+ }
+ String[] excluded = value.getRangeExcluded();
+ if (excluded != null && excluded.length > 0) {
+ List<Node> markedForRemoval = new ArrayList<Node>();
+ for (String exclusion : excluded) {
+ for (Node node : candidateList) {
+ if (node.getId().equals(exclusion)) {
+ markedForRemoval.add(node);
+ }
+ }
+ }
+ candidateList.removeAll(markedForRemoval);
+ }
+ break;
+ case RANDOM_MIN_MAX:
+ throw new IllegalStateException(" Invalid value configured for location");
+ }
+ return candidateList;
+ }
- private static Node getNodeFromId(String nodeid, Cluster cluster) {
- if (nodeid.equals(EventDriver.CLIENT_NODE.getId())) {
- return EventDriver.CLIENT_NODE;
- }
+ private static Node getNodeFromId(String nodeid, Cluster cluster) {
+ if (nodeid.equals(EventDriver.CLIENT_NODE.getId())) {
+ return EventDriver.CLIENT_NODE;
+ }
- if (nodeid.equals(cluster.getMasterNode().getId())) {
- String javaOpts = cluster.getMasterNode().getJavaOpts() == null ? cluster
- .getJavaOpts() : cluster.getMasterNode().getJavaOpts();
- String logDir = cluster.getMasterNode().getLogdir() == null ? cluster
- .getLogdir() : cluster.getMasterNode().getLogdir();
- String javaHome = cluster.getMasterNode().getJavaHome() == null ? cluster
- .getJavaHome() : cluster.getMasterNode().getJavaHome();
- BigInteger debug = cluster.getMasterNode().getDebug();
- return new Node(cluster.getMasterNode().getId(), cluster
- .getMasterNode().getClusterIp(), javaHome, javaOpts,
- logDir, null, null, debug);
- }
+ if (nodeid.equals(cluster.getMasterNode().getId())) {
+ String logDir = cluster.getMasterNode().getLogdir() == null ? cluster.getLogdir() : cluster.getMasterNode()
+ .getLogdir();
+ String javaHome = cluster.getMasterNode().getJavaHome() == null ? cluster.getJavaHome() : cluster
+ .getMasterNode().getJavaHome();
+ return new Node(cluster.getMasterNode().getId(), cluster.getMasterNode().getClusterIp(), javaHome, logDir,
+ null, null);
+ }
- List<Node> nodeList = cluster.getNode();
- for (Node node : nodeList) {
- if (node.getId().equals(nodeid)) {
- return node;
- }
- }
- StringBuffer buffer = new StringBuffer();
- buffer.append(EventDriver.CLIENT_NODE.getId() + ",");
- buffer.append(cluster.getMasterNode().getId() + ",");
- for (Node v : cluster.getNode()) {
- buffer.append(v.getId() + ",");
- }
- buffer.deleteCharAt(buffer.length() - 1);
- throw new IllegalArgumentException("Unknown node id :" + nodeid
- + " valid ids:" + buffer);
- }
+ List<Node> nodeList = cluster.getNode();
+ for (Node node : nodeList) {
+ if (node.getId().equals(nodeid)) {
+ return node;
+ }
+ }
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(EventDriver.CLIENT_NODE.getId() + ",");
+ buffer.append(cluster.getMasterNode().getId() + ",");
+ for (Node v : cluster.getNode()) {
+ buffer.append(v.getId() + ",");
+ }
+ buffer.deleteCharAt(buffer.length() - 1);
+ throw new IllegalArgumentException("Unknown node id :" + nodeid + " valid ids:" + buffer);
+ }
- public static void executeEventScript(Node node, String script,
- List<String> args, Cluster cluster) throws IOException,
- InterruptedException {
- List<String> pargs = new ArrayList<String>();
- pargs.add("/bin/bash");
- pargs.add(EventDriver.getEventsDir() + "/" + EXECUTE_SCRIPT);
- StringBuffer argBuffer = new StringBuffer();
- String env = EventDriver.getStringifiedEnv(cluster) + " " + IP_LOCATION
- + "=" + node.getClusterIp();
- if (args != null) {
- for (String arg : args) {
- argBuffer.append(arg + " ");
- }
- }
- ProcessBuilder pb = new ProcessBuilder(pargs);
- pb.environment().putAll(EventDriver.getEnvironment());
- pb.environment().put(IP_LOCATION, node.getClusterIp());
- pb.environment().put(CLUSTER_ENV, env);
- pb.environment().put(SCRIPT, script);
- pb.environment().put(ARGS, argBuffer.toString());
- pb.start();
- }
+ public static void executeEventScript(Node node, String script, List<String> args, Cluster cluster)
+ throws IOException, InterruptedException {
+ List<String> pargs = new ArrayList<String>();
+ pargs.add("/bin/bash");
+ pargs.add(EventDriver.getEventsDir() + "/" + EXECUTE_SCRIPT);
+ StringBuffer argBuffer = new StringBuffer();
+ String env = EventDriver.getStringifiedEnv(cluster) + " " + IP_LOCATION + "=" + node.getClusterIp();
+ if (args != null) {
+ for (String arg : args) {
+ argBuffer.append(arg + " ");
+ }
+ }
+ ProcessBuilder pb = new ProcessBuilder(pargs);
+ pb.environment().putAll(EventDriver.getEnvironment());
+ pb.environment().put(IP_LOCATION, node.getClusterIp());
+ pb.environment().put(CLUSTER_ENV, env);
+ pb.environment().put(SCRIPT, script);
+ pb.environment().put(ARGS, argBuffer.toString());
+ pb.start();
+ }
- public static void executeLocalScript(Node node, String script,
- List<String> args) throws IOException, InterruptedException {
- List<String> pargs = new ArrayList<String>();
- pargs.add("/bin/bash");
- pargs.add(script);
- if (args != null) {
- pargs.addAll(args);
- }
- ProcessBuilder pb = new ProcessBuilder(pargs);
- pb.environment().putAll(EventDriver.getEnvironment());
- pb.environment().put(IP_LOCATION, node.getClusterIp());
- pb.start();
- }
+ public static void executeLocalScript(Node node, String script, List<String> args) throws IOException,
+ InterruptedException {
+ List<String> pargs = new ArrayList<String>();
+ pargs.add("/bin/bash");
+ pargs.add(script);
+ if (args != null) {
+ pargs.addAll(args);
+ }
+ ProcessBuilder pb = new ProcessBuilder(pargs);
+ pb.environment().putAll(EventDriver.getEnvironment());
+ pb.environment().put(IP_LOCATION, node.getClusterIp());
+ pb.start();
+ }
- public static List<String> getEventArgs(Pattern pattern) {
- List<String> pargs = new ArrayList<String>();
- if (pattern.getEvent().getPargs() == null) {
- return pargs;
- }
- String[] args = pattern.getEvent().getPargs().split(" ");
- for (String arg : args) {
- pargs.add(arg.trim());
- }
- return pargs;
- }
+ public static List<String> getEventArgs(Pattern pattern) {
+ List<String> pargs = new ArrayList<String>();
+ if (pattern.getEvent().getPargs() == null) {
+ return pargs;
+ }
+ String[] args = pattern.getEvent().getPargs().split(" ");
+ for (String arg : args) {
+ pargs.add(arg.trim());
+ }
+ return pargs;
+ }
}
diff --git a/asterix-events/src/main/resources/events/cc_start/cc_start.sh b/asterix-events/src/main/resources/events/cc_start/cc_start.sh
index 003d9cf..dfc8ad9 100755
--- a/asterix-events/src/main/resources/events/cc_start/cc_start.sh
+++ b/asterix-events/src/main/resources/events/cc_start/cc_start.sh
@@ -3,4 +3,5 @@
mkdir -p $LOG_DIR
fi
cd $WORKING_DIR
+export JAVA_OPTS=$CC_JAVA_OPTS
$ASTERIX_HOME/bin/asterixcc -client-net-ip-address $CLIENT_NET_IP -client-net-port 1098 -cluster-net-ip-address $CLUSTER_NET_IP -cluster-net-port 1099 -http-port 8888 &> $LOG_DIR/cc.log
diff --git a/asterix-events/src/main/resources/events/node_join/nc_join.sh b/asterix-events/src/main/resources/events/node_join/nc_join.sh
index d8bbbd2..2e2cfac 100755
--- a/asterix-events/src/main/resources/events/node_join/nc_join.sh
+++ b/asterix-events/src/main/resources/events/node_join/nc_join.sh
@@ -6,4 +6,5 @@
mkdir -p $LOG_DIR
fi
cd $WORKING_DIR
+export JAVA_OPTS=$NC_JAVA_OPTS
$ASTERIX_HOME/bin/asterixnc -node-id $NC_ID -cc-host $CC_HOST -cc-port 1099 -cluster-net-ip-address $IP_LOCATION -data-ip-address $IP_LOCATION -iodevices $IO_DEVICES -result-ip-address $IP_LOCATION &> $LOG_DIR/${NC_ID}.log
diff --git a/asterix-events/src/main/resources/schema/cluster.xsd b/asterix-events/src/main/resources/schema/cluster.xsd
index 0e1adce..4292418 100644
--- a/asterix-events/src/main/resources/schema/cluster.xsd
+++ b/asterix-events/src/main/resources/schema/cluster.xsd
@@ -1,98 +1,89 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cl="cluster" targetNamespace="cluster" elementFormDefault="qualified">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:cl="cluster" targetNamespace="cluster" elementFormDefault="qualified">
-<!-- definition of simple types -->
-<xs:element name="name" type="xs:string"/>
-<xs:element name="java_opts" type="xs:string"/>
-<xs:element name="logdir" type="xs:string"/>
-<xs:element name="id" type="xs:string"/>
-<xs:element name="client-ip" type="xs:string"/>
-<xs:element name="cluster-ip" type="xs:string"/>
-<xs:element name="key" type="xs:string"/>
-<xs:element name="value" type="xs:string"/>
-<xs:element name="dir" type="xs:string"/>
-<xs:element name="NFS" type="xs:boolean"/>
-<xs:element name="store" type="xs:string"/>
-<xs:element name="iodevices" type="xs:string"/>
-<xs:element name="java_home" type="xs:string"/>
-<xs:element name="username" type="xs:string"/>
-<xs:element name="debug" type="xs:integer"/>
-<xs:element name="debugEnabled" type="xs:boolean"/>
+ <!-- definition of simple types -->
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="logdir" type="xs:string" />
+ <xs:element name="id" type="xs:string" />
+ <xs:element name="client-ip" type="xs:string" />
+ <xs:element name="cluster-ip" type="xs:string" />
+ <xs:element name="key" type="xs:string" />
+ <xs:element name="value" type="xs:string" />
+ <xs:element name="dir" type="xs:string" />
+ <xs:element name="NFS" type="xs:boolean" />
+ <xs:element name="store" type="xs:string" />
+ <xs:element name="iodevices" type="xs:string" />
+ <xs:element name="java_home" type="xs:string" />
+ <xs:element name="username" type="xs:string" />
-<!-- definition of complex elements -->
-<xs:element name="workingDir">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl:dir"/>
- <xs:element ref="cl:NFS"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <!-- definition of complex elements -->
+ <xs:element name="workingDir">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="cl:dir" />
+ <xs:element ref="cl:NFS" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
-<xs:element name="master-node">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl:id"/>
- <xs:element ref="cl:client-ip"/>
- <xs:element ref="cl:cluster-ip"/>
- <xs:element ref="cl:java_home" minOccurs="0"/>
- <xs:element ref="cl:java_opts" minOccurs="0"/>
- <xs:element ref="cl:logdir" minOccurs="0"/>
- <xs:element ref="cl:debug" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <xs:element name="master-node">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="cl:id" />
+ <xs:element ref="cl:client-ip" />
+ <xs:element ref="cl:cluster-ip" />
+ <xs:element ref="cl:java_home" minOccurs="0" />
+ <xs:element ref="cl:logdir" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
-<xs:element name="property">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl:key"/>
- <xs:element ref="cl:value"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <xs:element name="property">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="cl:key" />
+ <xs:element ref="cl:value" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
-<xs:element name="env">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl:property" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <xs:element name="env">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="cl:property" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
-<xs:element name="node">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl:id"/>
- <xs:element ref="cl:cluster-ip"/>
- <xs:element ref="cl:java_home" minOccurs="0"/>
- <xs:element ref="cl:java_opts" minOccurs="0"/>
- <xs:element ref="cl:logdir" minOccurs="0"/>
- <xs:element ref="cl:store" minOccurs="0"/>
- <xs:element ref="cl:iodevices" minOccurs="0"/>
- <xs:element ref="cl:debug" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <xs:element name="node">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="cl:id" />
+ <xs:element ref="cl:cluster-ip" />
+ <xs:element ref="cl:java_home" minOccurs="0" />
+ <xs:element ref="cl:logdir" minOccurs="0" />
+ <xs:element ref="cl:store" minOccurs="0" />
+ <xs:element ref="cl:iodevices" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
-<xs:element name="cluster">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl:name"/>
- <xs:element ref="cl:username"/>
- <xs:element ref="cl:env" minOccurs="0"/>
- <xs:element ref="cl:java_home" minOccurs="0"/>
- <xs:element ref="cl:java_opts" minOccurs="0"/>
- <xs:element ref="cl:logdir" minOccurs="0"/>
- <xs:element ref="cl:store" minOccurs="0"/>
- <xs:element ref="cl:iodevices" minOccurs="0"/>
- <xs:element ref="cl:workingDir"/>
- <xs:element ref="cl:debugEnabled" minOccurs="0"/>
- <xs:element ref="cl:debug" minOccurs="0"/>
- <xs:element ref="cl:master-node"/>
- <xs:element ref="cl:node" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <xs:element name="cluster">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="cl:name" />
+ <xs:element ref="cl:username" />
+ <xs:element ref="cl:env" minOccurs="0" />
+ <xs:element ref="cl:java_home" minOccurs="0" />
+ <xs:element ref="cl:logdir" minOccurs="0" />
+ <xs:element ref="cl:store" minOccurs="0" />
+ <xs:element ref="cl:iodevices" minOccurs="0" />
+ <xs:element ref="cl:workingDir" />
+ <xs:element ref="cl:master-node" />
+ <xs:element ref="cl:node" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</xs:schema>
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
index 7f6b93e..3a1d641 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
@@ -35,7 +35,7 @@
InstallerUtil.validateAsterixInstanceExists(instanceName, State.INACTIVE);
ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
AsterixInstance instance = lookupService.getAsterixInstance(instanceName);
-
+ InstallerUtil.createClusterProperties(instance.getCluster(), instance.getAsterixConfiguration());
AsterixConfiguration asterixConfiguration = InstallerUtil
.getAsterixConfiguration(((AlterConfig) config).confPath);
instance.setAsterixConfiguration(asterixConfiguration);
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
index e742c4e..129e416 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
@@ -28,7 +28,6 @@
cluster.setStore("storage");
cluster.setLogdir(workingDir + File.separator + "logs");
cluster.setJavaHome(System.getenv("JAVA_HOME"));
- cluster.setJavaOpts("-Xmx1024m");
JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
Marshaller marshaller = ctx.createMarshaller();
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
index d8cd2cf..05d6777 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
@@ -58,21 +58,7 @@
asterixConfiguration);
InstallerUtil.evaluateConflictWithOtherInstances(asterixInstance);
InstallerUtil.createAsterixZip(asterixInstance, true);
- List<Property> clusterProperties = new ArrayList<Property>();
- clusterProperties.add(new Property("ASTERIX_HOME", cluster.getWorkingDir().getDir() + File.separator
- + "asterix"));
- StringBuilder javaOpts = new StringBuilder();
- if (cluster.getJavaOpts() != null) {
- javaOpts.append(cluster.getJavaOpts());
- }
- clusterProperties.add(new Property("JAVA_OPTS", javaOpts.toString()));
- clusterProperties.add(new Property("CLUSTER_NET_IP", cluster.getMasterNode().getClusterIp()));
- clusterProperties.add(new Property("CLIENT_NET_IP", cluster.getMasterNode().getClientIp()));
- clusterProperties.add(new Property("LOG_DIR", cluster.getLogdir()));
- clusterProperties.add(new Property("JAVA_HOME", cluster.getJavaHome()));
- clusterProperties.add(new Property("WORKING_DIR", cluster.getWorkingDir().getDir()));
- cluster.setEnv(new Env(clusterProperties));
-
+ InstallerUtil.createClusterProperties(cluster, asterixConfiguration);
EventrixClient eventrixClient = InstallerUtil.getEventrixClient(cluster);
PatternCreator pc = new PatternCreator();
@@ -121,7 +107,7 @@
@Option(name = "-c", required = true, usage = "Path to cluster configuration")
public String clusterPath;
- @Option(name = "-a", required = true, usage = "Path to asterix configuration")
+ @Option(name = "-a", required = false, usage = "Path to asterix configuration")
public String asterixConfPath;
}
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
index 01fdda4..f5119a5 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
@@ -25,8 +25,8 @@
import edu.uci.ics.asterix.installer.error.VerificationUtil;
import edu.uci.ics.asterix.installer.events.PatternCreator;
import edu.uci.ics.asterix.installer.model.AsterixInstance;
-import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
import edu.uci.ics.asterix.installer.model.AsterixRuntimeState;
+import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
import edu.uci.ics.asterix.installer.service.ServiceProvider;
public class StartCommand extends AbstractCommand {
@@ -39,10 +39,10 @@
InstallerUtil.createAsterixZip(instance, false);
PatternCreator pc = new PatternCreator();
EventrixClient client = InstallerUtil.getEventrixClient(instance.getCluster());
- Patterns asterixBinaryTransferPattern = pc.getAsterixBinaryTransferPattern(asterixInstanceName,
- instance.getCluster());
+ Patterns asterixBinaryTransferPattern = pc.getAsterixBinaryTransferPattern(asterixInstanceName, instance
+ .getCluster());
client.submit(asterixBinaryTransferPattern);
-
+ InstallerUtil.createClusterProperties(instance.getCluster(), instance.getAsterixConfiguration());
Patterns patterns = pc.getStartAsterixPattern(asterixInstanceName, instance.getCluster());
client.submit(patterns);
InstallerUtil.deleteDirectory(InstallerDriver.getManagixHome() + File.separator + InstallerDriver.ASTERIX_DIR
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
index 4e6460b..e5700e9 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
@@ -32,7 +32,6 @@
import edu.uci.ics.asterix.event.schema.cluster.Node;
import edu.uci.ics.asterix.installer.driver.InstallerDriver;
import edu.uci.ics.asterix.installer.driver.InstallerUtil;
-import edu.uci.ics.asterix.installer.model.ProcessInfo;
import edu.uci.ics.asterix.installer.schema.conf.Configuration;
import edu.uci.ics.asterix.installer.schema.conf.Zookeeper;
@@ -110,8 +109,8 @@
serverIds.add(cluster.getMasterNode().getId());
MasterNode masterNode = cluster.getMasterNode();
- Node master = new Node(masterNode.getId(), masterNode.getClusterIp(), masterNode.getJavaOpts(),
- masterNode.getJavaHome(), masterNode.getLogdir(), null, null, null);
+ Node master = new Node(masterNode.getId(), masterNode.getClusterIp(), masterNode.getJavaHome(), masterNode
+ .getLogdir(), null, null);
ipAddresses.add(masterNode.getClusterIp());
valid = valid & validateNodeConfiguration(master, cluster);
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
index 8083427..65a31c0 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
@@ -30,133 +30,114 @@
public class InstallerDriver {
- public static final String MANAGIX_INTERNAL_DIR = ".installer";
- public static final String MANAGIX_EVENT_DIR = MANAGIX_INTERNAL_DIR
- + File.separator + "eventrix";
- public static final String MANAGIX_EVENT_SCRIPTS_DIR = MANAGIX_INTERNAL_DIR
- + File.separator + "eventrix" + File.separator + "scripts";
- public static final String ASTERIX_DIR = "asterix";
- public static final String EVENTS_DIR = "events";
+ public static final String MANAGIX_INTERNAL_DIR = ".installer";
+ public static final String MANAGIX_EVENT_DIR = MANAGIX_INTERNAL_DIR + File.separator + "eventrix";
+ public static final String MANAGIX_EVENT_SCRIPTS_DIR = MANAGIX_INTERNAL_DIR + File.separator + "eventrix"
+ + File.separator + "scripts";
+ public static final String DEFAULT_ASTERIX_CONFIGURATION_PATH = "clusters" + File.separator + "local"
+ + File.separator + "conf" + File.separator + "asterix-conf.xml";
+ public static final String ASTERIX_DIR = "asterix";
+ public static final String EVENTS_DIR = "events";
- private static final Logger LOGGER = Logger.getLogger(InstallerDriver.class
- .getName());
- public static final String ENV_MANAGIX_HOME = "MANAGIX_HOME";
- public static final String MANAGIX_CONF_XML = "conf" + File.separator
- + "managix-conf.xml";
+ private static final Logger LOGGER = Logger.getLogger(InstallerDriver.class.getName());
+ public static final String ENV_MANAGIX_HOME = "MANAGIX_HOME";
+ public static final String MANAGIX_CONF_XML = "conf" + File.separator + "managix-conf.xml";
- private static Configuration conf;
- private static String managixHome;
- private static String asterixZip;
+ private static Configuration conf;
+ private static String managixHome;
+ private static String asterixZip;
- public static String getAsterixZip() {
- return asterixZip;
- }
+ public static String getAsterixZip() {
+ return asterixZip;
+ }
- public static Configuration getConfiguration() {
- return conf;
- }
+ public static Configuration getConfiguration() {
+ return conf;
+ }
- public static void initConfig() throws Exception {
- File configFile = new File(managixHome + File.separator
- + MANAGIX_CONF_XML);
- JAXBContext configCtx = JAXBContext.newInstance(Configuration.class);
- Unmarshaller unmarshaller = configCtx.createUnmarshaller();
- conf = (Configuration) unmarshaller.unmarshal(configFile);
- asterixZip = initBinary("asterix-server");
+ public static void initConfig() throws Exception {
+ File configFile = new File(managixHome + File.separator + MANAGIX_CONF_XML);
+ JAXBContext configCtx = JAXBContext.newInstance(Configuration.class);
+ Unmarshaller unmarshaller = configCtx.createUnmarshaller();
+ conf = (Configuration) unmarshaller.unmarshal(configFile);
+ asterixZip = initBinary("asterix-server");
- ILookupService lookupService = ServiceProvider.INSTANCE
- .getLookupService();
- if (!lookupService.isRunning(conf)) {
- lookupService.startService(conf);
- }
- }
+ ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
+ if (!lookupService.isRunning(conf)) {
+ lookupService.startService(conf);
+ }
+ }
- private static String initBinary(final String fileNamePattern) {
- String asterixDir = InstallerDriver.getAsterixDir();
- File file = new File(asterixDir);
- File[] zipFiles = file.listFiles(new FileFilter() {
- public boolean accept(File arg0) {
- return arg0.getAbsolutePath().contains(fileNamePattern)
- && arg0.isFile();
- }
- });
- if (zipFiles.length == 0) {
- String msg = " Binary not found at " + asterixDir;
- LOGGER.log(Level.FATAL, msg);
- throw new IllegalStateException(msg);
- }
- if (zipFiles.length > 1) {
- String msg = " Multiple binaries found at " + asterixDir;
- LOGGER.log(Level.FATAL, msg);
- throw new IllegalStateException(msg);
- }
+ private static String initBinary(final String fileNamePattern) {
+ String asterixDir = InstallerDriver.getAsterixDir();
+ File file = new File(asterixDir);
+ File[] zipFiles = file.listFiles(new FileFilter() {
+ public boolean accept(File arg0) {
+ return arg0.getAbsolutePath().contains(fileNamePattern) && arg0.isFile();
+ }
+ });
+ if (zipFiles.length == 0) {
+ String msg = " Binary not found at " + asterixDir;
+ LOGGER.log(Level.FATAL, msg);
+ throw new IllegalStateException(msg);
+ }
+ if (zipFiles.length > 1) {
+ String msg = " Multiple binaries found at " + asterixDir;
+ LOGGER.log(Level.FATAL, msg);
+ throw new IllegalStateException(msg);
+ }
- return zipFiles[0].getAbsolutePath();
- }
+ return zipFiles[0].getAbsolutePath();
+ }
- public static String getManagixHome() {
- return managixHome;
- }
+ public static String getManagixHome() {
+ return managixHome;
+ }
- public static String getAsterixDir() {
- return managixHome + File.separator + ASTERIX_DIR;
- }
+ public static String getAsterixDir() {
+ return managixHome + File.separator + ASTERIX_DIR;
+ }
- public static void main(String args[]) {
- try {
- if (args.length != 0) {
- managixHome = System.getenv(ENV_MANAGIX_HOME);
- CommandHandler cmdHandler = new CommandHandler();
- cmdHandler.processCommand(args);
- } else {
- printUsage();
- }
- } catch (IllegalArgumentException iae) {
- LOGGER.error("Unknown command");
- printUsage();
- } catch (Exception e) {
- LOGGER.error(e.getMessage());
- if (e.getMessage() == null || e.getMessage().length() == 0) {
- e.printStackTrace();
- }
- }
- }
+ public static void main(String args[]) {
+ try {
+ if (args.length != 0) {
+ managixHome = System.getenv(ENV_MANAGIX_HOME);
+ CommandHandler cmdHandler = new CommandHandler();
+ cmdHandler.processCommand(args);
+ } else {
+ printUsage();
+ }
+ } catch (IllegalArgumentException iae) {
+ LOGGER.error("Unknown command");
+ printUsage();
+ } catch (Exception e) {
+ LOGGER.error(e.getMessage());
+ if (e.getMessage() == null || e.getMessage().length() == 0) {
+ e.printStackTrace();
+ }
+ }
+ }
- private static void printUsage() {
- StringBuffer buffer = new StringBuffer("managix <command> <options>"
- + "\n");
- buffer.append("Commands" + "\n");
- buffer.append("create " + ":" + " Creates a new asterix instance"
- + "\n");
- buffer.append("delete " + ":" + " Deletes an asterix instance" + "\n");
- buffer.append("start " + ":" + " Starts an asterix instance" + "\n");
- buffer.append("stop " + ":"
- + " Stops an asterix instance that is in ACTIVE state" + "\n");
- buffer.append("backup " + ":"
- + " Creates a back up for an existing asterix instance" + "\n");
- buffer.append("restore " + ":" + " Restores an asterix instance"
- + "\n");
- buffer.append("describe " + ":"
- + " Describes an existing asterix instance" + "\n");
- buffer.append("validate " + ":"
- + " Validates the installer/cluster configuration" + "\n");
- buffer.append("configure"
- + ":"
- + " Auto-generate configuration for local psedu-distributed Asterix instance"
- + "\n");
- buffer.append("shutdown " + ":" + " Shutdown the installer service"
- + "\n");
- buffer.append("validate " + ":"
- + " Validates the installer/cluster configuration" + "\n");
- buffer.append("configure"
- + ":"
- + " Auto-generate configuration for local psedu-distributed Asterix instance"
- + "\n");
- buffer.append("shutdown " + ":" + " Shutdown the installer service"
- + "\n");
- buffer.append("help " + ":"
- + " Provides usage description of a command" + "\n");
+ private static void printUsage() {
+ StringBuffer buffer = new StringBuffer("managix <command> <options>" + "\n");
+ buffer.append("Commands" + "\n");
+ buffer.append("create " + ":" + " Creates a new asterix instance" + "\n");
+ buffer.append("delete " + ":" + " Deletes an asterix instance" + "\n");
+ buffer.append("start " + ":" + " Starts an asterix instance" + "\n");
+ buffer.append("stop " + ":" + " Stops an asterix instance that is in ACTIVE state" + "\n");
+ buffer.append("backup " + ":" + " Creates a back up for an existing asterix instance" + "\n");
+ buffer.append("restore " + ":" + " Restores an asterix instance" + "\n");
+ buffer.append("describe " + ":" + " Describes an existing asterix instance" + "\n");
+ buffer.append("validate " + ":" + " Validates the installer/cluster configuration" + "\n");
+ buffer.append("configure" + ":" + " Auto-generate configuration for local psedu-distributed Asterix instance"
+ + "\n");
+ buffer.append("shutdown " + ":" + " Shutdown the installer service" + "\n");
+ buffer.append("validate " + ":" + " Validates the installer/cluster configuration" + "\n");
+ buffer.append("configure" + ":" + " Auto-generate configuration for local psedu-distributed Asterix instance"
+ + "\n");
+ buffer.append("shutdown " + ":" + " Shutdown the installer service" + "\n");
+ buffer.append("help " + ":" + " Provides usage description of a command" + "\n");
- LOGGER.info(buffer.toString());
- }
+ LOGGER.info(buffer.toString());
+ }
}
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
index aa7c20e..484d206 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
@@ -49,7 +49,9 @@
import edu.uci.ics.asterix.event.driver.EventDriver;
import edu.uci.ics.asterix.event.management.EventrixClient;
import edu.uci.ics.asterix.event.schema.cluster.Cluster;
+import edu.uci.ics.asterix.event.schema.cluster.Env;
import edu.uci.ics.asterix.event.schema.cluster.Node;
+import edu.uci.ics.asterix.event.schema.cluster.Property;
import edu.uci.ics.asterix.installer.error.InstallerException;
import edu.uci.ics.asterix.installer.error.OutputHandler;
import edu.uci.ics.asterix.installer.model.AsterixInstance;
@@ -67,10 +69,10 @@
Node metadataNode = getMetadataNode(cluster);
String asterixZipName = InstallerDriver.getAsterixZip().substring(
InstallerDriver.getAsterixZip().lastIndexOf(File.separator) + 1);
- String asterixVersion = asterixZipName.substring("asterix-server-".length(),
- asterixZipName.indexOf("-binary-assembly"));
- AsterixInstance instance = new AsterixInstance(asterixInstanceName, cluster, asterixConfiguration,
- metadataNode.getId(), asterixVersion);
+ String asterixVersion = asterixZipName.substring("asterix-server-".length(), asterixZipName
+ .indexOf("-binary-assembly"));
+ AsterixInstance instance = new AsterixInstance(asterixInstanceName, cluster, asterixConfiguration, metadataNode
+ .getId(), asterixVersion);
return instance;
}
@@ -82,6 +84,31 @@
injectAsterixLogPropertyFile(modifiedZipPath, asterixInstance);
}
+ public static void createClusterProperties(Cluster cluster, AsterixConfiguration asterixConfiguration) {
+ List<Property> clusterProperties = null;
+ if (cluster.getEnv() != null && cluster.getEnv().getProperty() != null) {
+ clusterProperties = cluster.getEnv().getProperty();
+ clusterProperties.clear();
+ } else {
+ clusterProperties = new ArrayList<Property>();
+ }
+ for (edu.uci.ics.asterix.installer.schema.asterixconf.Property property : asterixConfiguration.getProperty()) {
+ if (property.getName().equalsIgnoreCase(AsterixInstance.CC_JAVA_OPTS)) {
+ clusterProperties.add(new Property("CC_JAVA_OPTS", property.getValue()));
+ } else if (property.getName().equalsIgnoreCase(AsterixInstance.NC_JAVA_OPTS)) {
+ clusterProperties.add(new Property("NC_JAVA_OPTS", property.getValue()));
+ }
+ }
+ clusterProperties.add(new Property("ASTERIX_HOME", cluster.getWorkingDir().getDir() + File.separator
+ + "asterix"));
+ clusterProperties.add(new Property("CLUSTER_NET_IP", cluster.getMasterNode().getClusterIp()));
+ clusterProperties.add(new Property("CLIENT_NET_IP", cluster.getMasterNode().getClientIp()));
+ clusterProperties.add(new Property("LOG_DIR", cluster.getLogdir()));
+ clusterProperties.add(new Property("JAVA_HOME", cluster.getJavaHome()));
+ clusterProperties.add(new Property("WORKING_DIR", cluster.getWorkingDir().getDir()));
+ cluster.setEnv(new Env(clusterProperties));
+ }
+
private static String injectAsterixPropertyFile(String origZipFile, AsterixInstance asterixInstance,
boolean newDeployment) throws IOException {
writeAsterixConfigurationFile(asterixInstance, newDeployment);
@@ -193,6 +220,11 @@
conf.append(asterixInstanceName + "_" + node.getId() + ".stores" + "=" + storeDir + "\n");
}
+ AsterixConfiguration asterixConf = asterixInstance.getAsterixConfiguration();
+ /*for (Property property : asterixConf.getProperty()){
+
+ }*/
+
conf.append("OutputDir=" + "dummy");
File asterixConfDir = new File(InstallerDriver.getAsterixDir() + File.separator + asterixInstanceName);
@@ -221,6 +253,10 @@
public static AsterixConfiguration getAsterixConfiguration(String asterixConf) throws FileNotFoundException,
IOException, JAXBException {
+ if (asterixConf == null) {
+ asterixConf = InstallerDriver.getManagixHome() + File.separator
+ + InstallerDriver.DEFAULT_ASTERIX_CONFIGURATION_PATH;
+ }
File file = new File(asterixConf);
JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
index 7e1dd13..d4b2a0b 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
@@ -18,16 +18,19 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import java.util.Properties;
import edu.uci.ics.asterix.event.schema.cluster.Cluster;
import edu.uci.ics.asterix.event.schema.cluster.Node;
import edu.uci.ics.asterix.installer.schema.asterixconf.AsterixConfiguration;
+import edu.uci.ics.asterix.installer.schema.asterixconf.Property;
public class AsterixInstance implements Serializable {
private static final long serialVersionUID = 2874439550187520449L;
+ public static final String CC_JAVA_OPTS = "cc_java_opts";
+ public static final String NC_JAVA_OPTS = "nc_java_opts";
+
public enum State {
ACTIVE,
INACTIVE,
@@ -169,26 +172,9 @@
buffer.append("\n");
buffer.append("Asterix Configuration\n");
- buffer.append("LSM Configuration\n");
- buffer.append("Size of in-memory component:" + asterixConfiguration.getLsm().getSizeMemoryComponent() + "\n");
- buffer.append("Total size of in-memory components:"
- + asterixConfiguration.getLsm().getTotalSizeMemoryComponent() + "\n");
-
- buffer.append("Transaction Configuration\n");
- buffer.append("Number of log buffer pages:" + asterixConfiguration.getTransactions().getLogBufferNumPages()
- + "\n");
- buffer.append("Log buffer page size:" + asterixConfiguration.getTransactions().getLogBufferPageSize() + "\n");
-
- buffer.append("Ports Configuration\n");
- buffer.append("Web-interface-port:" + asterixConfiguration.getPorts().getWebInterfacePort() + "\n");
- buffer.append("NC port:" + asterixConfiguration.getPorts().getNcPort() + "\n");
-
- buffer.append("Operator Configuration\n");
- buffer.append("Sort operator memory:" + asterixConfiguration.getOperators().getJoinOpMemory() + "\n");
- buffer.append("Join operator memory:" + asterixConfiguration.getOperators().getSortOpMemory() + "\n");
-
- buffer.append("Misc Configuration\n");
- buffer.append("Sort operator memory:" + asterixConfiguration.getOperators().getJoinOpMemory() + "\n");
+ for (Property property : asterixConfiguration.getProperty()) {
+ buffer.append(property.getName() + ":" + property.getValue() + "\n");
+ }
}
diff --git a/asterix-installer/src/main/resources/clusters/local/conf/asterix-conf.xml b/asterix-installer/src/main/resources/clusters/local/conf/asterix-conf.xml
index 48930be..195131a 100644
--- a/asterix-installer/src/main/resources/clusters/local/conf/asterix-conf.xml
+++ b/asterix-installer/src/main/resources/clusters/local/conf/asterix-conf.xml
@@ -1,29 +1,73 @@
<asterixConfiguration xmlns="asterixconf">
-
- <lsm>
- <size_memory_component>128m</size_memory_component>
- <total_size_memory_component>512m</total_size_memory_component>
- </lsm>
-
- <transactions>
- <log_buffer_num_pages>8</log_buffer_num_pages>
- <log_buffer_page_size>128m</log_buffer_page_size>
- <group_commit_interval>200ms</group_commit_interval>
- </transactions>
-
- <operators>
- <sort_op_memory></sort_op_memory>
- <join_op_memory></join_op_memory>
- </operators>
-
- <ports>
- <web_interface_port></web_interface_port>
- <nc_port></nc_port>
- </ports>
- <misc>
- <num_pages_buffer_cache></num_pages_buffer_cache>
- <log_level></log_level>
- </misc>
-
+ <property>
+ <name>nc_java_opts</name>
+ <value>-Xmx1024m</value>
+ </property>
+
+ <property>
+ <name>cc_java_opts</name>
+ <value>-Xmx1024m</value>
+ </property>
+
+ <property>
+ <name>size_memory_component</name>
+ <value>512m</value>
+ </property>
+
+ <property>
+ <name>total_size_memory_component</name>
+ <value>512m</value>
+ </property>
+
+ <property>
+ <name>log_buffer_num_pages</name>
+ <value>8</value>
+ </property>
+
+ <property>
+ <name>log_buffer_page_size</name>
+ <value></value>
+ </property>
+
+ <property>
+ <name>log_buffer_page_size</name>
+ <value>128m</value>
+ </property>
+
+ <property>
+ <name>group_commit_interval</name>
+ <value>200ms</value>
+ </property>
+
+ <property>
+ <name>sort_op_memory</name>
+ <value>200m</value>
+ </property>
+
+ <property>
+ <name>join_op_memory</name>
+ <value>200ms</value>
+ </property>
+
+ <property>
+ <name>web_interface_port</name>
+ <value>19001</value>
+ </property>
+
+ <property>
+ <name>nc_port</name>
+ <value>14601</value>
+ </property>
+
+ <property>
+ <name>num_pages_buffer_cache</name>
+ <value>8</value>
+ </property>
+
+ <property>
+ <name>log_level</name>
+ <value>INFO</value>
+ </property>
+
</asterixConfiguration>
diff --git a/asterix-installer/src/main/resources/schema/asterix-conf.xsd b/asterix-installer/src/main/resources/schema/asterix-conf.xsd
index 069fe74..3c7ae34 100644
--- a/asterix-installer/src/main/resources/schema/asterix-conf.xsd
+++ b/asterix-installer/src/main/resources/schema/asterix-conf.xsd
@@ -1,79 +1,30 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mg="asterixconf" targetNamespace="asterixconf" elementFormDefault="qualified">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mg="asterixconf" targetNamespace="asterixconf"
+ elementFormDefault="qualified">
-<!-- definition of simple types -->
-<xs:element name="size_memory_component" type="xs:string"/>
-<xs:element name="total_size_memory_component" type="xs:integer"/>
+ <!-- definition of simple types -->
-<xs:element name="sort_op_memory" type="xs:string"/>
-<xs:element name="join_op_memory" type="xs:string"/>
-
-<xs:element name="log_buffer_num_pages" type="xs:integer"/>
-<xs:element name="log_buffer_page_size" type="xs:integer"/>
-
-<xs:element name="web_interface_port" type="xs:string"/>
-<xs:element name="nc_port" type="xs:string"/>
-
-<xs:element name="num_pages_buffer_cache" type="xs:integer"/>
-<xs:element name="log_level" type="xs:string"/>
-
-<!-- definition of complex elements -->
-
-<xs:element name="lsm">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="mg:size_memory_component"/>
- <xs:element ref="mg:total_size_memory_component"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
-
-<xs:element name="transactions">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="mg:log_buffer_num_pages"/>
- <xs:element ref="mg:log_buffer_page_size"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
-
-<xs:element name="ports">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="mg:web_interface_port"/>
- <xs:element ref="mg:nc_port"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
-
-<xs:element name="operators">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="mg:sort_op_memory"/>
- <xs:element ref="mg:join_op_memory"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
-
-<xs:element name="misc">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="mg:num_pages_buffer_cache"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="value" type="xs:string" />
+
+ <!-- definition of complex elements -->
+ <xs:element name="property">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="mg:name" />
+ <xs:element ref="mg:value" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
-<xs:element name="asterixConfiguration">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="mg:lsm" minOccurs="0"/>
- <xs:element ref="mg:transactions" minOccurs="0"/>
- <xs:element ref="mg:ports"/>
- <xs:element ref="mg:operators"/>
- <xs:element ref="mg:misc"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <xs:element name="asterixConfiguration">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="mg:property" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</xs:schema>