[CalendarServer-changes] [5147] CalendarServer/branches/users/glyph/use-system-twisted

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 17 12:55:11 PST 2010


Revision: 5147
          http://trac.macosforge.org/projects/calendarserver/changeset/5147
Author:   glyph at apple.com
Date:     2010-02-17 12:55:11 -0800 (Wed, 17 Feb 2010)
Log Message:
-----------
Merge in changes from trunk.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/sidecar/task.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/caldav.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/carddav.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/test/test_caldav.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/gateway.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/loadaugmentdb.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/manageaugments.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/principals.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/gateway/augments.xml
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/gateway/caldavd.plist
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/test_gateway.py
    CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-apple.plist
    CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-partitioning-primary.plist
    CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-partitioning-secondary.plist
    CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-test.plist
    CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd.plist
    CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd-test.plist
    CalendarServer/branches/users/glyph/use-system-twisted/run
    CalendarServer/branches/users/glyph/use-system-twisted/setup.py
    CalendarServer/branches/users/glyph/use-system-twisted/support/Makefile.Apple
    CalendarServer/branches/users/glyph/use-system-twisted/support/build.sh
    CalendarServer/branches/users/glyph/use-system-twisted/test
    CalendarServer/branches/users/glyph/use-system-twisted/testcaldav
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/accesslog.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/client/pool.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/config.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/aggregate.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/augment.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/calendaruserproxy.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/calendaruserproxyloader.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/principal.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_augment.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_calendar.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_digest.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_guidchange.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_modify.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_principal.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_proxyprincipaldb.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_proxyprincipalmembers.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_resources.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/xmlaugmentsparser.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/xmlfile.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/mail.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/method/delete_common.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/method/put_common.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/notify.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/resource.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/scheduling/implicit.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/scheduling/ischeduleservers.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/stdconfig.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_config.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_stdconfig.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_upgrade.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/util.py
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/xmlutil.py

Added Paths:
-----------
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/augments.xml
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/caldavd.plist
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/resources-locations.xml
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/users-groups.xml
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/test_principals.py
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/util.py
    CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd-apple.plist
    CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd.plist
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/resources.xml
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_xmlutil.py

Removed Paths:
-------------
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/augments.xml
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/caldavd.plist
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/resources-locations.xml
    CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/users-groups.xml
    CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd.plist.default
    CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/modify/caldavd.plist

Property Changed:
----------------
    CalendarServer/branches/users/glyph/use-system-twisted/


Property changes on: CalendarServer/branches/users/glyph/use-system-twisted
___________________________________________________________________
Modified: svn:mergeinfo
   - /CalendarServer/branches/config-separation:4379-4443
/CalendarServer/branches/egg-info-351:4589-4625
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
/CalendarServer/branches/users/sagen/locations-resources:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/branches/users/sagen/resources-2:5084-5093
/CalendarServer/trunk:5084-5104
   + /CalendarServer/branches/config-separation:4379-4443
/CalendarServer/branches/egg-info-351:4589-4625
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
/CalendarServer/branches/users/sagen/locations-resources:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/branches/users/sagen/resources-2:5084-5093
/CalendarServer/trunk:5084-5146

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/sidecar/task.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/sidecar/task.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/sidecar/task.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -22,7 +22,6 @@
     "Task",
 ]
 
-from time import sleep
 import os
 
 from zope.interface import implements
@@ -31,24 +30,19 @@
 from twisted.internet.defer import DeferredList, inlineCallbacks, returnValue
 from twisted.internet.reactor import callLater
 from twisted.plugin import IPlugin
-from twisted.python.reflect import namedClass
 from twisted.python.usage import Options, UsageError
 from twext.web2.http_headers import Headers
 
 from twext.log import Logger, LoggingMixIn
 from twext.log import logLevelForNamespace, setLogLevelForNamespace
 
-from twistedcaldav import memcachepool
 from twistedcaldav.config import config
 from twistedcaldav.stdconfig import DEFAULT_CONFIG, DEFAULT_CONFIG_FILE
-from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
 from twistedcaldav.ical import Component
-from twistedcaldav.notify import installNotificationClient
 from twistedcaldav.scheduling.cuaddress import LocalCalendarUser
 from twistedcaldav.scheduling.scheduler import DirectScheduler
-from twistedcaldav.static import CalendarHomeProvisioningFile
 
-from calendarserver.provision.root import RootResource
+from calendarserver.util import getRootResource
 
 log = Logger()
 
@@ -201,9 +195,9 @@
 
 class CalDAVTaskService(Service):
 
-    def __init__(self, root, directory):
+    def __init__(self, root):
         self.root = root
-        self.directory = directory
+        self.directory = root.directory
         self.seconds = 30 # How often to check for new tasks in incomingDir
         self.taskDir = os.path.join(config.DataRoot, "tasks")
         # New task files are placed into "incoming"
@@ -345,13 +339,6 @@
     description = "Calendar Server Task Process"
     options = CalDAVTaskOptions
 
-    #
-    # Default resource classes
-    #
-    rootResourceClass            = RootResource
-    principalResourceClass       = DirectoryPrincipalProvisioningResource
-    calendarResourceClass        = CalendarHomeProvisioningFile
-
     def makeService(self, options):
 
         #
@@ -366,71 +353,10 @@
         oldLogLevel = logLevelForNamespace(None)
         setLogLevelForNamespace(None, "info")
 
-        #
-        # Setup the Directory
-        #
-        directoryClass = namedClass(config.DirectoryService.type)
+        rootResource = getRootResource(config)
 
-        self.log_info("Configuring directory service of type: %s"
-                      % (config.DirectoryService.type,))
+        service = CalDAVTaskService(rootResource)
 
-        directory = directoryClass(config.DirectoryService.params)
-
-        # Wait for the directory to become available
-        while not directory.isAvailable():
-            sleep(5)
-
-        #
-        # Configure Memcached Client Pool
-        #
-        memcachepool.installPools(
-            config.Memcached.Pools,
-            config.Memcached.MaxClients,
-        )
-
-        #
-        # Configure NotificationClient
-        #
-        if config.Notifications.Enabled:
-            installNotificationClient(
-                config.Notifications.InternalNotificationHost,
-                config.Notifications.InternalNotificationPort,
-            )
-
-        #
-        # Setup Resource hierarchy
-        #
-        self.log_info("Setting up document root at: %s"
-                      % (config.DocumentRoot,))
-        self.log_info("Setting up principal collection: %r"
-                      % (self.principalResourceClass,))
-
-        principalCollection = self.principalResourceClass(
-            "/principals/",
-            directory,
-        )
-
-        self.log_info("Setting up calendar collection: %r"
-                      % (self.calendarResourceClass,))
-
-        calendarCollection = self.calendarResourceClass(
-            os.path.join(config.DocumentRoot, "calendars"),
-            directory, "/calendars/",
-        )
-
-        self.log_info("Setting up root resource: %r"
-                      % (self.rootResourceClass,))
-
-        root = self.rootResourceClass(
-            config.DocumentRoot,
-            principalCollections=(principalCollection,),
-        )
-
-        root.putChild("principals", principalCollection)
-        root.putChild("calendars", calendarCollection)
-
-        service = CalDAVTaskService(root, directory)
-
         # Change log level back to what it was before
         setLogLevelForNamespace(None, oldLogLevel)
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/caldav.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/caldav.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -25,7 +25,7 @@
 import socket
 import stat
 import sys
-from time import sleep, time
+from time import time
 
 from subprocess import Popen, PIPE
 from pwd import getpwnam, getpwuid
@@ -37,9 +37,7 @@
 
 from twisted.python.log import FileLogObserver
 from twisted.python.usage import Options, UsageError
-from twisted.python.reflect import namedClass
 from twisted.plugin import IPlugin
-from twisted.internet import reactor
 from twisted.internet.reactor import callLater, spawnProcess
 from twisted.internet.process import ProcessExitedAlready
 from twisted.internet.protocol import Protocol, Factory
@@ -47,11 +45,7 @@
 from twisted.application.service import Service, MultiService, IServiceMaker
 from twisted.scripts.mktap import getid
 from twisted.runner import procmon
-from twisted.cred.portal import Portal
-from twext.web2.dav import auth
-from twext.web2.auth.basic import BasicCredentialFactory
 from twext.web2.server import Site
-from twext.web2.static import File as FileResource
 
 from twext.log import Logger, LoggingMixIn
 from twext.log import logLevelForNamespace, setLogLevelForNamespace
@@ -66,30 +60,18 @@
     from version import version as getVersion
     version = "%s (%s)" % getVersion()
 
-from twistedcaldav import memcachepool
 from twistedcaldav.accesslog import AMPCommonAccessLoggingObserver
 from twistedcaldav.accesslog import AMPLoggingFactory
-from twistedcaldav.accesslog import DirectoryLogWrapperResource
 from twistedcaldav.accesslog import RotatingFileAccessLoggingObserver
 from twistedcaldav.config import ConfigurationError
 from twistedcaldav.config import config
-from twistedcaldav.directory import augment, calendaruserproxy
-from twistedcaldav.directory.aggregate import AggregateDirectoryService
-from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
-from twistedcaldav.directory.digest import QopDigestCredentialFactory
 from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
-from twistedcaldav.directory.sudo import SudoDirectoryService
-from twistedcaldav.directory.util import NotFilePath
-from twistedcaldav.directory.wiki import WikiDirectoryService
 from twistedcaldav.localization import processLocalizationFiles
 from twistedcaldav.mail import IMIPReplyInboxResource
-from twistedcaldav.notify import installNotificationClient
-from twistedcaldav.resource import CalDAVResource, AuthenticationWrapper
 from twistedcaldav.static import CalendarHomeProvisioningFile
 from twistedcaldav.static import IScheduleInboxFile
 from twistedcaldav.static import TimezoneServiceFile
 from twistedcaldav.stdconfig import DEFAULT_CONFIG, DEFAULT_CONFIG_FILE
-from twistedcaldav.timezones import TimezoneCache
 from twistedcaldav.upgrade import upgradeData
 from twistedcaldav.util import getNCPU
 
@@ -102,6 +84,7 @@
 from calendarserver.provision.root import RootResource
 from calendarserver.webadmin.resource import WebAdminResource
 from calendarserver.webcal.resource import WebCalendarResource
+from calendarserver.util import getRootResource
 
 log = Logger()
 
@@ -264,23 +247,61 @@
 
         self.parent["pidfile"] = config.PIDFile
 
+
         #
-        # Verify that document root, data root actually exist
+        # Verify that server root actually exists
         #
         self.checkDirectory(
-            config.DocumentRoot,
-            "Document root",
-            # Don't require write access because one might not allow editing on /
-            access=os.R_OK,
-            create=(0750, config.UserName, config.GroupName),
-        )
-        self.checkDirectory(
-            config.DataRoot,
-            "Data root",
+            config.ServerRoot,
+            "Server root",
+            # Require write access because one might not allow editing on /
             access=os.W_OK,
             create=(0750, config.UserName, config.GroupName),
         )
+        
+        #
+        # Verify that other root paths are OK
+        #
+        if config.DocumentRoot.startswith(config.ServerRoot + os.sep):
+            self.checkDirectory(
+                config.DocumentRoot,
+                "Document root",
+                # Don't require write access because one might not allow editing on /
+                access=os.R_OK,
+                create=(0750, config.UserName, config.GroupName),
+            )
+        if config.DataRoot.startswith(config.ServerRoot + os.sep):
+            self.checkDirectory(
+                config.DataRoot,
+                "Data root",
+                access=os.W_OK,
+                create=(0750, config.UserName, config.GroupName),
+            )
 
+        if config.ConfigRoot.startswith(config.ServerRoot + os.sep):
+            self.checkDirectory(
+                config.ConfigRoot,
+                "Config root",
+                access=os.W_OK,
+                create=(0750, config.UserName, config.GroupName),
+            )
+
+        if config.LogRoot.startswith(config.ServerRoot + os.sep):
+            self.checkDirectory(
+                config.LogRoot,
+                "Log root",
+                access=os.W_OK,
+                create=(0750, config.UserName, config.GroupName),
+            )
+
+        if config.RunRoot.startswith(config.ServerRoot + os.sep):
+            self.checkDirectory(
+                config.RunRoot,
+                "Run root",
+                access=os.W_OK,
+                create=(0750, config.UserName, config.GroupName),
+            )
+            
         #
         # Nuke the file log observer's time format.
         #
@@ -469,321 +490,17 @@
         oldLogLevel = logLevelForNamespace(None)
         setLogLevelForNamespace(None, "info")
 
-        #
-        # Setup the Directory
-        #
-        directories = []
-
-        directoryClass = namedClass(config.DirectoryService.type)
-
-        self.log_info("Configuring directory service of type: %s"
-                      % (config.DirectoryService.type,))
-
-        baseDirectory = directoryClass(config.DirectoryService.params)
-
-        # Wait for the directory to become available
-        while not baseDirectory.isAvailable():
-            sleep(5)
-
-        directories.append(baseDirectory)
-
-        #
-        # Setup the Locations and Resources Service
-        #
-        if config.ResourceService.Enabled:
-            resourceClass = namedClass(config.ResourceService.type)
-
-            self.log_info("Configuring resource service of type: %s" % (resourceClass,))
-
-            resourceDirectory = resourceClass(config.ResourceService.params)
-            directories.append(resourceDirectory)
-
-        #
-        # Add sudoers directory
-        #
-        sudoDirectory = None
-
-        if config.SudoersFile and os.path.exists(config.SudoersFile):
-            self.log_info("Configuring SudoDirectoryService with file: %s"
-                          % (config.SudoersFile,))
-
-            sudoDirectory = SudoDirectoryService(config.SudoersFile)
-            sudoDirectory.realmName = baseDirectory.realmName
-
-            CalDAVResource.sudoDirectory = sudoDirectory
-            directories.insert(0, sudoDirectory)
-        else:
-            self.log_info(
-                "Not using SudoDirectoryService; file doesn't exist: %s"
-                % (config.SudoersFile,)
-            )
-
-        #
-        # Add wiki directory service
-        #
-        if config.Authentication.Wiki.Enabled:
-            wikiDirectory = WikiDirectoryService()
-            wikiDirectory.realmName = baseDirectory.realmName
-            directories.append(wikiDirectory)
-
-        directory = AggregateDirectoryService(directories)
-        self.directory = directory
-
-        if sudoDirectory:
-            directory.userRecordTypes.insert(0,
-                SudoDirectoryService.recordType_sudoers)
-
-        #
-        # Setup the Augment Service
-        #
-        augmentClass = namedClass(config.AugmentService.type)
-
-        self.log_info("Configuring augment service of type: %s" % (augmentClass,))
-
-        try:
-            augment.AugmentService = augmentClass(**config.AugmentService.params)
-        except IOError, e:
-            self.log_error("Could not start augment service")
-            raise
-
-        #
-        # Setup the PoxyDB Service
-        #
-        proxydbClass = namedClass(config.ProxyDBService.type)
-
-        self.log_info("Configuring proxydb service of type: %s" % (proxydbClass,))
-
-        try:
-            calendaruserproxy.ProxyDBService = proxydbClass(**config.ProxyDBService.params)
-        except IOError, e:
-            self.log_error("Could not start proxydb service")
-            raise
-
-        #
-        # Make sure proxies get initialized
-        #
-        if config.ProxyLoadFromFile:
-            def _doProxyUpdate():
-                loader = XMLCalendarUserProxyLoader(config.ProxyLoadFromFile)
-                return loader.updateProxyDB()
-            
-            reactor.addSystemEventTrigger("after", "startup", _doProxyUpdate)
-
-        #
-        # Configure Memcached Client Pool
-        #
-        memcachepool.installPools(
-            config.Memcached.Pools,
-            config.Memcached.MaxClients,
-        )
-
-        #
-        # Configure NotificationClient
-        #
-        if config.Notifications.Enabled:
-            installNotificationClient(
-                config.Notifications.InternalNotificationHost,
-                config.Notifications.InternalNotificationPort,
-            )
-
-        #
-        # Configure the Site and Wrappers
-        #
-        credentialFactories = []
-
-        portal = Portal(auth.DavRealm())
-
-        portal.registerChecker(directory)
-
-        realm = directory.realmName or ""
-
-        self.log_info("Configuring authentication for realm: %s" % (realm,))
-
-        for scheme, schemeConfig in config.Authentication.iteritems():
-            scheme = scheme.lower()
-
-            credFactory = None
-
-            if schemeConfig["Enabled"]:
-                self.log_info("Setting up scheme: %s" % (scheme,))
-
-                if scheme == "kerberos":
-                    if not NegotiateCredentialFactory:
-                        self.log_info("Kerberos support not available")
-                        continue
-
-                    try:
-                        principal = schemeConfig["ServicePrincipal"]
-                        if not principal:
-                            credFactory = NegotiateCredentialFactory(
-                                type="HTTP",
-                                hostname=config.ServerHostName,
-                            )
-                        else:
-                            credFactory = NegotiateCredentialFactory(
-                                principal=principal,
-                            )
-                    except ValueError:
-                        self.log_info("Could not start Kerberos")
-                        continue
-
-                elif scheme == "digest":
-                    credFactory = QopDigestCredentialFactory(
-                        schemeConfig["Algorithm"],
-                        schemeConfig["Qop"],
-                        realm,
-                    )
-
-                elif scheme == "basic":
-                    credFactory = BasicCredentialFactory(realm)
-
-                elif scheme == "wiki":
-                    pass
-
-                else:
-                    self.log_error("Unknown scheme: %s" % (scheme,))
-
-            if credFactory:
-                credentialFactories.append(credFactory)
-
-
-        # Set up a basic credential factory for use on the /inbox iMIP
-        # injection resource
-        inboxCredentialFactory = BasicCredentialFactory(realm)
-
-        #
-        # Setup Resource hierarchy
-        #
-        self.log_info("Setting up document root at: %s"
-                      % (config.DocumentRoot,))
-        self.log_info("Setting up principal collection: %r"
-                      % (self.principalResourceClass,))
-
-        principalCollection = self.principalResourceClass(
-            "/principals/",
-            directory,
-        )
-        self.principalCollection = principalCollection
-
-        self.log_info("Setting up calendar collection: %r"
-                      % (self.calendarResourceClass,))
-
-        calendarCollection = self.calendarResourceClass(
-            os.path.join(config.DocumentRoot, "calendars"),
-            directory, "/calendars/",
-        )
-
-        self.log_info("Setting up root resource: %r"
-                      % (self.rootResourceClass,))
-
-        root = self.rootResourceClass(
-            config.DocumentRoot,
-            principalCollections=(principalCollection,),
-        )
-        self.root = root
-
-        root.putChild("principals", principalCollection)
-        root.putChild("calendars", calendarCollection)
-
-        for name, info in config.Aliases.iteritems():
-            if os.path.sep in name or not info.get("path", None):
-                self.log_error("Invalid alias: %s" % (name,))
-                continue
-            self.log_info("Adding alias %s -> %s" % (name, info["path"]))
-            resource = FileResource(info["path"])
-            root.putChild(name, resource)
-
-        # Timezone service is optional
-        if config.EnableTimezoneService:
-            self.log_info("Setting up time zone service resource: %r"
-                          % (self.timezoneServiceResourceClass,))
-
-            timezoneService = self.timezoneServiceResourceClass(
-                NotFilePath(isfile=True),
-                root,
-            )
-            root.putChild("timezones", timezoneService)
-
-        # iSchedule service is optional
-        if config.Scheduling.iSchedule.Enabled:
-            self.log_info("Setting up iSchedule inbox resource: %r"
-                          % (self.iScheduleResourceClass,))
-
-            ischedule = self.iScheduleResourceClass(
-                NotFilePath(isfile=True),
-                root,
-            )
-            root.putChild("ischedule", ischedule)
-
-        #
-        # IMIP delivery resource
-        #
+        additional = []
         if config.Scheduling.iMIP.Enabled:
-            self.log_info("Setting up iMIP inbox resource: %r"
-                          % (self.imipResourceClass,))
+            additional.append(("inbox", IMIPReplyInboxResource, [], "basic"))
+        rootResource = getRootResource(config, additional)
 
-            # The authenticationWrapper below will be configured to always
-            # allow basic auth on /inbox
-            root.putChild("inbox", self.imipResourceClass(root))
-
         #
-        # WebCal
-        #
-        if config.WebCalendarRoot:
-            self.log_info("Setting up WebCalendar resource: %s"
-                          % (config.WebCalendarRoot,))
-            webCalendar = self.webCalendarResourceClass(
-                config.WebCalendarRoot,
-                principalCollections=(principalCollection,),
-            )
-            root.putChild("webcal", webCalendar)
-
-        #
-        # WebAdmin
-        #
-        if config.EnableWebAdmin:
-            self.log_info("Setting up WebAdmin resource")
-            webAdmin = self.webAdminResourceClass(
-                config.WebCalendarRoot,
-                root,
-                directory,
-                principalCollections=(principalCollection,),
-            )
-            root.putChild("admin", webAdmin)
-
-        #
-        # Configure ancillary data
-        #
-        self.log_info("Setting up Timezone Cache")
-        TimezoneCache.create()
-
-
-
-        self.log_info("Configuring authentication wrapper")
-
-        authWrapper = AuthenticationWrapper(
-            root,
-            portal,
-            credentialFactories,
-            (auth.IPrincipal,),
-            overrides = {
-                "/inbox" : (inboxCredentialFactory,),
-            }
-        )
-
-        logWrapper = DirectoryLogWrapperResource(
-            authWrapper,
-            directory,
-        )
-
-        #
         # Configure the service
         #
         self.log_info("Setting up service")
 
         if config.ProcessType == "Slave":
-            realRoot = logWrapper
-
             if config.ControlSocket:
                 mode = "AF_UNIX"
                 id = config.ControlSocket
@@ -799,8 +516,6 @@
             # Make sure no old socket files are lying around.
             self.deleteStaleSocketFiles()
 
-            realRoot = logWrapper
-
             logObserver = RotatingFileAccessLoggingObserver(
                 config.AccessLogFile,
             )
@@ -809,7 +524,7 @@
 
         service = CalDAVService(logObserver)
 
-        site = Site(realRoot)
+        site = Site(rootResource)
 
         httpFactory = LimitingHTTPFactory(
             site,

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/carddav.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/carddav.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/carddav.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -18,42 +18,33 @@
     "CardDAVServiceMaker",
 ]
 
-import errno
-import os
-
 from zope.interface import implements
 
-from twext.python.filepath import CachingFilePath as FilePath
 from twisted.plugin import IPlugin
-from twisted.internet.reactor import callLater
 from twisted.application.service import IServiceMaker
 
-from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
-
-from twistedcaldav.config import config
-from twistedcaldav.static import AddressBookHomeProvisioningFile, DirectoryBackedAddressBookFile
+from twistedcaldav.stdconfig import DEFAULT_CARDDAV_CONFIG_FILE
 from twext.log import Logger
 
 log = Logger()
 
-from calendarserver.tap.caldav import CalDAVServiceMaker
+from calendarserver.tap.caldav import CalDAVServiceMaker, CalDAVOptions
 
 try:
     from twistedcaldav.authkerb import NegotiateCredentialFactory
 except ImportError:
     NegotiateCredentialFactory = None
 
-from calendarserver.provision.root import RootResource as _ParentRootResource
 
 
-
-class RootResource (_ParentRootResource):
+class CardDAVOptions(CalDAVOptions):
     """
-    A special root resource that contains support checking SACLs
-    as well as adding responseFilters.
+    The same as L{CalDAVOptions}, but with a different default config file.
     """
 
-    saclService = "addressbook"
+    optParameters = [[
+        "config", "f", DEFAULT_CARDDAV_CONFIG_FILE, "Path to configuration file."
+    ]]
 
 
 
@@ -62,53 +53,4 @@
 
     tapname = "carddav"
     description = "Darwin Contacts Server"
-
-    #
-    # Default resource classes
-    #
-    rootResourceClass            = RootResource
-    principalResourceClass       = DirectoryPrincipalProvisioningResource
-    addressBookResourceClass     = AddressBookHomeProvisioningFile
-    directoryBackedAddressBookResourceClass = DirectoryBackedAddressBookFile
-
-    def makeService_Slave(self, options):
-        result = super(CardDAVServiceMaker, self).makeService_Slave(options)
-
-        directory = self.directory
-        principalCollection = self.principalCollection
-
-        if config.EnableCardDAV:
-            log.info("Setting up address book collection: %r" % (self.addressBookResourceClass,))
-    
-            addressBookCollection = self.addressBookResourceClass(
-                os.path.join(config.DocumentRoot, "addressbooks"),
-                directory, "/addressbooks/"
-            )
-            
-            directoryPath = os.path.join(config.DocumentRoot, "directory")
-            doBacking = config.DirectoryAddressBook and config.EnableSearchAddressBook
-            if doBacking:
-                log.info("Setting up directory address book: %r" % (self.directoryBackedAddressBookResourceClass,))
-    
-                directoryBackedAddressBookCollection = self.directoryBackedAddressBookResourceClass(
-                    directoryPath,
-                    principalCollections=(principalCollection,)
-                )
-                # do this after process is owned by carddav user, not root
-                callLater(1.0, directoryBackedAddressBookCollection.provisionDirectory)
-            else:
-                # remove /directory from previous runs that may have created it
-                try:
-                    FilePath(directoryPath).remove()
-                    self.log_info("Deleted: %s" %    directoryPath)
-                except (OSError, IOError), e:
-                    if e.errno != errno.ENOENT:
-                        self.log_error("Could not delete: %s : %r" %  (directoryPath, e,))
-            root = self.root
-
-            root.putChild('addressbooks', addressBookCollection)
-            if doBacking:
-                root.putChild('directory', directoryBackedAddressBookCollection)
-        return result
-
-    makeService_Single   = makeService_Slave
+    options = CardDAVOptions

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/test/test_caldav.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tap/test/test_caldav.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -36,7 +36,7 @@
 from twext.python.plistlib import writePlist
 from twext.internet.tcp import MaxAcceptTCPServer, MaxAcceptSSLServer
 
-from twistedcaldav.config import config, ConfigDict, _mergeData
+from twistedcaldav.config import config, ConfigDict
 from twistedcaldav.stdconfig import DEFAULT_CONFIG
 
 from twistedcaldav.directory.aggregate import AggregateDirectoryService
@@ -197,6 +197,7 @@
         self.config = ConfigDict(DEFAULT_CONFIG)
 
         accountsFile = os.path.join(sourceRoot, "twistedcaldav/directory/test/accounts.xml")
+        resourcesFile = os.path.join(sourceRoot, "twistedcaldav/directory/test/resources.xml")
         augmentsFile = os.path.join(sourceRoot, "twistedcaldav/directory/test/augments.xml")
         pemFile = os.path.join(sourceRoot, "twistedcaldav/test/data/server.pem")
 
@@ -205,24 +206,29 @@
             "type": "twistedcaldav.directory.xmlfile.XMLDirectoryService"
         }
 
+        self.config["ResourceService"] = {
+            "params": {"xmlFile": resourcesFile},
+        }
+
         self.config["AugmentService"] = {
             "params": {"xmlFiles": [augmentsFile]},
             "type": "twistedcaldav.directory.augment.AugmentXMLDB"
         }
 
-        self.config.DocumentRoot   = self.mktemp()
-        self.config.DataRoot       = self.mktemp()
+        self.config.ServerRoot     = self.mktemp()
+        self.config.ConfigRoot     = "config"
         self.config.ProcessType    = "Slave"
         self.config.SSLPrivateKey  = pemFile
         self.config.SSLCertificate = pemFile
 
         self.config.SudoersFile = ""
 
-        if self.configOptions:
-            _mergeData(self.config, self.configOptions)
+        self.config.update(self.configOptions if self.configOptions else {})
 
-        os.mkdir(self.config.DocumentRoot)
-        os.mkdir(self.config.DataRoot)
+        os.mkdir(self.config.ServerRoot)
+        os.mkdir(os.path.join(self.config.ServerRoot, self.config.DocumentRoot))
+        os.mkdir(os.path.join(self.config.ServerRoot, self.config.DataRoot))
+        os.mkdir(os.path.join(self.config.ServerRoot, self.config.ConfigRoot))
 
         self.configFile = self.mktemp()
 
