public function get_typename() {
        if (empty($this->typename)) {
            $matches = array();
            if (!preg_match("/^repository_(.*)$/", get_class($this), $matches)) {
                throw new coding_exception('The class name of a repository should be repository_<typeofrepository>, '.
                        'e.g. repository_dropbox');
            }
            $this->typename = $matches[1];
        }
        return $this->typename;
    }