private void ensureWindowsSupport(NativeFunction function) throws NativeAccessException { if (!hasWindowsSupport()) { throw new NativeAccessException("Native Windows Support plugin not installed"); } if (!nativeWindowsSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native Windows Support plugin does not support " + function); } }
private void ensureMacSupport(NativeFunction function) throws NativeAccessException { if (!hasMacSupport()) { throw new NativeAccessException("Native Mac Support plugin not installed"); } if (!nativeMacSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native Mac Support plugin does not support " + function); } }
/** * Authenticate using Using Unix Pluggable Authentication Modules (PAM) * * @param userName * @param password * @return List<String> list of groups to which this user belongs * @throws hudson.util.jna.Native.NativeExecutionException */ public Set<String> pamAuthenticate(String serviceName, String userName, String password) throws NativeAccessException { ensureUnixSupport(NativeFunction.PAM); return nativeUnixSupport.pamAuthenticate(serviceName, userName, password); }
private void ensureUnixSupport(NativeFunction function) throws NativeAccessException { if (!hasUnixSupport()) { throw new NativeAccessException("Native Unix Support plugin not installed"); } if (!nativeUnixSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native Unix Support plugin does not support " + function); } }
private void ensureZfsSupport(NativeFunction function) throws NativeAccessException { if (!hasZfsSupport()) { throw new NativeAccessException("Native ZFS Support plugin not installed"); } if (!nativeZfsSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native ZFS Support plugin does not support " + function); } }
/** * Check if PAM Authentication available in the machine where this program * runs * * @return Message corresponding to the availability of PAM * @throws hudson.util.jna.Native.NativeExecutionException */ public String checkPamAuthentication() throws NativeAccessException { ensureUnixSupport(NativeFunction.PAM); return nativeUnixSupport.checkPamAuthentication(); }
/** * Restart current Java process (JVM in which this application is running) * * @throws hudson.util.jna.Native.NativeExecutionException */ public void restartJavaProcess(Map<String, String> properties, boolean asDaemon) throws NativeAccessException { ensureUnixSupport(NativeFunction.JAVA_RESTART); nativeUnixSupport.restartJavaProcess(properties, asDaemon); }
/** * Get all the native processes on a Windows System * * @return List of Native Window Processes * @throws hudson.util.jna.Native.ExecutionError */ public List<NativeProcess> getWindowsProcesses() throws NativeAccessException { ensureWindowsSupport(NativeFunction.WINDOWS_PROCESS); return nativeWindowsSupport.getWindowsProcesses(); }
/** * Get the Native processes of a Mac System * * @return * @throws hudson.util.jna.Native.NativeExecutionException */ public List<NativeProcess> getMacProcesses() throws NativeAccessException { ensureMacSupport(NativeFunction.MAC_PROCESS); return nativeMacSupport.getMacProcesses(); }
/** * Do the Unix style chown (change Owner permission) on a File * * @param file * @param mask * @return true if the function executed successfully * @throws hudson.util.jna.Native.ExecutionError */ public boolean chown(File file, int uid, int gid) throws NativeAccessException { ensureUnixSupport(NativeFunction.CHOWN); return nativeUnixSupport.chown(file, uid, gid); }
/** * Get the Unix style mode (file permission) of a file * * @param file * @return * @throws hudson.util.jna.Native.ExecutionError */ public int mode(File file) throws NativeAccessException { ensureUnixSupport(NativeFunction.MODE); return nativeUnixSupport.mode(file); }
/** * Check if this Java process can be restarted * * @throws hudson.util.jna.Native.NativeExecutionException */ public boolean canRestartJavaProcess() throws NativeAccessException { ensureUnixSupport(NativeFunction.JAVA_RESTART); return nativeUnixSupport.canRestartJavaProcess(); }
/** * Get the error associated with the last Native Unix Operation * * @return String error message */ public String getLastUnixError() { if (!hasUnixSupport()) { return "Native Unix Support plugin not installed"; } return nativeUnixSupport.getLastError(); }
/** * Do the Unix style chmod (change file permission) on a File * * @param file * @param mask * @return true if the function executed successfully * @throws hudson.util.jna.Native.ExecutionError */ public boolean chmod(File file, int mask) throws NativeAccessException { ensureUnixSupport(NativeFunction.CHMOD); return nativeUnixSupport.chmod(file, mask); }
/** * Get the name of the user who started this Java process * * @return * @throws hudson.util.jna.Native.NativeExecutionException */ public String getProcessUser() throws NativeAccessException { ensureUnixSupport(NativeFunction.UNIX_USER); return nativeUnixSupport.getProcessUser(); }
/** * Get the effective User ID on a Unix System * * @return * @throws hudson.util.jna.Native.ExecutionError */ public int getEuid() throws NativeAccessException { ensureUnixSupport(NativeFunction.EUID); return nativeUnixSupport.getEuid(); }
/** * Get the effective Group ID on a Unix System * * @return * @throws hudson.util.jna.Native.ExecutionError */ public int getEgid() throws NativeAccessException { ensureUnixSupport(NativeFunction.EGID); return nativeUnixSupport.getEgid(); }
/** * Find the ZFS File System by its mount point * * @return * @throws hudson.util.jna.Native.NativeExecutionException */ public NativeZfsFileSystem getZfsByMountPoint(File mountPoint) throws NativeAccessException { ensureZfsSupport(NativeFunction.ZFS); return nativeZfsSupport.getZfsByMountPoint(mountPoint); }
/** * Create ZFS File System corresponding to the mount name * * @param mountPoint * @return ZFS File System if created successfully * @throws hudson.util.jna.Native.NativeExecutionException */ public NativeZfsFileSystem createZfs(String mountName) throws NativeAccessException { ensureZfsSupport(NativeFunction.ZFS); return nativeZfsSupport.createZfs(mountName); }
/** * Check if .NET is installed on a the Windows machine * * @return true if .NET is installed. * @throws hudson.util.jna.Native.ExecutionError */ public boolean isDotNetInstalled(int major, int minor) throws NativeAccessException { ensureWindowsSupport(NativeFunction.DOTNET); return nativeWindowsSupport.isDotNetInstalled(major, minor); }