Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2015-03-19 21:38:52 +0000
committerAngel Avila2015-03-19 21:38:52 +0000
commitaf904583bdf309a0fe3dd27c77fb342b84e9f691 (patch)
tree83ca00f5ef7a6cea2141bae0049c755ad87ff113 /plugins/org.eclipse.osee.framework.manager.servlet
parent8d4e299834c364c4e74614a70cfae3720b176959 (diff)
downloadorg.eclipse.osee-af904583bdf309a0fe3dd27c77fb342b84e9f691.tar.gz
org.eclipse.osee-af904583bdf309a0fe3dd27c77fb342b84e9f691.tar.xz
org.eclipse.osee-af904583bdf309a0fe3dd27c77fb342b84e9f691.zip
feature[ats_ATS146077]: Remove OseeModel Servlet
Change-Id: I909cf9831f98baf9ec7c0e794e909caddedbc953 Signed-off-by: Angel Avila <angel.avila2@boeing.com>
Diffstat (limited to 'plugins/org.eclipse.osee.framework.manager.servlet')
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java147
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java3
2 files changed, 0 insertions, 150 deletions
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java
deleted file mode 100644
index 380b0e592ec..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.manager.servlet;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
-import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
-import org.eclipse.osee.framework.core.server.ISessionManager;
-import org.eclipse.osee.framework.core.server.SecureOseeHttpServlet;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.resource.management.IResource;
-import org.eclipse.osee.logger.Log;
-import org.eclipse.osee.orcs.OrcsApi;
-import org.eclipse.osee.orcs.OrcsTypes;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeModelServlet extends SecureOseeHttpServlet {
-
- private static final long serialVersionUID = -2639113870500561780L;
-
- private final OrcsApi orcsApi;
- private final IDataTranslationService dataTransalatorService;
-
- public OseeModelServlet(Log logger, ISessionManager sessionManager, IDataTranslationService dataTransalatorService, OrcsApi orcsApi) {
- super(logger, sessionManager);
- this.dataTransalatorService = dataTransalatorService;
- this.orcsApi = orcsApi;
- }
-
- private OrcsTypes getOrcsTypes() {
- return orcsApi.getOrcsTypes(null);
- }
-
- @Override
- protected void checkAccessControl(HttpServletRequest request) throws OseeCoreException {
- if (!request.getMethod().equalsIgnoreCase("GET")) {
- super.checkAccessControl(request);
- }
- }
-
- private void handleError(HttpServletResponse resp, String request, Throwable th) throws IOException {
- getLogger().error(th, "Osee Cache request error: [%s]", request);
- resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- resp.setContentType("text/plain");
- resp.getWriter().write(Lib.exceptionToString(th));
- resp.getWriter().flush();
- resp.getWriter().close();
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- try {
- getOrcsTypes().writeTypes(output).call();
- resp.setStatus(HttpServletResponse.SC_ACCEPTED);
- resp.setContentType("text/plain");
- resp.setCharacterEncoding("UTF-8");
-
- Lib.inputStreamToOutputStream(new ByteArrayInputStream(output.toByteArray()), resp.getOutputStream());
- } catch (Exception ex) {
- handleError(resp, req.getQueryString(), ex);
- }
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- try {
- final OseeImportModelRequest modelRequest =
- dataTransalatorService.convert(req.getInputStream(), CoreTranslatorId.OSEE_IMPORT_MODEL_REQUEST);
-
- IResource resource = new IResource() {
-
- @Override
- public InputStream getContent() throws OseeCoreException {
- InputStream inputStream = null;
- try {
- inputStream = new ByteArrayInputStream(modelRequest.getModel().getBytes("UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return inputStream;
- }
-
- @Override
- public URI getLocation() {
- try {
- String modelName = modelRequest.getModelName();
- if (!modelName.endsWith(".osee")) {
- modelName += ".osee";
- }
- return new URI("osee:/" + modelName);
- } catch (URISyntaxException ex) {
- getLogger().error(ex, "Error creating location URI for model import");
- }
- return null;
- }
-
- @Override
- public String getName() {
- return modelRequest.getModelName();
- }
-
- @Override
- public boolean isCompressed() {
- return false;
- }
-
- };
-
- OseeImportModelResponse modelResponse = new OseeImportModelResponse();
-
- getOrcsTypes().loadTypes(resource).call();
-
- resp.setStatus(HttpServletResponse.SC_ACCEPTED);
- resp.setContentType("text/xml");
- resp.setCharacterEncoding("UTF-8");
-
- InputStream inputStream =
- dataTransalatorService.convertToStream(modelResponse, CoreTranslatorId.OSEE_IMPORT_MODEL_RESPONSE);
- Lib.inputStreamToOutputStream(inputStream, resp.getOutputStream());
- } catch (Exception ex) {
- handleError(resp, req.toString(), ex);
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
index 695f4378e44..b7c04529824 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java
@@ -25,7 +25,6 @@ import org.eclipse.osee.framework.manager.servlet.AtsServlet;
import org.eclipse.osee.framework.manager.servlet.BranchExchangeServlet;
import org.eclipse.osee.framework.manager.servlet.ConfigurationServlet;
import org.eclipse.osee.framework.manager.servlet.DataServlet;
-import org.eclipse.osee.framework.manager.servlet.OseeModelServlet;
import org.eclipse.osee.framework.manager.servlet.ResourceManagerServlet;
import org.eclipse.osee.framework.manager.servlet.SearchEngineTaggerServlet;
import org.eclipse.osee.framework.manager.servlet.SessionClientLoopbackServlet;
@@ -122,8 +121,6 @@ public class ServletRegistrationHandler {
register(new SessionManagementServlet(logger, sessionManager, authenticationManager, activityLog),
OseeServerContext.SESSION_CONTEXT);
register(new SessionClientLoopbackServlet(logger, sessionManager), OseeServerContext.CLIENT_LOOPBACK_CONTEXT);
- register(new OseeModelServlet(logger, sessionManager, translationService, orcsApi),
- OseeServerContext.OSEE_MODEL_CONTEXT);
register(new AtsServlet(logger, resourceManager, orcsApi, jdbcClient), "osee/ats");
register(new ConfigurationServlet(logger, translationService, orcsApi), OseeServerContext.OSEE_CONFIGURE_CONTEXT);

Back to the top