/**
   * This method should setup the flags/switches for the java command which will determine the
   * actual command to be executed.
   *
   * <p>Sets up flags like :
   *
   * <ul>
   *   <li>-Dem.home
   *   <li>-Dprocess.name
   * </ul>
   *
   * <br>
   * add computes the classpath.
   */
  protected void updateFlags(ServerCommand serverCmd) {

    String bootDir = System.getProperty("em.home");
    String appType = System.getProperty("appType");
    String appInst = System.getProperty("appInst");

    String javaClasspath = serverCmd.getClasspath();
    String processName = getProcessNameForLog();

    List jvmFlags = serverCmd.getJVMFlags();

    int cpToken = -1;

    for (int i = 0; i < jvmFlags.size(); i++) {
      String token = (String) jvmFlags.get(i);
      if (token.startsWith("-classpath")) {
        cpToken = i;
        javaClasspath = null;
      } else if (token.startsWith("-Dem.home")) {
        bootDir = null;
      } else if (token.startsWith("-Dprocess.name")) {
        processName = null;
      }
    }

    List addonJVMFlags = new LinkedList();

    if (bootDir != null) {
      addonJVMFlags.add("-Dem.home=" + bootDir);
    }

    if (processName != null) {
      addonJVMFlags.add("-Dprocess.name=" + processName);
    }

    if (!(appType == null || appType.trim().equals(""))) {
      addonJVMFlags.add("-DappType=" + appType);
    }

    if (!(appInst == null || appInst.trim().equals(""))) {
      addonJVMFlags.add("-DappInst=" + appInst);
    }

    if (cpToken != -1) {
      jvmFlags.remove(cpToken);
      String str = (String) jvmFlags.remove(cpToken);
      serverCmd.setClasspath(str);
    }

    jvmFlags.addAll(addonJVMFlags);
  }
  public static void main(String args[]) throws Exception {
    // cache the initial set of loggers before this test begins
    // to add any loggers
    Enumeration<String> e = logMgr.getLoggerNames();
    List<String> defaultLoggers = getDefaultLoggerNames();
    while (e.hasMoreElements()) {
      String logger = e.nextElement();
      if (!defaultLoggers.contains(logger)) {
        initialLoggerNames.add(logger);
      }
    }
    ;

    String tstSrc = System.getProperty(TST_SRC_PROP);
    File fname = new File(tstSrc, LM_PROP_FNAME);
    String prop = fname.getCanonicalPath();
    System.setProperty(CFG_FILE_PROP, prop);
    logMgr.readConfiguration();

    System.out.println();
    if (checkLoggers() == PASSED) {
      System.out.println(MSG_PASSED);
    } else {
      System.out.println(MSG_FAILED);
      throw new Exception(MSG_FAILED);
    }
  }
Beispiel #3
0
  private static List<File> createPossibleHomeDirList() {
    List<File> homeDirCheckList = new ArrayList<File>(4);

    // include codeSource dir in check list
    CodeSource lib = OCSSWRuntimeConfig.class.getProtectionDomain().getCodeSource();
    if (lib != null) {
      URL libUrl = lib.getLocation();
      if (libUrl.getProtocol().equals("file")) {
        String libPath = libUrl.getPath();
        File libParentDir = new File(libPath).getParentFile();
        if (libParentDir != null) {
          // include one above libParentDir
          if (libParentDir.getParentFile() != null) {
            homeDirCheckList.add(libParentDir.getParentFile());
          }
          // include libParentDir
          homeDirCheckList.add(libParentDir);
        }
      }
    }
    // include CWD in check list
    homeDirCheckList.add(new File(".").getAbsoluteFile());
    // include one above CWD in check list
    homeDirCheckList.add(new File("src/test").getAbsoluteFile());
    return homeDirCheckList;
  }
 /**
  * Looks for properties "watchdog.server.&lt;SERVER_NAME&gt;.java.vmtype" followed by
  * "watchdog.java.vmtype" in the configuration and returns the first non-null value. If both are
  * not available, returns null.
  */
 protected String getJVMType() {
   List queue = new LinkedList();
   queue.add(mPropertyPrefix + ".java.vmtype");
   queue.add(WDConstants.WD_PREFIX + ".java.vmtype");
   String vmType = getProperty(queue);
   return vmType;
 }
 /**
  * Looks for properties "watchdog.server.&lt;SERVER_NAME&gt;.java.home" followed by
  * "watchdog.java.home" in the configuration and returns the first non-null value. If both are not
  * available, returns the "java.home" system property.
  */
 protected String getJavaHome() {
   List queue = new LinkedList();
   queue.add(mPropertyPrefix + ".java.home");
   queue.add(WDConstants.WD_PREFIX + ".java.home");
   String javaHome = getProperty(queue);
   if (javaHome == null) javaHome = System.getProperty("java.home");
   return javaHome;
 }
  public static List<String> getDefaultLoggerNames() {
    List<String> expectedLoggerNames = new ArrayList<String>();

    // LogManager always creates two loggers:
    expectedLoggerNames.add(""); // root   logger: ""
    expectedLoggerNames.add("global"); // global logger: "global"
    return expectedLoggerNames;
  }
