<dependency>\r
<groupId>org.codehaus.plexus</groupId>\r
<artifactId>plexus-component-api</artifactId>\r
- <version>1.0-alpha-33</version>\r
+ <version>1.0-alpha-22</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.codehaus.plexus</groupId>\r
+ <artifactId>plexus-container-default</artifactId>\r
+ <version>1.0-alpha-22</version>\r
</dependency>\r
<dependency>\r
<groupId>dom4j</groupId>\r
*/\r
\r
import java.lang.reflect.Field;\r
-import java.util.ArrayList;\r
import java.util.Collection;\r
-import java.util.HashMap;\r
import java.util.Iterator;\r
import java.util.LinkedList;\r
import java.util.List;\r
import java.util.Map;\r
\r
-import org.codehaus.plexus.PlexusConstants;\r
import org.codehaus.plexus.PlexusContainer;\r
import org.codehaus.plexus.context.Context;\r
import org.codehaus.plexus.logging.LogEnabled;\r
public class PlexusComponentFactoryBean\r
implements FactoryBean, BeanFactoryAware, DisposableBean\r
{\r
- private static final char HINT = '#';\r
+ /**\r
+ * @todo isn't there a constant for this in plexus ?\r
+ */\r
+ private static final String SINGLETON = "singleton";\r
\r
private Class role;\r
\r
private Class implementation;\r
\r
- private String instanciationStrategy;\r
+ private String instanciationStrategy = SINGLETON;\r
\r
private Map requirements;\r
\r
public Object getObject()\r
throws Exception\r
{\r
- if ( "poolable".equals( instanciationStrategy ) )\r
- {\r
- throw new BeanCreationException( "Plexus poolable instanciation-strategy is not supported" );\r
- }\r
-\r
// Spring MAY cache the object built by this factory if getSingleton()\r
- // returns true,\r
- // but can also requires us to ensure unicity.\r
- if ( "singleton".equals( instanciationStrategy ) && !instances.isEmpty() )\r
+ // returns true, but can also requires us to ensure unicity.\r
+ if ( SINGLETON.equals( instanciationStrategy ) && !instances.isEmpty() )\r
{\r
return instances.get( 0 );\r
}\r
\r
if (component instanceof Contextualizable )\r
{\r
+ // VERRY limiter support for Contextualizable\r
((Contextualizable) component).contextualize( getContext() );\r
}\r
\r
\r
public boolean isSingleton()\r
{\r
- return "per-lookup".equals( instanciationStrategy );\r
+ return SINGLETON.equals( instanciationStrategy );\r
}\r
\r
/**\r
{\r
if ( instanciationStrategy.length() == 0 )\r
{\r
- instanciationStrategy = "singleton";\r
+ instanciationStrategy = SINGLETON;\r
+ }\r
+ if ( "poolable".equals( instanciationStrategy ) )\r
+ {\r
+ throw new BeanCreationException( "Plexus poolable instanciation-strategy is not supported" );\r
}\r
this.instanciationStrategy = instanciationStrategy;\r
}\r