com.ibm.as400.access
Class Subsystem
- java.lang.Object
-
- com.ibm.as400.access.Subsystem
-
public class Subsystem extends java.lang.Object
Represents a subsystem on the system. Most of the getter methods simply return the cached attribute value obtained by the most recentrefresh()
. Other than getObjectDescription(), none of the getters will themselves go to the system to get the current attribute value. Prior to the first refresh(), many of the getters will return null or zero.
Example:Subsystem sbs = new Subsystem(system, library, name); if (!sbs.exists()) { System.out.println("No such subsystem: "+sbs.getPath()); } else { sbs.refresh(); System.out.println("Status: " + sbs.getStatus()); System.out.println("Number of jobs: " + sbs.getCurrentActiveJobs()); System.out.println("Maximum jobs: " + sbs.getMaximumActiveJobs()); SystemPool[] pools = sbs.getPools(); System.out.print("Pools: "); if (pools == null) System.out.println("null"); else for (int i=0; i<pools.length; i++) { System.out.print(" " + (pools[i] == null ? "null" : pools[i].getName())); } System.out.println(); } System.out.println("All subsystems on "+system.getSystemName()); Subsystem[] list = Subsystem.listAllSubsystems(system); for (int i=0; i<list.length; i++) { System.out.println(list[i].getLibrary()+"/"+list[i].getName()); }
-
-
Field Summary
Fields Modifier and Type Field and Description static int
NO_MAX
Value for the maximumActiveJobs property, indicating "no maximum".static int
NO_TIME_LIMIT
Value for the timeLimit parameter of the end() methods, indicating "no time limit".
-
Constructor Summary
Constructors Constructor and Description Subsystem(AS400 system, java.lang.String path)
Constructs a Subsystem object.Subsystem(AS400 system, java.lang.String library, java.lang.String name)
Constructs a Subsystem object.
-
Method Summary
Methods Modifier and Type Method and Description void
assignPool(int sequenceNumber, int size, int activityLevel)
Defines a private storage pool and adds it to the list of storage pools defined for the subsystem.void
assignPool(int sequenceNumber, java.lang.String poolName)
Adds a shared system pool to the list of storage pools defined for the subsystem.void
changeDescriptionText(java.lang.String text)
Sets the subsystem description text.void
changeDisplayFilePath(java.lang.String path)
Specifies the signon display file that is used when showing signon displays at work stations allocated to the subsystem.void
changeLanguageLibrary(java.lang.String library)
Specifies a library to enter ahead of other libraries in the system portion of the library list.void
changeMaximumActiveJobs(int maxJobs)
Sets the maximum number of active jobs that can run or use resources within the subsystem at one time.void
create()
Creates the subsystem on the system.void
create(java.lang.String authority)
Creates the subsystem on the system.void
delete()
Deletes the subsystem from the system.void
end(int timeLimit)
Ends the subsystem on the system, in a controlled manner.static void
endAllSubsystems(AS400 system, int timeLimit)
Ends all active subsystems on the system, in a controlled manner.static void
endAllSubsystemsImmediately(AS400 system)
Ends all active subsystems on the system, immediately.void
endImmediately()
Ends the subsystem on the system, immediately.boolean
equals(java.lang.Object obj)
Determines whether this Subsystem object is equal to another object.boolean
exists()
Determines if the subsystem currently exists on the system.int
getCurrentActiveJobs()
Returns the number of jobs currently active in the subsystem.java.lang.String
getDescriptionText()
Returns the subsystem description text.java.lang.String
getDisplayFilePath()
Returns the path of the signon display file that is used when showing signon displays at work stations allocated to the subsystem.java.lang.String
getLanguageLibrary()
Returns the library that is entered ahead of other libraries in the system portion of the library list.java.lang.String
getLibrary()
Returns the name of the library where the subsystem resides on the system.int
getMaximumActiveJobs()
Returns the maximum number of active jobs that can run or use resources within the subsystem at one time.Job
getMonitorJob()
Returns the subsystem monitor job.java.lang.String
getName()
Returns the subsystem name.ObjectDescription
getObjectDescription()
Returns an ObjectDescription instance representing the subsystem.java.lang.String
getPath()
Returns the fully-qualifed IFS pathname of the subsystem.SystemPool
getPool(int sequenceNumber)
Returns the storage pool defined at the specified position for the subsystem.SystemPool[]
getPools()
Returns the list of storage pools that are defined for the subsystem.java.lang.String
getStatus()
Returns the extended status of the subsystem.AS400
getSystem()
Returns the system where the subsystem resides.int
hashCode()
Returns a hash code value for the object.static Subsystem[]
listAllSubsystems(AS400 system)
Lists all subsystems on the system.void
refresh()
Refreshes the attributes of this Subsystem object, to reflect the current state of the subsystem on the system.void
removePool(int sequenceNumber)
Removes a storage pool from the list of pools defined for the subsystem.void
start()
Starts the subsystem on the system.
-
-
-
Field Detail
-
NO_MAX
public static final int NO_MAX
Value for the maximumActiveJobs property, indicating "no maximum".- See Also:
- Constant Field Values
-
NO_TIME_LIMIT
public static final int NO_TIME_LIMIT
Value for the timeLimit parameter of the end() methods, indicating "no time limit".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Subsystem
public Subsystem(AS400 system, java.lang.String library, java.lang.String name)
Constructs a Subsystem object.
Note: Does not create a subsystem on the system.- Parameters:
system
- The system.library
- The name of the library where the subsystem resides.name
- The simple name of the subsystem.- See Also:
create()
-
-
Method Detail
-
assignPool
public void assignPool(int sequenceNumber, java.lang.String poolName) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Adds a shared system pool to the list of storage pools defined for the subsystem. Current pool definitions, other than the one specified, remain unchanged.- Parameters:
sequenceNumber
- The number of the pool, within the pool list for the subsystem. Valid values are 1-10.poolName
- The name of a shared system storage pool. Valid values include: *BASE, *NOSTG, *INTERACT, *SPOOL, and *SHRPOOLnn, where nn is an integer from 1 to 60.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
assignPool
public void assignPool(int sequenceNumber, int size, int activityLevel) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Defines a private storage pool and adds it to the list of storage pools defined for the subsystem. Current pool definitions, other than the one specified, remain unchanged.- Parameters:
sequenceNumber
- The number of the pool, within the pool list for the subsystem. Valid values are 1-10.size
- The size of the storage pool, in kilobytes. Must be at least 256 (meaning 256 kilobytes).activityLevel
- The activity level of the pool.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
changeDescriptionText
public void changeDescriptionText(java.lang.String text) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Sets the subsystem description text. The default is "".- Parameters:
text
- The subsystem description text. To clear the description, specify "".- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
changeDisplayFilePath
public void changeDisplayFilePath(java.lang.String path) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Specifies the signon display file that is used when showing signon displays at work stations allocated to the subsystem. By default, QSYS/QDSIGNON (path /QSYS.LIB/QDSIGNON.FILE) is used.- Parameters:
path
- The fully qualified pathname of the signon display file. SeeQSYSObjectPathName.toString()
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
changeLanguageLibrary
public void changeLanguageLibrary(java.lang.String library) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Specifies a library to enter ahead of other libraries in the system portion of the library list. This method allows you to use a secondary language library.- Parameters:
library
- The name of the library. Specify "" or "*NONE" to remove the current secondary language library from the system library list.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
changeMaximumActiveJobs
public void changeMaximumActiveJobs(int maxJobs) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Sets the maximum number of active jobs that can run or use resources within the subsystem at one time.- Parameters:
maxJobs
- The maximum number of active jobs. Valid values are 0-1000. Special valueNO_MAX
is the default, and indicates no maximum.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
create
public void create() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, ObjectAlreadyExistsException
Creates the subsystem on the system.
More precisely, this method creates a subsystem description on the system.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.ObjectAlreadyExistsException
- If the object already exists on the system.
-
create
public void create(java.lang.String authority) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, ObjectAlreadyExistsException
Creates the subsystem on the system.
More precisely, this method creates a subsystem description on the system.- Parameters:
authority
- The authority to give to users who do not have specific authority for the object, who are not on an authorization list, and whose group profile or supplemental group profiles do not have specific authority for the object. The default is *LIBCRTAUT. The "base system pool" (*BASE) is used.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.ObjectAlreadyExistsException
- If the object already exists on the system.
-
delete
public void delete() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException
Deletes the subsystem from the system.
More precisely, this method deletes a subsystem description on the system.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
end
public void end(int timeLimit) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Ends the subsystem on the system, in a controlled manner. This allows the programs that are running in the subsystem, to perform cleanup (end of job processing). When a job being ended has a signal handling procedure for the asynchronous signal SIGTERM, the SIGTERM signal is generated for that job. The application has timeLimit seconds to complete cleanup before the job is ended.- Parameters:
timeLimit
- The amount of time (in seconds) that is allowed to complete the controlled subsystem end operation. If this amount of time is exceeded and the end operation is not complete, any jobs still being processed in the subsystem are ended immediately. Special valueNO_TIME_LIMIT
indicates no time limit.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
endAllSubsystems
public static void endAllSubsystems(AS400 system, int timeLimit) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException
Ends all active subsystems on the system, in a controlled manner.- Parameters:
system
- The system.timeLimit
- The amount of time (in seconds) that is allowed to complete the controlled subsystem end operation. If this amount of time is exceeded and the end operation is not complete, any jobs still being processed in the subsystem are ended immediately. Special valueNO_TIME_LIMIT
indicates no time limit.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
endAllSubsystemsImmediately
public static void endAllSubsystemsImmediately(AS400 system) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException
Ends all active subsystems on the system, immediately.- Parameters:
system
- The system.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.
-
endImmediately
public void endImmediately() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Ends the subsystem on the system, immediately.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
equals
public boolean equals(java.lang.Object obj)
Determines whether this Subsystem object is equal to another object.- Overrides:
equals
in classjava.lang.Object
- Returns:
- true if the two instances are equal
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code value for this object.
-
exists
public boolean exists() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Determines if the subsystem currently exists on the system.
More precisely, this method reports if the subsystem description exists on the system.- Returns:
- true if the subsystem exists; false if the subsystem does not exist.
- Throws:
AS400Exception
- If the program call returns error messages.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the system API (that queries subsystem description information) is missing.
-
getCurrentActiveJobs
public int getCurrentActiveJobs()
Returns the number of jobs currently active in the subsystem.- Returns:
- The number of currently active jobs. 0 if refresh() has not been called, or if the subsystem status is *INACTIVE.
-
getDescriptionText
public java.lang.String getDescriptionText()
Returns the subsystem description text.- Returns:
- The subsystem description text. null if refresh() has not been called. "" if description is blank.
-
getDisplayFilePath
public java.lang.String getDisplayFilePath()
Returns the path of the signon display file that is used when showing signon displays at work stations allocated to the subsystem. By default, QSYS/QDSIGNON (path /QSYS.LIB/QDSIGNON.FILE) is used.- Returns:
- The path of the signon display file. null if refresh() has not been called.
-
getLanguageLibrary
public java.lang.String getLanguageLibrary() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the library that is entered ahead of other libraries in the system portion of the library list. This library typically specifies a secondary language library.- Returns:
- The name of the secondary language library. null if refresh() has not been called. "*NONE" if no secondary language library is set.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
getLibrary
public java.lang.String getLibrary()
Returns the name of the library where the subsystem resides on the system.- Returns:
- The name of the library.
-
getMaximumActiveJobs
public int getMaximumActiveJobs()
Returns the maximum number of active jobs that can run or use resources within the subsystem at one time.- Returns:
- The maximum number of active jobs. 0 if refresh() has not been called.
NO_MAX
if no maximum.
-
getMonitorJob
public Job getMonitorJob()
Returns the subsystem monitor job.- Returns:
- The subsystem monitor job. null if refresh() has not been called, or if subsystem status is *INACTIVE.
-
getName
public java.lang.String getName()
Returns the subsystem name.- Returns:
- The subsystem name.
-
getObjectDescription
public ObjectDescription getObjectDescription()
Returns an ObjectDescription instance representing the subsystem.- Returns:
- An ObjectDescription for the subsystem.
-
getPath
public java.lang.String getPath()
Returns the fully-qualifed IFS pathname of the subsystem. For example: "/QSYS.LIB/MYSUBSYS.SBSD".- Returns:
- The path of the subsystem.
-
getPool
public SystemPool getPool(int sequenceNumber)
Returns the storage pool defined at the specified position for the subsystem.- Parameters:
sequenceNumber
- The number of the pool, within the pool list for the subsystem. Valid values are 1-10.- Returns:
- The pool used by the subsystem, at the specified sequence position. null if refresh() has not been called, or if no pool has been assigned at that position.
-
getPools
public SystemPool[] getPools()
Returns the list of storage pools that are defined for the subsystem. That is, the list of storage pool definitions that are in the subsystem description. The element at offset 0 represents subsystem pool #1, element at offset 1 represents pool #2, and so on. In positions where no pool assignment has been made, the array element will be null.- Returns:
- The pools that are used by the subsystem. null if refresh() has not been called. Otherwise, a 10-element array is returned.
-
getStatus
public java.lang.String getStatus()
Returns the extended status of the subsystem. Possible values are: *ACTIVE, *ENDING, *INACTIVE, *RESTRICTED, and *STARTING.- Returns:
- The subsystem status. null if refresh() has not been called.
-
getSystem
public AS400 getSystem()
Returns the system where the subsystem resides.- Returns:
- The system.
-
listAllSubsystems
public static Subsystem[] listAllSubsystems(AS400 system) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, RequestNotSupportedException
Lists all subsystems on the system.- Parameters:
system
-- Returns:
- A list of all defined subsystems, both active and inactive.
- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.RequestNotSupportedException
- If the requested function is not supported because the system is not at the correct level.
-
refresh
public void refresh() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Refreshes the attributes of this Subsystem object, to reflect the current state of the subsystem on the system.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
removePool
public void removePool(int sequenceNumber) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Removes a storage pool from the list of pools defined for the subsystem. You should first end the subsystem before removing a pool.- Parameters:
sequenceNumber
- The number of the pool, within the pool list for the subsystem. Valid values are 1-10.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
start
public void start() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Starts the subsystem on the system.- Throws:
AS400Exception
- If the system returns an error message.AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.java.io.IOException
- If an error occurs while communicating with the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
-