test_class.declarator: GLOBAL = ImmutableMap.of(
              "oak-jcr", "http://www.jcp.org/jcr/1.0",
              "oak-nt", "http://www.jcp.org/jcr/nt/1.0",
              "oak-foo", "http://www.example.com/foo",
              "oak-quu", "http://www.example.com/quu",
              "oak",     "http://jackrabbit.apache.org/oak/ns/1.0")
test_class.modifier: private static final
test_class.original_string: private static final Map<String, String> GLOBAL = ImmutableMap.of(
              "oak-jcr", "http://www.jcp.org/jcr/1.0",
              "oak-nt", "http://www.jcp.org/jcr/nt/1.0",
              "oak-foo", "http://www.example.com/foo",
              "oak-quu", "http://www.example.com/quu",
              "oak",     "http://jackrabbit.apache.org/oak/ns/1.0");
test_class.type: Map<String, String>
test_class.var_name: GLOBAL
test_class.declarator: LOCAL = ImmutableMap.of(
              "jcr-jcr", "http://www.jcp.org/jcr/1.0",
              "jcr-nt", "http://www.jcp.org/jcr/nt/1.0",
              "foo", "http://www.example.com/foo",
              "quu", "http://www.example.com/quu")
test_class.modifier: private static final
test_class.original_string: private static final Map<String, String> LOCAL = ImmutableMap.of(
              "jcr-jcr", "http://www.jcp.org/jcr/1.0",
              "jcr-nt", "http://www.jcp.org/jcr/nt/1.0",
              "foo", "http://www.example.com/foo",
              "quu", "http://www.example.com/quu");
test_class.type: Map<String, String>
test_class.var_name: LOCAL
test_class.declarator: mapper = new LocalNameMapper(GLOBAL, LOCAL)
test_class.modifier: private final
test_class.original_string: private final NameMapper mapper = new LocalNameMapper(GLOBAL, LOCAL);
test_class.type: NameMapper
test_class.var_name: mapper
test_class.declarator: npMapper = new NamePathMapperImpl(mapper)
test_class.modifier: private
test_class.original_string: private NamePathMapper npMapper = new NamePathMapperImpl(mapper);
test_class.type: NamePathMapper
test_class.var_name: npMapper
test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/impl/NamePathMapperImplTest.java
test_class.identifier: NamePathMapperImplTest
test_case.body: @Test
      public void testInvalidIdentifierPath() {
          String uuid = UUIDUtils.generateUUID();
          List<String> invalid = new ArrayList<String>();
          invalid.add('[' + uuid + "]abc");
          invalid.add('[' + uuid + "]/a/b/c");
  
          for (String jcrPath : invalid) {
              assertNull(npMapper.getOakPath(jcrPath));
          }
      }
