Is this the right way to get/build folder structure
for View layer in a typical web application ?
I tried, it took 2659ms with the default slide 2.1B2
configuration.

class BuildFolderStructure {
...

public BuildFolderStructure () {
 // get tht root node
 FolderNode = new FolderNode("slide",0);
 WebdavResource  webdavResource = new
WebdavResource(uriToHttpURL
("http://localhost:8080/slide/";));
 names = webdavResource.listBasic();

addFoldersAsNodes(names , FolderNode, 1, 8,
webdavResource);
}

private addFoldersAsNodes (Vector col, FolderNode t,
int depthCount, int depthLimit, WebDavResource) {
 /* loop through child directories */ 
 Vector names;
                
 for (int i = 0; i < col.size(); i++) {
                        
  // the Vector has n String arrays, 
  // each has 4 elements:
  // 0: name
  // 1: size
  // 2: COLLECTION or not
  // 3: date
  String[] ele = (String[])col.elementAt(i);
                        
  if (ele[2].equalsIgnoreCase("collection")) { 
                                
    /* create new node to add */ 
    FolderNode newNode = new FolderNode(ele[0],
depthCount); 
    t.addChild(newNode); 
                                
   /* check our depth, then recurse to add child
folders */
                                
  if (depthCount < depthLimit) { 
    String path= webdavResource.getPath();
    try {
                                                
webdavResource.setPath(path+ele[0]+"/");
        names = webdavResource.listBasic();
        if (names.size() > 0) {                           depthCount++;                
                  
addFoldersAsNodes(names, newNode, depthCount,
depthLimit, webdavResource);              depthCount--; 
        }                                               webdavResource.setPath(path);
        } catch (Exception e) {
                                                
        }
     }
                                
    } 
  } 


}

}





--- lixin chu <[EMAIL PROTECTED]> wrote:

> Hi,
> is there an API to get a fodler structure ? I am
> trying the propfindMethod(depth). It does return all
> but not in a nested format so I have to rebuid the
> tree structure.
> 
> btw, propfindMethod (path, depth) return error code
> 501 (not implemented). not sure why. what 'path'
> should be used ? I tried "files", "/files" after
> connecting to my local /slide/.
> 
> thanks
> li xin
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



                
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to