/**
   * Deletes a meeting from the database
   *
   * <p>- Requires a cookie for the session user - Requires a meetingId request parameter for the
   * HTTP GET
   *
   * @param req The HTTP Request
   * @param res The HTTP Response
   */
  public void deletemeetingAction(HttpServletRequest req, HttpServletResponse res) {
    // Ensure there is a cookie for the session user
    if (AccountController.redirectIfNoCookie(req, res)) return;

    if (req.getMethod() == HttpMethod.Get) {

      // Get the meeting
      int meetingId = Integer.parseInt(req.getParameter("meetingId"));
      MeetingManager meetingMan = new MeetingManager();
      Meeting meeting = meetingMan.get(meetingId);
      meetingMan.deleteMeeting(meetingId);

      // Update the User Session to remove meeting
      HttpSession session = req.getSession();
      Session userSession = (Session) session.getAttribute("userSession");
      List<Meeting> adminMeetings = userSession.getUser().getMeetings();

      for (int i = 0; i < adminMeetings.size(); i++) {
        Meeting m = adminMeetings.get(i);
        if (m.getId() == meeting.getId()) {
          adminMeetings.remove(i);
          break;
        }
      }

      redirectToLocal(req, res, "/home/dashboard");
      return;

    } else if (req.getMethod() == HttpMethod.Post) {
      httpNotFound(req, res);
    }
  }
  public synchronized void dispose() {
    List<SchedulerListener> l = listeners;
    listeners = null;

    if (l != null) {
      boolean cont = true;
      while (cont) {
        synchronized (l) {
          int queueSize = getQueueSize();
          if (queueSize == 0) {
            cont = false;
          } else {
            try {
              l.wait();
            } catch (InterruptedException ex) {
              // Ignore!
            }
          }
        }
      }

      synchronized (l) {
        l.clear();
      }
    }
  }
  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);
    }
  }
예제 #4
0
 @Override
 public void processingInstruction(String target, String data) throws SAXException {
   _logger.fine("Processing Instruction " + target);
   _logger.fine("Processing Instruction data: " + data);
   if (target.equals("assemble")) {
     if (!_stack.isEmpty()) {
       ElementInfo element = _stack.get(_stack.size() - 1);
       Matcher matcher = PROCESSING_INSTRUCTION.matcher(data);
       while (matcher.find()) {
         if (matcher.groupCount() == 2) {
           String name = matcher.group(1);
           if (name.charAt(0) == '@') {
             element.inst.put(name, matcher.group(2));
           } else {
             element.args.add(guessUntypedValue(name, matcher.group(2)));
           }
           _logger.fine(
               "Processing Instruction for "
                   + element.data.getClass()
                   + "\n\ttarget = "
                   + target
                   + "\n\t"
                   + name
                   + "="
                   + matcher.group(2));
         }
       }
     }
   }
 }
예제 #5
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;
  }
예제 #6
0
  /**
   * Find mod files in the "mods" folder
   *
   * @param modFolder Folder to search
   * @param modFiles List of mod files to load
   */
  protected void findModFiles(File modFolder, LinkedList<File> modFiles) {
    List<String> supportedVerions = Arrays.asList(SUPPORTED_VERSIONS);

    for (File modFile : modFolder.listFiles(this)) {
      try {
        // Check for a version file
        ZipFile modZip = new ZipFile(modFile);
        ZipEntry version = modZip.getEntry("version.txt");

        if (version != null) {
          // Read the version string
          InputStream versionStream = modZip.getInputStream(version);
          BufferedReader versionReader = new BufferedReader(new InputStreamReader(versionStream));
          String strVersion = versionReader.readLine();
          versionReader.close();

          // Only add the mod if the version matches and we were able to successfully add it to the
          // class path
          if (supportedVerions.contains(strVersion) && addURLToClassPath(modFile.toURI().toURL())) {
            modFiles.add(modFile);
          }
        }

        modZip.close();
      } catch (Exception ex) {
        logger.warning(
            "Error enumerating '"
                + modFile.getAbsolutePath()
                + "': Invalid zip file or error reading file");
      }
    }
  }
예제 #7
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;
  }
