01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: SiteProcessorFactory.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine;
09:
10: import com.uwyn.rife.datastructures.EnumClass;
11: import java.util.Collection;
12:
13: public class SiteProcessorFactory extends EnumClass<String> {
14: public static final String MANUAL_IDENTIFIER = "manual";
15: public static final String XML_IDENTIFIER = "xml";
16: public static final String GROOVY_IDENTIFIER = "groovy";
17: public static final String JANINO_IDENTIFIER = "janino";
18:
19: public static final SiteProcessorFactory MANUAL = new SiteProcessorFactory(
20: MANUAL_IDENTIFIER, null, null);
21: public static final SiteProcessorFactory XML = new SiteProcessorFactory(
22: XML_IDENTIFIER, "xml", new Xml2Site());
23: public static final SiteProcessorFactory GROOVY = new SiteProcessorFactory(
24: GROOVY_IDENTIFIER, "groovy", new Groovy2Site());
25: public static final SiteProcessorFactory JANINO = new SiteProcessorFactory(
26: JANINO_IDENTIFIER, "janino", new Janino2Site());
27:
28: private String mExtension = null;
29: private SiteProcessor mProcessor = null;
30:
31: public SiteProcessorFactory(String identifier, String extension,
32: SiteProcessor processor) {
33: super (identifier);
34:
35: mExtension = extension;
36: mProcessor = processor;
37: }
38:
39: public String getIdentifier() {
40: return toString();
41: }
42:
43: public String getExtension() {
44: return mExtension;
45: }
46:
47: public SiteProcessor getProcessor() {
48: return mProcessor;
49: }
50:
51: public static SiteProcessorFactory getSiteProcessorFactory(
52: String identifier) {
53: return getMember(SiteProcessorFactory.class, identifier);
54: }
55:
56: public static Collection<SiteProcessorFactory> getSiteProcessorFactories() {
57: return (Collection<SiteProcessorFactory>) getMembers(SiteProcessorFactory.class);
58: }
59: }
|