Import of working code base

Signed-off-by: martin f. krafft <madduck@madduck.net>
diff --git a/output/__init__.py b/output/__init__.py
new file mode 100644
index 0000000..75f6f4a
--- /dev/null
+++ b/output/__init__.py
@@ -0,0 +1,33 @@
+#
+# -*- coding: utf-8 -*-
+#
+# This file is part of reclass (http://github.com/madduck/reclass)
+#
+# Copyright © 2007–13 martin f. krafft <madduck@madduck.net>
+# Released under the terms of the Artistic Licence 2.0
+#
+class OutputterBase(object):
+
+    def __init__(self):
+        pass
+
+    def dump(self, data, pretty_print=False):
+        raise NotImplementedError, "dump() method not yet implemented"
+
+
+class OutputLoader(object):
+
+    def __init__(self, outputter):
+        self._name = outputter + '_outputter'
+        try:
+            self._module = __import__(self._name, globals(), locals(),
+                                      self._name)
+        except ImportError:
+            raise NotImplementedError
+
+    def load(self, attr='Outputter'):
+        klass = getattr(self._module, attr, None)
+        if klass is None:
+            raise AttributeError, \
+                'Outputter class {0} does not export "{1}"'.format(self._name, klass)
+        return klass
diff --git a/output/json_outputter.py b/output/json_outputter.py
new file mode 100644
index 0000000..25fa8bc
--- /dev/null
+++ b/output/json_outputter.py
@@ -0,0 +1,17 @@
+#
+# -*- coding: utf-8 -*-
+#
+# This file is part of reclass (http://github.com/madduck/reclass)
+#
+# Copyright © 2007–13 martin f. krafft <madduck@madduck.net>
+# Released under the terms of the Artistic Licence 2.0
+#
+from output import OutputterBase
+import json
+
+class Outputter(OutputterBase):
+
+    def dump(self, data, pretty_print=False):
+        separators = (',', ': ') if pretty_print else (',', ':')
+        indent = 2 if pretty_print else None
+        return json.dumps(data, indent=indent, separators=separators)
diff --git a/output/yaml_outputter.py b/output/yaml_outputter.py
new file mode 100644
index 0000000..493f5cb
--- /dev/null
+++ b/output/yaml_outputter.py
@@ -0,0 +1,15 @@
+#
+# -*- coding: utf-8 -*-
+#
+# This file is part of reclass (http://github.com/madduck/reclass)
+#
+# Copyright © 2007–13 martin f. krafft <madduck@madduck.net>
+# Released under the terms of the Artistic Licence 2.0
+#
+from output import OutputterBase
+import yaml
+
+class Outputter(OutputterBase):
+
+    def dump(self, data, pretty_print=False):
+        return yaml.dump(data, default_flow_style=not pretty_print)