Tabnine Logo
JcrNameParser
Code IndexAdd Tabnine to your IDE (free)

How to use
JcrNameParser
in
org.apache.jackrabbit.oak.namepath

Best Java code snippets using org.apache.jackrabbit.oak.namepath.JcrNameParser (Showing top 20 results out of 315)

origin: apache/jackrabbit-oak

  public static void checkName(String jcrName, boolean allowResidual) throws ConstraintViolationException {
    if (jcrName == null || !(allowResidual && "*".equals(jcrName) || validate(jcrName))) {
      throw new ConstraintViolationException("Not a valid JCR name '" + jcrName + '\'');
    }
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

public static boolean validate(String jcrName) {
  Listener listener = new Listener() {
    @Override
    public void error(String message) {
    }
    @Override
    public boolean name(String name, int index) {
      return true;
    }
  };
  return parse(jcrName, listener, 0);
}
origin: org.apache.jackrabbit/oak-jcr

/**
 * Processes the given {@code name}, i.e. decodes it and checks
 * the format of the decoded name.
 *
 * @param nameInfo name to process
 * @return the decoded and valid jcr name or the original name if it is
 *         not encoded or if the resulting decoded name would be illegal.
 * @throws javax.jcr.RepositoryException
 */
private NameInfo processName(NameInfo nameInfo) throws RepositoryException {
  String decodedLocalName = ISO9075.decode(nameInfo.getLocalName());
  NameInfo decodedNameInfo = new NameInfo(nameInfo.getDocPrefix(), decodedLocalName);
  if (!decodedLocalName.equals(nameInfo.getLocalName())) {
    try {
      JcrNameParser.checkName(decodedNameInfo.getRepoQualifiedName(), true);
    } catch (ConstraintViolationException e) {
      // decoded name would be illegal according to jsr 170,
      // use encoded name as a fallback
      log.warn("encountered illegal decoded name '" + decodedLocalName + '\'', e);
      return nameInfo;
    }
  }
  return decodedNameInfo;
}
origin: apache/jackrabbit-oak

/**
 * Processes the given {@code name}, i.e. decodes it and checks
 * the format of the decoded name.
 *
 * @param nameInfo name to process
 * @return the decoded and valid jcr name or the original name if it is
 *         not encoded or if the resulting decoded name would be illegal.
 * @throws javax.jcr.RepositoryException
 */
private NameInfo processName(NameInfo nameInfo) throws RepositoryException {
  String decodedLocalName = ISO9075.decode(nameInfo.getLocalName());
  NameInfo decodedNameInfo = new NameInfo(nameInfo.getDocPrefix(), decodedLocalName);
  if (!decodedLocalName.equals(nameInfo.getLocalName())) {
    try {
      JcrNameParser.checkName(decodedNameInfo.getRepoQualifiedName(), true);
    } catch (ConstraintViolationException e) {
      // decoded name would be illegal according to jsr 170,
      // use encoded name as a fallback
      log.warn("encountered illegal decoded name '" + decodedLocalName + '\'', e);
      return nameInfo;
    }
  }
  return decodedNameInfo;
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

  public static void checkName(String jcrName, boolean allowResidual) throws ConstraintViolationException {
    if (jcrName == null || !(allowResidual && "*".equals(jcrName) || validate(jcrName))) {
      throw new ConstraintViolationException("Not a valid JCR name '" + jcrName + '\'');
    }
  }
}
origin: apache/jackrabbit-oak

public static boolean validate(String jcrName) {
  Listener listener = new Listener() {
    @Override
    public void error(String message) {
    }
    @Override
    public boolean name(String name, int index) {
      return true;
    }
  };
  return parse(jcrName, listener, 0);
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Processes the given {@code name}, i.e. decodes it and checks
 * the format of the decoded name.
 *
 * @param nameInfo name to process
 * @return the decoded and valid jcr name or the original name if it is
 *         not encoded or if the resulting decoded name would be illegal.
 * @throws javax.jcr.RepositoryException
 */
private NameInfo processName(NameInfo nameInfo) throws RepositoryException {
  String decodedLocalName = ISO9075.decode(nameInfo.getLocalName());
  NameInfo decodedNameInfo = new NameInfo(nameInfo.getDocPrefix(), decodedLocalName);
  if (!decodedLocalName.equals(nameInfo.getLocalName())) {
    try {
      JcrNameParser.checkName(decodedNameInfo.getRepoQualifiedName(), true);
    } catch (ConstraintViolationException e) {
      // decoded name would be illegal according to jsr 170,
      // use encoded name as a fallback
      log.warn("encountered illegal decoded name '" + decodedLocalName + '\'', e);
      return nameInfo;
    }
  }
  return decodedNameInfo;
}
origin: apache/jackrabbit-oak

/**
 * Converts the given JCR name to the corresponding Oak name. Throws
 * a {@link ConstraintViolationException} if the name is {@code null}
 * or otherwise invalid.
 *
 * @param jcrName JCR name
 * @return Oak name
 * @throws ConstraintViolationException if name is invalid or {@code null}
 */
@NotNull
protected String getOakNameOrThrowConstraintViolation(@Nullable String jcrName)
    throws ConstraintViolationException {
  if (jcrName == null) {
    throw new ConstraintViolationException("Missing JCR name");
  }
  String oakName = mapper.getOakNameOrNull(jcrName);
  if (oakName == null || !JcrNameParser.validate(jcrName)) {
    throw new ConstraintViolationException(
        "Invalid name: " + jcrName);
  }
  return oakName;
}
origin: apache/jackrabbit-oak

if (!JcrNameParser.parse(name, listener, index)) {
  return false;
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Converts the given JCR name to the corresponding Oak name. Throws
 * a {@link ConstraintViolationException} if the name is {@code null}
 * or otherwise invalid.
 *
 * @param jcrName JCR name
 * @return Oak name
 * @throws ConstraintViolationException if name is invalid or {@code null}
 */
@Nonnull
protected String getOakNameOrThrowConstraintViolation(@CheckForNull String jcrName)
    throws ConstraintViolationException {
  if (jcrName == null) {
    throw new ConstraintViolationException("Missing JCR name");
  }
  String oakName = mapper.getOakNameOrNull(jcrName);
  if (oakName == null || !JcrNameParser.validate(jcrName)) {
    throw new ConstraintViolationException(
        "Invalid name: " + jcrName);
  }
  return oakName;
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

if (!JcrNameParser.parse(name, listener, index)) {
  return false;
origin: org.apache.jackrabbit/oak-core

/**
 * Converts the given JCR name to the corresponding Oak name. Throws
 * a {@link ConstraintViolationException} if the name is {@code null}
 * or otherwise invalid.
 *
 * @param jcrName JCR name
 * @return Oak name
 * @throws ConstraintViolationException if name is invalid or {@code null}
 */
@NotNull
protected String getOakNameOrThrowConstraintViolation(@Nullable String jcrName)
    throws ConstraintViolationException {
  if (jcrName == null) {
    throw new ConstraintViolationException("Missing JCR name");
  }
  String oakName = mapper.getOakNameOrNull(jcrName);
  if (oakName == null || !JcrNameParser.validate(jcrName)) {
    throw new ConstraintViolationException(
        "Invalid name: " + jcrName);
  }
  return oakName;
}
origin: apache/jackrabbit-oak

} else if (name.startsWith("[") && !name.endsWith("]")) {
  return null;
} else if (!JcrNameParser.validate(name)) {
  return null;
origin: org.apache.jackrabbit/oak-core

type != PropertyType.LONG &&
type != PropertyType.BOOLEAN &&
JcrNameParser.validate(value.getString());
origin: org.apache.jackrabbit/oak-core

} else if (name.startsWith("[") && !name.endsWith("]")) {
  return null;
} else if (!JcrNameParser.validate(name)) {
  return null;
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

} else if (name.startsWith("[") && !name.endsWith("]")) {
  return null;
} else if (!JcrNameParser.validate(name)) {
  return null;
origin: apache/jackrabbit-oak

type != PropertyType.LONG &&
type != PropertyType.BOOLEAN &&
JcrNameParser.validate(value.getString());
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

type != PropertyType.LONG &&
type != PropertyType.BOOLEAN &&
JcrNameParser.validate(value.getString());
origin: apache/jackrabbit-oak

case PropertyType.NAME:
  String oakName = namePathMapper.getOakNameOrNull(value);
  if (oakName == null || !JcrNameParser.validate(oakName)) {
    throw new ValueFormatException("Invalid name: " + value);
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

case PropertyType.NAME:
  String oakName = namePathMapper.getOakNameOrNull(value);
  if (oakName == null || !JcrNameParser.validate(oakName)) {
    throw new ValueFormatException("Invalid name: " + value);
org.apache.jackrabbit.oak.namepathJcrNameParser

Javadoc

Parses and validates JCR names. Upon successful completion of #parse(String,Listener,int)the specified listener is informed about the (resulting) JCR name. In case of failure JcrNameParser.Listener#error(String) is called indicating the reason.

Most used methods

  • validate
  • checkName
  • parse
    Parse the specified jcr name and inform the specified listenerabout the result or any error that may

Popular in Java

  • Parsing JSON documents to java classes using gson
  • findViewById (Activity)
  • compareTo (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now