<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    xmlns:five="http://namespaces.zope.org/five"
    i18n_domain="plone.dexterity">

    <i18n:registerTranslations directory="locales"/>

    <include package="Products.CMFCore" />

    <include package="plone.behavior" />
    <include package="plone.folder" />
    <include package="plone.supermodel" />
    <include package="plone.rfc822" />
    <include package="plone.z3cform" />
    
    <include package=".browser" />
    <include package=".fti" />
    
    <!-- Re-index content when it's modified -->
    <subscriber
        for=".interfaces.IDexterityContent
             zope.lifecycleevent.interfaces.IObjectModifiedEvent"
        handler=".content.reindexOnModify"
        />
        
    <!-- Ensure content workflow is always initialised.
        XXX: This should go away when we use CMF 2.2, which does this for us.
      -->
    <subscriber
        for=".interfaces.IDexterityContent
             zope.app.container.interfaces.IObjectAddedEvent"
        handler=".content.finishConstruction"
        />
    
    <!-- Support for dynamic schemata -->
    
    <utility
        factory=".schema.DexteritySchemaPolicy"
        name="dexterity"
        />
        
    <utility
        factory=".schema.SchemaModuleFactory"
        name="plone.dexterity.schema.generated"
        />
                
    <!-- Schema cache -->
    <subscriber handler=".schema.invalidate_schema" />

    <!-- Support for plone.behavior behaviors -->
    <adapter factory=".behavior.DexterityBehaviorAssignable" />

    <!-- Register the content classes -->
    <five:registerClass
        class=".content.Item"
        meta_type="Dexterity Item"
        permission="cmf.AddPortalContent"
        icon="plone.dexterity.item.gif"
        />
    <class class=".content.Item" />
        
    <five:registerClass
        class=".content.Container"
        meta_type="Dexterity Container"
        permission="cmf.AddPortalContent"
        icon="plone.dexterity.item.gif"
        />
    <class class=".content.Container" />
        
    <!-- Register FTI class -->
    <five:registerClass
        class=".fti.DexterityFTI"
        meta_type="Dexterity FTI"
        addview="plone.dexterity.fti"
        permission="cmf.ManagePortal"
        icon="plone.dexterity.fti.gif"
        global="False"
        />
        
    <!-- Register FTI add/remove/modify handlers -->
    
    <subscriber
        for=".interfaces.IDexterityFTI
             zope.app.container.interfaces.IObjectAddedEvent"
        handler=".fti.ftiAdded"
        />
        
    <subscriber
        for=".interfaces.IDexterityFTI
             zope.app.container.interfaces.IObjectRemovedEvent"
        handler=".fti.ftiRemoved"
        />
        
    <subscriber
        for=".interfaces.IDexterityFTI
             zope.app.container.interfaces.IObjectMovedEvent"
        handler=".fti.ftiRenamed"
        />
    
    <subscriber
        for=".interfaces.IDexterityFTI
             zope.lifecycleevent.interfaces.IObjectModifiedEvent"
        handler=".fti.ftiModified"
        />
    
    <!-- File representation (FTP/WebDAV support) -->
    <adapter factory=".filerepresentation.DefaultDirectoryFactory" />
    <adapter factory=".filerepresentation.DefaultFileFactory" />
    
    <adapter
        provides="zope.filerepresentation.interfaces.IRawReadFile"
        factory=".filerepresentation.DefaultReadFile"
        />
    <adapter factory=".filerepresentation.DefaultWriteFile" />

    <!-- PrimaryFieldInfo -->
    <adapter factory=".primary.PrimaryFieldInfo"/>
</configure>
