Example #1
0
 /** List file names */
 public Enumeration nlst(String s) throws IOException {
   InetAddress inetAddress = InetAddress.getLocalHost();
   byte ab[] = inetAddress.getAddress();
   serverSocket_ = new ServerSocket(0, 1);
   StringBuffer sb = new StringBuffer(32);
   sb.append("PORT ");
   for (int i = 0; i < ab.length; i++) {
     sb.append(String.valueOf(ab[i] & 255));
     sb.append(",");
   }
   sb.append(String.valueOf(serverSocket_.getLocalPort() >>> 8 & 255));
   sb.append(",");
   sb.append(String.valueOf(serverSocket_.getLocalPort() & 255));
   if (issueCommand(sb.toString()) != FTP_SUCCESS) {
     serverSocket_.close();
     throw new IOException(getResponseString());
   } else if (issueCommand("NLST " + ((s == null) ? "" : s)) != FTP_SUCCESS) {
     serverSocket_.close();
     throw new IOException(getResponseString());
   }
   dataSocket_ = serverSocket_.accept();
   serverSocket_.close();
   serverSocket_ = null;
   Vector v = readServerResponse_(dataSocket_.getInputStream());
   dataSocket_.close();
   dataSocket_ = null;
   return (v == null) ? null : v.elements();
 }
Example #2
0
  protected Vector /* of TTPNode */ queryPNodes1(String query) throws IOException {
    write(query);
    Vector lines = readlines();
    Vector r = new Vector();
    for (Enumeration e = lines.elements(); e.hasMoreElements(); ) {
      Vector line = stringToVector((String) e.nextElement(), ":");

      TTLexEntry le = new TTLexEntry();
      le.citationForm = (String) line.elementAt(0);
      le.features = (String) line.elementAt(1);
      le.inflection = (String) line.elementAt(2);
      le.inflFeatures = (String) line.elementAt(3);

      TTLexEntryToObj leo = new TTLexEntryToObj();
      leo.lexentry = le;
      leo.objname = (String) line.elementAt(4);
      leo.features = (String) line.elementAt(5);

      TTPNode pn = new TTPNode();
      pn.feature = TT.featureGet(le.features, TT.FT_POS, TT.F_NULL);
      pn.leo = leo;
      pn.startpos = TT.longParse((String) line.elementAt(8), true);
      pn.endpos = TT.longParse((String) line.elementAt(9), true);

      r.addElement(pn);
    }
    return r;
  }
Example #3
0
  /** Mthis method perform equals based on string rapresentation of objects */
  public static void updateStringComboBox(
      javax.swing.JComboBox comboBox, Vector newItems, boolean addNullEntry) {
    Object itemSelected = null;
    if (comboBox.getSelectedIndex() >= 0) {
      itemSelected = comboBox.getSelectedItem() + "";
    }

    comboBox.removeAllItems();
    boolean selected = false;
    boolean foundNullItem = false;
    Enumeration e = newItems.elements();
    while (e.hasMoreElements()) {
      String item = "" + e.nextElement();
      comboBox.addItem(item);
      if (item.equals(itemSelected)) {
        selected = true;
        comboBox.setSelectedItem(itemSelected);
      }
      if (item.equals("")) {
        foundNullItem = true;
      }
    }

    if (addNullEntry) {
      if (!foundNullItem) comboBox.insertItemAt("", 0);
      if (!selected) comboBox.setSelectedItem("");
    }
  }
 public void addJavaLibraries() {
   final Vector<String> packages = JavaEnvUtils.getJrePackages();
   final Enumeration<String> e = packages.elements();
   while (e.hasMoreElements()) {
     final String packageName = e.nextElement();
     this.addSystemPackageRoot(packageName);
   }
 }
