001/*
002 * (C) Copyright 2006-2013 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-2.1.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 *     Nuxeo - initial API and implementation
016 *
017 */
018
019package org.nuxeo.connect.client;
020
021import org.nuxeo.connect.CallbackHolder;
022import org.nuxeo.connect.update.PackageUpdateService;
023import org.nuxeo.runtime.api.Framework;
024
025/**
026 * Provide access to Nuxeo Framework from Nuxeo Connect Client
027 *
028 * @author tiry
029 */
030public class NuxeoCallbackHolder implements CallbackHolder {
031
032    @Override
033    public String getHomePath() {
034        return Framework.getRuntime().getHome().getAbsolutePath();
035    }
036
037    @Override
038    public String getProperty(String key, String defaultValue) {
039        return Framework.getProperty(key, defaultValue);
040    }
041
042    @Override
043    public boolean isTestModeSet() {
044        return Framework.isTestModeSet();
045    }
046
047    @Override
048    public PackageUpdateService getUpdateService() {
049        return Framework.getLocalService(PackageUpdateService.class);
050    }
051
052}