@@ -689,23 +695,27 @@
         Test that a sudo directory service is available if the
         SudoersFile is set and exists
         """
-        self.config.SudoersFile = self.mktemp()
-
+        self.config.SudoersFile = "sudoers.plist"
+        sudoersFilePath = os.path.join(
+            self.config.ServerRoot,
+            self.config.ConfigRoot,
+            self.config.SudoersFile
+        )
         self.writeConfig()
 
-        open(self.config.SudoersFile, "w").write(sudoersFile)
+        open(sudoersFilePath, "w").write(sudoersFile)
 
         site = self.getSite()
         principals = site.resource.resource.resource.getChild("principals")
         directory = principals.directory
 
-        self.failUnless(self.config.SudoersFile)
+        self.failUnless(sudoersFilePath)
 
         sudoService = directory.serviceForRecordType(SudoDirectoryService.recordType_sudoers)
 
         self.assertEquals(
             sudoService.plistFile.path,
-            os.path.abspath(self.config.SudoersFile)
+            os.path.abspath(sudoersFilePath)
         )
         self.failUnless(
             SudoDirectoryService.recordType_sudoers

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/gateway.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/gateway.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -34,6 +34,9 @@
 from calendarserver.tools.util import loadConfig, getDirectory, setupMemcached, setupNotifications
 from calendarserver.tools.principals import principalForPrincipalID, proxySubprincipal, addProxy, removeProxy, ProxyError, ProxyWarning
 
+from twext.python.log import StandardIOObserver
+
+
 def usage(e=None):
 
     name = os.path.basename(sys.argv[0])
@@ -43,6 +46,7 @@
     print ""
     print "options:"
     print "  -h --help: print this help and exit"
+    print "  -e --error: send stderr to stdout"
     print "  -f --config <path>: Specify caldavd.plist configuration path"
     print ""
 
@@ -56,8 +60,9 @@
 
     try:
         (optargs, args) = getopt(
-            sys.argv[1:], "hf:", [
+            sys.argv[1:], "hef:", [
                 "help",
+                "error",
                 "config=",
             ],
         )
@@ -73,6 +78,10 @@
         if opt in ("-h", "--help"):
             usage()
 
+        if opt in ("-e", "--error"):
+            observer = StandardIOObserver()
+            observer.start()
+
         elif opt in ("-f", "--config"):
             configFileName = arg
 
@@ -206,10 +215,14 @@
         guid = command['GeneratedUID']
         record = self.dir.recordWithGUID(guid)
         recordDict = recordToDict(record)
-        # principal = principalForPrincipalID(guid, directory=self.dir)
-        # recordDict['AutoSchedule'] = principal.getAutoSchedule()
+        principal = principalForPrincipalID(guid, directory=self.dir)
+        if principal is None:
+            respondWithError("Principal not found: %s" % (guid,))
+            return
+        recordDict['AutoSchedule'] = principal.getAutoSchedule()
         respond(command, recordDict)
 
+    @inlineCallbacks
     def command_setLocationAttributes(self, command):
 
         kwargs = {}
@@ -222,9 +235,9 @@
             respondWithError(str(e))
             return
 
-        # principal = principalForPrincipalID(command['GeneratedUID'],
-        #     directory=self.dir)
-        # principal.setAutoSchedule(command.get('AutoSchedule', False))
+        principal = principalForPrincipalID(command['GeneratedUID'],
+            directory=self.dir)
+        (yield principal.setAutoSchedule(command.get('AutoSchedule', False)))
 
         self.command_getLocationAttributes(command)
 
@@ -258,13 +271,9 @@
         respondWithRecordsOfType(self.dir, command, "resources")
 
     def command_getResourceAttributes(self, command):
-        guid = command['GeneratedUID']
-        record = self.dir.recordWithGUID(guid)
-        recordDict = recordToDict(record)
-        # principal = principalForPrincipalID(guid, directory=self.dir)
-        # recordDict['AutoSchedule'] = principal.getAutoSchedule()
-        respond(command, recordDict)
+        self.command_getLocationAttributes(command)
 
+    @inlineCallbacks
     def command_setResourceAttributes(self, command):
 
         kwargs = {}
@@ -277,9 +286,9 @@
             respondWithError(str(e))
             return
 
-        # principal = principalForPrincipalID(command['GeneratedUID'],
-        #     directory=self.dir)
-        # principal.setAutoSchedule(command.get('AutoSchedule', False))
+        principal = principalForPrincipalID(command['GeneratedUID'],
+            directory=self.dir)
+        (yield principal.setAutoSchedule(command.get('AutoSchedule', False)))
 
         self.command_getResourceAttributes(command)
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/loadaugmentdb.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/loadaugmentdb.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/loadaugmentdb.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -165,6 +165,7 @@
         updated = 0
         removed = 0
         if dbxml:
+            yield augment.AugmentService.addAugmentRecords(dbxml.db.values(), )
             add_records = list()
             modify_records = list()
             for record in dbxml.db.values():
@@ -172,18 +173,12 @@
                     modify_records.append(record)
                 else:
                     add_records.append(record)
-            yield augment.AugmentService.addAugmentRecords(add_records, False)
             added = len(add_records)
-
-            yield augment.AugmentService.addAugmentRecords(modify_records, True)
             updated = len(modify_records)
 
             remove_uids = uids.difference(dbxml.db.keys())
             yield augment.AugmentService.removeAugmentRecords(remove_uids)
             removed = len(remove_uids)
-        else:
-            yield augment.AugmentService.clean()
-            removed = len(uids)
             
         print "Changes:"
         print "  Added: %d" % (added,)

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/manageaugments.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/manageaugments.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/manageaugments.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -127,11 +127,11 @@
         if args[0] == "add":
             if not options.node:
                 parser.error("Partition node must be specified when adding")
-            yield augment.AugmentService.addAugmentRecords([makeRecord(uid, options) for uid in uids], False)
+            yield augment.AugmentService.addAugmentRecords([makeRecord(uid, options) for uid in uids])
             for uid in uids:
                 print "Added uid '%s' to augment database" % (uid,)
         elif args[0] == "modify":
-            yield augment.AugmentService.addAugmentRecords([makeRecord(uid, options) for uid in uids], True)
+            yield augment.AugmentService.addAugmentRecords([makeRecord(uid, options) for uid in uids])
             for uid in uids:
                 print "Modified uid '%s' in augment database" % (uid,)
         elif args[0] == "remove":

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/principals.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/principals.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -329,7 +329,7 @@
         return directory.principalCollection.principalForShortName(recordType, shortName)
 
     try:
-        guid = UUID(principalID)
+        UUID(principalID)
 
         if checkOnly:
             return None
@@ -453,7 +453,6 @@
         (yield subPrincipal.writeProperty(membersProperty, None))
 
 
-
 @inlineCallbacks
 def action_setAutoSchedule(principal, autoSchedule):
     if autoSchedule and principal.record.recordType in ("users", "groups"):
@@ -463,9 +462,8 @@
             { True: "true", False: "false" }[autoSchedule],
             principal,
         )
-        principal.setAutoSchedule(autoSchedule)
+        (yield principal.setAutoSchedule(autoSchedule))
 
- at inlineCallbacks
 def action_getAutoSchedule(principal):
     autoSchedule = principal.getAutoSchedule()
     print "Autoschedule for %s is %s" % (

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/gateway/augments.xml
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/gateway/augments.xml	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/gateway/augments.xml	2010-02-17 20:55:11 UTC (rev 5147)
@@ -20,6 +20,12 @@
 
 <augments>
   <record>
+    <uid>Default</uid>
+    <enable>true</enable>
+    <enable-calendar>true</enable-calendar>
+    <enable-addressbook>true</enable-addressbook>
+  </record>
+  <record>
     <uid>user01</uid>
     <enable>true</enable>
     <enable-calendar>true</enable-calendar>

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/gateway/caldavd.plist
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/gateway/caldavd.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/gateway/caldavd.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -73,14 +73,30 @@
         Data Store
       -->
 
+    <!-- Server root -->
+    <key>ServerRoot</key>
+    <string>%(ServerRoot)s</string>
+
     <!-- Data root -->
     <key>DataRoot</key>
-    <string>%(DataRoot)s</string>
+    <string>Data</string>
 
     <!-- Document root -->
     <key>DocumentRoot</key>
-    <string>%(DocumentRoot)s</string>
+    <string>Documents</string>
 
+    <!-- Configuration root -->
+    <key>ConfigRoot</key>
+    <string>/etc/caldavd</string>
+
+    <!-- Log root -->
+    <key>LogRoot</key>
+    <string>/var/log/caldavd</string>
+
+    <!-- Run root -->
+    <key>RunRoot</key>
+    <string>/var/run</string>
+
     <!-- Child aliases -->
     <key>Aliases</key>
     <dict>
@@ -130,7 +146,7 @@
       <key>params</key>
       <dict>
         <key>xmlFile</key>
-        <string>%(DirectoryXMLFile)s</string>
+        <string>accounts.xml</string>
         <key>recordTypes</key>
         <array>
             <string>users</string>
@@ -150,7 +166,7 @@
       <key>params</key>
       <dict>
         <key>xmlFile</key>
-        <string>%(ResourceXMLFile)s</string>
+        <string>resources.xml</string>
         <key>recordTypes</key>
         <array>
             <string>resources</string>
@@ -197,7 +213,7 @@
       <dict>
         <key>xmlFiles</key>
         <array>
-	      <string>%(AugmentXMLFile)s</string>
+	      <string>augments.xml</string>
         </array>
       </dict>
     </dict>
@@ -243,7 +259,7 @@
       <key>params</key>
       <dict>
         <key>dbpath</key>
-        <string>%(ProxyDBFile)s</string>
+        <string>proxies.sqlite</string>
       </dict>
     </dict>
 
@@ -407,10 +423,6 @@
     <key>GlobalStatsLoggingFrequency</key> 
     <integer>12</integer>
 
-    <!-- Server statistics file -->
-    <key>ServerStatsFile</key>
-    <string>logs/stats.plist</string>
-
     <!-- Server process ID file -->
     <key>PIDFile</key>
     <string>logs/caldavd.pid</string>

Deleted: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/augments.xml
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/principals/augments.xml	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/augments.xml	2010-02-17 20:55:11 UTC (rev 5147)
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-Copyright (c) 2009-2010 Apple Inc. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
- -->
-
-<!DOCTYPE accounts SYSTEM "../../../conf/auth/augments.dtd">
-
-<augments>
-  <record>
-    <uid>user01</uid>
-    <enable>true</enable>
-    <enable-calendar>true</enable-calendar>
-  </record>
-  <record>
-    <uid>user02</uid>
-    <enable>false</enable>
-    <enable-calendar>false</enable-calendar>
-  </record>
-  <record>
-    <uid>location01</uid>
-    <enable>true</enable>
-    <enable-calendar>true</enable-calendar>
-  </record>
-</augments>

Copied: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/augments.xml (from rev 5146, CalendarServer/trunk/calendarserver/tools/test/principals/augments.xml)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/augments.xml	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/augments.xml	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2009-2010 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "../../../conf/auth/augments.dtd">
+
+<augments>
+  <record>
+    <uid>user01</uid>
+    <enable>true</enable>
+    <enable-calendar>true</enable-calendar>
+  </record>
+  <record>
+    <uid>user02</uid>
+    <enable>false</enable>
+    <enable-calendar>false</enable-calendar>
+  </record>
+  <record>
+    <uid>location01</uid>
+    <enable>true</enable>
+    <enable-calendar>true</enable-calendar>
+  </record>
+</augments>

Deleted: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/caldavd.plist
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/principals/caldavd.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/caldavd.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -1,772 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-    Copyright (c) 2006-2010 Apple Inc. All rights reserved.
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-  -->
-
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-  <dict>
-
-    <!--
-        Public network address information
-
-        This is the server's public network address, which is provided to
-        clients in URLs and the like.  It may or may not be the network
-        address that the server is listening to directly, though it is by
-        default.  For example, it may be the address of a load balancer or
-        proxy which forwards connections to the server.
-      -->
-
-    <!-- Network host name [empty = system host name] -->
-    <key>ServerHostName</key>
-    <string></string> <!-- The hostname clients use when connecting -->
-
-    <!-- HTTP port [0 = disable HTTP] -->
-    <key>HTTPPort</key>
-    <integer>8008</integer>
-
-    <!-- SSL port [0 = disable HTTPS] -->
-    <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
-    <key>SSLPort</key>
-    <integer>8443</integer>
-
-    <!-- Redirect non-SSL ports to an SSL port -->
-    <key>RedirectHTTPToHTTPS</key>
-    <false/>
-
-    <!--
-        Network address configuration information
-
-        This configures the actual network address that the server binds to.
-      -->
-
-    <!-- List of IP addresses to bind to [empty = all] -->
-    <key>BindAddresses</key>
-    <array>
-    </array>
-
-    <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
-    <key>BindHTTPPorts</key>
-    <array>
-    </array>
-
-    <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
-    <key>BindSSLPorts</key>
-    <array>
-    </array>
-
-
-    <!--
-        Data Store
-      -->
-
-    <!-- Server root -->
-    <key>ServerRoot</key>
-    <string>%(ServerRoot)s</string>
-
-    <!-- Data root -->
-    <key>DataRoot</key>
-    <string>Data</string>
-
-    <!-- Document root -->
-    <key>DocumentRoot</key>
-    <string>Documents</string>
-
-    <!-- Configuration root -->
-    <key>ConfigRoot</key>
-    <string>/etc/caldavd</string>
-
-    <!-- Log root -->
-    <key>LogRoot</key>
-    <string>/var/log/caldavd</string>
-
-    <!-- Run root -->
-    <key>RunRoot</key>
-    <string>/var/run</string>
-
-    <!-- Child aliases -->
-    <key>Aliases</key>
-    <dict>
-      <!--
-      <key>foo</key>
-      <dict>
-        <key>path</key>
-        <string>/path/to/foo</string>
-      </dict>
-       -->
-    </dict>
-
-    <!-- User quota (in bytes) -->
-    <key>UserQuota</key>
-    <integer>104857600</integer><!-- 100Mb -->
-
-    <!-- Attachment size limit (in bytes) -->
-    <key>MaximumAttachmentSize</key>
-    <integer>1048576</integer><!-- 1Mb -->
-
-    <!-- Maximum number of unique attendees per entire event -->
-    <!-- 0 for no limit -->
-    <key>MaxAttendeesPerInstance</key>
-    <integer>100</integer>
-
-    <!-- Maximum number of instances allowed for a single RRULE -->
-    <!-- 0 for no limit -->
-    <key>MaxInstancesForRRULE</key>
-    <integer>400</integer>
-
-
-    <!--
-        Directory service
-
-        A directory service provides information about principals (eg.
-        users, groups, locations and resources) to the server.
-
-        A variety of directory services are available for use.
-      -->
-
-    <!-- XML File Directory Service -->
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>accounts.xml</string>
-        <key>recordTypes</key>
-        <array>
-            <string>users</string>
-            <string>groups</string>
-        </array>
-      </dict>
-    </dict>
-
-    <!-- XML File Resource Service -->
-    <key>ResourceService</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>resources.xml</string>
-        <key>recordTypes</key>
-        <array>
-            <string>resources</string>
-            <string>locations</string>
-        </array>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-    
-    <!-- Open Directory Service (Mac OS X) -->
-    <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-    -->
-
-    <!--
-        Augment service
-
-        Augments for the directory service records to add calendar specific attributes.
-
-        A variety of augment services are available for use.
-        When using a partitioned server, a service that can be accessed from each host will be needed.
-      -->
-
-    <!-- XML File Augment Service -->
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFiles</key>
-        <array>
-	      <string>augments.xml</string>
-        </array>
-      </dict>
-    </dict>
-    
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- Sqlite ProxyDB Service -->
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>proxies.sqlite</string>
-      </dict>
-    </dict>
-
-    <!-- PostgreSQL ProxyDB Service -->
-    <!--
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>proxies</string>
-      </dict>
-    </dict>
-     -->
-
-	<key>ProxyLoadFromFile</key>
-    <string>conf/auth/proxies-test.xml</string>
-
-    <!--
-        Special principals
-
-        These principals are granted special access and/or perform
-        special roles on the server.
-      -->
-
-    <!-- Principals with "DAV:all" access (relative URLs) -->
-    <key>AdminPrincipals</key>
-    <array>
-      <string>/principals/__uids__/admin/</string>
-    </array>
-
-    <!-- Principals with "DAV:read" access (relative URLs) -->
-    <key>ReadPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
-    </array>
-
-    <!-- Principals that can pose as other principals -->
-    <key>SudoersFile</key>
-    <string>conf/sudoers.plist</string>
-
-    <!-- Create "proxy access" principals -->
-    <key>EnableProxyPrincipals</key>
-    <true/>
-
-
-    <!--
-        Permissions
-      -->
-
-    <!-- Anonymous read access for root resource -->
-    <key>EnableAnonymousReadRoot</key>
-    <true/>
-
-    <!-- Anonymous read access for resource hierarchy -->
-    <key>EnableAnonymousReadNav</key>
-    <false/>
-
-    <!-- Enables directory listings for principals -->
-    <key>EnablePrincipalListings</key>
-    <true/>
-
-    <!-- Render calendar collections as a monolithic iCalendar object -->
-    <key>EnableMonolithicCalendars</key>
-    <true/>
-
-
-    <!--
-        Authentication
-      -->
-
-    <key>Authentication</key>
-    <dict>
-
-      <!-- Clear text; best avoided -->
-      <key>Basic</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-      </dict>
-
-      <!-- Digest challenge/response -->
-      <key>Digest</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>Algorithm</key>
-        <string>md5</string>
-        <key>Qop</key>
-        <string></string>
-      </dict>
-
-      <!-- Kerberos/SPNEGO -->
-      <key>Kerberos</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>ServicePrincipal</key>
-        <string></string>
-      </dict>
-
-      <!-- Wikiserver authentication (Mac OS X) -->
-      <key>Wiki</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>Cookie</key>
-        <string>sessionID</string>
-        <key>URL</key>
-        <string>http://127.0.0.1/RPC2</string>
-        <key>UserMethod</key>
-        <string>userForSession</string>
-        <key>WikiMethod</key>
-        <string>accessLevelForUserWikiCalendar</string>
-      </dict>
-
-    </dict>
-
-
-    <!--
-        Logging
-      -->
-
-    <!-- Apache-style access log -->
-    <key>AccessLogFile</key>
-    <string>logs/access.log</string>
-    <key>RotateAccessLog</key>
-    <false/>
-
-    <!-- Server activity log -->
-    <key>ErrorLogFile</key>
-    <string>logs/error.log</string>
-
-    <!-- Log levels -->
-    <key>DefaultLogLevel</key>
-    <string>info</string> <!-- debug, info, warn, error -->
-
-    <!-- Log level overrides for specific functionality -->
-    <key>LogLevels</key>
-    <dict>
-      <!--
-      <key>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</key>
-      <string>debug</string>
-      -->
-    </dict>
-
-    <!-- Global server stats --> 
-    <key>GlobalStatsSocket</key> 
-    <string>logs/caldavd-stats.sock</string> 
-
-    <!-- Global server stats logging period --> 
-    <key>GlobalStatsLoggingPeriod</key> 
-    <integer>60</integer> 
-
-    <!-- Global server stats logging frequency [0 = disable stats] --> 
-    <key>GlobalStatsLoggingFrequency</key> 
-    <integer>12</integer>
-
-    <!-- Server process ID file -->
-    <key>PIDFile</key>
-    <string>logs/caldavd.pid</string>
-
-
-    <!--
-        Accounting
-      -->
-
-    <!-- Enable accounting for certain operations -->
-    <key>AccountingCategories</key>
-    <dict>
-      <key>iTIP</key>
-      <false/>
-      <key>HTTP</key>
-      <false/>
-    </dict>
-    <!-- Enable accounting for specific principals -->
-    <key>AccountingPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/454D85C0-09F0-4DC6-A3C6-97DFEB4622CD/</string> -->
-    </array>
-
-
-    <!--
-        SSL/TLS
-      -->
-
-    <!-- Public key -->
-    <key>SSLCertificate</key>
-    <string>twistedcaldav/test/data/server.pem</string>
-
-    <!-- SSL authority chain (for intermediate certs) -->
-    <key>SSLAuthorityChain</key>
-    <string></string>
-
-    <!-- Private key -->
-    <key>SSLPrivateKey</key>
-    <string>twistedcaldav/test/data/server.pem</string>
-
-
-    <!--
-        Process management
-      -->
-
-    <key>UserName</key>
-    <string></string>
-
-    <key>GroupName</key>
-    <string></string>
-
-    <key>ProcessType</key>
-    <string>Combined</string>
-
-    <key>MultiProcess</key>
-    <dict>
-      <key>ProcessCount</key>
-      <integer>2</integer> <!-- 0 = larger of: 4 or (2 * CPU count) -->
-    </dict>
-
-
-    <!--
-        Notifications
-      -->
-
-    <key>Notifications</key>
-    <dict>
-      <!-- Time spent coalescing notifications before delivery -->
-      <key>CoalesceSeconds</key>
-      <integer>3</integer>
-
-      <key>InternalNotificationHost</key>
-      <string>localhost</string>
-
-      <key>InternalNotificationPort</key>
-      <integer>62309</integer>
-
-      <key>Services</key>
-      <dict>
-        <key>SimpleLineNotifier</key>
-        <dict>
-          <!-- Simple line notification service (for testing) -->
-          <key>Service</key>
-          <string>twistedcaldav.notify.SimpleLineNotifierService</string>
-          <key>Enabled</key>
-          <false/>
-          <key>Port</key>
-          <integer>62308</integer>
-        </dict>
-
-        <key>XMPPNotifier</key>
-        <dict>
-          <!-- XMPP notification service -->
-          <key>Service</key>
-          <string>twistedcaldav.notify.XMPPNotifierService</string>
-          <key>Enabled</key>
-          <false/>
-
-          <!-- XMPP host and port to contact -->
-          <key>Host</key>
-          <string>xmpp.host.name</string>
-          <key>Port</key>
-          <integer>5222</integer>
-
-          <!-- Jabber ID and password for the server -->
-          <key>JID</key>
-          <string>jid at xmpp.host.name/resource</string>
-          <key>Password</key>
-          <string>password_goes_here</string>
-
-          <!-- PubSub service address -->
-          <key>ServiceAddress</key>
-          <string>pubsub.xmpp.host.name</string>
-
-          <key>NodeConfiguration</key>
-          <dict>
-            <key>pubsub#deliver_payloads</key>
-            <string>1</string>
-            <key>pubsub#persist_items</key>
-            <string>1</string>
-          </dict>
-
-          <!-- Sends a presence notification to XMPP server at this interval (prevents disconnect) -->
-          <key>KeepAliveSeconds</key>
-          <integer>120</integer>
-
-          <!-- Sends a pubsub publish to a particular heartbeat node at this interval -->
-          <key>HeartbeatMinutes</key>
-          <integer>30</integer>
-
-          <!-- List of glob-like expressions defining which XMPP JIDs can converse with the server (for debugging) -->
-          <key>AllowedJIDs</key>
-          <array>
-            <!--
-            <string>*.example.com</string>
-             -->
-          </array>
-        </dict>
-      </dict>
-    </dict>
-
-
-    <!--
-        Server-to-server protocol
-      -->
-
-    <key>Scheduling</key>
-    <dict>
-
-      <!-- CalDAV protocol options -->
-      <key>CalDAV</key>
-      <dict>
-        <key>EmailDomain</key>
-        <string></string>
-        <key>HTTPDomain</key>
-        <string></string>
-        <key>AddressPatterns</key>
-        <array>
-        </array>
-        <key>OldDraftCompatibility</key>
-        <true/>
-        <key>ScheduleTagCompatibility</key>
-        <true/>
-        <key>EnablePrivateComments</key>
-        <true/>
-      </dict>
-
-      <!-- iSchedule protocol options -->
-      <key>iSchedule</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>AddressPatterns</key>
-        <array>
-        </array>
-        <key>Servers</key>
-        <string>conf/servertoserver-test.xml</string>
-      </dict>
-
-      <!-- iMIP protocol options -->
-      <key>iMIP</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>MailGatewayServer</key>
-        <string>localhost</string>
-        <key>MailGatewayPort</key>
-        <integer>62310</integer>
-        <key>Sending</key>
-        <dict>
-          <key>Server</key>
-          <string></string>
-          <key>Port</key>
-          <integer>587</integer>
-          <key>UseSSL</key>
-          <true/>
-          <key>Username</key>
-          <string></string>
-          <key>Password</key>
-          <string></string>
-          <key>Address</key>
-          <string></string> <!-- Address email will be sent from -->
-        </dict>
-        <key>Receiving</key>
-        <dict>
-          <key>Server</key>
-          <string></string>
-          <key>Port</key>
-          <integer>995</integer>
-          <key>Type</key>
-          <string></string> <!-- Either "pop" or "imap" -->
-          <key>UseSSL</key>
-          <true/>
-          <key>Username</key>
-          <string></string>
-          <key>Password</key>
-          <string></string>
-          <key>PollingSeconds</key>
-          <integer>30</integer>
-        </dict>
-        <key>AddressPatterns</key>
-        <array>
-          <string>mailto:.*</string>
-        </array>
-      </dict>
-
-	  <!-- General options for scheduling -->
-	  <key>Options</key>
-	  <dict>
-        <key>AllowGroupAsOrganizer</key>
-        <false/>
-        <key>AllowLocationAsOrganizer</key>
-        <false/>
-        <key>AllowResourceAsOrganizer</key>
-        <false/>
-       </dict>
-
-    </dict>
-
-
-    <!--
-        Free-busy URL protocol
-      -->
-
-    <key>FreeBusyURL</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>TimePeriod</key>
-      <integer>14</integer>
-      <key>AnonymousAccess</key>
-      <false/>
-    </dict>
-
-
-    <!--
-        Non-standard CalDAV extensions
-      -->
-
-    <!-- Calendar Drop Box -->
-    <key>EnableDropBox</key>
-    <true/>
-
-    <!-- Private Events -->
-    <key>EnablePrivateEvents</key>
-    <true/>
-
-    <!-- Timezone Service -->
-    <key>EnableTimezoneService</key>
-    <true/>
-
-
-    <!--
-        Miscellaneous items
-      -->
-
-    <!-- Service ACLs (Mac OS X) -->
-    <key>EnableSACLs</key>
-    <false/>
-
-    <!-- Web-based administration -->
-    <key>EnableWebAdmin</key>
-    <true/>
-
-    <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
-    <key>ResponseCompression</key>
-    <false/>
-    
-    <!-- The retry-after value (in seconds) to return with a 503 error. -->
-    <key>HTTPRetryAfter</key>
-    <integer>180</integer>
-
-    <!-- A unix socket used for communication between the child and master processes.
-         An empty value tells the server to use a tcp socket instead. -->
-    <key>ControlSocket</key>
-    <string>logs/caldavd.sock</string>
-
-    <!-- Support for Memcached -->
-    <key>Memcached</key>
-    <dict>
-      <key>MaxClients</key>
-      <integer>5</integer>
-      <key>memcached</key>
-      <string>memcached</string> <!-- Find in PATH -->
-      <key>Options</key>
-      <array>
-        <!--<string>-vv</string>-->
-      </array>
-      <key>Pools</key>
-        <dict>
-        <key>Default</key>
-            <dict>
-                <key>ClientEnabled</key>
-                <false/>
-                <key>ServerEnabled</key>
-                <false/>
-            </dict>
-        </dict>
-    </dict>
-
-    <!-- Response Caching -->
-    <key>ResponseCacheTimeout</key>
-    <integer>30</integer> <!-- in minutes -->
-
-
-    <!--
-        Twisted
-      -->
-
-    <key>Twisted</key>
-    <dict>
-      <key>twistd</key>
-      <string>../Twisted/bin/twistd</string>
-    </dict>
-
-
-    <key>Localization</key>
-    <dict>
-      <key>LocalesDirectory</key>
-      <string>locales</string>
-      <key>Language</key>
-      <string>English</string>
-    </dict>
-
-
-  </dict>
-</plist>

Copied: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/caldavd.plist (from rev 5146, CalendarServer/trunk/calendarserver/tools/test/principals/caldavd.plist)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/caldavd.plist	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/caldavd.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,772 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+  -->
+
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+  <dict>
+
+    <!--
+        Public network address information
+
+        This is the server's public network address, which is provided to
+        clients in URLs and the like.  It may or may not be the network
+        address that the server is listening to directly, though it is by
+        default.  For example, it may be the address of a load balancer or
+        proxy which forwards connections to the server.
+      -->
+
+    <!-- Network host name [empty = system host name] -->
+    <key>ServerHostName</key>
+    <string></string> <!-- The hostname clients use when connecting -->
+
+    <!-- HTTP port [0 = disable HTTP] -->
+    <key>HTTPPort</key>
+    <integer>8008</integer>
+
+    <!-- SSL port [0 = disable HTTPS] -->
+    <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
+    <key>SSLPort</key>
+    <integer>8443</integer>
+
+    <!-- Redirect non-SSL ports to an SSL port -->
+    <key>RedirectHTTPToHTTPS</key>
+    <false/>
+
+    <!--
+        Network address configuration information
+
+        This configures the actual network address that the server binds to.
+      -->
+
+    <!-- List of IP addresses to bind to [empty = all] -->
+    <key>BindAddresses</key>
+    <array>
+    </array>
+
+    <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
+    <key>BindHTTPPorts</key>
+    <array>
+    </array>
+
+    <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
+    <key>BindSSLPorts</key>
+    <array>
+    </array>
+
+
+    <!--
+        Data Store
+      -->
+
+    <!-- Server root -->
+    <key>ServerRoot</key>
+    <string>%(ServerRoot)s</string>
+
+    <!-- Data root -->
+    <key>DataRoot</key>
+    <string>Data</string>
+
+    <!-- Document root -->
+    <key>DocumentRoot</key>
+    <string>Documents</string>
+
+    <!-- Configuration root -->
+    <key>ConfigRoot</key>
+    <string>/etc/caldavd</string>
+
+    <!-- Log root -->
+    <key>LogRoot</key>
+    <string>/var/log/caldavd</string>
+
+    <!-- Run root -->
+    <key>RunRoot</key>
+    <string>/var/run</string>
+
+    <!-- Child aliases -->
+    <key>Aliases</key>
+    <dict>
+      <!--
+      <key>foo</key>
+      <dict>
+        <key>path</key>
+        <string>/path/to/foo</string>
+      </dict>
+       -->
+    </dict>
+
+    <!-- User quota (in bytes) -->
+    <key>UserQuota</key>
+    <integer>104857600</integer><!-- 100Mb -->
+
+    <!-- Attachment size limit (in bytes) -->
+    <key>MaximumAttachmentSize</key>
+    <integer>1048576</integer><!-- 1Mb -->
+
+    <!-- Maximum number of unique attendees per entire event -->
+    <!-- 0 for no limit -->
+    <key>MaxAttendeesPerInstance</key>
+    <integer>100</integer>
+
+    <!-- Maximum number of instances allowed for a single RRULE -->
+    <!-- 0 for no limit -->
+    <key>MaxInstancesForRRULE</key>
+    <integer>400</integer>
+
+
+    <!--
+        Directory service
+
+        A directory service provides information about principals (eg.
+        users, groups, locations and resources) to the server.
+
+        A variety of directory services are available for use.
+      -->
+
+    <!-- XML File Directory Service -->
+    <key>DirectoryService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      
+      <key>params</key>
+      <dict>
+        <key>xmlFile</key>
+        <string>accounts.xml</string>
+        <key>recordTypes</key>
+        <array>
+            <string>users</string>
+            <string>groups</string>
+        </array>
+      </dict>
+    </dict>
+
+    <!-- XML File Resource Service -->
+    <key>ResourceService</key>
+    <dict>
+      <key>Enabled</key>
+      <true/>
+      <key>type</key>
+      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      
+      <key>params</key>
+      <dict>
+        <key>xmlFile</key>
+        <string>resources.xml</string>
+        <key>recordTypes</key>
+        <array>
+            <string>resources</string>
+            <string>locations</string>
+        </array>
+        <key>cacheTimeout</key>
+        <integer>30</integer>
+      </dict>
+    </dict>
+    
+    <!-- Open Directory Service (Mac OS X) -->
+    <!--
+    <key>DirectoryService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
+      
+      <key>params</key>
+      <dict>
+        <key>node</key>
+        <string>/Search</string>
+        <key>cacheTimeout</key>
+        <integer>30</integer>
+      </dict>
+    </dict>
+    -->
+
+    <!--
+        Augment service
+
+        Augments for the directory service records to add calendar specific attributes.
+
+        A variety of augment services are available for use.
+        When using a partitioned server, a service that can be accessed from each host will be needed.
+      -->
+
+    <!-- XML File Augment Service -->
+    <key>AugmentService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>xmlFiles</key>
+        <array>
+	      <string>augments.xml</string>
+        </array>
+      </dict>
+    </dict>
+    
+    <!-- Sqlite Augment Service -->
+    <!--
+    <key>AugmentService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>dbpath</key>
+        <string>/etc/caldavd/augments.sqlite</string>
+      </dict>
+    </dict>
+     -->
+
+    <!-- PostgreSQL Augment Service -->
+    <!--
+    <key>AugmentService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>host</key>
+        <string>localhost</string>
+        <key>database</key>
+        <string>augments</string>
+      </dict>
+    </dict>
+     -->
+
+    <!-- Sqlite ProxyDB Service -->
+    <key>ProxyDBService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>dbpath</key>
+        <string>proxies.sqlite</string>
+      </dict>
+    </dict>
+
+    <!-- PostgreSQL ProxyDB Service -->
+    <!--
+    <key>ProxyDBService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>host</key>
+        <string>localhost</string>
+        <key>database</key>
+        <string>proxies</string>
+      </dict>
+    </dict>
+     -->
+
+	<key>ProxyLoadFromFile</key>
+    <string>conf/auth/proxies-test.xml</string>
+
+    <!--
+        Special principals
+
+        These principals are granted special access and/or perform
+        special roles on the server.
+      -->
+
+    <!-- Principals with "DAV:all" access (relative URLs) -->
+    <key>AdminPrincipals</key>
+    <array>
+      <string>/principals/__uids__/admin/</string>
+    </array>
+
+    <!-- Principals with "DAV:read" access (relative URLs) -->
+    <key>ReadPrincipals</key>
+    <array>
+      <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
+    </array>
+
+    <!-- Principals that can pose as other principals -->
+    <key>SudoersFile</key>
+    <string>conf/sudoers.plist</string>
+
+    <!-- Create "proxy access" principals -->
+    <key>EnableProxyPrincipals</key>
+    <true/>
+
+
+    <!--
+        Permissions
+      -->
+
+    <!-- Anonymous read access for root resource -->
+    <key>EnableAnonymousReadRoot</key>
+    <true/>
+
+    <!-- Anonymous read access for resource hierarchy -->
+    <key>EnableAnonymousReadNav</key>
+    <false/>
+
+    <!-- Enables directory listings for principals -->
+    <key>EnablePrincipalListings</key>
+    <true/>
+
+    <!-- Render calendar collections as a monolithic iCalendar object -->
+    <key>EnableMonolithicCalendars</key>
+    <true/>
+
+
+    <!--
+        Authentication
+      -->
+
+    <key>Authentication</key>
+    <dict>
+
+      <!-- Clear text; best avoided -->
+      <key>Basic</key>
+      <dict>
+        <key>Enabled</key>
+        <true/>
+      </dict>
+
+      <!-- Digest challenge/response -->
+      <key>Digest</key>
+      <dict>
+        <key>Enabled</key>
+        <true/>
+        <key>Algorithm</key>
+        <string>md5</string>
+        <key>Qop</key>
+        <string></string>
+      </dict>
+
+      <!-- Kerberos/SPNEGO -->
+      <key>Kerberos</key>
+      <dict>
+        <key>Enabled</key>
+        <false/>
+        <key>ServicePrincipal</key>
+        <string></string>
+      </dict>
+
+      <!-- Wikiserver authentication (Mac OS X) -->
+      <key>Wiki</key>
+      <dict>
+        <key>Enabled</key>
+        <true/>
+        <key>Cookie</key>
+        <string>sessionID</string>
+        <key>URL</key>
+        <string>http://127.0.0.1/RPC2</string>
+        <key>UserMethod</key>
+        <string>userForSession</string>
+        <key>WikiMethod</key>
+        <string>accessLevelForUserWikiCalendar</string>
+      </dict>
+
+    </dict>
+
+
+    <!--
+        Logging
+      -->
+
+    <!-- Apache-style access log -->
+    <key>AccessLogFile</key>
+    <string>logs/access.log</string>
+    <key>RotateAccessLog</key>
+    <false/>
+
+    <!-- Server activity log -->
+    <key>ErrorLogFile</key>
+    <string>logs/error.log</string>
+
+    <!-- Log levels -->
+    <key>DefaultLogLevel</key>
+    <string>info</string> <!-- debug, info, warn, error -->
+
+    <!-- Log level overrides for specific functionality -->
+    <key>LogLevels</key>
+    <dict>
+      <!--
+      <key>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</key>
+      <string>debug</string>
+      -->
+    </dict>
+
+    <!-- Global server stats --> 
+    <key>GlobalStatsSocket</key> 
+    <string>logs/caldavd-stats.sock</string> 
+
+    <!-- Global server stats logging period --> 
+    <key>GlobalStatsLoggingPeriod</key> 
+    <integer>60</integer> 
+
+    <!-- Global server stats logging frequency [0 = disable stats] --> 
+    <key>GlobalStatsLoggingFrequency</key> 
+    <integer>12</integer>
+
+    <!-- Server process ID file -->
+    <key>PIDFile</key>
+    <string>logs/caldavd.pid</string>
+
+
+    <!--
+        Accounting
+      -->
+
+    <!-- Enable accounting for certain operations -->
+    <key>AccountingCategories</key>
+    <dict>
+      <key>iTIP</key>
+      <false/>
+      <key>HTTP</key>
+      <false/>
+    </dict>
+    <!-- Enable accounting for specific principals -->
+    <key>AccountingPrincipals</key>
+    <array>
+      <!-- <string>/principals/__uids__/454D85C0-09F0-4DC6-A3C6-97DFEB4622CD/</string> -->
+    </array>
+
+
+    <!--
+        SSL/TLS
+      -->
+
+    <!-- Public key -->
+    <key>SSLCertificate</key>
+    <string>twistedcaldav/test/data/server.pem</string>
+
+    <!-- SSL authority chain (for intermediate certs) -->
+    <key>SSLAuthorityChain</key>
+    <string></string>
+
+    <!-- Private key -->
+    <key>SSLPrivateKey</key>
+    <string>twistedcaldav/test/data/server.pem</string>
+
+
+    <!--
+        Process management
+      -->
+
+    <key>UserName</key>
+    <string></string>
+
+    <key>GroupName</key>
+    <string></string>
+
+    <key>ProcessType</key>
+    <string>Combined</string>
+
+    <key>MultiProcess</key>
+    <dict>
+      <key>ProcessCount</key>
+      <integer>2</integer> <!-- 0 = larger of: 4 or (2 * CPU count) -->
+    </dict>
+
+
+    <!--
+        Notifications
+      -->
+
+    <key>Notifications</key>
+    <dict>
+      <!-- Time spent coalescing notifications before delivery -->
+      <key>CoalesceSeconds</key>
+      <integer>3</integer>
+
+      <key>InternalNotificationHost</key>
+      <string>localhost</string>
+
+      <key>InternalNotificationPort</key>
+      <integer>62309</integer>
+
+      <key>Services</key>
+      <dict>
+        <key>SimpleLineNotifier</key>
+        <dict>
+          <!-- Simple line notification service (for testing) -->
+          <key>Service</key>
+          <string>twistedcaldav.notify.SimpleLineNotifierService</string>
+          <key>Enabled</key>
+          <false/>
+          <key>Port</key>
+          <integer>62308</integer>
+        </dict>
+
+        <key>XMPPNotifier</key>
+        <dict>
+          <!-- XMPP notification service -->
+          <key>Service</key>
+          <string>twistedcaldav.notify.XMPPNotifierService</string>
+          <key>Enabled</key>
+          <false/>
+
+          <!-- XMPP host and port to contact -->
+          <key>Host</key>
+          <string>xmpp.host.name</string>
+          <key>Port</key>
+          <integer>5222</integer>
+
+          <!-- Jabber ID and password for the server -->
+          <key>JID</key>
+          <string>jid at xmpp.host.name/resource</string>
+          <key>Password</key>
+          <string>password_goes_here</string>
+
+          <!-- PubSub service address -->
+          <key>ServiceAddress</key>
+          <string>pubsub.xmpp.host.name</string>
+
+          <key>NodeConfiguration</key>
+          <dict>
+            <key>pubsub#deliver_payloads</key>
+            <string>1</string>
+            <key>pubsub#persist_items</key>
+            <string>1</string>
+          </dict>
+
+          <!-- Sends a presence notification to XMPP server at this interval (prevents disconnect) -->
+          <key>KeepAliveSeconds</key>
+          <integer>120</integer>
+
+          <!-- Sends a pubsub publish to a particular heartbeat node at this interval -->
+          <key>HeartbeatMinutes</key>
+          <integer>30</integer>
+
+          <!-- List of glob-like expressions defining which XMPP JIDs can converse with the server (for debugging) -->
+          <key>AllowedJIDs</key>
+          <array>
+            <!--
+            <string>*.example.com</string>
+             -->
+          </array>
+        </dict>
+      </dict>
+    </dict>
+
+
+    <!--
+        Server-to-server protocol
+      -->
+
+    <key>Scheduling</key>
+    <dict>
+
+      <!-- CalDAV protocol options -->
+      <key>CalDAV</key>
+      <dict>
+        <key>EmailDomain</key>
+        <string></string>
+        <key>HTTPDomain</key>
+        <string></string>
+        <key>AddressPatterns</key>
+        <array>
+        </array>
+        <key>OldDraftCompatibility</key>
+        <true/>
+        <key>ScheduleTagCompatibility</key>
+        <true/>
+        <key>EnablePrivateComments</key>
+        <true/>
+      </dict>
+
+      <!-- iSchedule protocol options -->
+      <key>iSchedule</key>
+      <dict>
+        <key>Enabled</key>
+        <false/>
+        <key>AddressPatterns</key>
+        <array>
+        </array>
+        <key>Servers</key>
+        <string>conf/servertoserver-test.xml</string>
+      </dict>
+
+      <!-- iMIP protocol options -->
+      <key>iMIP</key>
+      <dict>
+        <key>Enabled</key>
+        <false/>
+        <key>MailGatewayServer</key>
+        <string>localhost</string>
+        <key>MailGatewayPort</key>
+        <integer>62310</integer>
+        <key>Sending</key>
+        <dict>
+          <key>Server</key>
+          <string></string>
+          <key>Port</key>
+          <integer>587</integer>
+          <key>UseSSL</key>
+          <true/>
+          <key>Username</key>
+          <string></string>
+          <key>Password</key>
+          <string></string>
+          <key>Address</key>
+          <string></string> <!-- Address email will be sent from -->
+        </dict>
+        <key>Receiving</key>
+        <dict>
+          <key>Server</key>
+          <string></string>
+          <key>Port</key>
+          <integer>995</integer>
+          <key>Type</key>
+          <string></string> <!-- Either "pop" or "imap" -->
+          <key>UseSSL</key>
+          <true/>
+          <key>Username</key>
+          <string></string>
+          <key>Password</key>
+          <string></string>
+          <key>PollingSeconds</key>
+          <integer>30</integer>
+        </dict>
+        <key>AddressPatterns</key>
+        <array>
+          <string>mailto:.*</string>
+        </array>
+      </dict>
+
+	  <!-- General options for scheduling -->
+	  <key>Options</key>
+	  <dict>
+        <key>AllowGroupAsOrganizer</key>
+        <false/>
+        <key>AllowLocationAsOrganizer</key>
+        <false/>
+        <key>AllowResourceAsOrganizer</key>
+        <false/>
+       </dict>
+
+    </dict>
+
+
+    <!--
+        Free-busy URL protocol
+      -->
+
+    <key>FreeBusyURL</key>
+    <dict>
+      <key>Enabled</key>
+      <true/>
+      <key>TimePeriod</key>
+      <integer>14</integer>
+      <key>AnonymousAccess</key>
+      <false/>
+    </dict>
+
+
+    <!--
+        Non-standard CalDAV extensions
+      -->
+
+    <!-- Calendar Drop Box -->
+    <key>EnableDropBox</key>
+    <true/>
+
+    <!-- Private Events -->
+    <key>EnablePrivateEvents</key>
+    <true/>
+
+    <!-- Timezone Service -->
+    <key>EnableTimezoneService</key>
+    <true/>
+
+
+    <!--
+        Miscellaneous items
+      -->
+
+    <!-- Service ACLs (Mac OS X) -->
+    <key>EnableSACLs</key>
+    <false/>
+
+    <!-- Web-based administration -->
+    <key>EnableWebAdmin</key>
+    <true/>
+
+    <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
+    <key>ResponseCompression</key>
+    <false/>
+    
+    <!-- The retry-after value (in seconds) to return with a 503 error. -->
+    <key>HTTPRetryAfter</key>
+    <integer>180</integer>
+
+    <!-- A unix socket used for communication between the child and master processes.
+         An empty value tells the server to use a tcp socket instead. -->
+    <key>ControlSocket</key>
+    <string>logs/caldavd.sock</string>
+
+    <!-- Support for Memcached -->
+    <key>Memcached</key>
+    <dict>
+      <key>MaxClients</key>
+      <integer>5</integer>
+      <key>memcached</key>
+      <string>memcached</string> <!-- Find in PATH -->
+      <key>Options</key>
+      <array>
+        <!--<string>-vv</string>-->
+      </array>
+      <key>Pools</key>
+        <dict>
+        <key>Default</key>
+            <dict>
+                <key>ClientEnabled</key>
+                <false/>
+                <key>ServerEnabled</key>
+                <false/>
+            </dict>
+        </dict>
+    </dict>
+
+    <!-- Response Caching -->
+    <key>ResponseCacheTimeout</key>
+    <integer>30</integer> <!-- in minutes -->
+
+
+    <!--
+        Twisted
+      -->
+
+    <key>Twisted</key>
+    <dict>
+      <key>twistd</key>
+      <string>../Twisted/bin/twistd</string>
+    </dict>
+
+
+    <key>Localization</key>
+    <dict>
+      <key>LocalesDirectory</key>
+      <string>locales</string>
+      <key>Language</key>
+      <string>English</string>
+    </dict>
+
+
+  </dict>
+</plist>

Deleted: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/resources-locations.xml
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/principals/resources-locations.xml	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/resources-locations.xml	2010-02-17 20:55:11 UTC (rev 5147)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-Copyright (c) 2006-2010 Apple Inc. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
- -->
-
-<!DOCTYPE accounts SYSTEM "accounts.dtd">
-
-<accounts realm="Test Realm">
-  <location repeat="10">
-    <uid>location%02d</uid>
-    <guid>location%02d</guid>
-    <password>location%02d</password>
-    <name>Room %02d</name>
-  </location>
-  <resource repeat="10">
-    <uid>resource%02d</uid>
-    <guid>resource%02d</guid>
-    <password>resource%02d</password>
-    <name>Resource %02d</name>
-  </resource>
-</accounts>

Copied: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/resources-locations.xml (from rev 5146, CalendarServer/trunk/calendarserver/tools/test/principals/resources-locations.xml)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/resources-locations.xml	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/resources-locations.xml	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "accounts.dtd">
+
+<accounts realm="Test Realm">
+  <location repeat="10">
+    <uid>location%02d</uid>
+    <guid>location%02d</guid>
+    <password>location%02d</password>
+    <name>Room %02d</name>
+  </location>
+  <resource repeat="10">
+    <uid>resource%02d</uid>
+    <guid>resource%02d</guid>
+    <password>resource%02d</password>
+    <name>Resource %02d</name>
+  </resource>
+</accounts>

Deleted: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/users-groups.xml
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/principals/users-groups.xml	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/users-groups.xml	2010-02-17 20:55:11 UTC (rev 5147)
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-Copyright (c) 2006-2010 Apple Inc. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
- -->
-
-<!DOCTYPE accounts SYSTEM "accounts.dtd">
-
-<accounts realm="Test Realm">
-  <user repeat="10">
-    <uid>user%02d</uid>
-    <guid>user%02d</guid>
-    <password>test</password>
-    <name>Test User %02d</name>
-    <first-name>Test</first-name>
-    <last-name>User %02d</last-name>
-  </user>
-  <group>
-    <uid>testgroup1</uid>
-    <guid>e5a6142c-4189-4e9e-90b0-9cd0268b314b</guid>
-    <password>test</password>
-    <name>Group 01</name>
-    <members>
-      <member type="users">user01</member>
-      <member type="users">user02</member>
-    </members>
-  </group>
-</accounts>

Copied: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/users-groups.xml (from rev 5146, CalendarServer/trunk/calendarserver/tools/test/principals/users-groups.xml)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/users-groups.xml	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/principals/users-groups.xml	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "accounts.dtd">
+
+<accounts realm="Test Realm">
+  <user repeat="10">
+    <uid>user%02d</uid>
+    <guid>user%02d</guid>
+    <password>test</password>
+    <name>Test User %02d</name>
+    <first-name>Test</first-name>
+    <last-name>User %02d</last-name>
+  </user>
+  <group>
+    <uid>testgroup1</uid>
+    <guid>e5a6142c-4189-4e9e-90b0-9cd0268b314b</guid>
+    <password>test</password>
+    <name>Group 01</name>
+    <members>
+      <member type="users">user01</member>
+      <member type="users">user02</member>
+    </members>
+  </group>
+</accounts>

Modified: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/test_gateway.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/test_gateway.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/test_gateway.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -21,134 +21,49 @@
 from twext.python.filepath import CachingFilePath as FilePath
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, Deferred, returnValue
-from twisted.internet.error import ProcessDone
-from twisted.internet.protocol import ProcessProtocol
 
 from twistedcaldav.config import config
-from twistedcaldav.test.util import TestCase
+from twistedcaldav.test.util import TestCase, CapturingProcessProtocol
 from calendarserver.tools.util import getDirectory
 
+from twistedcaldav.directory import augment
 
-class ErrorOutput(Exception):
-    """
-    The process produced some error output and exited with a non-zero exit
-    code.
-    """
 
-
-class CapturingProcessProtocol(ProcessProtocol):
-    """
-    A L{ProcessProtocol} that captures its output and error.
-
-    @ivar output: a C{list} of all C{str}s received to stderr.
-
-    @ivar error: a C{list} of all C{str}s received to stderr.
-    """
-
-    def __init__(self, deferred, inputData):
-        """
-        Initialize a L{CapturingProcessProtocol}.
-
-        @param deferred: the L{Deferred} to fire when the process is complete.
-
-        @param inputData: a C{str} to feed to the subprocess's stdin.
-        """
-        self.deferred = deferred
-        self.input = inputData
-        self.output = []
-        self.error = []
-
-
-    def connectionMade(self):
-        """
-        The process started; feed its input on stdin.
-        """
-        self.transport.write(self.input)
-        self.transport.closeStdin()
-
-
-    def outReceived(self, data):
-        """
-        Some output was received on stdout.
-        """
-        self.output.append(data)
-
-
-    def errReceived(self, data):
-        """
-        Some output was received on stderr.
-        """
-        self.error.append(data)
-        # Attempt to exit promptly if a traceback is displayed, so we don't
-        # deal with timeouts.
-        lines = ''.join(self.error).split("\n")
-        if len(lines) > 1:
-            errorReportLine = lines[-2].split(": ", 1)
-            if len(errorReportLine) == 2 and ' ' not in errorReportLine[0] and '\t' not in errorReportLine[0]:
-                self.transport.signalProcess("TERM")
-
-
-    def processEnded(self, why):
-        """
-        The process is over, fire the Deferred with the output.
-        """
-        if why.check(ProcessDone) and not self.error:
-            self.deferred.callback(''.join(self.output))
-        else:
-            self.deferred.errback(ErrorOutput(''.join(self.error)))
-
-
 class GatewayTestCase(TestCase):
 
     def setUp(self):
+        super(GatewayTestCase, self).setUp()
+
         testRoot = os.path.join(os.path.dirname(__file__), "gateway")
         templateName = os.path.join(testRoot, "caldavd.plist")
         templateFile = open(templateName)
         template = templateFile.read()
         templateFile.close()
 
-        tmpDir = FilePath(self.mktemp())
-        tmpDir.makedirs()
-        dataRoot = tmpDir.child("data")
-        dataRoot.makedirs()
-        docRoot = tmpDir.child("documents")
-        docRoot.makedirs()
+        newConfig = template % {
+            'ServerRoot' : os.path.abspath(config.ServerRoot),
+        }
+        configFilePath = FilePath(os.path.join(config.ConfigRoot, "caldavd.plist"))
+        configFilePath.setContent(newConfig)
 
-        # Copy xml files to a temp directory because they may get modified
+        self.configFileName = configFilePath.path
+        config.load(self.configFileName)
 
         origUsersFile = FilePath(os.path.join(os.path.dirname(__file__),
             "gateway", "users-groups.xml"))
-        copyUsersFile = tmpDir.child("users-groups.xml")
+        copyUsersFile = FilePath(os.path.join(config.DataRoot, "accounts.xml"))
         origUsersFile.copyTo(copyUsersFile)
 
         origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
             "gateway", "resources-locations.xml"))
-        copyResourcesFile = tmpDir.child("resources-locations.xml")
+        copyResourcesFile = FilePath(os.path.join(config.DataRoot, "resources.xml"))
         origResourcesFile.copyTo(copyResourcesFile)
 
         origAugmentFile = FilePath(os.path.join(os.path.dirname(__file__),
             "gateway", "augments.xml"))
-        copyAugmentFile = tmpDir.child("augments.xml")
+        copyAugmentFile = FilePath(os.path.join(config.DataRoot, "augments.xml"))
         origAugmentFile.copyTo(copyAugmentFile)
 
-        proxyFile = tmpDir.child("proxies.sqlite")
-
-        newConfig = template % {
-            'DataRoot' : dataRoot.path,
-            'DocumentRoot' : docRoot.path,
-            'DirectoryXMLFile' : copyUsersFile.path,
-            'ResourceXMLFile' : copyResourcesFile.path,
-            'AugmentXMLFile' : copyAugmentFile.path,
-            'ProxyDBFile' : proxyFile.path,
-        }
-        configFilePath = tmpDir.child("caldavd.plist")
-        configFilePath.setContent(newConfig)
-
-        self.configFileName = configFilePath.path
-        config.load(self.configFileName)
-
-        super(GatewayTestCase, self).setUp()
-
         # Make sure trial puts the reactor in the right state, by letting it
         # run one reactor iteration.  (Ignore me, please.)
         d = Deferred()
@@ -156,7 +71,7 @@
         return d
 
     @inlineCallbacks
-    def runCommand(self, command):
+    def runCommand(self, command, error=False):
         """
         Run the given command by feeding it as standard input to
         calendarserver_command_gateway in a subprocess.