Beispiel #7
0
 private List<String> createHomeContentPathList() {
   List<String> homeContentPathList = new ArrayList<String>(8);
   homeContentPathList.add(defaultRelConfigFilePath);
   homeContentPathList.add("bin");
   homeContentPathList.add(DEFAULT_LIB_DIR_NAME);
   homeContentPathList.add(DEFAULT_MODULES_DIR_NAME);
   return homeContentPathList;
 }
Beispiel #8
0
 public Judge(String user, String pathPrefix) {
   this.user = user;
   cmdPrefix = new ArrayList<String>();
   cmdPrefix.add("sudo");
   cmdPrefix.add("-u");
   cmdPrefix.add(user);
   cmdPrefix.add("limit");
   workDir = new File(pathPrefix);
 }
 /**
  * Looks for properties "watchdog.server.&lt;SERVER_NAME&gt;.java.class.path" followed by
  * "watchdog.java.class.path" in the configuration and returns the first non-null value. If both
  * are not available, returns the "java.class.path" system property.
  */
 protected String getJavaClasspath() {
   List queue = new LinkedList();
   queue.add(mPropertyPrefix + ".java.class.path");
   queue.add(WDConstants.WD_PREFIX + ".java.class.path");
   String cpath = getProperty(queue);
   if (cpath == null) {
     cpath = System.getProperty("java.class.path");
   }
   return cpath;
 }
  /**
   * This method should update the ServerCommand "struct" and setup the necessary values for the
   * server to be executed under OptimizeIt.
   */
  protected void updateServerCommandForOptimizeIt(ServerCommand serverCmd) {

    mLogger.config(mPropertyPrefix + " checking for optit");

    String optitPrefix = WDConstants.WD_PREFIX + ".java.profilers.OptimizeIt.";

    String home = DCPLib.getProperty(optitPrefix + "home", null);
    if (home == null) {
      mLogger.warning("OptimizeItHome is not specified. Cannot start OptimizeIt");
      return;
    }

    if (!(new java.io.File(home)).exists()) {
      mLogger.warning("OptimizeItHome : " + home + " does not exist." + " Cannot start OptimizeIt");
      return;
    }

    String classPath = DCPLib.getProperty(optitPrefix + "addonClassPath", "");
    classPath = WDUtil.sreplace(classPath, "OPTIMIZEIT_HOME", home);
    serverCmd.setClasspath(serverCmd.getClasspath() + File.pathSeparator + classPath);

    String libPath = DCPLib.getProperty(optitPrefix + "addonLibPath", "");
    libPath = WDUtil.sreplace(libPath, "OPTIMIZEIT_HOME", home);

    String sysLibPath = serverCmd.getLibPath();
    if (sysLibPath == null) sysLibPath = System.getProperty("java.library.path", "");
    serverCmd.setLibPath(libPath + File.pathSeparator + sysLibPath);

    String javaArgs = DCPLib.getProperty(optitPrefix + "javaArgs", "");
    javaArgs = WDUtil.sreplace(javaArgs, "OPTIMIZEIT_HOME", home);
    List jvmFlags = serverCmd.getJVMFlags();
    jvmFlags.add(0, javaArgs);

    String profilerClass = DCPLib.getProperty(optitPrefix + "class", "intuitive.audit.Audit");

    if (mOptitAuditPort == null) {
      mOptitAuditPort = getOptimizeItAuditPort(mPropertyPrefix);
    }
    System.out.println("OptimizeIt for " + mName + " is running at " + mOptitAuditPort);
    mLogger.config("OptimizeIt running at " + mOptitAuditPort);

    String optitArgs = DCPLib.getProperty(optitPrefix + "args", "");
    optitArgs = WDUtil.sreplace(optitArgs, "OPTIMIZEIT_HOME", home);
    optitArgs = WDUtil.sreplace(optitArgs, "AUDIT_PORT", mOptitAuditPort);

    String mainClass = serverCmd.getMainClassName();
    List appArgs = serverCmd.getAppArgs();

    serverCmd.setMainClassName(profilerClass);

    appArgs.add(0, mainClass);
    appArgs.add(0, optitArgs);
  }
 /**
  * Looks for properties "watchdog.server.&lt;SERVER_NAME&gt;.java.jvm" followed by
  * "watchdog.java.jvm" in the configuration and returns the first non-null value. If both are not
  * available, returns the /bin/java in the directory returned by getJavaHome
  *
  * @see ProcessExecutor#getJavaHome
  */
 protected String getJavaJVM() {
   List queue = new LinkedList();
   queue.add(mPropertyPrefix + ".java.jvm");
   queue.add(WDConstants.WD_PREFIX + ".java.jvm");
   String javaVM = getProperty(queue);
   if (javaVM == null) {
     String fileSeparator = System.getProperty("file.separator");
     String javaHome = getJavaHome();
     javaVM = javaHome + fileSeparator + "bin" + fileSeparator + "java";
   }
   return javaVM;
 }
