public AdvancedRunAsUserFSOps(Map<String, Object> conf) { super(conf); if (Utils.isOnWindows()) { throw new UnsupportedOperationException("ERROR: Windows doesn't support running workers as different users yet"); } _conf = conf; }
RunAsUserContainer(Container.ContainerType type, Map<String, Object> conf, String supervisorId, int supervisorPort, int port, LocalAssignment assignment, ResourceIsolationInterface resourceIsolationManager, LocalState localState, String workerId, StormMetricsRegistry metricsRegistry, ContainerMemoryTracker containerMemoryTracker, Map<String, Object> topoConf, AdvancedFSOps ops, String profileCmd) throws IOException { super(type, conf, supervisorId, supervisorPort, port, assignment, resourceIsolationManager, localState, workerId, metricsRegistry, containerMemoryTracker, topoConf, ops, profileCmd); if (Utils.isOnWindows()) { throw new UnsupportedOperationException("ERROR: Windows doesn't support running workers as different users yet"); } }
public static String localTempPath() { StringBuilder ret = new StringBuilder().append(System.getProperty("java.io.tmpdir")); if (!Utils.isOnWindows()) { ret.append("/"); } ret.append(Utils.uuid()); return ret.toString(); }
public static void sendSignalToProcess(long lpid, int signum) throws IOException { String pid = Long.toString(lpid); try { if (Utils.isOnWindows()) { if (signum == SIGKILL) { execCommand("taskkill", "/f", "/pid", pid); } else { execCommand("taskkill", "/pid", pid); } } else { execCommand("kill", "-" + signum, pid); } } catch (ExecuteException e) { LOG.info("Error when trying to kill {}. Process is probably already dead.", pid); } catch (IOException e) { LOG.info("IOException Error when trying to kill {}.", pid); throw e; } }
/** * Given a Tar File as input it will untar the file in a the untar directory passed as the second parameter * <p/> * This utility will untar ".tar" files and ".tar.gz","tgz" files. * * @param inFile The tar file as input. * @param untarDir The untar directory where to untar the tar file. * @param symlinksDisabled true if symlinks should be disabled, else false. * @throws IOException */ public static void unTar(File inFile, File untarDir, boolean symlinksDisabled) throws IOException { ensureDirectory(untarDir); boolean gzipped = inFile.toString().endsWith("gz"); if (Utils.isOnWindows() || symlinksDisabled) { // Tar is not native to Windows. Use simple Java based implementation for // tests and simple tar archives unTarUsingJava(inFile, untarDir, gzipped, symlinksDisabled); } else { // spawn tar utility to untar archive for full fledged unix behavior such // as resolving symlinks in tar archives unTarUsingTar(inFile, untarDir, gzipped); } }
/** * Factory to create a new AdvancedFSOps * * @param conf the configuration of the process * @return the appropriate instance of the class for this config and environment. */ public static AdvancedFSOps make(Map<String, Object> conf) { if (Utils.isOnWindows()) { return new AdvancedWindowsFSOps(conf); } if (ObjectReader.getBoolean(conf.get(Config.SUPERVISOR_RUN_WORKER_AS_USER), false)) { return new AdvancedRunAsUserFSOps(conf); } return new AdvancedFSOps(conf); }
config, componentPageInfo.get_eventlog_port())); result.put("profilingAndDebuggingCapable", !Utils.isOnWindows()); result.put("profileActionEnabled", config.get(DaemonConfig.WORKER_PROFILER_ENABLED));
public void testArchives(File archiveFile, boolean supportSymlinks, int size) throws Exception { if (Utils.isOnWindows()) {
RunAsUserContainer(ContainerType type, Map<String, Object> conf, String supervisorId, int port, LocalAssignment assignment, LocalState localState, String workerId, Map<String, Object> topoConf, AdvancedFSOps ops, String profileCmd) throws IOException { super(type, conf, supervisorId, port, assignment, localState, workerId, topoConf, ops, profileCmd); if (Utils.isOnWindows()) { throw new UnsupportedOperationException("ERROR: Windows doesn't support running workers as different users yet"); } }
public AdvancedRunAsUserFSOps(Map<String, Object> conf) { super(conf); if (Utils.isOnWindows()) { throw new UnsupportedOperationException("ERROR: Windows doesn't support running workers as different users yet"); } _conf = conf; }
public static void sendSignalToProcess(long lpid, int signum) throws IOException { String pid = Long.toString(lpid); try { if (isOnWindows()) { if (signum == SIGKILL) { execCommand("taskkill", "/f", "/pid", pid); } else { execCommand("taskkill", "/pid", pid); } } else { execCommand("kill", "-" + signum, pid); } } catch (ExecuteException e) { LOG.info("Error when trying to kill {}. Process is probably already dead.", pid); } catch (IOException e) { LOG.info("IOException Error when trying to kill {}.", pid); throw e; } }
/** * Given a Tar File as input it will untar the file in a the untar directory * passed as the second parameter * <p/> * This utility will untar ".tar" files and ".tar.gz","tgz" files. * * @param inFile The tar file as input. * @param untarDir The untar directory where to untar the tar file. * @param symlinksDisabled true if symlinks should be disabled, else false. * @throws IOException */ public static void unTar(File inFile, File untarDir, boolean symlinksDisabled) throws IOException { ensureDirectory(untarDir); boolean gzipped = inFile.toString().endsWith("gz"); if (Utils.isOnWindows() || symlinksDisabled) { // Tar is not native to Windows. Use simple Java based implementation for // tests and simple tar archives unTarUsingJava(inFile, untarDir, gzipped, symlinksDisabled); } else { // spawn tar utility to untar archive for full fledged unix behavior such // as resolving symlinks in tar archives unTarUsingTar(inFile, untarDir, gzipped); } }
/** * Factory to create a new AdvancedFSOps * @param conf the configuration of the process * @return the appropriate instance of the class for this config and environment. */ public static AdvancedFSOps make(Map<String, Object> conf) { if (Utils.isOnWindows()) { return new AdvancedWindowsFSOps(conf); } if (Utils.getBoolean(conf.get(Config.SUPERVISOR_RUN_WORKER_AS_USER), false)) { return new AdvancedRunAsUserFSOps(conf); } return new AdvancedFSOps(conf); }