2 Replies Latest reply on Jan 4, 2007 12:33 PM by Anil Saldanha

    ObjectModelFactories parsing empty xml elements

    Anil Saldanha Master

      What should be the exact behavior of the ObjectModelFactory for parsing the following security-domain element.

       <container-configurations>
       <!-- A stateless session config that is not secured -->
       <container-configuration extends="Standard Stateless SessionBean">
       <container-name>Unsecure Stateless SessionBean</container-name>
       <security-domain/>
       </container-configuration>
       </container-configurations>
      


      Currently the JBossEjbObjectFactory has a setValue method on the ConfigurationMetaData, but I see that a setValue call is not happening for the security-domain tag.

      A similar concept exists for web.xml "auth-constraint" empty tag, but the way the WebMetaDataObjectFactory handles this is via a new AuthConstraint() object which can be either populated with 1 or more roles.

      Is there a need for a SecurityDomain object to handle this case?

      Note that the following setting works fine:
      <!-- A stateless session config that uses the spec-test-domain -->
      <container-configuration extends="Standard Stateless SessionBean">
       <container-name>Domain Stateless SessionBean</container-name>
       <security-domain>java:/jaas/spec-test-domain</security-domain>
      </container-configuration>
      


      My question in general is how should the following xml element C be handled by an ObjectModelFactory?
      <A name="xyz">
       <B>Hello Again</B>
       <C/>
       </A>
      


      This question applies to any deployer that may parse a DD. Hence the question is asked in this forum rather than XB. :)

        • 1. Re: ObjectModelFactories parsing empty xml elements
          Scott Stark Master

          There is no reason for the setValue to be called on an empty element. There would have to be both a newChild and setValue to handle both cases. You don't need a separate SecurityDomain as you can return the parent element:

           public Object newChild(ConfigurationMetaData md, UnmarshallingContext navigator,
           String namespaceURI, String localName, Attributes attrs)
           {
           Object child = null;
           if (localName.equals("cluster-config"))
           {
           child = new ClusterConfigMetaData();
           }
           else if(localName.equals("container-interceptors") ||
           localName.equals("container-cache-conf") ||
           localName.equals("container-pool-conf"))
           {
           child = new DomElement(newDomElement(localName, attrs));
           }
           else if(localName.equals("security-domain"))
           {
           child = md;
           // Indicate a security-domain element was seen...
           md.setSecurityDomain(null);
           }
           return child;
           }
          
          



          • 2. Re: ObjectModelFactories parsing empty xml elements
            Anil Saldanha Master

            Thanks Scott. That did the trick. I had tried the combination of setValue and newChild but did not figure out returning the parent element.