Beispiel #12
0
  /*
   * BE CAREFUL -- Don't introduce "Distributed Concurrency Bugs"
   * e.g. you have to make sure the filename is unique.
   * 1. create a remote file
   * 2. copy the token/auth stuff into it
   * 3. add the correct args to the remote commandline
   *    Put the file in the same directory that nadmin lives in (lib)
   */
  private void setupAuthTokenFile(List<String> cmd, List<String> stdin) throws WindowsException {
    WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(dcomInfo.getCredentials());
    authTokenFilePath =
        dcomInfo.getNadminParentPath()
            + "\\token_"
            + System.nanoTime()
            + new Random().nextInt(1000);
    authTokenFilePath = createUniqueFilename(dcomInfo.getNadminParentPath());
    authTokenFile = new WindowsRemoteFile(wrfs, authTokenFilePath);
    authTokenFile.copyFrom(stdin);

    cmd.add(AsadminInput.CLI_INPUT_OPTION);
    cmd.add(authTokenFilePath);
  }
 public void addElement(Element el, BoxBounds bounds) {
   Layer layer = new Layer(el, bounds);
   layers.add(layer);
   el.getStyle().setPosition(Style.Position.ABSOLUTE);
   presetLayerBounds(layer);
   container.appendChild(el);
 }
Beispiel #14
0
  /**
   * Find all the year records in a Calendar, it need not be a standard period (used in MRP)
   *
   * @param C_Calendar_ID calendar
   * @param ctx context
   * @param trx trx
   * @return MYear[]
   */
  public static MYear[] getAllYearsInCalendar(int C_Calendar_ID, Ctx ctx, Trx trx) {

    List<MYear> years = new ArrayList<MYear>();
    String sql = "SELECT * FROM C_Year WHERE " + "IsActive='Y' AND C_Calendar_ID = ? ";

    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql, trx);
      pstmt.setInt(1, C_Calendar_ID);
      rs = pstmt.executeQuery();
      while (rs.next()) years.add(new MYear(ctx, rs, trx));

    } catch (Exception e) {
      s_log.log(Level.SEVERE, sql, e);
    } finally {

      DB.closeResultSet(rs);
      DB.closeStatement(pstmt);
    }

    MYear[] retValue = new MYear[years.size()];
    years.toArray(retValue);
    return retValue;
  }
