User: stark
Date: 01/02/12 01:22:19
Added: security/src/main/org/jboss/metadata
ApplicationMetaData.java BeanMetaData.java
ConfigurationMetaData.java
Log:
Patches to the configuration files to support the security proxy
setup elements
Revision Changes Path
1.1
contrib/security/src/main/org/jboss/metadata/ApplicationMetaData.java
Index: ApplicationMetaData.java
===================================================================
/*
* JBoss, the OpenSource EJB server
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.metadata;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collection;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.jboss.ejb.DeploymentException;
/**
* <description>
*
* MessageDriven Bean added
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
* @author Peter Antman ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class ApplicationMetaData extends MetaData {
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
private URL url;
private ArrayList beans = new ArrayList();
private ArrayList securityRoles = new ArrayList();
private HashMap configurations = new HashMap();
private HashMap resources = new HashMap();
private HashMap plugins = new HashMap();
private String securityDomain;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
public ApplicationMetaData (URL u) {
url = u;
}
public ApplicationMetaData () {
}
// Public --------------------------------------------------------
public URL getUrl() { return url; }
public void setUrl(URL u) { url = u; }
public Iterator getEnterpriseBeans() {
return beans.iterator();
}
public BeanMetaData getBeanByEjbName(String ejbName) {
Iterator iterator = getEnterpriseBeans();
while (iterator.hasNext()) {
BeanMetaData current = (BeanMetaData) iterator.next();
if (current.getEjbName().equals(ejbName)) return current;
}
// not found
return null;
}
public Iterator getConfigurations() {
return configurations.values().iterator();
}
public ConfigurationMetaData getConfigurationMetaDataByName(String name) {
return (ConfigurationMetaData)configurations.get(name);
}
public String getResourceByName(String name) {
// if not found, the container will use default
return (String)resources.get(name);
}
public void addPluginData(String pluginName, Object pluginData) {
plugins.put(pluginName, pluginData);
}
public Object getPluginData(String pluginName) {
return plugins.get(pluginName);
}
public String getSecurityDomain()
{
return securityDomain;
}
public void importEjbJarXml (Element element) throws DeploymentException {
// find the beans
Element enterpriseBeans = getUniqueChild(element, "enterprise-beans");
// entities
Iterator iterator = getChildrenByTagName(enterpriseBeans, "entity");
while (iterator.hasNext()) {
Element currentEntity = (Element)iterator.next();
EntityMetaData entityMetaData = new EntityMetaData(this);
try {
entityMetaData.importEjbJarXml(currentEntity);
} catch (DeploymentException e) {
throw new DeploymentException("Error in ejb-jar.xml for Entity Bean " +
entityMetaData.getEjbName() + ": " + e.getMessage());
}
beans.add(entityMetaData);
}
// sessions
iterator = getChildrenByTagName(enterpriseBeans, "session");
while (iterator.hasNext()) {
Element currentSession = (Element)iterator.next();
SessionMetaData sessionMetaData = new SessionMetaData(this);
try {
sessionMetaData.importEjbJarXml(currentSession);
} catch (DeploymentException e) {
throw new DeploymentException("Error in ejb-jar.xml for Session Bean " +
sessionMetaData.getEjbName() + ": " + e.getMessage());
}
beans.add(sessionMetaData);
}
// MDB
iterator = getChildrenByTagName(enterpriseBeans, "message-driven");
while (iterator.hasNext()) {
Element currentMessageDriven = (Element)iterator.next();
MessageDrivenMetaData messageDrivenMetaData = new
MessageDrivenMetaData(this);
try {
messageDrivenMetaData.importEjbJarXml(currentMessageDriven);
} catch (DeploymentException e) {
throw new DeploymentException("Error in ejb-jar.xml for Message Driven
Bean " + messageDrivenMetaData.getEjbName() + ": " + e.getMessage());
}
beans.add(messageDrivenMetaData);
}
// read the assembly descriptor (optional)
Element assemblyDescriptor = getOptionalChild(element, "assembly-descriptor");
if (assemblyDescriptor != null) {
// set the security roles (optional)
iterator = getChildrenByTagName(assemblyDescriptor, "security-role");
while (iterator.hasNext()) {
Element securityRole = (Element)iterator.next();
try {
String role = getElementContent(getUniqueChild(securityRole,
"role-name"));
securityRoles.add(role);
} catch (DeploymentException e) {
throw new DeploymentException("Error in ejb-jar.xml for security-role:
" + e.getMessage());
}
}
// set the method permissions (optional)
iterator = getChildrenByTagName(assemblyDescriptor, "method-permission");
try {
while (iterator.hasNext()) {
Element methodPermission = (Element)iterator.next();
// find the list of roles
Set roles = new HashSet();
Iterator rolesIterator = getChildrenByTagName(methodPermission,
"role-name");
while (rolesIterator.hasNext()) {
roles.add(getElementContent((Element)rolesIterator.next()));
}
// find the methods
Iterator methods = getChildrenByTagName(methodPermission, "method");
while (methods.hasNext()) {
// load the method
MethodMetaData method = new MethodMetaData();
method.importEjbJarXml((Element)methods.next());
method.setRoles(roles);
// give the method to the right bean
BeanMetaData bean = getBeanByEjbName(method.getEjbName());
if (bean == null) {
throw new DeploymentException(method.getEjbName() + " doesn't
exist");
}
bean.addPermissionMethod(method);
}
}
} catch (DeploymentException e) {
throw new DeploymentException("Error in ejb-jar.xml, in method-permission:
" + e.getMessage());
}
// set the container transactions (optional)
iterator = getChildrenByTagName(assemblyDescriptor,
"container-transaction");
try {
while (iterator.hasNext()) {
Element containerTransaction = (Element)iterator.next();
// find the type of the transaction
byte transactionType;
String type = getElementContent(getUniqueChild(containerTransaction,
"trans-attribute"));
if (type.equalsIgnoreCase("NotSupported") ||
type.equalsIgnoreCase("Not_Supported")) {
transactionType = TX_NOT_SUPPORTED;
} else if (type.equalsIgnoreCase("Supports")) {
transactionType = TX_SUPPORTS;
} else if (type.equalsIgnoreCase("Required")) {
transactionType = TX_REQUIRED;
} else if (type.equalsIgnoreCase("RequiresNew") ||
type.equalsIgnoreCase("Requires_New")) {
transactionType = TX_REQUIRES_NEW;
} else if (type.equalsIgnoreCase("Mandatory")) {
transactionType = TX_MANDATORY;
} else if (type.equalsIgnoreCase("Never")) {
transactionType = TX_NEVER;
} else {
throw new DeploymentException("invalid transaction-attribute : " +
type);
}
// find the methods
Iterator methods = getChildrenByTagName(containerTransaction,
"method");
while (methods.hasNext()) {
// load the method
MethodMetaData method = new MethodMetaData();
method.importEjbJarXml((Element)methods.next());
method.setTransactionType(transactionType);
// give the method to the right bean
BeanMetaData bean = getBeanByEjbName(method.getEjbName());
if (bean == null) {
throw new DeploymentException("bean " + method.getEjbName() + "
doesn't exist");
}
bean.addTransactionMethod(method);
}
}
} catch (DeploymentException e) {
throw new DeploymentException("Error in ejb-jar.xml, in
container-transaction: " + e.getMessage());
}
}
}
public void importJbossXml(Element element) throws DeploymentException {
Iterator iterator;
// all the tags are optional
// Get the security domain name
Element securityDomainElement = getOptionalChild(element, "security-domain");
if( securityDomainElement != null )
securityDomain = getElementContent(securityDomainElement);
// find the container configurations (we need them first to use them in the
beans)
Element confs = getOptionalChild(element, "container-configurations");
if (confs != null) {
iterator = getChildrenByTagName(confs, "container-configuration");
while (iterator.hasNext()) {
Element conf = (Element)iterator.next();
String confName = getElementContent(getUniqueChild(conf,
"container-name"));
// find the configuration if it has already been defined
// (allow jboss.xml to modify a standard conf)
ConfigurationMetaData configurationMetaData =
getConfigurationMetaDataByName(confName);
// create it if necessary
if (configurationMetaData == null) {
configurationMetaData = new ConfigurationMetaData(confName);
configurations.put(confName, configurationMetaData);
}
try {
configurationMetaData.importJbossXml(conf);
} catch (DeploymentException e) {
throw new DeploymentException("Error in jboss.xml for
container-configuration " + configurationMetaData.getName() + ": " + e.getMessage());
}
}
}
// update the enterprise beans
Element entBeans = getOptionalChild(element, "enterprise-beans");
if (entBeans != null) {
String ejbName = null;
try {
iterator = getChildrenByTagName(entBeans, "entity");
while (iterator.hasNext()) {
Element bean = (Element) iterator.next();
ejbName = getElementContent(getUniqueChild(bean, "ejb-name"));
BeanMetaData beanMetaData = getBeanByEjbName(ejbName);
if (beanMetaData == null) {
throw new DeploymentException("found in jboss.xml but not in
ejb-jar.xml");
}
beanMetaData.importJbossXml(bean);
}
iterator = getChildrenByTagName(entBeans, "session");
while (iterator.hasNext()) {
Element bean = (Element) iterator.next();
ejbName = getElementContent(getUniqueChild(bean, "ejb-name"));
BeanMetaData beanMetaData = getBeanByEjbName(ejbName);
if (beanMetaData == null) {
throw new DeploymentException("found in jboss.xml but not in
ejb-jar.xml");
}
beanMetaData.importJbossXml(bean);
}
iterator = getChildrenByTagName(entBeans, "message-driven");
while (iterator.hasNext()) {
Element bean = (Element) iterator.next();
ejbName = getElementContent(getUniqueChild(bean, "ejb-name"));
BeanMetaData beanMetaData = getBeanByEjbName(ejbName);
if (beanMetaData == null) {
throw new DeploymentException("found in jboss.xml but not in
ejb-jar.xml");
}
beanMetaData.importJbossXml(bean);
}
} catch (DeploymentException e) {
throw new DeploymentException("Error in jboss.xml for Bean " + ejbName +
": " + e.getMessage());
}
}
// set the resource managers
Element resmans = getOptionalChild(element, "resource-managers");
if (resmans != null) {
iterator = getChildrenByTagName(resmans, "resource-manager");
try {
while (iterator.hasNext()) {
Element resourceManager = (Element)iterator.next();
String resName = getElementContent(getUniqueChild(resourceManager,
"res-name"));
String jndi = getElementContent(getOptionalChild(resourceManager,
"res-jndi-name"));
// Make sure it is prefixed with java:
if (jndi != null && !jndi.startsWith("java:/"))
jndi = "java:/"+jndi;
String url = getElementContent(getOptionalChild(resourceManager,
"res-url"));
if (jndi != null && url == null) {
resources.put(resName, jndi);
} else if (jndi == null && url != null) {
resources.put(resName, url);
} else {
throw new DeploymentException(resName + " : expected res-url or
res-jndi-name tag");
}
}
} catch (DeploymentException e) {
throw new DeploymentException("Error in jboss.xml, in resource-manager: "
+ e.getMessage());
}
}
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
}
1.1 contrib/security/src/main/org/jboss/metadata/BeanMetaData.java
Index: BeanMetaData.java
===================================================================
/*
* JBoss, the OpenSource EJB server
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.metadata;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.Collection;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.jboss.ejb.DeploymentException;
import org.jboss.ejb.Container;
/**
* <description>
*
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
* @author Peter Antman ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public abstract class BeanMetaData extends MetaData {
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
private ApplicationMetaData application;
// from ejb-jar.xml
private String ejbName;
private String homeClass;
private String remoteClass;
private String ejbClass;
protected boolean session;
protected boolean messageDriven = false;
private HashMap ejbReferences = new HashMap();
private ArrayList environmentEntries = new ArrayList();
private ArrayList securityRoleReferences = new ArrayList();
private HashMap resourceReferences = new HashMap();
private ArrayList permissionMethods = new ArrayList();
private ArrayList transactionMethods = new ArrayList();
// from jboss.xml
private String jndiName;
protected String configurationName;
private ConfigurationMetaData configuration;
private String statelessSecurityProxy;
private String statefulSecurityProxy;
/**
* @label stateless-security-proxy element
* @supplierRole bean container
* @clientRole bean config*/
/*#Container lnkContainer;*/
/**
* @label stateful-security-proxy element
* @supplierRole bean container
* @clientRole bean config
*/
/*#Container lnkContainer1;*/
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
public BeanMetaData(ApplicationMetaData app) {
application = app;
}
// Public --------------------------------------------------------
public boolean isSession() { return session; }
public boolean isMessageDriven() { return messageDriven; }
public boolean isEntity() { return !session && !messageDriven; }
public String getHome() { return homeClass; }
public String getRemote() { return remoteClass; }
public String getEjbClass() { return ejbClass; }
public String getEjbName() { return ejbName; }
public Iterator getEjbReferences() { return ejbReferences.values().iterator();
}
public EjbRefMetaData getEjbRefByName(String name) {
return (EjbRefMetaData)ejbReferences.get(name);
}
public Iterator getEnvironmentEntries() { return
environmentEntries.iterator(); }
public Iterator getSecurityRoleReferences() { return
securityRoleReferences.iterator(); }
public Iterator getResourceReferences() { return
resourceReferences.values().iterator(); }
public String getJndiName() {
// jndiName may be set in jboss.xml
if (jndiName == null) {
jndiName = ejbName;
}
return jndiName;
}
public String getConfigurationName() {
if (configurationName == null) {
configurationName = getDefaultConfigurationName();
}
return configurationName;
}
public ConfigurationMetaData getContainerConfiguration() {
if (configuration == null) {
configuration =
application.getConfigurationMetaDataByName(getConfigurationName());
}
return configuration;
}
public String getStatelessSecurityProxy() { return statelessSecurityProxy; }
public String getStatefulSecurityProxy() { return statefulSecurityProxy; }
public ApplicationMetaData getApplicationMetaData() { return application; }
public abstract String getDefaultConfigurationName();
public Iterator getTransactionMethods() { return
transactionMethods.iterator(); }
public Iterator getPermissionMethods() { return permissionMethods.iterator(); }
public void addTransactionMethod(MethodMetaData method) {
transactionMethods.add(method);
}
public void addPermissionMethod(MethodMetaData method) {
permissionMethods.add(method);
}
public byte getMethodTransactionType(String methodName, Class[] params,
boolean remote) {
// default value
byte result = TX_UNKNOWN;
Iterator iterator = getTransactionMethods();
while (iterator.hasNext()) {
MethodMetaData m = (MethodMetaData)iterator.next();
if (m.patternMatches(methodName, params, remote)) {
result = m.getTransactionType();
// if it is an exact match, break, if it is the
wildcard continue to look for a finer match
if (!"*".equals(m.getMethodName())) break;
}
}
return result;
}
// d.s.> PERFORMANCE !!!
public Set getMethodPermissions(String methodName, Class[] params, boolean
remote) {
Set result = new HashSet ();
Iterator iterator = getPermissionMethods();
while (iterator.hasNext()) {
MethodMetaData m = (MethodMetaData)iterator.next();
if (m.patternMatches(methodName, params, remote))
{
Iterator i = m.getRoles().iterator ();
while (i.hasNext ())
result.add (i.next ());
}
}
if (result.isEmpty ()) // no method-permission specified
return null;
else
return result;
}
public void importEjbJarXml(Element element) throws DeploymentException {
// set the ejb-name
ejbName = getElementContent(getUniqueChild(element, "ejb-name"));
// set the classes
// Not for MessageDriven
if (!messageDriven) {
homeClass = getElementContent(getUniqueChild(element, "home"));
remoteClass = getElementContent(getUniqueChild(element, "remote"));
}
ejbClass = getElementContent(getUniqueChild(element, "ejb-class"));
// set the environment entries
Iterator iterator = getChildrenByTagName(element, "env-entry");
while (iterator.hasNext()) {
Element envEntry = (Element)iterator.next();
EnvEntryMetaData envEntryMetaData = new EnvEntryMetaData();
envEntryMetaData.importEjbJarXml(envEntry);
environmentEntries.add(envEntryMetaData);
}
// set the ejb references
iterator = getChildrenByTagName(element, "ejb-ref");
while (iterator.hasNext()) {
Element ejbRef = (Element) iterator.next();
EjbRefMetaData ejbRefMetaData = new EjbRefMetaData();
ejbRefMetaData.importEjbJarXml(ejbRef);
ejbReferences.put(ejbRefMetaData.getName(), ejbRefMetaData);
}
// set the security roles references
iterator = getChildrenByTagName(element, "security-role-ref");
while (iterator.hasNext()) {
Element secRoleRef = (Element) iterator.next();
SecurityRoleRefMetaData securityRoleRefMetaData = new
SecurityRoleRefMetaData();
securityRoleRefMetaData.importEjbJarXml(secRoleRef);
securityRoleReferences.add(securityRoleRefMetaData);
}
// set the resource references
iterator = getChildrenByTagName(element, "resource-ref");
while (iterator.hasNext()) {
Element resourceRef = (Element) iterator.next();
ResourceRefMetaData resourceRefMetaData = new
ResourceRefMetaData();
resourceRefMetaData.importEjbJarXml(resourceRef);
resourceReferences.put(resourceRefMetaData.getRefName(),
resourceRefMetaData);
}
}
public void importJbossXml(Element element) throws DeploymentException {
// we must not set defaults here, this might never be called
// set the jndi name, (optional)
jndiName = getElementContent(getOptionalChild(element, "jndi-name"));
// set the configuration (optional)
configurationName = getElementContent(getOptionalChild(element,
"configuration-name"));
if (configurationName != null &&
getApplicationMetaData().getConfigurationMetaDataByName(configurationName) == null) {
throw new DeploymentException("configuration '" +
configurationName + "' not found in standardjboss.xml or jboss.xml");
}
// Get the security proxies
statelessSecurityProxy = getElementContent(getOptionalChild(element,
"stateless-security-proxy"), statelessSecurityProxy);
statefulSecurityProxy = getElementContent(getOptionalChild(element,
"stateful-security-proxy"), statefulSecurityProxy);
// update the resource references (optional)
Iterator iterator = getChildrenByTagName(element, "resource-ref");
while (iterator.hasNext()) {
Element resourceRef = (Element)iterator.next();
String resRefName =
getElementContent(getUniqueChild(resourceRef, "res-ref-name"));
String resourceName =
getElementContent(getUniqueChild(resourceRef, "resource-name"));
ResourceRefMetaData resourceRefMetaData =
(ResourceRefMetaData)resourceReferences.get(resRefName);
if (resourceRefMetaData == null) {
throw new DeploymentException("resource-ref " + resRefName + " found
in jboss.xml but not in ejb-jar.xml");
}
resourceRefMetaData.setResourceName(resourceName);
}
// set the external ejb-references (optional)
iterator = getChildrenByTagName(element, "ejb-ref");
while (iterator.hasNext()) {
Element ejbRef = (Element)iterator.next();
String ejbRefName = getElementContent(getUniqueChild(ejbRef,
"ejb-ref-name"));
EjbRefMetaData ejbRefMetaData = getEjbRefByName(ejbRefName);
if (ejbRefMetaData == null) {
throw new DeploymentException("ejb-ref " + ejbRefName
+ " found in jboss.xml but not in ejb-jar.xml");
}
ejbRefMetaData.importJbossXml(ejbRef);
}
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
}
1.1
contrib/security/src/main/org/jboss/metadata/ConfigurationMetaData.java
Index: ConfigurationMetaData.java
===================================================================
/*
* JBoss, the OpenSource EJB server
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.metadata;
import org.w3c.dom.Element;
import org.jboss.ejb.DeploymentException;
/**
* <description>
*
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
* @version $Revision: 1.1 $
*/
public class ConfigurationMetaData extends MetaData {
// Constants -----------------------------------------------------
public static final String CMP_13 = "Standard CMP EntityBean";
public static final String BMP_13 = "Standard BMP EntityBean";
public static final String STATELESS_13 = "Standard Stateless SessionBean";
public static final String STATEFUL_13 = "Standard Stateful SessionBean";
public static final String MESSAGE_DRIVEN_13 = "Standard Message Driven Bean";
public static final String CMP_12 = "jdk1.2.2 CMP EntityBean";
public static final String BMP_12 = "jdk1.2.2 BMP EntityBean";
public static final String STATELESS_12 = "jdk1.2.2 Stateless SessionBean";
public static final String STATEFUL_12 = "jdk1.2.2 Stateful SessionBean";
public static final String MESSAGE_DRIVEN_12 = "jdk1.2.2 Message Driven Bean";
public static final byte A_COMMIT_OPTION = 0;
public static final byte B_COMMIT_OPTION = 1;
public static final byte C_COMMIT_OPTION = 2;
public static final String[] commitOptionStrings = { "A", "B", "C" };
// Attributes ----------------------------------------------------
private String name;
private String containerInvoker;
private String instancePool;
private String instanceCache;
private String persistenceManager;
private String transactionManager;
private byte commitOption;
private boolean callLogging;
private boolean readOnlyGetMethods;
private String authenticationModule;
private String roleMappingManager;
private Element containerInvokerConf;
private Element containerPoolConf;
private Element containerCacheConf;
private Element containerInterceptorsConf;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
public ConfigurationMetaData (String name) {
this.name = name;
}
// Public --------------------------------------------------------
public String getName() { return name; }
public String getContainerInvoker() { return containerInvoker; }
public String getInstancePool() { return instancePool; }
public String getInstanceCache() { return instanceCache; }
public String getPersistenceManager() { return persistenceManager; }
public String getAuthenticationModule() { return authenticationModule; }
public String getRoleMappingManager() { return roleMappingManager; }
public String getTransactionManager() { return transactionManager; }
public Element getContainerInvokerConf() { return containerInvokerConf; }
public Element getContainerPoolConf() { return containerPoolConf; }
public Element getContainerCacheConf() { return containerCacheConf; }
public Element getContainerInterceptorsConf() { return
containerInterceptorsConf; }
public boolean getCallLogging() { return callLogging; }
public byte getCommitOption() { return commitOption; }
public boolean getReadOnlyGetMethods() { return readOnlyGetMethods; }
public void importJbossXml(Element element) throws DeploymentException {
// everything is optional to allow jboss.xml to modify part of a
configuration
// defined in standardjboss.xml
// set call logging
callLogging =
Boolean.valueOf(getElementContent(getOptionalChild(element, "call-logging"),
String.valueOf(callLogging))).booleanValue();
// set read-only get methods
readOnlyGetMethods =
Boolean.valueOf(getElementContent(getOptionalChild(element,
"read-only-get-methods"))).booleanValue();
// set the container invoker
containerInvoker = getElementContent(getOptionalChild(element,
"container-invoker"), containerInvoker);
// set the instance pool
instancePool = getElementContent(getOptionalChild(element,
"instance-pool"), instancePool);
// set the instance cache
instanceCache = getElementContent(getOptionalChild(element,
"instance-cache"), instanceCache);
// set the persistence manager
persistenceManager = getElementContent(getOptionalChild(element,
"persistence-manager"), persistenceManager);
// set the transaction manager
transactionManager = getElementContent(getOptionalChild(element,
"transaction-manager"), transactionManager);
// set the authentication module
authenticationModule = getElementContent(getOptionalChild(element,
"authentication-module"), authenticationModule);
// set the role mapping manager
roleMappingManager = getElementContent(getOptionalChild(element,
"role-mapping-manager"), roleMappingManager);
// set the commit option
String commit = getElementContent(getOptionalChild(element,
"commit-option"), commitOptionToString(commitOption));
commitOption = stringToCommitOption(commit);
// the classes which can understand the following are dynamically
loaded during deployment :
// We save the Elements for them to use later
// The configuration for the container interceptors
containerInterceptorsConf = getOptionalChild(element,
"container-interceptors", containerInterceptorsConf);
// configuration for container invoker
containerInvokerConf = getOptionalChild(element, "container-invoker-conf",
containerInvokerConf);
// configuration for instance pool
containerPoolConf = getOptionalChild(element, "container-pool-conf",
containerPoolConf);
// configuration for instance cache
containerCacheConf = getOptionalChild(element, "container-cache-conf",
containerCacheConf);
// DEPRECATED: Remove this in JBoss 4.0
if
(containerInvoker.equals("org.jboss.ejb.plugins.jrmp12.server.JRMPContainerInvoker") ||
containerInvoker.equals("org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker"))
{
System.out.println("Deprecated container invoker. Change to
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker");
containerInvoker = "org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker";
}
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
private static String commitOptionToString(byte commitOption)
throws DeploymentException {
try {
return commitOptionStrings[commitOption];
} catch( ArrayIndexOutOfBoundsException e ) {
throw new DeploymentException("Invalid commit option: " +
commitOption);
}
}
private static byte stringToCommitOption(String commitOption)
throws DeploymentException {
for( byte i=0; i<commitOptionStrings.length; ++i )
if( commitOptionStrings[i].equals(commitOption) )
return i;
throw new DeploymentException("Invalid commit option: '" + commitOption +
"'");
}
// Inner classes -------------------------------------------------
}