Package org.apache.oozie.hadoop.utils

Examples of org.apache.oozie.hadoop.utils.HadoopShims


            createFile(basePath1.toString() + Path.SEPARATOR + "pig" + Path.SEPARATOR + "pig_2.jar");
            createFile(basePath1.toString() + Path.SEPARATOR + "pig" + Path.SEPARATOR + "pig_3.jar");
            createFile(basePath1.toString() + Path.SEPARATOR + "pig" + Path.SEPARATOR + "pig_4.jar");

            HadoopShims fileSystem = new HadoopShims(fs);
            fileSystem.createSymlink(basePath, symlink, true);

            prop.put(ShareLibService.SHARE_LIB_CONF_PREFIX + ".pig", "/user/test/" + symlink.toString());
            createTestShareLibMetaFile(fs, prop);
            assertEquals(fileSystem.isSymlink(symlink), true);

            conf.set(ShareLibService.SHARELIB_MAPPING_FILE, fs.getUri() + "/user/test/config.properties");
            conf.set(ShareLibService.SHIP_LAUNCHER_JAR, "true");
            try {
                ShareLibService shareLibService = Services.get().get(ShareLibService.class);
                shareLibService.init(services);
                assertEquals(shareLibService.getShareLibJars("pig").size(), 2);
                new HadoopShims(fs).createSymlink(basePath1, symlink, true);
                assertEquals(shareLibService.getShareLibJars("pig").size(), 3);
            }
            finally {
                fs.delete(new Path("shareLibPath/"), true);
                fs.delete(symlink, true);
View Full Code Here


        if (!HadoopShims.isSymlinkSupported() || symlinkMapping.get(shareLibKey) == null
                || symlinkMapping.get(shareLibKey).isEmpty()) {
            return;
        }

        HadoopShims fileSystem = new HadoopShims(fs);
        for (Path path : symlinkMapping.get(shareLibKey).keySet()) {
            if (!symlinkMapping.get(shareLibKey).get(path).equals(fileSystem.getSymLinkTarget(path))) {
                synchronized (ShareLibService.class) {
                    Map<String, List<Path>> tempShareLibMap = new HashMap<String, List<Path>>(shareLibMap);
                    Map<String, Map<Path, Path>> tmpSymlinkMapping = new HashMap<String, Map<Path, Path>>(symlinkMapping);

                    LOG.info(MessageFormat.format("Symlink target for [{0}] has changed, was [{1}], now [{2}]", shareLibKey,
                            path, fileSystem.getSymLinkTarget(path)));
                    loadShareLibMetaFile(tempShareLibMap, tmpSymlinkMapping, sharelibMappingFile, shareLibKey);
                    shareLibMap = tempShareLibMap;
                    symlinkMapping = tmpSymlinkMapping;
                    return;
                }
View Full Code Here

    private void loadSharelib(Map<String, List<Path>> tmpShareLibMap, Map<String, Map<Path, Path>> tmpSymlinkMapping,
            String shareLibKey, String pathList[]) throws IOException {
        List<Path> listOfPaths = new ArrayList<Path>();
        Map<Path, Path> symlinkMappingforAction = new HashMap<Path, Path>();
        HadoopShims fileSystem = new HadoopShims(fs);

        for (String dfsPath : pathList) {
            Path path = new Path(dfsPath);

            getPathRecursively(fs, path, listOfPaths);
            if (HadoopShims.isSymlinkSupported() && fileSystem.isSymlink(path)) {
                symlinkMappingforAction.put(path, fileSystem.getSymLinkTarget(path));
            }
        }
        if (HadoopShims.isSymlinkSupported()) {
            LOG.info("symlink for " + shareLibKey + ":" + symlinkMappingforAction);
            tmpSymlinkMapping.put(shareLibKey, symlinkMappingforAction);
View Full Code Here

TOP

Related Classes of org.apache.oozie.hadoop.utils.HadoopShims

Copyright © 2018 www.massapicom. 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.