Revision: 6503 http://trac.macosforge.org/projects/calendarserver/changeset/6503 Author: glyph@apple.com Date: 2010-11-01 14:15:22 -0700 (Mon, 01 Nov 2010) Log Message: ----------- Split out directory creation from root-resource initialization Modified Paths: -------------- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py =================================================================== --- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py 2010-11-01 21:15:01 UTC (rev 6502) +++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py 2010-11-01 21:15:22 UTC (rev 6503) @@ -103,46 +103,12 @@ -def getRootResource(config, resources=None): +def directoryFromConfig(config): """ - Set up directory service and resource hierarchy based on config. - Return root resource. - - Additional resources can be added to the hierarchy by passing a list of - tuples containing: path, resource class, __init__ args list, and optional - authentication scheme ("basic" or "digest"). + Create an L{AggregateDirectoryService} from the given configuration. """ - - # FIXME: this is only here to workaround circular imports - doBind() # - # Default resource classes - # - rootResourceClass = RootResource - principalResourceClass = DirectoryPrincipalProvisioningResource - calendarResourceClass = DirectoryCalendarHomeProvisioningResource - iScheduleResourceClass = IScheduleInboxResource - timezoneServiceResourceClass = TimezoneServiceResource - webCalendarResourceClass = WebCalendarResource - webAdminResourceClass = WebAdminResource - addressBookResourceClass = DirectoryAddressBookHomeProvisioningResource - directoryBackedAddressBookResourceClass = DirectoryBackedAddressBookResource - - # - # Setup the Augment Service - # - augmentClass = namedClass(config.AugmentService.type) - - log.info("Configuring augment service of type: %s" % (augmentClass,)) - - try: - augment.AugmentService = augmentClass(**config.AugmentService.params) - except IOError: - log.error("Could not start augment service") - raise - - # # Setup the Directory # directories = [] @@ -224,7 +190,52 @@ except ImportError: pass + return directory + + +def getRootResource(config, resources=None): + """ + Set up directory service and resource hierarchy based on config. + Return root resource. + + Additional resources can be added to the hierarchy by passing a list of + tuples containing: path, resource class, __init__ args list, and optional + authentication scheme ("basic" or "digest"). + """ + + # FIXME: this is only here to workaround circular imports + doBind() + # + # Default resource classes + # + rootResourceClass = RootResource + principalResourceClass = DirectoryPrincipalProvisioningResource + calendarResourceClass = DirectoryCalendarHomeProvisioningResource + iScheduleResourceClass = IScheduleInboxResource + timezoneServiceResourceClass = TimezoneServiceResource + webCalendarResourceClass = WebCalendarResource + webAdminResourceClass = WebAdminResource + addressBookResourceClass = DirectoryAddressBookHomeProvisioningResource + directoryBackedAddressBookResourceClass = DirectoryBackedAddressBookResource + + # + # Setup the Augment Service + # + augmentClass = namedClass(config.AugmentService.type) + + log.info("Configuring augment service of type: %s" % (augmentClass,)) + + try: + augment.AugmentService = augmentClass(**config.AugmentService.params) + except IOError: + log.error("Could not start augment service") + raise + + + directory = directoryFromConfig(config) + + # # Setup the ProxyDB Service # proxydbClass = namedClass(config.ProxyDBService.type)
participants (1)
-
source_changes@macosforge.org