"""
$RCSfile: __init__.py,v $

The ZopeXMLMethods package is a Zope product.  

Author: Chip Morris <cmorris@arielpartners.com>
Modified by Philipp von Weitershausen <philikon@philikon.de>

$Id: __init__.py,v 1.4 2003/06/16 05:47:53 arielpartners Exp $
"""

__cvstag__  = '$Name:  $'[6:-2]
__date__    = '$Date: 2003/06/16 05:47:53 $'[6:-2]
__version__ = '$Revision: 1.4 $'[10:-2]

# make sure, 'from Interface import Interface' works...
try:
    from zope.interface import Interface
except ImportError:
    # Zope <2.6
    import Interface
    Interface.Interface = Interface.Base
del Interface

import XMLMethod
import XSLTMethod
import XPathMethod
import DTDValidateMethod
import CacheManager

from XSLTMethod import manage_addXSLTMethod, \
     manage_addXSLTMethodForm, addXSLTMethod
from XPathMethod import manage_addXPathMethod, \
     manage_addXPathMethodForm, addXPathMethod
from DTDValidateMethod import manage_addDTDValidateMethod, \
     manage_addDTDValidateMethodForm, addDTDValidateMethod
from CacheManager import manage_addXMLMethodCacheManagerForm, \
     manage_addXMLMethodCacheManager, addXMLMethodCacheManager

methods = { "availableXSLTProcessors":  XSLTMethod.availableProcessors,
            "availableXPathProcessors": XPathMethod.availableProcessors,
            "availableDTDValidators":   DTDValidateMethod.DTDValidateMethod.availableProcessors,            
            "behaveLikeList":           XMLMethod.behaveLikeList,
            "findCacheManager":         XSLTMethod.findCacheManager }

def initialize(context):
    """
    Initialize the ZopeXMLMethods product.  This makes the object appear
    in the Zope product list menu. initialize() is called by Zope when
    starting a Zope server.
    """
    try:
        context.registerClass( XSLTMethod.XSLTMethod,
                               constructors = ( manage_addXSLTMethodForm,
                                                manage_addXSLTMethod,
                                                addXSLTMethod),
                               icon = 'www/XSLTMethod.gif' )

        context.registerClass( XPathMethod.XPathMethod,
                               constructors = ( manage_addXPathMethodForm,
                                                manage_addXPathMethod,
                                                addXPathMethod),
                               icon = 'www/XPathMethod.gif' )

        context.registerClass( DTDValidateMethod.DTDValidateMethod,
                               constructors = ( manage_addDTDValidateMethodForm,
                                                manage_addDTDValidateMethod,
                                                addDTDValidateMethod),
                               icon = 'www/DTDValidateMethod.gif' )

        context.registerClass( CacheManager.CacheManager,
                               constructors = ( manage_addXMLMethodCacheManagerForm,
                                                manage_addXMLMethodCacheManager,
                                                addXMLMethodCacheManager,
                                                XSLTMethod.findCacheManager),
                               icon = 'www/cache.gif' )

        context.registerHelp()

    except:
        import sys, traceback, string
        type, val, tb = sys.exc_info()
        sys.stderr.write(string.join(traceback.format_exception(type, val, tb), ''))
        del type, val, tb
    
