Java Code Examples for java.util.Vector.toString()

The following are Jave code examples for showing how to use toString() of the java.util.Vector class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: convertigo-engine   File: CicsTransaction.java   View Source Code Vote up 7 votes
public String getRequestString(Context context) {
	if (context != null) {
		String requestString = context.projectName + " " + context.transactionName;
		Document doc = context.inputDocument;
		if (doc != null) {
			NodeList list = doc.getElementsByTagName("variable");
			Vector<String> vVariables = new Vector<String>(list.getLength());
			for (int i=0; i<list.getLength(); i++) {
				Element elt = (Element)list.item(i);
				String name = elt.getAttribute("name");
				String value = elt.getAttribute("value");
				vVariables.add(name + "=" + value);
			}
			QuickSort quickSort = new QuickSort(vVariables);
			vVariables = GenericUtils.cast(quickSort.perform(true));
	
			requestString += " " + vVariables.toString();
		}
		return requestString;
	}
	return null;
}
 
Example 2
Project: keepass2android   File: ChannelSftp.java   View Source Code Vote up 6 votes
/**
 * This method will check if the given string can be expanded to the
 * unique string.  If it can be expanded to mutiple files, SftpException
 * will be thrown.
 * @return the returned string is unquoted.
 */
private String isUnique(String path) throws SftpException, Exception{
  Vector v=glob_remote(path);
  if(v.size()!=1){
    throw new SftpException(SSH_FX_FAILURE, path+" is not unique: "+v.toString());
  }
  return (String)(v.elementAt(0));
}
 
Example 3
Project: aos-FileCoreLibrary   File: ChannelSftp.java   View Source Code Vote up 6 votes
/**
 * This method will check if the given string can be expanded to the
 * unique string.  If it can be expanded to mutiple files, SftpException
 * will be thrown.
 * @return the returned string is unquoted.
 */
private String isUnique(String path) throws SftpException, Exception{
  Vector v=glob_remote(path);
  if(v.size()!=1){
    throw new SftpException(SSH_FX_FAILURE, path+" is not unique: "+v.toString());
  }
  return (String)(v.elementAt(0));
}
 
Example 4
Project: parabuild-ci   File: ChannelSftp.java   View Source Code Vote up 6 votes
public void put(InputStream src, String dst, 
  SftpProgressMonitor monitor, int mode) throws SftpException{
  try{
    dst=remoteAbsolutePath(dst);

    Vector v=glob_remote(dst);
    int vsize=v.size();
    if(vsize!=1){
      if(vsize==0){
        if(isPattern(dst))
          throw new SftpException(SSH_FX_FAILURE, dst);
        else
          dst=Util.unquote(dst);
      }
      throw new SftpException(SSH_FX_FAILURE, v.toString());
    }
    else{
      dst=(String)(v.elementAt(0));
    }

    if(isRemoteDir(dst)){
      throw new SftpException(SSH_FX_FAILURE, dst+" is a directory");
    }

    _put(src, dst, monitor, mode);
  }
  catch(Exception e){
    if(e instanceof SftpException) throw (SftpException)e;
    if(e instanceof Throwable)
      throw new SftpException(SSH_FX_FAILURE, e.toString(), (Throwable)e);
    throw new SftpException(SSH_FX_FAILURE, e.toString());
  }
}
 
Example 5
Project: parabuild-ci   File: ChannelSftp.java   View Source Code Vote up 6 votes
/**
 * This method will check if the given string can be expanded to the
 * unique string.  If it can be expanded to mutiple files, SftpException
 * will be thrown.
 * @return the returned string is unquoted.
 */
private String isUnique(String path) throws SftpException, Exception{
  Vector v=glob_remote(path);
  if(v.size()!=1){
    throw new SftpException(SSH_FX_FAILURE, path+" is not unique: "+v.toString());
  }
  return (String)(v.elementAt(0));
}
 
Example 6
Project: keepass2android   File: ChannelSftp.java   View Source Code Vote up 5 votes
/**
 * Sends data from the input stream <code>src</code> to <code>dst</code> file.
 * The <code>mode</code> should be <code>OVERWRITE</code>,
 * <code>RESUME</code> or <code>APPEND</code>.
 *
 * @param src input stream
 * @param dst destination file
 * @param monitor progress monitor
 * @param mode how data should be added to dst
 */
