[seam-commits] Seam SVN: r8925 - in trunk/src/main/org/jboss/seam: init and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Sep 5 14:23:47 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-09-05 14:23:47 -0400 (Fri, 05 Sep 2008)
New Revision: 8925
Modified:
trunk/src/main/org/jboss/seam/deployment/GroovyHotDeploymentStrategy.java
trunk/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java
trunk/src/main/org/jboss/seam/init/Initialization.java
Log:
Fix the testsuite
Modified: trunk/src/main/org/jboss/seam/deployment/GroovyHotDeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/GroovyHotDeploymentStrategy.java 2008-09-05 17:44:14 UTC (rev 8924)
+++ trunk/src/main/org/jboss/seam/deployment/GroovyHotDeploymentStrategy.java 2008-09-05 18:23:47 UTC (rev 8925)
@@ -31,9 +31,9 @@
* groovy Seam components are placed
*
*/
- public GroovyHotDeploymentStrategy(ClassLoader classLoader, File hotDeployDirectory)
+ public GroovyHotDeploymentStrategy(ClassLoader classLoader, File hotDeployDirectory, boolean enabled)
{
- super(classLoader, hotDeployDirectory);
+ super(classLoader, hotDeployDirectory, enabled);
groovyDeploymentHandler = new GroovyDeploymentHandler(DEFAULT_SCRIPT_EXTENSION);
getDeploymentHandlers().put(GroovyDeploymentHandler.NAME, groovyDeploymentHandler);
}
Modified: trunk/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java 2008-09-05 17:44:14 UTC (rev 8924)
+++ trunk/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java 2008-09-05 18:23:47 UTC (rev 8925)
@@ -50,20 +50,29 @@
private ComponentDeploymentHandler componentDeploymentHandler;
private AnnotationDeploymentHandler annotationDeploymentHandler;
+
+ private ClassLoader classLoader;
/**
* @param classLoader The parent classloader of the hot deployment classloader
* @param hotDeployDirectory The directory in which hot deployable Seam
* components are placed
*/
- public HotDeploymentStrategy(ClassLoader classLoader, File hotDeployDirectory)
+ public HotDeploymentStrategy(ClassLoader classLoader, File hotDeployDirectory, boolean enabled)
{
- initHotDeployClassLoader(classLoader, hotDeployDirectory);
- componentDeploymentHandler = new ComponentDeploymentHandler();
- getDeploymentHandlers().put(ComponentDeploymentHandler.NAME, componentDeploymentHandler);
- annotationDeploymentHandler = new AnnotationDeploymentHandler(getPropertyValues(AnnotationDeploymentHandler.ANNOTATIONS_KEY), classLoader);
- getDeploymentHandlers().put(AnnotationDeploymentHandler.NAME, annotationDeploymentHandler);
- getDeploymentHandlers().put(DotPageDotXmlDeploymentHandler.NAME, new DotPageDotXmlDeploymentHandler());
+ if (enabled)
+ {
+ this.classLoader = Thread.currentThread().getContextClassLoader();
+ initHotDeployClassLoader(classLoader, hotDeployDirectory);
+ if (hotDeployDirectory != null && hotDeployDirectory.exists())
+ {
+ componentDeploymentHandler = new ComponentDeploymentHandler();
+ getDeploymentHandlers().put(ComponentDeploymentHandler.NAME, componentDeploymentHandler);
+ annotationDeploymentHandler = new AnnotationDeploymentHandler(getPropertyValues(AnnotationDeploymentHandler.ANNOTATIONS_KEY), classLoader);
+ getDeploymentHandlers().put(AnnotationDeploymentHandler.NAME, annotationDeploymentHandler);
+ }
+ getDeploymentHandlers().put(DotPageDotXmlDeploymentHandler.NAME, new DotPageDotXmlDeploymentHandler());
+ }
}
private void initHotDeployClassLoader(ClassLoader classLoader, File hotDeployDirectory)
@@ -77,11 +86,6 @@
hotDeployClassLoader = new URLClassLoader(urls, classLoader);
getFiles().add(hotDeployDirectory);
}
- else
- {
- hotDeployClassLoader = classLoader;
- }
-
}
catch (MalformedURLException mue)
{
@@ -89,6 +93,16 @@
}
}
+ public boolean isEnabled()
+ {
+ return classLoader != null;
+ }
+
+ public boolean isHotDeployClasslLoaderEnabled()
+ {
+ return hotDeployClassLoader != null;
+ }
+
@Override
protected String getDeploymentHandlersKey()
{
@@ -120,13 +134,13 @@
* @param hotDeployDirectory The directory which contains hot deployable
* Seam components
*/
- public static HotDeploymentStrategy createInstance(String className, ClassLoader classLoader, File hotDeployDirectory)
+ public static HotDeploymentStrategy createInstance(String className, ClassLoader classLoader, File hotDeployDirectory, boolean enabled)
{
try
{
Class initializer = Reflections.classForName(className);
- Constructor ctr = initializer.getConstructor(ClassLoader.class, File.class);
- return (HotDeploymentStrategy) ctr.newInstance(classLoader, hotDeployDirectory);
+ Constructor ctr = initializer.getConstructor(ClassLoader.class, File.class, boolean.class);
+ return (HotDeploymentStrategy) ctr.newInstance(classLoader, hotDeployDirectory, enabled);
}
catch (Exception e)
{
@@ -137,7 +151,7 @@
@Override
public ClassLoader getClassLoader()
{
- return hotDeployClassLoader;
+ return hotDeployClassLoader != null ? hotDeployClassLoader : classLoader;
}
/**
Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java 2008-09-05 17:44:14 UTC (rev 8924)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java 2008-09-05 18:23:47 UTC (rev 8925)
@@ -637,10 +637,13 @@
installComponents(init);
- if (hotDeploymentStrategy != null)
+ if (hotDeploymentStrategy.isEnabled())
{
hotDeploymentStrategy.scan();
- installHotDeployableComponents();
+ if (hotDeploymentStrategy.isHotDeployClasslLoaderEnabled())
+ {
+ installHotDeployableComponents();
+ }
// TODO Hack
hotDeploymentStrategy.getFiles().add(warRootDirectory);
init.setHotDeployPaths( hotDeploymentStrategy.getHotDeploymentPaths() );
@@ -700,22 +703,15 @@
private HotDeploymentStrategy createHotDeployment(ClassLoader classLoader)
{
- if ( isDebugEnabled() )
+ if (isGroovyPresent())
{
- if (isGroovyPresent())
- {
- log.debug("Using Java + Groovy hot deploy");
- return HotDeploymentStrategy.createInstance("org.jboss.seam.deployment.GroovyHotDeploymentStrategy", classLoader, hotDeployDirectory);
- }
- else
- {
- log.debug("Using Java hot deploy");
- return new HotDeploymentStrategy(classLoader, hotDeployDirectory);
- }
+ log.debug("Using Java + Groovy hot deploy");
+ return HotDeploymentStrategy.createInstance("org.jboss.seam.deployment.GroovyHotDeploymentStrategy", classLoader, hotDeployDirectory, isDebugEnabled());
}
- else
+ else
{
- return null;
+ log.debug("Using Java hot deploy");
+ return new HotDeploymentStrategy(classLoader, hotDeployDirectory, isDebugEnabled());
}
}
@@ -1038,7 +1034,7 @@
descriptor.getJndiName()
);
context.set(componentName, component);
- if ( hotDeploymentStrategy != null && !hotDeploymentStrategy.getClassLoader().equals(getClass().getClassLoader()) && hotDeploymentStrategy.isFromHotDeployClassLoader( descriptor.getComponentClass() ) )
+ if ( hotDeploymentStrategy.isEnabled() && hotDeploymentStrategy.isFromHotDeployClassLoader( descriptor.getComponentClass() ) )
{
Init.instance().addHotDeployableComponent( component.getName() );
}
More information about the seam-commits
mailing list