|
From: <tr...@us...> - 2003-08-27 03:13:42
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv27423/src/com/babeldoc/core/pipeline/xml
Modified Files:
XmlPipelineStageFactory.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: XmlPipelineStageFactory.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/xml/XmlPipelineStageFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** XmlPipelineStageFactory.java 12 Aug 2003 23:44:44 -0000 1.7
--- XmlPipelineStageFactory.java 27 Aug 2003 03:13:35 -0000 1.8
***************
*** 66,75 ****
package com.babeldoc.core.pipeline.xml;
! import com.babeldoc.core.I18n;
! import com.babeldoc.core.option.IConfigData;
! import com.babeldoc.core.pipeline.PipelineException;
import com.babeldoc.core.pipeline.PipelineStageFactory;
import java.io.IOException;
--- 66,79 ----
package com.babeldoc.core.pipeline.xml;
! import com.babeldoc.core.option.IConfigInfo;
! import com.babeldoc.core.option.ConfigOption;
! import com.babeldoc.core.option.IConfigOptionType;
import com.babeldoc.core.pipeline.PipelineStageFactory;
+ import com.babeldoc.core.pipeline.IPipelineStageResolver;
+ import com.babeldoc.core.pipeline.PipelineStageFactoryInfo;
import java.io.IOException;
+ import java.util.Collection;
+ import java.util.ArrayList;
***************
*** 83,116 ****
* @version 1.0
*/
! public class XmlPipelineStageFactory extends PipelineStageFactory {
/** constant: Configuration constants */
public static final String XML_FILENAME = "configFile";
/**
! * Default constructor - necessary for the dynamic loading nature of the
! * pipeline factory.
*/
! public XmlPipelineStageFactory() {
}
/**
! * Set the data. Once the the data have been set we can do the
! * configuration loving.
! *
! * @param data the hashtable of data.
*
! * @throws PipelineException DOCUMENT ME!
*/
! public void setOptions(IConfigData data) throws PipelineException {
! super.setOptions(data);
! String fileName = data.getValue(XML_FILENAME);
! try {
! setResolver(new XmlPipelineStageResolver(fileName));
! } catch (IOException e) {
! throw new PipelineException(I18n.get("002001", fileName), e);
}
}
}
--- 87,161 ----
* @version 1.0
*/
! public class XmlPipelineStageFactory
! extends PipelineStageFactory {
/** constant: Configuration constants */
public static final String XML_FILENAME = "configFile";
+ /** Keep the configuration information */
+ private IConfigInfo 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 fileName = getInfo().getStrValue(XML_FILENAME);
! try {
! resolver = new XmlPipelineStageResolver(fileName);
! } catch (IOException e) {
! getLog().logError(e);
! }
! }
! return resolver;
}
/**
! * 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(XML_FILENAME, IConfigOptionType.STRING,
! null, true, "Configuration data filename"));
! return specific;
! }
!
! /**
! * Return description of this worker
! *
! * @return description
! */
! public String getDescription() {
! return "XML pipeline stage factory reads its pipeline configuration from an xml file";
! }
!
! /**
! * return the name
! *
! * @return
! */
! public String getName() {
! return "xml";
! }
! };
}
+
+ return info;
}
}
|