Add a sub-service object.

        :param obj: stackinabox.services.StackInABoxService instance
        :raises: RouteAlreadyRegisteredError if the route is already registered
        :returns: n/a

def set_subservice(self, obj):
        """Add a sub-service object.

        :param obj: stackinabox.services.StackInABoxService instance
        :raises: RouteAlreadyRegisteredError if the route is already registered
        :returns: n/a
        """
        # ensure there is not already a sub-service
        if self.obj is not None:
            raise RouteAlreadyRegisteredError(
                'Service Router ({0} - {1}): Route {2} already has a '
                'sub-service handler'
                .format(id(self), self.service_name, self.uri))

        # warn if any methods are already registered
        if len(self.methods):
            logger.debug(
                'WARNING: Service Router ({0} - {1}): Methods detected '
                'on Route {2}. Sub-Service {3} may be hidden.'
                .format(id(self), self.service_name, self.uri, obj.name))

        # Ensure we do not have any circular references
        assert(obj != self.parent_obj)

        # if no errors, save the object and update the URI
        self.obj = obj
        self.obj.base_url = '{0}/{1}'.format(self.uri, self.service_name)