Finally I got my directories. My fix for missing
"current-user-privilege-set" property screwed up some of it and a check
on the url prevented it from working if the root is '/'. Here is my
versuin of SPWebFolder.init():

  public void init() throws Exception  {
    SPPropFindMethod propFindMethod = new SPPropFindMethod(client);
    propFindMethod.setPath(resourceUrlPath);
    propFindMethod.execute();

    int statusCode = propFindMethod.getStatusCode();

    if (statusCode != HttpStatus.SC_MULTI_STATUS) {
      final String title = "Remote Failure";
      final String msg = "Unable to access a remote directory
("+statusCode+")";
      SPUtils.showMessageDialog(title, msg);
    }

    children = new ArrayList();
    Enumeration enum = propFindMethod.getAllResponseURLs();

    while (enum.hasMoreElements()){
      String url = (String) enum.nextElement();

      Property p =
(Property)propFindMethod.getProperty("current-user-privilege-set", url);
      if(p!=null) {
        System.err.println("current-user-privilege-set is
"+p.getClass().getName());
        CurrentUserPrivilegeSetProperty userPrivilege =
          //        (CurrentUserPrivilegeSetProperty)
          //           
propFindMethod.getProperty("current-user-privilege-set", url);
          (CurrentUserPrivilegeSetProperty)p;

        boolean readAccess = userPrivilege.hasReadAccess();
        boolean writeAccess = userPrivilege.hasWriteAccess();
      } else
        System.err.println("current-user-privilege-set returned
nothing");

      LockdiscoveryProperty lockdiscoveryProp =
        (LockdiscoveryProperty)
        propFindMethod.getProperty("lockdiscovery", url);

      boolean readOnly=false;
      if (lockdiscoveryProp != null)  { //is being locked
        String userName = client.getCredentials().getUserName();
        if (lockdiscoveryProp.getLockToken(userName) == null)  {
          // is locked by others
          readOnly = true;
        }
      }

      SPResourceNode newChild;

      // Pending: Waiting for the proper setting of "displayname"
property
      // in the server
      //if( ! url.endsWith(resourceUrlPath) ) {
      if( ! url.equals(resourceUrlPath) ) {
        //if not this SPWebFolder's url
        //create a SPWebFolder or SPWebFile child according to its type

        if (propFindMethod.isCollection(url))  {
          newChild = new SPWebFolder(client, url);
        } else  {
          newChild = new SPWebFile(client, url);
        }

        newChild.setPrivilege(readAccess, writeAccess);
        newChild.setReadOnlyCached(readOnly);
        newChild.setParent(this);
        children.add(newChild);
      } else  {
        this.readAccess = readAccess;
        this.writeAccess = writeAccess;
        accessPrivilegeChecked = true;
      }// if(! url.endsWidth...)
    }// while (enum...)
  }// init()

--

Neil de Hoog

[EMAIL PROTECTED]

Reply via email to