001/* 002 * (C) Copyright 2014-2015 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 * Antoine Taillefer <ataillefer@nuxeo.com> 016 */ 017package org.nuxeo.drive.operations; 018 019import java.io.IOException; 020 021import org.nuxeo.common.Environment; 022import org.nuxeo.drive.NuxeoDriveConstants; 023import org.nuxeo.ecm.automation.core.Constants; 024import org.nuxeo.ecm.automation.core.annotations.Operation; 025import org.nuxeo.ecm.automation.core.annotations.OperationMethod; 026import org.nuxeo.ecm.core.api.Blob; 027import org.nuxeo.runtime.api.Framework; 028 029/** 030 * Gets the information needed for the Nuxeo Drive client update: 031 * <ul> 032 * <li>Server version</li> 033 * <li>Nuxeo Drive update site URL</li> 034 * </ul> 035 * 036 * @author Antoine Taillefer 037 */ 038@Operation(id = NuxeoDriveGetClientUpdateInfo.ID, category = Constants.CAT_SERVICES, label = "Nuxeo Drive: Get client update information") 039public class NuxeoDriveGetClientUpdateInfo { 040 041 public static final String ID = "NuxeoDrive.GetClientUpdateInfo"; 042 043 @OperationMethod 044 public Blob run() throws IOException { 045 046 String serverVersion = Framework.getProperty(Environment.DISTRIBUTION_VERSION); 047 String updateSiteURL = Framework.getProperty(NuxeoDriveConstants.UPDATE_SITE_URL_PROP_KEY); 048 String betaUpdateSiteURL = Framework.getProperty(NuxeoDriveConstants.BETA_UPDATE_SITE_URL_PROP_KEY); 049 NuxeoDriveClientUpdateInfo info = new NuxeoDriveClientUpdateInfo(serverVersion, updateSiteURL, 050 betaUpdateSiteURL); 051 return NuxeoDriveOperationHelper.asJSONBlob(info); 052 } 053 054}