001/*
002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Antoine Taillefer <ataillefer@nuxeo.com>
016 */
017package org.nuxeo.drive.service.impl;
018
019import java.security.Principal;
020
021import org.nuxeo.drive.adapter.FolderItem;
022import org.nuxeo.drive.adapter.impl.DefaultTopLevelFolderItem;
023import org.nuxeo.drive.service.TopLevelFolderItemFactory;
024
025/**
026 * Default implementation of a {@link TopLevelFolderItemFactory}.
027 *
028 * @author Antoine Taillefer
029 */
030public class DefaultTopLevelFolderItemFactory extends AbstractVirtualFolderItemFactory implements
031        TopLevelFolderItemFactory {
032
033    /*---------------------- VirtualFolderItemFactory ---------------*/
034    @Override
035    public FolderItem getVirtualFolderItem(Principal principal) {
036        return getTopLevelFolderItem(principal);
037    }
038
039    /*----------------------- TopLevelFolderItemFactory ---------------------*/
040    @Override
041    public FolderItem getTopLevelFolderItem(Principal principal) {
042        return new DefaultTopLevelFolderItem(getName(), principal, getFolderName());
043    }
044
045}