@@ -166,6 +81,9 @@
         gateway = os.path.join(sourceRoot, "bin", "calendarserver_command_gateway")
 
         args = [python, gateway, "-f", self.configFileName]
+        if error:
+            args.append("--error")
+
         cwd = sourceRoot
 
         deferred = Deferred()
@@ -199,6 +117,7 @@
         self.assertEquals(results['result']['Street'], "1 Infinite Loop")
         self.assertEquals(results['result']['RealName'], "Created Location 01")
         self.assertEquals(results['result']['Comment'], "Test Comment")
+        self.assertEquals(results['result']['AutoSchedule'], False)
 
     @inlineCallbacks
     def test_getResourceList(self):
@@ -243,6 +162,11 @@
         record = directory.recordWithUID("836B1B66-2E9A-4F46-8B1C-3DD6772C20B2")
         yield self.runCommand(command_setLocationAttributes)
         directory.flushCaches()
+
+        # This appears to be necessary in order for record.autoSchedule to
+        # reflect the change
+        augment.AugmentService.refresh()
+
         record = directory.recordWithUID("836B1B66-2E9A-4F46-8B1C-3DD6772C20B2")
 
         self.assertEquals(record.extras['comment'], "Updated Test Comment")
@@ -255,7 +179,12 @@
         self.assertEquals(record.extras['zip'], "95015")
         self.assertEquals(record.extras['country'], "Updated USA")
         self.assertEquals(record.extras['phone'], "(408) 555-1213")
+        self.assertEquals(record.autoSchedule, True)
 
+        results = yield self.runCommand(command_getLocationAttributes)
+        self.assertEquals(results['result']['AutoSchedule'], True)
+
+
     @inlineCallbacks
     def test_destroyLocation(self):
         directory = getDirectory()
@@ -466,7 +395,7 @@
         <key>command</key>
         <string>listReadProxies</string>
         <key>Principal</key>
-        <string>locations:location01</string>
+        <string>836B1B66-2E9A-4F46-8B1C-3DD6772C20B2</string>
 </dict>
 </plist>
 """
@@ -478,7 +407,7 @@
         <key>command</key>
         <string>listWriteProxies</string>
         <key>Principal</key>
-        <string>locations:location01</string>
+        <string>836B1B66-2E9A-4F46-8B1C-3DD6772C20B2</string>
 </dict>
 </plist>
 """
@@ -518,7 +447,7 @@
         <key>command</key>
         <string>setLocationAttributes</string>
         <key>AutoSchedule</key>
-        <false/>
+        <true/>
         <key>GeneratedUID</key>
         <string>836B1B66-2E9A-4F46-8B1C-3DD6772C20B2</string>
         <key>RealName</key>

Copied: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/test_principals.py (from rev 5146, CalendarServer/trunk/calendarserver/tools/test/test_principals.py)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/test_principals.py	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/tools/test/test_principals.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,146 @@
+##
+# Copyright (c) 2005-2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+import os
+
+from twisted.python.filepath import FilePath
+from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, Deferred, returnValue
+
+from twistedcaldav.config import config
+from twistedcaldav.test.util import TestCase, CapturingProcessProtocol
+
+
+class MangePrincipalsTestCase(TestCase):
+
+    def setUp(self):
+        super(MangePrincipalsTestCase, self).setUp()
+
+        testRoot = os.path.join(os.path.dirname(__file__), "principals")
+        templateName = os.path.join(testRoot, "caldavd.plist")
+        templateFile = open(templateName)
+        template = templateFile.read()
+        templateFile.close()
+
+        newConfig = template % {
+            'ServerRoot' : os.path.abspath(config.ServerRoot),
+        }
+        configFilePath = FilePath(os.path.join(config.ConfigRoot, "caldavd.plist"))
+        configFilePath.setContent(newConfig)
+
+        self.configFileName = configFilePath.path
+        config.load(self.configFileName)
+
+        origUsersFile = FilePath(os.path.join(os.path.dirname(__file__),
+            "principals", "users-groups.xml"))
+        copyUsersFile = FilePath(os.path.join(config.DataRoot, "accounts.xml"))
+        origUsersFile.copyTo(copyUsersFile)
+
+        origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
+            "principals", "resources-locations.xml"))
+        copyResourcesFile = FilePath(os.path.join(config.DataRoot, "resources.xml"))
+        origResourcesFile.copyTo(copyResourcesFile)
+
+        origAugmentFile = FilePath(os.path.join(os.path.dirname(__file__),
+            "principals", "augments.xml"))
+        copyAugmentFile = FilePath(os.path.join(config.DataRoot, "augments.xml"))
+        origAugmentFile.copyTo(copyAugmentFile)
+
+        # Make sure trial puts the reactor in the right state, by letting it
+        # run one reactor iteration.  (Ignore me, please.)
+        d = Deferred()
+        reactor.callLater(0, d.callback, True)
+        return d
+
+    @inlineCallbacks
+    def runCommand(self, *additional):
+        """
+        Run calendarserver_manage_principals, passing additional as args.
+        """
+        sourceRoot = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
+        python = os.path.join(sourceRoot, "python")
+        script = os.path.join(sourceRoot, "bin", "calendarserver_manage_principals")
+
+        args = [python, script, "-f", self.configFileName]
+        args.extend(additional)
+        cwd = sourceRoot
+
+        deferred = Deferred()
+        reactor.spawnProcess(CapturingProcessProtocol(deferred, None), python, args, env=os.environ, path=cwd)
+        output = yield deferred
+        returnValue(output)
+
+    @inlineCallbacks
+    def test_help(self):
+        results = yield self.runCommand("--help")
+        self.assertTrue(results.startswith("usage:"))
+
+    @inlineCallbacks
+    def test_principalTypes(self):
+        results = yield self.runCommand("--list-principal-types")
+        self.assertTrue("groups" in results)
+        self.assertTrue("users" in results)
+        self.assertTrue("locations" in results)
+        self.assertTrue("resources" in results)
+
+    @inlineCallbacks
+    def test_modifyWriteProxies(self):
+        results = yield self.runCommand("--add-write-proxy=users:user01",
+            "locations:location01")
+        self.assertTrue(results.startswith("Added (users)user01 as a write proxy for (locations)location01"))
+
+        results = yield self.runCommand("--list-write-proxies",
+            "locations:location01")
+        self.assertTrue("Read/write proxies for (locations)location01:\n * /principals/__uids__/user01/" in results)
+
+        results = yield self.runCommand("--remove-proxy=users:user01",
+            "locations:location01")
+
+        results = yield self.runCommand("--list-write-proxies",
+            "locations:location01")
+        self.assertTrue("No write proxies for (locations)location01" in results)
+
+    @inlineCallbacks
+    def test_modifyReadProxies(self):
+        results = yield self.runCommand("--add-read-proxy=users:user01",
+            "locations:location01")
+        self.assertTrue(results.startswith("Added (users)user01 as a read proxy for (locations)location01"))
+
+        results = yield self.runCommand("--list-read-proxies",
+            "locations:location01")
+        self.assertTrue("Read-only proxies for (locations)location01:\n * /principals/__uids__/user01/" in results)
+
+        results = yield self.runCommand("--remove-proxy=users:user01",
+            "locations:location01")
+
+        results = yield self.runCommand("--list-read-proxies",
+            "locations:location01")
+        self.assertTrue("No read proxies for (locations)location01" in results)
+
+
+    @inlineCallbacks
+    def test_autoSchedule(self):
+        results = yield self.runCommand("--get-auto-schedule",
+            "locations:location01")
+        self.assertTrue(results.startswith("Autoschedule for (locations)location01 is false"))
+
+        results = yield self.runCommand("--set-auto-schedule=true",
+            "locations:location01")
+        self.assertTrue(results.startswith("Setting auto-schedule to true for (locations)location01"))
+
+        results = yield self.runCommand("--get-auto-schedule",
+            "locations:location01")
+        self.assertTrue(results.startswith("Autoschedule for (locations)location01 is true"))

