i changed the exception-handling of the new producers and localizers to use the multe...
[mir.git] / source / mircoders / producer / StartPageProducerFactory.java
1 package mircoders.producer;
2
3 import java.util.*;
4 import mir.entity.*;
5 import mir.producer.*;
6 import mircoders.storage.*;
7 import mircoders.module.*;
8
9 public class StartPageProducerFactory implements ProducerFactory {
10   private String generatorIdentifier;
11   private String resourceBundle;
12   private String outputFile;
13   private int nrNewswireItems;
14   private int nrFeatures;
15
16   public StartPageProducerFactory(
17     String aGeneratorIdentifier,
18     String aResourceBundle,
19     String anOutputFile,
20     int aNrFeatures,
21     int aNrNewswireItems) {
22
23     generatorIdentifier = aGeneratorIdentifier;
24     resourceBundle = aResourceBundle;
25     outputFile = anOutputFile;
26     nrFeatures = aNrFeatures;
27     nrNewswireItems = aNrNewswireItems;
28   }
29
30
31   public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure {
32
33     try {
34       ModuleContent contentModule = new ModuleContent(DatabaseContent.getInstance());
35       ModuleTopics topicsModule = new ModuleTopics(DatabaseTopics.getInstance());
36       ModuleBreaking breakingModule = new ModuleBreaking(DatabaseBreaking.getInstance());
37
38       return new StartPageProducer(
39                     generatorIdentifier,
40                     resourceBundle,
41                     outputFile,
42                     contentModule.getNewsWire(0,nrNewswireItems),
43                     contentModule.getFeatures(0,nrFeatures),
44                     topicsModule .getTopicsList(),
45                     breakingModule.getBreakingNews());
46     }
47     catch (Throwable e) {
48       throw new ProducerFailure("Creating StartPageProducer failed",e);
49     }
50   };
51
52   public Iterator verbs() {
53     Vector verbList = new Vector();
54
55     verbList.add("all");
56
57     return verbList.iterator();
58   };
59 }
60