You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Chris Opacki <ch...@yahoo.com> on 2003/08/15 19:38:24 UTC

Re: [PATCH] JSR-88 DeploymentFactoryManager + Test

Hi Arron,
I've been working on the DDBean and the class that
loads them. In the spec examples it shows that a
DDBean is grabbing data directly from the xml
document. I was thinking that i would load the DDBeans
from elsewhere holding the required data in the
DDBeanImpl. I am creating one DDBean implementation,
one DDBeanRoot implementation and a Loader that is
responsible for parsing a zip file, reading an entry
and writing it to a temp file. I am also assuming that
we will grab child dd beans based on a relative path
from root. I'm not sure if you have started that
DDConfigBean implementations yet, but I thought it
would be good that you know what I am doing. Is anyone
else actively working on JSR88? There haven't been a
whole lot of activity on our threads. Any thoughts?
Chris

--- Aaron Mulder <am...@alumni.princeton.edu>
wrote:
> 	Here are two patches to:
> 
>  - update the deployment factory manager so that it
> throws an 
> IllegalArgumentException for bad arguments, and
> doesn't re-register an 
> identical factory more than once.
> 
>  - update the DFM tests to refer to the actual
> Geronimo DeploymentFactory
> implementation instead of the "Mock" impls, actually
> test the 
> DeploymentFactory registration and lookup, and
> revise the tests a bit 
> (don't rely on previous tests having run and set up
> static objects, etc.)
> 
> 	In addition, when these are applied, we should
> remove the classes
> 
>
modules/core/src/test/javax/enterprise/deploy/spi/MockDeploymentManager
> 
> 	and
> 
>
modules/core/src/test/javax/enterprise/deploy/spi/factories/MockDeploymentFactory
> 
> 	Because those were only used by the tests, and now
> the tests use 
> the real thing instead of the "Mock" versions.
> 
> Aaron
> > Index:
>
specs/jsr88/src/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java
>
===================================================================
> RCS file:
>
/home/cvspublic/incubator-geronimo/specs/jsr88/src/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java,v
> retrieving revision 1.1
> diff -c -r1.1 DeploymentFactoryManager.java
> ***
>
specs/jsr88/src/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java
> 14 Aug 2003 16:12:52 -0000	1.1
> ---
>
specs/jsr88/src/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java
> 15 Aug 2003 17:14:01 -0000
> ***************
> *** 68,128 ****
>   public class DeploymentFactoryManager {
>       private static DeploymentFactoryManager
> instance;
>   
> -     private ArrayList deploymentFactories = new
> ArrayList();
> - 
>       public static DeploymentFactoryManager
> getInstance() {
> !         if (instance == null) {
>               instance = new
> DeploymentFactoryManager();
>           }
>           return instance;
>       }
>   
>       public void
> registerDeploymentFactory(DeploymentFactory factory)
> {
> !           // apparently we dont care about null
> values, the Sun RI even adds the null
> !           // to the list. So after
> registerDeploymentFactory(null)
> getDeploymentFactories()
> !           // return an array with length 1.
> !           deploymentFactories.add(factory);
> !       }
>   
>       public DeploymentFactory[]
> getDeploymentFactories() {
> !         return (DeploymentFactory[])
> deploymentFactories.toArray(new
> DeploymentFactory[]{});
>       }
>   
>       public DeploymentManager
> getDeploymentManager(String uri, String username,
> String password) throws
> DeploymentManagerCreationException {
> !         // RI doesn't care about uri being null,
> neither do we
> ! 
> !         for (Iterator i =
> deploymentFactories.iterator(); i.hasNext();) {
> !             DeploymentFactory factory =
> (DeploymentFactory) i.next();
> !             if (factory != null) {
> !                 if (factory.handlesURI(uri)) {
> !                     try {
> !                         return
> factory.getDeploymentManager(uri, username,
> password);
> !                     } catch
> (DeploymentManagerCreationException e) {
> !                         // Just like the RI we
> throw a new exception with a generic message
> !                         throw new
> DeploymentManagerCreationException("Could not get
> DeploymentManager");
>                       }
>                   }
>               }
>           }
> !         throw new
> DeploymentManagerCreationException("Could not get
> DeploymentManager");
>       }
>   
>       public DeploymentManager
> getDisconnectedDeploymentManager(String uri) throws
> DeploymentManagerCreationException {
> !         // RI doesn't care about uri being null,
> neither do we
> ! 
> !         for (Iterator i =
> deploymentFactories.iterator(); i.hasNext();) {
> !             DeploymentFactory factory =
> (DeploymentFactory) i.next();
> !             if (factory != null) {
> !                 if (factory.handlesURI(uri)) {
> !                     try {
> !                         return
> factory.getDisconnectedDeploymentManager(uri);
> !                     } catch
> (DeploymentManagerCreationException e) {
> !                         // Just like the RI we
> throw a new exception with a generic message
> !                         throw new
> DeploymentManagerCreationException("Could not get
> DeploymentManager");
>                       }
>                   }
>               }
>           }
> !         throw new
> DeploymentManagerCreationException("Could not get
> DeploymentManager");
>       }
>   }
> --- 68,137 ----
>   public class DeploymentFactoryManager {
>       private static DeploymentFactoryManager
> instance;
>   
>       public static DeploymentFactoryManager
> getInstance() {
> !         if(instance == null) {
>               instance = new
> DeploymentFactoryManager();
>           }
>           return instance;
>       }
>   
> +     private ArrayList deploymentFactories = new
> ArrayList();
> + 
> +     private DeploymentFactoryManager() {
> +     }
> + 
>       public void
> registerDeploymentFactory(DeploymentFactory factory)
> {
> !         if(factory == null) {
> !             throw new
> IllegalArgumentException("DeploymentFactory to
> register should not be null");
> !         }
> !         if(!deploymentFactories.contains(factory))
> {
> !             deploymentFactories.add(factory);
> !         }
> !     }
>   
>       public DeploymentFactory[]
> getDeploymentFactories() {
> !         return
> (DeploymentFactory[])deploymentFactories.toArray(new
> DeploymentFactory[deploymentFactories.size()]);
>       }
>   
>       public DeploymentManager
> getDeploymentManager(String uri, String username,
> String password) throws
> DeploymentManagerCreationException {
> !         if(uri == null) {
> !             throw new
> IllegalArgumentException("URI for DeploymentManager
> should not be null");
> !         }
> !         DeploymentManager manager = null;
> !         for(Iterator i =
> deploymentFactories.iterator(); i.hasNext();) {
> !             DeploymentFactory factory =
> (DeploymentFactory)i.next();
> !             if(factory.handlesURI(uri)) {
> !                 try {
> !                     manager =
> factory.getDeploymentManager(uri, username,
> password);
> !                     if(manager != null) {
> !                         return manager;
>                       }
> +                 }
> catch(DeploymentManagerCreationException e) {
> +                     throw new
> DeploymentManagerCreationException("Could not get
> DeploymentManager: "+e.getMessage());
>                   }
>               }
>           }
> !         throw new
> DeploymentManagerCreationException("Could not get
> DeploymentManager; No registered DeploymentFactory
> handles this URI");
>       }
>   
>       public DeploymentManager
> getDisconnectedDeploymentManager(String uri) throws
> DeploymentManagerCreationException {
> !         if(uri == null) {
> !             throw new
> IllegalArgumentException("URI for DeploymentManager
> should not be null");
> !         }
> !         DeploymentManager manager = null;
> !         for(Iterator i =
> deploymentFactories.iterator(); 
=== message truncated ===> Index:
>
modules/core/src/test/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java
>
===================================================================
> RCS file:
>
/home/cvspublic/incubator-geronimo/modules/core/src/test/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java,v
> retrieving revision 1.1
> diff -c -r1.1 DeploymentFactoryManagerTest.java
> ***
>
modules/core/src/test/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java
> 14 Aug 2003 09:14:05 -0000	1.1
> ---
>
modules/core/src/test/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java
> 15 Aug 2003 17:13:45 -0000
> ***************
> *** 58,66 ****
>   import junit.framework.TestCase;
>   
>   import
>
javax.enterprise.deploy.spi.factories.DeploymentFactory;
> - import
>
javax.enterprise.deploy.spi.factories.MockDeploymentFactory;
>   import
>
javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
>   import
> javax.enterprise.deploy.spi.DeploymentManager;
>   
>   /**
>    * Low level tests on the
> DeploymentFactoryManager.
> --- 58,66 ----
>   import junit.framework.TestCase;
>   
>   import
>
javax.enterprise.deploy.spi.factories.DeploymentFactory;
>   import
>
javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
>   import
> javax.enterprise.deploy.spi.DeploymentManager;
> + import
>
org.apache.geronimo.enterprise.deploy.provider.GeronimoDeploymentFactory;
>   
>   /**
>    * Low level tests on the
> DeploymentFactoryManager.
> ***************
> *** 80,107 ****
>   
>       public void
>
testGetDeploymentManagerWithoutAnyRegisteredFactories()
> {
>           try {
> !            
> factoryManager.getDeploymentManager(null, null,
> null);
>           } catch
> (DeploymentManagerCreationException e) {
> !             assertEquals("Could not get
> DeploymentManager", e.getMessage());
> !             return;
>           }
> -         fail("Expected a
> DeploymentManagerCreationException");
>       }
>   
>       public void
>
testDisconnectedGetDeploymentManagerWithoutAnyRegisteredFactories()
> {
>           try {
> !            
>
factoryManager.getDisconnectedDeploymentManager(null);
>           } catch
> (DeploymentManagerCreationException e) {
> !             assertEquals("Could not get
> DeploymentManager", e.getMessage());
> !             return;
>           }
> -         fail("Expected a
> DeploymentManagerCreationException");
>       }
>   
>       public void testRegisterDeploymentFactory() {
>           int initialNumberOfFactories =
> factoryManager.getDeploymentFactories().length;
>   
> !         DeploymentFactory factory = new
> MockDeploymentFactory();
>          
> factoryManager.registerDeploymentFactory(factory);
>   
>           int expectedNumberOfFactories =
> initialNumberOfFactories + 1;
> --- 80,133 ----
>   
>       public void
>
testGetDeploymentManagerWithoutAnyRegisteredFactories()
> {
>           try {
> !            
> factoryManager.getDeploymentManager("invalid-uri",
> null, null);
> !             fail("Expected a
> DeploymentManagerCreationException");
>           } catch
> (DeploymentManagerCreationException e) {
> !            
> assertTrue(e.getMessage().startsWith("Could not get
> DeploymentManager"));
>           }
>       }
>   
>       public void
>
testDisconnectedGetDeploymentManagerWithoutAnyRegisteredFactories()
> {
>           try {
> !            
>
factoryManager.getDisconnectedDeploymentManager("invalid-uri");
> !             fail("Expected a
> DeploymentManagerCreationException");
>           } catch
> (DeploymentManagerCreationException e) {
> !            
> assertTrue(e.getMessage().startsWith("Could not get
> DeploymentManager"));
> !         }
> !     }
> ! 
> !     public void
> testGetDeploymentManagerWithNullURI() {
> !         try {
> !            
> factoryManager.getDeploymentManager(null, null,
> null);
> !             fail("Expected an
> IllegalArgumentException");
> !         } catch (IllegalArgumentException e) {
> !         } catch(DeploymentManagerCreationException
> e) {
> !             fail("Unexpected Exception:
> "+e.getMessage());
> !         }
> !     }
> ! 
> !     public void
> testDisconnectedGetDeploymentManagerWithNullURI() {
> !         try {
> !            
>
factoryManager.getDisconnectedDeploymentManager(null);
> !             fail("Expected an
> IllegalArgumentException");
> !         } catch (IllegalArgumentException e) {
> !         } catch(DeploymentManagerCreationException
> e) {
> !             fail("Unexpected Exception:
> "+e.getMessage());
> !         }
> !     }
> ! 
> !     public void testRegisterNull() {
> !         try {
> !            
> factoryManager.registerDeploymentFactory(null);
> !             fail("Should have gotten an
> IllegalArgumentException");
> !         } catch(IllegalArgumentException e) {
>           }
>       }
>   
>       public void testRegisterDeploymentFactory() {
>           int initialNumberOfFactories =
> factoryManager.getDeploymentFactories().length;
>   
> !         DeploymentFactory factory = new
> GeronimoDeploymentFactory();
>          
> factoryManager.registerDeploymentFactory(factory);
>   
>           int expectedNumberOfFactories =
> initialNumberOfFactories + 1;
> ***************
> *** 110,151 ****
>           assertEquals(expectedNumberOfFactories,
> currentNumberOfFactories);
>       }
>   
> -     /**
> -      * Relies on succesful completion of @link
> #testRegisterDeploymentFactory()
> -      * bacause we need a registered
> DeploymentManager for this test.
> -      */
>       public void testGetDeploymentManager() {
> !         int numberOfFactories =
> factoryManager.getDeploymentFactories().length;
> !         assertTrue("We should have a registered
> MockDeploymentFactory", numberOfFactories > 0);
>   
>           DeploymentManager deploymentManager =
> null;
>           try {
> !             deploymentManager =
> factoryManager.getDeploymentManager(null, null,
> null);
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

[JSR-88] DDBean Status

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
Chris,
	Where do you stand on the DDBeans?  I'm at the point where I need
some DDBeans to test with.  Do you have something ready (at least for the
first couple ejb-jar.xml tags)?  Or should I put something basic together
myself and we can add on from there?

Thanks,
	Aaron

On Fri, 15 Aug 2003, Chris Opacki wrote:
> Hi Aaron,
> I've been working on the DDBean and the class that
> loads them. In the spec examples it shows that a
> DDBean is grabbing data directly from the xml
> document. I was thinking that i would load the DDBeans
> from elsewhere holding the required data in the
> DDBeanImpl. I am creating one DDBean implementation,
> one DDBeanRoot implementation and a Loader that is
> responsible for parsing a zip file, reading an entry
> and writing it to a temp file. I am also assuming that
> we will grab child dd beans based on a relative path
> from root. I'm not sure if you have started that
> DDConfigBean implementations yet, but I thought it
> would be good that you know what I am doing. Is anyone
> else actively working on JSR88? There haven't been a
> whole lot of activity on our threads. Any thoughts?
> Chris


Re: [PATCH] JSR-88 DeploymentFactoryManager + Test

Posted by Chris Opacki <ch...@yahoo.com>.
oops....Aaron...rather.

--- Chris Opacki <ch...@yahoo.com> wrote:
> Hi Arron,
> I've been working on the DDBean and the class that
> loads them. In the spec examples it shows that a
> DDBean is grabbing data directly from the xml
> document. I was thinking that i would load the
> DDBeans
> from elsewhere holding the required data in the
> DDBeanImpl. I am creating one DDBean implementation,
> one DDBeanRoot implementation and a Loader that is
> responsible for parsing a zip file, reading an entry
> and writing it to a temp file. I am also assuming
> that
> we will grab child dd beans based on a relative path
> from root. I'm not sure if you have started that
> DDConfigBean implementations yet, but I thought it
> would be good that you know what I am doing. Is
> anyone
> else actively working on JSR88? There haven't been a
> whole lot of activity on our threads. Any thoughts?
> Chris
> 
> --- Aaron Mulder <am...@alumni.princeton.edu>
> wrote:
> > 	Here are two patches to:
> > 
> >  - update the deployment factory manager so that
> it
> > throws an 
> > IllegalArgumentException for bad arguments, and
> > doesn't re-register an 
> > identical factory more than once.
> > 
> >  - update the DFM tests to refer to the actual
> > Geronimo DeploymentFactory
> > implementation instead of the "Mock" impls,
> actually
> > test the 
> > DeploymentFactory registration and lookup, and
> > revise the tests a bit 
> > (don't rely on previous tests having run and set
> up
> > static objects, etc.)
> > 
> > 	In addition, when these are applied, we should
> > remove the classes
> > 
> >
>
modules/core/src/test/javax/enterprise/deploy/spi/MockDeploymentManager
> > 
> > 	and
> > 
> >
>
modules/core/src/test/javax/enterprise/deploy/spi/factories/MockDeploymentFactory
> > 
> > 	Because those were only used by the tests, and
> now
> > the tests use 
> > the real thing instead of the "Mock" versions.
> > 
> > Aaron
> > > Index:
> >
>
specs/jsr88/src/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java
> >
>
===================================================================
> > RCS file:
> >
>
/home/cvspublic/incubator-geronimo/specs/jsr88/src/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java,v
> > retrieving revision 1.1
> > diff -c -r1.1 DeploymentFactoryManager.java
> > ***
> >
>
specs/jsr88/src/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java
> > 14 Aug 2003 16:12:52 -0000	1.1
> > ---
> >
>
specs/jsr88/src/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java
> > 15 Aug 2003 17:14:01 -0000
> > ***************
> > *** 68,128 ****
> >   public class DeploymentFactoryManager {
> >       private static DeploymentFactoryManager
> > instance;
> >   
> > -     private ArrayList deploymentFactories = new
> > ArrayList();
> > - 
> >       public static DeploymentFactoryManager
> > getInstance() {
> > !         if (instance == null) {
> >               instance = new
> > DeploymentFactoryManager();
> >           }
> >           return instance;
> >       }
> >   
> >       public void
> > registerDeploymentFactory(DeploymentFactory
> factory)
> > {
> > !           // apparently we dont care about null
> > values, the Sun RI even adds the null
> > !           // to the list. So after
> > registerDeploymentFactory(null)
> > getDeploymentFactories()
> > !           // return an array with length 1.
> > !           deploymentFactories.add(factory);
> > !       }
> >   
> >       public DeploymentFactory[]
> > getDeploymentFactories() {
> > !         return (DeploymentFactory[])
> > deploymentFactories.toArray(new
> > DeploymentFactory[]{});
> >       }
> >   
> >       public DeploymentManager
> > getDeploymentManager(String uri, String username,
> > String password) throws
> > DeploymentManagerCreationException {
> > !         // RI doesn't care about uri being null,
> > neither do we
> > ! 
> > !         for (Iterator i =
> > deploymentFactories.iterator(); i.hasNext();) {
> > !             DeploymentFactory factory =
> > (DeploymentFactory) i.next();
> > !             if (factory != null) {
> > !                 if (factory.handlesURI(uri)) {
> > !                     try {
> > !                         return
> > factory.getDeploymentManager(uri, username,
> > password);
> > !                     } catch
> > (DeploymentManagerCreationException e) {
> > !                         // Just like the RI we
> > throw a new exception with a generic message
> > !                         throw new
> > DeploymentManagerCreationException("Could not get
> > DeploymentManager");
> >                       }
> >                   }
> >               }
> >           }
> > !         throw new
> > DeploymentManagerCreationException("Could not get
> > DeploymentManager");
> >       }
> >   
> >       public DeploymentManager
> > getDisconnectedDeploymentManager(String uri)
> throws
> > DeploymentManagerCreationException {
> > !         // RI doesn't care about uri being null,
> > neither do we
> > ! 
> > !         for (Iterator i =
> > deploymentFactories.iterator(); i.hasNext();) {
> > !             DeploymentFactory factory =
> > (DeploymentFactory) i.next();
> > !             if (factory != null) {
> > !                 if (factory.handlesURI(uri)) {
> > !                     try {
> > !                         return
> > factory.getDisconnectedDeploymentManager(uri);
> > !                     } catch
> > (DeploymentManagerCreationException e) {
> > !                         // Just like the RI we
> > throw a new exception with a generic message
> > !                         throw new
> > DeploymentManagerCreationException("Could not get
> > DeploymentManager");
> >                       }
> >                   }
> >               }
> >           }
> > !         throw new
> > DeploymentManagerCreationException("Could not get
> > DeploymentManager");
> >       }
> >   }
> > --- 68,137 ----
> >   public class DeploymentFactoryManager {
> >       private static DeploymentFactoryManager
> > instance;
> >   
> >       public static DeploymentFactoryManager
> > getInstance() {
> > !         if(instance == null) {
> >               instance = new
> > DeploymentFactoryManager();
> >           }
> >           return instance;
> >       }
> >   
> > +     private ArrayList deploymentFactories = new
> > ArrayList();
> > + 
> > +     private DeploymentFactoryManager() {
> > +     }
> > + 
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

RE: [JSR-88] DDBean Implementation

Posted by Chris Opacki <ch...@yahoo.com>.
Checking that stuff out now.

--- Jeremy Boynes <je...@coredevelopers.net> wrote:
> Have you looked at the stuff James checked in to
> xmlbeans which is meant to
> be doing something like this?
> 
> > -----Original Message-----
> > From: Chris Opacki [mailto:chris_opacki@yahoo.com]
> > Sent: Friday, August 15, 2003 11:38 AM
> > To: geronimo-dev@incubator.apache.org
> > Subject: Re: [JSR-88] DDBean Implementation
> >
> >
> > > What zip file and temp file are you referring
> to?
> >
> > I was thinking of writing the ejb-jar.xml to a
> temp
> > file and then loading the temp file into an xml
> > document object. I see that I can parse directly
> from
> > the inputstream, I will do that instead.
> >
> > I have already coded some functionality to load an
> jar
> > file and find the ejb-jar.xml entry and load it
> into
> > in inputstream.
> >
> > I didn't know about the castor generation. I will
> have
> > to read up on it. I have never used it. I have
> played
> > with JAXB a bit.
> >
> > My experience with the xml-related APIs is limited
> so
> > I'm hoping someone can point me in the right
> > direction.
> >
> > My initial thoughts were to use the DOM and load
> the
> > DDBeans rather than holding a reference to an xml
> > document. I was planning on one DDBean instance
> for
> > each tag, but I don't have to do it that way. I
> can
> > keep the reference to the xml document and parse
> data
> > from it when it is requested. I could try both and
> see
> > what performs better.
> >
> > I did mean that I would create a generic DDBean
> > implementation. I don't really see a need to
> create
> > one implementation for each tag.
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> > http://sitebuilder.yahoo.com
> >
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

RE: [JSR-88] DDBean Implementation

Posted by Jeremy Boynes <je...@coredevelopers.net>.
Have you looked at the stuff James checked in to xmlbeans which is meant to
be doing something like this?

> -----Original Message-----
> From: Chris Opacki [mailto:chris_opacki@yahoo.com]
> Sent: Friday, August 15, 2003 11:38 AM
> To: geronimo-dev@incubator.apache.org
> Subject: Re: [JSR-88] DDBean Implementation
>
>
> > What zip file and temp file are you referring to?
>
> I was thinking of writing the ejb-jar.xml to a temp
> file and then loading the temp file into an xml
> document object. I see that I can parse directly from
> the inputstream, I will do that instead.
>
> I have already coded some functionality to load an jar
> file and find the ejb-jar.xml entry and load it into
> in inputstream.
>
> I didn't know about the castor generation. I will have
> to read up on it. I have never used it. I have played
> with JAXB a bit.
>
> My experience with the xml-related APIs is limited so
> I'm hoping someone can point me in the right
> direction.
>
> My initial thoughts were to use the DOM and load the
> DDBeans rather than holding a reference to an xml
> document. I was planning on one DDBean instance for
> each tag, but I don't have to do it that way. I can
> keep the reference to the xml document and parse data
> from it when it is requested. I could try both and see
> what performs better.
>
> I did mean that I would create a generic DDBean
> implementation. I don't really see a need to create
> one implementation for each tag.
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>


Re: [JSR-88] DDBean Implementation

Posted by Chris Opacki <ch...@yahoo.com>.
> What zip file and temp file are you referring to?

I was thinking of writing the ejb-jar.xml to a temp
file and then loading the temp file into an xml
document object. I see that I can parse directly from
the inputstream, I will do that instead.

I have already coded some functionality to load an jar
file and find the ejb-jar.xml entry and load it into
in inputstream.

I didn't know about the castor generation. I will have
to read up on it. I have never used it. I have played
with JAXB a bit.

My experience with the xml-related APIs is limited so
I'm hoping someone can point me in the right
direction.

My initial thoughts were to use the DOM and load the
DDBeans rather than holding a reference to an xml
document. I was planning on one DDBean instance for
each tag, but I don't have to do it that way. I can
keep the reference to the xml document and parse data
from it when it is requested. I could try both and see
what performs better.

I did mean that I would create a generic DDBean
implementation. I don't really see a need to create
one implementation for each tag.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

[JSR-88] DDBean Implementation

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
(changing the subject since it's not related to the patch)

On Fri, 15 Aug 2003, Chris Opacki wrote:
> Hi Aaron,
> I've been working on the DDBean and the class that
> loads them. In the spec examples it shows that a
> DDBean is grabbing data directly from the xml
> document. I was thinking that i would load the DDBeans
> from elsewhere holding the required data in the
> DDBeanImpl.

	I'm not sure what you mean by that last sentence.  Can you 
elaborate?

> I am creating one DDBean implementation,
> one DDBeanRoot implementation and a Loader that is
> responsible for parsing a zip file, reading an entry
> and writing it to a temp file.

	What zip file and temp file are you referring to?  Let's start by 
assuming we're just going to work with EJB JARs (we'll worry about EARs 
later).  Then you don't need any special temp files or anything -- just 
create a new JarFile, get the Entry for META-INF/ejb-jar.xml, get the 
InputStream for that, and load it.

	Someone has already set up the infrastructure required to have 
Castor generate object to read and write XML from an InputStream.  We just 
need to add something to the build to generate objects for the ejb-jar.dtd 
(or maybe make a Schema out of it if we need to), and you could 
practically load a set of objects representing the DD in one line.  Of 
course, for these purposes, it may be better to load a DOM rather than an 
object tree (for resolving XPaths and so on), but that should still be 
pretty straightforward.  Do you have thoughts on how exactly you want to 
read the XML?

	Now when you say "one DDBean implementation", do you mean there 
will be one generic DDBean class that can represent any element, or do you 
mean you're just starting with a DDBean for "enterprise-beans" or 
something?

> I am also assuming that
> we will grab child dd beans based on a relative path
> from root. I'm not sure if you have started that
> DDConfigBean implementations yet, but I thought it
> would be good that you know what I am doing.

	I'd have to look -- I thought maybe you could do either absolute 
or relative paths, but I need to check to confirm that.	

> Is anyone
> else actively working on JSR88? There haven't been a
> whole lot of activity on our threads. Any thoughts?

	Well, Maas contributed the original API implementation, but seems
to have moved on to 77 and elsewhere.  A number of other seemed to be
interested on working on the UI, so we should probably give them a chance
to speak up too.  As far as I know, I'm the only one working on the server 
provider side for now.

Aaron