Copied: CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/util.py (from rev 5146, CalendarServer/trunk/calendarserver/util.py)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/util.py	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/calendarserver/util.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,426 @@
+# -*- test-case-name: calendarserver.tap.test.test_caldav -*-
+##
+# Copyright (c) 2005-2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+__all__ = [
+    "getRootResource",
+]
+
+import errno
+import os
+from time import sleep
+
+from twisted.python.reflect import namedClass
+from twisted.internet import reactor
+from twisted.cred.portal import Portal
+from twext.web2.dav import auth
+from twext.web2.auth.basic import BasicCredentialFactory
+from twext.web2.static import File as FileResource
+from twext.python.filepath import CachingFilePath as FilePath
+
+from twext.log import Logger
+
+from twistedcaldav import memcachepool
+from twistedcaldav.accesslog import DirectoryLogWrapperResource
+from twistedcaldav.directory import augment, calendaruserproxy
+from twistedcaldav.directory.aggregate import AggregateDirectoryService
+from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
+from twistedcaldav.directory.digest import QopDigestCredentialFactory
+from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
+from twistedcaldav.directory.sudo import SudoDirectoryService
+from twistedcaldav.directory.util import NotFilePath
+from twistedcaldav.directory.wiki import WikiDirectoryService
+from twistedcaldav.notify import installNotificationClient
+from twistedcaldav.resource import CalDAVResource, AuthenticationWrapper
+from twistedcaldav.static import CalendarHomeProvisioningFile
+from twistedcaldav.static import IScheduleInboxFile
+from twistedcaldav.static import TimezoneServiceFile
+from twistedcaldav.static import AddressBookHomeProvisioningFile, DirectoryBackedAddressBookFile
+from twistedcaldav.timezones import TimezoneCache
+
+try:
+    from twistedcaldav.authkerb import NegotiateCredentialFactory
+    NegotiateCredentialFactory  # pacify pyflakes
+except ImportError:
+    NegotiateCredentialFactory = None
+
+from calendarserver.provision.root import RootResource
+from calendarserver.webadmin.resource import WebAdminResource
+from calendarserver.webcal.resource import WebCalendarResource
+
+log = Logger()
+
+
+
+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").
+    """
+
+    #
+    # Default resource classes
+    #
+    rootResourceClass            = RootResource
+    principalResourceClass       = DirectoryPrincipalProvisioningResource
+    calendarResourceClass        = CalendarHomeProvisioningFile
+    iScheduleResourceClass       = IScheduleInboxFile
+    timezoneServiceResourceClass = TimezoneServiceFile
+    webCalendarResourceClass     = WebCalendarResource
+    webAdminResourceClass        = WebAdminResource
+    addressBookResourceClass     = AddressBookHomeProvisioningFile
+    directoryBackedAddressBookResourceClass = DirectoryBackedAddressBookFile
+
+    #
+    # Setup the Directory
+    #
+    directories = []
+
+    directoryClass = namedClass(config.DirectoryService.type)
+
+    log.info("Configuring directory service of type: %s"
+        % (config.DirectoryService.type,))
+
+    baseDirectory = directoryClass(config.DirectoryService.params)
+
+    # Wait for the directory to become available
+    while not baseDirectory.isAvailable():
+        sleep(5)
+
+    directories.append(baseDirectory)
+
+    #
+    # Setup the Locations and Resources Service
+    #
+    if config.ResourceService.Enabled:
+        resourceClass = namedClass(config.ResourceService.type)
+
+        log.info("Configuring resource service of type: %s" % (resourceClass,))
+
+        resourceDirectory = resourceClass(config.ResourceService.params)
+        directories.append(resourceDirectory)
+
+    #
+    # Add sudoers directory
+    #
+    sudoDirectory = None
+
+    if config.SudoersFile and os.path.exists(config.SudoersFile):
+        log.info("Configuring SudoDirectoryService with file: %s"
+                      % (config.SudoersFile,))
+
+        sudoDirectory = SudoDirectoryService(config.SudoersFile)
+        sudoDirectory.realmName = baseDirectory.realmName
+
+        CalDAVResource.sudoDirectory = sudoDirectory
+        directories.insert(0, sudoDirectory)
+    else:
+        log.info( "Not using SudoDirectoryService; file doesn't exist: %s"
+            % (config.SudoersFile,)
+        )
+
+    #
+    # Add wiki directory service
+    #
+    if config.Authentication.Wiki.Enabled:
+        wikiDirectory = WikiDirectoryService()
+        wikiDirectory.realmName = baseDirectory.realmName
+        directories.append(wikiDirectory)
+
+    directory = AggregateDirectoryService(directories)
+
+    if sudoDirectory:
+        directory.userRecordTypes.insert(0,
+            SudoDirectoryService.recordType_sudoers)
+
+    #
+    # 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 PoxyDB Service
+    #
+    proxydbClass = namedClass(config.ProxyDBService.type)
+
+    log.info("Configuring proxydb service of type: %s" % (proxydbClass,))
+
+    try:
+        calendaruserproxy.ProxyDBService = proxydbClass(**config.ProxyDBService.params)
+    except IOError:
+        log.error("Could not start proxydb service")
+        raise
+
+    #
+    # Make sure proxies get initialized
+    #
+    if config.ProxyLoadFromFile:
+        def _doProxyUpdate():
+            loader = XMLCalendarUserProxyLoader(config.ProxyLoadFromFile)
+            return loader.updateProxyDB()
+
+        reactor.addSystemEventTrigger("after", "startup", _doProxyUpdate)
+
+    #
+    # Configure Memcached Client Pool
+    #
+    memcachepool.installPools(
+        config.Memcached.Pools,
+        config.Memcached.MaxClients,
+    )
+
+    #
+    # Configure NotificationClient
+    #
+    if config.Notifications.Enabled:
+        installNotificationClient(
+            config.Notifications.InternalNotificationHost,
+            config.Notifications.InternalNotificationPort,
+        )
+
+    #
+    # Configure the Site and Wrappers
+    #
+    credentialFactories = []
+
+    portal = Portal(auth.DavRealm())
+
+    portal.registerChecker(directory)
+
+    realm = directory.realmName or ""
+
+    log.info("Configuring authentication for realm: %s" % (realm,))
+
+    for scheme, schemeConfig in config.Authentication.iteritems():
+        scheme = scheme.lower()
+
+        credFactory = None
+
+        if schemeConfig["Enabled"]:
+            log.info("Setting up scheme: %s" % (scheme,))
+
+            if scheme == "kerberos":
+                if not NegotiateCredentialFactory:
+                    log.info("Kerberos support not available")
+                    continue
+
+                try:
+                    principal = schemeConfig["ServicePrincipal"]
+                    if not principal:
+                        credFactory = NegotiateCredentialFactory(
+                            type="HTTP",
+                            hostname=config.ServerHostName,
+                        )
+                    else:
+                        credFactory = NegotiateCredentialFactory(
+                            principal=principal,
+                        )
+                except ValueError:
+                    log.info("Could not start Kerberos")
+                    continue
+
+            elif scheme == "digest":
+                credFactory = QopDigestCredentialFactory(
+                    schemeConfig["Algorithm"],
+                    schemeConfig["Qop"],
+                    realm,
+                )
+
+            elif scheme == "basic":
+                credFactory = BasicCredentialFactory(realm)
+
+            elif scheme == "wiki":
+                pass
+
+            else:
+                log.error("Unknown scheme: %s" % (scheme,))
+
+        if credFactory:
+            credentialFactories.append(credFactory)
+
+
+    #
+    # Setup Resource hierarchy
+    #
+    log.info("Setting up document root at: %s"
+                  % (config.DocumentRoot,))
+    log.info("Setting up principal collection: %r"
+                  % (principalResourceClass,))
+
+    principalCollection = principalResourceClass("/principals/", directory)
+
+    log.info("Setting up calendar collection: %r" % (calendarResourceClass,))
+
+    calendarCollection = calendarResourceClass(
+        os.path.join(config.DocumentRoot, "calendars"),
+        directory, "/calendars/",
+    )
+
+    log.info("Setting up root resource: %r" % (rootResourceClass,))
+
+    root = rootResourceClass(
+        config.DocumentRoot,
+        principalCollections=(principalCollection,),
+    )
+
+    if config.EnableCardDAV:
+        root.saclService = "addressbook" # XXX this needs to be dealt with
+                                         # differently if caldav and carddav
+                                         # are going to be in the same process
+        log.info("Setting up address book collection: %r" % (addressBookResourceClass,))
+
+        addressBookCollection = addressBookResourceClass(
+            os.path.join(config.DocumentRoot, "addressbooks"),
+            directory, "/addressbooks/"
+        )
+
+        directoryPath = os.path.join(config.DocumentRoot, "directory")
+        doBacking = config.DirectoryAddressBook and config.EnableSearchAddressBook
+        if doBacking:
+            log.info("Setting up directory address book: %r" % (directoryBackedAddressBookResourceClass,))
+
+            directoryBackedAddressBookCollection = directoryBackedAddressBookResourceClass(
+                directoryPath,
+                principalCollections=(principalCollection,)
+            )
+            # do this after process is owned by carddav user, not root.  XXX
+            # this should be fixed to execute at a different stage of service
+            # startup entirely.
+            reactor.callLater(1.0, directoryBackedAddressBookCollection.provisionDirectory)
+        else:
+            # remove /directory from previous runs that may have created it
+            try:
+                FilePath(directoryPath).remove()
+                log.info("Deleted: %s" %    directoryPath)
+            except (OSError, IOError), e:
+                if e.errno != errno.ENOENT:
+                    log.error("Could not delete: %s : %r" %  (directoryPath, e,))
+
+        root.putChild('addressbooks', addressBookCollection)
+        if doBacking:
+            root.putChild('directory', directoryBackedAddressBookCollection)
+
+    root.putChild("principals", principalCollection)
+    root.putChild("calendars", calendarCollection)
+
+    for name, info in config.Aliases.iteritems():
+        if os.path.sep in name or not info.get("path", None):
+            log.error("Invalid alias: %s" % (name,))
+            continue
+        log.info("Adding alias %s -> %s" % (name, info["path"]))
+        resource = FileResource(info["path"])
+        root.putChild(name, resource)
+
+    # Timezone service is optional
+    if config.EnableTimezoneService:
+        log.info("Setting up time zone service resource: %r"
+                      % (timezoneServiceResourceClass,))
+
+        timezoneService = timezoneServiceResourceClass(
+            NotFilePath(isfile=True),
+            root,
+        )
+        root.putChild("timezones", timezoneService)
+
+    # iSchedule service is optional
+    if config.Scheduling.iSchedule.Enabled:
+        log.info("Setting up iSchedule inbox resource: %r"
+                      % (iScheduleResourceClass,))
+
+        ischedule = iScheduleResourceClass(
+            NotFilePath(isfile=True),
+            root,
+        )
+        root.putChild("ischedule", ischedule)
+
+    #
+    # WebCal
+    #
+    if config.WebCalendarRoot:
+        log.info("Setting up WebCalendar resource: %s"
+                      % (config.WebCalendarRoot,))
+        webCalendar = webCalendarResourceClass(
+            config.WebCalendarRoot,
+            principalCollections=(principalCollection,),
+        )
+        root.putChild("webcal", webCalendar)
+
+    #
+    # WebAdmin
+    #
+    if config.EnableWebAdmin:
+        log.info("Setting up WebAdmin resource")
+        webAdmin = webAdminResourceClass(
+            config.WebCalendarRoot,
+            root,
+            directory,
+            principalCollections=(principalCollection,),
+        )
+        root.putChild("admin", webAdmin)
+
+    #
+    # Configure ancillary data
+    #
+    log.info("Setting up Timezone Cache")
+    TimezoneCache.create()
+
+
+    log.info("Configuring authentication wrapper")
+
+    overrides = { }
+    if resources:
+        for path, cls, args, scheme in resources:
+            root.putChild(path, cls(root, *args))
+
+            if scheme == "basic":
+                overrides[path] = (BasicCredentialFactory(realm),)
+
+            elif scheme == "digest":
+                schemeConfig = config.Authentication.Digest
+                overrides[path] = (QopDigestCredentialFactory(
+                    schemeConfig["Algorithm"],
+                    schemeConfig["Qop"],
+                    realm,
+                ),)
+            log.info("Overriding %s with %s (%s)" % (path, cls, scheme))
+
+    authWrapper = AuthenticationWrapper(
+        root,
+        portal,
+        credentialFactories,
+        (auth.IPrincipal,),
+        overrides=overrides,
+    )
+
+    logWrapper = DirectoryLogWrapperResource(
+        authWrapper,
+        directory,
+    )
+
+    return logWrapper
+

Modified: CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-apple.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-apple.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -16,7 +16,7 @@
     limitations under the License.
   -->
 
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
   <dict>
 
@@ -76,14 +76,26 @@
         Data Store
       -->
 
+    <!-- Server root -->
+    <key>ServerRoot</key>
+    <string>/Library/CalendarServer</string>
+
     <!-- Data root -->
     <key>DataRoot</key>
-    <string>/Library/CalendarServer/Data/</string>
+    <string>Data</string>
 
     <!-- Document root -->
     <key>DocumentRoot</key>
-    <string>/Library/CalendarServer/Documents/</string>
+    <string>Documents</string>
 
+    <!-- Configuration root -->
+    <key>ConfigRoot</key>
+    <string>/etc/caldavd</string>
+
+    <!-- Run root -->
+    <key>RunRoot</key>
+    <string>/var/run</string>
+
     <!-- Child aliases -->
     <key>Aliases</key>
     <dict>
@@ -96,7 +108,12 @@
        -->
     </dict>
 
-    <!-- User quota (in bytes) -->
+
+    <!--
+        Quotas and limits
+      -->
+
+    <!-- User quota (in bytes) [0 = no quota] -->
     <key>UserQuota</key>
     <integer>104857600</integer><!-- 100Mb -->
 
@@ -134,7 +151,7 @@
       <key>params</key>
       <dict>
         <key>xmlFile</key>
-        <string>/etc/caldavd/accounts.xml</string>
+        <string>accounts.xml</string>
       </dict>
     </dict>
     -->
@@ -155,109 +172,7 @@
     </dict>
 
 
-    <!-- Resource and Locations service -->
-    <key>ResourceService</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>/Library/CalendarServer/Data/resources.xml</string>
-      </dict>
-    </dict>
-
-
     <!--
-        Augment service
-
-        Augments for the directory service records to add calendar specific attributes.
-
-        A variety of augment services are available for use.
-        When using a partitioned server, a service that can be accessed from each host will be needed.
-      -->
-
-    <!-- XML File Augment Service -->
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFiles</key>
-        <array>
-	      <string>/etc/caldavd/augments.xml</string>
-        </array>
-      </dict>
-    </dict>
-    
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- Sqlite ProxyDB Service -->
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/Library/CalendarServer/Data/proxies.sqlite</string>
-      </dict>
-    </dict>
-
-    <!-- PostgreSQL ProxyDB Service -->
-    <!--
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>proxies</string>
-      </dict>
-    </dict>
-     -->
-
-    <!--
         Special principals
 
         These principals are granted special access and/or perform
@@ -276,10 +191,6 @@
       <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
     </array>
 
-    <!-- Principals that can pose as other principals -->
-    <key>SudoersFile</key>
-    <string>/etc/caldavd/sudoers.plist</string>
-
     <!-- Create "proxy access" principals -->
     <key>EnableProxyPrincipals</key>
     <true/>
@@ -354,15 +265,19 @@
         Logging
       -->
 
+    <!-- Log root -->
+    <key>LogRoot</key>
+    <string>/var/log/caldavd</string>
+
     <!-- Apache-style access log -->
     <key>AccessLogFile</key>
-    <string>/var/log/caldavd/access.log</string>
+    <string>access.log</string>
     <key>RotateAccessLog</key>
     <true/>
 
     <!-- Server activity log -->
     <key>ErrorLogFile</key>
-    <string>/var/log/caldavd/error.log</string>
+    <string>error.log</string>
 
     <!-- Log levels -->
     <key>DefaultLogLevel</key>
@@ -370,15 +285,11 @@
 
     <!-- Global server stats --> 
     <key>GlobalStatsSocket</key> 
-    <string>/var/run/caldavd-stats.sock</string> 
+    <string>caldavd-stats.sock</string> 
 
-    <!-- Server statistics file -->
-    <key>ServerStatsFile</key>
-    <string>/var/run/caldavd/stats.plist</string>
-
     <!-- Server process ID file -->
     <key>PIDFile</key>
-    <string>/var/run/caldavd.pid</string>
+    <string>caldavd.pid</string>
 
 
     <!--
@@ -486,7 +397,7 @@
         <array>
         </array>
         <key>Servers</key>
-        <string>/etc/caldavd/servertoserver.xml</string>
+        <string>servertoserver.xml</string>
       </dict>
 
       <!-- iMIP protocol options -->
@@ -566,11 +477,7 @@
     <key>EnablePrivateEvents</key>
     <true/>
 
-    <!-- Timezone Service -->
-    <key>EnableTimezoneService</key>
-    <true/>
 
-
     <!--
         Miscellaneous items
       -->

Modified: CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-partitioning-primary.plist
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-partitioning-primary.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-partitioning-primary.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -28,7 +28,7 @@
 	    <key>ServerPartitionID</key>
 	    <string>00001</string>
 	    <key>PartitionConfigFile</key>
-	    <string>/etc/caldavd/partitions.plist</string>
+	    <string>partitions.plist</string>
 	    <key>MaxClients</key>
 	    <integer>5</integer>
 	</dict>

Modified: CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-partitioning-secondary.plist
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-partitioning-secondary.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-partitioning-secondary.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -28,7 +28,7 @@
 	    <key>ServerPartitionID</key>
 	    <string>00002</string>
 	    <key>PartitionConfigFile</key>
-	    <string>/etc/caldavd/partitions.plist</string>
+	    <string>partitions.plist</string>
 	    <key>MaxClients</key>
 	    <integer>5</integer>
 	</dict>

Modified: CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-test.plist
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-test.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd-test.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -16,7 +16,7 @@
     limitations under the License.
   -->
 
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
   <dict>
 
@@ -43,10 +43,11 @@
     <key>SSLPort</key>
     <integer>8443</integer>
 
-    <!-- Redirect non-SSL ports to an SSL port -->
+    <!-- Redirect non-SSL ports to an SSL port (if configured for SSL) -->
     <key>RedirectHTTPToHTTPS</key>
     <false/>
 
+
     <!--
         Network address configuration information
 
@@ -73,14 +74,26 @@
         Data Store
       -->
 
+    <!-- Server root -->
+    <key>ServerRoot</key>
+    <string>./data</string>
+
     <!-- Data root -->
     <key>DataRoot</key>
-    <string>data/</string>
+    <string>Data</string>
 
     <!-- Document root -->
     <key>DocumentRoot</key>
-    <string>twistedcaldav/test/data/</string>
+    <string>Documents</string>
 
+    <!-- Configuration root -->
+    <key>ConfigRoot</key>
+    <string>./conf</string>
+
+    <!-- Run root -->
+    <key>RunRoot</key>
+    <string>Logs</string>
+
     <!-- Child aliases -->
     <key>Aliases</key>
     <dict>
@@ -93,7 +106,12 @@
        -->
     </dict>
 
-    <!-- User quota (in bytes) -->
+
+    <!--
+        Quotas and limits
+      -->
+
+    <!-- User quota (in bytes) [0 = no quota] -->
     <key>UserQuota</key>
     <integer>104857600</integer><!-- 100Mb -->
 
@@ -130,35 +148,10 @@
       <key>params</key>
       <dict>
         <key>xmlFile</key>
-        <string>conf/auth/accounts-test.xml</string>
-        <key>recordTypes</key>
-        <array>
-            <string>users</string>
-            <string>groups</string>
-        </array>
+        <string>./conf/auth/accounts-test.xml</string>
       </dict>
     </dict>
     
-    <!-- Resource and Location Service -->
-    <key>ResourceService</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>conf/auth/resources-test.xml</string>
-        <key>recordTypes</key>
-        <array>
-            <string>locations</string>
-            <string>resources</string>
-        </array>
-      </dict>
-    </dict>
-    
     <!-- Open Directory Service (Mac OS X) -->
     <!--
     <key>DirectoryService</key>
@@ -176,15 +169,21 @@
     </dict>
     -->
 
-    <!--
-        Augment service
+    <!-- Resource and Location Service -->
+    <key>ResourceService</key>
+    <dict>
+      <key>Enabled</key>
+      <true/>
+      <key>type</key>
+      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      
+      <key>params</key>
+      <dict>
+        <key>xmlFile</key>
+        <string>./conf/auth/resources-test.xml</string>
+      </dict>
+    </dict>
 
-        Augments for the directory service records to add calendar specific attributes.
-
-        A variety of augment services are available for use.
-        When using a partitioned server, a service that can be accessed from each host will be needed.
-      -->
-
     <!-- XML File Augment Service -->
     <key>AugmentService</key>
     <dict>
@@ -195,11 +194,11 @@
       <dict>
         <key>xmlFiles</key>
         <array>
-	      <string>conf/auth/augments-test.xml</string>
+	      <string>./conf/auth/augments-test.xml</string>
         </array>
       </dict>
     </dict>
-    
+
     <!-- Sqlite Augment Service -->
     <!--
     <key>AugmentService</key>
@@ -210,7 +209,7 @@
       <key>params</key>
       <dict>
         <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
+        <string>./conf/auth/augments.sqlite</string>
       </dict>
     </dict>
      -->
@@ -241,7 +240,7 @@
       <key>params</key>
       <dict>
         <key>dbpath</key>
-        <string>data/proxies.sqlite</string>
+        <string>proxies.sqlite</string>
       </dict>
     </dict>
 
@@ -262,9 +261,10 @@
     </dict>
      -->
 
-	<key>ProxyLoadFromFile</key>
-    <string>conf/auth/proxies-test.xml</string>
+    <key>ProxyLoadFromFile</key>
+    <string>./conf/auth/proxies-test.xml</string>
 
+
     <!--
         Special principals
 
@@ -286,7 +286,7 @@
 
     <!-- Principals that can pose as other principals -->
     <key>SudoersFile</key>
-    <string>conf/sudoers.plist</string>
+    <string>sudoers.plist</string>
 
     <!-- Create "proxy access" principals -->
     <key>EnableProxyPrincipals</key>
@@ -343,7 +343,7 @@
       <key>Kerberos</key>
       <dict>
         <key>Enabled</key>
-        <false/>
+        <true/>
         <key>ServicePrincipal</key>
         <string></string>
       </dict>
@@ -370,15 +370,19 @@
         Logging
       -->
 
+    <!-- Log root -->
+    <key>LogRoot</key>
+    <string>Logs</string>
+
     <!-- Apache-style access log -->
     <key>AccessLogFile</key>
-    <string>logs/access.log</string>
+    <string>access.log</string>
     <key>RotateAccessLog</key>
     <false/>
 
     <!-- Server activity log -->
     <key>ErrorLogFile</key>
-    <string>logs/error.log</string>
+    <string>error.log</string>
 
     <!-- Log levels -->
     <key>DefaultLogLevel</key>
@@ -393,25 +397,9 @@
       -->
     </dict>
 
-    <!-- Global server stats --> 
-    <key>GlobalStatsSocket</key> 
-    <string>logs/caldavd-stats.sock</string> 
-
-    <!-- Global server stats logging period --> 
-    <key>GlobalStatsLoggingPeriod</key> 
-    <integer>60</integer> 
-
-    <!-- Global server stats logging frequency [0 = disable stats] --> 
-    <key>GlobalStatsLoggingFrequency</key> 
-    <integer>12</integer>
-
-    <!-- Server statistics file -->
-    <key>ServerStatsFile</key>
-    <string>logs/stats.plist</string>
-
     <!-- Server process ID file -->
     <key>PIDFile</key>
-    <string>logs/caldavd.pid</string>
+    <string>caldavd.pid</string>
 
 
     <!--
@@ -426,6 +414,7 @@
       <key>HTTP</key>
       <false/>
     </dict>
+
     <!-- Enable accounting for specific principals -->
     <key>AccountingPrincipals</key>
     <array>
@@ -585,7 +574,7 @@
         <array>
         </array>
         <key>Servers</key>
-        <string>conf/servertoserver-test.xml</string>
+        <string>servertoserver-test.xml</string>
       </dict>
 
       <!-- iMIP protocol options -->
@@ -635,16 +624,16 @@
         </array>
       </dict>
 
-	  <!-- General options for scheduling -->
-	  <key>Options</key>
-	  <dict>
+      <!-- General options for scheduling -->
+      <key>Options</key>
+      <dict>
         <key>AllowGroupAsOrganizer</key>
         <false/>
         <key>AllowLocationAsOrganizer</key>
         <false/>
         <key>AllowResourceAsOrganizer</key>
         <false/>
-       </dict>
+      </dict>
 
     </dict>
 
@@ -701,10 +690,9 @@
     <key>HTTPRetryAfter</key>
     <integer>180</integer>
 
-    <!-- A unix socket used for communication between the child and master processes.
-         An empty value tells the server to use a tcp socket instead. -->
+    <!-- For child-master IPC. [empty = use tcp] -->
     <key>ControlSocket</key>
-    <string>logs/caldavd.sock</string>
+    <string>caldavd.sock</string>
 
     <!-- Support for Memcached -->
     <key>Memcached</key>
@@ -715,7 +703,7 @@
       <string>memcached</string> <!-- Find in PATH -->
       <key>Options</key>
       <array>
-        <!--<string>-vv</string>-->
+        <!--<string>-vv</string>--> <!-- Be very verbose -->
       </array>
     </dict>
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd.plist
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/caldavd.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -16,7 +16,7 @@
     limitations under the License.
   -->
 
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
   <dict>
 
@@ -76,14 +76,26 @@
         Data Store
       -->
 
+    <!-- Server root -->
+    <key>ServerRoot</key>
+    <string>/Library/CalendarServer</string>
+
     <!-- Data root -->
     <key>DataRoot</key>
-    <string>/Library/CalendarServer/Data/</string>
+    <string>Data</string>
 
     <!-- Document root -->
     <key>DocumentRoot</key>
-    <string>/Library/CalendarServer/Documents/</string>
+    <string>Documents</string>
 
+    <!-- Configuration root -->
+    <key>ConfigRoot</key>
+    <string>/etc/caldavd</string>
+
+    <!-- Run root -->
+    <key>RunRoot</key>
+    <string>/var/run</string>
+
     <!-- Child aliases -->
     <key>Aliases</key>
     <dict>
@@ -96,13 +108,18 @@
        -->
     </dict>
 
-    <!-- User quota (in bytes) -->
+
+    <!--
+        Quotas and limits
+      -->
+
+    <!-- User quota (in bytes) [0 = no quota] -->
     <key>UserQuota</key>
-    <integer>104857600</integer><!-- 100Mb -->
+    <integer>104857600</integer> <!-- 100Mb -->
 
     <!-- Attachment size limit (in bytes) -->
     <key>MaximumAttachmentSize</key>
-    <integer>1048576</integer><!-- 1Mb -->
+    <integer>1048576</integer> <!-- 1Mb -->
 
     <!-- Maximum number of unique attendees per entire event -->
     <!-- 0 for no limit -->
@@ -133,7 +150,7 @@
       <key>params</key>
       <dict>
         <key>xmlFile</key>
-        <string>/etc/caldavd/accounts.xml</string>
+        <string>accounts.xml</string>
       </dict>
     </dict>
     
@@ -154,93 +171,8 @@
     </dict>
      -->
 
-    <!--
-        Augment service
 
-        Augments for the directory service records to add calendar specific attributes.
-
-        A variety of augment services are available for use.
-        When using a partitioned server, a service that can be accessed from each host will be needed.
-      -->
-
-    <!-- XML File Augment Service -->
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFiles</key>
-        <array>
-	      <string>/etc/caldavd/augments.xml</string>
-        </array>
-      </dict>
-    </dict>
-    
-    <!-- Sqlite Augment Service -->
     <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- Sqlite ProxyDB Service -->
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/proxies.sqlite</string>
-      </dict>
-    </dict>
-
-    <!-- PostgreSQL ProxyDB Service -->
-    <!--
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>proxies</string>
-      </dict>
-    </dict>
-     -->
-
-    <!--
         Special principals
 
         These principals are granted special access and/or perform
@@ -259,10 +191,6 @@
       <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
     </array>
 
-    <!-- Principals that can pose as other principals -->
-    <key>SudoersFile</key>
-    <string>/etc/caldavd/sudoers.plist</string>
-
     <!-- Create "proxy access" principals -->
     <key>EnableProxyPrincipals</key>
     <true/>
@@ -330,15 +258,19 @@
         Logging
       -->
 
+    <!-- Log root -->
+    <key>LogRoot</key>
+    <string>/var/log/caldavd</string>
+
     <!-- Apache-style access log -->
     <key>AccessLogFile</key>
-    <string>/var/log/caldavd/access.log</string>
+    <string>access.log</string>
     <key>RotateAccessLog</key>
     <true/>
 
     <!-- Server activity log -->
     <key>ErrorLogFile</key>
-    <string>/var/log/caldavd/error.log</string>
+    <string>error.log</string>
 
     <!-- Log levels -->
     <key>DefaultLogLevel</key>
@@ -346,15 +278,11 @@
 
     <!-- Global server stats --> 
     <key>GlobalStatsSocket</key> 
-    <string>/var/run/caldavd-stats.sock</string> 
+    <string>caldavd-stats.sock</string> 
 
-    <!-- Server statistics file -->
-    <key>ServerStatsFile</key>
-    <string>/var/run/caldavd/stats.plist</string>
-
     <!-- Server process ID file -->
     <key>PIDFile</key>
-    <string>/var/run/caldavd.pid</string>
+    <string>caldavd.pid</string>
 
 
     <!--
@@ -462,7 +390,7 @@
         <array>
         </array>
         <key>Servers</key>
-        <string>/etc/caldavd/servertoserver.xml</string>
+        <string>servertoserver.xml</string>
       </dict>
 
       <!-- iMIP protocol options -->

Copied: CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd-apple.plist (from rev 5146, CalendarServer/trunk/conf/carddavd-apple.plist)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd-apple.plist	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd-apple.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,711 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+  -->
+
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+  <dict>
+
+    <!--
+        Public network address information
+
+        This is the server's public network address, which is provided to
+        clients in URLs and the like.  It may or may not be the network
+        address that the server is listening to directly, though it is by
+        default.  For example, it may be the address of a load balancer or
+        proxy which forwards connections to the server.
+      -->
+
+    <!-- Network host name [empty = system host name] -->
+    <key>ServerHostName</key>
+    <string></string> <!-- The hostname clients use when connecting -->
+
+    <key>EnableCardDAV</key>
+    <true/>
+
+    <key>EnableCalDAV</key>
+    <false/>
+
+    <key>ConfigRoot</key>
+    <string>/etc/carddavd</string>
+
+    <key>LogRoot</key>
+    <string>/var/log/carddavd</string>
+
+    <key>PIDFile</key>
+    <string>carddavd.pid</string>
+
+    <key>GlobalStatsSocket</key>
+    <string>carddavd-stats.sock</string>
+
+    <key>ControlSocket</key>
+    <string>carddavd.sock</string>
+
+    <!-- HTTP port [0 = disable HTTP] -->
+    <key>HTTPPort</key>
+    <integer>8800</integer>
+
+    <!-- SSL port [0 = disable HTTPS] -->
+    <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
+    <!--
+    <key>SSLPort</key>
+    <integer>8443</integer>
+    -->
+
+    <!-- Redirect non-SSL ports to an SSL port (if configured for SSL) -->
+    <key>RedirectHTTPToHTTPS</key>
+    <false/>
+
+
+    <!--
+        Network address configuration information
+
+        This configures the actual network address that the server binds to.
+      -->
+
+    <!-- List of IP addresses to bind to [empty = all] -->
+    <key>BindAddresses</key>
+    <array>
+    </array>
+
+    <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
+    <key>BindHTTPPorts</key>
+    <array>
+    </array>
+
+    <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
+    <key>BindSSLPorts</key>
+    <array>
+    </array>
+
+
+    <!--
+        Data Store
+      -->
+
+    <!-- Server root -->
+    <key>ServerRoot</key>
+    <string>/Library/CalendarServer</string>
+
+    <!-- Data root -->
+    <key>DataRoot</key>
+    <string>Data</string>
+
+    <!-- Document root -->
+    <key>DocumentRoot</key>
+    <string>Documents</string>
+
+    <!-- Configuration root -->
+    <key>ConfigRoot</key>
+    <string>/etc/carddavd</string>
+
+    <!-- Log root -->
+    <key>LogRoot</key>
+    <string>/var/log/carddavd</string>
+
+    <!-- Run root -->
+    <key>RunRoot</key>
+    <string>/var/run</string>
+
+    <!-- Child aliases -->
+    <key>Aliases</key>
+    <dict>
+      <!--
+      <key>foo</key>
+      <dict>
+        <key>path</key>
+        <string>/path/to/foo</string>
+      </dict>
+       -->
+    </dict>
+
+    <!-- User quota (in bytes) -->
+    <key>UserQuota</key>
+    <integer>104857600</integer><!-- 100Mb -->
+
+    <!-- Attachment size limit (in bytes) -->
+    <key>MaximumAttachmentSize</key>
+    <integer>1048576</integer><!-- 1Mb -->
+
+    <!-- Maximum number of unique attendees per entire event -->
+    <!-- 0 for no limit -->
+    <key>MaxAttendeesPerInstance</key>
+    <integer>100</integer>
+
+    <!-- Maximum number of instances allowed for a single RRULE -->
+    <!-- 0 for no limit -->
+    <key>MaxInstancesForRRULE</key>
+    <integer>400</integer>
+
+
+    <!--
+        Directory service
+
+        A directory service provides information about principals (eg.
+        users, groups, locations and resources) to the server.
+
+        A variety of directory services are available for use.
+      -->
+
+    <!-- Disable resource service. -->
+    <key>ResourceService</key>
+    <dict>
+      <key>Enabled</key>
+      <false/>
+    </dict>
+
+    <!-- XML File Directory Service -->
+    <!--
+    <key>DirectoryService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      
+      <key>params</key>
+      <dict>
+        <key>xmlFile</key>
+        <string>accounts.xml</string>
+      </dict>
+    </dict>
+    -->
+    
+    <!-- Open Directory Service (Mac OS X) -->
+    <key>DirectoryService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
+      
+      <key>params</key>
+      <dict>
+        <key>node</key>
+        <string>/Search</string>
+        <key>cacheTimeout</key>
+        <integer>30</integer>
+      </dict>
+    </dict>
+
+    <!--
+        Augment service
+
+        Augments for the directory service records to add calendar specific attributes.
+
+        A variety of augment services are available for use.
+        When using a partitioned server, a service that can be accessed from each host will be needed.
+      -->
+
+    <!-- XML File Augment Service -->
+    <key>AugmentService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>xmlFiles</key>
+        <array>
+	      <string>augments.xml</string>
+        </array>
+      </dict>
+    </dict>
+    
+    <!-- Sqlite Augment Service -->
+    <!--
+    <key>AugmentService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>dbpath</key>
+        <string>augments.sqlite</string>
+      </dict>
+    </dict>
+     -->
+
+    <!-- PostgreSQL Augment Service -->
+    <!--
+    <key>AugmentService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>host</key>
+        <string>localhost</string>
+        <key>database</key>
+        <string>augments</string>
+      </dict>
+    </dict>
+     -->
+
+    <!-- PostgreSQL ProxyDB Service -->
+    <!--
+    <key>ProxyDBService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
+      
+      <key>params</key>
+      <dict>
+        <key>host</key>
+        <string>localhost</string>
+        <key>database</key>
+        <string>proxies</string>
+      </dict>
+    </dict>
+     -->
+
+    <!--
+        Special principals
+
+        These principals are granted special access and/or perform
+        special roles on the server.
+      -->
+
+    <!-- Principals with "DAV:all" access (relative URLs) -->
+    <key>AdminPrincipals</key>
+    <array>
+      <!-- <string>/principals/__uids__/AEB68DD7-D2B8-4D4D-A574-2A4533DF36A4/</string> -->
+    </array>
+
+    <!-- Principals with "DAV:read" access (relative URLs) -->
+    <key>ReadPrincipals</key>
+    <array>
+      <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
+    </array>
+
+    <!-- Principals that can pose as other principals -->
+    <key>SudoersFile</key>
+    <string>sudoers.plist</string>
+
+    <!-- Create "proxy access" principals -->
+    <key>EnableProxyPrincipals</key>
+    <true/>
+
+
+    <!--
+        Permissions
+      -->
+
+    <!-- Anonymous read access for root resource -->
+    <key>EnableAnonymousReadRoot</key>
+    <false/>
+
+    <!-- Anonymous read access for resource hierarchy -->
+    <key>EnableAnonymousReadNav</key>
+    <false/>
+
+    <!-- Enables directory listings for principals -->
+    <key>EnablePrincipalListings</key>
+    <false/>
+
+    <!-- Render calendar collections as a monolithic iCalendar object -->
+    <key>EnableMonolithicCalendars</key>
+    <true/>
+
+
+    <!--
+        Authentication
+      -->
+
+    <key>Authentication</key>
+    <dict>
+
+      <!-- Clear text; best avoided -->
+      <key>Basic</key>
+      <dict>
+        <key>Enabled</key>
+        <false/>
+      </dict>
+
+      <!-- Digest challenge/response -->
+      <key>Digest</key>
+      <dict>
+        <key>Enabled</key>
+        <true/>
+        <key>Algorithm</key>
+        <string>md5</string>
+        <key>Qop</key>
+        <string></string>
+      </dict>
+
+      <!-- Kerberos/SPNEGO -->
+      <key>Kerberos</key>
+      <dict>
+        <key>Enabled</key>
+        <true/>
+        <key>ServicePrincipal</key>
+        <string></string>
+      </dict>
+
+      <!-- Wikiserver authentication (Mac OS X) -->
+      <key>Wiki</key>
+      <dict>
+        <key>Enabled</key>
+        <true/>
+      </dict>
+
+    </dict>
+
+
+    <!--
+        Logging
+      -->
+
+    <!-- Apache-style access log -->
+    <key>AccessLogFile</key>
+    <string>access.log</string>
+    <key>RotateAccessLog</key>
+    <true/>
+
+    <!-- Server activity log -->
+    <key>ErrorLogFile</key>
+    <string>error.log</string>
+
+    <!-- Log levels -->
+    <key>DefaultLogLevel</key>
+    <string>warn</string> <!-- debug, info, warn, error -->
+
+    <!-- Global server stats --> 
+    <key>GlobalStatsSocket</key> 
+    <string>carddavd-stats.sock</string> 
+
+    <!-- Server process ID file -->
+    <key>PIDFile</key>
+    <string>carddavd.pid</string>
+
+
+    <!--
+        SSL/TLS
+      -->
+
+    <!-- Public key -->
+    <key>SSLCertificate</key>
+    <string></string>
+
+    <!-- SSL authority chain (for intermediate certs) -->
+    <key>SSLAuthorityChain</key>
+    <string></string>
+
+    <!-- Private key -->
+    <key>SSLPrivateKey</key>
+    <string></string>
+
+
+    <!--
+        Process management
+      -->
+
+    <key>UserName</key>
+    <string>calendar</string>
+
+    <key>GroupName</key>
+    <string>calendar</string>
+
+    <key>ProcessType</key>
+    <string>Combined</string>
+
+    <key>MultiProcess</key>
+    <dict>
+      <key>ProcessCount</key>
+      <integer>0</integer> <!-- 0 = larger of: 4 or (2 * CPU count) -->
+    </dict>
+
+
+    <!--
+        Notifications
+      -->
+
+    <key>Notifications</key>
+    <dict>
+      <!-- Time spent coalescing notifications before delivery -->
+      <key>CoalesceSeconds</key>
+      <integer>3</integer>
+
+      <key>Services</key>
+      <dict>
+        <key>XMPPNotifier</key>
+        <dict>
+          <!-- XMPP notification service -->
+          <key>Service</key>
+          <string>twistedcaldav.notify.XMPPNotifierService</string>
+          <key>Enabled</key>
+          <false/>
+
+          <!-- XMPP host and port to contact -->
+          <key>Host</key>
+          <string>xmpp.host.name</string>
+          <key>Port</key>
+          <integer>5222</integer>
+
+          <!-- Jabber ID and password for the server -->
+          <key>JID</key>
+          <string>jid at xmpp.host.name/resource</string>
+          <key>Password</key>
+          <string>password_goes_here</string>
+
+          <!-- PubSub service address -->
+          <key>ServiceAddress</key>
+          <string>pubsub.xmpp.host.name</string>
+        </dict>
+      </dict>
+    </dict>
+
+
+    <!--
+        Server-to-server protocol
+      -->
+
+    <key>Scheduling</key>
+    <dict>
+
+      <!-- CalDAV protocol options -->
+      <key>CalDAV</key>
+      <dict>
+        <key>EmailDomain</key>
+        <string></string>
+        <key>HTTPDomain</key>
+        <string></string>
+        <key>AddressPatterns</key>
+        <array>
+        </array>
+      </dict>
+
+      <!-- iSchedule protocol options -->
+      <key>iSchedule</key>
+      <dict>
+        <key>Enabled</key>
+        <false/>
+        <key>AddressPatterns</key>
+        <array>
+        </array>
+        <key>Servers</key>
+        <string>servertoserver.xml</string>
+      </dict>
+
+      <!-- iMIP protocol options -->
+      <key>iMIP</key>
+      <dict>
+        <key>Enabled</key>
+        <false/>
+        <key>MailGatewayServer</key>
+        <string>localhost</string>
+        <key>MailGatewayPort</key>
+        <integer>62310</integer>
+        <key>Sending</key>
+        <dict>
+          <key>Server</key>
+          <string></string>
+          <key>Port</key>
+          <integer>587</integer>
+          <key>UseSSL</key>
+          <true/>
+          <key>Username</key>
+          <string></string>
+          <key>Password</key>
+          <string></string>
+          <key>Address</key>
+          <string></string> <!-- Address email will be sent from -->
+        </dict>
+        <key>Receiving</key>
+        <dict>
+          <key>Server</key>
+          <string></string>
+          <key>Port</key>
+          <integer>995</integer>
+          <key>Type</key>
+          <string></string> <!-- Either "pop" or "imap" -->
+          <key>UseSSL</key>
+          <true/>
+          <key>Username</key>
+          <string></string>
+          <key>Password</key>
+          <string></string>
+          <key>PollingSeconds</key>
+          <integer>30</integer>
+        </dict>
+        <key>AddressPatterns</key>
+        <array>
+          <string>mailto:.*</string>
+        </array>
+      </dict>
+
+    </dict>
+
+
+    <!--
+        Free-busy URL protocol
+      -->
+
+    <key>FreeBusyURL</key>
+    <dict>
+      <key>Enabled</key>
+      <true/>
+      <key>TimePeriod</key>
+      <integer>14</integer>
+      <key>AnonymousAccess</key>
+      <false/>
+    </dict>
+
+
+    <!--
+        Non-standard CalDAV extensions
+      -->
+
+    <!-- Calendar Drop Box -->
+    <key>EnableDropBox</key>
+    <true/>
+
+    <!-- Private Events -->
+    <key>EnablePrivateEvents</key>
+    <true/>
+
+    <!-- Timezone Service -->
+    <key>EnableTimezoneService</key>
+    <true/>
+
+
+    <!--
+        Miscellaneous items
+      -->
+
+    <!-- Service ACLs (Mac OS X) -->
+    <key>EnableSACLs</key>
+    <true/>
+
+    <!-- Web-based administration -->
+    <key>EnableWebAdmin</key>
+    <true/>
+
+    <key>DirectoryAddressBook</key>
+    <dict>
+        <key>type</key>
+        <string>twistedcaldav.directory.opendirectorybacker.OpenDirectoryBackingService</string>
+      
+        <key>params</key>
+        <dict>
+     	  <!-- Search for people records -->
+          <key>queryPeopleRecords</key>
+          <true/>
+     	  <!-- Search for people records in this directory service node -->
+          <key>peopleNode</key>
+          <string>/Search/Contacts</string>
+     	  <!-- Search for user records -->
+          <key>queryUserRecords</key>
+          <true/>
+          <key>userNode</key>
+     	  <!-- Search for user records in this directory service node -->
+          <string>/Search</string>
+      	  <!-- query in directory service local node -->
+          <key>queryDSLocal</key>
+          <false/>
+      	  <!-- minutes to keep directory service local node in memory before refresh -->
+          <key>dsLocalCacheTimeout</key>
+          <integer>30</integer>
+     	  <!-- approx. maximum number of records returned from a directory service query -->
+          <key>maxDSQueryRecords</key>
+          <integer>150</integer> <!-- use 0 to have server calculate the maximum based on MaxAddressBookQueryResults, MaxAddressBookMultigetHrefs keys -->
+     	  <!-- ignore system records like "root" when creating vCards -->
+          <key>ignoreSystemRecords</key>
+          <true/>
+       	  <!-- True to use a directory service query for each addressBook-query to the directory address book -->
+          <key>liveQuery</key>
+          <true/>
+       	  	  <!-- fake the eTag.  If false all directory service attributes are used to calculate the eTag -->
+              <key>fakeETag</key>
+              <true/>
+          <!-- True to store the results on disk after a directory service query. True is usually much slower. -->
+          <key>cacheQuery</key>
+          <false/>
+           	  <!-- If cacheQuery is True and liveQuery is False, the minutes to keep the results from a complete directory service all record query. -->
+              <key>cacheTimeout</key>
+              <integer>30</integer>
+          <!-- add this key to use additional directory service attributes in queries.  Needed for some queries with directory service templates.
+          <key>additionalAttributes</key>
+          <array>
+             <string>dsAttrTypeNative:sampleAIMPreferred</string>
+             <string>dsAttrTypeNative:sampleManager</string>
+          </array>
+          -->
+          <!-- add this key to limit directory service attributes used to make vCard properties
+          		When using directory service templates, list should include only mapped attributes.
+          <key>allowedAttributes</key>
+          <array>
+            <string>dsAttrTypeStandard:AddressLine1</string>
+            <string>dsAttrTypeStandard:AddressLine2</string>
+            <string>dsAttrTypeStandard:AddressLine3</string>
+            <string>dsAttrTypeStandard:Birthday</string>
+            <string>dsAttrTypeStandard:Building</string>
+            <string>dsAttrTypeStandard:City</string>
+            <string>dsAttrTypeStandard:Comment</string>
+            <string>dsAttrTypeStandard:Company</string>
+            <string>dsAttrTypeStandard:Country</string>
+            <string>dsAttrTypeStandard:CreationTimestamp</string>
+            <string>dsAttrTypeStandard:Department</string>
+            <string>dsAttrTypeStandard:EMailAddress</string>
+            <string>dsAttrTypeStandard:EMailContacts</string>
+            <string>dsAttrTypeStandard:FAXNumber</string>
+            <string>dsAttrTypeStandard:FirstName</string>
+            <string>dsAttrTypeStandard:HomePhoneNumber</string>
+            <string>dsAttrTypeStandard:IMHandle</string>
+            <string>dsAttrTypeStandard:JPEGPhoto</string>
+            <string>dsAttrTypeStandard:JobTitle</string>
+            <string>dsAttrTypeStandard:LastName</string>
+            <string>dsAttrTypeStandard:MapCoordinates</string>
+            <string>dsAttrTypeStandard:MiddleName</string>
+            <string>dsAttrTypeStandard:MobileNumber</string>
+            <string>dsAttrTypeStandard:ModificationTimestamp</string>
+            <string>dsAttrTypeStandard:NamePrefix</string>
+            <string>dsAttrTypeStandard:NameSuffix</string>
+            <string>dsAttrTypeStandard:NickName</string>
+            <string>dsAttrTypeStandard:Note</string>
+            <string>dsAttrTypeStandard:OrganizationName</string>
+            <string>dsAttrTypeStandard:PGPPublicKey</string>
+            <string>dsAttrTypeStandard:PagerNumber</string>
+            <string>dsAttrTypeStandard:PhoneContacts</string>
+            <string>dsAttrTypeStandard:PhoneNumber</string>
+            <string>dsAttrTypeStandard:PostalAddress</string>
+            <string>dsAttrTypeStandard:PostalAddressContacts</string>
+            <string>dsAttrTypeStandard:PostalCode</string>
+            <string>dsAttrTypeStandard:Relationships</string>
+            <string>dsAttrTypeStandard:State</string>
+            <string>dsAttrTypeStandard:Street</string>
+            <string>dsAttrTypeStandard:URL</string>
+            <string>dsAttrTypeStandard:UserCertificate</string>
+            <string>dsAttrTypeStandard:UserPKCS12Data</string>
+            <string>dsAttrTypeStandard:UserSMIMECertificate</string>
+            <string>dsAttrTypeStandard:WeblogURI</string>
+          </array>
+          -->
+        </dict>
+    </dict>
+      
+    <!--  allow unauthenticated users to access the directory address book -->
+    <key>AnonymousDirectoryAddressBookAccess</key>
+    <false/>
+    
+    <!--  enable search address book in user's home -->
+    <key>EnableSearchAddressBook</key>
+    <false/>
+    
+    <!--  enable find share report -->
+    <key>EnableFindSharedReport</key>
+    <false/>
+  </dict>
+</plist>

Modified: CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd-test.plist
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd-test.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd-test.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -75,15 +75,30 @@
     <!--
         Data Store
       -->
+    <!-- Server root -->
+    <key>ServerRoot</key>
+    <string>data</string>
 
     <!-- Data root -->
     <key>DataRoot</key>
-    <string>data/</string>
+    <string>Data/</string>
 
     <!-- Document root -->
     <key>DocumentRoot</key>
-    <string>twistedcaldav/test/data/</string>
+    <string>Documents</string>
 
+    <!-- Configuration root -->
+    <key>ConfigRoot</key>
+    <string>./conf</string>
+
+    <!-- Log root -->
+    <key>LogRoot</key>
+    <string>Logs</string>
+
+    <!-- Run root -->
+    <key>RunRoot</key>
+    <string>Run</string>
+
     <!-- Child aliases -->
     <key>Aliases</key>
     <dict>
@@ -114,6 +129,12 @@
     <key>MaxInstancesForRRULE</key>
     <integer>400</integer>
 
+    <!-- Disable resource service. -->
+    <key>ResourceService</key>
+    <dict>
+      <key>Enabled</key>
+      <false/>
+    </dict>
 
     <!--
         Directory service
@@ -123,7 +144,6 @@
 
         A variety of directory services are available for use.
       -->
-
     <!-- XML File Directory Service -->
     <key>DirectoryService</key>
     <dict>
@@ -133,7 +153,7 @@
       <key>params</key>
       <dict>
         <key>xmlFile</key>
-        <string>conf/auth/accounts-test.xml</string>
+        <string>./conf/auth/accounts-test.xml</string>
       </dict>
     </dict>
     
@@ -173,7 +193,7 @@
       <dict>
         <key>xmlFiles</key>
         <array>
-	      <string>conf/auth/augments-test.xml</string>
+	      <string>./conf/auth/augments-test.xml</string>
         </array>
       </dict>
     </dict>
@@ -219,7 +239,7 @@
       <key>params</key>
       <dict>
         <key>dbpath</key>
-        <string>data/proxies.sqlite</string>
+        <string>proxies.sqlite</string>
       </dict>
     </dict>
 
@@ -241,7 +261,7 @@
      -->
 
 	<key>ProxyLoadFromFile</key>
-    <string>conf/auth/proxies-test.xml</string>
+    <string>./conf/auth/proxies-test.xml</string>
 
     <!--
         Special principals
@@ -264,7 +284,7 @@
 
     <!-- Principals that can pose as other principals -->
     <key>SudoersFile</key>
-    <string>conf/sudoers.plist</string>
+    <string>./conf/sudoers.plist</string>
 
     <!-- Create "proxy access" principals -->
     <key>EnableProxyPrincipals</key>
@@ -352,7 +372,7 @@
 
     <!-- Apache-style access log -->
     <key>AccessLogFile</key>
-    <string>logs/access.log</string>
+    <string>access.log</string>
     <key>RotateAccessLog</key>
     <false/>
     <key>MoreAccessLogData</key>
@@ -360,7 +380,7 @@
 
     <!-- Server activity log -->
     <key>ErrorLogFile</key>
-    <string>logs/error.log</string>
+    <string>error.log</string>
 
     <!-- Log levels -->
     <key>DefaultLogLevel</key>
@@ -377,7 +397,7 @@
 
     <!-- Global server stats --> 
     <key>GlobalStatsSocket</key> 
-    <string>logs/carddavd-stats.sock</string> 
+    <string>carddavd-stats.sock</string> 
 
     <!-- Global server stats logging period --> 
     <key>GlobalStatsLoggingPeriod</key> 
@@ -389,11 +409,11 @@
 
     <!-- Server statistics file -->
     <key>ServerStatsFile</key>
-    <string>logs/stats.plist</string>
+    <string>stats.plist</string>
 
     <!-- Server process ID file -->
     <key>PIDFile</key>
-    <string>logs/carddavd.pid</string>
+    <string>carddavd.pid</string>
 
 
     <!--
@@ -567,7 +587,7 @@
         <array>
         </array>
         <key>Servers</key>
-        <string>conf/servertoserver-test.xml</string>
+        <string>./conf/servertoserver-test.xml</string>
       </dict>
 
       <!-- iMIP protocol options -->
@@ -686,7 +706,7 @@
     <!-- A unix socket used for communication between the child and master processes.
          An empty value tells the server to use a tcp socket instead. -->
     <key>ControlSocket</key>
-    <string>logs/carddavd.sock</string>
+    <string>carddavd.sock</string>
 
     <!-- Support for Memcached -->
     <key>Memcached</key>
@@ -744,7 +764,7 @@
       <key>params</key>
       <dict>
         <key>xmlFile</key>
-        <string>conf/auth/accounts-test.xml</string>
+        <string>./conf/auth/accounts-test.xml</string>
       </dict>
     </dict>
 

Copied: CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd.plist (from rev 5146, CalendarServer/trunk/conf/carddavd.plist)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd.plist	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+  -->
+
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+  <dict>
+
+    <!--
+        Public network address information
+
+        This is the server's public network address, which is provided to
+        clients in URLs and the like.  It may or may not be the network
+        address that the server is listening to directly, though it is by
+        default.  For example, it may be the address of a load balancer or
+        proxy which forwards connections to the server.
+      -->
+
+    <!-- Network host name [empty = system host name] -->
+    <key>ServerHostName</key>
+    <string></string> <!-- The hostname clients use when connecting -->
+
+    <!-- HTTP port [0 = disable HTTP] -->
+    <key>HTTPPort</key>
+    <integer>80</integer>
+
+    <!-- SSL port [0 = disable HTTPS] -->
+    <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
+    <!--
+    <key>SSLPort</key>
+    <integer>443</integer>
+    -->
+
+    <!-- Redirect non-SSL ports to an SSL port (if configured for SSL) -->
+    <key>RedirectHTTPToHTTPS</key>
+    <false/>
+
+
+    <!--
+        Network address configuration information
+
+        This configures the actual network address that the server binds to.
+      -->
+
+    <!-- List of IP addresses to bind to [empty = all] -->
+    <key>BindAddresses</key>
+    <array>
+    </array>
+
+    <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
+    <key>BindHTTPPorts</key>
+    <array>
+    </array>
+
+    <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
+    <key>BindSSLPorts</key>
+    <array>
+    </array>
+
+
+    <!--
+        Data Store
+      -->
+
+    <!-- Server root -->
+    <key>ServerRoot</key>
+    <string>/Library/AddressBookServer</string>
+
+    <!-- Data root -->
+    <key>DataRoot</key>
+    <string>Data</string>
+
+    <!-- Document root -->
+    <key>DocumentRoot</key>
+    <string>Documents</string>
+
+    <!-- Configuration root -->
+    <key>ConfigRoot</key>
+    <string>/etc/cardavd</string>
+
+    <!-- Run root -->
+    <key>RunRoot</key>
+    <string>/var/run</string>
+
+    <!-- Child aliases -->
+    <key>Aliases</key>
+    <dict>
+      <!--
+      <key>foo</key>
+      <dict>
+        <key>path</key>
+        <string>/path/to/foo</string>
+      </dict>
+       -->
+    </dict>
+
+
+    <!--
+        Quotas and limits
+      -->
+
+    <!-- User quota (in bytes) [0 = no quota] -->
+    <key>UserQuota</key>
+    <integer>104857600</integer> <!-- 100Mb -->
+
+
+    <!--
+        Directory service
+
+        A directory service provides information about principals (eg.
+        users, groups, locations and resources) to the server.
+
+        A variety of directory services are available for use.
+      -->
+
+    <!-- Disable resource service. -->
+    <key>ResourceService</key>
+    <dict>
+      <key>Enabled</key>
+      <false/>
+    </dict>
+
+
+    <!-- XML File Directory Service -->
+    <key>DirectoryService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
+      
+      <key>params</key>
+      <dict>
+        <key>xmlFile</key>
+        <string>accounts.xml</string>
+      </dict>
+    </dict>
+    
+    <!-- Open Directory Service (Mac OS X) -->
+    <!--
+    <key>DirectoryService</key>
+    <dict>
+      <key>type</key>
+      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
+      
+      <key>params</key>
+      <dict>
+        <key>node</key>
+        <string>/Search</string>
+        <key>cacheTimeout</key>
+        <integer>30</integer>
+      </dict>
+    </dict>
+     -->
+
+    <!--
+        Special principals
+
+        These principals are granted special access and/or perform
+        special roles on the server.
+      -->
+
+    <!-- Principals with "DAV:all" access (relative URLs) -->
+    <key>AdminPrincipals</key>
+    <array>
+      <!-- <string>/principals/__uids__/AEB68DD7-D2B8-4D4D-A574-2A4533DF36A4/</string> -->
+    </array>
+
+    <!-- Principals with "DAV:read" access (relative URLs) -->
+    <key>ReadPrincipals</key>
+    <array>
+      <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
+    </array>
+
+
+    <!--
+        Permissions
+      -->
+
+    <!-- Anonymous read access for root resource -->
+    <key>EnableAnonymousReadRoot</key>
+    <true/>
+
+    <!-- Anonymous read access for resource hierarchy -->
+    <key>EnableAnonymousReadNav</key>
+    <false/>
+
+    <!-- Enables directory listings for principals -->
+    <key>EnablePrincipalListings</key>
+    <false/>
+
+
+    <!--
+        Authentication
+      -->
+
+    <key>Authentication</key>
+    <dict>
+
+      <!-- Clear text; best avoided -->
+      <key>Basic</key>
+      <dict>
+        <key>Enabled</key>
+        <false/>
+      </dict>
+
+      <!-- Digest challenge/response -->
+      <key>Digest</key>
+      <dict>
+        <key>Enabled</key>
+        <true/>
+        <key>Algorithm</key>
+        <string>md5</string>
+        <key>Qop</key>
+        <string></string>
+      </dict>
+
+      <!-- Kerberos/SPNEGO -->
+      <key>Kerberos</key>
+      <dict>
+        <key>Enabled</key>
+        <true/>
+        <key>ServicePrincipal</key>
+        <string></string>
+      </dict>
+
+    </dict>
+
+
+    <!--
+        Logging
+      -->
+
+    <!-- Log root -->
+    <key>LogRoot</key>
+    <string>/var/log/cardavd</string>
+
+    <!-- Apache-style access log -->
+    <key>AccessLogFile</key>
+    <string>access.log</string>
+    <key>RotateAccessLog</key>
+    <true/>
+
+    <!-- Server activity log -->
+    <key>ErrorLogFile</key>
+    <string>error.log</string>
+
+    <!-- Log levels -->
+    <key>DefaultLogLevel</key>
+    <string>warn</string> <!-- debug, info, warn, error -->
+
+    <!-- Global server stats -->
+    <key>GlobalStatsSocket</key>
+    <string>carddavd-stats.sock</string>
+
+    <!-- Server process ID file -->
+    <key>PIDFile</key>
+    <string>carddavd.pid</string>
+
+
+    <!--
+        SSL/TLS
+      -->
+
+    <!-- Public key -->
+    <key>SSLCertificate</key>
+    <string></string>
+
+    <!-- SSL authority chain (for intermediate certs) -->
+    <key>SSLAuthorityChain</key>
+    <string></string>
+
+    <!-- Private key -->
+    <key>SSLPrivateKey</key>
+    <string></string>
+
+
+    <!--
+        Process management
+      -->
+
+    <key>UserName</key>
+    <string>daemon</string>
+
+    <key>GroupName</key>
+    <string>daemon</string>
+
+    <key>ProcessType</key>
+    <string>Combined</string>
+
+    <key>MultiProcess</key>
+    <dict>
+      <key>ProcessCount</key>
+      <integer>0</integer> <!-- 0 = larger of: 4 or (2 * CPU count) -->
+    </dict>
+
+
+  </dict>
+</plist>

Deleted: CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd.plist.default
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd.plist.default	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/conf/carddavd.plist.default	2010-02-17 20:55:11 UTC (rev 5147)
@@ -1,443 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-    Copyright (c) 2006-2009 Apple Inc. All rights reserved.
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-  -->
-
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-  <dict>
-
-    <!--
-        Public network address information
-
-        This is the server's public network address, which is provided to
-        clients in URLs and the like.  It may or may not be the network
-        address that the server is listening to directly, though it is by
-        default.  For example, it may be the address of a load balancer or
-        proxy which forwards connections to the server.
-      -->
-
-    <!-- Network host name [empty = system host name] -->
-    <key>ServerHostName</key>
-    <string></string> <!-- The hostname clients use when connecting -->
-
-    <!-- HTTP port [0 = disable HTTP] -->
-    <key>HTTPPort</key>
-    <integer>8800</integer>
-
-    <!-- SSL port [0 = disable HTTPS] -->
-    <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
-    <!--
-    <key>SSLPort</key>
-    <integer>8843</integer>
-    -->
-
-    <!-- Redirect non-SSL ports to an SSL port (if configured for SSL) -->
-    <key>RedirectHTTPToHTTPS</key>
-    <false/>
-
-
-    <!--
-        Network address configuration information
-
-        This configures the actual network address that the server binds to.
-      -->
-
-    <!-- List of IP addresses to bind to [empty = all] -->
-    <key>BindAddresses</key>
-    <array>
-    </array>
-
-    <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
-    <key>BindHTTPPorts</key>
-    <array>
-    </array>
-
-    <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
-    <key>BindSSLPorts</key>
-    <array>
-    </array>
-
-
-    <!--
-        Data Store
-      -->
-
-    <!-- Data root -->
-    <key>DataRoot</key>
-    <string>/Library/AddressBookServer/Data/</string>
-
-    <!-- Document root -->
-    <key>DocumentRoot</key>
-    <string>/Library/AddressBookServer/Documents</string>
-
-    <!-- User quota (in bytes) -->
-    <key>UserQuota</key>
-    <integer>104857600</integer><!-- 104857600 = 100Mb ; use 0 for no quota -->
-
-    <!--
-        Directory service
-
-        A directory service provides information about principals (eg.
-        users, groups, locations and resources) to the server.
-
-        A variety of directory services are available for use.
-      -->
-
-    <!-- XML File Directory Service -->
-    <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>/etc/carddavd/accounts.xml</string>
-      </dict>
-    </dict>
-    -->
-    
-    <!-- Cache-on-Demand Open Directory Service (Mac OS X) -->
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>maxAvailableWaitSeconds</key>
-        <integer>120</integer>			 <!-- Wait for all nodes to be available before starting server.  -1 to wait forever, 0 to not wait -->
-        <key>node</key>
-        <string>/Search</string>
-        <key>restrictEnabledRecords</key>
-        <false/>
-        <key>restrictToGroup</key>
-        <string></string>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-
-    <!--
-        Special principals
-
-        These principals are granted special access and/or perform
-        special roles on the server.
-      -->
-
-    <!-- Principals with "DAV:all" access (relative URLs) -->
-    <key>AdminPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/AEB68DD7-D2B8-4D4D-A574-2A4533DF36A4/</string> -->
-    </array>
-
-    <!-- Principals with "DAV:read" access (relative URLs) -->
-    <key>ReadPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
-    </array>
-
-    <!-- Principals that can pose as other principals -->
-    <key>SudoersFile</key>
-    <string></string>  <!-- empty to disable <string>/etc/carddavd/sudoers.plist</string> -->
-
-    <!--
-        Permissions
-      -->
-
-    <!-- Anonymous read access for root resource -->
-    <key>EnableAnonymousReadRoot</key>
-    <false/>
-
-    <!-- Anonymous read access for resource hierarchy -->
-    <key>EnableAnonymousReadNav</key>
-    <false/>
-
-    <!-- Enables directory listings for principals -->
-    <key>EnablePrincipalListings</key>
-    <false/>
-
-
-    <!--
-        Authentication
-      -->
-
-    <key>Authentication</key>
-    <dict>
-
-      <!-- Clear text; best avoided -->
-      <key>Basic</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-      </dict>
-
-      <!-- Digest challenge/response -->
-      <key>Digest</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>Algorithm</key>
-        <string>md5</string>
-        <key>Qop</key>
-        <string></string>
-      </dict>
-
-      <!-- Kerberos/SPNEGO -->
-      <key>Kerberos</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>ServicePrincipal</key>
-        <string></string>
-      </dict>
-
-    </dict>
-
-
-    <!--
-        Logging
-      -->
-
-    <!-- Apache-style access log -->
-    <key>AccessLogFile</key>
-    <string>/var/log/carddavd/access.log</string>
-    <key>RotateAccessLog</key>
-    <false/>
-
-    <!-- Server activity log -->
-    <key>ErrorLogFile</key>
-    <string>/var/log/carddavd/error.log</string>
-
-    <!-- Log levels -->
-    <key>DefaultLogLevel</key>
-    <string>warn</string> <!-- debug, info, warn, error -->
-
-    <!-- Server statistics file -->
-    <key>ServerStatsFile</key>
-    <string>/var/run/carddavd/stats.plist</string>
-
-    <!-- Server process ID file -->
-    <key>PIDFile</key>
-    <string>/var/run/carddavd.pid</string>
-
-
-    <!-- Global server stats -->
-    <key>GlobalStatsSocket</key>
-    <string>/var/run/carddavd-stats.sock</string>
-
-    <!--
-	To snapshot every five minutes over the last hour:
-	    GlobalStatsLoggingPeriod : 60
-	    GlobalStatsLoggingFrequency : 12
-	Set GlobalStatsLoggingFrequency to 0 to disable the stats
-      -->
-
-    <!-- Global server stats logging period -->
-    <key>GlobalStatsLoggingPeriod</key>
-    <integer>60</integer>
-
-    <!-- Global server stats logging frequency -->
-    <key>GlobalStatsLoggingFrequency</key>
-    <integer>12</integer>
-
-    <!--
-        SSL/TLS
-      -->
-
-    <!-- Public key -->
-    <key>SSLCertificate</key>
-    <string></string>
-
-    <!-- Private key -->
-    <key>SSLPrivateKey</key>
-    <string></string>
-
-
-    <!--
-        Process management
-      -->
-
-    <key>UserName</key>
-    <string>_carddav</string>
-
-    <key>GroupName</key>
-    <string>_carddav</string>
-
-    <key>ProcessType</key>
-    <string>Combined</string>
-
-    <key>MultiProcess</key>
-    <dict>
-      <key>ProcessCount</key>
-      <integer>0</integer> <!-- 0 = larger of: 2 or CPU count -->
-    </dict>
-
-
-
-
-    <!--
-        Miscellaneous items
-      -->
-
-    <!-- Maximum results returned by addressbook-query report -->
-    <key>MaxAddressBookQueryResults</key>
-    <integer>1000</integer>
-
-    <!-- Maximum hrefs in addressbook-multiget report -->
-    <key>MaxAddressBookMultigetHrefs</key>
-    <integer>5000</integer>
-
-    <!-- Service ACLs (Mac OS X) -->
-    <key>EnableSACLs</key>
-    <true/>
-
-    <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
-    <key>ResponseCompression</key>
-    <true/>
-
-    <!--
-        Directory Address Book
-      -->
-    
-    <!--  Disable Directory Address Book-->
-    <!--
-      <key>DirectoryAddressBook</key>
-      <false/>
-    -->
-    
-    <!-- Open Directory-backed Directory Address Book -->
-    <key>DirectoryAddressBook</key>
-    <dict>
-        <key>type</key>
-        <string>twistedcaldav.directory.opendirectorybacker.OpenDirectoryBackingService</string>
-      
-        <key>params</key>
-        <dict>
-     	  <!-- Search for people records -->
-          <key>queryPeopleRecords</key>
-          <true/>
-     	  <!-- Search for people records in this directory service node -->
-          <key>peopleNode</key>
-          <string>/Search/Contacts</string>
-     	  <!-- Search for user records -->
-          <key>queryUserRecords</key>
-          <true/>
-          <key>userNode</key>
-     	  <!-- Search for user records in this directory service node -->
-          <string>/Search</string>
-      	  <!-- query in directory service local node -->
-          <key>queryDSLocal</key>
-          <false/>
-      	  <!-- minutes to keep directory service local node in memory before refresh -->
-          <key>dsLocalCacheTimeout</key>
-          <integer>30</integer>
-     	  <!-- approx. maximum number of records returned from a directory service query -->
-          <key>maxDSQueryRecords</key>
-          <integer>150</integer> <!-- use 0 to have server calculate the maximum based on MaxAddressBookQueryResults, MaxAddressBookMultigetHrefs keys -->
-     	  <!-- ignore system records like "root" when creating vCards -->
-          <key>ignoreSystemRecords</key>
-          <true/>
-       	  <!-- True to use a directory service query for each addressBook-query to the directory address book -->
-          <key>liveQuery</key>
-          <true/>
-       	  	  <!-- fake the eTag.  If false all directory service attributes are used to calculate the eTag -->
-              <key>fakeETag</key>
-              <true/>
-          <!-- True to store the results on disk after a directory service query. True is usually much slower. -->
-          <key>cacheQuery</key>
-          <false/>
-           	  <!-- If cacheQuery is True and liveQuery is False, the minutes to keep the results from a complete directory service all record query. -->
-              <key>cacheTimeout</key>
-              <integer>30</integer>
-          <!-- add this key to use additional directory service attributes in queries.  Needed for some queries with directory service templates.
-          <key>additionalAttributes</key>
-          <array>
-             <string>dsAttrTypeNative:sampleAIMPreferred</string>
-             <string>dsAttrTypeNative:sampleManager</string>
-          </array>
-          -->
-          <!-- add this key to limit directory service attributes used to make vCard properties
-          		When using directory service templates, list should include only mapped attributes.
-          <key>allowedAttributes</key>
-          <array>
-            <string>dsAttrTypeStandard:AddressLine1</string>
-            <string>dsAttrTypeStandard:AddressLine2</string>
-            <string>dsAttrTypeStandard:AddressLine3</string>
-            <string>dsAttrTypeStandard:Birthday</string>
-            <string>dsAttrTypeStandard:Building</string>
-            <string>dsAttrTypeStandard:City</string>
-            <string>dsAttrTypeStandard:Comment</string>
-            <string>dsAttrTypeStandard:Company</string>
-            <string>dsAttrTypeStandard:Country</string>
-            <string>dsAttrTypeStandard:CreationTimestamp</string>
-            <string>dsAttrTypeStandard:Department</string>
-            <string>dsAttrTypeStandard:EMailAddress</string>
-            <string>dsAttrTypeStandard:EMailContacts</string>
-            <string>dsAttrTypeStandard:FAXNumber</string>
-            <string>dsAttrTypeStandard:FirstName</string>
-            <string>dsAttrTypeStandard:HomePhoneNumber</string>
-            <string>dsAttrTypeStandard:IMHandle</string>
-            <string>dsAttrTypeStandard:JPEGPhoto</string>
-            <string>dsAttrTypeStandard:JobTitle</string>
-            <string>dsAttrTypeStandard:LastName</string>
-            <string>dsAttrTypeStandard:MapCoordinates</string>
-            <string>dsAttrTypeStandard:MiddleName</string>
-            <string>dsAttrTypeStandard:MobileNumber</string>
-            <string>dsAttrTypeStandard:ModificationTimestamp</string>
-            <string>dsAttrTypeStandard:NamePrefix</string>
-            <string>dsAttrTypeStandard:NameSuffix</string>
-            <string>dsAttrTypeStandard:NickName</string>
-            <string>dsAttrTypeStandard:Note</string>
-            <string>dsAttrTypeStandard:OrganizationName</string>
-            <string>dsAttrTypeStandard:PGPPublicKey</string>
-            <string>dsAttrTypeStandard:PagerNumber</string>
-            <string>dsAttrTypeStandard:PhoneContacts</string>
-            <string>dsAttrTypeStandard:PhoneNumber</string>
-            <string>dsAttrTypeStandard:PostalAddress</string>
-            <string>dsAttrTypeStandard:PostalAddressContacts</string>
-            <string>dsAttrTypeStandard:PostalCode</string>
-            <string>dsAttrTypeStandard:Relationships</string>
-            <string>dsAttrTypeStandard:State</string>
-            <string>dsAttrTypeStandard:Street</string>
-            <string>dsAttrTypeStandard:URL</string>
-            <string>dsAttrTypeStandard:UserCertificate</string>
-            <string>dsAttrTypeStandard:UserPKCS12Data</string>
-            <string>dsAttrTypeStandard:UserSMIMECertificate</string>
-            <string>dsAttrTypeStandard:WeblogURI</string>
-          </array>
-          -->
-        </dict>
-    </dict>
-      
-    <!--  allow unauthenticated users to access the directory address book -->
-    <key>AnonymousDirectoryAddressBookAccess</key>
-    <false/>
-    
-    <!--  enable search address book in user's home -->
-    <key>EnableSearchAddressBook</key>
-    <false/>
-    
-    <!--  enable find share report -->
-    <key>EnableFindSharedReport</key>
-    <false/>
-
-    </dict>
-</plist>

Modified: CalendarServer/branches/users/glyph/use-system-twisted/run
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/run	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/run	2010-02-17 20:55:11 UTC (rev 5147)
@@ -97,6 +97,7 @@
       'p') do_get="false"; do_setup="false"; do_run="false"; print_path="true"; ;;
       'i') do_get="true" ; do_setup="true" ; do_run="false"; install="${OPTARG}"; install_flag="--root="; ;;
       'I') do_get="true" ; do_setup="true" ; do_run="false"; install="${wd}/build/dst"; install_flag="--root="; install_home="${OPTARG}"; ;;
+      'n') do_get="false" ; do_setup="false"; ;;
     esac;
   done;
   shift $((${OPTIND} - 1));
@@ -124,8 +125,8 @@
     fi;
 
     cd "${wd}";
-    if [ ! -d "${wd}/logs" ]; then
-      mkdir "${wd}/logs";
+    if [ ! -d "${wd}/data" ]; then
+      mkdir "${wd}/data";
     fi;
 
     echo "";

Modified: CalendarServer/branches/users/glyph/use-system-twisted/setup.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/setup.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/setup.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -117,7 +117,7 @@
                              "bin/carddavd",
                            ],
         data_files       = [ ("caldavd", ["conf/caldavd.plist"]),
-                             ("carddavd", ["conf/carddavd.plist.default" ])],
+                             ("carddavd", ["conf/carddavd.plist" ])],
         ext_modules      = extensions,
         py_modules       = ["kqreactor", "memcacheclient"],
     )

Modified: CalendarServer/branches/users/glyph/use-system-twisted/support/Makefile.Apple
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/support/Makefile.Apple	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/support/Makefile.Apple	2010-02-17 20:55:11 UTC (rev 5147)
@@ -98,6 +98,7 @@
 	$(_v) $(INSTALL_FILE) "$(Sources)/conf/caldavd-partitioning-secondary.plist" "$(DSTROOT)$(ETCDIR)/caldavd/caldavd-partitioning-secondary.plist"
 	$(_v) $(INSTALL_FILE) "$(Sources)/conf/partitions.plist" "$(DSTROOT)$(ETCDIR)/caldavd/partitions.plist"
 	$(_v) $(INSTALL_FILE) "$(Sources)/conf/servertoserver.xml" "$(DSTROOT)$(ETCDIR)/caldavd/servertoserver.xml"
+	$(_v) $(INSTALL_FILE) "$(Sources)/conf/carddavd-apple.plist" "$(DSTROOT)$(ETCDIR)/carddavd/carddavd.plist"
 	$(_v) chmod -R ugo+r "$(DSTROOT)$(PY_HOME)"
 	$(_v) for f in $$(find "$(DSTROOT)$(ETCDIR)" -type f ! -name '*.default'); do cp "$${f}" "$${f}.default"; done
 	$(_v) $(INSTALL_FILE) "$(Sources)/conf/servertoserver.dtd" "$(DSTROOT)$(ETCDIR)/caldavd/servertoserver.dtd"

Modified: CalendarServer/branches/users/glyph/use-system-twisted/support/build.sh
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/support/build.sh	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/support/build.sh	2010-02-17 20:55:11 UTC (rev 5147)
@@ -483,7 +483,7 @@
     false true true true 219;
 
   # Tool dependencies.  The code itself doesn't depend on these, but you probably want them.
-  svn_get "CalDAVTester" "${top}/CalDAVTester" "${svn_uri_base}/CalDAVTester/trunk" 4912;
+  svn_get "CalDAVTester" "${top}/CalDAVTester" "${svn_uri_base}/CalDAVTester/trunk" HEAD;
   svn_get "Pyflakes" "${top}/Pyflakes" http://divmod.org/svn/Divmod/trunk/Pyflakes HEAD;
 }
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/test
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/test	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/test	2010-02-17 20:55:11 UTC (rev 5147)
@@ -27,6 +27,7 @@
 no_colour="";
 until_fail="";
 coverage="";
+m_twisted="";
 
 usage ()
 {
@@ -56,6 +57,7 @@
     'n')  no_colour="--reporter=bwverbose"; ;;
     'u') until_fail="--until-failure"; ;;
     'c')   coverage="--coverage"; ;;
+    't')  m_twisted="twisted"; ;;
   esac;
 done;
 shift $((${OPTIND} - 1));
@@ -67,7 +69,7 @@
 if [ $# -gt 0 ]; then
     test_modules="$@";
 else
-    test_modules="calendarserver twistedcaldav twext txdav txcaldav txcarddav twisted";
+    test_modules="calendarserver twistedcaldav twext txdav txcaldav txcarddav ${m_twisted}";
 fi;
 
 cd "${wd}" && "${python}" "${twisted}/bin/trial" --rterrors ${random} ${until_fail} ${no_colour} ${coverage} ${test_modules};

Modified: CalendarServer/branches/users/glyph/use-system-twisted/testcaldav
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/testcaldav	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/testcaldav	2010-02-17 20:55:11 UTC (rev 5147)
@@ -25,7 +25,7 @@
 
 verbose="";
 serverinfo="${cdt}/scripts/server/serverinfo.xml";
-documentroot="${wd}/twistedcaldav/test/data";
+documentroot="${wd}/data/Documents";
 
 usage ()
 {

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/accesslog.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/accesslog.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/accesslog.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -133,6 +133,17 @@
                         if " " in v:
                             v = '"%s"' % (v,)
                         formats.append("%s=%s" % (k, v))
+
+                fwdHeaders = request.headers.getRawHeaders("x-forwarded-for", "")
+                if fwdHeaders:
+                    # Limit each x-forwarded-header to 50 in case someone is
+                    # trying to overwhelm the logs
+                    forwardedFor = ",".join([hdr[:50] for hdr in fwdHeaders])
+                    forwardedFor = forwardedFor.replace(" ", "")
+                    formats.append("fwd=%(fwd)s")
+                else:
+                    forwardedFor = ""
+
                 format = " ".join(formats)
 
             formatArgs = {
@@ -149,6 +160,7 @@
                 "serverInstance"      : config.LogID,
                 "timeSpent"           : (time.time() - request.initTime) * 1000,
                 "outstandingRequests" : request.chanRequest.channel.factory.outstandingRequests,
+                "fwd"                 : forwardedFor,
             }
             self.logMessage(format % formatArgs)
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/client/pool.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/client/pool.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/client/pool.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -33,6 +33,9 @@
 from twext.web2 import responsecode
 from twext.web2.client.http import HTTPClientProtocol
 from twext.web2.http import StatusResponse, HTTPError
+from twext.web2.dav.util import allDataFromStream
+from twext.web2.stream import MemoryStream
+
 from twistedcaldav.config import config
 
 class PooledHTTPClientFactory(ClientFactory, LoggingMixIn):
@@ -232,9 +235,17 @@
         @return: A L{Deferred} that fires with the result of the given command.
         """
 
