public boolean copyCollection(User user, String name, String namedest) throws EXistException, PermissionDeniedException { RpcConnection con = pool.get();
public boolean copyCollection(User user, String collectionPath, String destinationPath, String newName) throws EXistException, PermissionDeniedException { RpcConnection con = pool.get();
    public boolean copyCollection(User user, String name, String namedest)            throws EXistException, PermissionDeniedException {        RpcConnection con = pool.get();        try {            createCollection(user, namedest);            Hashtable parametri = new Hashtable();            parametri.put(OutputKeys.INDENT, "no");            parametri.put(EXistOutputKeys.EXPAND_XINCLUDES, "no");            parametri.put(OutputKeys.ENCODING, "UTF-8");            Hashtable lista = getCollectionDesc(user, name);            Vector collezioni = (Vector) lista.get("collections");            Vector documents = (Vector) lista.get("documents");            //ricrea le directory            Iterator collezioniItr = collezioni.iterator();            String nome;            while (collezioniItr.hasNext()) {                nome = collezioniItr.next().toString();                createCollection(user, namedest + "/" + nome);                copyCollection(user, name + "/" + nome, namedest + "/" + nome);            }            //Copy i file            Hashtable hash;            int p, dsize = documents.size();            for (int i = 0; i < dsize; i++) {                hash = (Hashtable) documents.elementAt(i);                nome = (String) hash.get("name");                if ((p = nome.lastIndexOf('/')) > -1)                        nome = nome.substring(p + 1);                byte[] xml = getDocument(user, name + "/" + nome, parametri);                parse(user, xml, namedest + "/" + nome);            }            return true;        } catch (Exception e) {            handleException(e);            return false;        } finally {            pool.release(con);        }    }