com.ibm.as400.access
Class SystemValueGroup

java.lang.Object
  extended by com.ibm.as400.access.SystemValueGroup
All Implemented Interfaces:
Serializable

public class SystemValueGroup
extends Object
implements Serializable

The SystemValueGroup class represents a user-defined collection of system values and network attributes. It is not as much a container for SystemValue objects as it is a factory for generating collections of SystemValues having certain attributes.

See Also:
SystemValue, SystemValueList, Serialized Form

Constructor Summary
Constructor and Description
SystemValueGroup()
          Constructs a SystemValueGroup object.
SystemValueGroup(AS400 system, String groupName, String groupDescription)
          Constructs a SystemValueGroup object.
SystemValueGroup(AS400 system, String groupName, String groupDescription, int group)
          Constructs a SystemValueGroup object.
SystemValueGroup(AS400 system, String groupName, String groupDescription, String[] names)
          Constructs a SystemValueGroup object.
 
Method Summary
Modifier and Type Method and Description
 void add(String name)
          Adds a system value name to this group.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a VetoableChangeListener.
 boolean contains(String name)
          Determines if a system value name is part of this group.
 String getGroupDescription()
          Returns the user-defined description for this group.
 String getGroupName()
          Returns the user-defined name for this group.
 String[] getNames()
          Returns the system value names that are currently part of this group.
 AS400 getSystem()
          Returns the system object representing the system on which the system value group exists.
 Vector getSystemValues()
          Returns newly-generated SystemValue objects representing the system values in this group.
static void refresh(Vector systemValues)
          Retrieves new values for the SystemValue objects in the Vector.
 boolean remove(String name)
          Removes a system value name from this group.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the PropertyChangeListener.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes the VetoableChangeListener.
 void setGroupDescription(String groupDescription)
          Sets the user-defined group description for any SystemValue objects generated by this group.
 void setGroupName(String groupName)
          Sets the user-defined group name for any SystemValue objects generated by this group.
 void setSystem(AS400 system)
          Sets the system object representing the system on which the system value group exists.
 String toString()
          Returns a String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SystemValueGroup

public SystemValueGroup()
Constructs a SystemValueGroup object. The system property must be set before attempting a connection.

See Also:
setSystem(com.ibm.as400.access.AS400)

SystemValueGroup

public SystemValueGroup(AS400 system,
                        String groupName,
                        String groupDescription)
Constructs a SystemValueGroup object. The group of system value names is initialized to be empty.

Parameters:
system - The system that this group of system value names references.
groupName - The user-defined group name to be used.
groupDescription - The user-defined group description to be used.

SystemValueGroup

public SystemValueGroup(AS400 system,
                        String groupName,
                        String groupDescription,
                        String[] names)
Constructs a SystemValueGroup object. The group of system value names is initialized to contain the system value names in names.

Parameters:
system - The system that this group of system value names references.
groupName - The user-defined group name to be used.
groupDescription - The user-defined group description to be used.
names - The array of system value names to be initially added to this group.

SystemValueGroup

public SystemValueGroup(AS400 system,
                        String groupName,
                        String groupDescription,
                        int group)
Constructs a SystemValueGroup object. The group of system value names is initialized to contain all of the system value names in the system-defined group groupIndicator. For example, specifying SystemValueList.GROUP_ALL for groupIndicator would result in this group of system value names being initialized to contain all system value and network attribute names.

Note: This constructor now makes a connection to the system in order to retrieve the IBM i release level of the system.

Parameters:
system - The system that this group of system values references.
groupName - The user-defined group name to be used.
groupDescription - The user-defined group description to be used.
group - The system value group constant indicating the set of system value names to be initially added to this group. Valid constants are defined in the SystemValueList class.
See Also:
SystemValueList, SystemValueList.GROUP_ALL
Method Detail

add

public void add(String name)
Adds a system value name to this group. All names in this group must be unique, so if name already exists in this group, it is ignored.