+        # Since we may need to replay the request we have to read the request.stream
+        # into memory and reset request.stream to use a MemoryStream each time we repeat
+        # the request
+        data = (yield allDataFromStream(request.stream))
+
         # Try this maxRetries times
         for ctr in xrange(self.maxRetries + 1):
             try:
+                request.stream = MemoryStream(data if data is not None else "")
+                request.stream.doStartReading = None
+
                 response = (yield self._submitRequest(request, args, kwargs))
 
             except (ConnectionLost, ConnectionDone, ConnectError), e:

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/config.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/config.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2005-2009 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -119,8 +119,8 @@
             self._provider = ConfigProvider()
         else:
             self._provider = provider
-        self._preUpdateHooks = set()
-        self._postUpdateHooks = set()
+        self._preUpdateHooks = list()
+        self._postUpdateHooks = list()
         self.reset()
         
     def __setattr__(self, attr, value):
@@ -159,15 +159,15 @@
 
     def addPreUpdateHook(self, hook):
         if isinstance(hook, list) or isinstance(hook, tuple):
-            self._preUpdateHooks.update(hook)
+            self._preUpdateHooks.extend(hook)
         else:
-            self._preUpdateHooks.add(hook)
+            self._preUpdateHooks.append(hook)
         
     def addPostUpdateHook(self, hook):
         if isinstance(hook, list) or isinstance(hook, tuple):