test_case.class_method_signature: NamePathMapperImplTest.testInvalidIdentifierPath()
test_case.full_signature: @Test public void testInvalidIdentifierPath()
test_case.identifier: testInvalidIdentifierPath
test_case.invocations: generateUUID add add assertNull getOakPath
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInvalidIdentifierPath()
focal_class.declarator: log = LoggerFactory.getLogger(NamePathMapperImpl.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(NamePathMapperImpl.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: nameMapper
focal_class.modifier: private final
focal_class.original_string: private final NameMapper nameMapper;
focal_class.type: NameMapper
focal_class.var_name: nameMapper
focal_class.declarator: idManager
focal_class.modifier: private final
focal_class.original_string: private final IdentifierManager idManager;
focal_class.type: IdentifierManager
focal_class.var_name: idManager
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/impl/NamePathMapperImpl.java
focal_class.identifier: NamePathMapperImpl
focal_class.interfaces: implements NamePathMapper
focal_class.class_method_signature: NamePathMapperImpl.NamePathMapperImpl(NameMapper nameMapper)
focal_class.full_signature: public  NamePathMapperImpl(NameMapper nameMapper)
focal_class.identifier: NamePathMapperImpl
focal_class.modifiers: public
focal_class.parameters: (NameMapper nameMapper)
focal_class.signature:  NamePathMapperImpl(NameMapper nameMapper)
focal_class.class_method_signature: NamePathMapperImpl.NamePathMapperImpl(NameMapper nameMapper, IdentifierManager idManager)
focal_class.full_signature: public  NamePathMapperImpl(NameMapper nameMapper, IdentifierManager idManager)
focal_class.identifier: NamePathMapperImpl
focal_class.modifiers: public
focal_class.parameters: (NameMapper nameMapper, IdentifierManager idManager)
focal_class.signature:  NamePathMapperImpl(NameMapper nameMapper, IdentifierManager idManager)
focal_class.class_method_signature: NamePathMapperImpl.getOakNameOrNull(@NotNull String jcrName)
focal_class.full_signature: @Override public String getOakNameOrNull(@NotNull String jcrName)
focal_class.identifier: getOakNameOrNull
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull String jcrName)
focal_class.return: String
focal_class.signature: String getOakNameOrNull(@NotNull String jcrName)
focal_class.class_method_signature: NamePathMapperImpl.getOakName(@NotNull String jcrName)
focal_class.full_signature: @NotNull @Override public String getOakName(@NotNull String jcrName)
focal_class.identifier: getOakName
focal_class.modifiers: @NotNull @Override public
focal_class.parameters: (@NotNull String jcrName)
focal_class.return: String
focal_class.signature: String getOakName(@NotNull String jcrName)
focal_class.class_method_signature: NamePathMapperImpl.getJcrName(@NotNull String oakName)
focal_class.full_signature: @NotNull @Override public String getJcrName(@NotNull String oakName)
focal_class.identifier: getJcrName
focal_class.modifiers: @NotNull @Override public
focal_class.parameters: (@NotNull String oakName)
focal_class.return: String
focal_class.signature: String getJcrName(@NotNull String oakName)
focal_class.class_method_signature: NamePathMapperImpl.getSessionLocalMappings()
focal_class.full_signature: @Override @NotNull public Map<String, String> getSessionLocalMappings()
focal_class.identifier: getSessionLocalMappings
focal_class.modifiers: @Override @NotNull public
focal_class.parameters: ()
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> getSessionLocalMappings()
focal_class.class_method_signature: NamePathMapperImpl.getOakPath(String jcrPath)
focal_class.full_signature: @Override public String getOakPath(String jcrPath)
focal_class.identifier: getOakPath
focal_class.modifiers: @Override public
focal_class.parameters: (String jcrPath)
focal_class.return: String
focal_class.signature: String getOakPath(String jcrPath)
focal_class.class_method_signature: NamePathMapperImpl.getJcrPath(final String oakPath)
focal_class.full_signature: @Override @NotNull public String getJcrPath(final String oakPath)
focal_class.identifier: getJcrPath
focal_class.modifiers: @Override @NotNull public
focal_class.parameters: (final String oakPath)
focal_class.return: String
focal_class.signature: String getJcrPath(final String oakPath)
focal_class.class_method_signature: NamePathMapperImpl.needsFullMapping(String path)
focal_class.full_signature: private boolean needsFullMapping(String path)
focal_class.identifier: needsFullMapping
focal_class.modifiers: private
focal_class.parameters: (String path)
focal_class.return: boolean
focal_class.signature: boolean needsFullMapping(String path)
focal_method.body: @Override
      public String getOakPath(String jcrPath) {
          if (!needsFullMapping(jcrPath)) {
              return jcrPath;
          }
  
          int length = jcrPath.length();
  
          // identifier path?
          if (length > 0 && jcrPath.charAt(0) == '[') {
              if (jcrPath.charAt(length - 1) != ']') {
                  log.debug("Could not parse path " + jcrPath + ": unterminated identifier");
                  return null;
              }
              if (this.idManager == null) {
                  log.debug("Could not parse path " + jcrPath + ": could not resolve identifier");
                  return null;
              }
              return this.idManager.getPath(jcrPath.substring(1, length - 1));
          }
  
          final StringBuilder parseErrors = new StringBuilder();
  
          PathListener listener = new PathListener() {
              @Override
              public void error(String message) {
                  parseErrors.append(message);
              }
  
              @Override
              public boolean name(String name, int index) {
                  if (index < 0) {
                      error("invalid index: " + index);
                      return false;
                  }
  
                  String oakName = nameMapper.getOakNameOrNull(name);
                  if (oakName == null) {
                      error("Invalid name: " + name);
                      return false;
                  }
                  if (index > 1) {
                      oakName += "[" + index + ']';
                  }
                  elements.add(oakName);
                  return true;
              }
          };
  
          JcrPathParser.parse(jcrPath, listener);
          if (parseErrors.length() != 0) {
              log.debug("Could not parse path " + jcrPath + ": " + parseErrors.toString());
              return null;
          }
  
          // Empty path maps to ""
          if (listener.elements.isEmpty()) {
              return "";
          }
  
          StringBuilder oakPath = new StringBuilder();
          for (String element : listener.elements) {
              if (element.isEmpty()) {
                  // root
                  oakPath.append('/');
              }
              else {
                  oakPath.append(element);
                  oakPath.append('/');
              }
          }
  
          // root path is special-cased early on so it does not need to
          // be considered here
          oakPath.deleteCharAt(oakPath.length() - 1);
          return oakPath.toString();
      }
focal_method.class_method_signature: NamePathMapperImpl.getOakPath(String jcrPath)
focal_method.full_signature: @Override public String getOakPath(String jcrPath)
focal_method.identifier: getOakPath
focal_method.invocations: needsFullMapping length charAt charAt debug debug getPath substring append error getOakNameOrNull error add parse length debug toString isEmpty isEmpty append append append deleteCharAt length toString
focal_method.modifiers: @Override public
focal_method.parameters: (String jcrPath)
focal_method.return: String
focal_method.signature: String getOakPath(String jcrPath)