You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/01/11 17:14:34 UTC
svn commit: r1230120 -
/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Author: rmannibucau
Date: Wed Jan 11 16:14:34 2012
New Revision: 1230120
URL: http://svn.apache.org/viewvc?rev=1230120&view=rev
Log:
normally everything should be fine simply scanning pu with the old way
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1230120&r1=1230119&r2=1230120&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java Wed Jan 11 16:14:34 2012
@@ -78,7 +78,6 @@ import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
import static org.apache.openejb.config.NewLoaderLogic.applyBuiltinExcludes;
import static org.apache.openejb.util.URLs.toFile;
@@ -196,8 +195,8 @@ public class DeploymentLoader implements
final ResourceFinder finder = new ResourceFinder("", urls.toArray(new URL[urls.size()]));
otherDD = getDescriptors(finder, false);
- addWebPersistenceDD("persistence.xml", file, baseUrl, otherDD, appModule);
- addWebPersistenceDD("persistence-fragment.xml", file, baseUrl, otherDD, appModule);
+ addWebPersistenceDD("persistence.xml", otherDD, appModule);
+ addWebPersistenceDD("persistence-fragment.xml", otherDD, appModule);
addPersistenceUnits(appModule, baseUrl);
return appModule;
}
@@ -235,45 +234,8 @@ public class DeploymentLoader implements
}
}
- private void addWebPersistenceDD(final String name, final File file, URL baseUrl, final Map<String, URL> otherDD, final AppModule appModule) {
- URL persistenceUrl = null;
- if (file.isDirectory()) {
- File persistenceXml = new File(file, "WEB-INF/classes/META-INF/" + name);
- if (persistenceXml.exists() && persistenceXml.isFile()) {
- try {
- persistenceUrl = persistenceXml.toURI().toURL();
- } catch (MalformedURLException e) {
- // no-op
- }
- }
- } else { // .war
- JarFile jf;
- try {
- jf = new JarFile(file);
- ZipEntry entry = jf.getEntry("WEB-INF/classes/META-INF/" + name);
- if (entry != null) {
- String base = baseUrl.toString();
- if (!base.startsWith("jar:")) {
- base = "jar:" + base;
- try {
- baseUrl = new URL(base + "!/WEB-INF/classes");
- } catch (MalformedURLException e) {
- // ignored
- }
- }
-
- try {
- persistenceUrl = new URL(base + "!/WEB-INF/classes/META-INF/" + name);
- } catch (MalformedURLException e) {
- // no-op
- }
- }
- } catch (IOException e) {
- // ignored
- }
- }
-
- if (persistenceUrl != null || otherDD.containsKey(name)) {
+ private void addWebPersistenceDD(final String name, final Map<String, URL> otherDD, final AppModule appModule) {
+ if (otherDD.containsKey(name)) {
List<URL> persistenceUrls = (List<URL>) appModule.getAltDDs().get(name);
if (persistenceUrls == null) {
persistenceUrls = new ArrayList<URL>();
@@ -283,31 +245,10 @@ public class DeploymentLoader implements
if (otherDD.containsKey(name)) {
final URL otherUrl = otherDD.get(name);
if (!persistenceUrls.contains(otherUrl)) {
- persistenceUrls.add(otherDD.get(name));
- }
- }
-
- if (persistenceUrl != null && !containsUnpackVersion(persistenceUrls, persistenceUrl)) {
- try {
- persistenceUrls.add(persistenceUrl);
- } catch (Exception e) {
- // no-op
- }
- }
- }
- }
-
- private boolean containsUnpackVersion(final List<URL> list, final URL url) {
- String urlStr = url.toExternalForm();
- if (urlStr.contains("!")) { // a packed version so check it is not already included in list
- urlStr = urlStr.substring(urlStr.lastIndexOf('!') + 1);
- for (URL i : list) {
- if (i.toExternalForm().endsWith(urlStr)) {
- return true;
+ persistenceUrls.add(otherUrl);
}
}
}
- return false;
}
protected ClassLoader getOpenEJBClassLoader(final URL url) {
Re: svn commit: r1230120 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Posted by Romain Manni-Bucau <rm...@gmail.com>.
At a moment while working on tck pu was not parsed in webapp as it was
mounths ago.
I added code to take into account webapp pu since i thought it was the
issue but it seems the issue was we were no more scanning pu in webapp and
its libs.
- Romain
Le 11 janv. 2012 18:45, "David Blevins" <da...@gmail.com> a écrit :
>
> On Jan 11, 2012, at 8:14 AM, rmannibucau@apache.org wrote:
>
> > Author: rmannibucau
> > Date: Wed Jan 11 16:14:34 2012
> > New Revision: 1230120
> >
> > URL: http://svn.apache.org/viewvc?rev=1230120&view=rev
> > Log:
> > normally everything should be fine simply scanning pu with the old way
>
> Out of curiosity, what exactly was different about the old way and the new
> way that was removed?
>
> I see the new way that was removed involved a baseUrl of some kind. What
> was that for?
>
>
> -David
>
>
Re: svn commit: r1230120 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Posted by David Blevins <da...@gmail.com>.
On Jan 11, 2012, at 8:14 AM, rmannibucau@apache.org wrote:
> Author: rmannibucau
> Date: Wed Jan 11 16:14:34 2012
> New Revision: 1230120
>
> URL: http://svn.apache.org/viewvc?rev=1230120&view=rev
> Log:
> normally everything should be fine simply scanning pu with the old way
Out of curiosity, what exactly was different about the old way and the new way that was removed?
I see the new way that was removed involved a baseUrl of some kind. What was that for?
-David