|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.midlet.MIDlet | +--examples.midp.exampleapp.textapp.MidpClient
This is the MIDP client controller for the text app. It is designed to work as a MIDlet and cannot be run from the commandline (use Client.java for that).
The client is required to register with the registration server before it can send messages to the gateway. This is done by the registerWithCentral() function located in the AppModel class.
The MIDP controller works as follows:
If the registry of a previous queue manager is still present in the record store,
load the queue manager's details from that and start running without bothering
to register (since the client must have registered before for the registry to
be there).
If no signs of a previous QM are visible, the user is prompted for a name for the
new queue manager. Once they have chosen a name, the client registers with the
reg server.
The following jad properties are available:
App_Registration_ServerIP The IP address of the registration server App_Gateway_ServerIP The IP address of the gateway server
Field Summary | |
static short[] |
version
|
Constructor Summary | |
MidpClient()
|
Method Summary | |
protected void |
addNewQM(java.lang.String name)
adds a new recordstore to the device containing the name of the queue manager this can be used of the app is restarted to keep the same qm name. |
protected void |
attachButtons(javax.microedition.lcdui.Displayable screen,
javax.microedition.lcdui.Command[] commands)
Attaches buttons to a given screen. |
protected void |
changeDisplay(javax.microedition.lcdui.Screen newDisplay)
Changes the display to the given screen. |
protected void |
clearMessage()
Clears the messagebox that is used by the user to enter messages. |
void |
commandAction(javax.microedition.lcdui.Command c,
javax.microedition.lcdui.Displayable d)
See CommandListener#commandAction method for more details. |
void |
deleteQueueManager()
Completely removes the queue manager from the system. |
void |
destroyApp(boolean arg0)
See javax.microedition.midlet.MIDlet#destroyApp for more details. |
void |
displayStatus(java.lang.String msg)
If the controller is initializing, use the initialScreen to display the message, otherwise use the statusbar. |
java.lang.String |
getQMname()
This will search the record store for signs of a previous queue manager. |
protected void |
initialize(java.lang.String localQMname)
Initializes the view. |
protected void |
initializeMainScreen()
Initializes the main screen - this involves creating a new form and adding the 2 components: message - a text field so the user can enter a message to send. |
void |
pauseApp()
There's nothing to pause. |
void |
promptFor(java.lang.String title,
java.lang.String stringDefault)
Due to the way MIDP works, the user will hit the ok button on the screen at which point commandAction will be called and initialization will continue. |
protected void |
setPumpProperties()
|
protected void |
showStatus()
Displays a status report to the user. |
protected void |
start()
This is the first thing run when the midlet is started. |
void |
startApp()
See javax.microedition.midlet.MIDlet#startApp for more details. |
void |
stop()
Stops the controller and all constituent parts - in this case, the model. |
Methods inherited from class javax.microedition.midlet.MIDlet |
getAppProperty, notifyDestroyed, notifyPaused, resumeRequest |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static short[] version
Constructor Detail |
public MidpClient()
Method Detail |
public void startApp() throws javax.microedition.midlet.MIDletStateChangeException
startApp
in class javax.microedition.midlet.MIDlet
javax.microedition.midlet.MIDletStateChangeException
protected void attachButtons(javax.microedition.lcdui.Displayable screen, javax.microedition.lcdui.Command[] commands)
screen
- The screen to attach the buttons tocommands
- An array of buttons to attach to the screen
protected void setPumpProperties()
protected void start()
When the user hits the OK button, commandAction() is notified and will continue the initialization.
If a previous queue manager did exist, the name is retrieved from the record store and initialization is started.
protected void initializeMainScreen()
Buttons are also attached to the form.
protected void initialize(java.lang.String localQMname)
localQMname
- The name of the queue manager
public void deleteQueueManager()
This will of course mean that if you have both the textapp and the message pump in the same MIDlet suite, wiping one queue manager will also remove the other.
public void stop() throws java.lang.Exception
java.lang.Exception
public void pauseApp()
See javax.microedition.midlet.MIDlet#pauseApp for more details.
pauseApp
in class javax.microedition.midlet.MIDlet
public void destroyApp(boolean arg0) throws javax.microedition.midlet.MIDletStateChangeException
destroyApp
in class javax.microedition.midlet.MIDlet
javax.microedition.midlet.MIDletStateChangeException
public void promptFor(java.lang.String title, java.lang.String stringDefault)
title
- The title of the promptstringDefault
- The default string to display
protected void changeDisplay(javax.microedition.lcdui.Screen newDisplay)
newDisplay
- The screen to display
public void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
commandAction
in interface javax.microedition.lcdui.CommandListener
protected void addNewQM(java.lang.String name)
name
- The name of the queue manager
protected void showStatus()
protected void clearMessage()
public java.lang.String getQMname()
getQMname
in interface AppController
AppController.getQMname()
public void displayStatus(java.lang.String msg)
displayStatus
in interface AppController
msg
- The message to be displayed
AppController.displayStatus(java.lang.String)
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |