AdobeSignConfigurationServlet.java 3.88 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.aemds.guide.utils.GuidePropertyProviderUtils
 *  javax.jcr.RepositoryException
 *  javax.servlet.Servlet
 *  javax.servlet.ServletException
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Properties
 *  org.apache.felix.scr.annotations.Property
 *  org.apache.felix.scr.annotations.Reference
 *  org.apache.felix.scr.annotations.Service
 *  org.apache.sling.api.SlingHttpServletRequest
 *  org.apache.sling.api.SlingHttpServletResponse
 *  org.apache.sling.api.servlets.SlingAllMethodsServlet
 *  org.apache.sling.commons.json.JSONArray
 *  org.apache.sling.commons.json.JSONException
 *  org.osgi.service.component.ComponentContext
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.adobe.fd.workflow.adobesign.impl;

import com.adobe.aemds.guide.utils.GuidePropertyProviderUtils;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import javax.jcr.RepositoryException;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.apache.sling.commons.json.JSONArray;
import org.apache.sling.commons.json.JSONException;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component(metatype=0)
@Service(value={Servlet.class})
@Properties(value={@Property(name="sling.servlet.resourceTypes", value={"fd/workflow/components/esign_cloudservice_configurations"}), @Property(name="sling.servlet.extensions", value={"json"}), @Property(name="sling.servlet.selector", value={"list"}), @Property(name="sling.servlet.methods", value={"GET"}), @Property(name="service.description", value={"Adobe Sign Cloud Service Configurations List"})})
public class AdobeSignConfigurationServlet
extends SlingAllMethodsServlet {
    private static final long serialVersionUID = -780464494271946961L;
    private final Logger log = LoggerFactory.getLogger(AdobeSignConfigurationServlet.class);
    private ComponentContext context;
    private static final String ROOT_PATH = "/etc/cloudservices/echosign";
    @Reference
    private GuidePropertyProviderUtils guidePropertyProviderUtils;

    protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
        response.setContentType("application/json");
        response.setCharacterEncoding("utf-8");
        PrintWriter writer = response.getWriter();
        try {
            JSONArray esignCloudConfigurationArray = this.guidePropertyProviderUtils.fetchEsignCloudServiceConfiguration("/etc/cloudservices/echosign");
            if (esignCloudConfigurationArray == null) {
                esignCloudConfigurationArray = new JSONArray();
            }
            esignCloudConfigurationArray.write((Writer)writer);
        }
        catch (JSONException e) {
            throw new ServletException("Error", (Throwable)e);
        }
    }

    protected void activate(ComponentContext context) throws RepositoryException {
        this.context = context;
    }

    protected void bindGuidePropertyProviderUtils(GuidePropertyProviderUtils guidePropertyProviderUtils) {
        this.guidePropertyProviderUtils = guidePropertyProviderUtils;
    }

    protected void unbindGuidePropertyProviderUtils(GuidePropertyProviderUtils guidePropertyProviderUtils) {
        if (this.guidePropertyProviderUtils == guidePropertyProviderUtils) {
            this.guidePropertyProviderUtils = null;
        }
    }
}