xdoclet can't generate classes for the following bean.
but if i delete content of the dispatch method, then xdoclet works well.
who can tell me what's the problem?
/**
*
* @ejb.bean name="MessageDispatcher"
* jndi-name="MessageDispatcherBean"
* local-jndi-name="LocalMessageDispatcherBean"
* type="Stateless"
*
* @ejb.ejb-ref
* ejb-name="UserManager"
* view-type="local"
* ref-name="ejb/UserManagerLocal"
**/
public abstract class MessageDispatcherBean implements SessionBean {
/**
* @ejb.interface-method
* view-type="local"
**/
public void dispatch(String message){
try {
String[] items = MessageHelper.parseMessage(message);
//get message head
int msgid = Integer.parseInt(items[0]);
int userid = Integer.parseInt(items[1]);
int sessionid = Integer.parseInt(items[2]);
long localUserId = Long.parseLong(items[3]);
//get message body
String[] body = null;
if (items.length > 4) {
body = new String[items.length-4];
System.arraycopy(items,4,body,0,body.length);
}
UserManagerLocalHome umLocalHome = UserManagerUtil.getLocalHome();
UserManagerLocal um = umLocalHome.create();
if (msgid != UserAuthMessageHelper.USER_LOGIN_REQ) {
if (!um.validate(userid,sessionid,localUserId)) {
System.out.println("invalid user: id="+userid+", sessionid="+sessionid+
", localUserId="+localUserId);
return;
}
}
switch (msgid) {
case UserAuthMessageHelper.USER_LOGIN_REQ:
String account = MessageHelper.stringDecode(body[0]);
String password = MessageHelper.stringDecode(body[1]);
String custName = MessageHelper.stringDecode(body[2]);
um.login(localUserId,account,password,custName);
break;
case UserAuthMessageHelper.USER_LOGOUT_NOTICE:
um.logout(userid,localUserId);
break;
default:
System.out.println("unknown message: "+message);
}
} catch (CreateException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
-
xdoclet can't generate classes (4 messages)
- Posted by: normal wang
- Posted on: October 22 2003 03:11 EDT
Threaded Messages (4)
- xdoclet can't generate classes by ashish verma on October 22 2003 07:41 EDT
- xdoclet can't generate classes by normal wang on October 23 2003 05:01 EDT
-
xdoclet can't generate classes by ashish verma on October 23 2003 07:13 EDT
- xdoclet can't generate classes by normal wang on October 26 2003 08:36 EST
-
xdoclet can't generate classes by ashish verma on October 23 2003 07:13 EDT
- xdoclet can't generate classes by normal wang on October 23 2003 05:01 EDT
-
xdoclet can't generate classes[ Go to top ]
- Posted by: ashish verma
- Posted on: October 22 2003 07:41 EDT
- in response to normal wang
Have a look at this chapter.
http://www.tusc.com.au/tutorial/html/chap3.html
Vishal(Co-Author of this tutorial.) -
xdoclet can't generate classes[ Go to top ]
- Posted by: normal wang
- Posted on: October 23 2003 05:01 EDT
- in response to ashish verma
I have read the article, but I still don't know what is the problem with my program. -
xdoclet can't generate classes[ Go to top ]
- Posted by: ashish verma
- Posted on: October 23 2003 07:13 EDT
- in response to normal wang
The reason u get yr interface-mehod (Business method) works fine when u delete the contents, beacuse xdoclet generates the neccessry classes for u using recommnded dedign patterns, and in that manner it forces u to use these patterns which really helps yr application to be structured in a very robust way.
As yr buiness method wil be overrideen in the genarated class, and roughy speaking if u have to write that much lines of code in business method, then u defintely need to restucure yr bean and use different paterns to implement that.
You might want to read some J2EE patterns and then probably restuucture yr buines method.
As Xdoclet is all about reducing the no of lines of code a developer has to write and then not worrying about syncronising the deployment descriptors during the development life cycle.
I hope this helps.
Vishal. -
xdoclet can't generate classes[ Go to top ]
- Posted by: normal wang
- Posted on: October 26 2003 20:36 EST
- in response to ashish verma
Should I assign most responsibilities to non-ejb objects and call them in the business methods of ejb?