public void put(InputStream src, String dst, 
  SftpProgressMonitor monitor, int mode) throws SftpException{
  try{
    ((MyPipedInputStream)io_in).updateReadSide();

    dst=remoteAbsolutePath(dst);

    Vector v=glob_remote(dst);
    int vsize=v.size();
    if(vsize!=1){
      if(vsize==0){
        if(isPattern(dst))
          throw new SftpException(SSH_FX_FAILURE, dst);
        else
          dst=Util.unquote(dst);
      }
      throw new SftpException(SSH_FX_FAILURE, v.toString());
    }
    else{
      dst=(String)(v.elementAt(0));
    }

    if(monitor!=null){
      monitor.init(SftpProgressMonitor.PUT, 
                   "-", dst,
                   SftpProgressMonitor.UNKNOWN_SIZE);
    }

    _put(src, dst, monitor, mode);
  }
  catch(Exception e){
    if(e instanceof SftpException) {
      if(((SftpException)e).id == SSH_FX_FAILURE &&
         isRemoteDir(dst)) {
        throw new SftpException(SSH_FX_FAILURE, dst+" is a directory");
      }
      throw (SftpException)e;
    }
    if(e instanceof Throwable)
      throw new SftpException(SSH_FX_FAILURE, e.toString(), (Throwable)e);
    throw new SftpException(SSH_FX_FAILURE, e.toString());
  }
}
 
Example 7
Project: keepass2android   File: ChannelSftp.java   View Source Code Vote up 5 votes
public void rename(String oldpath, String newpath) throws SftpException{
   if(server_version<2){
     throw new SftpException(SSH_FX_OP_UNSUPPORTED, 
                             "The remote sshd is too old to support rename operation.");
   }

   try{
     ((MyPipedInputStream)io_in).updateReadSide();

     oldpath=remoteAbsolutePath(oldpath);
     newpath=remoteAbsolutePath(newpath);

     oldpath=isUnique(oldpath);

     Vector v=glob_remote(newpath);
     int vsize=v.size();
     if(vsize>=2){
       throw new SftpException(SSH_FX_FAILURE, v.toString());
     }
     if(vsize==1){
       newpath=(String)(v.elementAt(0));
     }
     else{  // vsize==0
       if(isPattern(newpath))
         throw new SftpException(SSH_FX_FAILURE, newpath);
       newpath=Util.unquote(newpath);
     }

     sendRENAME(Util.str2byte(oldpath, fEncoding),
                Util.str2byte(newpath, fEncoding));

     Header header=new Header();
     header=header(buf, header);
     int length=header.length;
     int type=header.type;

     fill(buf, length);

     if(type!=SSH_FXP_STATUS){
       throw new SftpException(SSH_FX_FAILURE, "");
     }

     int i=buf.getInt();
     if(i==SSH_FX_OK) return;
     throwStatusError(buf, i);
  }
  catch(Exception e){
    if(e instanceof SftpException) throw (SftpException)e;
    if(e instanceof Throwable)
      throw new SftpException(SSH_FX_FAILURE, "", (Throwable)e);
    throw new SftpException(SSH_FX_FAILURE, "");
  }
}
 
Example 8
Project: aos-FileCoreLibrary   File: ChannelSftp.java   View Source Code Vote up 5 votes
/**
 * Sends data from the input stream <code>src</code> to <code>dst</code> file.
 * The <code>mode</code> should be <code>OVERWRITE</code>,
 * <code>RESUME</code> or <code>APPEND</code>.
 *
 * @param src input stream
 * @param dst destination file
 * @param monitor progress monitor
 * @param mode how data should be added to dst
 */
