Hi all...
Im currently learning all about jboss and
EJBs, and I have started to develop an EJB to generate SesssionBean
template code.
I was wondering if it would be worth running
this on the jboss site to enable developers to get a good starting point
for ejb development.
(hit a jsp page, fill out bean name and
package etc, press the go button, hey presto the bean ;-)
If people think this is a good idea then I
will continue with this little project, adding support for Entity beans
etc.
I know there is another site that does a
similar thing, but I dont think it is open source...
example output... (rough and ready at the
moment)
++++++++++++++++++ Remote interface
++++++++++++++++++
/*
*
BannanaSession.java
*
* Wednesday, November 8,
2000
*
* Copyright (c) 2000 by Contact Point
Technologies, Inc.
* All rights
reserved.
*
* Legal notice goes
here
*/
package com.cpt.bannana;
import javax.ejb.EJBObject;
import
javax.ejb.EJBHome;
import javax.ejb.Handle;
import
java.rmi.RemoteException;
public interface BannanaSession extends
EJBObject, BannanaSessionBusinessInterface {
}
+++++++++++++++++++++++ The BEAN
+++++++++++++++++++++
/*
*
BannanaSessionBean.java
*
* Wednesday, November 8,
2000
*
* Copyright (c) 2000 by Contact Point
Technologies, Inc.
* All rights
reserved.
*
* Legal notice goes
here
*
*/
package com.cpt.bannana;
import javax.ejb.*;
import
javax.naming.*;
import java.rmi.RemoteException;
import
javax.rmi.PortableRemoteObject;
import java.security.*;
import com.cpt.util.ByteUtils;
public class BannanaSessionBean implements
SessionBean, BannanaSessionBusinessInterface {
private static final
boolean VERBOSE = true; // set to false for
release....
private SessionContext ctx;
public void ejbActivate()
throws javax.ejb.EJBException, java.rmi.RemoteException
{
}
public void ejbPassivate()
throws javax.ejb.EJBException, java.rmi.RemoteException
{
}
public void ejbRemove()
throws javax.ejb.EJBException, java.rmi.RemoteException
{
}
public void
setSessionContext(SessionContext ctx) throws javax.ejb.EJBException,
java.rmi.RemoteException {
this.ctx = ctx;
}
public void
ejbCreate() throws CreateException
{
if ( VERBOSE )
System.out.println("in BannanaSessionBean.ejbCreate "
);
}
////////////////////////////////////////////////////////////
//// BUSINESS FUNCTIONS
////////////////////////////////////////////////////////////
/** todo business
functions go here */
public String
someFunction() throws RemoteException {
}
}
++++++++++++++++ Business interface
++++++++++++++
/*
*
LicenceKeyGenSessionBusinessInterface.java
*
*
Wednesday, November 8, 2000
*
* Copyright (c) 2000 by
Contact Point Technologies, Inc.
* All rights
reserved.
*
* Legal notice goes
here
*/
package com.cpt.bannana;
import java.rmi.RemoteException;
public interface
BannanaSessionBusinessInterface {
public String
someFunction() throws RemoteException;
}
+++++++++ The home interface
++++++++
/*
*
BannanaSessionHome.java
*
* Wednesday, November 8,
2000
*
* Copyright (c) 2000 by Contact Point
Technologies, Inc.
* All rights
reserved.
*
*
*/
package
com.cpt.bannana;
import javax.ejb.EJBHome;
import
javax.ejb.EJBMetaData;
import javax.ejb.HomeHandle;
import
javax.ejb.Handle;
import javax.ejb.CreateException;
import
java.rmi.RemoteException;
public interface BannanaSessionHome extends
EJBHome {
BannanaSession create() throws
RemoteException, CreateException;
}