generic: move generic's code from dsde to the generic header

The Factory class, the Factory and Generic exceptions must be moved into
the generic headers.