Java Reference
In-Depth Information
import java.rmi.*;
import jmxbook.ch3.RMIClientFactory;
import com.sun.jdmk.comm.*;
public class UserInfoBean implements EntityBean
{
private EntityContext ctx = null;
private String userName = null;
private int count=0;
private boolean loginIsAllowed=true;
public int getNumberOfLogins(){
System.out.println("Return Number Of Queries:"+count);
return count;
}
Retrieve
login
count
public boolean login()throws RemoteException{
if(!loginIsAllowed) {
System.out.println("User does not have "
+ "permissions to login");
return false;
}
this.count++;
System.out.println("User has successfully logged in");
return true;
}
Increase
login
count
public void logout()throws RemoteException{
System.out.println("User has successfully logged out");
}
Disable
or enable
user's
account
public void setLoginAllowed(boolean isAllowed){
this.loginIsAllowed=isAllowed;
System.out.println("Setting login isAllowed:"+loginIsAllowed);
}
public void ejbLoad(){
System.out.println("EJBLoad::Loading New UserInfo Bean:");
}
public void ejbStore(){
System.out.println("EJBStore::Storing UserInfo Bean:"+userName);
}
public String ejbCreate( String userName ) throws CreateException{
System.out.println("EJBCreate::Creating New UserInfo"
+ " Bean for:"+userName);
return userName;
}
public void ejbPostCreate( String userName)
{
System.out.println( "Post create called" );
}
Search WWH ::




Custom Search