diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/googledocs/status.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/googledocs/status.get.desc.xml new file mode 100644 index 0000000000..816f862383 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/googledocs/status.get.desc.xml @@ -0,0 +1,10 @@ + + Get GoogleDocs Integration Status Information + + Get information about the GoogleDocs integration current status. + + /api/googledocs/status + argument + user + required + \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/googledocs/status.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/googledocs/status.get.json.ftl new file mode 100644 index 0000000000..d5debcdfd1 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/googledocs/status.get.json.ftl @@ -0,0 +1,6 @@ +{ + "data" : + { + "enabled" : ${enabled?string} + } +} \ No newline at end of file diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml index b3b32d62c2..d7bd9d91d1 100644 --- a/config/alfresco/web-scripts-application-context.xml +++ b/config/alfresco/web-scripts-application-context.xml @@ -1420,5 +1420,11 @@ parent="webscript"> + + + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/web/scripts/googledocs/Status.java b/source/java/org/alfresco/repo/web/scripts/googledocs/Status.java new file mode 100644 index 0000000000..04f1bd20af --- /dev/null +++ b/source/java/org/alfresco/repo/web/scripts/googledocs/Status.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.web.scripts.googledocs; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.repo.googledocs.GoogleDocsService; +import org.alfresco.repo.management.subsystems.ApplicationContextFactory; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Google Doc service status web script implementation + */ +public class Status extends DeclarativeWebScript implements ApplicationContextAware +{ + private ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException + { + this.applicationContext = applicationContext; + } + + @Override + protected Map executeImpl(WebScriptRequest req, org.springframework.extensions.webscripts.Status status, Cache cache) + { + ApplicationContextFactory subsystem = (ApplicationContextFactory)applicationContext.getBean("googledocs"); + ConfigurableApplicationContext childContext = (ConfigurableApplicationContext)subsystem.getApplicationContext(); + GoogleDocsService googleDocsService = (GoogleDocsService)childContext.getBean("googleDocsService"); + + Map model = new HashMap(1); + model.put("enabled", googleDocsService.isEnabled()); + return model; + } +}