Revision: 7265
Author: victormote
Date: 2006-05-26 10:09:20 -0700 (Fri, 26 May 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7265&view=rev
Log Message:
-----------
Change to a static approach.
Modified Paths:
--------------
trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java
Modified: trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java
===================================================================
--- trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java 2006-05-26 16:12:28 UTC (rev 7264)
+++ trunk/foray/foray-specific/src/java/org/foray/specific/FOraySpecific.java 2006-05-26 17:09:20 UTC (rev 7265)
@@ -26,6 +26,7 @@
import org.foray.app.FOrayException;
import org.foray.app.SessionConfig;
+import org.foray.common.Logging;
import org.foray.common.XMLParser;
import org.foray.font.FOrayFontServer;
import org.foray.graphic.FOrayGraphicServer;
@@ -44,21 +45,33 @@
import java.net.URL;
+/**
+ * Utility class that creates FOray-specific implementations of the high-level
+ * objects for each module.
+ * The purpose of the methods in this class is to simplify the task of getting
+ * FOray started up in a standard manner without diminishing the flexibility
+ * of its pluggable nature.
+ */
public class FOraySpecific {
- private Log logger;
-
- public FOraySpecific(Log logger) throws FOrayException {
- this.logger = logger;
+ /**
+ * Private constructor, as this class should never be instantiated.
+ */
+ private FOraySpecific() {
}
- public Log getLogger() {
- return this.logger;
+ public static Log makeLogger(SessionConfig configuration) {
+ if (configuration.optionVerbosity().equals("debug")) {
+ return Logging.makeDebugLogger();
+ } else {
+ return Logging.makeDefaultLogger();
+ }
}
- public FontServer makeFontServer(SessionConfig configuration,
- EntityResolver entityResolver) throws FOrayException {
- FOrayFontServer forayFontServer = new FOrayFontServer(getLogger());
+ public static FontServer makeFontServer(Log logger,
+ SessionConfig configuration, EntityResolver entityResolver)
+ throws FOrayException {
+ FOrayFontServer forayFontServer = new FOrayFontServer(logger);
forayFontServer.setBaseFontURL(
configuration.optionFontBaseDirectory());
forayFontServer.setBaseURL(configuration.optionBaseDirectory());
@@ -72,17 +85,16 @@
return forayFontServer;
}
- public TextServer makeTextServer(SessionConfig configuration)
- throws FOrayException {
+ public static TextServer makeTextServer(Log logger,
+ SessionConfig configuration) throws FOrayException {
URL hyphenationDir = configuration.optionHyphenationBaseDirectory();
- return new org.foray.text.TextServer(getLogger(),
- hyphenationDir);
+ return new org.foray.text.TextServer(logger, hyphenationDir);
}
- public GraphicServer makeGraphicServer() throws FOrayException {
- return new FOrayGraphicServer(getLogger(),
- XMLParser.getParserClassName());
+ public static GraphicServer makeGraphicServer(Log logger)
+ throws FOrayException {
+ return new FOrayGraphicServer(logger, XMLParser.getParserClassName());
}
public FOTreeFactory makeFOTreeFactory(GraphicServer graphicServer,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|