java: XML module skeleton
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 10 Sep 2016 23:08:58 +0200
changeset 2291e52083f255
parent 21 7d86d90e6e0e
child 23 4ad40aaed4bb
java: XML module skeleton
java/parameter-lister/config/META-INF/services/info.glogalcode.parameterLister.OutputModuleFactory
java/parameter-lister/src/info/glogalcode/parameterLister/modules/XmlModule.java
java/parameter-lister/src/info/glogalcode/parameterLister/modules/XmlModuleFactory.java
     1.1 --- a/java/parameter-lister/config/META-INF/services/info.glogalcode.parameterLister.OutputModuleFactory	Sat Sep 10 23:03:43 2016 +0200
     1.2 +++ b/java/parameter-lister/config/META-INF/services/info.glogalcode.parameterLister.OutputModuleFactory	Sat Sep 10 23:08:58 2016 +0200
     1.3 @@ -1,1 +1,2 @@
     1.4 -info.glogalcode.parameterLister.modules.TerminalModuleFactory
     1.5 \ No newline at end of file
     1.6 +info.glogalcode.parameterLister.modules.TerminalModuleFactory
     1.7 +info.glogalcode.parameterLister.modules.XmlModuleFactory
     1.8 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/java/parameter-lister/src/info/glogalcode/parameterLister/modules/XmlModule.java	Sat Sep 10 23:08:58 2016 +0200
     2.3 @@ -0,0 +1,26 @@
     2.4 +package info.glogalcode.parameterLister.modules;
     2.5 +
     2.6 +import info.glogalcode.parameterLister.OutputModule;
     2.7 +import info.glogalcode.parameterLister.OutputModuleException;
     2.8 +import java.io.OutputStream;
     2.9 +import java.io.PrintWriter;
    2.10 +import java.util.List;
    2.11 +
    2.12 +/**
    2.13 + *
    2.14 + * @author Ing. František Kučera (frantovo.cz)
    2.15 + */
    2.16 +public class XmlModule implements OutputModule {
    2.17 +
    2.18 +	@Override
    2.19 +	public void process(OutputStream output, List<String> parameters) throws OutputModuleException {
    2.20 +		try (PrintWriter out = new PrintWriter(output)) {
    2.21 +			for (String parameter : parameters) {
    2.22 +				out.print("xml> ");
    2.23 +				out.println(parameter);
    2.24 +				out.flush();
    2.25 +			}
    2.26 +		}
    2.27 +	}
    2.28 +
    2.29 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/java/parameter-lister/src/info/glogalcode/parameterLister/modules/XmlModuleFactory.java	Sat Sep 10 23:08:58 2016 +0200
     3.3 @@ -0,0 +1,15 @@
     3.4 +package info.glogalcode.parameterLister.modules;
     3.5 +
     3.6 +/**
     3.7 + *
     3.8 + * @author Ing. František Kučera (frantovo.cz)
     3.9 + */
    3.10 +public class XmlModuleFactory extends AbstractModuleFactory {
    3.11 +
    3.12 +	public static final String MODULE_NAME = "xml";
    3.13 +
    3.14 +	public XmlModuleFactory() {
    3.15 +		super(MODULE_NAME, XmlModule.class);
    3.16 +	}
    3.17 +
    3.18 +}