Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-12-09 18:47:27 +0000
committerAngel Avila2014-12-09 18:47:27 +0000
commitc70a4475ee01da357750842ca7fa52728cce64cb (patch)
tree434c3ae26648f2bd3e8eff2d8ddfb1610a537a4c /plugins/org.eclipse.osee.framework.manager.servlet
parent0454cc9720e42045e43a7a1e1f3b869f16f69f41 (diff)
downloadorg.eclipse.osee-c70a4475ee01da357750842ca7fa52728cce64cb.tar.gz
org.eclipse.osee-c70a4475ee01da357750842ca7fa52728cce64cb.tar.xz
org.eclipse.osee-c70a4475ee01da357750842ca7fa52728cce64cb.zip
feature: Remove legacy servlet ClientResource
Diffstat (limited to 'plugins/org.eclipse.osee.framework.manager.servlet')
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/server.application.xml9
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientInfo.java50
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientResource.java158
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientStatus.java62
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ReleaseStatus.java41
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ReleaseTypeStatus.java44
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerApplication.java52
8 files changed, 1 insertions, 427 deletions
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
index b60a80ed2ab..4b6a479591b 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/META-INF/MANIFEST.MF
@@ -4,33 +4,25 @@ Bundle-Name: Servlet Plug-in
Bundle-SymbolicName: org.eclipse.osee.framework.manager.servlet
Bundle-Version: 0.20.0.qualifier
Bundle-ActivationPolicy: lazy
-Import-Package: com.google.common.base;version="[11.0.0,15.0.0)",
- com.google.common.collect;version="[11.0.0,15.0.0)",
+Import-Package: com.google.common.collect;version="[11.0.0,15.0.0)",
javax.servlet,
javax.servlet.http,
- javax.ws.rs,
- javax.ws.rs.core,
org.eclipse.core.runtime,
org.eclipse.core.runtime.jobs,
org.eclipse.osee.activity.api,
- org.eclipse.osee.event,
org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.message,
org.eclipse.osee.framework.core.model,
- org.eclipse.osee.framework.core.model.cache,
org.eclipse.osee.framework.core.model.change,
org.eclipse.osee.framework.core.model.type,
- org.eclipse.osee.framework.core.operation,
org.eclipse.osee.framework.core.server,
- org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.core.translation,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
- org.eclipse.osee.framework.jdk.core.util.io.xml,
org.eclipse.osee.framework.jdk.core.util.xml,
org.eclipse.osee.framework.resource.management,
org.eclipse.osee.framework.resource.management.exception,
@@ -39,9 +31,7 @@ Import-Package: com.google.common.base;version="[11.0.0,15.0.0)",
org.eclipse.osee.logger,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
- org.eclipse.osee.orcs.rest.model,
org.eclipse.osee.orcs.search,
- org.eclipse.osee.orcs.transaction,
org.eclipse.osgi.framework.console,
org.osgi.framework,
org.osgi.service.http,
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/server.application.xml b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/server.application.xml
deleted file mode 100644
index a3e8efc3a23..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/server.application.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop">
- <implementation class="org.eclipse.osee.framework.manager.servlet.internal.ServerApplication"/>
- <service>
- <provide interface="javax.ws.rs.core.Application"/>
- </service>
- <reference bind="setServerManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerManager" name="IApplicationServerManager" policy="static"/>
- <reference bind="setSessionManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.ISessionManager" name="ISessionManager" policy="static"/>
-</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientInfo.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientInfo.java
deleted file mode 100644
index 272303a27d9..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.internal;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @author Donald G. Dunne
- */
-public class ClientInfo {
-
- private static Pattern namePattern = Pattern.compile("Name: \\[(.*)\\]");
- private static Pattern versionPattern = Pattern.compile("Version:\\[(.*)\\]");
- private static Pattern userIdPattern = Pattern.compile("User Id:\\[(.*)\\]");
- private final String info;
-
- public ClientInfo(String info) {
- this.info = info;
- }
-
- public String getName() {
- return getValue(namePattern);
- }
-
- public String getVersion() {
- return getValue(versionPattern);
- }
-
- public String getUserId() {
- return getValue(userIdPattern);
- }
-
- public String getValue(Pattern pattern) {
- String name = "unknown";
- Matcher m = pattern.matcher(info);
- if (m.find()) {
- name = m.group(1);
- }
- return name;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientResource.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientResource.java
deleted file mode 100644
index 15f1b6a33bc..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientResource.java
+++ /dev/null
@@ -1,158 +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.internal;
-
-import java.io.ByteArrayOutputStream;
-import java.net.URL;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.UriInfo;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.server.ISession;
-import org.eclipse.osee.framework.core.server.ISessionManager;
-import org.eclipse.osee.framework.core.util.HttpProcessor;
-import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.DateUtil;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.orcs.rest.model.IdeVersion;
-
-/**
- * @author Donald G. Dunne
- */
-@Path("client")
-public class ClientResource {
-
- // Allows to insert contextual objects into the class,
- // e.g. ServletContext, Request, Response, UriInfo
- @Context
- UriInfo uriInfo;
- @Context
- Request request;
- private final IApplicationServerManager serverManager;
- private final ISessionManager sessionManager;
-
- public ClientResource(IApplicationServerManager serverManager, ISessionManager sessionManager) {
- this.serverManager = serverManager;
- this.sessionManager = sessionManager;
- }
-
- @GET
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- public IdeVersion get() throws OseeCoreException {
- IdeVersion client = new IdeVersion();
- String[] supportedVersions = serverManager.getVersions();
- for (String ver : supportedVersions) {
- client.addVersion(ver);
- }
- return client;
- }
-
- @Path("status")
- @GET
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- public ClientStatus getStatus() {
- return getStatus(null);
- }
-
- @Path("status/{userId}")
- @GET
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- public ClientStatus getStatus(@PathParam("userId") String userId) {
- ClientStatus status = new ClientStatus();
- Set<String> duplicate = new HashSet<String>(50);
- Calendar cal = DateUtil.getCalendar(new Date());
- cal.add(Calendar.DAY_OF_WEEK, -7);
- Date weekAgo = cal.getTime();
-
- Map<String, ReleaseTypeStatus> nameToReleaseMap = new HashMap<String, ReleaseTypeStatus>(10);
- for (ISession session : sessionManager.getAllSessions()) {
- if (session.getCreationDate().before(weekAgo)) {
- // skipping session from week ago
- continue;
- }
- if (userId != null && !session.getUserId().equals(userId)) {
- // skip users not specified if single user chosen
- continue;
- }
- String addrPort = String.format("%s:%s", session.getClientAddress(), session.getClientPort());
- // skip duplicate entries
- if (!duplicate.contains(addrPort)) {
- duplicate.add(addrPort);
- String infoStr = getInfo(session);
- if (Strings.isValid(infoStr)) {
- ClientInfo info = new ClientInfo(infoStr);
- String version = info.getVersion();
- ReleaseStatus release = (ReleaseStatus) nameToReleaseMap.get(version);
- String type = getType(version);
- if (release == null) {
- release = new ReleaseStatus();
- nameToReleaseMap.put(version, release);
- status.getReleases().add(release);
- release.setName(version);
- release.setType(type);
- }
-
- ReleaseTypeStatus shortRel = nameToReleaseMap.get(type);
- if (shortRel == null) {
- shortRel = new ReleaseTypeStatus();
- nameToReleaseMap.put(type, shortRel);
- status.getReleaseByType().add(shortRel);
- shortRel.setType(type);
- }
- shortRel.incClient();
-
- release.incClient();
- release.getUsers().add(info.getName());
- }
- }
- }
- return status;
- }
-
- private String getType(String version) {
- if (version.endsWith("-REL")) {
- return "REL";
- } else if (version.endsWith("-RC")) {
- return "RC";
- } else if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("local")) {
- return "DEV";
- }
- return String.format("unhandled version [%s]", version);
- }
-
- private String getInfo(ISession session) throws OseeCoreException {
- try {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- URL url =
- new URL(String.format("http://%s:%s/osee/request?cmd=info", session.getClientAddress(),
- session.getClientPort()));
- AcquireResult result = HttpProcessor.acquire(url, outputStream, 1000);
- if (result.wasSuccessful()) {
- return outputStream.toString(result.getEncoding());
- }
- } catch (Exception ex) {
- // do nothing
- }
- return "";
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientStatus.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientStatus.java
deleted file mode 100644
index 6961ffc1a56..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ClientStatus.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.internal;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.eclipse.osee.framework.jdk.core.util.DateUtil;
-
-/**
- * @author Donald G. Dunne
- */
-@XmlRootElement
-public class ClientStatus {
-
- private Date date = new Date();
- private String dateStr = DateUtil.get(date, DateUtil.MMDDYYHHMM);
- private List<ReleaseTypeStatus> releaseByType = new ArrayList<ReleaseTypeStatus>();
- private List<ReleaseStatus> releases = new ArrayList<ReleaseStatus>();
-
- public List<ReleaseStatus> getReleases() {
- return releases;
- }
-
- public void setReleases(List<ReleaseStatus> releases) {
- this.releases = releases;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public String getDateStr() {
- return dateStr;
- }
-
- public void setDateStr(String dateStr) {
- this.dateStr = dateStr;
- }
-
- public List<ReleaseTypeStatus> getReleaseByType() {
- return releaseByType;
- }
-
- public void setReleaseByType(List<ReleaseTypeStatus> releaseByType) {
- this.releaseByType = releaseByType;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ReleaseStatus.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ReleaseStatus.java
deleted file mode 100644
index 34f4bdf6c88..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ReleaseStatus.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Donald G. Dunne
- */
-@XmlRootElement
-public class ReleaseStatus extends ReleaseTypeStatus {
-
- private String name;
- private List<String> users = new ArrayList<String>(50);
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public List<String> getUsers() {
- return users;
- }
-
- public void setUsers(List<String> users) {
- this.users = users;
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ReleaseTypeStatus.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ReleaseTypeStatus.java
deleted file mode 100644
index 220e7716831..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ReleaseTypeStatus.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.internal;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Donald G. Dunne
- */
-@XmlRootElement
-public class ReleaseTypeStatus {
-
- private String type;
- private int numberClients = 0;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public int getNumberClients() {
- return numberClients;
- }
-
- public void setNumberClients(int numberClients) {
- this.numberClients = numberClients;
- }
-
- public void incClient() {
- numberClients++;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerApplication.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerApplication.java
deleted file mode 100644
index 2dd4c3309ca..00000000000
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerApplication.java
+++ /dev/null
@@ -1,52 +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.internal;
-
-import java.util.HashSet;
-import java.util.Set;
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.server.ISessionManager;
-
-/**
- * @author Donald G. Dunne
- */
-@ApplicationPath("orcs")
-public class ServerApplication extends Application {
-
- private final Set<Object> resources = new HashSet<Object>();
-
- private IApplicationServerManager serverManager;
- private ISessionManager sessionManager;
-
- public void setServerManager(IApplicationServerManager serverManager) {
- this.serverManager = serverManager;
- }
-
- public void start() {
- resources.add(new ClientResource(serverManager, sessionManager));
- }
-
- public void stop() {
- resources.clear();
- }
-
- @Override
- public Set<Object> getSingletons() {
- return resources;
- }
-
- public void setSessionManager(ISessionManager sessionManager) {
- this.sessionManager = sessionManager;
- }
-
-}

Back to the top