geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Apache-licensed fscontext.jar and providerutil.jar?
Date Mon, 16 Jan 2006 01:36:03 GMT
Is this part of a test to see if the JDOHelper jndi lookup works?  If  
so, you can definitely use our ReadOnlyContext, although you will  
have to "bind" differently.  I think we have a read-write context  
also, but it hasn't been used much lately.  Also I think it is pretty  
easy to write an even simpler jndi context that would work just for a  
test.  If we know a bit more about what you need we can give you  
better suggestions ;-)

thanks
david jencks

On Jan 15, 2006, at 3:46 PM, Craig L Russell wrote:

> Hi,
>
> Please reply directly as I am not on this alias.
>
> In the Apache JDO project we download the fscontext.jar and  
> providerutil.jar from Sun which is a PITA because of the licensing.
>
> Is there an equivalent functionality available in Geronimo that can  
> be used? I downloaded the naming and naming-builder jars but I  
> can't tell at first glance if they have the goods.
>
> What we use the jars for is to bind an instance to a naming context  
> and then look it up:
>
>     protected PersistenceManagerFactory getPMF(String name) {
>         Context context = null;
>         try {
>             //We need a JNDI context which contains a PMF instance.
>             //For this reason, we create a JNDI context,
>             //create a PMF instance and bind that to the context.
>             context = new InitialContext();
>             if (name.equals(validPropertiesFile)) {
>                 PersistenceManagerFactory pmf =
>                     JDOHelper.getPersistenceManagerFactory(new File 
> (name));
>                 verifyProperties(pmf, loadProperties 
> (validPropertiesFile));
>                 context.bind(jndiName, pmf);
>             }
>             return JDOHelper.getPersistenceManagerFactory(jndiName,  
> context);
>         } catch (NamingException e) {
>             throw new JDOFatalException("Caught NamingException  
> trying to bind " +
>                     e.getMessage(), e);
>         } finally {
>             if (context != null) {
>                 try {
>                     context.unbind(jndiName);
>                     context.close();
>                 } catch (NamingException e) {
>                     fail("Caught NamingException trying to unbind  
> or close." +
>                             e.getMessage());
>                     // stay quiet
>                 }
>             }
>         }
>     }
>
> Thanks for any help,
>
> Craig
>
> Craig Russell
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
>


Mime
View raw message