|
From: <tr...@us...> - 2003-08-27 03:13:42
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv27423/src/com/babeldoc/core/pipeline/simple
Modified Files:
SimplePipelineStageFactory.java
Log Message:
Now pipeline stage factories get to be IConfigurable too!! This is to support the work I am doing in the J2ee module.
Index: SimplePipelineStageFactory.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/simple/SimplePipelineStageFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SimplePipelineStageFactory.java 12 Aug 2003 23:44:44 -0000 1.6
--- SimplePipelineStageFactory.java 27 Aug 2003 03:13:35 -0000 1.7
***************
*** 68,75 ****
import com.babeldoc.core.config.ConfigService;
import com.babeldoc.core.config.IConfig;
! import com.babeldoc.core.pipeline.IPipelineStageFactory;
! import com.babeldoc.core.pipeline.PipelineStageFactory;
! import com.babeldoc.core.pipeline.PipelineException;
! import com.babeldoc.core.option.IConfigData;
--- 68,76 ----
import com.babeldoc.core.config.ConfigService;
import com.babeldoc.core.config.IConfig;
! import com.babeldoc.core.pipeline.*;
! import com.babeldoc.core.option.*;
!
! import java.util.Collection;
! import java.util.ArrayList;
***************
*** 85,104 ****
extends PipelineStageFactory
implements IPipelineStageFactory {
/** Configuration constants */
public static final String CONFIG_FILENAME = "configFile";
/**
! * Set the options. Extract the name of the configuration file and then do
! * the setup.
*
! * @param options map of configuration options (possibly nested)
*/
! public void setOptions(IConfigData options)
! throws PipelineException{
! super.setOptions(options);
! String configFile = options.getValue(CONFIG_FILENAME);
! IConfig config = ConfigService.getInstance().getConfig(configFile);
! setResolver(new SimplePipelineStageResolver(config));
}
}
--- 86,155 ----
extends PipelineStageFactory
implements IPipelineStageFactory {
+
/** Configuration constants */
public static final String CONFIG_FILENAME = "configFile";
+ /** Keep reference to the configuration information */
+ private IConfigInfo info;
+
/**
! * Get the configuration iformation for this class
*
! * @return IConfigInfo object
*/
! public IConfigInfo getInfo() {
! if(info==null) {
! info = new PipelineStageFactoryInfo() {
! /**
! * This method returns type specific options
! *
! * @return comments
! */
! public Collection getTypeSpecificOptions() {
! Collection specific = new ArrayList();
! specific.add(new ConfigOption(CONFIG_FILENAME, IConfigOptionType.STRING,
! null, true, "Configuration data filename"));
!
! return specific;
! }
!
! /**
! * Return description of this worker
! *
! * @return description
! */
! public String getDescription() {
! return "Simple pipeline stage factory reads its pipeline configuration from configuration objects";
! }
!
! /**
! * return the name
! *
! * @return
! */
! public String getName() {
! return "simple";
! }
! };
! }
!
! return info;
! }
!
! /**
! * Get the resolver. If the resolver is null, then extract
! * whatever information from the configuration options to
! * create the resolver.
! *
! * @return a reference to the pipeline stage resolver
! */
! public IPipelineStageResolver getResolver() {
! if(resolver==null) {
! String configFile = getInfo().getStrValue(CONFIG_FILENAME);
! IConfig config = ConfigService.getInstance().getConfig(configFile);
! resolver = new SimplePipelineStageResolver(config);
! }
! return resolver;
}
}
|