dblevins 2004/04/13 14:13:16
Modified: modules/core/src/java/org/openejb/proxy EJBProxyFactory.java
Added: modules/core/src/java/org/openejb/proxy SessionEJBHome.java
SessionEJBLocalHome.java
Removed: modules/core/src/java/org/openejb/proxy StatefulEJBHome.java
StatefulEJBLocalHome.java StatelessEJBHome.java
StatelessEJBLocalHome.java
Log:
Stateful and stateless home proxies can share a base EJBHome type.
Though it is nice to have separate base classes, this way allows us to
create EJBHome proxies for session beans without knowing what kind of
session bean it is.
Revision Changes Path
1.5 +3 -3
openejb/modules/core/src/java/org/openejb/proxy/EJBProxyFactory.java
Index: EJBProxyFactory.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/proxy/EJBProxyFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EJBProxyFactory.java 12 Apr 2004 08:31:41 -0000 1.4
+++ EJBProxyFactory.java 13 Apr 2004 18:13:16 -0000 1.5
@@ -62,8 +62,8 @@
public class EJBProxyFactory implements Serializable {
private static final Class[][] baseClasses = new Class[][]{
- {StatefulEJBObject.class, StatefulEJBHome.class,
StatefulEJBLocalObject.class, StatefulEJBLocalHome.class}, // STATEFUL
- {StatelessEJBObject.class, StatelessEJBHome.class,
StatelessEJBLocalObject.class, StatelessEJBLocalHome.class}, // STATELESS
+ {StatefulEJBObject.class, SessionEJBHome.class,
StatefulEJBLocalObject.class, SessionEJBLocalHome.class}, // STATEFUL
+ {StatelessEJBObject.class, SessionEJBHome.class,
StatelessEJBLocalObject.class, SessionEJBLocalHome.class}, // STATELESS
{EntityEJBObject.class, EntityEJBHome.class, EntityEJBLocalObject.class,
EntityEJBLocalHome.class}, // BMP_ENTITY
{EntityEJBObject.class, EntityEJBHome.class, EntityEJBLocalObject.class,
EntityEJBLocalHome.class}, // CMP_ENTITY
};
1.1
openejb/modules/core/src/java/org/openejb/proxy/SessionEJBHome.java
Index: SessionEJBHome.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: SessionEJBHome.java,v 1.1 2004/04/13 18:13:16 dblevins Exp $
*/
package org.openejb.proxy;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import javax.ejb.Handle;
import javax.ejb.RemoveException;
/**
*
*/
public abstract class SessionEJBHome extends EJBHomeImpl{
public SessionEJBHome(EJBMethodInterceptor handler) {
super(handler);
}
public void remove(Handle handle) throws RemoteException, RemoveException {
if (getEJBMetaData().isStatelessSession()){
if (handle == null) {
throw new RemoveException("Handle is null");
}
Class remoteInterface = ejbHandler.getProxyInfo().getRemoteInterface();
if (!remoteInterface.isInstance(handle.getEJBObject())) {
throw new RemoteException("Handle does not hold a " +
remoteInterface.getName());
}
} else {
EJBObject ejbObject = handle.getEJBObject();
ejbObject.remove();
}
}
public void remove(Object primaryKey) throws RemoteException, RemoveException {
throw new RemoveException("Session objects are private resources and do not
have primary keys");
}
}
1.1
openejb/modules/core/src/java/org/openejb/proxy/SessionEJBLocalHome.java
Index: SessionEJBLocalHome.java
===================================================================
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "OpenEJB" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of The OpenEJB Group. For written permission,
* please contact [EMAIL PROTECTED]
*
* 4. Products derived from this Software may not be called "OpenEJB"
* nor may "OpenEJB" appear in their names without prior written
* permission of The OpenEJB Group. OpenEJB is a registered
* trademark of The OpenEJB Group.
*
* 5. Due credit should be given to the OpenEJB Project
* (http://openejb.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
*
* $Id: SessionEJBLocalHome.java,v 1.1 2004/04/13 18:13:16 dblevins Exp $
*/
package org.openejb.proxy;
import javax.ejb.EJBException;
import javax.ejb.RemoveException;
/**
*
*/
public abstract class SessionEJBLocalHome extends EJBLocalHomeImpl {
public SessionEJBLocalHome(EJBMethodInterceptor handler) {
super(handler);
}
public void remove(Object primaryKey) throws RemoveException, EJBException {
throw new RemoveException("Session objects are private resources and do not
have primary keys");
}
}