-            self._postUpdateHooks.update(hook)
+            self._postUpdateHooks.extend(hook)
         else:
-            self._postUpdateHooks.add(hook)
+            self._postUpdateHooks.append(hook)
 
     def getProvider(self):
         return self._provider
@@ -216,7 +216,6 @@
     def reset(self):
         self._data = ConfigDict(copy.deepcopy(self._provider.getDefaults()))
 
-
 def _mergeData(oldData, newData):
     for key, value in newData.iteritems():
         if isinstance(value, (dict,)):
@@ -229,4 +228,10 @@
         else:
             oldData[key] = value
 
+def fullServerPath(base, path):
+    if type(path) is str:
+        return os.path.join(base, path) if path and path[0] not in ('/', '.',) else path
+    else:
+        return path
+
 config = Config()

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/aggregate.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/aggregate.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/aggregate.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -49,8 +49,8 @@
 
             if service.realmName != realmName:
                 assert realmName is None, (
-                    "Aggregated directory services must have the same realm name: %r != %r"
-                    % (service.realmName, realmName)
+                    "Aggregated directory services must have the same realm name: %r != %r\nServices: %r"
+                    % (service.realmName, realmName, services)
                 )
                 realmName = service.realmName
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/augment.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/augment.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/augment.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -21,13 +21,14 @@
 
 from twext.log import Logger
 
+from twistedcaldav.config import fullServerPath, config
 from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\
     ADBAPIPostgreSQLMixin
+from twistedcaldav.directory import xmlaugmentsparser
 from twistedcaldav.directory.xmlaugmentsparser import XMLAugmentsParser
-import os
-from twistedcaldav.directory import xmlaugmentsparser
 from twistedcaldav.xmlutil import newElementTreeWithRoot, addSubElement,\
     writeXML, readXML
+import os
 
 
 log = Logger()
@@ -103,14 +104,12 @@
         
         raise NotImplementedError("Child class must define this.")
 
-    def addAugmentRecords(self, records, update=False):
+    def addAugmentRecords(self, records):
         """
         Add an AugmentRecord to the DB.
 
         @param record: augment records to add
         @type record: C{list} of L{AugmentRecord}
-        @param update: C{True} if changing an existing record
-        @type update: C{bool}
         
         @return: L{Deferred}
         """
@@ -132,9 +131,21 @@
     def refresh(self):
         """
         Refresh any cached data.
+        
+        @return: L{Deferred}
         """
-        pass
+
+        return succeed(None)
+    
+    def clean(self):
+        """
+        Remove all records.
         
+        @return: L{Deferred}
+        """
+
+        raise NotImplementedError("Child class must define this.")
+        
 AugmentService = AugmentDB()   # Global augment service
 
 
@@ -145,7 +156,7 @@
     
     def __init__(self, xmlFiles, cacheTimeout=30):
         
-        self.xmlFiles = xmlFiles
+        self.xmlFiles = [fullServerPath(config.DataRoot, path) for path in xmlFiles]
         self.cacheTimeout = cacheTimeout * 60 # Value is mins we want secs
         self.lastCached = 0
         self.db = {}
@@ -207,7 +218,7 @@
             
         return succeed(self.db.get(uid))
 
-    def addAugmentRecords(self, records, update=False):
+    def addAugmentRecords(self, records):
         """
         Add an AugmentRecord to the DB.
 
@@ -219,14 +230,23 @@
         @return: L{Deferred}
         """
 
-        if update:
+        # Look at each record and determine whether it is new or a modify
+        new_records = list()
+        existing_records = list() 
+        for record in records:
+            (existing_records if record.uid in self.db else new_records).append(record)
+
+        if existing_records:
             # Now look at each file and modify the UIDs
             for xmlFile in self.xmlFiles:
-                self._doModifyInFile(xmlFile, records)
-        else:
+                self._doModifyInFile(xmlFile, existing_records)
+
+        if new_records:
             # Add to first file in list
-            self._doAddToFile(self.xmlFiles[0], records)
+            self._doAddToFile(self.xmlFiles[0], new_records)
 
+        return succeed(None)
+
     def _doAddToFile(self, xmlfile, records):
     
         _ignore_etree, augments_node = readXML(xmlfile)
@@ -253,20 +273,22 @@
 
         # Make sure UID is present
         changed = False
-        for child in augments_node.getchildren():
+        for record_node in augments_node.getchildren():
             
-            if child.tag != xmlaugmentsparser.ELEMENT_RECORD:
+            if record_node.tag != xmlaugmentsparser.ELEMENT_RECORD:
                 continue
     
-            uid = child.find(xmlaugmentsparser.ELEMENT_UID).text
+            uid = record_node.find(xmlaugmentsparser.ELEMENT_UID).text
             if uid in recordMap:
                 # Modify record
                 record = recordMap[uid]
-                child.find(xmlaugmentsparser.ELEMENT_ENABLE).text = "true" if record.enabled else "false"
-                child.find(xmlaugmentsparser.ELEMENT_HOSTEDAT).text = record.hostedAt
-                child.find(xmlaugmentsparser.ELEMENT_ENABLECALENDAR).text = "true" if record.enabledForCalendaring else "false"
-                child.find(xmlaugmentsparser.ELEMENT_ENABLEADDRESSBOOK).text = "true" if record.enabledForAddressBooks else "false"
-                child.find(xmlaugmentsparser.ELEMENT_AUTOSCHEDULE).text = "true" if record.autoSchedule else "false"
+                del record_node.getchildren()[:]
+                addSubElement(record_node, xmlaugmentsparser.ELEMENT_UID, record.uid)
+                addSubElement(record_node, xmlaugmentsparser.ELEMENT_ENABLE, "true" if record.enabled else "false")
+                addSubElement(record_node, xmlaugmentsparser.ELEMENT_HOSTEDAT, record.hostedAt)
+                addSubElement(record_node, xmlaugmentsparser.ELEMENT_ENABLECALENDAR, "true" if record.enabledForCalendaring else "false")
+                addSubElement(record_node, xmlaugmentsparser.ELEMENT_ENABLEADDRESSBOOK, "true" if record.enabledForAddressBooks else "false")
+                addSubElement(record_node, xmlaugmentsparser.ELEMENT_AUTOSCHEDULE, "true" if record.autoSchedule else "false")
                 changed = True
         
         
@@ -326,6 +348,16 @@
             log.error("Failed to parse XML augments file during cache refresh - ignoring")
         self.lastCached = time.time()
 
+        return succeed(None)
+
+    def clean(self):
+        """
+        Remove all records.
+        """
+
+        self.removeAugmentRecords(self.db.keys())
+        return succeed(None)
+        
     def _parseXML(self):
         
         # Do each file
@@ -394,40 +426,17 @@
             returnValue(record)
 
     @inlineCallbacks
-    def addAugmentRecords(self, records, update=False):
+    def addAugmentRecords(self, records):
 
         for record in records:
-            partitionid = (yield self._getPartitionID(record.hostedAt))
             
+            results = (yield self.query("select UID from AUGMENTS where UID = :1", (record.uid,)))
+            update = len(results) > 0
+
             if update:
-                yield self.execute(
-                    """update AUGMENTS set
-                    (UID, ENABLED, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE) =
-                    (:1, :2, :3, :4, :5, :6) where UID = :7""",
-                    (
-                        record.uid,
-                        "T" if record.enabled else "F",
-                        partitionid,
-                        "T" if record.enabledForCalendaring else "F",
-                        "T" if record.enabledForAddressBooks else "F",
-                        "T" if record.autoSchedule else "F",
-                        record.uid,
-                    )
-                )
+                yield self._modifyRecord(record)
             else:
-                yield self.execute(
-                    """insert into AUGMENTS
-                    (UID, ENABLED, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE)
-                    values (:1, :2, :3, :4, :5, :6)""",
-                    (
-                        record.uid,
-                        "T" if record.enabled else "F",
-                        partitionid,
-                        "T" if record.enabledForCalendaring else "F",
-                        "T" if record.enabledForAddressBooks else "F",
-                        "T" if record.autoSchedule else "F",
-                    )
-                )
+                yield self._addRecord(record)
 
     @inlineCallbacks
     def removeAugmentRecords(self, uids):
@@ -435,6 +444,13 @@
         for uid in uids:
             yield self.execute("delete from AUGMENTS where UID = :1", (uid,))
 
+    def clean(self):
+        """
+        Remove all records.
+        """
+
+        return self.execute("delete from AUGMENTS", ())
+        
     @inlineCallbacks
     def _getPartitionID(self, hostedat, createIfMissing=True):
         
@@ -520,8 +536,28 @@
     def __init__(self, dbpath):
         
         ADBAPISqliteMixin.__init__(self)
-        AugmentADAPI.__init__(self, "Augments", "sqlite3", (dbpath,))
+        AugmentADAPI.__init__(self, "Augments", "sqlite3", (fullServerPath(config.DataRoot, dbpath),))
 
+    @inlineCallbacks
+    def _addRecord(self, record):
+        partitionid = (yield self._getPartitionID(record.hostedAt))
+        yield self.execute(
+            """insert or replace into AUGMENTS
+            (UID, ENABLED, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE)
+            values (:1, :2, :3, :4, :5, :6)""",
+            (
+                record.uid,
+                "T" if record.enabled else "F",
+                partitionid,
+                "T" if record.enabledForCalendaring else "F",
+                "T" if record.enabledForAddressBooks else "F",
+                "T" if record.autoSchedule else "F",
+            )
+        )
+
+    def _modifyRecord(self, record):
+        return self._addRecord(record)
+
 class AugmentPostgreSQLDB(ADBAPIPostgreSQLMixin, AugmentADAPI):
     """
     PostgreSQL based augment database implementation.
@@ -532,3 +568,37 @@
         ADBAPIPostgreSQLMixin.__init__(self)
         AugmentADAPI.__init__(self, "Augments", "pgdb", (), host=host, database=database, user=user, password=password,)
 
+    @inlineCallbacks
+    def _addRecord(self, record):
+        partitionid = (yield self._getPartitionID(record.hostedAt))
+        yield self.execute(
+            """insert into AUGMENTS
+            (UID, ENABLED, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE)
+            values (:1, :2, :3, :4, :5, :6)""",
+            (
+                record.uid,
+                "T" if record.enabled else "F",
+                partitionid,
+                "T" if record.enabledForCalendaring else "F",
+                "T" if record.enabledForAddressBooks else "F",
+                "T" if record.autoSchedule else "F",
+            )
+        )
+
+    @inlineCallbacks
+    def _modifyRecord(self, record):
+        partitionid = (yield self._getPartitionID(record.hostedAt))
+        yield self.execute(
+            """update AUGMENTS set
+            (UID, ENABLED, PARTITIONID, CALENDARING, ADDRESSBOOKS, AUTOSCHEDULE) =
+            (:1, :2, :3, :4, :5, :6) where UID = :7""",
+            (
+                record.uid,
+                "T" if record.enabled else "F",
+                partitionid,
+                "T" if record.enabledForCalendaring else "F",
+                "T" if record.enabledForAddressBooks else "F",
+                "T" if record.autoSchedule else "F",
+                record.uid,
+            )
+        )

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/calendaruserproxy.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/calendaruserproxy.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/calendaruserproxy.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -39,7 +39,7 @@
 
 from twext.log import LoggingMixIn
 
-from twistedcaldav.config import config
+from twistedcaldav.config import config, fullServerPath
 from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\
     ADBAPIPostgreSQLMixin
 from twistedcaldav.extensions import DAVFile, DAVPrincipalResource
@@ -789,7 +789,7 @@
     def __init__(self, dbpath):
         
         ADBAPISqliteMixin.__init__(self)
-        ProxyDB.__init__(self, "Proxies", "sqlite3", (dbpath,))
+        ProxyDB.__init__(self, "Proxies", "sqlite3", (fullServerPath(config.DataRoot, dbpath),))
 
 class ProxyPostgreSQLDB(ADBAPIPostgreSQLMixin, ProxyDB):
     """

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/calendaruserproxyloader.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/calendaruserproxyloader.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/calendaruserproxyloader.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -30,6 +30,7 @@
 
 from twext.log import Logger
 
+from twistedcaldav.config import config, fullServerPath
 from twistedcaldav.directory import calendaruserproxy
 
 log = Logger()
@@ -54,7 +55,7 @@
     def __init__(self, xmlFile):
 
         self.items = []
-        self.xmlFile = xmlFile
+        self.xmlFile = fullServerPath(config.DataRoot, xmlFile)
 
         # Read in XML
         try:

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/principal.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/principal.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -56,6 +56,7 @@
 from twistedcaldav.config import config
 from twistedcaldav.cache import DisabledCacheNotifier, PropfindCacheMixin
 from twistedcaldav.directory import calendaruserproxy
+from twistedcaldav.directory import augment
 from twistedcaldav.directory.calendaruserproxy import CalendarUserProxyPrincipalResource
 from twistedcaldav.directory.directory import DirectoryService, DirectoryRecord
 from twistedcaldav.directory.util import NotFilePath
@@ -488,7 +489,6 @@
             subType = None
 
         record = self.directory.recordWithUID(primaryUID)
-
         primaryPrincipal = self.principalForRecord(record) if record and record.enabled else None
         if primaryPrincipal is None:
             log.err("No principal found for UID: %s" % (name,))
@@ -618,6 +618,7 @@
             """---------------------\n"""
             """Directory GUID: %s\n"""         % (self.record.service.guid,),
             """Realm: %s\n"""                  % (self.record.service.realmName,),
+            """Hosted-At: %s\n"""              % (self.record.hostedAt,) if config.Partitioning.Enabled else "", 
             """\n"""
             """Principal Information\n"""
             """---------------------\n"""
@@ -786,8 +787,12 @@
     # Extra resource info
     ##
 
+    @inlineCallbacks
     def setAutoSchedule(self, autoSchedule):
         self.record.autoSchedule = autoSchedule
+        augmentRecord = (yield augment.AugmentService.getAugmentRecord(self.record.guid))
+        augmentRecord.autoSchedule = autoSchedule
+        (yield augment.AugmentService.addAugmentRecords([augmentRecord]))
 
     def getAutoSchedule(self):
         return self.record.autoSchedule

