dain 2004/04/15 22:34:05
Modified: modules/core/src/java/org/openejb/assembler
AssemblerTool.java ContainerBuilder.java
CoreDeploymentInfo.java DeploymentInfo.java
Log:
Changed container id to a String
Simplified requirements to create an EJBProxyFactory
EJBProxyFactory is now constructed in the GenericEJBContainer constructor
Change ProxyRefAddress to store the class names instead of a proxy info
object; this allows the construction of an ejb-ref without knowing the
container type
Merged stateless and stateful object base classes into a single class,
which simplifies proxy construction
Revision Changes Path
1.2 +7 -17
openejb/modules/core/src/java/org/openejb/assembler/AssemblerTool.java
Index: AssemblerTool.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/assembler/AssemblerTool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AssemblerTool.java 1 Mar 2004 07:14:42 -0000 1.1
+++ AssemblerTool.java 16 Apr 2004 02:34:05 -0000 1.2
@@ -54,6 +54,7 @@
import java.util.Vector;
import javax.naming.InitialContext;
+import javax.naming.Context;
import javax.resource.spi.ConnectionManager;
import javax.resource.spi.ManagedConnectionFactory;
@@ -109,15 +110,12 @@
* are constructed using the assembleContainer() method. Once constructed
* the container and its deployments are added to the container system.
*
- * Assembles and returns a [EMAIL PROTECTED] ContainerManager} for the [EMAIL
PROTECTED] ContainerSystem} using the
+ * Assembles and returns a for the [EMAIL PROTECTED] ContainerSystem} using the
* information from the [EMAIL PROTECTED] ContainerManagerInfo} object passed
in.
*
* @param containerSystem the system to which the container should be added.
* @param containerSystemInfo defines the contain system,its containers, and
deployments.
- * @return
- * @exception throws Exception if there was a problem constructing the
ContainerManager.
- * @exception Exception
- * @see org.openejb.core.ContainerManager
+ * @throws Exception if there was a problem constructing the ContainerManager.
* @see org.openejb.assembler.ContainerSystem
* @see ContainerManagerInfo
*/
@@ -159,7 +157,6 @@
* @param containerInfo describes a Container and its deployments.
* @return the Container that was constructed (StatefulContainer,
StatelessContainer, EntityContainer)
* @see org.openejb.assembler.ContainerInfo
- * @see org.openejb.assembler.Assembler.assembleDeploymentInfo();
*/
public org.openejb.assembler.Container assembleContainer(ContainerInfo
containerInfo)
throws org.openejb.OpenEJBException{
@@ -231,7 +228,6 @@
* applyMethodPermissions(), applySecurityRoleReferences() and
applyTransactionAttributes()
*
* @param beanInfo describes the enterprise bean deployment to be assembled.
- * @param the DeploymentInfo object that was assembled from the beanInfo
configuration.
*/
public CoreDeploymentInfo assembleDeploymentInfo(EnterpriseBeanInfo beanInfo)
throws org.openejb.SystemException, org.openejb.OpenEJBException {
@@ -291,7 +287,7 @@
/*[3] Populate a new DeploymentInfo object */
IvmContext root = new IvmContext("comp");
- org.openejb.assembler.CoreDeploymentInfo deployment =
createDeploymentInfoObject(root, beanInfo.ejbDeploymentId, home, remote, ejbClass,
ejbPk, componentType);
+ CoreDeploymentInfo deployment = createDeploymentInfoObject(root,
beanInfo.ejbDeploymentId, home, remote, ejbClass, ejbPk, componentType);
/*[3.1] Add Entity bean specific values */
if ( isEntity ) {
@@ -373,8 +369,8 @@
* this method to hook in its own DeploymentInfo subclass without duplicating
* code.
*/
- protected org.openejb.assembler.CoreDeploymentInfo
createDeploymentInfoObject(javax.naming.Context root, Object did, Class homeClass,
Class remoteClass, Class beanClass, Class pkClass, byte componentType) throws
org.openejb.SystemException {
- org.openejb.assembler.CoreDeploymentInfo info = new
org.openejb.assembler.CoreDeploymentInfo(did, homeClass, remoteClass, beanClass,
pkClass, componentType);
+ protected CoreDeploymentInfo createDeploymentInfoObject(Context root, String
did, Class homeClass, Class remoteClass, Class beanClass, Class pkClass, byte
componentType) throws org.openejb.SystemException {
+ CoreDeploymentInfo info = new CoreDeploymentInfo(did, homeClass,
remoteClass, beanClass, pkClass, componentType);
info.setJndiEnc(root);
return info;
}
@@ -498,7 +494,6 @@
* should be processed before anything else is done in the deployment process.
*
* @param ivmInfo the IntraVmServerInfo configuration object that describes the
ProxyFactory
- * @return void
* @see org.openejb.assembler.IntraVmServerInfo
*/
public void applyProxyFactory(IntraVmServerInfo ivmInfo) throws
OpenEJBException{
@@ -541,9 +536,7 @@
* See page 251 EJB 1.1 for an explanation of the method attribute.
*
* @param deploymentInfo the deployment to which the transaction attributes are
applied
- * @param MethodTransactionInfo describes the transaction attributes for the
enterprise bean(s)
* @see org.openejb.assembler.MethodTransactionInfo
- * @see org.openejb.core.CoreDeploymentInfo.setMethodTransactionAttribute()
*/
public void applyTransactionAttributes(CoreDeploymentInfo deploymentInfo,
MethodTransactionInfo [] mtis){
/*TODO: Add better exception handling. This method doesn't throws any
exceptions!!
@@ -601,7 +594,6 @@
* @param roleMapping the RoleMapping object which contains the logical to
physical security roles.
* @see org.openejb.assembler.EnterpriseBeanInfo
* @see org.openejb.assembler.AssemblerTool.RoleMapping
- * @see org.openejb.core.DepoymentInfo.addSecurityRoleReference()
*/
public void applySecurityRoleReference(CoreDeploymentInfo deployment,
EnterpriseBeanInfo beanInfo, AssemblerTool.RoleMapping roleMapping){
if(beanInfo.securityRoleReferences != null){
@@ -625,7 +617,6 @@
* @param deployment the DeploymentInfo object to which the Method Permissions
should be applied.
* @param permissions the Method Permission to be applied to the deployment.
* @see org.openejb.assembler.MethodPermissionInfo
- * @see org.openejb.core.CoreDeploymentInfo.appendMethodPermissions()
*/
public void applyMethodPermissions(CoreDeploymentInfo deployment,
MethodPermissionInfo [] permissions){
/*TODO: Add better exception handling. This method doesn't throws any
exceptions!!
@@ -667,7 +658,6 @@
* @param roleMapping the encapsulation of logical roles and their corresponding
physical role mappings.
* @see org.openejb.assembler.MethodPermissionInfo
* @see org.openejb.assembler.AssemblerTool.RoleMapping
- * @see org.openejb.core.CoreDeploymentInfo.appendMethodPermissions()
*/
public void applyMethodPermissions(CoreDeploymentInfo deployment,
MethodPermissionInfo [] permissions, AssemblerTool.RoleMapping roleMapping){
/*TODO: Add better exception handling. This method doesn't throws any
exceptions!!
1.7 +2 -2
openejb/modules/core/src/java/org/openejb/assembler/ContainerBuilder.java
Index: ContainerBuilder.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/assembler/ContainerBuilder.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ContainerBuilder.java 9 Apr 2004 19:04:00 -0000 1.6
+++ ContainerBuilder.java 16 Apr 2004 02:34:05 -0000 1.7
@@ -226,7 +226,7 @@
return deploymentInfo.getContainer();
}
- public Object getDeploymentID() {
+ public String getDeploymentID() {
return deploymentInfo.getDeploymentID();
}
1.2 +56 -59
openejb/modules/core/src/java/org/openejb/assembler/CoreDeploymentInfo.java
Index: CoreDeploymentInfo.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/assembler/CoreDeploymentInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CoreDeploymentInfo.java 1 Mar 2004 07:14:42 -0000 1.1
+++ CoreDeploymentInfo.java 16 Apr 2004 02:34:05 -0000 1.2
@@ -46,47 +46,42 @@
import java.lang.reflect.Method;
import java.util.HashMap;
-import java.util.HashSet;
-
-import javax.ejb.EJBContext;
import javax.ejb.EJBHome;
import javax.naming.Context;
-import org.openejb.*;
-
/**
- * Contains all the information needed by the container for a particular
- * deployment. Some of this information is generic, but this class is
+ * Contains all the information needed by the container for a particular
+ * deployment. Some of this information is generic, but this class is
* largely becoming a dumping ground for information specific to individual
* containers. This class should be abstracted and subclassed in the individual
* container packages. The container should be required to provide its own
DeploymentInfo
* implementation, possibly returning it to the assembler and OpenEJB in general
via a
* new accessor method.
- *
+ *
* @version $Revision$ $Date$
*/
-public class CoreDeploymentInfo implements org.openejb.assembler.DeploymentInfo{
+public class CoreDeploymentInfo implements org.openejb.assembler.DeploymentInfo {
+
+ private final String deploymentId;
+ private final Class homeInterface;
+ private final Class remoteInterface;
+ private final Class beanClass;
+ private final Class pkClass;
+ private final byte componentType;
+
+ private final HashMap methodTransactionAttributes = new HashMap();
- private final Object deploymentId;
- private final Class homeInterface;
- private final Class remoteInterface;
- private final Class beanClass;
- private final Class pkClass;
- private final byte componentType;
-
- private final HashMap methodTransactionAttributes = new HashMap();
-
- private boolean isBeanManagedTransaction;
- private boolean isReentrant;
+ private boolean isBeanManagedTransaction;
+ private boolean isReentrant;
private Container container;
- private Context jndiContextRoot;
+ private Context jndiContextRoot;
-
- public CoreDeploymentInfo( ){
- this(null, null, null, null, null, (byte)0);
+
+ public CoreDeploymentInfo() {
+ this(null, null, null, null, null, (byte) 0);
}
- public CoreDeploymentInfo(Object did, Class homeClass, Class remoteClass, Class
beanClass, Class pkClass, byte componentType){
+ public CoreDeploymentInfo(String did, Class homeClass, Class remoteClass, Class
beanClass, Class pkClass, byte componentType) {
this.deploymentId = did;
this.homeInterface = homeClass;
this.remoteInterface = remoteClass;
@@ -95,47 +90,47 @@
this.pkClass = pkClass;
}
- public void setContainer(Container cont){
+ public void setContainer(Container cont) {
container = cont;
}
- public int getComponentType( ){
+ public int getComponentType() {
return componentType;
}
- public byte getTransactionAttribute(Method method){
- Byte byteWrapper = (Byte)methodTransactionAttributes.get(method);
- if(byteWrapper==null)
+ public byte getTransactionAttribute(Method method) {
+ Byte byteWrapper = (Byte) methodTransactionAttributes.get(method);
+ if (byteWrapper == null)
return TX_NOT_SUPPORTED;// non remote or home interface method
else
return byteWrapper.byteValue();
}
- public Container getContainer( ){
+ public Container getContainer() {
return container;
}
- public Object getDeploymentID( ){
+ public String getDeploymentID() {
return deploymentId;
}
- public boolean isBeanManagedTransaction(){
+ public boolean isBeanManagedTransaction() {
return isBeanManagedTransaction;
}
- public Class getHomeInterface(){
+ public Class getHomeInterface() {
return homeInterface;
}
- public Class getRemoteInterface(){
+ public Class getRemoteInterface() {
return remoteInterface;
}
- public Class getBeanClass(){
+ public Class getBeanClass() {
return beanClass;
}
- public Class getPrimaryKeyClass(){
+ public Class getPrimaryKeyClass() {
return pkClass;
}
@@ -148,53 +143,55 @@
// begin accessors & mutators for this implementation
//
- public EJBHome getEJBHome() { throw new UnsupportedOperationException(); }
+ public EJBHome getEJBHome() {
+ throw new UnsupportedOperationException();
+ }
- public void setBeanManagedTransaction(boolean value){
+ public void setBeanManagedTransaction(boolean value) {
isBeanManagedTransaction = value;
}
- public void setJndiEnc(javax.naming.Context cntx){
+ public void setJndiEnc(javax.naming.Context cntx) {
jndiContextRoot = cntx;
}
- public javax.naming.Context getJndiEnc(){
+ public javax.naming.Context getJndiEnc() {
return jndiContextRoot;
}
- public boolean isReentrant(){
+ public boolean isReentrant() {
return isReentrant;
}
- public void setIsReentrant(boolean reentrant){
+ public void setIsReentrant(boolean reentrant) {
isReentrant = reentrant;
}
- public void appendMethodPermissions(Method m, String [] roleNames){
+ public void appendMethodPermissions(Method m, String[] roleNames) {
}
- public void addSecurityRoleReference(String securityRoleReference, String []
physicalRoles){
+ public void addSecurityRoleReference(String securityRoleReference, String[]
physicalRoles) {
}
-
- public void setMethodTransactionAttribute(Method method, String transAttribute){
+
+ public void setMethodTransactionAttribute(Method method, String transAttribute)
{
Byte byteValue = null;
- if(transAttribute.equals("Supports")){
+ if (transAttribute.equals("Supports")) {
byteValue = new Byte(TX_SUPPORTS);
- } else if(transAttribute.equals("RequiresNew")) {
+ } else if (transAttribute.equals("RequiresNew")) {
byteValue = new Byte(TX_REQUIRES_NEW);
- } else if(transAttribute.equals("Mandatory")) {
+ } else if (transAttribute.equals("Mandatory")) {
byteValue = new Byte(TX_MANDITORY);
- } else if(transAttribute.equals("NotSupported")) {
+ } else if (transAttribute.equals("NotSupported")) {
byteValue = new Byte(TX_NOT_SUPPORTED);
- } else if(transAttribute.equals("Required")) {
+ } else if (transAttribute.equals("Required")) {
byteValue = new Byte(TX_REQUIRED);
- } else if(transAttribute.equals("Never")) {
+ } else if (transAttribute.equals("Never")) {
byteValue = new Byte(TX_NEVER);
- } else{
- throw new IllegalArgumentException("Invalid transaction attribute
\""+transAttribute+"\" declared for method "+method.getName()+". Please check your
configuration.");
+ } else {
+ throw new IllegalArgumentException("Invalid transaction attribute \"" +
transAttribute + "\" declared for method " + method.getName() + ". Please check your
configuration.");
}
-
- methodTransactionAttributes.put( method, byteValue );
+
+ methodTransactionAttributes.put(method, byteValue);
}
}
1.2 +2 -8
openejb/modules/core/src/java/org/openejb/assembler/DeploymentInfo.java
Index: DeploymentInfo.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/assembler/DeploymentInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeploymentInfo.java 1 Mar 2004 07:14:42 -0000 1.1
+++ DeploymentInfo.java 16 Apr 2004 02:34:05 -0000 1.2
@@ -58,8 +58,6 @@
* deployments or deployments. Each bean deployment will have its own
DeploymentInfo
* object to represent much of the information that was provided to the container
by
* the bean's EJB XML deployment descriptor or by the Deployer at the time of
deployment.
- *
- * @see org.openejb.core.DeploymentInfo
*/
public interface DeploymentInfo {
@@ -118,7 +116,6 @@
* Gets the type of this bean component.
* Will return a <code>STATEFUL</code>, <code>STATELESS</code>,
<code>BMP_ENTITY</code> or <code>CMP_ENTITY</code>.
*
- * @param
* @return Returns <code>STATEFUL</code>, <code>STATELESS</code>,
<code>BMP_ENTITY</code> or <code>CMP_ENTITY</code>.
*/
public int getComponentType( );
@@ -154,10 +151,8 @@
* Gets the id of this bean deployment.
*
* @return the id of of this bean deployment
- * @see ContainerManager#getContainerManagerID()
ContainerManager.getContainerManagerID()
- * @see Container#getContainerManagerID() Container.getContainerManagerID()
*/
- public Object getDeploymentID( );
+ public String getDeploymentID( );
/**
* Returns true if this bean deployment has chosen bean-managed transaction
demarcation.
@@ -173,7 +168,6 @@
* Used primarily by Servers integrating OpenEJB into their platform. Aids in
implementing
* the bean's home interface.
*
- * @param
* @return a Class object of the bean's home interface
* @see javax.ejb.EJBHome
*/