public void put(InputStream src, String dst, 
  SftpProgressMonitor monitor, int mode) throws SftpException{
  try{
    ((MyPipedInputStream)io_in).updateReadSide();

    dst=remoteAbsolutePath(dst);

    Vector v=glob_remote(dst);
    int vsize=v.size();
    if(vsize!=1){
      if(vsize==0){
        if(isPattern(dst))
          throw new SftpException(SSH_FX_FAILURE, dst);
        else
          dst=Util.unquote(dst);
      }
      throw new SftpException(SSH_FX_FAILURE, v.toString());
    }
    else{
      dst=(String)(v.elementAt(0));
    }

    if(monitor!=null){
      monitor.init(SftpProgressMonitor.PUT, 
                   "-", dst,
                   SftpProgressMonitor.UNKNOWN_SIZE);
    }

    _put(src, dst, monitor, mode);
  }
  catch(Exception e){
    if(e instanceof SftpException) {
      if(((SftpException)e).id == SSH_FX_FAILURE &&
         isRemoteDir(dst)) {
        throw new SftpException(SSH_FX_FAILURE, dst+" is a directory");
      }
      throw (SftpException)e;
    }
    if(e instanceof Throwable)
      throw new SftpException(SSH_FX_FAILURE, e.toString(), (Throwable)e);
    throw new SftpException(SSH_FX_FAILURE, e.toString());
  }
}
 
Example 9
Project: aos-FileCoreLibrary   File: ChannelSftp.java   View Source Code Vote up 5 votes
public void rename(String oldpath, String newpath) throws SftpException{
   if(server_version<2){
     throw new SftpException(SSH_FX_OP_UNSUPPORTED, 
                             "The remote sshd is too old to support rename operation.");
   }

   try{
     ((MyPipedInputStream)io_in).updateReadSide();

     oldpath=remoteAbsolutePath(oldpath);
     newpath=remoteAbsolutePath(newpath);

     oldpath=isUnique(oldpath);

     Vector v=glob_remote(newpath);
     int vsize=v.size();
     if(vsize>=2){
       throw new SftpException(SSH_FX_FAILURE, v.toString());
     }
     if(vsize==1){
       newpath=(String)(v.elementAt(0));
     }
     else{  // vsize==0
       if(isPattern(newpath))
         throw new SftpException(SSH_FX_FAILURE, newpath);
       newpath=Util.unquote(newpath);
     }

     sendRENAME(Util.str2byte(oldpath, fEncoding),
                Util.str2byte(newpath, fEncoding));

     Header header=new Header();
     header=header(buf, header);
     int length=header.length;
     int type=header.type;

     fill(buf, length);

     if(type!=SSH_FXP_STATUS){
       throw new SftpException(SSH_FX_FAILURE, "");
     }

     int i=buf.getInt();
     if(i==SSH_FX_OK) return;
     throwStatusError(buf, i);
  }
  catch(Exception e){
    if(e instanceof SftpException) throw (SftpException)e;
    if(e instanceof Throwable)
      throw new SftpException(SSH_FX_FAILURE, "", (Throwable)e);
    throw new SftpException(SSH_FX_FAILURE, "");
  }
}
 
Example 10
Project: OpenJSharp   File: Stylesheet.java   View Source Code Vote up 5 votes
/**
 * This method returns a vector with variables/params and keys in the
 * order in which they are to be compiled for initialization. The order
 * is determined by analyzing the dependencies between them. The XSLT 1.0
 * spec does not allow a key to depend on a variable. However, for
 * compatibility with Xalan interpretive, that type of dependency is
 * allowed and, therefore, consider to determine the partial order.
 */
private Vector resolveDependencies(Vector input) {
    /* DEBUG CODE - INGORE
    for (int i = 0; i < input.size(); i++) {
        final TopLevelElement e = (TopLevelElement) input.elementAt(i);
        System.out.println("e = " + e + " depends on:");
        Vector dep = e.getDependencies();
        for (int j = 0; j < (dep != null ? dep.size() : 0); j++) {
            System.out.println("\t" + dep.elementAt(j));
        }
    }
    System.out.println("=================================");
    */

    Vector result = new Vector();
    while (input.size() > 0) {
        boolean changed = false;
        for (int i = 0; i < input.size(); ) {
            final TopLevelElement vde = (TopLevelElement) input.elementAt(i);
            final Vector dep = vde.getDependencies();
            if (dep == null || result.containsAll(dep)) {
                result.addElement(vde);
                input.remove(i);
                changed = true;
            }
            else {
                i++;
            }
        }

        // If nothing was changed in this pass then we have a circular ref
        if (!changed) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.CIRCULAR_VARIABLE_ERR,
                                        input.toString(), this);
            getParser().reportError(Constants.ERROR, err);
            return(result);
        }
    }

    /* DEBUG CODE - INGORE
    System.out.println("=================================");
    for (int i = 0; i < result.size(); i++) {
        final TopLevelElement e = (TopLevelElement) result.elementAt(i);
        System.out.println("e = " + e);
    }
    */

    return result;
}
 
Example 11
Project: parabuild-ci   File: ChannelSftp.java   View Source Code Vote up 5 votes
public void rename(String oldpath, String newpath) throws SftpException{
   if(server_version<2){
     throw new SftpException(SSH_FX_OP_UNSUPPORTED, 
                             "The remote sshd is too old to support rename operation.");
   }

   try{
     oldpath=remoteAbsolutePath(oldpath);
     newpath=remoteAbsolutePath(newpath);

     oldpath=isUnique(oldpath);

     Vector v=glob_remote(newpath);
     int vsize=v.size();
     if(vsize>=2){
       throw new SftpException(SSH_FX_FAILURE, v.toString());
     }
     if(vsize==1){
       newpath=(String)(v.elementAt(0));
     }
     else{  // vsize==0
       if(isPattern(newpath))
         throw new SftpException(SSH_FX_FAILURE, newpath);
       newpath=Util.unquote(newpath);
     }

     sendRENAME(Util.str2byte(oldpath, fEncoding),
                Util.str2byte(newpath, fEncoding));

     Header header=new Header();
     header=header(buf, header);
     int length=header.length;
     int type=header.type;

     fill(buf, length);

     if(type!=SSH_FXP_STATUS){
       throw new SftpException(SSH_FX_FAILURE, "");
     }

     int i=buf.getInt();
     if(i==SSH_FX_OK) return;
     throwStatusError(buf, i);
  }
  catch(Exception e){
    if(e instanceof SftpException) throw (SftpException)e;
    if(e instanceof Throwable)
      throw new SftpException(SSH_FX_FAILURE, "", (Throwable)e);
    throw new SftpException(SSH_FX_FAILURE, "");
  }
}
 
Example 12
Project: openjdk-jdk10   File: Stylesheet.java   View Source Code Vote up 5 votes
/**
 * This method returns a vector with variables/params and keys in the
 * order in which they are to be compiled for initialization. The order
 * is determined by analyzing the dependencies between them. The XSLT 1.0
 * spec does not allow a key to depend on a variable. However, for
 * compatibility with Xalan interpretive, that type of dependency is
 * allowed and, therefore, consider to determine the partial order.
 */
private Vector resolveDependencies(Vector input) {
    /* DEBUG CODE - INGORE
    for (int i = 0; i < input.size(); i++) {
        final TopLevelElement e = (TopLevelElement) input.elementAt(i);
        System.out.println("e = " + e + " depends on:");
        Vector dep = e.getDependencies();
        for (int j = 0; j < (dep != null ? dep.size() : 0); j++) {
            System.out.println("\t" + dep.elementAt(j));
        }
    }
    System.out.println("=================================");
    */

    Vector result = new Vector();
    while (input.size() > 0) {
        boolean changed = false;
        for (int i = 0; i < input.size(); ) {
            final TopLevelElement vde = (TopLevelElement) input.elementAt(i);
            final Vector dep = vde.getDependencies();
            if (dep == null || result.containsAll(dep)) {
                result.addElement(vde);
                input.remove(i);
                changed = true;
            }
            else {
                i++;
            }
        }

        // If nothing was changed in this pass then we have a circular ref
        if (!changed) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.CIRCULAR_VARIABLE_ERR,
                                        input.toString(), this);
            getParser().reportError(Constants.ERROR, err);
            return(result);
        }
    }

    /* DEBUG CODE - INGORE
    System.out.println("=================================");
    for (int i = 0; i < result.size(); i++) {
        final TopLevelElement e = (TopLevelElement) result.elementAt(i);
        System.out.println("e = " + e);
    }
    */

    return result;
}