public class SaveFile
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
CLS
Special value for the "waitTime" property.
|
static java.lang.String |
CURRENT_RELEASE
Value for the "targetRelease" property, indicating "current release".
|
static int |
DEFAULT
Special value for the "maximumNumberOfRecords", "waitTime", and "asp" properties.
|
static int |
IMMED
Value for the "waitTime" property, indicating "immediate".
|
static long |
NO_MAX
Value for the "maximumNumberOfRecords" property, indicating that the system maximum is used.
|
static java.lang.String |
PREVIOUS_RELEASE
Value for the "targetRelease" property, indicating "previous release".
|
Constructor and Description |
---|
SaveFile(AS400 system,
java.lang.String library,
java.lang.String name)
Constructs a SaveFile object.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all existing records from the save file and reduces the amount of storage used by this file.
|
void |
copyTo(java.lang.String library,
java.lang.String name)
Copies the save file to another save file on the same system.
|
void |
create()
Creates a save file on the system.
|
void |
create(long maxRecords,
int asp,
int waitTime,
boolean shared,
java.lang.String authority,
java.lang.String description)
Creates a save file on the system.
|
void |
delete()
Deletes the save file.
|
boolean |
equals(java.lang.Object obj)
Determines whether this SaveFile object is equal to another object.
|
boolean |
exists()
Determines if the save file currently exists on the system.
|
int |
getASP()
Returns the auxiliary storage pool ID for the save file.
|
long |
getCurrentNumberOfRecords()
Returns the current number of records in the save file.
|
java.lang.String |
getDescription()
Returns the text description of the save file.
|
long |
getLength()
Returns the current total size (in bytes) of the save file.
|
java.lang.String |
getLibrary()
Returns the name of the library where the save file is located on the system.
|
long |
getMaximumNumberOfRecords()
Returns the capacity (maximum number of records) of the save file.
|
java.lang.String |
getName()
Returns the name of the save file on the system.
|
ObjectDescription |
getObjectDescription()
Returns an ObjectDescription instance representing the save file.
|
java.lang.String |
getPath()
Returns the fully-qualifed IFS pathname of the save file.
|
AS400 |
getSystem()
Returns the system where the save file is located.
|
java.lang.String |
getTargetRelease()
Returns the target release level of the operating system on which you intend to restore and use the object(s) saved in the save file by a subsequent invocation of one of the save() methods.
|
int |
getWaitTime()
Returns the wait time for the save file.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isSaveOutput()
Indicates whether output from called API's will be saved in the job's spooled output.
|
boolean |
isShared()
Reports whether the open data path (ODP) for the save file is shared with other programs in the routing step.
|
SaveFileEntry[] |
listEntries()
Lists the contents of the save file.
|
Product[] |
listProducts()
Lists the product loads in the save file.
|
void |
refresh()
Purges any cached attribute information about the save file.
|
void |
renameTo(java.lang.String name)
Renames the save file.
|
void |
restore(Product product)
Restores a licenced program product that was saved into the save file.
|
void |
restore(java.lang.String libraryName)
Restores a library that was saved into the save file.
|
void |
restore(java.lang.String libraryName,
java.lang.String[] objectList,
java.lang.String toLibraryName)
Restores objects that were saved into the save file.
|
void |
save(Product product)
Saves a copy of all of the objects that make up a licenced program product, into the save file.
|
void |
save(java.lang.String libraryName)
Saves a library into the save file.
|
void |
save(java.lang.String[] pathList)
Saves files from the root file system into the save file.
|
void |
save(java.lang.String libraryName,
java.lang.String[] objectList)
Saves objects into the save file.
|
void |
setDescription(java.lang.String description)
Sets the text description of the save file.
|
void |
setMaximumNumberOfRecords(long maximumNumberOfRecords)
Sets the capacity (maximum number of records) of the save file.
|
void |
setSaveOutput(boolean save)
Indicates whether output from called API's will be saved in the job's spooled output.
|
void |
setShared(boolean shared)
Sets whether the open data path (ODP) for the save file is shared with other programs in the routing step.
|
void |
setTargetRelease(java.lang.String targetRelease)
Sets the target release level of the operating system on which you intend to restore and use the object(s) saved in the save file by a subsequent invocation of one of the save() methods.
|
void |
setWaitTime(int seconds)
Sets the number of seconds to wait for the file resources and session resources to be allocated when the save file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the save file.
|
java.lang.String |
toString()
Returns the String representation of this object.
|
public static final java.lang.String CURRENT_RELEASE
public static final java.lang.String PREVIOUS_RELEASE
public static final long NO_MAX
public static final int IMMED
public static final int CLS
public static final int DEFAULT
public SaveFile(AS400 system, java.lang.String library, java.lang.String name)
create()
or create()
.system
- The system where the save file is located.library
- The library (on the system) where the save file is located. Example: "MYLIB1". Case is preserved.name
- The name of the save file. Example: "MYFILE1". Case is preserved.public void clear() throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException, ObjectDoesNotExistException
A save file must be cleared before it can be used again to receive data from a save command or to receive another save file.
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 object does not exist on the system.public void copyTo(java.lang.String library, java.lang.String name) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
library
- The library of the target save file. Example: "MYLIB1". Case is preserved.name
- The name of the target save file. Example: "MYFILE1". Case is preserved.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 object does not exist on the system.public void create() throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException, ObjectDoesNotExistException, ObjectAlreadyExistsException
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.ObjectAlreadyExistsException
- If the save file already exists on the system.ObjectDoesNotExistException
- If the system API that queries save file description information is missing.public void create(long maxRecords, int asp, int waitTime, boolean shared, java.lang.String authority, java.lang.String description) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException, ObjectDoesNotExistException, ObjectAlreadyExistsException
maxRecords
- The maximum number of records the save file can hold. If NO_MAX
is specified, the system maximum is used.asp
- The auxiliary storage pool (ASP) in which the system creates the save file. If DEFAULT
is specified, the save file is created in the same ASP as the one containing the library holding the file.waitTime
- The number of seconds that the program waits for the file resources and session resources to be allocated when the file is opened, or for the device or session resources to be allocated when an acquire operation is performed to the file. Special values: CLS
, IMMED
shared
- Specifies whether the open data path (ODP) for the save file is shared with other programs in the routing step. When an ODP is shared, the programs accessing the file share facilities such as the file status and the buffer. Default is false.authority
- The authority given to users who do not have specific authority to the save file, who are not on an authorization list, and whose user group has no specific authority to the save file. Defaults to *EXCLUDE if null.description
- The text that briefly describes the save file. Defaults to blank if null.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.ObjectAlreadyExistsException
- If the save file already exists on the system.ObjectDoesNotExistException
- If the system API that queries save file description information is missing.public void delete() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException
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.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean exists() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 save file description information is missing.public int getASP() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 object does not exist on the system.public long getCurrentNumberOfRecords() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 object does not exist on the system.public java.lang.String getDescription() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 object does not exist on the system.public long getLength() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 object does not exist on the system.public java.lang.String getLibrary()
public long getMaximumNumberOfRecords() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
NO_MAX
if there is no maximum.
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 object does not exist on the system.public java.lang.String getName()
public ObjectDescription getObjectDescription() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 object does not exist on the system.public java.lang.String getPath()
public AS400 getSystem()
public java.lang.String getTargetRelease()
CURRENT_RELEASE
and PREVIOUS_RELEASE
. The default is CURRENT_RELEASE.public int getWaitTime() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
IMMED
, CLS
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 object does not exist on the system.public boolean isSaveOutput()
public boolean isShared() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 object does not exist on the system.public SaveFileEntry[] listEntries() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, java.io.UnsupportedEncodingException
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 object does not exist on the system.java.io.UnsupportedEncodingException
- If the Character Encoding is not supported.public Product[] listProducts() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 object does not exist on the system.public void refresh() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
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 object does not exist on the system.public void renameTo(java.lang.String name) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
name
- The new name for the save file. Example: "MYFILE1".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 object does not exist on the system.public void restore(java.lang.String libraryName) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
libraryName
- The library to be restored.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 object does not exist on the system.public void restore(java.lang.String libraryName, java.lang.String[] objectList, java.lang.String toLibraryName) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
libraryName
- The library from which the object was saved.objectList
- The objects to be restored. Objects are specified by simple object name. For example: MYPROG1 or MYFILE2.toLibraryName
- The library to which to restore the object. If null, restores to the original library, that is, the library from which the object was saved.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 object does not exist on the system.public void restore(Product product) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
product
- The product to be restored.AS400Exception
- If the product is already installed, or 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 object does not exist on the system.public void save(java.lang.String libraryName) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
libraryName
- The library to be saved.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 object does not exist on the system.public void save(java.lang.String libraryName, java.lang.String[] objectList) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
libraryName
- The library where the object resides.objectList
- The objects to be saved. Objects are specified by simple object name. For example: MYPROG1 or MYFILE2.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 object does not exist on the system.public void save(java.lang.String[] pathList) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
pathList
- The objects to be saved; objects are specified by path. For example: "/myDirectory/myFile" or "/myDirectory/*".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 object does not exist on the system.public void save(Product product) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
product
- The product to be saved.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 object does not exist on the system.public void setDescription(java.lang.String description) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
description
- The description.
Maximum length is 50 characters.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 object does not exist on the system.public void setMaximumNumberOfRecords(long maximumNumberOfRecords) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
NO_MAX
maximumNumberOfRecords
- 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 object does not exist on the system.public void setSaveOutput(boolean save)
save
- Whether output should be saved.public void setShared(boolean shared) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
shared
- Whether ODP is shared.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 object does not exist on the system.public void setTargetRelease(java.lang.String targetRelease)
CURRENT_RELEASE
and PREVIOUS_RELEASE
. The default is CURRENT_RELEASE.targetRelease
- The target release.public void setWaitTime(int seconds) throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
IMMED
.
seconds
- The wait time.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 object does not exist on the system.public java.lang.String toString()
toString
in class java.lang.Object