User: sparre  
  Date: 01/06/20 00:14:16

  Modified:    src/main/org/jboss/metadata BeanMetaData.java
                        MessageDrivenMetaData.java SessionMetaData.java
  Log:
  Moved the BMT/CMT metadata attribute to common BeanMetaData superclass,
  since every bean is either BMT or CMT.
  Also removed a few tabs.
  
  Revision  Changes    Path
  1.25      +229 -221  jboss/src/main/org/jboss/metadata/BeanMetaData.java
  
  Index: BeanMetaData.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/metadata/BeanMetaData.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- BeanMetaData.java 2001/06/18 20:01:27     1.24
  +++ BeanMetaData.java 2001/06/20 07:14:16     1.25
  @@ -28,27 +28,28 @@
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Daniel OConnor</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
  - *   @version $Revision: 1.24 $
  + *   @author <a href="mailto:[EMAIL PROTECTED]";>Ole Husgaard</a> 
  + *   @version $Revision: 1.25 $
    */
   public abstract class BeanMetaData extends MetaData {
       // Constants -----------------------------------------------------
  -     public static final char SESSION_TYPE = 'S';
  -     public static final char ENTITY_TYPE = 'E';
  -     public static final char MDB_TYPE = 'M';
  +    public static final char SESSION_TYPE = 'S';
  +    public static final char ENTITY_TYPE = 'E';
  +    public static final char MDB_TYPE = 'M';
   
  -     // Attributes ----------------------------------------------------
  -     private ApplicationMetaData application;
  +    // Attributes ----------------------------------------------------
  +    private ApplicationMetaData application;
       
  -     // from ejb-jar.xml
  +    // from ejb-jar.xml
       /** The ejb-name element specifies an enterprise bean�s name. This name is
       assigned by the ejb-jar file producer to name the enterprise bean in
       the ejb-jar file�s deployment descriptor. The name must be unique
       among the names of the enterprise beans in the same ejb-jar file.
       */
  -     private String ejbName;
  +    private String ejbName;
       /** The home element contains the fully-qualified name of the enterprise
       bean�s home interface. */
  -     private String homeClass;
  +    private String homeClass;
       /** The remote element contains the fully-qualified name of the enterprise
       bean�s remote interface. */
       private String remoteClass;
  @@ -63,13 +64,15 @@
       private String ejbClass;
       /** The type of bean: ENTITY_TYPE, SESSION_TYPE, MDB_TYPE */
       protected char beanType;
  +    /** Is this bean's transactions managed by the container? */
  +    protected boolean containerManagedTx = true;
   
       /** The The env-entry element(s) contains the declaration of an enterprise
       bean�s environment entry */
  -     private ArrayList environmentEntries = new ArrayList();
  +    private ArrayList environmentEntries = new ArrayList();
       /** The The ejb-ref element(s) for the declaration of a reference to an
       enterprise bean�s home */
  -     private HashMap ejbReferences = new HashMap();
  +    private HashMap ejbReferences = new HashMap();
       /** The ejb-local-ref element(s) info */
       private HashMap ejbLocalReferences = new HashMap();
       /** The security-role-ref element(s) info */
  @@ -77,92 +80,100 @@
       /** The security-idemtity element info */
       private SecurityIdentityMetaData securityIdentity = null;
       /** The resource-ref element(s) info */
  -     private HashMap resourceReferences = new HashMap();
  +    private HashMap resourceReferences = new HashMap();
       /** The resource-env-ref element(s) info */
  -     private HashMap resourceEnvReferences = new HashMap();
  +    private HashMap resourceEnvReferences = new HashMap();
       /** The assembly-descriptor/method-permission element(s) info */
  -     private ArrayList permissionMethods = new ArrayList();
  +    private ArrayList permissionMethods = new ArrayList();
       /** The assembly-descriptor/container-transaction element(s) info */
  -     private ArrayList transactionMethods = new ArrayList();
  +    private ArrayList transactionMethods = new ArrayList();
       /** The assembly-descriptor/exclude-list method(s) */
  -     private ArrayList excludedMethods = new ArrayList();
  +    private ArrayList excludedMethods = new ArrayList();
   
  -     // from jboss.xml
  +    // from jboss.xml
       /** The JNDI name under with the home interface should be bound */
  -     private String jndiName;
  -     protected String configurationName;
  -     private ConfigurationMetaData configuration;
  +    private String jndiName;
  +    protected String configurationName;
  +    private ConfigurationMetaData configuration;
       private String securityProxy;
        
  -     // Static --------------------------------------------------------
  +    // Static --------------------------------------------------------
       
       // Constructors --------------------------------------------------
       public BeanMetaData(ApplicationMetaData app, char beanType)
       {
  -             application = app;
  +        application = app;
           this.beanType = beanType;
  -     }
  +    }
   
       // Public --------------------------------------------------------
       public boolean isSession() { return beanType == SESSION_TYPE; }
   
       public boolean isMessageDriven() { return beanType == MDB_TYPE; }
   
  -     public boolean isEntity() { return beanType == ENTITY_TYPE; }
  +    public boolean isEntity() { return beanType == ENTITY_TYPE; }
                                                
  -     public String getHome() { return homeClass; }
  +    public String getHome() { return homeClass; }
        
  -     public String getRemote() { return remoteClass; }
  +    public String getRemote() { return remoteClass; }
   
  -     public String getLocalHome() { return localHomeClass; }
  +    public String getLocalHome() { return localHomeClass; }
        
  -     public String getLocal() { return localClass; }    
  +    public String getLocal() { return localClass; }    
           
  -     public String getEjbClass() { return ejbClass; }
  +    public String getEjbClass() { return ejbClass; }
        
  -     public String getEjbName() { return ejbName; }
  +    public String getEjbName() { return ejbName; }
  +
  +    public boolean isContainerManagedTx() { return containerManagedTx; }
  +
  +    public boolean isBeanManagedTx() { return !containerManagedTx; }
        
  -     public Iterator getEjbReferences() { return ejbReferences.values().iterator(); 
}
  +    public Iterator getEjbReferences() { return ejbReferences.values().iterator(); }
           
       public Iterator getEjbLocalReferences() { return 
ejbLocalReferences.values().iterator(); }
        
  -     public EjbRefMetaData getEjbRefByName(String name) {
  -             return (EjbRefMetaData)ejbReferences.get(name);
  -     }
  -
  -     public EjbLocalRefMetaData getEjbLocalRefByName(String name) {
  -             return (EjbLocalRefMetaData)ejbLocalReferences.get(name);
  -     }       
  +    public EjbRefMetaData getEjbRefByName(String name)
  +    {
  +        return (EjbRefMetaData)ejbReferences.get(name);
  +    }
  +
  +    public EjbLocalRefMetaData getEjbLocalRefByName(String name)
  +    {
  +     return (EjbLocalRefMetaData)ejbLocalReferences.get(name);
  +    }       
           
  -     public Iterator getEnvironmentEntries() { return 
environmentEntries.iterator(); }
  +    public Iterator getEnvironmentEntries() { return environmentEntries.iterator(); 
}
        
  -     public Iterator getSecurityRoleReferences() { return 
securityRoleReferences.iterator(); }
  +    public Iterator getSecurityRoleReferences() { return 
securityRoleReferences.iterator(); }
        
  -     public Iterator getResourceReferences() { return 
resourceReferences.values().iterator(); }
  -     public Iterator getResourceEnvReferences() { return 
resourceEnvReferences.values().iterator(); }
  +    public Iterator getResourceReferences() { return 
resourceReferences.values().iterator(); }
  +    public Iterator getResourceEnvReferences() { return 
resourceEnvReferences.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 String getJndiName()
  +    { 
  +     // jndiName may be set in jboss.xml
  +     if (jndiName == null) {
  +            jndiName = ejbName;
  +        }
  +        return jndiName;
  +    }
        
  -     public ConfigurationMetaData getContainerConfiguration() {
  -             if (configuration == null) {
  -                     configuration = 
application.getConfigurationMetaDataByName(getConfigurationName());
  -             }
  -             return configuration;
  -     }
  +    public String getConfigurationName()
  +    {
  +        if (configurationName == null) {
  +            configurationName = getDefaultConfigurationName();
  +        }
  +        return configurationName;
  +    }
  +
  +    public ConfigurationMetaData getContainerConfiguration()
  +    {
  +        if (configuration == null) {
  +            configuration = 
application.getConfigurationMetaDataByName(getConfigurationName());
  +        }
  +        return configuration;
  +    }
   
       public String getSecurityProxy() { return securityProxy; }
       public SecurityIdentityMetaData getSecurityIdentityMetaData()
  @@ -170,71 +181,76 @@
           return securityIdentity;
       }
   
  -     public ApplicationMetaData getApplicationMetaData() { return application; }
  +    public ApplicationMetaData getApplicationMetaData() { return application; }
        
  -     public abstract String getDefaultConfigurationName();
  +    public abstract String getDefaultConfigurationName();
        
  -     public Iterator getTransactionMethods() { return 
transactionMethods.iterator(); }
  +    public Iterator getTransactionMethods() { return transactionMethods.iterator(); 
}
        
  -     public Iterator getPermissionMethods() { return permissionMethods.iterator(); }
  -     public Iterator getExcludedMethods() { return excludedMethods.iterator(); }
  +    public Iterator getPermissionMethods() { return permissionMethods.iterator(); }
  +    public Iterator getExcludedMethods() { return excludedMethods.iterator(); }
   
        
  -     public void addTransactionMethod(MethodMetaData method) { 
  -             transactionMethods.add(method);
  -     }
  +    public void addTransactionMethod(MethodMetaData method)
  +    { 
  +        transactionMethods.add(method);
  +    }
        
  -     public void addPermissionMethod(MethodMetaData method)
  +    public void addPermissionMethod(MethodMetaData method)
       {
           // Insert unchecked methods into the front of the list to speed up their 
validation
           if( method.isUnchecked() )
               permissionMethods.add(0, method);
           else
               permissionMethods.add(method);
  -     }
  -     public void addExcludedMethod(MethodMetaData method) { 
  -             excludedMethods.add(method);
  -     }
  +    }
   
  -     public byte getMethodTransactionType(String methodName, Class[] params, 
boolean remote) {
  -             
  -             // default value
  -             byte result = TX_UNKNOWN;
  +    public void addExcludedMethod(MethodMetaData method)
  +    { 
  +        excludedMethods.add(method);
  +    }
   
  -             Iterator iterator = getTransactionMethods();
  -             while (iterator.hasNext()) {
  -                     MethodMetaData m = (MethodMetaData)iterator.next();
  -                     if (m.patternMatches(methodName, params, remote)) {
  -                             result = m.getTransactionType();
  +    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;
  -     }
  -
  -    /** A somewhat tedious method that builds a Set<Principal> of the roles
  -     that have been assigned permission to execute the indicated method. The
  -     work performed is tedious because of the wildcard style of declaring
  -     method permission allowed in the ejb-jar.xml descriptor. This method is
  -     called by the Container.getMethodPermissions() when it fails to find the
  -     prebuilt set of method roles in its cache.
  -     @return The Set<Principal> for the application domain roles that
  -        caller principal's are to be validated against.
  -     @see org.jboss.ejb.Container#getMethodPermissions(Method, boolean)
  -    */
  -     public Set getMethodPermissions(String methodName, Class[] params, boolean 
remote)
  +                // 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;
  +    }
  +
  +    /**
  +     *  A somewhat tedious method that builds a Set<Principal> of the roles
  +     *  that have been assigned permission to execute the indicated method. The
  +     *  work performed is tedious because of the wildcard style of declaring
  +     *  method permission allowed in the ejb-jar.xml descriptor. This method is
  +     *  called by the Container.getMethodPermissions() when it fails to find the
  +     *  prebuilt set of method roles in its cache.
  +     *
  +     *  @return The Set<Principal> for the application domain roles that
  +     *     caller principal's are to be validated against.
  +     *  @see org.jboss.ejb.Container#getMethodPermissions(Method, boolean)
  +     */
  +    public Set getMethodPermissions(String methodName, Class[] params,
  +                                    boolean remote)
       {
  -             Set result = new HashSet();
  +        Set result = new HashSet();
           // First check the excluded method list as this takes priority over all 
other assignments
           Iterator iterator = getExcludedMethods();
  -        while( iterator.hasNext() )
  -        {
  -                     MethodMetaData m = (MethodMetaData) iterator.next();
  -                     if( m.patternMatches(methodName, params, remote) )
  -            {
  +        while (iterator.hasNext()) {
  +            MethodMetaData m = (MethodMetaData) iterator.next();
  +            if (m.patternMatches(methodName, params, remote)) {
                   /* No one is allowed to execute this method so add a role that
                    fails to equate to any Principal or Principal name and return.
                    We don't return null to differentiate between an explicit
  @@ -247,17 +263,14 @@
   
           // Check the permissioned methods list
           iterator = getPermissionMethods();
  -        while( iterator.hasNext() )
  -        {
  -                     MethodMetaData m = (MethodMetaData) iterator.next();
  -                     if( m.patternMatches(methodName, params, remote) )
  -            {
  +        while (iterator.hasNext()) {
  +            MethodMetaData m = (MethodMetaData) iterator.next();
  +            if (m.patternMatches(methodName, params, remote)) {
                   /* If this is an unchecked method anyone can access it so
                    set the result set to a role that equates to any Principal or
                    Principal name and return.
                   */
  -                if( m.isUnchecked() )
  -                {
  +                if (m.isUnchecked()) {
                       result.clear();
                       result.add(AnybodyPrincipal.ANYBODY_PRINCIPAL);
                       break;
  @@ -266,178 +279,173 @@
                   else
                   {
                       Iterator rolesIterator = m.getRoles().iterator();
  -                    while( rolesIterator.hasNext() )
  -                    {
  +                    while (rolesIterator.hasNext()) {
                           String roleName = (String) rolesIterator.next();
                           result.add(new SimplePrincipal(roleName));
                       }
                   }
               }
  -             }
  +        }
   
           // If no permissions were assigned to the method return null to indicate no 
access
  -             if( result.isEmpty() )
  +        if (result.isEmpty())
               result = null;
           return result;
  -     }
  +    }
   
  -     public void importEjbJarXml(Element element) throws DeploymentException {
  -    
  -         // set the ejb-name
  -             ejbName = getElementContent(getUniqueChild(element, "ejb-name"));
  +    public void importEjbJarXml(Element element) throws DeploymentException
  +    {
  +        // set the ejb-name
  +        ejbName = getElementContent(getUniqueChild(element, "ejb-name"));
   
  -             // set the classes
  -             // Not for MessageDriven
  -             if( isMessageDriven() == false )
  -        {
  +        // set the classes
  +        // Not for MessageDriven
  +        if (isMessageDriven() == false) {
               homeClass = getElementContent(getOptionalChild(element, "home"));
               remoteClass = getElementContent(getOptionalChild(element, "remote"));
               localHomeClass = getElementContent(getOptionalChild(element, 
"local-home"));
               localClass = getElementContent(getOptionalChild(element, "local"));
  -             }
  -             ejbClass = getElementContent(getUniqueChild(element, "ejb-class"));
  +        }
  +        ejbClass = getElementContent(getUniqueChild(element, "ejb-class"));
                
  -             // set the environment entries
  -             Iterator iterator = getChildrenByTagName(element, "env-entry");
  +        // set the environment entries
  +        Iterator iterator = getChildrenByTagName(element, "env-entry");
                
  -             while (iterator.hasNext()) {
  -                     Element envEntry = (Element)iterator.next();
  +        while (iterator.hasNext()) {
  +            Element envEntry = (Element)iterator.next();
                        
  -                     EnvEntryMetaData envEntryMetaData = new EnvEntryMetaData();
  -                     envEntryMetaData.importEjbJarXml(envEntry);
  +            EnvEntryMetaData envEntryMetaData = new EnvEntryMetaData();
  +            envEntryMetaData.importEjbJarXml(envEntry);
                        
  -                     environmentEntries.add(envEntryMetaData);
  -             }
  +            environmentEntries.add(envEntryMetaData);
  +        }
                
  -             // set the ejb references
  -             iterator = getChildrenByTagName(element, "ejb-ref");
  +        // set the ejb references
  +        iterator = getChildrenByTagName(element, "ejb-ref");
                
  -             while (iterator.hasNext()) {
  -                     Element ejbRef = (Element) iterator.next();
  +        while (iterator.hasNext()) {
  +            Element ejbRef = (Element) iterator.next();
                    
  -                     EjbRefMetaData ejbRefMetaData = new EjbRefMetaData();
  -                     ejbRefMetaData.importEjbJarXml(ejbRef);
  +            EjbRefMetaData ejbRefMetaData = new EjbRefMetaData();
  +            ejbRefMetaData.importEjbJarXml(ejbRef);
                        
  -                     ejbReferences.put(ejbRefMetaData.getName(), ejbRefMetaData);
  -             }
  +            ejbReferences.put(ejbRefMetaData.getName(), ejbRefMetaData);
  +        }
                
  -             // set the ejb local references
  -             iterator = getChildrenByTagName(element, "ejb-local-ref");
  +        // set the ejb local references
  +        iterator = getChildrenByTagName(element, "ejb-local-ref");
                
  -             while (iterator.hasNext()) {
  -                     Element ejbLocalRef = (Element) iterator.next();
  +        while (iterator.hasNext()) {
  +            Element ejbLocalRef = (Element) iterator.next();
                    
  -                     EjbLocalRefMetaData ejbLocalRefMetaData = new 
EjbLocalRefMetaData();
  -                     ejbLocalRefMetaData.importEjbJarXml(ejbLocalRef);
  +            EjbLocalRefMetaData ejbLocalRefMetaData = new EjbLocalRefMetaData();
  +            ejbLocalRefMetaData.importEjbJarXml(ejbLocalRef);
                        
  -                     ejbLocalReferences.put(ejbLocalRefMetaData.getName(), 
  -                           ejbLocalRefMetaData);
  -             }
  +            ejbLocalReferences.put(ejbLocalRefMetaData.getName(), 
  +                                   ejbLocalRefMetaData);
  +        }
   
  -                // set the security roles references
  -             iterator = getChildrenByTagName(element, "security-role-ref");
  +        // set the security roles references
  +        iterator = getChildrenByTagName(element, "security-role-ref");
                
  -             while (iterator.hasNext()) {
  -                     Element secRoleRef = (Element) iterator.next();
  +        while (iterator.hasNext()) {
  +            Element secRoleRef = (Element) iterator.next();
                        
  -                     SecurityRoleRefMetaData securityRoleRefMetaData = new 
SecurityRoleRefMetaData();
  -                     securityRoleRefMetaData.importEjbJarXml(secRoleRef);
  +            SecurityRoleRefMetaData securityRoleRefMetaData = new 
SecurityRoleRefMetaData();
  +            securityRoleRefMetaData.importEjbJarXml(secRoleRef);
                        
  -                     securityRoleReferences.add(securityRoleRefMetaData);
  -             }
  +            securityRoleReferences.add(securityRoleRefMetaData);
  +        }
   
           // The security-identity element
           Element securityIdentityElement = getOptionalChild(element, 
"security-identity");
  -        if( securityIdentityElement != null )
  -        {
  +        if (securityIdentityElement != null) {
               securityIdentity = new SecurityIdentityMetaData();
               securityIdentity.importEjbJarXml(securityIdentityElement);
           }
   
  -             // set the resource references
  +        // set the resource references
           iterator = getChildrenByTagName(element, "resource-ref");
                
  -             while (iterator.hasNext()) {
  -                     Element resourceRef = (Element) iterator.next();
  +        while (iterator.hasNext()) {
  +            Element resourceRef = (Element) iterator.next();
                        
  -                     ResourceRefMetaData resourceRefMetaData = new 
ResourceRefMetaData();
  -                     resourceRefMetaData.importEjbJarXml(resourceRef);
  +            ResourceRefMetaData resourceRefMetaData = new ResourceRefMetaData();
  +            resourceRefMetaData.importEjbJarXml(resourceRef);
                        
  -                     resourceReferences.put(resourceRefMetaData.getRefName(), 
resourceRefMetaData);
  -             }
  +            resourceReferences.put(resourceRefMetaData.getRefName(), 
resourceRefMetaData);
  +        }
   
           // Parse the resource-env-ref elements
           iterator = getChildrenByTagName(element, "resource-env-ref");
  -        while( iterator.hasNext() )
  -        {
  -                     Element resourceRef = (Element) iterator.next();        
  -                     ResourceEnvRefMetaData refMetaData = new 
ResourceEnvRefMetaData();
  -                     refMetaData.importEjbJarXml(resourceRef);
  -                     resourceEnvReferences.put(refMetaData.getRefName(), 
refMetaData);
  +        while (iterator.hasNext()) {
  +            Element resourceRef = (Element) iterator.next(); 
  +            ResourceEnvRefMetaData refMetaData = new ResourceEnvRefMetaData();
  +            refMetaData.importEjbJarXml(resourceRef);
  +            resourceEnvReferences.put(refMetaData.getRefName(), refMetaData);
           }
  -     }
  +    }
   
  -     public void importJbossXml(Element element) throws DeploymentException {
  -             // we must not set defaults here, this might never be called
  +    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 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");
  -             }
  +        // 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 proxy
           securityProxy = getElementContent(getOptionalChild(element, 
"security-proxy"), securityProxy);
   
  -             // 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"));
  -                     ResourceRefMetaData resourceRefMetaData = 
(ResourceRefMetaData)resourceReferences.get(resRefName);
  +        // 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"));
  +            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.importJbossXml(resourceRef);
  -             }
  +        }
   
           // Set the resource-env-ref deployed jndi names
           iterator = getChildrenByTagName(element, "resource-env-ref");
  -        while( iterator.hasNext() )
  -        {
  -                     Element resourceRef = (Element) iterator.next();        
  -                     String resRefName = 
getElementContent(getUniqueChild(resourceRef, "resource-env-ref-name"));
  -                     ResourceEnvRefMetaData refMetaData = (ResourceEnvRefMetaData) 
resourceEnvReferences.get(resRefName);
  -            if( refMetaData == null)
  -            {
  +        while (iterator.hasNext()) {
  +            Element resourceRef = (Element) iterator.next(); 
  +            String resRefName = getElementContent(getUniqueChild(resourceRef, 
"resource-env-ref-name"));
  +            ResourceEnvRefMetaData refMetaData = (ResourceEnvRefMetaData) 
resourceEnvReferences.get(resRefName);
  +            if (refMetaData == null) {
                   throw new DeploymentException("resource-env-ref " + resRefName + " 
found in jboss.xml but not in ejb-jar.xml");
               }
               refMetaData.importJbossXml(resourceRef);
           }
   
  -             // 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);
  -             }
  -     }
  -     
  -     
  -     
  +        // 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.9       +78 -78    jboss/src/main/org/jboss/metadata/MessageDrivenMetaData.java
  
  Index: MessageDrivenMetaData.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/metadata/MessageDrivenMetaData.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MessageDrivenMetaData.java        2001/06/18 20:01:27     1.8
  +++ MessageDrivenMetaData.java        2001/06/20 07:14:16     1.9
  @@ -19,10 +19,10 @@
    *
    * Have to add changes ApplicationMetaData and ConfigurationMetaData
    *   @see <related>
  -' *   @author <a href="mailto:[EMAIL PROTECTED]";>Sebastien Alborini</a>
  + *   @author <a href="mailto:[EMAIL PROTECTED]";>Sebastien Alborini</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Peter Antman</a>.
  -
  - *   @version $Revision: 1.8 $
  + *
  + *   @version $Revision: 1.9 $
    */
   public class MessageDrivenMetaData extends BeanMetaData {
       // Constants -----------------------------------------------------
  @@ -33,7 +33,6 @@
       public static final byte NON_DURABLE_SUBSCRIPTION = 1;
       
       // Attributes ----------------------------------------------------
  -    private boolean containerManagedTx;
       private int acknowledgeMode = AUTO_ACKNOWLEDGE_MODE;
       private String destinationType;
       private byte subscriptionDurability = NON_DURABLE_SUBSCRIPTION;
  @@ -46,13 +45,12 @@
       // Static --------------------------------------------------------
       
       // Constructors --------------------------------------------------
  -    public MessageDrivenMetaData(ApplicationMetaData app) {
  +    public MessageDrivenMetaData(ApplicationMetaData app)
  +    {
        super(app, BeanMetaData.MDB_TYPE);
  -     }
  +    }
        
       // Public --------------------------------------------------------
  -    public boolean isContainerManagedTx() { return containerManagedTx; }
  -    public boolean isBeanManagedTx() { return !containerManagedTx; }
       /**
        * returns MessageDrivenMetaData.AUTO_ACKNOWLADGE_MODE or
        * MessageDrivenMetaData.DUPS_OK_AKNOWLEDGE_MODE
  @@ -70,83 +68,84 @@
        */
       public byte getSubscriptionDurability() {return subscriptionDurability;}
       
  -    public String getDefaultConfigurationName() {
  +    public String getDefaultConfigurationName()
  +    {
        return jdk13Enabled() ? ConfigurationMetaData.MESSAGE_DRIVEN_13 : 
ConfigurationMetaData.MESSAGE_DRIVEN_12;
  -
       }
        
  -     public void importEjbJarXml(Element element) throws DeploymentException {
  -             super.importEjbJarXml(element);
  +    public void importEjbJarXml(Element element) throws DeploymentException
  +    {
  +        super.importEjbJarXml(element);
                
  -             messageSelector = getElementContent(getOptionalChild(element, 
"message-selector"));
  +        messageSelector = getElementContent(getOptionalChild(element, 
"message-selector"));
   
  -             // set 
  -             Element destination = getUniqueChild(element, 
"message-driven-destination");
  -             destinationType = getElementContent(getUniqueChild(destination
  +        // set 
  +        Element destination = getUniqueChild(element, "message-driven-destination");
  +        destinationType = getElementContent(getUniqueChild(destination
   , "destination-type"));
                 
  -             if (destinationType.equals("javax.jms.Topic")) {
  -                     String subscr = getElementContent(getUniqueChild(destination, 
"subscription-durability"));
  -                     // Should we do sanity check??
  -                     if (subscr.equals("Durable"))
  -                         subscriptionDurability = DURABLE_SUBSCRIPTION;
  -                     else
  -                         subscriptionDurability = NON_DURABLE_SUBSCRIPTION;//Default
  -             }
  -             /* Skipp check of dest type, for flexibility
  -             } else if (destinationType.equals("javax.jms.Queue")) {
  -                     //Noop
  -             } else {
  -                     throw new DeploymentException("session type should be 
'Stateful' or 'Stateless'");
  -             }
  -             */
  -             // set the transaction type
  -             String transactionType = getElementContent(getUniqueChild(element, 
"transaction-type"));
  -             if (transactionType.equals("Bean")) {
  -                     containerManagedTx = false;
  -                     String ack = getElementContent(getUniqueChild(element, 
"acknowledge-mode"));
  -                     if ( ack.equals("Auto-acknowledge") || 
ack.equals("AUTO_ACKNOWLEDGE"))
  -                         acknowledgeMode = AUTO_ACKNOWLEDGE_MODE;
  -                     else
  -                         acknowledgeMode = DUPS_OK_ACKNOWLEDGE_MODE;
  -                     // else defaults to AUTO
  -             } else if (transactionType.equals("Container")) {
  -                     containerManagedTx = true;
  -                     /* My interpretation of the EJB and JMS spec leads
  -                        me to that CLIENT_ACK is the only possible
  -                        solution. A transaction is per session in JMS, and
  -                        it is not possible to get access to the transaction.
  -                        According to the JMS spec it is possible to 
  -                        multithread handling of messages (but not session),
  -                        but there is NO transaction support for this.
  -                        I,e, we can not use the JMS transaction for
  -                        message ack: hence we must use manual ack.
  -
  -                        But for NOT_SUPPORTED this is not true here we 
  -                        should have AUTO_ACKNOWLEDGE_MODE
  -
  -                        This is not true for now. For JBossMQ we relly 
  -                        completely on transaction handling. For JBossMQ, the
  -                        ackmode is actually not relevant. We keep it here
  -                        anyway, if we find that this is needed for other
  -                        JMS provider, or is not good.
  -                        
  -                     */
  -
  -                     /*
  -                      * Here we should have a way of looking up wich message class
  -                      * the MessageDriven bean implements, by doing this we might
  -                      * be able to use other MOM systems, aka XmlBlaser. TODO!
  -                      * The MessageDrivenContainer needs this too!!
  -                      */
  -                     if(getMethodTransactionType("onMessage", new Class[] {}, true) 
== MetaData.TX_REQUIRED)
  -                         acknowledgeMode = CLIENT_ACKNOWLEDGE_MODE;
  -             } else {
  -                 throw new DeploymentException("transaction type should be 'Bean' 
or 'Container'");
  -             }
  -     }
  -    public void importJbossXml(Element element) throws DeploymentException {
  -     
  +        if (destinationType.equals("javax.jms.Topic")) {
  +            String subscr = getElementContent(getUniqueChild(destination, 
"subscription-durability"));
  +            // Should we do sanity check??
  +            if (subscr.equals("Durable"))
  +                subscriptionDurability = DURABLE_SUBSCRIPTION;
  +            else
  +                subscriptionDurability = NON_DURABLE_SUBSCRIPTION;//Default
  +        }
  +        /* Skipp check of dest type, for flexibility
  +        } else if (destinationType.equals("javax.jms.Queue")) {
  +            //Noop
  +        } else {
  +            throw new DeploymentException("session type should be 'Stateful' or 
'Stateless'");
  +        }
  +        */
  +        // set the transaction type
  +        String transactionType = getElementContent(getUniqueChild(element, 
"transaction-type"));
  +        if (transactionType.equals("Bean")) {
  +            containerManagedTx = false;
  +            String ack = getElementContent(getUniqueChild(element, 
"acknowledge-mode"));
  +            if ( ack.equals("Auto-acknowledge") || ack.equals("AUTO_ACKNOWLEDGE"))
  +                acknowledgeMode = AUTO_ACKNOWLEDGE_MODE;
  +            else
  +                acknowledgeMode = DUPS_OK_ACKNOWLEDGE_MODE;
  +            // else defaults to AUTO
  +        } else if (transactionType.equals("Container")) {
  +            containerManagedTx = true;
  +            /* My interpretation of the EJB and JMS spec leads
  +               me to that CLIENT_ACK is the only possible
  +               solution. A transaction is per session in JMS, and
  +               it is not possible to get access to the transaction.
  +               According to the JMS spec it is possible to 
  +               multithread handling of messages (but not session),
  +               but there is NO transaction support for this.
  +               I,e, we can not use the JMS transaction for
  +               message ack: hence we must use manual ack.
  +
  +               But for NOT_SUPPORTED this is not true here we 
  +               should have AUTO_ACKNOWLEDGE_MODE
  +
  +               This is not true for now. For JBossMQ we relly 
  +               completely on transaction handling. For JBossMQ, the
  +               ackmode is actually not relevant. We keep it here
  +               anyway, if we find that this is needed for other
  +               JMS provider, or is not good.
  +            */
  +
  +            /*
  +             * Here we should have a way of looking up wich message class
  +             * the MessageDriven bean implements, by doing this we might
  +             * be able to use other MOM systems, aka XmlBlaser. TODO!
  +             * The MessageDrivenContainer needs this too!!
  +             */
  +            if (getMethodTransactionType("onMessage", new Class[] {}, true) == 
MetaData.TX_REQUIRED)
  +                acknowledgeMode = CLIENT_ACKNOWLEDGE_MODE;
  +        } else {
  +            throw new DeploymentException("transaction type should be 'Bean' or 
'Container'");
  +        }
  +    }
  +
  +    public void importJbossXml(Element element) throws DeploymentException
  +    {
        super.importJbossXml(element);
        // set the jndi name, (optional)                
        destinationJndiName = getElementContent(getUniqueChild(element, 
"destination-jndi-name"));
  @@ -154,6 +153,7 @@
        passwd = getElementContent(getOptionalChild(element,"mdb-passwd"));
        clientId = getElementContent(getOptionalChild(element,"mdb-client-id"));
       }        
  +
       // Package protected ---------------------------------------------
       
       // Protected -----------------------------------------------------
  
  
  
  1.7       +34 -36    jboss/src/main/org/jboss/metadata/SessionMetaData.java
  
  Index: SessionMetaData.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/metadata/SessionMetaData.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SessionMetaData.java      2001/06/18 20:01:27     1.6
  +++ SessionMetaData.java      2001/06/20 07:14:16     1.7
  @@ -15,62 +15,60 @@
    *
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Sebastien Alborini</a>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
  - *   @version $Revision: 1.6 $
  + *   @version $Revision: 1.7 $
    */
   public class SessionMetaData extends BeanMetaData {
       // Constants -----------------------------------------------------
       
       // Attributes ----------------------------------------------------
  -     private boolean stateful;
  -     private boolean containerManagedTx;
  +    private boolean stateful;
   
       // Static --------------------------------------------------------
       
       // Constructors --------------------------------------------------
       public SessionMetaData(ApplicationMetaData app)
       {
  -             super(app, BeanMetaData.SESSION_TYPE);
  -     }
  +        super(app, BeanMetaData.SESSION_TYPE);
  +    }
        
       // Public --------------------------------------------------------
       public boolean isStateful() { return stateful; }
       public boolean isStateless() { return !stateful; }
  -    public boolean isContainerManagedTx() { return containerManagedTx; }
  -     public boolean isBeanManagedTx() { return !containerManagedTx; }
                
  -     public String getDefaultConfigurationName() {
  -             if (isStateful()) {
  -                     return jdk13Enabled() ? ConfigurationMetaData.STATEFUL_13 : 
ConfigurationMetaData.STATEFUL_12;
  -             } else {
  -                     return jdk13Enabled() ? ConfigurationMetaData.STATELESS_13 : 
ConfigurationMetaData.STATELESS_12;
  -             }
  -     }
  +    public String getDefaultConfigurationName()
  +    {
  +        if (isStateful()) {
  +            return jdk13Enabled() ? ConfigurationMetaData.STATEFUL_13 : 
ConfigurationMetaData.STATEFUL_12;
  +        } else {
  +            return jdk13Enabled() ? ConfigurationMetaData.STATELESS_13 : 
ConfigurationMetaData.STATELESS_12;
  +        }
  +    }
        
  -     public void importEjbJarXml(Element element) throws DeploymentException {
  -             super.importEjbJarXml(element);
  +    public void importEjbJarXml(Element element) throws DeploymentException {
  +        super.importEjbJarXml(element);
                
  -             // set the session type 
  -             String sessionType = getElementContent(getUniqueChild(element, 
"session-type"));
  -             if (sessionType.equals("Stateful")) {
  -                     stateful = true;
  -             } else if (sessionType.equals("Stateless")) {
  -                     stateful = false;
  -             } else {
  -                     throw new DeploymentException("session type should be 
'Stateful' or 'Stateless'");
  -             }
  +        // set the session type 
  +        String sessionType = getElementContent(getUniqueChild(element, 
"session-type"));
  +        if (sessionType.equals("Stateful")) {
  +            stateful = true;
  +        } else if (sessionType.equals("Stateless")) {
  +            stateful = false;
  +        } else {
  +            throw new DeploymentException("session type should be 'Stateful' or 
'Stateless'");
  +        }
                        
  -             // set the transaction type
  -             String transactionType = getElementContent(getUniqueChild(element, 
"transaction-type"));
  -             if (transactionType.equals("Bean")) {
  -                     containerManagedTx = false;
  -             } else if (transactionType.equals("Container")) {
  -                     containerManagedTx = true;
  -             } else {
  -                     throw new DeploymentException("transaction type should be 
'Bean' or 'Container'");
  -             }
  -     }
  +        // set the transaction type
  +        String transactionType = getElementContent(getUniqueChild(element, 
"transaction-type"));
  +        if (transactionType.equals("Bean")) {
  +            containerManagedTx = false;
  +        } else if (transactionType.equals("Container")) {
  +            containerManagedTx = true;
  +        } else {
  +            throw new DeploymentException("transaction type should be 'Bean' or 
'Container'");
  +        }
  +    }
                        
  -     // Package protected ---------------------------------------------
  +    // Package protected ---------------------------------------------
       
       // Protected -----------------------------------------------------
       
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to