|
|
dc97cd |
From e501d0ee85bb661173c4c5c3fd1c74fabe78c2e3 Mon Sep 17 00:00:00 2001
|
|
|
dc97cd |
From: Michal Srb <msrb@redhat.com>
|
|
|
dc97cd |
Date: Wed, 10 Apr 2013 11:30:35 +0200
|
|
|
dc97cd |
Subject: [PATCH] Migrate to plexus-containers-container-default
|
|
|
dc97cd |
|
|
|
dc97cd |
---
|
|
|
dc97cd |
.../component/factory/bsh/BshComponentFactory.java | 26 +++++++++++++++++-----
|
|
|
dc97cd |
1 file changed, 20 insertions(+), 6 deletions(-)
|
|
|
dc97cd |
|
|
|
dc97cd |
diff --git a/src/main/java/org/codehaus/plexus/component/factory/bsh/BshComponentFactory.java b/src/main/java/org/codehaus/plexus/component/factory/bsh/BshComponentFactory.java
|
|
|
dc97cd |
index f2f3437..5e39fcf 100644
|
|
|
dc97cd |
--- a/src/main/java/org/codehaus/plexus/component/factory/bsh/BshComponentFactory.java
|
|
|
dc97cd |
+++ b/src/main/java/org/codehaus/plexus/component/factory/bsh/BshComponentFactory.java
|
|
|
dc97cd |
@@ -8,6 +8,8 @@ import org.codehaus.plexus.PlexusContainer;
|
|
|
dc97cd |
import org.codehaus.plexus.component.factory.AbstractComponentFactory;
|
|
|
dc97cd |
import org.codehaus.plexus.component.factory.ComponentInstantiationException;
|
|
|
dc97cd |
import org.codehaus.plexus.component.repository.ComponentDescriptor;
|
|
|
dc97cd |
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
|
|
dc97cd |
+import org.codehaus.plexus.logging.Logger;
|
|
|
dc97cd |
import org.codehaus.plexus.util.IOUtil;
|
|
|
dc97cd |
|
|
|
dc97cd |
import java.io.FileNotFoundException;
|
|
|
dc97cd |
@@ -68,24 +70,31 @@ public class BshComponentFactory
|
|
|
dc97cd |
catch ( EvalError evalError )
|
|
|
dc97cd |
{
|
|
|
dc97cd |
containerRealm.display();
|
|
|
dc97cd |
-
|
|
|
dc97cd |
- container.getLogger().info( "Error text: " + evalError.getErrorText() );
|
|
|
dc97cd |
-
|
|
|
dc97cd |
+
|
|
|
dc97cd |
+ try
|
|
|
dc97cd |
+ {
|
|
|
dc97cd |
+ container.lookup( Logger.class ).info( "Error text: " + evalError.getErrorText() );
|
|
|
dc97cd |
+ }
|
|
|
dc97cd |
+ catch ( ComponentLookupException e )
|
|
|
dc97cd |
+ {
|
|
|
dc97cd |
+ throw new ComponentInstantiationException( e );
|
|
|
dc97cd |
+ }
|
|
|
dc97cd |
+
|
|
|
dc97cd |
throw new ComponentInstantiationException( "Cannot build component for: " +
|
|
|
dc97cd |
- componentDescriptor.getComponentKey() +
|
|
|
dc97cd |
+ componentDescriptor.toString() +
|
|
|
dc97cd |
"; unable to read BeanShell script", evalError );
|
|
|
dc97cd |
}
|
|
|
dc97cd |
catch ( FileNotFoundException e )
|
|
|
dc97cd |
{
|
|
|
dc97cd |
containerRealm.display();
|
|
|
dc97cd |
throw new ComponentInstantiationException( "Cannot build component for: " +
|
|
|
dc97cd |
- componentDescriptor.getComponentKey() +
|
|
|
dc97cd |
+ componentDescriptor.toString() +
|
|
|
dc97cd |
"; unable to read BeanShell script", e );
|
|
|
dc97cd |
}
|
|
|
dc97cd |
catch ( IOException e )
|
|
|
dc97cd |
{
|
|
|
dc97cd |
throw new ComponentInstantiationException( "Cannot build component for: " +
|
|
|
dc97cd |
- componentDescriptor.getComponentKey() +
|
|
|
dc97cd |
+ componentDescriptor.toString() +
|
|
|
dc97cd |
"; unable to read BeanShell script", e );
|
|
|
dc97cd |
}
|
|
|
dc97cd |
finally
|
|
|
dc97cd |
@@ -96,4 +105,9 @@ public class BshComponentFactory
|
|
|
dc97cd |
return result;
|
|
|
dc97cd |
}
|
|
|
dc97cd |
|
|
|
dc97cd |
+ public String getId()
|
|
|
dc97cd |
+ {
|
|
|
dc97cd |
+ return getClass().toString();
|
|
|
dc97cd |
+ }
|
|
|
dc97cd |
+
|
|
|
dc97cd |
}
|
|
|
dc97cd |
--
|
|
|
dc97cd |
1.8.1.4
|
|
|
dc97cd |
|