persistence@glassfish.java.net

Re: URL handling in Toplink Essential

From: Tom Ware <tom.ware_at_oracle.com>
Date: Tue, 06 Jun 2006 11:24:26 -0400

Hi Sahoo,

  I think this merits further investigation. Does JarInputStream even
cover all our cases? We have found that in some deployments on
non-compliant servers the URL we get converts to neither a File nor a
JarInputStream and we have to do some guessing when we look for
orm.xml. I have not had a chance to assess whether there is a chance
that in a compliant server (one where unlisted classes should be
included) that we will get a URL that corresponds neither to a Directory
nor a Jar file.

  It is probably worth entering a bug so this can be investigated.

-Tom

Sanjeeb Kumar Sahoo wrote:

>Hi Tom,
>
>The javadocs of PersistenceUnitInfo#getPersistenceUnitRootUrl()
>http://java.sun.com/javaee/5/docs/api/javax/persistence/spi/PersistenceUnitInfo.html#getPersistenceUnitRootUrl()
>allows a container to return a URL that does not use file protocol. I
>think we don't correctly process such URL in our code. Currently, the
>code
>https://glassfish.dev.java.net/source/browse/glassfish/entity-persistence/src/java/oracle/toplink/essentials/ejb/cmp3/persistence/PersistenceUnitProcessor.java?rev=1.15&only_with_tag=HEAD&view=auto&content-type=text/vnd.viewcvs-markup
>in
>oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor#getClassNamesFromURL
>passes the URI returned by URL#toURI() to create a File object. Will it
>work when the URL is not a file: URL?
>I think, in such a case, we should use URL#openStream() to create a
>JarInputStream and read from there. What do you think?
>
>Thanks,
>Sahoo
>
>

-- 
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com