Author: rhauch
Date: 2009-04-23 14:13:36 -0400 (Thu, 23 Apr 2009)
New Revision: 851
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaEngine.java
Log:
DNA-58 Create repository configuration and component
Minor change to allow a subclass to define the SessionFactory used by the
SequencingService. The configuration for the JCR engine may need to provide its own
SessionFactory implementation (or instance).
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaEngine.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaEngine.java 2009-04-23
18:09:01 UTC (rev 850)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaEngine.java 2009-04-23
18:13:36 UTC (rev 851)
@@ -76,6 +76,7 @@
private final ExecutionContext context;
private final List<AdministeredService> services;
+ private final SessionFactory jcrSessionFactory;
private final RepositoryService repositoryService;
private final ObservationService observationService;
private final SequencingService sequencingService;
@@ -109,8 +110,8 @@
// Create the sequencing service ...
executorService = new ScheduledThreadPoolExecutor(10); // Use a magic number for
now
sequencingService = new SequencingService();
- SessionFactory sessionFactory = new SimpleSessionFactory();
- JcrExecutionContext jcrContext = new JcrExecutionContext(context, sessionFactory,
"");
+ jcrSessionFactory = createSessionFactory();
+ JcrExecutionContext jcrContext = new JcrExecutionContext(context,
jcrSessionFactory, "");
sequencingService.setExecutionContext(jcrContext);
sequencingService.setExecutorService(executorService);
for (SequencerConfig sequencerConfig : scanner.getSequencingConfigurations()) {
@@ -135,6 +136,15 @@
}
/**
+ * Method that can be overridden in subclasses to create (and populate) the
SessionFactory used by the sequencing service.
+ *
+ * @return a session factory, which may not be null
+ */
+ protected SessionFactory createSessionFactory() {
+ return new SimpleSessionFactory();
+ }
+
+ /**
* Get the problems that were encountered when setting up this engine from the
configuration.
*
* @return the problems, which may be empty but will never be null
Show replies by date