FALCON-2277 Error msg while registering extensions Author: Pracheer Agarwal <[email protected]> Author: Pracheer Agarwal <[email protected]> Author: Pracheer Agarwal <[email protected]>
Reviewers: @pallavi-rao Closes #363 from PracheerAgarwal/register and squashes the following commits: 1c59097 [Pracheer Agarwal] review comment changes f52be5e [Pracheer Agarwal] Error msg while registering extensions ba60452 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon ed65aa0 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon 9ff05df [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon 9c2f0a5 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon 9cd8c17 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon 778c579 [Pracheer Agarwal] Merge branch 'master' of https://github.com/PracheerAgarwal/falcon e39808d [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon a932633 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon fda3b28 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon a93d71a [Pracheer Agarwal] Merge branch 'master' of https://github.com/PracheerAgarwal/falcon e3728d5 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon 066c8e2 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon b20f044 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon 7f572a1 [Pracheer Agarwal] Merge branch 'master' of https://github.com/apache/falcon 46042fd [Pracheer Agarwal] Merge branch 'master' of https://github.com/PracheerAgarwal/falcon daa3ffc [Pracheer Agarwal] FALCON-2225 extension owner added for trusted extensions 622cae4 [Pracheer Agarwal] FALCON-2225 extension owner added for trusted extensions (cherry picked from commit 217ea0099de4302c9e443eabb35820e64a0e98cc) Signed-off-by: Pallavi Rao <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/b93639cf Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/b93639cf Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/b93639cf Branch: refs/heads/master Commit: b93639cfa915eeae1380e636692c9b90d27b69a5 Parents: 6c10529 Author: Pracheer Agarwal <[email protected]> Authored: Fri Feb 10 08:44:14 2017 +0530 Committer: Pallavi Rao <[email protected]> Committed: Fri Feb 10 08:44:30 2017 +0530 ---------------------------------------------------------------------- .../falcon/extensions/store/ExtensionStore.java | 70 ++++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/b93639cf/extensions/src/main/java/org/apache/falcon/extensions/store/ExtensionStore.java ---------------------------------------------------------------------- diff --git a/extensions/src/main/java/org/apache/falcon/extensions/store/ExtensionStore.java b/extensions/src/main/java/org/apache/falcon/extensions/store/ExtensionStore.java index ed42b6b..6fc04aa 100644 --- a/extensions/src/main/java/org/apache/falcon/extensions/store/ExtensionStore.java +++ b/extensions/src/main/java/org/apache/falcon/extensions/store/ExtensionStore.java @@ -278,46 +278,46 @@ public final class ExtensionStore { public String registerExtension(final String extensionName, final String path, final String description, String extensionOwner) throws URISyntaxException, FalconException { - URI uri = new URI(path); - assertURI("Scheme", uri.getScheme()); - assertURI("Authority", uri.getAuthority()); - assertURI("Path", uri.getPath()); - FileSystem fileSystem = getHdfsFileSystem(path); - try { - fileSystem.listStatus(new Path(uri.getPath() + "/README")); - } catch (IOException e) { - LOG.error("Exception in registering Extension:{}", extensionName, e); - throw new ValidationException("README file is not present in the " + path); - } - PathFilter filter = new PathFilter() { - public boolean accept(Path file) { - return file.getName().endsWith(".jar"); + if (!metaStore.checkIfExtensionExists(extensionName)) { + URI uri = new URI(path); + assertURI("Scheme", uri.getScheme()); + assertURI("Authority", uri.getAuthority()); + assertURI("Path", uri.getPath()); + FileSystem fileSystem = getHdfsFileSystem(path); + try { + fileSystem.listStatus(new Path(uri.getPath() + "/README")); + } catch (IOException e) { + LOG.error("Exception in registering Extension:{}", extensionName, e); + throw new ValidationException("README file is not present in the " + path); } - }; - FileStatus[] jarStatus; - try { - jarStatus = fileSystem.listStatus(new Path(uri.getPath(), "libs/build"), filter); - if (jarStatus.length <= 0) { + PathFilter filter = new PathFilter() { + public boolean accept(Path file) { + return file.getName().endsWith(".jar"); + } + }; + FileStatus[] jarStatus; + try { + jarStatus = fileSystem.listStatus(new Path(uri.getPath(), "libs/build"), filter); + if (jarStatus.length <= 0) { + throw new ValidationException("Jars are not present in the " + uri.getPath() + "/libs/build."); + } + } catch (IOException e) { + LOG.error("Exception in registering Extension:{}", extensionName, e); throw new ValidationException("Jars are not present in the " + uri.getPath() + "/libs/build."); } - } catch (IOException e) { - LOG.error("Exception in registering Extension:{}", extensionName, e); - throw new ValidationException("Jars are not present in the " + uri.getPath() + "/libs/build."); - } - FileStatus[] propStatus; - try { - propStatus = fileSystem.listStatus(new Path(uri.getPath() , "META")); - if (propStatus.length <= 0) { - throw new ValidationException("No properties file is not present in the " + uri.getPath() + "/META" + + FileStatus[] propStatus; + try { + propStatus = fileSystem.listStatus(new Path(uri.getPath() , "META")); + if (propStatus.length <= 0) { + throw new ValidationException("No properties file is not present in the " + uri.getPath() + "/META" + + " structure."); + } + } catch (IOException e) { + LOG.error("Exception in registering Extension:{}", extensionName, e); + throw new ValidationException("Directory is not present in the " + uri.getPath() + "/META" + " structure."); } - } catch (IOException e) { - LOG.error("Exception in registering Extension:{}", extensionName, e); - throw new ValidationException("Directory is not present in the " + uri.getPath() + "/META" - + " structure."); - } - - if (!metaStore.checkIfExtensionExists(extensionName)) { metaStore.storeExtensionBean(extensionName, path, ExtensionType.CUSTOM, description, extensionOwner); } else { throw new ValidationException(extensionName + " already exists.");
