3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.maven.plugin.util;
11 import java.util.Properties;
13 public class JavaProcess {
14 private final int pid;
15 private final String mainClass;
16 private final Properties systemProperties = new Properties();
18 public JavaProcess(int id, String cls) {
23 public void setSystemProperties(String line) {
24 if (line == null || line.length() == 0) return;
25 String[] tokens = line.split("\\s");
26 for (String t : tokens) setSystemProperty(t);
29 public void setSystemProperty(String line) {
30 if (line.startsWith("-D")) {
31 int x = line.indexOf('=');
33 systemProperties.put(line.substring(2, x), line.substring(x+1));
35 systemProperties.put(line.substring(2), "");
44 public String getMainClass() {
48 public Properties getSystemProperties() {
49 return systemProperties;
53 public String toString() {
54 return "pid:" + pid + " class:" + mainClass +
55 " system-properties:" + systemProperties.toString();