bloritsch 01/02/15 13:55:53
Modified: src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
Log:
Adding Repository as first class component
Revision Changes Path
No revision
No revision
1.4.2.54 +14 -1 xml-cocoon/src/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.4.2.53
retrieving revision 1.4.2.54
diff -u -r1.4.2.53 -r1.4.2.54
--- Cocoon.java 2001/02/15 20:28:22 1.4.2.53
+++ Cocoon.java 2001/02/15 21:55:50 1.4.2.54
@@ -28,6 +28,7 @@
import org.apache.avalon.ConfigurationException;
import org.apache.avalon.Initializable;
import org.apache.cocoon.components.parser.Parser;
+import org.apache.cocoon.components.store.FilesystemStore;
import org.apache.cocoon.components.url.URLFactory;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.serialization.Serializer;
@@ -44,7 +45,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
(Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.4.2.53 $ $Date: 2001/02/15 20:28:22 $
+ * @version CVS $Revision: 1.4.2.54 $ $Date: 2001/02/15 21:55:50 $
*/
public class Cocoon extends AbstractLoggable implements Component,
Initializable, Modifiable, Processor, Contextualizable {
/** The application context */
@@ -96,17 +97,29 @@
this.componentManager = new DefaultComponentManager();
this.componentManager.contextualize(this.context);
this.componentManager.setLogger(getLogger());
+
getLogger().debug("New Cocoon object.");
// Setup the default parser, for parsing configuration.
// If one need to use a different parser, set the given system
property
String parser = System.getProperty(Constants.PARSER_PROPERTY,
Constants.DEFAULT_PARSER);
getLogger().debug("Using parser: " + parser);
+
try {
this.componentManager.addComponent(Roles.PARSER,
ClassUtils.loadClass(parser), null);
} catch (Exception e) {
getLogger().error("Could not load parser, Cocoon object not
created.", e);
throw new ConfigurationException("Could not load parser " +
parser, e);
}
+
+ try {
+ getLogger().debug("Creating Repository with this directory: " +
this.workDir);
+ FilesystemStore repository = new FilesystemStore(this.workDir);
+ this.componentManager.addComponentInstance(Roles.REPOSITORY,
repository);
+ } catch (IOException e) {
+ getLogger().error("Could not create repository!", e);
+ throw new ConfigurationException("Could not create the
repository!", e);
+ }
+
getLogger().debug("Classpath = " + classpath);
getLogger().debug("Work directory = " + workDir.getCanonicalPath());
this.configure();