Parameters:
name - The system value name to be added to this group.
See Also:
contains(java.lang.String), getNames(), remove(java.lang.String)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this SystemValueGroup. It can be removed with removePropertyChangeListener.

Parameters:
listener - The listener object.

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method will be called each time the value of any constrained property is changed.

Parameters:
listener - The listener object.

contains

public boolean contains(String name)
Determines if a system value name is part of this group.

Parameters:
name - The system value name in question.
Returns:
Returns true if the system value is part of this group; false otherwise.
See Also:
add(java.lang.String), getNames(), remove(java.lang.String)

getGroupDescription

public String getGroupDescription()
Returns the user-defined description for this group.

Returns:
The group description.
See Also:
setGroupDescription(java.lang.String)

getGroupName

public String getGroupName()
Returns the user-defined name for this group.

Returns:
The group name.
See Also:
setGroupName(java.lang.String)

getNames

public String[] getNames()
Returns the system value names that are currently part of this group.

Returns:
An array of system value names.
See Also:
add(java.lang.String), contains(java.lang.String), remove(java.lang.String)

getSystem

public AS400 getSystem()
Returns the system object representing the system on which the system value group exists.

Returns:
The system object representing the system on which the system value group exists. If the system has not been set, null is returned.

getSystemValues

public Vector getSystemValues()
                       throws AS400SecurityException,
                              ErrorCompletingRequestException,
                              InterruptedException,
                              IOException,
                              ObjectDoesNotExistException
Returns newly-generated SystemValue objects representing the system values in this group. The SystemValue objects in the Vector are sorted by system value name.

If any value in this group is not supported by this group's system, its corresponding SystemValue object will not be returned in the Vector. Therefore, the number of SystemValue objects in the returned Vector may not be the same as the number of system value names represented by this group.

To refresh the values in a Vector of SystemValues, use the refresh() method.

Returns:
A Vector of SystemValue objects.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the object does not exist on the system.
See Also:
refresh(java.util.Vector)

refresh

public static void refresh(Vector systemValues)
                    throws AS400SecurityException,
                           ErrorCompletingRequestException,
                           InterruptedException,
                           IOException,
                           ObjectDoesNotExistException
Retrieves new values for the SystemValue objects in the Vector. The SystemValue objects in systemValues have their values refreshed from their respective systems. This method does not create new SystemValue objects; rather, it refreshes all SystemValue objects at once for a given system, which is more efficient than calling clear() on each SystemValue. All objects in systemValues must be SystemValue objects.

Parameters:
systemValues - The group of SystemValue objects to be refreshed.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the object does not exist on the system.
See Also:
SystemValue.clear()

remove

public boolean remove(String name)
Removes a system value name from this group.

Parameters:
name - The system value name to be removed from this group.
Returns:
Returns true if the system value was successfully removed; false otherwise.
See Also:
add(java.lang.String), contains(java.lang.String), getNames()

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done.

Parameters:
listener - The listener object.

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes the VetoableChangeListener. If the VetoableChangeListener is not on the list, nothing is done.

Parameters:
listener - The listener object.

setGroupDescription

public void setGroupDescription(String groupDescription)
                         throws PropertyVetoException
Sets the user-defined group description for any SystemValue objects generated by this group.

Parameters:
groupDescription - The group description.
Throws:
PropertyVetoException - If any of the registered listeners vetos the property change.
See Also:
getGroupDescription()

setGroupName

public void setGroupName(String groupName)
                  throws PropertyVetoException
Sets the user-defined group name for any SystemValue objects generated by this group.

Parameters:
groupName - The group name.
Throws:
PropertyVetoException - If any of the registered listeners vetos the property change.
See Also:
getGroupName()

setSystem

public void setSystem(AS400 system)
               throws PropertyVetoException
Sets the system object representing the system on which the system value group exists.

Parameters:
system - The system object representing the system on which the system value group exists.
Throws:
PropertyVetoException - If any of the registered listeners vetos the property change.

toString

public String toString()
Returns a String representation of this object.

Overrides:
toString in class Object
Returns:
A String representing this SystemValueGroup object.