Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.Property


  public int countProperties(Document document)
      throws RepositoryException {
    int counter = 0;
    System.out.println();
    for (String name : document.getPropertyNames()) {
      Property property = document.findProperty(name);
      assertNotNull(property);
      Value value = property.nextValue();
      assertNotNull(value);
      System.out.print(name);
      System.out.print("(");
      String type = value.getClass().getName();
      System.out.print(type);
View Full Code Here


   * @throws RepositoryException if there was a problem extracting properties.
   */
  private static Property processAclProperty(Document document,
      String aclPropName, String aclRolePrefix) throws RepositoryException {
    LinkedList<Value> acl = new LinkedList<Value>();
    Property scopeProp = document.findProperty(aclPropName);
    Value scopeVal;
    while ((scopeVal = scopeProp.nextValue()) != null) {
      Principal principal = (scopeVal instanceof PrincipalValue)
          ? ((PrincipalValue) scopeVal).getPrincipal()
          : new Principal(scopeVal.toString().trim());
      String aclScope = principal.getName();
      if (Strings.isNullOrEmpty(aclScope)) {
        continue;
      }
      Property scopeRoleProp = document.findProperty(aclRolePrefix + aclScope);
      if (scopeRoleProp != null) {
        // Add ACL Entry (scope=role pair) to the list.
        Value roleVal;
        while ((roleVal = scopeRoleProp.nextValue()) != null) {
          String role = roleVal.toString().trim();
          if (role.length() > 0) {
            acl.add(Value.getPrincipalValue(new Principal(
                principal.getPrincipalType(),
                principal.getNamespace(), aclScope + '=' + role,
View Full Code Here

      for (String name : propertyNames) {
        if (XmlFeed.propertySkipSet.contains(name)) {
          continue;
        }
        try {
          Property property = metadata.findProperty(name);
          if (property != null) {
            encodeOneProperty(sb, name, property);
          }
        } catch (RepositoryException e) {
          LOGGER.log(Level.WARNING, "Failed to retrieve property " + name, e);
View Full Code Here

  /*
   * Generate the ACL principal XML data.
   */
  private void getPrincipalXml(Document acl, StringBuilder buff)
      throws IOException, RepositoryException {
    Property property;

    property = acl.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    if (property != null) {
      wrapAclPrincipal(buff, property, AclScope.USER, AclAccess.PERMIT);
    }
View Full Code Here

          if (LOGGER.isLoggable(Level.FINEST)) {
            logOneProperty(document, name);
          }
          continue;
        }
        Property property = document.findProperty(name);
        if (property != null) {
          wrapOneProperty(buf, name, property);
        }
      }
    }
View Full Code Here

  private void logOneProperty(Document document, String name)
      throws RepositoryException, IOException {
    if (SpiConstants.PROPNAME_CONTENT.equals(name)) {
      LOGGER.finest("PROPERTY: " + name + " = \"...content...\"");
    } else {
      Property property = document.findProperty(name);
      if (property != null) {
        ValueImpl value = null;
        while ((value = (ValueImpl) property.nextValue()) != null) {
          LOGGER.finest("PROPERTY: " + name + " = \"" + value.toString()
                        + "\"");
        }
      }
    }
View Full Code Here

    props.put(SpiConstants.PROPNAME_ACLUSERS, principal);
    Document input = ConnectorTestUtils.createSimpleDocument(props);

    Document output = createFilter(input,
        CaseSensitivityType.EVERYTHING_CASE_INSENSITIVE, null, false);
    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value = prop.nextValue();

    Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
    assertEquals(principal.getName(), newPrincipal.getName());
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_INSENSITIVE,
        newPrincipal.getCaseSensitivityType());
View Full Code Here

    props.put(SpiConstants.PROPNAME_ACLUSERS, principal);
    Document input = ConnectorTestUtils.createSimpleDocument(props);

    Document output = createFilter(input,
        CaseSensitivityType.EVERYTHING_CASE_SENSITIVE, null, false);
    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value = prop.nextValue();

    Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
    assertEquals(principal.getName(), newPrincipal.getName());
    assertTrue(newPrincipal.getCaseSensitivityType().equals(
        CaseSensitivityType.EVERYTHING_CASE_SENSITIVE));
View Full Code Here

    Document input = ConnectorTestUtils.createSimpleDocument(props);

    AclPropertyFilter factory = new AclPropertyFilter();
    Document output = factory.newDocumentFilter(input);

    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value = prop.nextValue();

    Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
    assertEquals(principal.getName(), newPrincipal.getName());
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
        newPrincipal.getCaseSensitivityType());
View Full Code Here

    Document input = ConnectorTestUtils.createSimpleDocument(props);

    AclPropertyFilter factory = new AclPropertyFilter();
    Document output = factory.newDocumentFilter(input);

    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value = prop.nextValue();

    Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
    assertEquals(principal.getName(), newPrincipal.getName());
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
        newPrincipal.getCaseSensitivityType());

    Property propInheritFrom =
        output.findProperty(SpiConstants.PROPNAME_ACLINHERITFROM);
    Value valueInheritfrom = propInheritFrom.nextValue();
    assertEquals("parentId", valueInheritfrom.toString());
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.Property

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.