* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
- * exception to your version of the file, but you are not obligated to do so.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.producer.reader;
import java.util.Map;
+import java.io.File;
-import mir.entity.adapter.EntityAdapterModel;
import mir.producer.ProducerNode;
import mir.producer.reader.DefaultProducerNodeBuilders;
import mir.producer.reader.ProducerConfigExc;
import mir.producer.reader.ProducerNodeBuilderLibrary;
-import mir.util.XMLReader;
-import mir.util.XMLReaderTool;
+import mir.producer.reader.ProducerNodeBuilder;
+import mir.util.xml.XMLParserExc;
+import mir.util.xml.XMLReaderTool;
import mircoders.producer.ContentMarkingProducerNode;
import mircoders.producer.ContentModifyingProducerNode;
import mircoders.producer.IndexingProducerNode;
public class SupplementalProducerNodeBuilders {
- public static void registerBuilders(ProducerNodeBuilderLibrary aBuilderLibrary, EntityAdapterModel aModel) throws ProducerConfigExc {
+ public static void registerBuilders(ProducerNodeBuilderLibrary aBuilderLibrary, File aBasePath) throws ProducerConfigExc {
aBuilderLibrary.registerBuilder("ModifyContent", ContentModifyingProducerNodeBuilder.class);
aBuilderLibrary.registerBuilder("MarkContent", ContentMarkingProducerNodeBuilder.class);
aBuilderLibrary.registerBuilder("GenerateMedia", MediaGeneratingProducerNodeBuilder.class);
- aBuilderLibrary.registerBuilder("IndexContent",ContentIndexingProducerNodeBuilder.class);
- aBuilderLibrary.registerBuilder("UnIndexContent",ContentUnIndexingProducerNodeBuilder.class);
+ aBuilderLibrary.registerFactory("IndexContent", new ContentIndexingProducerNodeBuilder.factory(aBasePath));
+ aBuilderLibrary.registerFactory("UnIndexContent", new ContentUnIndexingProducerNodeBuilder.factory(aBasePath));
aBuilderLibrary.registerBuilder("PDFPreFormat", PDFPreFormattingProducerNodeBuilder.class);
aBuilderLibrary.registerBuilder("PDFGenerate", PDFGeneratingProducerNodeBuilder.class);
+// aBuilderLibrary.registerBuilder("ReportChangedFiles", );
}
private final static String MARKER_KEY_ATTRIBUTE = DefaultProducerNodeBuilders.KEY_ATTRIBUTE;
super(MARKER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(MARKER_KEY_ATTRIBUTE);
private final static String[] INDEXER_SUBNODES = {};
public static class ContentIndexingProducerNodeBuilder extends DefaultProducerNodeBuilders.AbstractProducerNodeBuilder {
-
private String key;
private String pathToIndex;
+ private File indexBasePath;
+
+ private static class factory implements ProducerNodeBuilderFactory {
+ private File sourceBasePath;
- public ContentIndexingProducerNodeBuilder() {
+ public factory(File aSourceBasePath) {
+ sourceBasePath = aSourceBasePath;
+ }
+
+ public ProducerNodeBuilder makeBuilder() {
+ return new ContentIndexingProducerNodeBuilder(sourceBasePath);
+ }
+ }
+
+ public ContentIndexingProducerNodeBuilder(File anIndexBasePath) {
super(INDEXER_SUBNODES);
+
+ indexBasePath = anIndexBasePath;
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
XMLReaderTool.checkAttributes(anAttributes, INDEXER_REQUIRED_ATTRIBUTES, INDEXER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(INDEXER_KEY_ATTRIBUTE);
};
public ProducerNode constructNode() {
- return new IndexingProducerNode(key,pathToIndex);
+ return new IndexingProducerNode(indexBasePath, key, pathToIndex);
};
}
private final static String[] UNINDEXER_SUBNODES = {};
public static class ContentUnIndexingProducerNodeBuilder extends DefaultProducerNodeBuilders.AbstractProducerNodeBuilder {
-
private String key;
private String pathToIndex;
- public ContentUnIndexingProducerNodeBuilder() {
+ private File indexBasePath;
+
+ private static class factory implements ProducerNodeBuilderFactory {
+ private File indexBasePath;
+
+ public factory(File aSourceBasePath) {
+ indexBasePath = aSourceBasePath;
+ }
+
+ public ProducerNodeBuilder makeBuilder() {
+ return new ContentUnIndexingProducerNodeBuilder(indexBasePath);
+ }
+ }
+
+ public ContentUnIndexingProducerNodeBuilder(File anIndexBasePath) {
super(UNINDEXER_SUBNODES);
+
+ indexBasePath = anIndexBasePath;
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
XMLReaderTool.checkAttributes(anAttributes, UNINDEXER_REQUIRED_ATTRIBUTES, UNINDEXER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(UNINDEXER_KEY_ATTRIBUTE);
};
public ProducerNode constructNode() {
- return new UnIndexingProducerNode(key,pathToIndex);
+ return new UnIndexingProducerNode(indexBasePath, key,pathToIndex);
};
}
super(CONTENT_MODIFIER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
XMLReaderTool.checkAttributes(anAttributes, CONTENT_MODIFIER_REQUIRED_ATTRIBUTES, CONTENT_MODIFIER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(CONTENT_MODIFIER_KEY_ATTRIBUTE);
super(MEDIA_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
XMLReaderTool.checkAttributes(anAttributes, MEDIA_REQUIRED_ATTRIBUTES, MEDIA_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(MEDIA_KEY_ATTRIBUTE);
super(MARKER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(MARKER_KEY_ATTRIBUTE);
}
public static class PDFGeneratingProducerNodeBuilder extends DefaultProducerNodeBuilders.AbstractProducerNodeBuilder {
- private final static String MARKER_KEY_ATTRIBUTE = DefaultProducerNodeBuilders.KEY_ATTRIBUTE;
private final static String PDF_GENERATOR_ATTRIBUTE = "generator";
private final static String PDF_DESTINATION_ATTRIBUTE = "destination";
private final static String PDF_STYLESHEET_ATTRIBUTE = "stylesheet";
super(MARKER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
generator = (String) anAttributes.get(PDF_GENERATOR_ATTRIBUTE);
return new PDFGeneratingProducerNode(generator,destination,stylesheet);
};
}
+
+
+ /**
+ * Builder for {@link mircoders.producer.ChangedFilesReportingProducerNode}
+ * nodes.
+ */
+/*
+ private static class ChangeReportingProducerNodeBuilder extends DefaultProducerNodeBuilders.AbstractProducerNodeBuilder {
+ private final static String DESTINATION_FILE_ATTRIBUTE = "reportFile";
+ private final static String LOCK_FILE_ATTRIBUTE = "lockfile";
+ private final static String BASE_PATH_ATTRIBUTE = "basepath";
+ private final static String EXCLUDED_PATHS_ATTRIBUTE = "excludedpaths";
+ private final static String FLUSH_ATTRIBUTE = "flush";
+ private final static String[] REQUIRED_ATTRIBUTES = {DESTINATION_FILE_ATTRIBUTE};
+ private final static String[] OPTIONAL_ATTRIBUTES = {LOCK_FILE_ATTRIBUTE, BASE_PATH_ATTRIBUTE, EXCLUDED_PATHS_ATTRIBUTE, FLUSH_ATTRIBUTE};
+ private final static String[] SUBNODES = {};
+
+ private String reportFile;
+ private String lockFile;
+ private String basePath;
+ private String excludedPaths;
+ private String flush;
+
+ public ChangeReportingProducerNodeBuilder() {
+ super(SUBNODES);
+ }
+
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ XMLReaderTool.checkAttributes(anAttributes, REQUIRED_ATTRIBUTES, OPTIONAL_ATTRIBUTES);
+
+ reportFile = XMLReaderTool.getStringAttributeWithDefault(anAttributes, DESTINATION_FILE_ATTRIBUTE, null);
+ lockFile = XMLReaderTool.getStringAttributeWithDefault(anAttributes, LOCK_FILE_ATTRIBUTE, null);
+ basePath = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BASE_PATH_ATTRIBUTE, "");
+ excludedPaths = XMLReaderTool.getStringAttributeWithDefault(anAttributes, EXCLUDED_PATHS_ATTRIBUTE, "");
+ flush = XMLReaderTool.getStringAttributeWithDefault(anAttributes, FLUSH_ATTRIBUTE, "1");
+ };
+
+ public ProducerNode constructNode() {
+ return new ChangedFilesReportingProducerNode(reportFile, lockFile, basePath, excludedPaths, flush);
+ };
+ }
+*/
}