Made Javadoc review.
This commit is contained in:
parent
c0d3fb7be0
commit
402a0a47dd
11 changed files with 152 additions and 92 deletions
|
@ -144,10 +144,8 @@ public class EtcGroupFile extends ChangeableFile
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the updated groups.
|
||||
*
|
||||
* @return the groups
|
||||
/* (non-Javadoc)
|
||||
* @see fr.devinsy.unix.util.ChangeableFile#refresh()
|
||||
*/
|
||||
@Override
|
||||
public void refresh()
|
||||
|
|
|
@ -99,10 +99,8 @@ public class EtcPasswdFile extends ChangeableFile
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated users.
|
||||
*
|
||||
* @return the users
|
||||
/* (non-Javadoc)
|
||||
* @see fr.devinsy.unix.util.ChangeableFile#refresh()
|
||||
*/
|
||||
@Override
|
||||
public void refresh()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2010,2013-2014,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -23,7 +23,6 @@ import java.util.Vector;
|
|||
/**
|
||||
* The Class Group.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Group
|
||||
{
|
||||
|
@ -89,7 +88,9 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the members.
|
||||
*
|
||||
* @return the members
|
||||
*/
|
||||
public Vector<String> getMembers()
|
||||
{
|
||||
|
@ -102,7 +103,9 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
|
@ -115,7 +118,9 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the password.
|
||||
*
|
||||
* @return the password
|
||||
*/
|
||||
public String getPassword()
|
||||
{
|
||||
|
@ -128,7 +133,9 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Gid.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
public int gid()
|
||||
{
|
||||
|
@ -141,7 +148,9 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Members.
|
||||
*
|
||||
* @return the vector
|
||||
*/
|
||||
public Vector<String> members()
|
||||
{
|
||||
|
@ -154,7 +163,9 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String name()
|
||||
{
|
||||
|
@ -167,7 +178,9 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Passwd.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String passwd()
|
||||
{
|
||||
|
@ -180,7 +193,10 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the gid.
|
||||
*
|
||||
* @param gid
|
||||
* the new gid
|
||||
*/
|
||||
public void setGid(final int gid)
|
||||
{
|
||||
|
@ -188,7 +204,10 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name
|
||||
* the new name
|
||||
*/
|
||||
public void setName(final String name)
|
||||
{
|
||||
|
@ -196,7 +215,10 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the passwd.
|
||||
*
|
||||
* @param password
|
||||
* the new passwd
|
||||
*/
|
||||
public void setPasswd(final String password)
|
||||
{
|
||||
|
@ -204,7 +226,10 @@ public class Group
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the password.
|
||||
*
|
||||
* @param password
|
||||
* the new password
|
||||
*/
|
||||
public void setPassword(final String password)
|
||||
{
|
||||
|
@ -225,5 +250,3 @@ public class Group
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2010,2013-2014,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -24,11 +24,9 @@ import java.util.Vector;
|
|||
/**
|
||||
* The Class Groups.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Groups extends Vector<Group>
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 5802487312198869603L;
|
||||
|
||||
// static private final Logger logger =
|
||||
|
@ -91,7 +89,11 @@ public class Groups extends Vector<Group>
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the by gid.
|
||||
*
|
||||
* @param gid
|
||||
* the gid
|
||||
* @return the by gid
|
||||
*/
|
||||
public Group getByGid(final int gid)
|
||||
{
|
||||
|
@ -250,5 +252,3 @@ public class Groups extends Vector<Group>
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -35,7 +35,6 @@ import fr.devinsy.unix.acl.AclManager;
|
|||
/**
|
||||
* The Class Unix.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Unix
|
||||
{
|
||||
|
@ -51,8 +50,8 @@ public class Unix
|
|||
* the text
|
||||
* @param path
|
||||
* the path
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void appendToFile(final String text, final String path) throws UnixException
|
||||
{
|
||||
|
@ -99,6 +98,15 @@ public class Unix
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bash.
|
||||
*
|
||||
* @param command
|
||||
* the command
|
||||
* @return the string
|
||||
* @throws CmdExecException
|
||||
* the cmd exec exception
|
||||
*/
|
||||
public static String bash(final String... command) throws CmdExecException
|
||||
{
|
||||
String result;
|
||||
|
@ -118,13 +126,13 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Chmod.
|
||||
*
|
||||
*
|
||||
* @param changes
|
||||
* the changes
|
||||
* @param path
|
||||
* the path
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void chmod(final String changes, final String path) throws UnixException
|
||||
{
|
||||
|
@ -152,13 +160,13 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Clear acl.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void clearAcl(final String id, final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -167,13 +175,13 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Clear acl group.
|
||||
*
|
||||
*
|
||||
* @param group
|
||||
* the group
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void clearAclGroup(final String group, final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -182,13 +190,13 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Clear acl user.
|
||||
*
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void clearAclUser(final String login, final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -197,11 +205,11 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Creates the user account.
|
||||
*
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void createUserAccount(final String login) throws UnixException
|
||||
{
|
||||
|
@ -217,13 +225,13 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Creates the user account.
|
||||
*
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @param name
|
||||
* the name
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void createUserAccount(final String login, final String name) throws UnixException
|
||||
{
|
||||
|
@ -243,15 +251,15 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Creates the user account.
|
||||
*
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @param name
|
||||
* the name
|
||||
* @param home
|
||||
* the home
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void createUserAccount(final String login, final String name, final String home) throws UnixException
|
||||
{
|
||||
|
@ -286,7 +294,7 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Creates the user account.
|
||||
*
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @param name
|
||||
|
@ -295,8 +303,8 @@ public class Unix
|
|||
* the home
|
||||
* @param password
|
||||
* the password
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void createUserAccount(final String login, final String name, final String home, final String password) throws UnixException
|
||||
{
|
||||
|
@ -317,11 +325,11 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Delete group.
|
||||
*
|
||||
*
|
||||
* @param group
|
||||
* the group
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void deleteGroup(final String group) throws UnixException
|
||||
{
|
||||
|
@ -346,7 +354,12 @@ public class Unix
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete user account.
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void deleteUserAccount(final String login) throws UnixException
|
||||
{
|
||||
|
@ -398,12 +411,12 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Gets the acl data.
|
||||
*
|
||||
*
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @return the acl data
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static String getAclData(final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -417,12 +430,12 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Gets the acl users.
|
||||
*
|
||||
*
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @return the acl users
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static String[] getAclUsers(final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -472,13 +485,13 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Link.
|
||||
*
|
||||
*
|
||||
* @param sourcePath
|
||||
* the source path
|
||||
* @param targetPath
|
||||
* the target path
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void link(final String sourcePath, final String targetPath) throws UnixException
|
||||
{
|
||||
|
@ -517,15 +530,15 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Modify login.
|
||||
*
|
||||
*
|
||||
* @param sourceLogin
|
||||
* the source login
|
||||
* @param targetLogin
|
||||
* the target login
|
||||
* @param sourceHomeDirectory
|
||||
* the source home directory
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void modifyLogin(final String sourceLogin, final String targetLogin, final String sourceHomeDirectory) throws UnixException
|
||||
{
|
||||
|
@ -596,13 +609,13 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Recursive chmod.
|
||||
*
|
||||
*
|
||||
* @param changes
|
||||
* the changes
|
||||
* @param path
|
||||
* the path
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void recursiveChmod(final String changes, final String path) throws UnixException
|
||||
{
|
||||
|
@ -725,11 +738,11 @@ public class Unix
|
|||
|
||||
/**
|
||||
* Sets the facl.
|
||||
*
|
||||
*
|
||||
* @param args
|
||||
* the new facl
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void setfacl(final String... args) throws UnixException
|
||||
{
|
||||
|
@ -782,12 +795,13 @@ public class Unix
|
|||
|
||||
/**
|
||||
* chfn [ -f full-name ] [ username ].
|
||||
*
|
||||
*
|
||||
* @param login
|
||||
* the login
|
||||
* @param newRealName
|
||||
* the new real name
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static void setRealName(final String login, final String newRealName) throws UnixException
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2010,2013-2014,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -21,7 +21,6 @@ package fr.devinsy.unix;
|
|||
/**
|
||||
* The Class User.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class User
|
||||
{
|
||||
|
@ -409,5 +408,3 @@ public class User
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2006-2010,2013-2014,2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2006-2021 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -24,7 +24,6 @@ import java.util.Vector;
|
|||
/**
|
||||
* The Class Users.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Users extends Vector<User>
|
||||
{
|
||||
|
@ -41,8 +40,12 @@ public class Users extends Vector<User>
|
|||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.util.Vector#addAll(java.util.Collection)
|
||||
/**
|
||||
* Adds the all.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean addAll(final Users source)
|
||||
{
|
||||
|
@ -212,5 +215,3 @@ public class Users extends Vector<User>
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
|
@ -113,11 +113,12 @@ public class AclManager
|
|||
|
||||
/**
|
||||
* Gets the acl.
|
||||
*
|
||||
*
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @return the acl
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static Acl getAcl(final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -215,10 +216,12 @@ public class AclManager
|
|||
|
||||
/**
|
||||
* Gets the ACL data.
|
||||
*
|
||||
*
|
||||
* @param filePathName
|
||||
* the file path name
|
||||
* @return the acl data
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static String getAclData(final String filePathName) throws UnixException
|
||||
{
|
||||
|
@ -288,7 +291,7 @@ public class AclManager
|
|||
|
||||
/**
|
||||
* Checks if is used.
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* the type
|
||||
* @param id
|
||||
|
@ -299,8 +302,7 @@ public class AclManager
|
|||
* the depth
|
||||
* @return true, if is used
|
||||
* @throws UnixException
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* the unix exception
|
||||
*/
|
||||
public static boolean isUsed(final AclEntry.Type type, final String id, final String filePathName, final int depth) throws UnixException
|
||||
{
|
||||
|
@ -341,7 +343,7 @@ public class AclManager
|
|||
|
||||
/**
|
||||
* Checks if is used.
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* the type
|
||||
* @param id
|
||||
|
@ -354,6 +356,7 @@ public class AclManager
|
|||
* the depth
|
||||
* @return true, if is used
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static boolean isUsed(final AclEntry.Type type, final String id, final String filePath, final String[] filePathNames, final int depth) throws UnixException
|
||||
{
|
||||
|
@ -411,7 +414,7 @@ public class AclManager
|
|||
|
||||
/**
|
||||
* Checks if is used.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @param filePathName
|
||||
|
@ -419,8 +422,8 @@ public class AclManager
|
|||
* @param depth
|
||||
* the depth
|
||||
* @return true, if is used
|
||||
* @throws Exception
|
||||
* the exception
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static boolean isUsed(final String id, final String filePathName, final int depth) throws UnixException
|
||||
{
|
||||
|
@ -461,7 +464,7 @@ public class AclManager
|
|||
|
||||
/**
|
||||
* Checks if is used.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @param filePathNames
|
||||
|
@ -470,6 +473,7 @@ public class AclManager
|
|||
* the depth
|
||||
* @return true, if is used
|
||||
* @throws UnixException
|
||||
* the unix exception
|
||||
*/
|
||||
public static boolean isUsed(final String id, final String[] filePathNames, final int depth) throws UnixException
|
||||
{
|
||||
|
|
|
@ -36,7 +36,6 @@ import fr.devinsy.unix.util.PropertyList;
|
|||
/**
|
||||
* The Class Linux.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class Linux
|
||||
{
|
||||
|
@ -208,6 +207,7 @@ public class Linux
|
|||
*
|
||||
* @return the string
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static String readProcCpuinfo0() throws IOException
|
||||
{
|
||||
|
@ -265,6 +265,7 @@ public class Linux
|
|||
*
|
||||
* @return the string
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static String readProcUptimeFile() throws IOException
|
||||
{
|
||||
|
|
|
@ -21,11 +21,8 @@ package fr.devinsy.unix.util;
|
|||
import java.io.File;
|
||||
|
||||
/**
|
||||
* The Class CachedFile.
|
||||
*
|
||||
* @author Christian Pierre MOMON <christian.momon@devinsy.fr>
|
||||
* The Class ChangeableFile.
|
||||
*/
|
||||
|
||||
public class ChangeableFile
|
||||
{
|
||||
private File sourceFile;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON
|
||||
* Copyright (C) 2017-2021 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-unix.
|
||||
*
|
||||
|
@ -28,6 +28,11 @@ public class Property
|
|||
|
||||
/**
|
||||
* Utility class has not to have a constructor.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public Property(final String name, final String value)
|
||||
{
|
||||
|
@ -35,21 +40,43 @@ public class Property
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name
|
||||
* the new name
|
||||
*/
|
||||
public void setName(final String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value.
|
||||
*
|
||||
* @param value
|
||||
* the new value
|
||||
*/
|
||||
public void setValue(final String value)
|
||||
{
|
||||
this.value = value;
|
||||
|
|
Loading…
Reference in a new issue