Example #5
0
 protected Vector /* of Object */ queryAssertionLines1(String query) throws IOException {
   write(query);
   Vector v = readlines();
   Vector r = new Vector();
   for (Enumeration e = v.elements(); e.hasMoreElements(); ) {
     r.addElement(TT.stringToObject((String) e.nextElement()));
   }
   return r;
 }
 /*
  * Applet is no longer displayed
  */
 public void stop() {
   // Tell all pages to stop talking to the server
   Enumeration e = pages.elements();
   while (e.hasMoreElements()) {
     SOAPMonitorPage pg = (SOAPMonitorPage) e.nextElement();
     if (pg != null) {
       pg.stop();
     }
   }
 }
 /** Check if soap data matches filter */
 public boolean filterMatch(SOAPMonitorData soap) {
   boolean match = true;
   if (filter_include != null) {
     // Check for service match
     Enumeration e = filter_include.elements();
     match = false;
     while (e.hasMoreElements() && !match) {
       String service = (String) e.nextElement();
       if (service.equals(soap.getTargetService())) {
         match = true;
       }
     }
   }
   if (filter_exclude != null) {
     // Check for service match
     Enumeration e = filter_exclude.elements();
     while (e.hasMoreElements() && match) {
       String service = (String) e.nextElement();
       if (service.equals(soap.getTargetService())) {
         match = false;
       }
     }
   }
   if (filter_active) {
     // Check for active status match
     if (soap.getSOAPResponse() != null) {
       match = false;
     }
   }
   if (filter_complete) {
     // Check for complete status match
     if (soap.getSOAPResponse() == null) {
       match = false;
     }
   }
   // The "most recent" is always a match
   if (soap.getId() == null) {
     match = true;
   }
   return match;
 }
Example #8
0
  public String toString() {
    String s = "[" + helper_type + ";";
    for (Enumeration e = seq.elements(); e.hasMoreElements(); ) {
      try {
        Class c = (Class) e.nextElement();
        s += c.getName() + ",";
      } catch (NoSuchElementException ee) {
        s += "???" + ",";
      }
    }

    return s + "]";
  }
  private synchronized void broadcast(int i) {
    ObjectOutputStream dataOut = null;

    for (Enumeration e = clients.elements(); e.hasMoreElements(); ) {
      dataOut = (ObjectOutputStream) (e.nextElement());
      try {
        dataOut.writeInt(i);
        dataOut.flush();
      } catch (Exception x) {
        System.out.println(x.getMessage() + ": Failed to broadcast to client.");
        clients.removeElement(dataOut);
      }
    }
  }
Example #10
0
 /** Met à jour le cache en fonction de la liste todo */
 private void updateCache() {
   aladin.trace(2, "Start cache updater...");
   Vector v;
   synchronized (this) {
     v = (Vector) todo.clone();
     todo.clear();
   }
   Enumeration e = v.elements();
   while (e.hasMoreElements()) {
     String url = (String) e.nextElement();
     try {
       putInCache(url);
     } catch (Exception e1) {
     }
     Util.pause(1000); // Pose entre deux
   }
   fin();
 }
 /** Refilter the list of messages */
 public void applyFilter() {
   // Re-filter using new criteria
   filter_data = null;
   if ((filter_include != null)
       || (filter_exclude != null)
       || filter_active
       || filter_complete) {
     filter_data = new Vector();
     Enumeration e = data.elements();
     SOAPMonitorData soap;
     while (e.hasMoreElements()) {
       soap = (SOAPMonitorData) e.nextElement();
       if (filterMatch(soap)) {
         filter_data.addElement(soap);
       }
     }
   }
   fireTableDataChanged();
 }
Example #12
0
  protected Vector /* of TTLexEntryToObj */ queryLeos1(String query) throws IOException {
    write(query);
    Vector lines = readlines();
    Vector r = new Vector();
    for (Enumeration e = lines.elements(); e.hasMoreElements(); ) {
      Vector line = stringToVector((String) e.nextElement(), ":");

      TTLexEntry le = new TTLexEntry();
      le.citationForm = (String) line.elementAt(0);
      le.features = (String) line.elementAt(1);
      le.inflection = (String) line.elementAt(2);
      le.inflFeatures = (String) line.elementAt(3);

      TTLexEntryToObj leo = new TTLexEntryToObj();
      leo.lexentry = le;
      leo.objname = (String) line.elementAt(4);
      leo.features = (String) line.elementAt(5);

      r.addElement(leo);
    }
    return r;
  }
  public FunctionalTest() throws IOException {
    Vector v = new Vector();
    for (Enumeration e = v.elements(); e.hasMoreElements(); ) {}
    IOException e = new IOException();

    // this is to test excluding literals
    String buz = "text/plain";

    // this is to test array handling
    ArrayList[] foo = new ArrayList[0];
    ArrayList bar = new ArrayList();
    bar.add(HashSet.class);
    bar.add(Integer.class);
    File[] files = (File[]) bar.toArray(new File[0]);

    // this is to test imports of inner classes
    HashMap biv = new HashMap();
    Set set = biv.entrySet();
    Iterator iter = set.iterator();
    bar.add((Entry) iter.next());

    // this is to test inclusion of classes from java.lang.reflect
    Modifier m = new Modifier();

    // This next one can't be picked up by importscrubber because the compiler inlines it
    // System.out.println("A JOptionPane thingy " + JOptionPane.CANCEL_OPTION);
    // bummer!

    // this is to test importing a class and only calling a static method on it
    // Buz.doSomething();

    // this is to test NOT importing classes which are fully qualified in the class body
    // java.sql.Date sqlDate = new java.sql.Date(20);
    // Date javaDate = new Date();

    throw new IllegalArgumentException();
  }
