Package org.apache.manifoldcf.core.common

Examples of org.apache.manifoldcf.core.common.XMLDoc$MyEntityResolver


      ListsSoap listsCall = listsService.getListsSoapHandler( );

      GetListCollectionResponseGetListCollectionResult listResp = listsCall.getListCollection();
      org.apache.axis.message.MessageElement[] lists = listResp.get_any();

      XMLDoc doc = new XMLDoc( lists[0].toString() );
      ArrayList nodeList = new ArrayList();

      doc.processPath(nodeList, "*", null);
      if (nodeList.size() != 1)
      {
        throw new ManifoldCFException("Bad xml - missing outer 'ns1:Lists' node - there are "+Integer.toString(nodeList.size())+" nodes");
      }
      Object parent = nodeList.get(0);
      if (!doc.getNodeName(parent).equals("ns1:Lists"))
        throw new ManifoldCFException("Bad xml - outer node is not 'ns1:Lists'");

      nodeList.clear();
      doc.processPath(nodeList, "*", parent)// <ns1:Lists>

      String prefixPath = decodedServerLocation + parentSiteDecoded + "/";

      int i = 0;
      while (i < nodeList.size())
      {
        Object o = nodeList.get( i++ );

        String baseType = doc.getValue( o, "BaseType");
        if ( baseType.equals("1") )
        {
          // We think it's a library

          // This is how we display it, so this has the right path extension
          String urlPath = doc.getValue( o, "DefaultViewUrl" );

          // If it has no view url, we don't have any idea what to do with it
          if (urlPath != null && urlPath.length() > 0)
          {
            // Normalize conditionally
            if (!urlPath.startsWith("/"))
              urlPath = prefixPath + urlPath;
            // Get rid of what we don't want, unconditionally
            if (urlPath.startsWith(prefixPath))
            {
              urlPath = urlPath.substring(prefixPath.length());
              // We're at the library name.  Figure out where the end of it is.
              int index = urlPath.indexOf("/");
              if (index == -1)
                throw new ManifoldCFException("Bad library view url without site: '"+urlPath+"'");
              String pathpart = urlPath.substring(0,index);

              if ( pathpart.equals(docLibrary) )
              {
                // We found it!
                // Return its ID
                return doc.getValue( o, "ID" );
              }
            }
            else
            {
              Logging.connectors.warn("SharePoint: Library view url is not in the expected form: '"+urlPath+"'; it should start with '"+prefixPath+"'; skipping");
View Full Code Here


      ListsSoap listsCall = listsService.getListsSoapHandler( );

      GetListCollectionResponseGetListCollectionResult listResp = listsCall.getListCollection();
      org.apache.axis.message.MessageElement[] lists = listResp.get_any();

      XMLDoc doc = new XMLDoc( lists[0].toString() );
      ArrayList nodeList = new ArrayList();

      doc.processPath(nodeList, "*", null);
      if (nodeList.size() != 1)
      {
        throw new ManifoldCFException("Bad xml - missing outer 'ns1:Lists' node - there are "+Integer.toString(nodeList.size())+" nodes");
      }
      Object parent = nodeList.get(0);
      if (!doc.getNodeName(parent).equals("ns1:Lists"))
        throw new ManifoldCFException("Bad xml - outer node is not 'ns1:Lists'");

      nodeList.clear();
      doc.processPath(nodeList, "*", parent)// <ns1:Lists>

      String prefixPath = decodedServerLocation + parentSiteDecoded + "/";

      int i = 0;
      while (i < nodeList.size())
      {
        Object o = nodeList.get( i++ );

        String baseType = doc.getValue( o, "BaseType");
        if ( baseType.equals("0") )
        {
          // We think it's a list

          // This is how we display it, so this has the right path extension
          String urlPath = doc.getValue( o, "DefaultViewUrl" );

          // If it has no view url, we don't have any idea what to do with it
          if (urlPath != null && urlPath.length() > 0)
          {
            // Normalize conditionally
            if (!urlPath.startsWith("/"))
              urlPath = prefixPath + urlPath;
            // Get rid of what we don't want, unconditionally
            if (urlPath.startsWith(prefixPath))
            {
              urlPath = urlPath.substring(prefixPath.length());
              // We're at the Lists/listname part of the name.  Figure out where the end of it is.
              int index = urlPath.indexOf("/");
              if (index == -1)
                throw new ManifoldCFException("Bad list view url without site: '"+urlPath+"'");
              String pathpart = urlPath.substring(0,index);
              if("Lists".equals(pathpart))
              {
                int k = urlPath.indexOf("/",index+1);
                if (k == -1)
                  throw new ManifoldCFException("Bad list view url without 'Lists': '"+urlPath+"'");
                pathpart = urlPath.substring(index+1,k);
              }

              if ( pathpart.equals(listName) )
              {
                // We found it!
                // Return its ID
                return doc.getValue( o, "ID" );
              }
            }
            else
            {
              Logging.connectors.warn("SharePoint: List view url is not in the expected form: '"+urlPath+"'; expected something beginning with '"+prefixPath+"'; skipping");
View Full Code Here

      GetVersionsResponseGetVersionsResult versionsResp = versionsCall.getVersions( docPath );
      org.apache.axis.message.MessageElement[] lists = versionsResp.get_any();

      //System.out.println( lists[0].toString() );
      XMLDoc doc = new XMLDoc( lists[0].toString() );
      ArrayList nodeList = new ArrayList();

      doc.processPath(nodeList, "*", null);

      if (nodeList.size() != 1)
      {
        throw new ManifoldCFException("Bad xml - missing outer 'results' node - there are "+Integer.toString(nodeList.size())+" nodes");
      }

      Object parent = nodeList.get(0);
      if (!doc.getNodeName(parent).equals("results"))
        throw new ManifoldCFException("Bad xml - outer node is not 'results'");

      return doc;
    }
    catch (java.net.MalformedURLException e)
View Full Code Here

    java.rmi.RemoteException
  {
    com.microsoft.schemas.sharepoint.soap.directory.GetUserInfoResponseGetUserInfoResult userResp = userCall.getUserInfo( userLogin );
    org.apache.axis.message.MessageElement[] userList = userResp.get_any();

    XMLDoc doc = new XMLDoc( userList[0].toString() );
    ArrayList nodeList = new ArrayList();

    doc.processPath(nodeList, "*", null);
    if (nodeList.size() != 1)
    {
      throw new ManifoldCFException("Bad xml - missing outer 'ns1:GetUserInfo' node - there are "+Integer.toString(nodeList.size())+" nodes");
    }
    Object parent = nodeList.get(0);
    if (!doc.getNodeName(parent).equals("ns1:GetUserInfo"))
      throw new ManifoldCFException("Bad xml - outer node is not 'ns1:GetUserInfo'");

    nodeList.clear();
    doc.processPath(nodeList, "*", parent)// ns1:User

    if ( nodeList.size() != 1 )
    {
      throw new ManifoldCFException( " No User found." );
    }
    parent = nodeList.get(0);
    nodeList.clear();
    String sid = doc.getValue( parent, "Sid" );
    return sid;
  }
View Full Code Here

    throws ManifoldCFException, java.net.MalformedURLException, javax.xml.rpc.ServiceException, java.rmi.RemoteException
  {
    com.microsoft.schemas.sharepoint.soap.directory.GetUserCollectionFromGroupResponseGetUserCollectionFromGroupResult roleResp = userCall.getUserCollectionFromGroup(groupName);
    org.apache.axis.message.MessageElement[] roleList = roleResp.get_any();

    XMLDoc doc = new XMLDoc(roleList[0].toString());
    ArrayList nodeList = new ArrayList();

    doc.processPath(nodeList, "*", null);
    if (nodeList.size() != 1)
    {
      throw new ManifoldCFException("Bad xml - missing outer 'ns1:GetUserCollectionFromGroup' node - there are "
      + Integer.toString(nodeList.size()) + " nodes");
    }
    Object parent = nodeList.get(0);
    if (!doc.getNodeName(parent).equals("ns1:GetUserCollectionFromGroup"))
      throw new ManifoldCFException("Bad xml - outer node is not 'ns1:GetUserCollectionFromGroup'");

    nodeList.clear();
    doc.processPath(nodeList, "*", parent); // <ns1:Users>

    if (nodeList.size() != 1)
    {
      throw new ManifoldCFException(" No Users collection found.");
    }
    parent = nodeList.get(0);
    nodeList.clear();
    doc.processPath(nodeList, "*", parent); // <ns1:User>

    ArrayList sidsList = new ArrayList();
    String[] sids = new String[0];
    int i = 0;
    while (i < nodeList.size())
    {
      Object o = nodeList.get(i++);
      sidsList.add(doc.getValue(o, "Sid"));
    }
    sids = (String[]) sidsList.toArray((Object[]) sids);
    return sids;
  }
View Full Code Here

      WebsSoap webCall = webService.getWebsSoapHandler();

      GetWebCollectionResponseGetWebCollectionResult webResp = webCall.getWebCollection();
      org.apache.axis.message.MessageElement[] webList = webResp.get_any();

      XMLDoc doc = new XMLDoc( webList[0].toString() );
      ArrayList nodeList = new ArrayList();

      doc.processPath(nodeList, "*", null);
      if (nodeList.size() != 1)
      {
        throw new ManifoldCFException("Bad xml - missing outer 'ns1:Webs' node - there are "+Integer.toString(nodeList.size())+" nodes");
      }
      Object parent = nodeList.get(0);
      if (!doc.getNodeName(parent).equals("ns1:Webs"))
        throw new ManifoldCFException("Bad xml - outer node is not 'ns1:Webs'");

      nodeList.clear();
      doc.processPath(nodeList, "*", parent)// <ns1:Webs>

      int i = 0;
      while (i < nodeList.size())
      {
        Object o = nodeList.get( i++ );
        //Logging.connectors.debug( i + ": " + o );
        //System.out.println( i + ": " + o );
        String url = doc.getValue( o, "Url" );
        String title = doc.getValue( o, "Title" );

        // Leave here for now
        if (Logging.connectors.isDebugEnabled())
          Logging.connectors.debug("SharePoint: Subsite list: '"+url+"', '"+title+"'");
       
View Full Code Here

      GetListCollectionResponseGetListCollectionResult listResp = listsCall.getListCollection();
      org.apache.axis.message.MessageElement[] lists = listResp.get_any();

      //if ( parentSite.compareTo("/Sample2") == 0) System.out.println( lists[0].toString() );

      XMLDoc doc = new XMLDoc( lists[0].toString() );
      ArrayList nodeList = new ArrayList();

      doc.processPath(nodeList, "*", null);
      if (nodeList.size() != 1)
      {
        throw new ManifoldCFException("Bad xml - missing outer 'ns1:Lists' node - there are "+Integer.toString(nodeList.size())+" nodes");
      }
      Object parent = nodeList.get(0);
      if (!doc.getNodeName(parent).equals("ns1:Lists"))
        throw new ManifoldCFException("Bad xml - outer node is not 'ns1:Lists'");

      nodeList.clear();
      doc.processPath(nodeList, "*", parent)// <ns1:Lists>

      String prefixPath = decodedServerLocation + parentSiteDecoded + "/";

      int i = 0;
      while (i < nodeList.size())
      {
        Object o = nodeList.get( i++ );

        String baseType = doc.getValue( o, "BaseType");
        if ( baseType.equals( "1" ) )
        {
          // We think it's a library

          // This is how we display it, so this has the right path extension
          String urlPath = doc.getValue( o, "DefaultViewUrl" );
          // This is the pretty name
          String title = doc.getValue( o, "Title" );

          // Leave this in for the moment
          if (Logging.connectors.isDebugEnabled())
            Logging.connectors.debug("SharePoint: Library list: '"+urlPath+"', '"+title+"'");

View Full Code Here

      GetListCollectionResponseGetListCollectionResult listResp = listsCall.getListCollection();
      org.apache.axis.message.MessageElement[] lists = listResp.get_any();

      //if ( parentSite.compareTo("/Sample2") == 0) System.out.println( lists[0].toString() );

      XMLDoc doc = new XMLDoc( lists[0].toString() );
      ArrayList nodeList = new ArrayList();

      doc.processPath(nodeList, "*", null);
      if (nodeList.size() != 1)
      {
        throw new ManifoldCFException("Bad xml - missing outer 'ns1:Lists' node - there are "+Integer.toString(nodeList.size())+" nodes");
      }
      Object parent = nodeList.get(0);
      if (!doc.getNodeName(parent).equals("ns1:Lists"))
        throw new ManifoldCFException("Bad xml - outer node is not 'ns1:Lists'");

      nodeList.clear();
      doc.processPath(nodeList, "*", parent)// <ns1:Lists>

      String prefixPath = decodedServerLocation + parentSiteDecoded + "/";

      int i = 0;
      while (i < nodeList.size())
      {
        Object o = nodeList.get( i++ );

        String baseType = doc.getValue( o, "BaseType");
        if ( baseType.equals( "0" ) )
        {
          // We think it's a list

          // This is how we display it, so this has the right path extension
          String urlPath = doc.getValue( o, "DefaultViewUrl" );
          // This is the pretty name
          String title = doc.getValue( o, "Title" );

          // Leave this in for the moment
          if (Logging.connectors.isDebugEnabled())
            Logging.connectors.debug("SharePoint: List: '"+urlPath+"', '"+title+"'");

View Full Code Here

      com.microsoft.schemas.sharepoint.soap.directory.PermissionsSoap aclCall = aclService.getPermissionsSoapHandler( );

      com.microsoft.schemas.sharepoint.soap.directory.GetPermissionCollectionResponseGetPermissionCollectionResult aclResult = aclCall.getPermissionCollection( guid, "List" );
      org.apache.axis.message.MessageElement[] aclList = aclResult.get_any();

      XMLDoc doc = new XMLDoc( aclList[0].toString() );
      ArrayList nodeList = new ArrayList();

      doc.processPath(nodeList, "*", null);
      if (nodeList.size() != 1)
      {
        throw new ManifoldCFException("Bad xml - missing outer 'ns1:GetPermissionCollection' node - there are "+Integer.toString(nodeList.size())+" nodes");
      }
      Object parent = nodeList.get(0);
      if (!doc.getNodeName(parent).equals("ns1:GetPermissionCollection"))
        throw new ManifoldCFException("Bad xml - outer node is not 'ns1:GetPermissionCollection'");

      nodeList.clear();
      doc.processPath(nodeList, "*", parent);

      if ( nodeList.size() != 1 )
      {
        throw new ManifoldCFException( " No results found." );
      }
      parent = nodeList.get(0);
      nodeList.clear();
      doc.processPath( nodeList, "*", parent );
      Set<String> sids = new HashSet<String>();
      int i = 0;
      for (; i< nodeList.size(); i++ )
      {
        Object node = nodeList.get( i );
        String mask = doc.getValue( node, "Mask" );
        long maskValue = new Long(mask).longValue();
        if ((maskValue & 1L) == 1L)
        {
          // Permission to view
          String isUser = doc.getValue( node, "MemberIsUser" );

          if ( isUser.compareToIgnoreCase("True") == 0 )
          {
            // Use AD user or group
            String userLogin = doc.getValue( node, "UserLogin" );
            String userSid = getSidForUser( userCall, userLogin, activeDirectoryAuthority );
            sids.add( userSid );
          }
          else
          {
            // Role
            List<String> roleSids;
            String roleName = doc.getValue( node, "RoleName" );
            if ( roleName.length() == 0)
            {
              roleName = doc.getValue(node,"GroupName");
              roleSids = getSidsForGroup(userCall, roleName, activeDirectoryAuthority);
            }
            else
            {
              roleSids = getSidsForRole(userCall, roleName, activeDirectoryAuthority);
View Full Code Here

      if (Logging.connectors.isDebugEnabled())
      {
        Logging.connectors.debug("SharePoint: document acls xml: '" + aclList[0].toString() + "'");
      }

      XMLDoc doc = new XMLDoc( aclList[0].toString() );
      ArrayList nodeList = new ArrayList();

      doc.processPath(nodeList, "*", null);
      if (nodeList.size() != 1)
      {
        throw new ManifoldCFException("Bad xml - missing outer 'ns1:GetPermissionCollection' node - there are "+Integer.toString(nodeList.size())+" nodes");
      }
      Object parent = nodeList.get(0);
      if (!doc.getNodeName(parent).equals("GetPermissionCollection"))
        throw new ManifoldCFException("Bad xml - outer node is not 'GetPermissionCollection'");

      nodeList.clear();
      doc.processPath(nodeList, "*", parent);

      if ( nodeList.size() != 1 )
      {
        throw new ManifoldCFException( " No results found." );
      }
      parent = nodeList.get(0);
      nodeList.clear();
      doc.processPath( nodeList, "*", parent );
      Set<String> sids = new HashSet<String>();
      int i = 0;
      for (; i< nodeList.size(); i++ )
      {
        Object node = nodeList.get( i );
        String mask = doc.getValue( node, "Mask" );
        long maskValue = new Long(mask).longValue();
        if ((maskValue & 1L) == 1L)
        {
          // Permission to view
          String isUser = doc.getValue( node, "MemberIsUser" );

          if ( isUser.compareToIgnoreCase("True") == 0 )
          {
            // Use AD user or group
            String userLogin = doc.getValue( node, "UserLogin" );
            String userSid = getSidForUser( userCall, userLogin, activeDirectoryAuthority );
            sids.add( userSid );
          }
          else
          {
            // Role
            List<String> roleSids;
            String roleName = doc.getValue( node, "RoleName" );
            if ( roleName.length() == 0)
            {
              roleName = doc.getValue(node,"GroupName");
              roleSids = getSidsForGroup(userCall, roleName, activeDirectoryAuthority);
            }
            else
            {
              roleSids = getSidsForRole(userCall, roleName, activeDirectoryAuthority);
View Full Code Here

TOP

Related Classes of org.apache.manifoldcf.core.common.XMLDoc$MyEntityResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.