@@ -0,0 +1,3438 @@
+/*%0A*  Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.%0A*%0A*  WSO2 Inc. licenses this file to you under the Apache License,%0A*  Version 2.0 (the %22License%22); you may not use this file except%0A*  in compliance with the License.%0A*  You may obtain a copy of the License at%0A*%0A*    http://www.apache.org/licenses/LICENSE-2.0%0A*%0A* Unless required by applicable law or agreed to in writing,%0A* software distributed under the License is distributed on an%0A* %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A* KIND, either express or implied.  See the License for the%0A* specific language governing permissions and limitations%0A* under the License.%0A*/%0A%0Apackage org.wso2.developerstudio.eclipse.esb.project.servlets;%0A%0Aimport java.io.IOException;%0A%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport org.eclipse.core.runtime.IProgressMonitor;%0Aimport org.eclipse.core.runtime.IStatus;%0Aimport org.eclipse.core.runtime.Status;%0Aimport org.eclipse.core.runtime.jobs.Job;%0Aimport org.eclipse.swt.widgets.Display;%0Aimport org.wso2.developerstudio.eclipse.esb.project.connector.store.Connector;%0A%0Aimport com.google.gson.Gson;%0A%0A/**%0A * Servlet that handles connector downloads%0A */%0Apublic class ConnectorDownloadServlet extends HttpServlet %7B%0A    /**%0A     * Downloads the specified connector%0A     * %0A     * Response contains the container to be downloaded as %7B%22data%22:%7B%22id%22: %22xx%22, %22attributes%22: %5B%5D%7D%7D%0A     * %0A     */%0A    @Override%0A    protected void doPost(HttpServletRequest request, HttpServletResponse response)%0A            throws ServletException, IOException %7B%0A        final String function = request.getParameter(%22data%22);%0A        Connector connector = new Gson().fromJson(function, Connector.class);%0A%0A        response.setContentType(%22application/json%22);%0A        response.setStatus(HttpServletResponse.SC_OK);%0A        response.getWriter().println(%22%7B %5C%22status%5C%22: %5C%22ok%5C%22%7D%22);%0A        new Thread(new Runnable() %7B%0A            public void run() %7B%0A                Display.getDefault().asyncExec(new Runnable() %7B%0A                    public void run() %7B%0A                        ConnectorServletUtil connectorFunctionServletUtil = new ConnectorServletUtil();%0A                        Job downloadJob = new Job(%22Downloading Connectors%22) %7B%0A                            @Override%0A                            protected IStatus run(IProgressMonitor monitor) %7B%0A                                monitor.beginTask(%22Downloading connector%22, 100);%0A                                monitor.subTask(connector.getAttributes().getOverview_name() + %22 connector%22);%0A                                String downloadLink = connector.getAttributes().getOverview_downloadlink();%0A                                if (connectorFunctionServletUtil.downloadConnectorAndUpdateProjects(downloadLink)) %7B%0A                                    monitor.worked(100);%0A                                    monitor.done();%0A                                    return Status.OK_STATUS;%0A                                %7D%0A                                monitor.worked(100);%0A                                monitor.done();%0A                                return Status.CANCEL_STATUS;%0A                            %7D%0A                        %7D;%0A                        downloadJob.schedule();%0A                    %7D%0A                %7D);%0A            %7D%0A        %7D).start();%0A    %7D%0A%7D%0A

Add advanced options to connector retrieval