com.izforge.izpack.util.os.unix
Class UnixUsers

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by com.izforge.izpack.util.os.unix.UnixUsers
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class UnixUsers
extends java.util.ArrayList

Unix Users Collection Class and related static Helper Methods

Author:
marc.eppelmann@reddot.de
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
          serialVersionUID = -4804842346742194981L;
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
UnixUsers()
          Creates a new UnixUsers object.
 
Method Summary
 java.util.ArrayList _getUsersWithValidShellsExistingHomesAndDesktops()
          Gets all known users with valid shells and really existing (not dummy) Home And!
private  void fromUsersArrayList(java.util.ArrayList<java.lang.String> anUsersArrayList)
          Builds the internal Array from the given UsersArrayList
static java.util.ArrayList<java.lang.String> getEtcPasswdUsersAsArrayList()
          Gets all Users from /etc/passwd as StringList
static java.lang.String getUsersColonString()
          Returns all Users as ColonSeparated String
 java.util.ArrayList<UnixUser> getUsersWithValidShells()
          Gets all known users with valid shells
 java.util.ArrayList<UnixUser> getUsersWithValidShellsAndExistingHomes()
          Gets all known users with valid shells and really existing (not dummy) Homefolders.
static java.util.ArrayList getUsersWithValidShellsExistingHomesAndDesktops()
          Gets all known users with valid shells and really existing (not dummy) Home And!
 java.util.ArrayList<java.lang.String> getValidUsersDesktopFolders()
          An StringArray of the existing Desktop folders of all valid users.
static java.util.ArrayList<java.lang.String> getYpPasswdUsersAsArrayList()
          Gets all Users from /etc/passwd as StringList
static void main(java.lang.String[] args)
          Test main Method
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

serialVersionUID

private static final long serialVersionUID
serialVersionUID = -4804842346742194981L;

See Also:
Constant Field Values
Constructor Detail

UnixUsers

public UnixUsers()
Creates a new UnixUsers object.

Method Detail

getUsersWithValidShells

public java.util.ArrayList<UnixUser> getUsersWithValidShells()
Gets all known users with valid shells

Returns:
an UnixUsers arraylist of these users

getUsersWithValidShellsAndExistingHomes

public java.util.ArrayList<UnixUser> getUsersWithValidShellsAndExistingHomes()
Gets all known users with valid shells and really existing (not dummy) Homefolders.

Returns:
an UnixUsers Arraylist of these users

_getUsersWithValidShellsExistingHomesAndDesktops

public java.util.ArrayList _getUsersWithValidShellsExistingHomesAndDesktops()
Gets all known users with valid shells and really existing (not dummy) Home And! freedesktop.org/RFC-based "Desktop" folders.

Returns:
an UnixUsers Arraylist of these users

getValidUsersDesktopFolders

public java.util.ArrayList<java.lang.String> getValidUsersDesktopFolders()
An StringArray of the existing Desktop folders of all valid users.

Returns:
the Stringlist of ValidUsersDesktopFolders

getUsersWithValidShellsExistingHomesAndDesktops

public static java.util.ArrayList getUsersWithValidShellsExistingHomesAndDesktops()
Gets all known users with valid shells and really existing (not dummy) Home And! freedesktop.org/RFC-based "Desktop" folders.

Returns:
an UnixUsers Arraylist of these users

fromUsersArrayList

private void fromUsersArrayList(java.util.ArrayList<java.lang.String> anUsersArrayList)
Builds the internal Array from the given UsersArrayList

Parameters:
anUsersArrayList - an Users ArrayList reded from /etc/passwd

getEtcPasswdUsersAsArrayList

public static java.util.ArrayList<java.lang.String> getEtcPasswdUsersAsArrayList()
Gets all Users from /etc/passwd as StringList

Returns:
the UserNames extracted from the getEtcPasswdArray()

getYpPasswdUsersAsArrayList

public static java.util.ArrayList<java.lang.String> getYpPasswdUsersAsArrayList()
Gets all Users from /etc/passwd as StringList

Returns:
the UserNames extracted from the getEtcPasswdArray()

getUsersColonString

public static java.lang.String getUsersColonString()
Returns all Users as ColonSeparated String

Returns:
"asterisk:at:avahi:beagleindex:bin:daemon:dhcpd:ftp:games:gdm:haldaemon:icecream:irc:ldap:lp:mail:mailman:man:...."

main

public static void main(java.lang.String[] args)
Test main Method

Parameters:
args - from Commandline