|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.as400.access.MessageFile
The MessageFile class allows a user to get a message from an AS/400 message file. It returns an AS400Message object which contains the message. The calling program can optionally supply substitution text for the message.
MessageFile will optionally format the message's associated help text. Three options are available for help text formatting:
For example, to retrieve and print a message:
AS400 system = new AS400("mysystem.mycompany.com"); MessageFile messageFile = new MessageFile(system); messageFile.setPath("/QSYS.LIB/QCPFMSG.MSGF"); AS400Message message = messageFile.getMessage("CPD0170"); System.out.println(message.getText());
AS400Message
,
CommandCall
,
ProgramCall
,
QSYSObjectPathName
, Serialized FormField Summary | |
static int |
NO_FORMATTING
Constant indicating help text should not be formatted. |
static int |
RETURN_FORMATTING_CHARACTERS
Constant indicating formatting characters are left in the help text. |
static int |
SUBSTITUTE_FORMATTING_CHARACTERS
Constant indicating MessageFile should replace formatting characters with newline and space characters. |
Constructor Summary | |
MessageFile()
Constructs a MessageFile object. |
|
MessageFile(AS400 system)
Constructs a MessageFile object. |
|
MessageFile(AS400 system,
java.lang.String path)
Constructs a message file object. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener. |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds a VetoableChangeListener. |
int |
getHelpTextFormatting()
Returns the status of help text formatting. |
AS400Message |
getMessage(java.lang.String ID)
Returns an AS400Message object containing the object. |
AS400Message |
getMessage(java.lang.String ID,
byte[] substitutionText)
Returns an AS400Message object containing the message. |
AS400Message |
getMessage(java.lang.String ID,
byte[] substitutionText,
int type)
Returns an AS400Message object containing the message. |
AS400Message |
getMessage(java.lang.String ID,
int type)
Returns an AS400Message object containing the object. |
AS400Message |
getMessage(java.lang.String ID,
java.lang.String substitutionText)
Returns an AS400Message object containing the message. |
AS400Message |
getMessage(java.lang.String ID,
java.lang.String substitutionText,
int type)
Returns an AS400Message object containing the message. |
java.lang.String |
getPath()
Returns the integrated file system pathname for the message file. |
AS400 |
getSystem()
Returns the AS/400 which contains the message file. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes this PropertyChangeListener from the internal list. |
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes this VetoableChangeListener from the internal list. |
void |
setHelpTextFormatting(int value)
Sets the help text formatting value. |
void |
setPath(java.lang.String path)
Sets the message file name. |
void |
setSystem(AS400 system)
Sets the AS/400 which contains the message file. |
static java.lang.String |
substituteFormattingCharacters(java.lang.String sourceText)
Substitutes formatting characters with appropriate new line and indent characters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NO_FORMATTING
public static final int RETURN_FORMATTING_CHARACTERS
public static final int SUBSTITUTE_FORMATTING_CHARACTERS
Constructor Detail |
public MessageFile()
public MessageFile(AS400 system)
system
- The AS/400 which contains the message file.public MessageFile(AS400 system, java.lang.String path)
system
- The AS/400 which contains the message filepath
- The integrated file system pathname for the message file.
That is, the message file name as a fully qualified path name
in the library file system.
The library and message file name must each be
10 characters or less. The extension for message files is .msgf.
For example, /QSYS.LIB/MYLIB.LIB/MSGFILE.MSGF.Method Detail |
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The VetoableChangeListener.removeVetoableChangeListener(java.beans.VetoableChangeListener)
public static java.lang.String substituteFormattingCharacters(java.lang.String sourceText)
sourceText
- The source text.public int getHelpTextFormatting()
public java.lang.String getPath()
public AS400Message getMessage(java.lang.String ID) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, java.beans.PropertyVetoException
ID
- The message identifier.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 AS/400.java.beans.PropertyVetoException
- If a change is vetoed.ObjectDoesNotExistException
- If the AS/400 object does not exist.public AS400Message getMessage(java.lang.String ID, int type) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, java.beans.PropertyVetoException
ID
- The message identifier.type
- The bidi message string type, as defined by the CDRA (Character
Data Representataion Architecture). See
BidiStringType for more information and valid values.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 AS/400.java.beans.PropertyVetoException
- If a change is vetoed.ObjectDoesNotExistException
- If the AS/400 object does not exist.public AS400Message getMessage(java.lang.String ID, java.lang.String substitutionText) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, java.beans.PropertyVetoException
For example, using AS/400 command DSPMSGD, we see the format of the substitution text for message CPD0170 is char 4, char 10, char 10. Passing string
"12 abcd xyz"as the substitution text on this call means "12" will be substituted for &1, "abcd" will be substituted for &2, and "xyz" will be substituted for &3.
ID
- The message identifier.substitutionText
- The substitution text.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 AS/400.java.beans.PropertyVetoException
- If a change is vetoed.ObjectDoesNotExistException
- If the AS/400 object does not exist.public AS400Message getMessage(java.lang.String ID, java.lang.String substitutionText, int type) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, java.beans.PropertyVetoException
For example, using AS/400 command DSPMSGD, we see the format of the substitution text for message CPD0170 is char 4, char 10, char 10. Passing string
"12 abcd xyz"as the substitution text on this call means "12" will be substituted for &1, "abcd" will be substituted for &2, and "xyz" will be substituted for &3.
ID
- The message identifier.substitutionText
- The substitution text.type
- The bidi message string type, as defined by the CDRA (Character
Data Representataion Architecture). See
BidiStringType for more information and valid values.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 AS/400.java.beans.PropertyVetoException
- If a change is vetoed.ObjectDoesNotExistException
- If the AS/400 object does not exist.public AS400Message getMessage(java.lang.String ID, byte[] substitutionText) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, java.beans.PropertyVetoException
ID
- The message identifier.substitutionText
- The substitution text.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 AS/400.java.beans.PropertyVetoException
- If a change is vetoed.ObjectDoesNotExistException
- If the AS/400 object does not exist.public AS400Message getMessage(java.lang.String ID, byte[] substitutionText, int type) throws AS400SecurityException, ErrorCompletingRequestException, java.lang.InterruptedException, java.io.IOException, ObjectDoesNotExistException, java.beans.PropertyVetoException
ID
- The message identifier.substitutionText
- The substitution text.type
- The bidi message string type, as defined by the CDRA (Character
Data Representataion Architecture). See
BidiStringType for more information and valid values.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 AS/400.java.beans.PropertyVetoException
- If a change is vetoed.ObjectDoesNotExistException
- If the AS/400 object does not exist.public AS400 getSystem()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The VetoableChangeListener.addVetoableChangeListener(java.beans.VetoableChangeListener)
public void setHelpTextFormatting(int value) throws java.beans.PropertyVetoException
value
- The help text formatting value.java.beans.PropertyVetoException
- If a change is vetoed.public void setPath(java.lang.String path) throws java.beans.PropertyVetoException
path
- The integrated file system pathname for the message file.
That is, the message file name as a fully qualified path name
in the library file system.
The library and file name must each be
10 characters or less. The extension for message files is .msgf.
For example, /QSYS.LIB/MyLib.LIB/MyFile.MSGF.java.beans.PropertyVetoException
- If a change is vetoed.public void setSystem(AS400 system) throws ExtendedIllegalStateException, java.beans.PropertyVetoException
system
- The AS/400 which contains the message file.java.beans.PropertyVetoException
- If a change is vetoed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |