|
22 | 22 | * SOFTWARE.
|
23 | 23 | */
|
24 | 24 |
|
25 |
| -import javax.inject.Inject; |
26 |
| - |
27 | 25 | import java.io.Reader;
|
28 | 26 | import java.io.Writer;
|
29 | 27 | import java.util.Properties;
|
30 | 28 |
|
31 | 29 | import org.codehaus.modello.core.ModelloCore;
|
32 | 30 | import org.codehaus.modello.model.Model;
|
33 | 31 | import org.codehaus.modello.model.ModelValidationException;
|
| 32 | +import org.codehaus.plexus.ContainerConfiguration; |
| 33 | +import org.codehaus.plexus.DefaultContainerConfiguration; |
| 34 | +import org.codehaus.plexus.DefaultPlexusContainer; |
| 35 | +import org.codehaus.plexus.PlexusConstants; |
| 36 | +import org.codehaus.plexus.PlexusContainer; |
34 | 37 |
|
35 | 38 | /**
|
36 | 39 | * @author <a href="mailto:[email protected]">Jason van Zyl</a>
|
37 | 40 | * @author <a href="mailto:[email protected]">Trygve Laugstøl</a>
|
38 | 41 | */
|
39 | 42 | public class Modello {
|
40 |
| - private final ModelloCore core; |
| 43 | + private PlexusContainer container; |
| 44 | + |
| 45 | + private ModelloCore core; |
| 46 | + |
| 47 | + public Modello() throws ModelloException { |
| 48 | + try { |
| 49 | + ContainerConfiguration configuration = new DefaultContainerConfiguration(); |
| 50 | + configuration.setAutoWiring(true); |
| 51 | + configuration.setClassPathScanning(PlexusConstants.SCANNING_INDEX); |
| 52 | + |
| 53 | + container = new DefaultPlexusContainer(configuration); |
41 | 54 |
|
42 |
| - @Inject |
43 |
| - public Modello(ModelloCore core) { |
44 |
| - this.core = core; |
| 55 | + core = (ModelloCore) container.lookup(ModelloCore.ROLE); |
| 56 | + } catch (Exception ex) { |
| 57 | + throw new ModelloException("Error while starting plexus.", ex); |
| 58 | + } |
45 | 59 | }
|
46 | 60 |
|
47 | 61 | public void generate(Reader modelReader, String outputType, Properties parameters)
|
|
0 commit comments