User: oleg
Date: 00/10/16 10:37:30
Modified: src/main/org/jboss/ejb ContainerFactory.java
Log:
Gets authentication and role mapping from JNDI based on container configuration also
for stateful session and entity beans.
Revision Changes Path
1.51 +58 -16 jboss/src/main/org/jboss/ejb/ContainerFactory.java
Index: ContainerFactory.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/ContainerFactory.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- ContainerFactory.java 2000/10/15 20:52:26 1.50
+++ ContainerFactory.java 2000/10/16 17:37:30 1.51
@@ -76,7 +76,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
*
-* @version $Revision: 1.50 $
+* @version $Revision: 1.51 $
*/
public class ContainerFactory
extends org.jboss.util.ServiceMBeanSupport
@@ -545,15 +545,36 @@
// Set transaction manager
container.setTransactionManager((TransactionManager)new
InitialContext().lookup("TransactionManager"));
- // Set security manager (should be chosen based on container
config)
- container.setSecurityManager((EJBSecurityManager)new
InitialContext().lookup("EJBSecurityManager"));
-
- // Set realm mapping (should be chosen based on container
config)
- container.setRealmMapping( (RealmMapping)new
InitialContext().lookup("SimpleRealmMapping"));
-
// Get container configuration
ConfigurationMetaData conf = bean.getContainerConfiguration();
+ // Set security manager & role mapping manager
+ String securityManagerJNDIName = conf.getAuthenticationModule();
+ String roleMappingManagerJNDIName = conf.getRoleMappingManager();
+
+ if ((securityManagerJNDIName != null) &&
(roleMappingManagerJNDIName != null))
+ {
+ try
+ {
+ EJBSecurityManager ejbS = (EJBSecurityManager)new
InitialContext().lookup(securityManagerJNDIName);
+ container.setSecurityManager( ejbS );
+ }
+ catch (NamingException ne)
+ {
+ throw new DeploymentException( "Could not find the Security
Manager specified for this container", ne );
+ }
+
+ try
+ {
+ RealmMapping rM = (RealmMapping)new
InitialContext().lookup(roleMappingManagerJNDIName);
+ container.setRealmMapping( rM );
+ }
+ catch (NamingException ne)
+ {
+ throw new DeploymentException( "Could not find the Role Mapping
Manager specified for this container", ne );
+ }
+ }
+
// Set container invoker
ContainerInvoker ci =
(ContainerInvoker)cl.loadClass(conf.getContainerInvoker()).newInstance();
if (ci instanceof XmlLoadable) {
@@ -610,15 +631,36 @@
// Set transaction manager
container.setTransactionManager((TransactionManager)new
InitialContext().lookup("TransactionManager"));
- // Set security manager (should be chosen based on container config)
- container.setSecurityManager((EJBSecurityManager)new
InitialContext().lookup("EJBSecurityManager"));
-
- // Set realm mapping (should be chosen based on container config)
- container.setRealmMapping( (RealmMapping)new
InitialContext().lookup("SimpleRealmMapping"));
-
// Get container configuration
ConfigurationMetaData conf = bean.getContainerConfiguration();
+ // Set security manager & role mapping manager
+ String securityManagerJNDIName = conf.getAuthenticationModule();
+ String roleMappingManagerJNDIName = conf.getRoleMappingManager();
+
+ if ((securityManagerJNDIName != null) && (roleMappingManagerJNDIName
!= null))
+ {
+ try
+ {
+ EJBSecurityManager ejbS = (EJBSecurityManager)new
InitialContext().lookup(securityManagerJNDIName);
+ container.setSecurityManager( ejbS );
+ }
+ catch (NamingException ne)
+ {
+ throw new DeploymentException( "Could not find the Security
Manager specified for this container", ne );
+ }
+
+ try
+ {
+ RealmMapping rM = (RealmMapping)new
InitialContext().lookup(roleMappingManagerJNDIName);
+ container.setRealmMapping( rM );
+ }
+ catch (NamingException ne)
+ {
+ throw new DeploymentException( "Could not find the Role Mapping
Manager specified for this container", ne );
+ }
+ }
+
// Set container invoker
ContainerInvoker ci =
(ContainerInvoker)cl.loadClass(conf.getContainerInvoker()).newInstance();
if (ci instanceof XmlLoadable) {
@@ -749,7 +791,7 @@
}
/**
- * is the aplication with this url deployed
+ * is the aplication with this url deployed
*
* @param url
* @exception MalformedURLException
@@ -757,7 +799,7 @@
public boolean isDeployed(String url)
throws MalformedURLException
{
- return isDeployed (new URL (url));
+ return isDeployed (new URL (url));
}
/**
@@ -768,7 +810,7 @@
*/
public boolean isDeployed (URL url)
{
- return (deployments.get(url) != null);
+ return (deployments.get(url) != null);
}