com.ibm.as400.access
Class JavaProgram
- java.lang.Object
-
- com.ibm.as400.access.JavaProgram
-
- All Implemented Interfaces:
- java.io.Serializable
public class JavaProgram extends java.lang.Object implements java.io.Serializable
Represents an IBM i Java program. This class is supported only when connecting to systems running IBM i V5R1 or higher, and is not supported beyond IBM i 7.1.In the context of this discussion, a "Java program" is the IBM i executable object that is created when the CRTJVAPGM (Create Java Program) CL command is run against a class, JAR, or ZIP file.
Using the JavaProgram class, you can obtain the following information about an IBM i Java program:- Adopted authority profile
- File change date
- File owner
- Java program creation date
- Release program was created for
- Licensed Internal Code options
- Number of attached java programs
- Number of classes
- Number of classes with current java programs
- Number of classes without current java programs
- Number of classes with errors
- Optimization level
- Path used
- Performance Collection Enabled flag
- Performance Collection type
- Profiling data status
- Size of attached java programs
- Use adopted authority
An Example using the JavaProgram class:
// Create a JavaProgram object to refer to a specific Java program. AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD"); JavaProgram javaProgram = new JavaProgram(system, "/home/mydir/HelloWorld.class");
// Get the optimization. int optimization = javaProgram.getOptimizationLevel();
// Get the file owner. String owner = javaProgram.getFileOwner();- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
ADOPTED_AUTHORITY_PROFILE_OWNER
Constant indicating that the profile to use when the use adopted authority field is set is *OWNER.static java.lang.String
ADOPTED_AUTHORITY_PROFILE_USER
Constant indicating that the profile to use when the use adopted authority field is set is *USER.static java.lang.String
PERFORMANCE_COLLECTION_TYPE_ENTRYEXIT
Constant indicating the type of performance collection is *ENTRYEXIT.static java.lang.String
PERFORMANCE_COLLECTION_TYPE_FULL
Constant indicating the type of performance collection is *FULL.static java.lang.String
PROFILING_DATA_STATUS_APY
Constant indicating that profile data has been applied to the attached Java program(s).static java.lang.String
PROFILING_DATA_STATUS_COL
Constant indicating that profile data collection is enabled for the attached Java program(s).static java.lang.String
PROFILING_DATA_STATUS_NOCOL
Constant indicating that profile data collection is not enabled for the the Java program(s).
-
Constructor Summary
Constructors Constructor and Description JavaProgram()
Creates a JavaProgramJavaProgram(AS400 system, java.lang.String path)
Creates a JavaProgram
-
Method Summary
Methods Modifier and Type Method and Description java.lang.String
getAdoptedAuthorityProfile()
Returns the profile to use when the "Use Adopted Authority" field is set.java.util.Date
getFileChangeDate()
Returns the date and time the file was last modified or changed.java.lang.String
getFileOwner()
Returns the name of the owner of the file.java.util.Date
getJavaProgramCreationDate()
Returns the date and time the Java program was created for the file.java.lang.String
getJavaProgramVersion()
Returns the IBM i version the Java program was created for.java.lang.String
getLICOptions()
Returns the LIC options string specified when the java program was last modified.int
getNumberOfAttachedPrograms()
Returns the number of Java prgroams attached to the .class or .jar/sip file.int
getNumberOfClasses()
Returns the number of classes.int
getNumberOfClassesWithCurrentJavaPrograms()
Returns the number of classes with representations up-to-date in the attached Java programs.int
getNumberOfClassesWithErrors()
Returns the number of classes containing errors.int
getNumberOfClassesWithoutCurrentJavaPrograms()
Returns the number of classes with representations out-of-date.int
getOptimizationLevel()
Returns the optimization level used to create the java program.java.lang.String
getPath()
Returns the path to a class, jar, or zip file used to create the Java program.java.lang.String
getPerformanceCollectionEnabledFlag()
Returns whether or not performance collection is enabled.java.lang.String
getPerformanceCollectionType()
Returns the type of performance collection if the performance collection flag is set.java.lang.String
getProfilingDataStatus()
Returns whether profiling data is enabled or applied.int
getSizeOfAttachedJavaPrograms()
Returns the size in kilobytes of all the attached java programs.AS400
getSystem()
Returns the name of the system.boolean
isUseAdoptedAuthority()
Returns whether or not the used adopted authority is set.void
refresh()
Refreshes all the values for this PTF by retrieving them from the system.void
setPath(java.lang.String path)
Sets the qualified path name to use.void
setSystem(AS400 system)
Sets the name of the system to search for a Java Program.
-
-
-
Field Detail
-
ADOPTED_AUTHORITY_PROFILE_USER
public static final java.lang.String ADOPTED_AUTHORITY_PROFILE_USER
Constant indicating that the profile to use when the use adopted authority field is set is *USER.- See Also:
- Constant Field Values
-
ADOPTED_AUTHORITY_PROFILE_OWNER
public static final java.lang.String ADOPTED_AUTHORITY_PROFILE_OWNER
Constant indicating that the profile to use when the use adopted authority field is set is *OWNER.- See Also:
- Constant Field Values
-
PERFORMANCE_COLLECTION_TYPE_ENTRYEXIT
public static final java.lang.String PERFORMANCE_COLLECTION_TYPE_ENTRYEXIT
Constant indicating the type of performance collection is *ENTRYEXIT.- See Also:
- Constant Field Values
-
PERFORMANCE_COLLECTION_TYPE_FULL
public static final java.lang.String PERFORMANCE_COLLECTION_TYPE_FULL
Constant indicating the type of performance collection is *FULL.- See Also:
- Constant Field Values
-
PROFILING_DATA_STATUS_NOCOL
public static final java.lang.String PROFILING_DATA_STATUS_NOCOL
Constant indicating that profile data collection is not enabled for the the Java program(s).- See Also:
- Constant Field Values
-
PROFILING_DATA_STATUS_COL
public static final java.lang.String PROFILING_DATA_STATUS_COL
Constant indicating that profile data collection is enabled for the attached Java program(s).- See Also:
- Constant Field Values
-
PROFILING_DATA_STATUS_APY
public static final java.lang.String PROFILING_DATA_STATUS_APY
Constant indicating that profile data has been applied to the attached Java program(s).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JavaProgram
public JavaProgram()
Creates a JavaProgram
-
JavaProgram
public JavaProgram(AS400 system, java.lang.String path)
Creates a JavaProgram- Parameters:
system
- The system.path
- The path. This can specify any class, jar, or zip file.
-
-
Method Detail
-
getSystem
public AS400 getSystem()
Returns the name of the system.- Returns:
- system name
-
getPath
public java.lang.String getPath()
Returns the path to a class, jar, or zip file used to create the Java program.- Returns:
- path
-
getAdoptedAuthorityProfile
public java.lang.String getAdoptedAuthorityProfile() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the profile to use when the "Use Adopted Authority" field is set.- Returns:
- the profile to use. Possible values are:
- Throws:
AS400Exception
- If an error occurs.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.
-
getFileChangeDate
public java.util.Date getFileChangeDate() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the date and time the file was last modified or changed.- Returns:
- the last-changed date and time
- Throws:
AS400Exception
- If an error occurs.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.
-
getFileOwner
public java.lang.String getFileOwner() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the name of the owner of the file. The string is in job CCSID- Returns:
- the file owner
- Throws:
AS400Exception
- If an error occurs.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.
-
getJavaProgramCreationDate
public java.util.Date getJavaProgramCreationDate() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the date and time the Java program was created for the file.- Returns:
- the creation date
- Throws:
AS400Exception
- If an error occurs.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.
-
getJavaProgramVersion
public java.lang.String getJavaProgramVersion() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the IBM i version the Java program was created for.- Returns:
- the version
- Throws:
AS400Exception
- If an error occurs.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.
-
getNumberOfClasses
public int getNumberOfClasses() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the number of classes.- Returns:
- the number of classes.
- Throws:
AS400Exception
- If an error occurs.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.
-
getNumberOfClassesWithCurrentJavaPrograms
public int getNumberOfClassesWithCurrentJavaPrograms() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the number of classes with representations up-to-date in the attached Java programs.- Returns:
- the number of classes with current java programs.
- Throws:
AS400Exception
- If an error occurs.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.
-
getNumberOfClassesWithErrors
public int getNumberOfClassesWithErrors() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the number of classes containing errors.- Returns:
- the number of classes with errors.
- Throws:
AS400Exception
- If an error occurs.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.
-
getNumberOfClassesWithoutCurrentJavaPrograms
public int getNumberOfClassesWithoutCurrentJavaPrograms() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the number of classes with representations out-of-date.- Returns:
- the number of classes without current java programs.
- Throws:
AS400Exception
- If an error occurs.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.
-
getNumberOfAttachedPrograms
public int getNumberOfAttachedPrograms() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the number of Java prgroams attached to the .class or .jar/sip file.- Returns:
- the number of programs
- Throws:
AS400Exception
- If an error occurs.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.
-
getOptimizationLevel
public int getOptimizationLevel() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the optimization level used to create the java program.- Returns:
- the optimization level. Possible values are:
- 0
- 10
- 20
- 30
- 40
- Throws:
AS400Exception
- If an error occurs.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.
-
getPerformanceCollectionEnabledFlag
public java.lang.String getPerformanceCollectionEnabledFlag() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns whether or not performance collection is enabled.- Returns:
- the performance collection enabled flag. Possible values are:
- 0 - "NONE
- 1 - on
- Throws:
AS400Exception
- If an error occurs.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.
-
getPerformanceCollectionType
public java.lang.String getPerformanceCollectionType() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the type of performance collection if the performance collection flag is set.- Returns:
- the type of performance collection. Possible values are:
- Throws:
AS400Exception
- If an error occurs.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.
-
isUseAdoptedAuthority
public boolean isUseAdoptedAuthority() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns whether or not the used adopted authority is set.- Returns:
- true if the use adopted authority is set, false otherwise
- Throws:
AS400Exception
- If an error occurs.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.
-
getSizeOfAttachedJavaPrograms
public int getSizeOfAttachedJavaPrograms() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the size in kilobytes of all the attached java programs.- Returns:
- the size
- Throws:
AS400Exception
- If an error occurs.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.
-
getProfilingDataStatus
public java.lang.String getProfilingDataStatus() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns whether profiling data is enabled or applied.- Returns:
- whether profiling data is enabled or applied. Possible values are:
- Throws:
AS400Exception
- If an error occurs.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.
-
getLICOptions
public java.lang.String getLICOptions() throws AS400Exception, AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException
Returns the LIC options string specified when the java program was last modified.- Returns:
- the LIC options.
- Throws:
AS400Exception
- If an error occurs.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.
-
refresh
public void refresh() throws AS400Exception, AS400SecurityException, ConnectionDroppedException, ErrorCompletingRequestException, java.lang.InterruptedException, ObjectDoesNotExistException, java.io.IOException, java.io.UnsupportedEncodingException
Refreshes all the values for this PTF by retrieving them from the system.- Throws:
AS400Exception
- If an error occurs.AS400SecurityException
- If a security or authority error occurs.ConnectionDroppedException
- If the connection is dropped.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.lang.InterruptedException
- If this thread is interrupted.ObjectDoesNotExistException
- If the object does not exist.java.io.IOException
- If an error occurs while communicating with the system.java.io.UnsupportedEncodingException
- If the Character Encoding is not supported.
-
setSystem
public void setSystem(AS400 system)
Sets the name of the system to search for a Java Program.- Parameters:
system
- The system
-
setPath
public void setPath(java.lang.String path)
Sets the qualified path name to use.- Parameters:
path
- - the qualified path name.
-
-