Example #14
0
 public Enumeration getWelcomeFiles() {
   return welcomeFiles.elements();
 }
Example #15
0
 public Enumeration getHostAliases() {
   return vhostAliases.elements();
 }
Example #16
0
  /**
   * Contact a belief network context, get the helper list, and search the list to see if there's a
   * helper which matches the type sequence specified. If there's more than one helper which
   * matches, find the ``best fit.''
   *
   * <p>The class and count scores of the best-fitting helper class are written into
   * <tt>max_class_score[0]</tt> and <tt>max_count_score[0]</tt>, respectively.
   */
  public static Class find_helper_class0(
      Vector seq, String helper_type, int[] max_class_score, int[] max_count_score)
      throws ClassNotFoundException {
    long t0 = System.currentTimeMillis();
    if (bnc != null) // make sure the reference is still alive
    try {
        bnc.get_name();
      } catch (RemoteException e) {
        bnc = null;
      }

    if (bnc == null) // need to locate a context
    {
      String cb = System.getProperty("java.rmi.server.codebase", "http://localhost");
      long tt0 = System.currentTimeMillis();
      try {
        bnc = BeliefNetworkContext.locate_context(new URL(cb).getHost());
      } catch (Exception e) {
        throw new ClassNotFoundException("nested: " + e);
      }
    }

    String[] helperlist;
    try {
      helperlist = bnc.get_helper_names(helper_type);
    } catch (RemoteException e) {
      throw new ClassNotFoundException("bnc.get_helper_names failed");
    }

    int[] class_score1 = new int[1], count_score1 = new int[1];
    max_class_score[0] = -1;
    max_count_score[0] = -1;
    Class cmax_score = null;

    for (int i = 0; i < helperlist.length; i++) {
      try {
        Class c = RMIClassLoader.loadClass(helperlist[i]);
        SeqTriple[] sm = (SeqTriple[]) invoke_description(c);
        if (sm == null) continue; // apparently not a helper class
        if (MatchClassPattern.matches(sm, seq, class_score1, count_score1)) {
          if (class_score1[0] > max_class_score[0]
              || (class_score1[0] == max_class_score[0] && count_score1[0] > max_count_score[0])) {
            cmax_score = c;
            max_class_score[0] = class_score1[0];
            max_count_score[0] = count_score1[0];
          }
        }
      } catch (Exception e2) {
        System.err.println("PiHelperLoader: attempt to load " + helperlist[i] + " failed; " + e2);
      }
    }

    if (cmax_score == null) {
      System.err.println("find_helper_class0: failed; helper list:");
      for (int i = 0; i < helperlist.length; i++) System.err.println("\t" + helperlist[i]);

      String s = "";
      for (Enumeration e = seq.elements(); e.hasMoreElements(); ) {
        try {
          Class c = (Class) e.nextElement();
          s += c.getName() + ",";
        } catch (NoSuchElementException ee) {
          s += "???" + ",";
        }
      }

      throw new ClassNotFoundException("no " + helper_type + " helper for sequence [" + s + "]");
    }

    // FOR NOW IGNORE THE POSSIBILITY OF TWO OR MORE MATCHES !!!
    return cmax_score;
  }