예제 #8
0
  /* hack TODO do not know how to get int status back from Windows
   * Stick in code that handles particular commands that we can figure out
   * the status.
   */
  private int determineStatus(List<String> args) {
    if (args == null) throw new NullPointerException();

    if (args.size() < 2) return 0;

    String instanceName = args.get(args.size() - 1);

    if (isCommand(args, "_delete-instance-filesystem")) {
      try {
        String dir = Paths.getInstanceDirPath(node, instanceName);
        WindowsRemoteFile instanceDir = new WindowsRemoteFile(dcomInfo.getCredentials(), dir);
        return instanceDir.exists() ? 1 : 0;
      } catch (WindowsException ex) {
        return 0;
      }
    } else if (isCommand(args, "_create-instance-filesystem")) {
      try {
        String dir = Paths.getDasPropsPath(node);
        WindowsRemoteFile dasProps = new WindowsRemoteFile(dcomInfo.getCredentials(), dir);

        if (dasProps.exists()) return 0;

        // uh-oh.  Wipe out the instance directory that was created
        dir = Paths.getInstanceDirPath(node, instanceName);
        WindowsRemoteFile instanceDir = new WindowsRemoteFile(dcomInfo.getCredentials(), dir);
        instanceDir.delete();
        return 1;
      } catch (WindowsException ex) {
        return 1;
      }
    }
    return 0;
  }
예제 #9
0
 /**
  * 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;
 }
예제 #10
0
  protected void prepare() throws Exception {
    try {

      List execCommand = buildExecCommand();

      if (execCommand == null) {
        mLogger.severe("No command property was specified; disabling server");
        synchronized (this) {
          changeState(STATE_DISABLED);
        }
        return;
      } else {
        mExecArgs = (String[]) execCommand.toArray(new String[0]);
        StringBuffer printableCmd = new StringBuffer(4096);
        int index = 0;
        for (; index < mExecArgs.length - 1; index++) {
          printableCmd.append(mExecArgs[index]).append(" ");
        }
        printableCmd.append(mExecArgs[index]);
        mPrintableCommand = printableCmd.toString();

        if (useOptimizeIt()) {
          System.err.println(mPrintableCommand);
        }
      }
    } catch (Exception ex) {
      mLogger.severe("Failed In preparing execargs");
      throw ex;
    }
  }
예제 #11
0
  /*
   * return 0 is success, otherwise failure
   */
  public final int runAdminCommandOnRemoteNode(
      Node thisNode, StringBuilder output, List<String> args, List<String> stdinLines)
      throws SSHCommandExecutionException, IllegalArgumentException, UnsupportedOperationException {

    String humanreadable = null;
    try {
      this.node = thisNode;
      dcomInfo = new DcomInfo(node);
      List<String> fullcommand = new ArrayList<String>();
      WindowsRemoteAsadmin asadmin = dcomInfo.getAsadmin();

      if (stdinLines != null && !stdinLines.isEmpty()) setupAuthTokenFile(fullcommand, stdinLines);

      fullcommand.addAll(args);
      humanreadable = dcomInfo.getNadminPath() + " " + commandListToString(fullcommand);

      // This is where the rubber meets the road...
      String out = asadmin.run(fullcommand);
      output.append(out);
      logger.info(Strings.get("remote.command.summary", humanreadable, out));
      return determineStatus(args);
    } catch (WindowsException ex) {
      throw new SSHCommandExecutionException(
          Strings.get("remote.command.error", ex.getMessage(), humanreadable), ex);
    } finally {
      teardownAuthTokenFile();
    }
  }
