示例#1
0
  public static boolean isTextValid(String aText, boolean canBeNull) {
    if (!canBeNull && (aText == null || aText.trim().length() == 0)) {
      return (false);
    }

    if (canBeNull && (aText == null || aText.trim().length() == 0)) {
      return (true);
    }

    String checkText = aText.toUpperCase();
    try {
      Pattern pattern =
          Pattern.compile(
              patternStr, Pattern.DOTALL + Pattern.CASE_INSENSITIVE + Pattern.UNIX_LINES);
      Matcher matcher = pattern.matcher(checkText);
      if (matcher.matches()) {
        return (false);
      }
      Pattern patternHex =
          Pattern.compile(
              hexPatternStr, Pattern.DOTALL + Pattern.CASE_INSENSITIVE + Pattern.UNIX_LINES);
      Matcher matcherHex = patternHex.matcher(checkText);
      if (matcherHex.matches()) {
        return (false);
      }
    } catch (Exception e) {
      Debug.info("Threw exception " + e.getMessage());
      return (false);
    }

    return (true);
  }
示例#2
0
  /** Terminates the application */
  public void destroy() {
    try {

      Debug.info(
          "******* UniTime "
              + Constants.getVersion()
              + " build on "
              + Constants.getReleaseDate()
              + " is going down *******");

      super.destroy();

      Debug.info(" - Stopping Online Sectioning Service ...");
      OnlineSectioningService.stopService();

      Debug.info(" - Stopping Solver Register ... ");
      SolverRegisterService.stopService();
      try {
        SolverRegisterService.removeShutdownHook();
      } catch (IllegalStateException e) {
      }

      SolverInfo.stopInfoCacheCleanup();

      ApplicationProperties.stopListener();

      if (RoomAvailability.getInstance() != null) {
        Debug.info(" - Stopping Room Availability Service ... ");
        RoomAvailability.getInstance().stopService();
      }

      QueueProcessor.stopProcessor();

      Debug.info("******* UniTime " + Constants.getVersion() + " shut down successfully *******");
    } catch (Exception e) {
      Debug.error("UniTime Shutdown Failed : " + e.getMessage(), e);
      if (e instanceof RuntimeException) throw (RuntimeException) e;
      else throw new RuntimeException("UniTime Shutdown Failed : " + e.getMessage(), e);
    }
  }
示例#3
0
 public void run() {
   Debug.info("InfoCache cleanup thread started.");
   try {
     while (true) {
       sleep(sInfoCacheCleanupInterval);
       if (sInfoCache == null) return;
       synchronized (sInfoCache) {
         if (sInfoCache.isEmpty()) continue;
         for (Iterator i = sInfoCache.entrySet().iterator(); i.hasNext(); ) {
           Map.Entry entry = (Map.Entry) i.next();
           CachedTimetableInfo cInfo = (CachedTimetableInfo) entry.getValue();
           if (cInfo.getAge() > sInfoCacheTimeToLive) {
             i.remove();
           }
         }
       }
     }
   } catch (InterruptedException ex) {
     Debug.info("InfoCache cleanup thread interrupted.");
   }
   Debug.info("InfoCache cleanup thread finished.");
 }
示例#4
0
  /** Initializes the application */
  public void init() throws ServletException {

    Debug.info(
        "******* UniTime "
            + Constants.getVersion()
            + " build on "
            + Constants.getReleaseDate()
            + " is starting up *******");

    super.init();

    try {

      Debug.info(" - Initializing Logging ... ");
      Debug.init(ApplicationProperties.getProperties());

      Debug.info(" - Initializing Hibernate ... ");
      _RootDAO.initialize();

      Debug.info(" - Initializing Solver Register ... ");
      SolverRegisterService.startService();
      SolverRegisterService.addShutdownHook();

      if (RoomAvailability.getInstance() != null) {
        Debug.info(" - Initializing Room Availability Service ... ");
        RoomAvailability.getInstance().startService();
      }

      Debug.info(" - Cleaning Logs ...");
      LogCleaner.cleanupLogs();

      Debug.info(" - Starting Online Sectioning Service ...");
      OnlineSectioningService.startService();

      Debug.info(
          "******* UniTime "
              + Constants.getVersion()
              + " build on "
              + Constants.getReleaseDate()
              + " initialized successfully *******");

    } catch (Exception e) {
      Debug.error("UniTime Initialization Failed : " + e.getMessage(), e);
      sInitializationException = e;
    }
  }
 public void valueUnbound(HttpSessionBindingEvent evt) {
   Debug.info("TT Session value unbound ... " + evt.getSession().getId());
 }
 public void sessionDidActivate(HttpSessionEvent evt) {
   Debug.info("TT Session did activate ... " + evt.getSession().getId());
 }
 public void sessionWillPassivate(HttpSessionEvent evt) {
   Debug.info("TT Session will passivate ... " + evt.getSession().getId());
 }