Deleted: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/modify/caldavd.plist
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/modify/caldavd.plist	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/modify/caldavd.plist	2010-02-17 20:55:11 UTC (rev 5147)
@@ -1,748 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-    Copyright (c) 2006-2010 Apple Inc. All rights reserved.
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-  -->
-
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-  <dict>
-
-    <!--
-        Public network address information
-
-        This is the server's public network address, which is provided to
-        clients in URLs and the like.  It may or may not be the network
-        address that the server is listening to directly, though it is by
-        default.  For example, it may be the address of a load balancer or
-        proxy which forwards connections to the server.
-      -->
-
-    <!-- Network host name [empty = system host name] -->
-    <key>ServerHostName</key>
-    <string></string> <!-- The hostname clients use when connecting -->
-
-    <!-- HTTP port [0 = disable HTTP] -->
-    <key>HTTPPort</key>
-    <integer>8008</integer>
-
-    <!-- SSL port [0 = disable HTTPS] -->
-    <!-- (Must also configure SSLCertificate and SSLPrivateKey below) -->
-    <key>SSLPort</key>
-    <integer>8443</integer>
-
-    <!-- Redirect non-SSL ports to an SSL port -->
-    <key>RedirectHTTPToHTTPS</key>
-    <false/>
-
-    <!--
-        Network address configuration information
-
-        This configures the actual network address that the server binds to.
-      -->
-
-    <!-- List of IP addresses to bind to [empty = all] -->
-    <key>BindAddresses</key>
-    <array>
-    </array>
-
-    <!-- List of port numbers to bind to for HTTP [empty = same as "Port"] -->
-    <key>BindHTTPPorts</key>
-    <array>
-    </array>
-
-    <!-- List of port numbers to bind to for SSL [empty = same as "SSLPort"] -->
-    <key>BindSSLPorts</key>
-    <array>
-    </array>
-
-
-    <!--
-        Data Store
-      -->
-
-    <!-- Data root -->
-    <key>DataRoot</key>
-    <string>data/</string>
-
-    <!-- Document root -->
-    <key>DocumentRoot</key>
-    <string>twistedcaldav/test/data/</string>
-
-    <!-- Child aliases -->
-    <key>Aliases</key>
-    <dict>
-      <!--
-      <key>foo</key>
-      <dict>
-        <key>path</key>
-        <string>/path/to/foo</string>
-      </dict>
-       -->
-    </dict>
-
-    <!-- User quota (in bytes) -->
-    <key>UserQuota</key>
-    <integer>104857600</integer><!-- 100Mb -->
-
-    <!-- Attachment size limit (in bytes) -->
-    <key>MaximumAttachmentSize</key>
-    <integer>1048576</integer><!-- 1Mb -->
-
-    <!-- Maximum number of unique attendees per entire event -->
-    <!-- 0 for no limit -->
-    <key>MaxAttendeesPerInstance</key>
-    <integer>100</integer>
-
-    <!-- Maximum number of instances allowed for a single RRULE -->
-    <!-- 0 for no limit -->
-    <key>MaxInstancesForRRULE</key>
-    <integer>400</integer>
-
-
-    <!--
-        Directory service
-
-        A directory service provides information about principals (eg.
-        users, groups, locations and resources) to the server.
-
-        A variety of directory services are available for use.
-      -->
-
-    <!-- XML File Directory Service -->
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>SET IN TEST</string>
-        <key>recordTypes</key>
-        <array>
-            <string>users</string>
-            <string>groups</string>
-        </array>
-      </dict>
-    </dict>
-
-    <!-- XML File Resource Service -->
-    <key>ResourceService</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>type</key>
-      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFile</key>
-        <string>SET IN TEST</string>
-        <key>recordTypes</key>
-        <array>
-            <string>resources</string>
-            <string>locations</string>
-        </array>
-      </dict>
-    </dict>
-    
-    <!-- Open Directory Service (Mac OS X) -->
-    <!--
-    <key>DirectoryService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-      
-      <key>params</key>
-      <dict>
-        <key>node</key>
-        <string>/Search</string>
-        <key>cacheTimeout</key>
-        <integer>30</integer>
-      </dict>
-    </dict>
-    -->
-
-    <!--
-        Augment service
-
-        Augments for the directory service records to add calendar specific attributes.
-
-        A variety of augment services are available for use.
-        When using a partitioned server, a service that can be accessed from each host will be needed.
-      -->
-
-    <!-- XML File Augment Service -->
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>xmlFiles</key>
-        <array>
-	      <string>SET IN TEST</string>
-        </array>
-      </dict>
-    </dict>
-    
-    <!-- Sqlite Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>/etc/caldavd/augments.sqlite</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- PostgreSQL Augment Service -->
-    <!--
-    <key>AugmentService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>augments</string>
-      </dict>
-    </dict>
-     -->
-
-    <!-- Sqlite ProxyDB Service -->
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>dbpath</key>
-        <string>data/proxies.sqlite</string>
-      </dict>
-    </dict>
-
-    <!-- PostgreSQL ProxyDB Service -->
-    <!--
-    <key>ProxyDBService</key>
-    <dict>
-      <key>type</key>
-      <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
-      
-      <key>params</key>
-      <dict>
-        <key>host</key>
-        <string>localhost</string>
-        <key>database</key>
-        <string>proxies</string>
-      </dict>
-    </dict>
-     -->
-
-	<key>ProxyLoadFromFile</key>
-    <string>conf/auth/proxies-test.xml</string>
-
-    <!--
-        Special principals
-
-        These principals are granted special access and/or perform
-        special roles on the server.
-      -->
-
-    <!-- Principals with "DAV:all" access (relative URLs) -->
-    <key>AdminPrincipals</key>
-    <array>
-      <string>/principals/__uids__/admin/</string>
-    </array>
-
-    <!-- Principals with "DAV:read" access (relative URLs) -->
-    <key>ReadPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/983C8238-FB6B-4D92-9242-89C0A39E5F81/</string> -->
-    </array>
-
-    <!-- Principals that can pose as other principals -->
-    <key>SudoersFile</key>
-    <string>conf/sudoers.plist</string>
-
-    <!-- Create "proxy access" principals -->
-    <key>EnableProxyPrincipals</key>
-    <true/>
-
-
-    <!--
-        Permissions
-      -->
-
-    <!-- Anonymous read access for root resource -->
-    <key>EnableAnonymousReadRoot</key>
-    <true/>
-
-    <!-- Anonymous read access for resource hierarchy -->
-    <key>EnableAnonymousReadNav</key>
-    <false/>
-
-    <!-- Enables directory listings for principals -->
-    <key>EnablePrincipalListings</key>
-    <true/>
-
-    <!-- Render calendar collections as a monolithic iCalendar object -->
-    <key>EnableMonolithicCalendars</key>
-    <true/>
-
-
-    <!--
-        Authentication
-      -->
-
-    <key>Authentication</key>
-    <dict>
-
-      <!-- Clear text; best avoided -->
-      <key>Basic</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-      </dict>
-
-      <!-- Digest challenge/response -->
-      <key>Digest</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>Algorithm</key>
-        <string>md5</string>
-        <key>Qop</key>
-        <string></string>
-      </dict>
-
-      <!-- Kerberos/SPNEGO -->
-      <key>Kerberos</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>ServicePrincipal</key>
-        <string></string>
-      </dict>
-
-      <!-- Wikiserver authentication (Mac OS X) -->
-      <key>Wiki</key>
-      <dict>
-        <key>Enabled</key>
-        <true/>
-        <key>Cookie</key>
-        <string>sessionID</string>
-        <key>URL</key>
-        <string>http://127.0.0.1/RPC2</string>
-        <key>UserMethod</key>
-        <string>userForSession</string>
-        <key>WikiMethod</key>
-        <string>accessLevelForUserWikiCalendar</string>
-      </dict>
-
-    </dict>
-
-
-    <!--
-        Logging
-      -->
-
-    <!-- Apache-style access log -->
-    <key>AccessLogFile</key>
-    <string>logs/access.log</string>
-    <key>RotateAccessLog</key>
-    <false/>
-
-    <!-- Server activity log -->
-    <key>ErrorLogFile</key>
-    <string>logs/error.log</string>
-
-    <!-- Log levels -->
-    <key>DefaultLogLevel</key>
-    <string>info</string> <!-- debug, info, warn, error -->
-
-    <!-- Log level overrides for specific functionality -->
-    <key>LogLevels</key>
-    <dict>
-      <!--
-      <key>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</key>
-      <string>debug</string>
-      -->
-    </dict>
-
-    <!-- Global server stats --> 
-    <key>GlobalStatsSocket</key> 
-    <string>logs/caldavd-stats.sock</string> 
-
-    <!-- Global server stats logging period --> 
-    <key>GlobalStatsLoggingPeriod</key> 
-    <integer>60</integer> 
-
-    <!-- Global server stats logging frequency [0 = disable stats] --> 
-    <key>GlobalStatsLoggingFrequency</key> 
-    <integer>12</integer>
-
-    <!-- Server statistics file -->
-    <key>ServerStatsFile</key>
-    <string>logs/stats.plist</string>
-
-    <!-- Server process ID file -->
-    <key>PIDFile</key>
-    <string>logs/caldavd.pid</string>
-
-
-    <!--
-        Accounting
-      -->
-
-    <!-- Enable accounting for certain operations -->
-    <key>AccountingCategories</key>
-    <dict>
-      <key>iTIP</key>
-      <false/>
-      <key>HTTP</key>
-      <false/>
-    </dict>
-    <!-- Enable accounting for specific principals -->
-    <key>AccountingPrincipals</key>
-    <array>
-      <!-- <string>/principals/__uids__/454D85C0-09F0-4DC6-A3C6-97DFEB4622CD/</string> -->
-    </array>
-
-
-    <!--
-        SSL/TLS
-      -->
-
-    <!-- Public key -->
-    <key>SSLCertificate</key>
-    <string>twistedcaldav/test/data/server.pem</string>
-
-    <!-- SSL authority chain (for intermediate certs) -->
-    <key>SSLAuthorityChain</key>
-    <string></string>
-
-    <!-- Private key -->
-    <key>SSLPrivateKey</key>
-    <string>twistedcaldav/test/data/server.pem</string>
-
-
-    <!--
-        Process management
-      -->
-
-    <key>UserName</key>
-    <string></string>
-
-    <key>GroupName</key>
-    <string></string>
-
-    <key>ProcessType</key>
-    <string>Combined</string>
-
-    <key>MultiProcess</key>
-    <dict>
-      <key>ProcessCount</key>
-      <integer>2</integer> <!-- 0 = larger of: 4 or (2 * CPU count) -->
-    </dict>
-
-
-    <!--
-        Notifications
-      -->
-
-    <key>Notifications</key>
-    <dict>
-      <!-- Time spent coalescing notifications before delivery -->
-      <key>CoalesceSeconds</key>
-      <integer>3</integer>
-
-      <key>InternalNotificationHost</key>
-      <string>localhost</string>
-
-      <key>InternalNotificationPort</key>
-      <integer>62309</integer>
-
-      <key>Services</key>
-      <dict>
-        <key>SimpleLineNotifier</key>
-        <dict>
-          <!-- Simple line notification service (for testing) -->
-          <key>Service</key>
-          <string>twistedcaldav.notify.SimpleLineNotifierService</string>
-          <key>Enabled</key>
-          <false/>
-          <key>Port</key>
-          <integer>62308</integer>
-        </dict>
-
-        <key>XMPPNotifier</key>
-        <dict>
-          <!-- XMPP notification service -->
-          <key>Service</key>
-          <string>twistedcaldav.notify.XMPPNotifierService</string>
-          <key>Enabled</key>
-          <false/>
-
-          <!-- XMPP host and port to contact -->
-          <key>Host</key>
-          <string>xmpp.host.name</string>
-          <key>Port</key>
-          <integer>5222</integer>
-
-          <!-- Jabber ID and password for the server -->
-          <key>JID</key>
-          <string>jid at xmpp.host.name/resource</string>
-          <key>Password</key>
-          <string>password_goes_here</string>
-
-          <!-- PubSub service address -->
-          <key>ServiceAddress</key>
-          <string>pubsub.xmpp.host.name</string>
-
-          <key>NodeConfiguration</key>
-          <dict>
-            <key>pubsub#deliver_payloads</key>
-            <string>1</string>
-            <key>pubsub#persist_items</key>
-            <string>1</string>
-          </dict>
-
-          <!-- Sends a presence notification to XMPP server at this interval (prevents disconnect) -->
-          <key>KeepAliveSeconds</key>
-          <integer>120</integer>
-
-          <!-- Sends a pubsub publish to a particular heartbeat node at this interval -->
-          <key>HeartbeatMinutes</key>
-          <integer>30</integer>
-
-          <!-- List of glob-like expressions defining which XMPP JIDs can converse with the server (for debugging) -->
-          <key>AllowedJIDs</key>
-          <array>
-            <!--
-            <string>*.example.com</string>
-             -->
-          </array>
-        </dict>
-      </dict>
-    </dict>
-
-
-    <!--
-        Server-to-server protocol
-      -->
-
-    <key>Scheduling</key>
-    <dict>
-
-      <!-- CalDAV protocol options -->
-      <key>CalDAV</key>
-      <dict>
-        <key>EmailDomain</key>
-        <string></string>
-        <key>HTTPDomain</key>
-        <string></string>
-        <key>AddressPatterns</key>
-        <array>
-        </array>
-        <key>OldDraftCompatibility</key>
-        <true/>
-        <key>ScheduleTagCompatibility</key>
-        <true/>
-        <key>EnablePrivateComments</key>
-        <true/>
-      </dict>
-
-      <!-- iSchedule protocol options -->
-      <key>iSchedule</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>AddressPatterns</key>
-        <array>
-        </array>
-        <key>Servers</key>
-        <string>conf/servertoserver-test.xml</string>
-      </dict>
-
-      <!-- iMIP protocol options -->
-      <key>iMIP</key>
-      <dict>
-        <key>Enabled</key>
-        <false/>
-        <key>MailGatewayServer</key>
-        <string>localhost</string>
-        <key>MailGatewayPort</key>
-        <integer>62310</integer>
-        <key>Sending</key>
-        <dict>
-          <key>Server</key>
-          <string></string>
-          <key>Port</key>
-          <integer>587</integer>
-          <key>UseSSL</key>
-          <true/>
-          <key>Username</key>
-          <string></string>
-          <key>Password</key>
-          <string></string>
-          <key>Address</key>
-          <string></string> <!-- Address email will be sent from -->
-        </dict>
-        <key>Receiving</key>
-        <dict>
-          <key>Server</key>
-          <string></string>
-          <key>Port</key>
-          <integer>995</integer>
-          <key>Type</key>
-          <string></string> <!-- Either "pop" or "imap" -->
-          <key>UseSSL</key>
-          <true/>
-          <key>Username</key>
-          <string></string>
-          <key>Password</key>
-          <string></string>
-          <key>PollingSeconds</key>
-          <integer>30</integer>
-        </dict>
-        <key>AddressPatterns</key>
-        <array>
-          <string>mailto:.*</string>
-        </array>
-      </dict>
-
-	  <!-- General options for scheduling -->
-	  <key>Options</key>
-	  <dict>
-        <key>AllowGroupAsOrganizer</key>
-        <false/>
-        <key>AllowLocationAsOrganizer</key>
-        <false/>
-        <key>AllowResourceAsOrganizer</key>
-        <false/>
-       </dict>
-
-    </dict>
-
-
-    <!--
-        Free-busy URL protocol
-      -->
-
-    <key>FreeBusyURL</key>
-    <dict>
-      <key>Enabled</key>
-      <true/>
-      <key>TimePeriod</key>
-      <integer>14</integer>
-      <key>AnonymousAccess</key>
-      <false/>
-    </dict>
-
-
-    <!--
-        Non-standard CalDAV extensions
-      -->
-
-    <!-- Calendar Drop Box -->
-    <key>EnableDropBox</key>
-    <true/>
-
-    <!-- Private Events -->
-    <key>EnablePrivateEvents</key>
-    <true/>
-
-    <!-- Timezone Service -->
-    <key>EnableTimezoneService</key>
-    <true/>
-
-
-    <!--
-        Miscellaneous items
-      -->
-
-    <!-- Service ACLs (Mac OS X) -->
-    <key>EnableSACLs</key>
-    <false/>
-
-    <!-- Web-based administration -->
-    <key>EnableWebAdmin</key>
-    <true/>
-
-    <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
-    <key>ResponseCompression</key>
-    <false/>
-    
-    <!-- The retry-after value (in seconds) to return with a 503 error. -->
-    <key>HTTPRetryAfter</key>
-    <integer>180</integer>
-
-    <!-- A unix socket used for communication between the child and master processes.
-         An empty value tells the server to use a tcp socket instead. -->
-    <key>ControlSocket</key>
-    <string>logs/caldavd.sock</string>
-
-    <!-- Support for Memcached -->
-    <key>Memcached</key>
-    <dict>
-      <key>MaxClients</key>
-      <integer>5</integer>
-      <key>memcached</key>
-      <string>memcached</string> <!-- Find in PATH -->
-      <key>Options</key>
-      <array>
-        <!--<string>-vv</string>-->
-      </array>
-    </dict>
-
-    <!-- Response Caching -->
-    <key>ResponseCacheTimeout</key>
-    <integer>30</integer> <!-- in minutes -->
-
-
-    <!--
-        Twisted
-      -->
-
-    <key>Twisted</key>
-    <dict>
-      <key>twistd</key>
-      <string>../Twisted/bin/twistd</string>
-    </dict>
-
-
-    <key>Localization</key>
-    <dict>
-      <key>LocalesDirectory</key>
-      <string>locales</string>
-      <key>Language</key>
-      <string>English</string>
-    </dict>
-
-
-  </dict>
-</plist>

Copied: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/resources.xml (from rev 5146, CalendarServer/trunk/twistedcaldav/directory/test/resources.xml)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/resources.xml	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/resources.xml	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Copyright (c) 2006-2010 Apple Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ -->
+
+<!DOCTYPE accounts SYSTEM "../../../conf/auth/accounts.dtd">
+
+<accounts realm="Test">
+</accounts>

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_augment.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_augment.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_augment.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -16,11 +16,12 @@
 
 from twistedcaldav.test.util import TestCase
 from twistedcaldav.directory.augment import AugmentXMLDB, AugmentSqliteDB,\
-    AugmentPostgreSQLDB
+    AugmentPostgreSQLDB, AugmentRecord
 from twisted.internet.defer import inlineCallbacks
 from twistedcaldav.directory.xmlaugmentsparser import XMLAugmentsParser
 import cStringIO
 import os
+from twisted.python.filepath import FilePath
 
 xmlFile = os.path.join(os.path.dirname(__file__), "augments-test.xml")
 xmlFileDefault = os.path.join(os.path.dirname(__file__), "augments-test-default.xml")
@@ -37,6 +38,15 @@
 
 testRecordDefault = {"uid":"A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True,  "hostedAt":"00001", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False}
 
+testAddRecords = (
+    {"uid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled":True,  "hostedAt":"", "enabledForCalendaring":False, "enabledForAddressBooks":False, "autoSchedule":False},
+)
+
+testModifyRecords = (
+    {"uid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975767", "enabled":True,  "hostedAt":"", "enabledForCalendaring":True, "enabledForAddressBooks":True, "autoSchedule":False},
+)
+
+
 class AugmentTests(TestCase):
 
     @inlineCallbacks
@@ -105,12 +115,46 @@
   </record>
 """), db)
 
+    @inlineCallbacks
+    def test_add_modify(self):
+        
+        # Duplicate file as we will change it
+        newxmlfile = FilePath(self.mktemp())
+        FilePath(xmlFile).copyTo(newxmlfile)
+        
+        db = AugmentXMLDB((newxmlfile.path,))
+
+        for item in testRecords:
+            yield self._checkRecord(db, item)
+
+        newrecord = AugmentRecord(
+            **testAddRecords[0]
+        )
+        yield db.addAugmentRecords((newrecord,))
+
+        newdb = AugmentXMLDB((newxmlfile.path,))
+
+        for item in testRecords:
+            yield self._checkRecord(newdb, item)
+        yield self._checkRecord(newdb, testAddRecords[0])
+
+        newrecord = AugmentRecord(
+            **testModifyRecords[0]
+        )
+        yield db.addAugmentRecords((newrecord,))
+
+        newdb = AugmentXMLDB((newxmlfile.path,))
+
+        for item in testRecords:
+            yield self._checkRecord(newdb, item)
+        yield self._checkRecord(newdb, testModifyRecords[0])
+
 class AugmentSqliteTests(AugmentTests):
 
     @inlineCallbacks
     def test_read(self):
         
-        db = AugmentSqliteDB(self.mktemp())
+        db = AugmentSqliteDB(os.path.abspath(self.mktemp()))
 
         dbxml = AugmentXMLDB((xmlFile,))
         yield db.addAugmentRecords(dbxml.db.values())
@@ -123,7 +167,7 @@
     @inlineCallbacks
     def test_read_default(self):
         
-        db = AugmentSqliteDB(self.mktemp())
+        db = AugmentSqliteDB(os.path.abspath(self.mktemp()))
 
         dbxml = AugmentXMLDB((xmlFileDefault,))
         yield db.addAugmentRecords(dbxml.db.values())
@@ -133,6 +177,42 @@
 
         yield self._checkRecord(db, testRecordDefault)
 
+    @inlineCallbacks
+    def test_add_modify(self):
+        
+        dbpath = os.path.abspath(self.mktemp())
+        db = AugmentSqliteDB(dbpath)
+
+        dbxml = AugmentXMLDB((xmlFile,))
+        yield db.addAugmentRecords(dbxml.db.values())
+
+        for item in testRecords:
+            yield self._checkRecord(db, item)
+
+        yield self._checkNoRecord(db, "D11F03A0-97EA-48AF-9A6C-FAC7F3975767")
+
+        newrecord = AugmentRecord(
+            **testAddRecords[0]
+        )
+        yield db.addAugmentRecords((newrecord,))
+
+        newdb = AugmentSqliteDB(dbpath)
+
+        for item in testRecords:
+            yield self._checkRecord(newdb, item)
+        yield self._checkRecord(newdb, testAddRecords[0])
+
+        newrecord = AugmentRecord(
+            **testModifyRecords[0]
+        )
+        yield db.addAugmentRecords((newrecord,))
+
+        newdb = AugmentSqliteDB(dbpath)
+
+        for item in testRecords:
+            yield self._checkRecord(newdb, item)
+        yield self._checkRecord(newdb, testModifyRecords[0])
+
 class AugmentPostgreSQLTests(AugmentTests):
 
     @inlineCallbacks
@@ -163,6 +243,42 @@
 
         yield self._checkRecord(db, testRecordDefault)
 
+    @inlineCallbacks
+    def test_add_modify(self):
+        
+        db = AugmentPostgreSQLDB("localhost", "augments")
+        yield db.clean()
+
+        dbxml = AugmentXMLDB((xmlFile,))
+        yield db.addAugmentRecords(dbxml.db.values())
+
+        for item in testRecords:
+            yield self._checkRecord(db, item)
+
+        yield self._checkNoRecord(db, "D11F03A0-97EA-48AF-9A6C-FAC7F3975767")
+
+        newrecord = AugmentRecord(
+            **testAddRecords[0]
+        )
+        yield db.addAugmentRecords((newrecord,))
+
+        newdb = AugmentPostgreSQLDB("localhost", "augments")
+
+        for item in testRecords:
+            yield self._checkRecord(newdb, item)
+        yield self._checkRecord(newdb, testAddRecords[0])
+
+        newrecord = AugmentRecord(
+            **testModifyRecords[0]
+        )
+        yield db.addAugmentRecords((newrecord,))
+
+        newdb = AugmentPostgreSQLDB("localhost", "augments")
+
+        for item in testRecords:
+            yield self._checkRecord(newdb, item)
+        yield self._checkRecord(newdb, testModifyRecords[0])
+
 try:
     import pgdb
 except ImportError:

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_calendar.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_calendar.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_calendar.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -28,6 +28,7 @@
 from twistedcaldav.static import CalendarHomeProvisioningFile
 
 import twistedcaldav.test.util
+from twistedcaldav.config import config
 
 class ProvisionedCalendars (twistedcaldav.test.util.TestCase):
     """
@@ -37,11 +38,11 @@
         super(ProvisionedCalendars, self).setUp()
         
         # Setup the initial directory
-        self.xmlFile = self.mktemp()
+        self.xmlFile = os.path.join(config.DataRoot, "accounts.xml")
         fd = open(self.xmlFile, "w")
         fd.write(open(xmlFile.path, "r").read())
         fd.close()
-        self.directoryService = XMLDirectoryService({'xmlFile' : self.xmlFile})
+        self.directoryService = XMLDirectoryService({'xmlFile' : "accounts.xml"})
         augment.AugmentService = augment.AugmentXMLDB(xmlFiles=(augmentsFile.path,))
         
         # Set up a principals hierarchy for each service we're testing with

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_digest.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_digest.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_digest.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -14,6 +14,10 @@
 # limitations under the License.
 ##
 
+import sys
+import time
+from hashlib import md5
+
 from twisted.cred import error
 from twisted.internet import address
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -26,11 +30,7 @@
 from twistedcaldav.test.util import TestCase
 from twistedcaldav.config import config
 from twext.web2.auth.digest import DigestCredentialFactory
-import time
 
-import md5
-import sys
-
 class FakeDigestCredentialFactory(QopDigestCredentialFactory):
     """
     A Fake Digest Credential Factory that generates a predictable
@@ -344,10 +344,10 @@
             creds = (yield factory.decode(clientResponse, _trivial_GET()))
     
             self.failUnless(creds.checkHash(
-                    md5.md5('username:test realm:password').hexdigest()))
+                    md5('username:test realm:password').hexdigest()))
     
             self.failIf(creds.checkHash(
-                    md5.md5('username:test realm:bogus').hexdigest()))
+                    md5('username:test realm:bogus').hexdigest()))
 
     @inlineCallbacks
     def test_invalidNonceCount(self):

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_guidchange.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_guidchange.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_guidchange.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -38,7 +38,7 @@
         super(ProvisionedPrincipals, self).setUp()
         
         # Setup the initial directory
-        self.xmlFile = self.mktemp()
+        self.xmlFile = os.path.abspath(self.mktemp())
         fd = open(self.xmlFile, "w")
         fd.write(open(xmlFile.path, "r").read())
         fd.close()

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_modify.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_modify.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_modify.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -25,14 +25,16 @@
 class ModificationTestCase(TestCase):
 
     def setUp(self):
+        super(ModificationTestCase, self).setUp()
+
         testRoot = os.path.join(os.path.dirname(__file__), "modify")
-        configFileName = os.path.join(testRoot, "caldavd.plist")
-        config.load(configFileName)
+        #configFileName = os.path.join(testRoot, "caldavd.plist")
+        #config.load(configFileName)
 
         usersFile = os.path.join(testRoot, "users-groups.xml")
         config.DirectoryService.params.xmlFile = usersFile
 
-        # Copy xml file containgin locations/resources to a temp file because
+        # Copy xml file containing locations/resources to a temp file because
         # we're going to be modifying it during testing
 
         origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
@@ -40,12 +42,11 @@
         copyResourcesFile = FilePath(self.mktemp())
         origResourcesFile.copyTo(copyResourcesFile)
         config.ResourceService.params.xmlFile = copyResourcesFile
+        config.ResourceService.Enabled = True
 
         augmentsFile = os.path.join(testRoot, "augments.xml")
         config.AugmentService.params.xmlFiles = (augmentsFile,)
 
-        super(ModificationTestCase, self).setUp()
-
     def test_createRecord(self):
         directory = getDirectory()
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_principal.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_principal.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_principal.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -67,7 +67,7 @@
             self.principalRootResources[directory.__class__.__name__] = provisioningResource
 
         augment.AugmentService = augment.AugmentXMLDB(xmlFiles=(augmentsFile.path,))
-        calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB(self.mktemp())
+        calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB(os.path.abspath(self.mktemp()))
 
     def test_hierarchy(self):
         """

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_proxyprincipaldb.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_proxyprincipaldb.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_proxyprincipaldb.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -13,15 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ##
-from twistedcaldav.config import config
 
 from twisted.internet.defer import inlineCallbacks
+from twistedcaldav.config import config
+from twistedcaldav.directory import calendaruserproxy
 from twistedcaldav.directory.calendaruserproxy import ProxySqliteDB,\
     ProxyPostgreSQLDB
+from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
 import twistedcaldav.test.util
-from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
-from twistedcaldav.directory import calendaruserproxy
 
+import os
+
 class ProxyPrincipalDBSqlite (twistedcaldav.test.util.TestCase):
     """
     Directory service provisioned principals.
@@ -73,7 +75,7 @@
     def test_normalDB(self):
     
         # Get the DB
-        db_path = self.mktemp()
+        db_path = os.path.abspath(self.mktemp())
         db = ProxySqliteDB(db_path)
         yield db.setGroupMembers("A", ("B", "C", "D",))
         
@@ -87,7 +89,7 @@
     def test_DBIndexed(self):
     
         # Get the DB
-        db_path = self.mktemp()
+        db_path = os.path.abspath(self.mktemp())
         db = ProxySqliteDB(db_path)
         self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set(("GROUPNAMES", "MEMBERS")))
 
@@ -95,7 +97,7 @@
     def test_OldDB(self):
     
         # Get the DB
-        db_path = self.mktemp()
+        db_path = os.path.abspath(self.mktemp())
         db = self.old_ProxyDB(db_path)
         self.assertEqual(set([row[1] for row in (yield db.query("PRAGMA index_list(GROUPS)"))]), set())
 
@@ -103,7 +105,7 @@
     def test_DBUpgrade(self):
     
         # Get the DB
-        db_path = self.mktemp()
+        db_path = os.path.abspath(self.mktemp())
         db = self.old_ProxyDB(db_path)
         yield db.setGroupMembers("A", ("B", "C", "D",))
 
@@ -131,7 +133,7 @@
     def test_DBUpgradeNewer(self):
     
         # Get the DB
-        db_path = self.mktemp()
+        db_path = os.path.abspath(self.mktemp())
         db = self.old_ProxyDB(db_path)
         yield db.setGroupMembers("A", ("B", "C", "D",))
 
@@ -159,7 +161,7 @@
     def test_DBNoUpgradeNewer(self):
     
         # Get the DB
-        db_path = self.mktemp()
+        db_path = os.path.abspath(self.mktemp())
         db = self.new_ProxyDB(db_path)
         yield db.setGroupMembers("A", ("B", "C", "D",))
 
@@ -190,7 +192,7 @@
             config.ProcessType = processType
 
             # Get the DB
-            db_path = self.mktemp()
+            db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
             
             # Do one insert and check the result
@@ -230,7 +232,7 @@
             config.ProcessType = processType
 
             # Get the DB
-            db_path = self.mktemp()
+            db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
             
             # Do one insert and check the result
@@ -271,7 +273,7 @@
             config.ProcessType = processType
 
             # Get the DB
-            db_path = self.mktemp()
+            db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
             
             # Do one insert and check the result
@@ -304,7 +306,7 @@
             config.ProcessType = processType
 
             # Get the DB
-            db_path = self.mktemp()
+            db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
             
             # Do one insert and check the result
@@ -345,7 +347,7 @@
             config.ProcessType = processType
 
             # Get the DB
-            db_path = self.mktemp()
+            db_path = os.path.abspath(self.mktemp())
             db = ProxySqliteDB(db_path)
             
             # Do one insert and check the result for the one we will remove

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_proxyprincipalmembers.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_proxyprincipalmembers.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_proxyprincipalmembers.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -30,7 +30,6 @@
 from twistedcaldav.config import config
 from twistedcaldav.directory import augment, calendaruserproxy
 from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
-import os
 
 class ProxyPrincipals (twistedcaldav.test.util.TestCase):
     """
@@ -43,7 +42,7 @@
 
         self.directoryService = XMLDirectoryService({'xmlFile' : xmlFile})
         augment.AugmentService = augment.AugmentXMLDB(xmlFiles=(augmentsFile.path,))
-        calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB(self.mktemp())
+        calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB("proxies.sqlite")
 
         # Set up a principals hierarchy for each service we're testing with
         self.principalRootResources = {}
@@ -56,8 +55,6 @@
 
         self.principalRootResources[self.directoryService.__class__.__name__] = provisioningResource
 
-        config.DataRoot = self.mktemp()
-        os.mkdir(config.DataRoot)
         yield XMLCalendarUserProxyLoader(proxiesFile.path).updateProxyDB()
 
     def _getPrincipalByShortName(self, type, name):

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_resources.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_resources.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/test/test_resources.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -22,21 +22,20 @@
 class ResourcesTestCase(TestCase):
 
     def setUp(self):
-        testRoot = os.path.join(os.path.dirname(__file__), "resources")
-        configFileName = os.path.join(testRoot, "caldavd.plist")
-        config.load(configFileName)
+        super(ResourcesTestCase, self).setUp()
 
+        testRoot = os.path.join(".", os.path.dirname(__file__), "resources")
+
         xmlFile = os.path.join(testRoot, "users-groups.xml")
         config.DirectoryService.params.xmlFile = xmlFile
 
         xmlFile = os.path.join(testRoot, "resources-locations.xml")
         config.ResourceService.params.xmlFile = xmlFile
+        config.ResourceService.Enabled = True
 
         xmlFile = os.path.join(testRoot, "augments.xml")
         config.AugmentService.params.xmlFiles = (xmlFile,)
 
-        super(ResourcesTestCase, self).setUp()
-
 # Uh, what's this testing?
 #    def test_loadConfig(self):
 #        directory = getDirectory()

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/xmlaugmentsparser.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/xmlaugmentsparser.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/xmlaugmentsparser.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -98,7 +98,7 @@
                     ELEMENT_UID,
                     ELEMENT_HOSTEDAT,
                 ):