예제 #12
0
 /**
  * Stores the value for the given field associated to last inserted symbol. If no symbol has been
  * inserted yet, an exception occurs.
  */
 public void putValue(final Field field, final double val) {
   final String symbol = symbols.get(symbols.size() - 1);
   Map<Field, Double> vs = values.get(symbol);
   if (vs == null) vs = new HashMap<Field, Double>();
   vs.put(field, val);
   this.values.put(symbol, vs);
 }
  @Override
  public void processCalculations(final User u, final Entity point, final Value value)
      throws NimbitsException {

    final List<Entity> calculations =
        EntityServiceFactory.getInstance().getEntityByTrigger(u, point, EntityType.calculation);
    for (final Entity entity : calculations) {
      Calculation c = (Calculation) entity;
      try {

        final List<Entity> target =
            EntityServiceFactory.getInstance().getEntityByKey(u, c.getTarget(), EntityType.point);
        if (target.isEmpty()) {
          log.severe("Point target was null " + c.getTarget());
          log.severe(c.getFormula());
          log.severe("trigger: " + c.getTrigger());
          disableCalc(u, c);
        } else {
          log.info("Solving calc" + c.getFormula());
          final Value result = solveEquation(u, c);
          log.info("result" + result);
          ValueServiceFactory.getInstance().recordValue(u, target.get(0), result);
        }
      } catch (NimbitsException e1) {
        LogHelper.logException(this.getClass(), e1);
        disableCalc(u, c);
      }
    }
  }
예제 #14
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;
  }
예제 #15
0
 /**
  * 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;
 }
예제 #16
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;
 }
  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;
  }
예제 #18
0
  /**
   * @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;
  }
예제 #19
0
  /**
   * Receives a <tt>DatagramPacket</tt> from a specific list of <tt>DatagramPacket</tt>s if it is
   * not empty or from the network if the specified list is empty. When this method returns, the
   * <tt>DatagramPacket</tt>'s buffer is filled with the data received. The datagram packet also
   * contains the sender's IP address, and the port number on the sender's machine.
   *
   * @param received the list of previously received <tt>DatagramPacket</tt> from which the first is
   *     to be removed and returned if available
   * @param p the <tt>DatagramPacket</tt> into which to place the incoming data
   * @throws IOException if an I/O error occurs
   */
  private void receive(List<DatagramPacket> received, DatagramPacket p) throws IOException {
    DatagramPacket r = null;

    do {
      boolean doReceive;

      synchronized (receiveSyncRoot) {
        if (received.isEmpty()) {
          if (inReceive) {
            doReceive = false;
            try {
              receiveSyncRoot.wait();
            } catch (InterruptedException iex) {
              continue;
            }
          } else {
            doReceive = true;
            inReceive = true;
          }
        } else {
          doReceive = false;
          r = received.remove(0);
        }
      }
      if (doReceive) {
        try {
          super.receive(p);

          synchronized (receiveSyncRoot) {
            synchronized (socketsSyncRoot) {
              boolean accepted = false;

              for (MultiplexedDatagramSocket socket : sockets)
                if (socket.getFilter().accept(p)) {
                  socket.received.add(clone(p));
                  accepted = true;

                  /*
                   * Emil: Don't break because we want all
                   * filtering sockets to get this.
                   */
                  // break;
                }

              if (!accepted) this.received.add(clone(p));
            }
          }
        } finally {
          synchronized (receiveSyncRoot) {
            inReceive = false;
            receiveSyncRoot.notify();
          }
        }
      }
    } while (r == null);

    copy(r, p);
  }
예제 #20
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);
 }
예제 #21
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;
 }
예제 #22
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()]);
 }
예제 #23
0
 /**
  * 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;
 }
 public void removeSchedulerListener(SchedulerListener schedulerListener) {
   if (schedulerListener != null) {
     List<SchedulerListener> l = listeners;
     if (l != null) {
       synchronized (l) {
         l.remove(schedulerListener);
       }
     }
   }
 }
 public void addSchedulerListener(SchedulerListener schedulerListener) {
   if (schedulerListener != null) {
     List<SchedulerListener> l = listeners;
     if (l != null) {
       synchronized (l) {
         l.add(schedulerListener);
       }
     }
   }
 }
예제 #26
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()]);
 }
예제 #27
0
 /**
  * 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;
 }
예제 #28
0
  /**
   * 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);
  }
예제 #29
0
  /**
   * 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;
  }
예제 #30
0
  protected static int processGet() throws NimbitsException {
    final List<Entity> points = EntityServiceFactory.getInstance().getIdleEntities();
    log.info("Processing " + points.size() + " potentially idle points");
    for (final Entity p : points) {
      try {
        checkIdle((Point) p);
      } catch (NimbitsException e) {

        LogHelper.logException(IdlePointCron.class, e);
      }
    }
    return points.size();
  }