Example usage for org.apache.hadoop.filecache DistributedCache createAllSymlink

List of usage examples for org.apache.hadoop.filecache DistributedCache createAllSymlink

Introduction

In this page you can find the example usage for org.apache.hadoop.filecache DistributedCache createAllSymlink.

Prototype

@Deprecated
public static void createAllSymlink(Configuration conf, File jobCacheDir, File workDir) throws IOException 

Source Link

Document

This method create symlinks for all files in a given dir in another directory.

Usage

From source file:io.apigee.lembos.node.types.DistributedCacheWrap.java

License:Apache License

/**
 * Java wrapper for {@link DistributedCache#createAllSymlink(Configuration, File, File)}.
 *
 * @param ctx the JavaScript context//  w w w.  j a  v  a 2s  .c om
 * @param thisObj the 'this' object
 * @param args the function arguments
 * @param func the function being called
 */
@JSStaticFunction
public static void createAllSymlink(final Context ctx, final Scriptable thisObj, final Object[] args,
        final Function func) {
    final Object arg0 = args.length >= 1 ? args[0] : Undefined.instance;
    final Object arg1 = args.length >= 2 ? args[1] : Undefined.instance;
    final Object arg2 = args.length >= 3 ? args[2] : Undefined.instance;

    if (args.length < 3) {
        throw Utils.makeError(ctx, thisObj, LembosMessages.THREE_ARGS_EXPECTED);
    } else if (!JavaScriptUtils.isDefined(arg0)) {
        throw Utils.makeError(ctx, thisObj, LembosMessages.FIRST_ARG_REQUIRED);
    } else if (!JavaScriptUtils.isDefined(arg1)) {
        throw Utils.makeError(ctx, thisObj, LembosMessages.SECOND_ARG_REQUIRED);
    } else if (!JavaScriptUtils.isDefined(arg2)) {
        throw Utils.makeError(ctx, thisObj, LembosMessages.THIRD_ARG_REQUIRED);
    } else if (!(arg0 instanceof ConfigurationWrap)) {
        throw Utils.makeError(ctx, thisObj, LembosMessages.FIRST_ARG_MUST_BE_CONF);
    }

    try {
        DistributedCache.createAllSymlink(((ConfigurationWrap) arg0).getConf(), new File(arg1.toString()),
                new File(arg2.toString()));
    } catch (IOException e) {
        throw Utils.makeError(ctx, thisObj, e.getMessage());
    }
}