|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openpermis.examples.ejb.client.HelloWorldClient
public class HelloWorldClient
Java client that prompts the user for a name and executes the hello world service.
The client uses the configured naming context and tries to access the hello world service from the EJB name passed on the command line. (The name at which the EJB is registered at the naming context usually corresponds to the EAR name when deploying to a EJB3 container.)
The intresting part of this example, namely the call to the EJB is perfomed in method
execute(String)
. The rest of this client deals with a simple user interface.
execute(String)
Field Summary | |
---|---|
private static String |
SERVICE
The service context location. |
private String |
serviceName
The context location of the HelloWorldServiceRemote . |
private static String[] |
USER_CHOICES
The users offered at the chooser. |
Constructor Summary | |
---|---|
HelloWorldClient(String serviceName)
Creates a new hello world client that connects to the specified service. |
Method Summary | |
---|---|
private String |
chooseUser()
Displays a prompt to choose a user for the hello world service. |
private void |
execute(String user)
Retrieves the hello message for the specified user. |
private HelloWorldServiceRemote |
getHelloWorldService()
Performs a lookup of the hello world service. |
static void |
main(String[] args)
Starts the hello world EJB client. |
void |
run()
Starts the hello world EJB client. |
private void |
showMessage(String message,
boolean error)
Displays a message box. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final String SERVICE
"/HelloWorldService/remote"
execute(String)
,
Constant Field Valuesprivate static final String[] USER_CHOICES
private final String serviceName
HelloWorldServiceRemote
.
Constructor Detail |
---|
public HelloWorldClient(String serviceName)
serviceName
- the context location of the HelloWorldServiceRemote
.Method Detail |
---|
public static void main(String[] args)
Pass the name of the EJB as the first argument to the client.
args
- the application arguments containing the EJB name as the first argument.run()
private void showMessage(String message, boolean error)
message
- the message to display.error
- true
if the message to display is an error message.private String chooseUser()
null
if aborted.private HelloWorldServiceRemote getHelloWorldService() throws NamingException
NamingException
- if the service lookup fails.private void execute(String user)
user
- the user name to pass to the hello world service.public void run()
Prompts for a user name and executes the hello world service.
run
in interface Runnable
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:07:15
Copyright (c) 2002-2007 Ergon Informatik AG