Beispiel #15
0
  /**
   * Find the periods in a calendar year it need not be a standard period (used in MRP)
   *
   * @param C_Year_ID Year
   * @param periodType Period Type
   * @param ctx context
   * @param trx trx
   * @return MPeriod[]
   */
  public static MPeriod[] getAllPeriodsInYear(int C_Year_ID, String periodType, Ctx ctx, Trx trx) {

    List<MPeriod> periods = new ArrayList<MPeriod>();
    String sql = "SELECT * FROM C_Period WHERE IsActive='Y'";

    sql = sql + " AND C_Year_ID = ?";

    if (periodType != null) sql = sql + " AND PeriodType = ? ";

    sql = sql + " order by StartDate ";

    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql, trx);
      pstmt.setInt(1, C_Year_ID);

      if (periodType != null) pstmt.setString(2, periodType);

      rs = pstmt.executeQuery();
      while (rs.next()) periods.add(new MPeriod(ctx, rs, trx));
    } catch (Exception e) {
      s_log.log(Level.SEVERE, sql, e);
    } finally {
      DB.closeResultSet(rs);
      DB.closeStatement(pstmt);
    }
    MPeriod[] retValue = new MPeriod[periods.size()];
    periods.toArray(retValue);
    return retValue;
  }
Beispiel #16
0
 private void LoadQueriesBtnMouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_LoadQueriesBtnMouseClicked
   // Algorithm
   /*
    * Goto queries' directory and load all queryfile.query to Combobox
    * Change local directory to repository diretory
    * List all file there
    * Try to load all file and add to combobox
    *
    *
    */
   String sQueryRepositoryPath = "/home/natuan/Documents/OntologyMysql/QueriesRepository/";
   File dir = new File(sQueryRepositoryPath);
   String[] children = dir.list();
   if (children == null) {
     // Either dir does not exist or is not a directory
   } else {
     System.out.println("list files");
     for (int i = 0; i < children.length; i++) {
       // Get filename of file or directory
       String filename = children[i];
       String sContent = ReadWholeFileToString(sQueryRepositoryPath + filename);
       queryList.add(sContent);
       QueriesCmb.addItem(filename);
       SparqlTxtArea.setText(sContent);
       //   System.out.println(filename);
     }
     QueriesCmb.setSelectedIndex(children.length - 1);
   }
 } // GEN-LAST:event_LoadQueriesBtnMouseClicked
  /**
   * @param sourceFile File to read from
   * @return List of String objects with the shas
   */
  public static FileRequestFileContent readRequestFile(final File sourceFile) {
    if (!sourceFile.isFile() || !(sourceFile.length() > 0)) {
      return null;
    }
    Document d = null;
    try {
      d = XMLTools.parseXmlFile(sourceFile.getPath());
    } catch (final Throwable t) {
      logger.log(Level.SEVERE, "Exception in readRequestFile, during XML parsing", t);
      return null;
    }

    if (d == null) {
      logger.log(Level.SEVERE, "Could'nt parse the request file");
      return null;
    }

    final Element rootNode = d.getDocumentElement();

    if (rootNode.getTagName().equals(TAG_FrostFileRequestFile) == false) {
      logger.severe(
          "Error: xml request file does not contain the root tag '"
              + TAG_FrostFileRequestFile
              + "'");
      return null;
    }

    final String timeStampStr = XMLTools.getChildElementsTextValue(rootNode, TAG_timestamp);
    if (timeStampStr == null) {
      logger.severe("Error: xml file does not contain the tag '" + TAG_timestamp + "'");
      return null;
    }
    final long timestamp = Long.parseLong(timeStampStr);

    final List<Element> nodelist = XMLTools.getChildElementsByTagName(rootNode, TAG_shaList);
    if (nodelist.size() != 1) {
      logger.severe("Error: xml request files must contain only one element '" + TAG_shaList + "'");
      return null;
    }

    final Element rootShaNode = nodelist.get(0);

    final List<String> shaList = new LinkedList<String>();
    final List<Element> xmlKeys = XMLTools.getChildElementsByTagName(rootShaNode, TAG_sha);
    for (final Element el : xmlKeys) {

      final Text txtname = (Text) el.getFirstChild();
      if (txtname == null) {
        continue;
      }

      final String sha = txtname.getData();
      shaList.add(sha);
    }

    final FileRequestFileContent content = new FileRequestFileContent(timestamp, shaList);
    return content;
  }
Beispiel #18
0
 public synchronized List<Element> getRestriccionColored() {
   List<Element> resp = new ArrayList();
   for (Element e : restriccion) {
     if (!e.getCol().equals(WHITE)) {
       resp.add(e);
     }
   }
   return resp;
 }
Beispiel #19
0
 private static String[] splitLibDirPaths(String libDirPathsString) {
   List<String> libDirPathList = new ArrayList<String>(8);
   StringTokenizer stringTokenizer = new StringTokenizer(libDirPathsString, File.pathSeparator);
   while (stringTokenizer.hasMoreElements()) {
     String libDirPath = (String) stringTokenizer.nextElement();
     libDirPathList.add(libDirPath);
   }
   return libDirPathList.toArray(new String[libDirPathList.size()]);
 }
 public void addSchedulerListener(SchedulerListener schedulerListener) {
   if (schedulerListener != null) {
     List<SchedulerListener> l = listeners;
     if (l != null) {
       synchronized (l) {
         l.add(schedulerListener);
       }
     }
   }
 }
Beispiel #21
0
 /**
  * Returns all supported capture sizes.
  *
  * @return an array of capture sizes, in bytes, never <code>null</code>.
  */
 public Integer[] getCaptureSizes() {
   final String rawValue = this.properties.get(DEVICE_CAPTURESIZES);
   final String[] values = rawValue.split(",\\s*");
   final List<Integer> result = new ArrayList<Integer>();
   for (String value : values) {
     result.add(Integer.valueOf(value.trim()));
   }
   Collections.sort(
       result, NumberUtils.<Integer>createNumberComparator(false /* aSortAscending */));
   return result.toArray(new Integer[result.size()]);
 }
Beispiel #22
0
  /**
   * Create a UPnP candidate.
   *
   * @param socket local socket
   * @param externalIP external IP address
   * @param port local port
   * @param component parent component
   * @param device the UPnP gateway device
   * @return a new <tt>UPNPCandidate</tt> instance which represents the specified
   *     <tt>TransportAddress</tt>
   * @throws Exception if something goes wrong during candidate creation
   */
  private List<LocalCandidate> createUPNPCandidate(
      IceSocketWrapper socket,
      String externalIP,
      int port,
      Component component,
      GatewayDevice device)
      throws Exception {
    List<LocalCandidate> ret = new ArrayList<>();
    TransportAddress addr = new TransportAddress(externalIP, port, Transport.UDP);

    HostCandidate base = new HostCandidate(socket, component);

    UPNPCandidate candidate = new UPNPCandidate(addr, base, component, device);
    IceSocketWrapper stunSocket = candidate.getStunSocket(null);
    candidate.getStunStack().addSocket(stunSocket);
    component.getComponentSocket().add(candidate.getCandidateIceSocketWrapper());

    ret.add(candidate);
    ret.add(base);

    return ret;
  }
  /**
   * Adds a specific <tt>LocalCandidate</tt> to the list of <tt>LocalCandidate</tt>s harvested for
   * {@link #hostCandidate} by this harvest.
   *
   * @param candidate the <tt>LocalCandidate</tt> to be added to the list of
   *     <tt>LocalCandidate</tt>s harvested for {@link #hostCandidate} by this harvest
   * @return <tt>true</tt> if the list of <tt>LocalCandidate</tt>s changed as a result of the method
   *     invocation; otherwise, <tt>false</tt>
   */
  protected boolean addCandidate(LocalCandidate candidate) {
    boolean added;

    // try to add the candidate to the component and then only add it to the
    // harvest if it wasn't deemed redundant
    if (!candidates.contains(candidate)
        && hostCandidate.getParentComponent().addLocalCandidate(candidate)) {
      added = candidates.add(candidate);
    } else {
      added = false;
    }
    return added;
  }
