/** Remove all messages from the table (but leave "most recent") */
 public void clearAll() {
   int last_row = data.size() - 1;
   if (last_row > 0) {
     data.removeAllElements();
     SOAPMonitorData soap = new SOAPMonitorData(null, null, null);
     data.addElement(soap);
     if (filter_data != null) {
       filter_data.removeAllElements();
       filter_data.addElement(soap);
     }
     fireTableDataChanged();
   }
 }
Exemplo n.º 2
0
 public void setConnected(boolean b, boolean process_pending) {
   if (b && state != ConnectionEvent.CONNECTION_OPENED) {
     if (host.length() > 0)
       ExpCoordinator.print(
           "NCCPConnection open connection to ipaddress " + host + " port " + port);
     state = ConnectionEvent.CONNECTION_OPENED;
     // connected = true;
     fireEvent(new ConnectionEvent(this, state));
     ExpCoordinator.printer.print("NCCPConnection.setConnected " + b + " event fired", 8);
     if (process_pending) {
       int max = pendingMessages.size();
       ExpCoordinator.printer.print(new String("   pendingMessages " + max + " elements"), 8);
       for (int i = 0; i < max; ++i) {
         sendMessage((NCCP.Message) pendingMessages.elementAt(i));
       }
       pendingMessages.removeAllElements();
     }
   } else {
     if (!b
         && (state != ConnectionEvent.CONNECTION_CLOSED
             || state != ConnectionEvent.CONNECTION_FAILED)) {
       if (host.length() > 0)
         ExpCoordinator.print(
             new String(
                 "NCCPConnection.setConnected -- Closed control socket for " + host + "." + port));
       state = ConnectionEvent.CONNECTION_CLOSED;
       fireEvent(new ConnectionEvent(this, state));
     }
   }
 }
Exemplo n.º 3
0
 protected void layoutFooter(Page page) {
   ServletUtil.doLayoutFooter(
       page, (footnotes == null ? null : footnotes.iterator()), getLockssApp().getVersionInfo());
   if (footnotes != null) {
     footnotes.removeAllElements();
   }
 }
Exemplo n.º 4
0
 /**
  * Store a footnote, assign it a number, return html for footnote reference. If footnote in null
  * or empty, no footnote is added and an empty string is returned. Footnote numbers get turned
  * into links; <b>Do not put the result of addFootnote inside a link!</b>.
  */
 protected String addFootnote(String s) {
   if (s == null || s.length() == 0) {
     return "";
   }
   if (footNumber == 0) {
     if (footnotes == null) {
       footnotes = new Vector(10, 10);
     } else {
       footnotes.removeAllElements();
     }
   }
   int n = footnotes.indexOf(s);
   if (n < 0) {
     n = footNumber++;
     footnotes.addElement(s);
   }
   return "<sup><font size=-1><a href=#foottag" + (n + 1) + ">" + (n + 1) + "</a></font></sup>";
 }
Exemplo n.º 5
0
  void handleDownEvent(Event evt) {
    switch (evt.getType()) {
      case Event.TMP_VIEW:
      case Event.VIEW_CHANGE:
        synchronized (members) {
          members.removeAllElements();
          Vector tmpvec = ((View) evt.getArg()).getMembers();
          for (int i = 0; i < tmpvec.size(); i++) {
            members.addElement(tmpvec.elementAt(i));
          }
        }
        break;

      case Event.GET_LOCAL_ADDRESS: // return local address -> Event(SET_LOCAL_ADDRESS, local)
        passUp(new Event(Event.SET_LOCAL_ADDRESS, local_addr));
        break;

      case Event.CONNECT:
        group_addr = (String) evt.getArg();
        udp_hdr = new UdpHeader(group_addr);

        // removed March 18 2003 (bela), not needed (handled by GMS)
        // changed July 2 2003 (bela): we discard CONNECT_OK at the GMS level anyway, this might
        // be needed if we run without GMS though
        passUp(new Event(Event.CONNECT_OK));
        break;

      case Event.DISCONNECT:
        passUp(new Event(Event.DISCONNECT_OK));
        break;

      case Event.CONFIG:
        if (Trace.trace) {
          Trace.info("UDP.down()", "received CONFIG event: " + evt.getArg());
        }
        handleConfigEvent((HashMap) evt.getArg());
        break;
    }
  }
Exemplo n.º 6
0
  private static void readConfig(File confFile) {

    System.out.println("Reading configuration file: " + confFile);

    try {
      StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new FileReader(confFile)));
      tokenizer.eolIsSignificant(true);
      tokenizer.slashStarComments(true);

      boolean EOF = false;
      int tokType = 0;
      Vector words = new Vector();
      while (!EOF) {
        if ((tokType = tokenizer.nextToken()) == StreamTokenizer.TT_EOF) {
          EOF = true;
        } else if (tokType != StreamTokenizer.TT_EOL) {
          if (tokenizer.sval != null) {
            words.addElement(tokenizer.sval);
          }
        } else {
          if (words.size() == 2) {
            String key = (String) words.elementAt(0);
            String value = (String) words.elementAt(1);
            if (key.equals("SRSServer")) {
              srsServer = new String(value);
            } else if (key.equals("Database")) {
              database = new String(value);
            } else if (key.equals("Layout")) {
              layout = new String(value);
            } else if (key.equals("AutosaveInterval")) {
              if (value.equals("none")) {
                setAutosaveInterval(-1);
              } else {
                try {
                  setAutosaveInterval(Integer.parseInt(value));
                } catch (NumberFormatException e) {
                  System.err.println("Can't parse number: " + value);
                }
              }
            } else if (key.equals("ColourSchemeInstall")) {
              try {
                String installString = value;
                int breakIndex = installString.indexOf(":");

                if (breakIndex < 0) {
                  // adapterRegistry.installDataAdapter(installString);
                } else {
                  String driverName = installString.substring(0, breakIndex);
                  String driverDesc = installString.substring(breakIndex + 1);
                  // adapterRegistry.installDataAdapter(driverName);
                }
              } catch (Throwable e) {
                System.err.println("Could not install driver " + value + " because of " + e);
              }
            } else if (key.equals("FormatAdapterInstall")) {
              try {
                String installString = value;
                int breakIndex = installString.indexOf(":");

                if (breakIndex < 0) {
                  // adapterRegistry.installDataAdapter(installString);
                } else {
                  String driverName = installString.substring(0, breakIndex);
                  String driverDesc = installString.substring(breakIndex + 1);
                  // adapterRegistry.installDataAdapter(driverName);
                }
              } catch (Throwable e) {
                System.err.println("Could not install driver " + value + " because of " + e);
              }
            } else {
              System.out.println("Unknown config key " + key);
            }
          } else {
            if (words.size() != 0) {
              System.out.println(
                  "Too many words on line beginning "
                      + (String) words.elementAt(0)
                      + " in config file");
            }
          }

          words.removeAllElements();
        }
      }
      return;

    } catch (Exception ex) {
      System.out.println(ex);
      return;
    }
  }