-                    fields[node.tag] = node.text
+                    fields[node.tag] = node.text if node.text else ""
                 elif node.tag in (
                     ELEMENT_ENABLE,
                     ELEMENT_ENABLECALENDAR,

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/xmlfile.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/xmlfile.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/directory/xmlfile.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -31,6 +31,7 @@
 from twext.python.filepath import CachingFilePath as FilePath
 from twistedcaldav.config import config
 
+from twistedcaldav.config import fullServerPath
 from twistedcaldav.directory import augment
 from twistedcaldav.directory.directory import DirectoryService, DirectoryError
 from twistedcaldav.directory.cachingdirectory import CachingDirectoryService,\
@@ -73,7 +74,7 @@
 
         super(XMLDirectoryService, self).__init__(params['cacheTimeout'])
 
-        xmlFile = params.get("xmlFile")
+        xmlFile = fullServerPath(config.DataRoot, params.get("xmlFile"))
         if type(xmlFile) is str:
             xmlFile = FilePath(xmlFile)
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/mail.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/mail.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/mail.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -37,31 +37,27 @@
 from zope.interface import implements
 
 from twisted.application import internet, service
-from twisted.cred.portal import Portal
 from twisted.internet import protocol, defer, ssl, reactor
 from twisted.internet.defer import inlineCallbacks, returnValue, succeed
 from twisted.mail import pop3client, imap4
 from twisted.mail.smtp import messageid, rfc822date, ESMTPSenderFactory
 from twisted.plugin import IPlugin
-from twisted.python.reflect import namedClass
 from twisted.python.usage import Options, UsageError
 from twisted.web import client
 
 from twext.web2 import server, responsecode
 from twext.web2.channel.http import HTTPFactory
-from twext.web2.dav import auth
 from twext.web2.dav import davxml
 from twext.web2.dav.noneprops import NonePropertyStore
 from twext.web2.http import Response, HTTPError
 from twext.web2.http_headers import MimeType
-from twext.web2.auth.basic import BasicCredentialFactory
 
+
 from twext.log import Logger, LoggingMixIn
 
 from twistedcaldav import ical, caldavxml
 from twistedcaldav import memcachepool
 from twistedcaldav.config import config
-from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
 from twistedcaldav.directory.util import NotFilePath
 from twistedcaldav.ical import Property
 from twistedcaldav.localization import translationTo
@@ -72,7 +68,7 @@
 from twistedcaldav.util import AuthorizedHTTPGetter
 from twistedcaldav.stdconfig import DEFAULT_CONFIG, DEFAULT_CONFIG_FILE
 
-from calendarserver.provision.root import RootResource
+from calendarserver.util import getRootResource
 
 
 __all__ = [
@@ -587,32 +583,13 @@
         self.settings = settings
         self.mailer = mailer
 
-        directoryClass = namedClass(config.DirectoryService.type)
-        directory = directoryClass(config.DirectoryService.params)
-
-        principalCollection = DirectoryPrincipalProvisioningResource(
-            "/principals/",
-            directory,
-        )
-
-        root = RootResource(
-            config.DocumentRoot,
-            principalCollections=(principalCollection,),
-        )
-
-        # Authenticated /inbox
-        portal = Portal(auth.DavRealm())
-        portal.registerChecker(directory)
-        realm = directory.realmName or ""
-        root.putChild('inbox',
-            auth.AuthenticationWrapper(
-                IMIPInvitationInboxResource(root, mailer),
-                portal,
-                (BasicCredentialFactory(realm),),
-                (auth.IPrincipal,),
+        rootResource = getRootResource(config,
+            (
+                ("inbox", IMIPInvitationInboxResource, (mailer,), "basic"),
             )
         )
-        self.factory = HTTPFactory(server.Site(root))
+
+        self.factory = HTTPFactory(server.Site(rootResource))
         self.server = internet.TCPServer(settings['MailGatewayPort'],
             self.factory)
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/method/delete_common.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/method/delete_common.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/method/delete_common.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -13,8 +13,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ##
-from twistedcaldav.method.report_common import applyToAddressBookCollections
-from twistedcaldav.method.report_common import applyToCalendarCollections
 
 
 """
@@ -36,7 +34,7 @@
 from twistedcaldav.caldavxml import caldav_namespace, ScheduleTag
 from twistedcaldav.config import config
 from twistedcaldav.memcachelock import MemcacheLock, MemcacheLockTimeoutError
-from twistedcaldav.method.report_common import applyToCalendarCollections
+from twistedcaldav.method.report_common import applyToAddressBookCollections, applyToCalendarCollections
 from twistedcaldav.resource import isCalendarCollectionResource,\
     isPseudoCalendarCollectionResource, isAddressBookCollectionResource
 from twistedcaldav.scheduling.implicit import ImplicitScheduler
@@ -270,29 +268,7 @@
         response = errors.response()
 
         returnValue(response)
-        
-    @inlineCallbacks
-    def run(self):
 
-        if isCalendarCollectionResource(self.parent):
-            response = (yield self.deleteCalendarResource(self.resource, self.resource_uri, self.parent))
-            
-        elif isCalendarCollectionResource(self.resource):
-            response = (yield self.deleteCalendar(self.resource, self.resource_uri, self.parent))
-        elif isAddressBookCollectionResource(self.parent):
-            response = (yield self.deleteAddressBookResource(self.resource, self.resource_uri, self.parent))
-
-        elif isAddressBookCollectionResource(self.resource):
-            response = (yield self.deleteAddressBook(self.resource, self.resource_uri, self.parent))
-
-        elif self.resource.isCollection():
-            response = (yield self.deleteCollection())
-
-        else:
-            response = (yield self.deleteResource(self.resource, self.resource_uri, self.parent))
-
-        returnValue(response)
-
     @inlineCallbacks
     def deleteAddressBookResource(self, delresource, deluri, parent):
         """
@@ -422,4 +398,25 @@
         response = errors.response()
 
         returnValue(response)
-        
+
+    @inlineCallbacks
+    def run(self):
+
+        if isCalendarCollectionResource(self.parent):
+            response = (yield self.deleteCalendarResource(self.resource, self.resource_uri, self.parent))
+            
+        elif isCalendarCollectionResource(self.resource):
+            response = (yield self.deleteCalendar(self.resource, self.resource_uri, self.parent))
+        elif isAddressBookCollectionResource(self.parent):
+            response = (yield self.deleteAddressBookResource(self.resource, self.resource_uri, self.parent))
+
+        elif isAddressBookCollectionResource(self.resource):
+            response = (yield self.deleteAddressBook(self.resource, self.resource_uri, self.parent))
+
+        elif self.resource.isCollection():
+            response = (yield self.deleteCollection())
+
+        else:
+            response = (yield self.deleteResource(self.resource, self.resource_uri, self.parent))
+
+        returnValue(response)

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/method/put_common.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/method/put_common.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -982,8 +982,13 @@
                         yield reservation.unreserve()
             
                     # Now forcibly delete the event
-                    deleter = DeleteResource(self.request, self.destination, self.destination_uri, self.destinationparent, "0", internal_request=True)
-                    yield deleter.run()
+                    if self.destination.exists():
+                        deleter = DeleteResource(self.request, self.destination, self.destination_uri, self.destinationparent, "0", internal_request=True)
+                        yield deleter.run()
+                    else:
+                        msg = "Attendee cannot create event for Organizer: %s" % (implicit_result,)
+                        log.err(msg)
+                        raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "attendee-allowed"), description=msg))
 
                     returnValue(StatusResponse(responsecode.OK, "Resource modified but immediately deleted by the server."))
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/notify.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/notify.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/notify.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -85,6 +85,30 @@
 ]
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+# FIXME:
+# Temporarily ignore digest auth as it's broken for local accounts
+
+NS_XMPP_SASL = 'urn:ietf:params:xml:ns:xmpp-sasl'
+
+from twisted.words.protocols.jabber import sasl
+def get_mechanisms(xs):
+    """
+    Parse the SASL feature to extract the available mechanism names.
+    """
+    mechanisms = []
+    for element in xs.features[(NS_XMPP_SASL, 'mechanisms')].elements():
+        if element.name == 'mechanism':
+            mechanism = str(element)
+            if mechanism != "DIGEST-MD5":
+                mechanisms.append(str(element))
+
+    return mechanisms
+
+sasl.get_mechanisms = get_mechanisms
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Classes used within calendarserver itself
 #
 
@@ -1366,4 +1390,3 @@
 
     def stopService(self):
         self.client.stopService()
-

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/resource.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/resource.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -999,16 +999,17 @@
                 returnValue(customxml.CalendarProxyWriteFor(
                     *[davxml.HRef(principal.principalURL()) for principal in results]
                 ))
+
+            elif name == "auto-schedule":
+                autoSchedule = self.getAutoSchedule()
+                returnValue(customxml.AutoSchedule("true" if autoSchedule else "false"))
+
         elif config.EnableCardDAV and namespace == carddav_namespace:
             if name == "addressbook-home-set":
                 returnValue(carddavxml.AddressBookHomeSet(
                     *[davxml.HRef(url) for url in self.addressBookHomeURLs()]
                  ))
 
-            elif name == "auto-schedule":
-                autoSchedule = self.getAutoSchedule()
-                returnValue(customxml.AutoSchedule("true" if autoSchedule else "false"))
-
         result = (yield super(CalendarPrincipalResource, self).readProperty(property, request))
         returnValue(result)
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/scheduling/implicit.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/scheduling/implicit.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -826,11 +826,12 @@
                 # We will allow the attendee to do anything in this case, but we will mark the organizer
                 # with an schedule-status error
                 log.debug("Attendee '%s' is allowed to update UID: '%s' with invalid organizer '%s'" % (self.attendee, self.uid, self.organizer))
-                self.calendar.setParameterToValueForPropertyWithValue(
-                    "SCHEDULE-STATUS",
-                    iTIPRequestStatus.NO_USER_SUPPORT_CODE,
-                    "ORGANIZER",
-                    self.organizer)
+                if doScheduling:
+                    self.calendar.setParameterToValueForPropertyWithValue(
+                        "SCHEDULE-STATUS",
+                        iTIPRequestStatus.NO_USER_SUPPORT_CODE,
+                        "ORGANIZER",
+                        self.organizer)
                 returnValue(None)
 
             else:

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/scheduling/ischeduleservers.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/scheduling/ischeduleservers.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/scheduling/ischeduleservers.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -18,7 +18,7 @@
 
 from twext.log import Logger
 
-from twistedcaldav.config import config
+from twistedcaldav.config import config, fullServerPath
 from twistedcaldav.scheduling.delivery import DeliveryService
 
 import xml.dom.minidom
@@ -46,7 +46,12 @@
 
     def _loadConfig(self):
         if IScheduleServers._servers is None:
-            IScheduleServers._xmlFile = FilePath(config.Scheduling[DeliveryService.serviceType_ischedule]["Servers"])
+            IScheduleServers._xmlFile = FilePath(
+                fullServerPath(
+                    config.ConfigRoot,
+                    config.Scheduling[DeliveryService.serviceType_ischedule]["Servers"]
+                )
+            )
         IScheduleServers._xmlFile.restat()
         fileInfo = (IScheduleServers._xmlFile.getmtime(), IScheduleServers._xmlFile.getsize())
         if fileInfo != IScheduleServers._fileInfo:

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/stdconfig.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/stdconfig.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -27,7 +27,7 @@
 from twext.log import clearLogLevels, setLogLevelForNamespace
 
 from twistedcaldav.config import ConfigProvider, ConfigurationError
-from twistedcaldav.config import config, _mergeData
+from twistedcaldav.config import config, _mergeData, fullServerPath
 from twistedcaldav.partitions import partitions
 from twistedcaldav.util import getPasswordFromKeychain
 from twistedcaldav.util import KeychainAccessError, KeychainPasswordNotFound
@@ -35,10 +35,11 @@
 log = Logger()
 
 DEFAULT_CONFIG_FILE = "/etc/caldavd/caldavd.plist"
+DEFAULT_CARDDAV_CONFIG_FILE = "/etc/carddavd/carddavd.plist"
 
 DEFAULT_SERVICE_PARAMS = {
     "twistedcaldav.directory.xmlfile.XMLDirectoryService": {
-        "xmlFile": "/etc/caldavd/accounts.xml",
+        "xmlFile": "accounts.xml",
         "cacheTimeout": 30,
         "recordTypes": ("users", "groups"),
     },
@@ -51,19 +52,18 @@
 
 DEFAULT_RESOURCE_PARAMS = {
     "twistedcaldav.directory.xmlfile.XMLDirectoryService": {
-        "xmlFile": "/etc/caldavd/resources.xml",
+        "xmlFile": "resources.xml",
         "cacheTimeout": 30,
-        "realmName": "/Search",
         "recordTypes" : ("locations", "resources"),
     },
 }
 
 DEFAULT_AUGMENT_PARAMS = {
     "twistedcaldav.directory.augment.AugmentXMLDB": {
-        "xmlFiles": ["/etc/caldavd/augments.xml",],
+        "xmlFiles": ["augments.xml",],
     },
     "twistedcaldav.directory.augment.AugmentSqliteDB": {
-        "dbpath": "/etc/caldavd/augments.sqlite",
+        "dbpath": "augments.sqlite",
     },
     "twistedcaldav.directory.augment.AugmentPostgreSQLDB": {
         "host":     "localhost",
@@ -75,7 +75,7 @@
 
 DEFAULT_PROXYDB_PARAMS = {
     "twistedcaldav.directory.calendaruserproxy.ProxySqliteDB": {
-        "dbpath": "/etc/caldavd/proxies.sqlite",
+        "dbpath": "proxies.sqlite",
     },
     "twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB": {
         "host":     "localhost",
@@ -164,8 +164,12 @@
     #
     # Data store
     #
-    "DataRoot"                : "/Library/CalendarServer/Data",
-    "DocumentRoot"            : "/Library/CalendarServer/Documents",
+    "ServerRoot"              : "/Library/CalendarServer",
+    "DataRoot"                : "Data",
+    "DocumentRoot"            : "Documents",
+    "ConfigRoot"              : "/etc/caldavd",
+    "LogRoot"                 : "/var/log/caldavd",
+    "RunRoot"                 : "/var/run",
     "UserQuota"               : 104857600, # User quota (in bytes)
     "MaximumAttachmentSize"   :   1048576, # Attachment size limit (in bytes)
     "MaxAttendeesPerInstance" :       100, # Maximum number of unique attendees
@@ -192,7 +196,7 @@
     #    and resources.
     #
     "ResourceService": {
-        "Enabled" : False,
+        "Enabled" : True,
         "type": "twistedcaldav.directory.xmlfile.XMLDirectoryService",
         "params": DEFAULT_RESOURCE_PARAMS["twistedcaldav.directory.xmlfile.XMLDirectoryService"],
     },
@@ -221,7 +225,7 @@
     #
     "AdminPrincipals": [],                       # Principals with "DAV:all" access (relative URLs)
     "ReadPrincipals": [],                        # Principals with "DAV:read" access (relative URLs)
-    "SudoersFile": "/etc/caldavd/sudoers.plist", # Principals that can pose as other principals
+    "SudoersFile": "sudoers.plist",              # Principals that can pose as other principals
     "EnableProxyPrincipals": True,               # Create "proxy access" principals
 
     #
@@ -263,10 +267,9 @@
     #
     # Logging
     #
-    "AccessLogFile"  : "/var/log/caldavd/access.log",  # Apache-style access log
-    "ErrorLogFile"   : "/var/log/caldavd/error.log",   # Server activity log
-    "ServerStatsFile": "/var/run/caldavd/stats.plist",
-    "PIDFile"        : "/var/run/caldavd.pid",
+    "AccessLogFile"  : "access.log",  # Apache-style access log
+    "ErrorLogFile"   : "error.log",   # Server activity log
+    "PIDFile"        : "caldavd.pid",
     "RotateAccessLog"   : False,
     "EnableExtendedAccessLog": True,
     "DefaultLogLevel"   : "",
@@ -277,9 +280,9 @@
         "iTIP": False,
     },
     "AccountingPrincipals": [],
-    "AccountingLogRoot"   : "/var/log/caldavd/accounting",
+    "AccountingLogRoot"   : "accounting",
 
-    "GlobalStatsSocket"           : "/var/run/caldavd-stats.sock", 
+    "GlobalStatsSocket"           : "caldavd-stats.sock", 
     "GlobalStatsLoggingPeriod"    : 60, 
     "GlobalStatsLoggingFrequency" : 12, 
 
@@ -351,7 +354,7 @@
         "iSchedule": {
             "Enabled"          : False, # iSchedule protocol
             "AddressPatterns"  : [],    # Reg-ex patterns to match iSchedule-able calendar user addresses
-            "Servers"          : "/etc/caldavd/servertoserver.xml",    # iSchedule server configurations
+            "Servers"          : "servertoserver.xml",    # iSchedule server configurations
         },
 
         "iMIP": {
@@ -437,7 +440,7 @@
     "Partitioning" : {
         "Enabled":             False,   # Partitioning enabled or not
         "ServerPartitionID":   "",      # Unique ID for this server's partition instance.
-        "PartitionConfigFile": "/etc/caldavd/partitions.plist", # File path for partition information
+        "PartitionConfigFile": "partitions.plist", # File path for partition information
         "MaxClients":          5,       # Pool size for connections to each partition
     },
 
@@ -486,7 +489,7 @@
 
     # A unix socket used for communication between the child and master
     # processes. If blank, then an AF_INET socket is used instead.
-    "ControlSocket": "/var/run/caldavd.sock",
+    "ControlSocket": "caldavd.sock",
 
 
     # Support for Content-Encoding compression options as specified in
@@ -563,13 +566,15 @@
                 
         # Now check for Includes and parse and add each of those
         if "Includes" in configDict:
+            configRoot = os.path.join(configDict.ServerRoot, configDict.ConfigRoot)
             for include in configDict.Includes:
                 
-                additionalDict = self._parseConfigFromFile(include)
+                additionalDict = self._parseConfigFromFile(fullServerPath(configRoot, include))
                 if additionalDict:
                     log.info("Adding configuration from file: '%s'" % (include,))
                     configDict.update(additionalDict)
 
+        _updateDataStore(configDict)
         return configDict
 
     def _parseConfigFromFile(self, filename):
@@ -585,6 +590,36 @@
         
         return configDict
 
+def _updateDataStore(configDict):
+    
+    # Base paths
+    if hasattr(configDict, "ServerRoot"):
+        configDict.DataRoot = fullServerPath(configDict.ServerRoot, configDict.DataRoot)
+        configDict.DocumentRoot = fullServerPath(configDict.ServerRoot, configDict.DocumentRoot)
+        configDict.ConfigRoot = fullServerPath(configDict.ServerRoot, configDict.ConfigRoot)
+        configDict.LogRoot = fullServerPath(configDict.ServerRoot, configDict.LogRoot)
+        configDict.RunRoot = fullServerPath(configDict.ServerRoot, configDict.RunRoot)
+
+    # Config paths
+    if hasattr(configDict, "SudoersFile"):
+        configDict.SudoersFile = fullServerPath(configDict.ConfigRoot, configDict.SudoersFile)
+
+    # Log paths
+    if hasattr(configDict, "AccessLogFile"):
+        configDict.AccessLogFile = fullServerPath(configDict.LogRoot, configDict.AccessLogFile)
+    if hasattr(configDict, "ErrorLogFile"):
+        configDict.ErrorLogFile = fullServerPath(configDict.LogRoot, configDict.ErrorLogFile)
+    if hasattr(configDict, "AccountingLogRoot"):
+        configDict.AccountingLogRoot = fullServerPath(configDict.LogRoot, configDict.AccountingLogRoot)
+
+    # Run paths
+    if hasattr(configDict, "PIDFile"):
+        configDict.PIDFile = fullServerPath(configDict.RunRoot, configDict.PIDFile)
+    if hasattr(configDict, "GlobalStatsSocket"):
+        configDict.GlobalStatsSocket = fullServerPath(configDict.RunRoot, configDict.GlobalStatsSocket)
+    if hasattr(configDict, "ControlSocket"):
+        configDict.ControlSocket = fullServerPath(configDict.RunRoot, configDict.ControlSocket)
+
 def _updateHostName(configDict):
     if not configDict.ServerHostName:
         from socket import getfqdn
@@ -871,7 +906,7 @@
     if configDict.Partitioning.Enabled:
         partitions.setSelfPartition(configDict.Partitioning.ServerPartitionID)
         partitions.setMaxClients(configDict.Partitioning.MaxClients)
-        partitions.readConfig(configDict.Partitioning.PartitionConfigFile)
+        partitions.readConfig(fullServerPath(configDict.ConfigRoot, configDict.Partitioning.PartitionConfigFile))
         partitions.installReverseProxies()
     else:
         partitions.clear()

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_config.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_config.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_config.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -134,25 +134,25 @@
 
     def testDirectoryService_noChange(self):
         self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
-        self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+        self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
 
         config.update({"DirectoryService": {}})
 
         self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
-        self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+        self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
 
     def testDirectoryService_sameType(self):
         self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
-        self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+        self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
 
         config.update({"DirectoryService": {"type": "twistedcaldav.directory.xmlfile.XMLDirectoryService"}})
 
         self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
-        self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+        self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
 
     def testDirectoryService_newType(self):
         self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
-        self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+        self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
 
         config.update({"DirectoryService": {"type": "twistedcaldav.directory.appleopendirectory.OpenDirectoryService"}})
 
@@ -162,7 +162,7 @@
 
     def testDirectoryService_newParam(self):
         self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
-        self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+        self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
 
         config.update({"DirectoryService": {"type": "twistedcaldav.directory.appleopendirectory.OpenDirectoryService"}})
 
@@ -171,7 +171,7 @@
 
     def testDirectoryService_unknownType(self):
         self.assertEquals(config.DirectoryService.type, "twistedcaldav.directory.xmlfile.XMLDirectoryService")
-        self.assertEquals(config.DirectoryService.params.xmlFile, "/etc/caldavd/accounts.xml")
+        self.assertEquals(config.DirectoryService.params.xmlFile, "accounts.xml")
 
         config.update({"DirectoryService": {"type": "twistedcaldav.test.test_config.SuperDuperAwesomeService"}})
 

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_stdconfig.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_stdconfig.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_stdconfig.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -71,10 +71,18 @@
         plist1 = """
 <plist version="1.0">
   <dict>
+    <key>ServerRoot</key>
+    <string>/root</string>
     <key>DocumentRoot</key>
     <string>defaultdoc</string>
     <key>DataRoot</key>
     <string>defaultdata</string>
+    <key>ConfigRoot</key>
+    <string>defaultconfig</string>
+    <key>LogRoot</key>
+    <string>defaultlog</string>
+    <key>RunRoot</key>
+    <string>defaultrun</string>
     <key>Includes</key>
     <array>
         <string>%s</string>
@@ -99,10 +107,14 @@
         tempfile1.setContent(plist1 % (tempfile2.path,))
 
         cfg = Config(PListConfigProvider({
+            "ServerRoot": "",
             "DocumentRoot": "",
             "DataRoot": "",
+            "ConfigRoot": "",
+            "LogRoot": "",
+            "RunRoot": "",
             "Includes": [],
         }))
         cfg.load(tempfile1.path)
-        self.assertEquals(cfg.DocumentRoot, "defaultdoc")
-        self.assertEquals(cfg.DataRoot, "overridedata")
+        self.assertEquals(cfg.DocumentRoot, "/root/defaultdoc")
+        self.assertEquals(cfg.DataRoot, "/root/overridedata")

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_upgrade.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_upgrade.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -19,11 +19,13 @@
 
 from twistedcaldav.config import config
 # from twistedcaldav.directory.calendaruserproxy import CalendarUserProxyDatabase
+#from twistedcaldav.directory.calendaruserproxy import CalendarUserProxyDatabase
+CalendarUserProxyDatabase = None
 from twistedcaldav.directory.xmlfile import XMLDirectoryService
 from twistedcaldav.directory.resourceinfo import ResourceInfoDatabase
 from twistedcaldav.mail import MailGatewayTokensDatabase
 from twistedcaldav.upgrade import UpgradeError, upgradeData, updateFreeBusySet
-from twistedcaldav.test.util import TestCase
+#from twistedcaldav.test.util import TestCase
 from calendarserver.tools.util import getDirectory
 
 import hashlib
@@ -34,7 +36,7 @@
 md5Attr = "WebDAV:{http:%2F%2Ftwistedmatrix.com%2Fxml_namespace%2Fdav%2F}getcontentmd5"
 
 
-class ProxyDBUpgradeTests(TestCase):
+class ProxyDBUpgradeTests(object): #(TestCase):
     todo = "upgrade.py needs to be fixed"
     
     def setUpXMLDirectory(self):

Copied: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_xmlutil.py (from rev 5146, CalendarServer/trunk/twistedcaldav/test/test_xmlutil.py)
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_xmlutil.py	                        (rev 0)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/test_xmlutil.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -0,0 +1,141 @@
+##
+# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+import twistedcaldav.test.util
+from cStringIO import StringIO
+from twistedcaldav.xmlutil import readXML, writeXML, addSubElement,\
+    changeSubElementText
+
+class XMLUtil(twistedcaldav.test.util.TestCase):
+    """
+    XML Util tests
+    """
+    
+    data1 = """<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE test SYSTEM "test.dtd">
+<test>
+  <help>me</help>
+  <nesting>
+    <nested/>
+  </nesting>
+</test>
+"""
+
+    data2 = """Not XML!"""
+
+    data3 = """<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE test SYSTEM "test.dtd">
+
+<test>
+  <help>me</help>
+  <nesting>
+    <nested />
+  </nesting>
+</test>
+"""
+
+    data4 = """<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE test SYSTEM "test.dtd">
+
+<test>
+  <help>me</help>
+  <nesting>
+    <nested />
+  </nesting>
+  <added>added text</added>
+</test>
+"""
+
+    data5 = """<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE test SYSTEM "test.dtd">
+
+<test>
+  <help>changed text</help>
+  <nesting>
+    <nested />
+  </nesting>
+</test>
+"""
+
+    data6 = """<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE test SYSTEM "test.dtd">
+
+<test>
+  <help>me</help>
+  <nesting>
+    <nested />
+  </nesting>
+  <new>new text</new>
+</test>
+"""
+
+    def _checkXML(self, node, data):
+        xmlfile = self.mktemp()
+        writeXML(xmlfile, node)
+        newdata = open(xmlfile).read()
+        self.assertEqual(newdata, data)
+        
+    def test_readXML_noverify(self):
+        
+        io = StringIO(XMLUtil.data1)
+        etree, root = readXML(io)
+        self.assertEqual(etree.getroot(), root)
+        self.assertEqual(root.tag, "test")
+
+    def test_readXML_verify_ok(self):
+        
+        io = StringIO(XMLUtil.data1)
+        etree, root = readXML(io, expectedRootTag="test")
+        self.assertEqual(etree.getroot(), root)
+        self.assertEqual(root.tag, "test")
+
+    def test_readXML_verify_bad(self):
+        
+        io = StringIO(XMLUtil.data1)
+        self.assertRaises(ValueError, readXML, io, "test1")
+
+    def test_readXML_data_bad(self):
+        
+        io = StringIO(XMLUtil.data2)
+        self.assertRaises(ValueError, readXML, io)
+
+    def test_writeXML(self):
+        
+        io = StringIO(XMLUtil.data1)
+        _ignore_etree, root = readXML(io)
+        self._checkXML(root, XMLUtil.data3)
+
+    def test_addElement(self):
+        
+        io = StringIO(XMLUtil.data1)
+        _ignore_etree, root = readXML(io)
+        addSubElement(root, "added", "added text")
+        self._checkXML(root, XMLUtil.data4)
+
+    def test_changeElement_existing(self):
+        
+        io = StringIO(XMLUtil.data1)
+        _ignore_etree, root = readXML(io)
+        changeSubElementText(root, "help", "changed text")
+        self._checkXML(root, XMLUtil.data5)
+
+    def test_changeElement_new(self):
+        
+        io = StringIO(XMLUtil.data1)
+        _ignore_etree, root = readXML(io)
+        changeSubElementText(root, "new", "new text")
+        self._checkXML(root, XMLUtil.data6)
+

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/util.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/util.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/test/util.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -22,9 +22,12 @@
 from twisted.python.failure import Failure
 from twisted.internet.defer import succeed, fail
 from twext.web2.http import HTTPError, StatusResponse
+from twisted.internet.error import ProcessDone
+from twisted.internet.protocol import ProcessProtocol
 
 from twistedcaldav import memcacher
 from twistedcaldav.config import config
+from twistedcaldav.stdconfig import _updateDataStore
 from twistedcaldav.static import CalDAVFile
 import memcacheclient
 
@@ -39,9 +42,20 @@
     def setUp(self):
         super(TestCase, self).setUp()
 
-        dataroot = self.mktemp()
-        os.mkdir(dataroot)
-        config.DataRoot = dataroot
+        config.reset()
+        serverroot = self.mktemp()
+        os.mkdir(serverroot)
+        config.ServerRoot = serverroot
+        config.ConfigRoot = "config"
+        _updateDataStore(config)
+        
+        if not os.path.exists(config.DataRoot):
+            os.makedirs(config.DataRoot)
+        if not os.path.exists(config.DocumentRoot):
+            os.makedirs(config.DocumentRoot)
+        if not os.path.exists(config.ConfigRoot):
+            os.makedirs(config.ConfigRoot)
+
         config.Memcached.Pools.Default.ClientEnabled = False
         config.Memcached.Pools.Default.ServerEnabled = False
         memcacheclient.ClientFactory.allowTestCache = True
@@ -260,3 +274,76 @@
         except:
             return succeed(False)
 
+
+
+
+
+class ErrorOutput(Exception):
+    """
+    The process produced some error output and exited with a non-zero exit
+    code.
+    """
+
+
+class CapturingProcessProtocol(ProcessProtocol):
+    """
+    A L{ProcessProtocol} that captures its output and error.
+
+    @ivar output: a C{list} of all C{str}s received to stderr.
+
+    @ivar error: a C{list} of all C{str}s received to stderr.
+    """
+
+    def __init__(self, deferred, inputData):
+        """
+        Initialize a L{CapturingProcessProtocol}.
+
+        @param deferred: the L{Deferred} to fire when the process is complete.
+
+        @param inputData: a C{str} to feed to the subprocess's stdin.
+        """
+        self.deferred = deferred
+        self.input = inputData
+        self.output = []
+        self.error = []
+
+
+    def connectionMade(self):
+        """
+        The process started; feed its input on stdin.
+        """
+        if self.input is not None:
+            self.transport.write(self.input)
+            self.transport.closeStdin()
+
+
+    def outReceived(self, data):
+        """
+        Some output was received on stdout.
+        """
+        self.output.append(data)
+
+
+    def errReceived(self, data):
+        """
+        Some output was received on stderr.
+        """
+        self.error.append(data)
+        # Attempt to exit promptly if a traceback is displayed, so we don't
+        # deal with timeouts.
+        lines = ''.join(self.error).split("\n")
+        if len(lines) > 1:
+            errorReportLine = lines[-2].split(": ", 1)
+            if len(errorReportLine) == 2 and ' ' not in errorReportLine[0] and '\t' not in errorReportLine[0]:
+                self.transport.signalProcess("TERM")
+
+
+    def processEnded(self, why):
+        """
+        The process is over, fire the Deferred with the output.
+        """
+        if why.check(ProcessDone) and not self.error:
+            self.deferred.callback(''.join(self.output))
+        else:
+            self.deferred.errback(ErrorOutput(''.join(self.error)))
+

Modified: CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/xmlutil.py
===================================================================
--- CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/xmlutil.py	2010-02-17 19:38:59 UTC (rev 5146)
+++ CalendarServer/branches/users/glyph/use-system-twisted/twistedcaldav/xmlutil.py	2010-02-17 20:55:11 UTC (rev 5147)
@@ -14,6 +14,8 @@
 # limitations under the License.
 ##
 
+from __future__ import with_statement
+
 from xml.etree.ElementTree import Element, ElementTree, SubElement, tostring
 from xml.parsers.expat import ExpatError
 
@@ -35,12 +37,12 @@
     try:
         etree = ElementTree(file=xmlfile)
     except ExpatError, e:
-        ValueError("Unable to parse file '%s' because: %s" % (xmlfile, e,))
+        raise ValueError("Unable to parse file '%s' because: %s" % (xmlfile, e,))
 
     if expectedRootTag:
         root = etree.getroot()
         if root.tag != expectedRootTag:
-            ValueError("Ignoring file '%s' because it is not a %s file" % (xmlfile, expectedRootTag,))
+            raise ValueError("Ignoring file '%s' because it is not a %s file" % (xmlfile, expectedRootTag,))
     
     return etree, etree.getroot()
 
@@ -95,5 +97,7 @@
 def changeSubElementText(parent, tag, text):
     
     child = parent.find(tag)
-    child.text = text
-
+    if child is not None:
+        child.text = text
+    else:
+        addSubElement(parent, tag, text)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100217/3d509e6a/attachment-0001.html>


More information about the calendarserver-changes mailing list