Beispiel #24
0
  /**
   * Returns the String array of the specified property, or null in case the returned property
   * string array had zero length.
   *
   * @param propertyName the name of the property that is being queried.
   * @param regex the delimiting regular expression
   * @return the array of strings computed by splitting the specified property value around matches
   *     of the given regular expression
   */
  public static String[] getStringArray(String propertyName, String regex) {
    String str = getString(propertyName);
    if (str == null) return null;

    String[] parts = str.split(regex);

    // Remove mal-formatted entries.
    List<String> res = new ArrayList<String>();
    for (String s : parts) if (s != null && s.trim().length() != 0) res.add(s);

    if (res.size() == 0) return null;

    return res.toArray(new String[res.size()]);
  }
  @Override
  public List<IMatchresultDto> getAll() throws NotFoundException {
    try {
      List<IMatchresultDto> result = new LinkedList<>();

      for (contract.domain.IMatchresult a :
          DomainFacade.getInstance().getAll(contract.domain.IMatchresult.class)) {
        result.add(MatchresultDto.copy(a));
      }

      return result;
    } catch (CouldNotFetchException ex) {
      throw new NotFoundException(ex);
    }
  }
  /** @param args the command line arguments */
  public static void main(String[] args) {
    // TODO code application logic here

    long lNumOfLines = 0;
    List list1 = new ArrayList();

    try {
      FileInputStream fstream = new FileInputStream("n:\\myphd\\dataset\\gps.csv");
      // Get the object of DataInputStream
      DataInputStream in = new DataInputStream(fstream);
      BufferedReader br = new BufferedReader(new InputStreamReader(in));
      String strLine;
      // Read File Line By Line
      while ((strLine = br.readLine()) != null) {
        // Print the content on the console
        lNumOfLines++;
        list1.add(strLine.trim());
      }
      // Close the input stream
      in.close();
    } catch (Exception e) { // Catch exception if any
      System.err.println("Error: " + e.getMessage());
    }

    long lTotal = 1000000;
    long numberOfLines = 0;
    long lStep = lTotal / lNumOfLines;
    System.out.println("lTotal:" + lTotal + " numberOfLines:" + numberOfLines + "lStep:" + lStep);
    float fSpeed = 100;
    float newfSpeed = 0;
    for (int iNum = 0; iNum < lStep; iNum++) {
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(1000);
      float f = (float) randomInt / 10000.0f;
      System.out.println("Random Int:" + randomInt + " f:" + f);
      if ((randomInt % 2) == 0) {
        newfSpeed = fSpeed + fSpeed * f;
        System.out.println("Even");
      } else {
        newfSpeed = fSpeed - fSpeed * f;
        System.out.println("odd");
      }
      // InsertInstance(fLat,fLon,fAlt,fSpeed,sDate,sTimestamp,sBTAddress,sBTName,sURI);
      System.out.println("generated speed:" + newfSpeed);
    }
  }
  public static void main(String args[]) throws Exception {
    List<ServerAddress> addrs = new LinkedList<ServerAddress>();
    addrs.add(new ServerAddress("127.0.0.1", 27017));
    addrs.add(new ServerAddress("127.0.0.1", 27018));

    Mongo m = new Mongo(addrs);

    ReplicaSetStatus status = new ReplicaSetStatus(m, addrs);
    System.out.println(status.ensureMaster()._addr);

    while (true) {
      System.out.println(status.ready());
      if (status.ready()) {
        status.printStatus();
        System.out.println(
            "master: " + status.getMaster() + "\t secondary: " + status.getASecondary());
      }
      System.out.println("-----------------------");
      Thread.sleep(5000);
    }
  }
  public void actionPerformed(ActionEvent ae) {
    if (nodes != null && nodes.size() > 0) {
      final SVNData cd = new SVNData();
      List<String> paths = new ArrayList<String>();
      boolean has_directory = false;
      for (VPTNode node : nodes) {
        if (node != null && node.getNodePath() != null) {
          paths.add(node.getNodePath());
          if (node.isDirectory() || node.isProject()) {
            has_directory = true;
          }
        }
      }
      cd.setPaths(paths);
      if (has_directory) {
        int answer =
            JOptionPane.showConfirmDialog(
                view,
                "One or more of the items selected is a directory.\nWould you like to see status for subdirectories and files?",
                "Show Child Status?",
                JOptionPane.YES_NO_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (JOptionPane.CANCEL_OPTION == answer) {
          return;
        }
        cd.setRecursive(JOptionPane.YES_OPTION == answer);
      }
      if (username != null && password != null) {
        cd.setUsername(username);
        cd.setPassword(password);
      }

      cd.setOut(new ConsolePrintStream(view));

      StatusAction action = new StatusAction(view, cd);
      action.actionPerformed(null);
    }
  }
  /**
   * Look at the various property settings and create the command line for this server.
   *
   * @return the command line for this server.
   */
  protected List buildExecCommand() {

    try {
      String cmd = getCommand();
      if (cmd == null) {
        return null;
      }
      mLogger.finest(LogUtil.splitLine(cmd));
      // Get java specific properties
      LinkedList execTokens = tokenizeCommand(cmd);

      String firstToken = (String) execTokens.get(0);

      if (firstToken.equals("java")) { // This is a java command, so rework it

        if (execTokens.size() < 2) {
          return null;
        }

        mIsJavaServer = true;

        List props = new LinkedList();
        props.add(mPropertyPrefix + ".nativeLogging");
        props.add(WDConstants.WD_PREFIX + ".nativeLogging");
        String nativeLog = getProperty(props);
        if (nativeLog == null || nativeLog.equals("false")) {
          setNativeLoggingUsed(false);
        } else {
          setNativeLoggingUsed(true);
        }

        String mainClassName = (String) execTokens.getLast();

        List cmdLineFlags = null;
        if (execTokens.size() > 2) {
          cmdLineFlags = execTokens.subList(1, execTokens.size() - 1);
        }

        String javaClasspath = getJavaClasspath();
        String addCp = getJavaAdditionalClasspath();
        if (addCp != null) {
          javaClasspath += File.pathSeparator + addCp;
        }
        String jvm = getJavaJVM();
        String jvmType = getJVMType();
        List jvmFlags = getJVMFlags();
        List appArgs = getAppArgs();

        mServerCmd =
            new ServerCommand(
                jvm, jvmType, jvmFlags, javaClasspath, mainClassName, cmdLineFlags, appArgs);

        updateFlags(mServerCmd);
        updateServerCommandForSpecialHandling(mServerCmd);

        execTokens = mServerCmd.getTokens();
        mLogger.finest(LogUtil.splitLine(execTokens.toString()));
      } else {
        setNativeLoggingUsed(true);
      }
      return execTokens;
    } catch (Exception e) {
      mLogger.severe("Failed to buildExecCmd", e);
      return null;
    }
  }
 /**
  * Looks for properties "watchdog.server.&lt;SERVER_NAME&gt;.java.cp" followed by
  * "watchdog.java.cp" in the configuration and returns the first non-null value. If both are null,
  * returns null.
  */
 protected String getJavaAdditionalClasspath() {
   List queue = new LinkedList();
   queue.add(mPropertyPrefix + ".java.cp");
   queue.add(WDConstants.WD_PREFIX + ".java.cp");
   return getProperty(queue);
 }