Examples of ValueImpl


Examples of com.google.enterprise.connector.spiimpl.ValueImpl

  /**
   * Adds one Property's values to the metadata header under contruction.
   */
  private static void encodeOneProperty(StringBuilder sb, String name,
      Property property) throws RepositoryException {
    ValueImpl value;
    while ((value = (ValueImpl) property.nextValue()) != null) {
      LOGGER.log(Level.FINEST, "PROPERTY: {0} = \"{1}\"",
                 new Object[] { name, value.toString() });
      String valString = value.toFeedXml();
      if (!Strings.isNullOrEmpty(valString)) {
        ServletUtil.percentEncode(sb, name, valString);
        sb.append(',');
      }
    }
View Full Code Here

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

    }

    try {
      // TODO: Value and DateValue Calendar methods are too weak to try to get
      // last modified from non-DateValues.
      ValueImpl value = (ValueImpl)
          Value.getSingleValue(metadata, SpiConstants.PROPNAME_LASTMODIFIED);
      if (value == null) {
        LOGGER.log(Level.FINEST, "Document does not contain {0}",
                   SpiConstants.PROPNAME_LASTMODIFIED);
      } else if (value instanceof DateValue) {
View Full Code Here

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

    if (metadata == null) {
      return HttpServletResponse.SC_SERVICE_UNAVAILABLE;
    }

    ValueImpl isPublicVal;
    try {
      isPublicVal = (ValueImpl) Value.getSingleValue(metadata,
          SpiConstants.PROPNAME_ISPUBLIC);
    } catch (RepositoryException ex) {
      LOGGER.log(Level.WARNING, "Failed retrieving isPublic property", ex);
      return HttpServletResponse.SC_SERVICE_UNAVAILABLE;
    }
    boolean isPublic = isPublicVal == null || isPublicVal.toBoolean();

    if (isSecurityHeaderSupported()) {
      res.setHeader("X-Gsa-Serve-Security", isPublic ? "public" : "secure");
      return HttpServletResponse.SC_OK;
    } else {
View Full Code Here

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

      LOGGER.log(Level.WARNING, "Swallowing exception while getting "
          + SpiConstants.PROPNAME_LASTMODIFIED, e);
    }

    try {
      ValueImpl v = (ValueImpl) Value.getSingleValue(document,
          SpiConstants.PROPNAME_ISPUBLIC);
      if (v != null) {
        boolean isPublic = v.toBoolean();
        if (!isPublic) {
          String authmethod = DocUtils.getOptionalString(document,
              SpiConstants.PROPNAME_AUTHMETHOD);
          if (Strings.isNullOrEmpty(authmethod)){
            authmethod = CONNECTOR_AUTHMETHOD;
View Full Code Here

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

   * Wrap the ACL principal info as XML data.
   */
  private static void wrapAclPrincipal(StringBuilder buff, Property property,
      AclScope scope, AclAccess access)
      throws RepositoryException, IOException {
    ValueImpl value;
    while ((value = (ValueImpl) property.nextValue()) != null) {
      Principal principal = (value instanceof PrincipalValue)
          ? ((PrincipalValue) value).getPrincipal()
          : new Principal(value.toString().trim());
      String name = stripRoles(principal.getName(), access);
      if (!Strings.isNullOrEmpty(name)) {
        buff.append("<").append(XML_PRINCIPAL);
        if (principal.getPrincipalType() ==
            SpiConstants.PrincipalType.UNQUALIFIED) {
View Full Code Here

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

   * @throws IOException only from Appendable, and that can't really
   *         happen when using StringBuilder.
   */
  private static void wrapOneProperty(StringBuilder buf, String name,
      Property property) throws RepositoryException, IOException {
    ValueImpl value = null;
    while ((value = (ValueImpl) property.nextValue()) != null) {
      if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("PROPERTY: " + name + " = \"" + value.toString() + "\"");
      }
      String valString = value.toFeedXml();
      if (valString != null && valString.length() > 0) {
        buf.append("<").append(XML_META);
        XmlUtils.xmlAppendAttr(XML_NAME, name, buf);
        XmlUtils.xmlAppendAttr(XML_CONTENT, valString, buf);
        buf.append("/>\n");
View Full Code Here

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

    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

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

   * Gets the Calendar value for a given property.
   */
  public static String getCalendarAndThrow(Document document, String name)
      throws IllegalArgumentException, RepositoryException {
    String result;
    ValueImpl v = getValueAndThrow(document, name);
    if (v == null) {
      result = null;
    } else if (v instanceof DateValue) {
      result = ((DateValue) v).toRfc822();
    } else {
      result = v.toFeedXml();
    }
    return result;
  }
View Full Code Here

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

   * Gets the String value for a given property.
   */
  public static String getStringAndThrow(Document document, String name)
      throws RepositoryException {
    String result = null;
    ValueImpl v = getValueAndThrow(document, name);
    if (v == null) {
      return null;
    }
    result = v.toFeedXml();
    return result;
  }
View Full Code Here

Examples of com.google.enterprise.connector.spiimpl.ValueImpl

   * Gets the InputStream value for a given property.
   */
  public static InputStream getStreamAndThrow(Document document, String name)
      throws RepositoryException {
    InputStream result = null;
    ValueImpl v = getValueAndThrow(document, name);
    if (v == null) {
      return null;
    }
    if (v instanceof BinaryValue) {
      result = ((BinaryValue) v).getInputStream();
    } else {
      String s = v.toString();
      byte[] bytes = s.getBytes(XmlFeed.XML_DEFAULT_CHARSET);
      result = new ByteArrayInputStream(bytes);
    }
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.