@Override public Location get(NamespaceId namespaceId) throws IOException { if (NamespaceId.DEFAULT.equals(namespaceId) || NamespaceId.SYSTEM.equals(namespaceId) || NamespaceId.CDAP.equals(namespaceId)) { // since these are cdap reserved namespace we know there cannot be a custom mapping for this. // for optimization don't query for namespace meta return getNonCustomMappedLocation(namespaceId); } // since this is not a cdap reserved namespace we look up meta if there is a custom mapping try { return get(namespaceQueryAdmin.get(namespaceId)); } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException(String.format("Failed to get namespace meta for namespace %s", namespaceId), e); } }
@Override public Location get(NamespaceMeta namespaceMeta) throws IOException { String rootDirectory = namespaceMeta.getConfig().getRootDirectory(); if (Strings.isNullOrEmpty(rootDirectory)) { // if no custom mapping was specified, then use the default namespaces location return getNonCustomMappedLocation(namespaceMeta.getNamespaceId()); } return Locations.getLocationFromAbsolutePath(locationFactory, rootDirectory); }