[jboss-cvs] JBossAS SVN: r108360 - in trunk/weld-int: deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 27 17:57:17 EDT 2010
Author: alesj
Date: 2010-09-27 17:57:17 -0400 (Mon, 27 Sep 2010)
New Revision: 108360
Added:
trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryArchivesProvider.java
Modified:
trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml
trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ClasspathFactory.java
trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryDiscoveryService.java
Log:
Code to interfaces; easier to replace. ;-)
Modified: trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml
===================================================================
--- trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml 2010-09-27 20:32:25 UTC (rev 108359)
+++ trunk/weld-int/assembly/src/main/assembly/resources/META-INF/weld-deployers-jboss-beans.xml 2010-09-27 21:57:17 UTC (rev 108360)
@@ -7,10 +7,6 @@
<!-- Weld libs lookup service -->
- <bean name="WeldClasspathFactory" class="org.jboss.weld.integration.deployer.env.bda.ClasspathFactory">
- <constructor factoryMethod="getInstance" />
- </bean>
-
<bean name="LibsDiscoveryService" class="org.jboss.weld.integration.deployer.env.bda.LibraryDiscoveryService">
<constructor>
<parameter><inject bean="WeldLibsLookupDeployer"/></parameter>
@@ -24,6 +20,12 @@
</install>
</bean>
+ <bean name="WeldClasspathFactory" class="org.jboss.weld.integration.deployer.env.bda.ClasspathFactory">
+ <constructor factoryMethod="getInstance" />
+ <!-- Disable until we fix the loop -->
+ <!-- property name="libArchivesProvider"><inject bean="LibsDiscoveryService"/></property -->
+ </bean>
+
<!-- Weld deployers -->
<!-- Responsible for discovering Weld files -->
Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ClasspathFactory.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ClasspathFactory.java 2010-09-27 20:32:25 UTC (rev 108359)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/ClasspathFactory.java 2010-09-27 21:57:17 UTC (rev 108360)
@@ -68,8 +68,8 @@
// the default classpath, corresponds to DefaultDomain
private volatile Classpath defaultClasspath;
- // libs discovery service
- private LibraryDiscoveryService libsDiscoveryService;
+ // lib archives provider
+ private LibraryArchivesProvider libArchivesProvider;
// a list of domains
private final Map<Loader, WeakReference<Classpath>> domainToClasspath;
@@ -96,9 +96,9 @@
defaultDomain = system.getDefaultDomain();
}
- public void setLibsDiscoveryService(LibraryDiscoveryService libsDiscoveryService)
+ public void setLibArchivesProvider(LibraryDiscoveryService libArchivesProvider)
{
- this.libsDiscoveryService = libsDiscoveryService;
+ this.libArchivesProvider = libArchivesProvider;
}
/**
@@ -130,16 +130,16 @@
if (defaultClasspath == null)
{
Archive[] archives = new Archive[0];
- if (libsDiscoveryService != null)
+ if (libArchivesProvider != null)
{
try
{
- Set<Archive> ldsa = libsDiscoveryService.getLibraries();
+ Set<Archive> ldsa = libArchivesProvider.getLibraries();
archives = ldsa.toArray(new Archive[ldsa.size()]);
}
- catch (Exception e)
+ catch (Throwable t)
{
- log.warn("Error looking up lib archives : " + e);
+ log.warn("Error looking up lib archives.", t);
}
}
defaultClasspath = new ClasspathImpl(defaultDomain.getName(), archives);
Copied: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryArchivesProvider.java (from rev 108359, trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryDiscoveryService.java)
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryArchivesProvider.java (rev 0)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryArchivesProvider.java 2010-09-27 21:57:17 UTC (rev 108360)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.weld.integration.deployer.env.bda;
+
+import java.util.Set;
+
+/**
+ * Provide Weld library archives.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface LibraryArchivesProvider
+{
+ /**
+ * Get libraries.
+ *
+ * @return the weld libraries
+ * @throws Exception for any error
+ */
+ Set<Archive> getLibraries() throws Exception;
+}
Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryDiscoveryService.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryDiscoveryService.java 2010-09-27 20:32:25 UTC (rev 108359)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/bda/LibraryDiscoveryService.java 2010-09-27 21:57:17 UTC (rev 108360)
@@ -47,7 +47,7 @@
*
* @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
*/
-public class LibraryDiscoveryService
+public class LibraryDiscoveryService implements LibraryArchivesProvider
{
private ResourceLookupProvider<Module> provider;
private Iterable<URL> excludedUrls;
@@ -62,12 +62,6 @@
this.provider = provider;
}
- /**
- * Get libraries.
- *
- * @return the weld libraries
- * @throws Exception for any error
- */
public synchronized Set<Archive> getLibraries() throws Exception
{
if (libs == null || checked.get() == false)
More information about the jboss-cvs-commits
mailing list