Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2015-03-04 19:01:34 +0000
committerRoberto E. Escobar2015-03-05 00:18:30 +0000
commita178be8d3206de7635534e7f5ab010dd8a079494 (patch)
treecbd9d0d2d3d1813ba6c73b5051eee56b76e2ccad
parent1543255a69ae90708448b60ac2f4f0f4bf2e3ba4 (diff)
downloadorg.eclipse.osee-0.20.0.v201503050058_REL.tar.gz
org.eclipse.osee-0.20.0.v201503050058_REL.tar.xz
org.eclipse.osee-0.20.0.v201503050058_REL.zip
feature[ats_ATS148512]: Improve jetty configuration and startup0.20.0.v201503091754_REL0.20.0.v201503050058_REL
-rw-r--r--plugins/org.eclipse.osee.config.admin/src/org/eclipse/osee/config/admin/internal/ConfigManagerImpl.java18
-rw-r--r--plugins/org.eclipse.osee.http.jetty/OSGI-INF/in.memory.http.service.xml (renamed from plugins/org.eclipse.osee.http.jetty/OSGI-INF/http.service.xml)2
-rw-r--r--plugins/org.eclipse.osee.http.jetty/OSGI-INF/jdbc.http.service.xml6
-rw-r--r--plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/JettyConstants.java24
-rw-r--r--plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/AbstractJettyHttpService.java (renamed from plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/JettyHttpService.java)50
-rw-r--r--plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/InMemoryJettyHttpService.java27
-rw-r--r--plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/JdbcJettyHttpService.java33
-rw-r--r--plugins/org.eclipse.osee.ote.master.product/etc/ote.server.config.json5
-rw-r--r--plugins/org.eclipse.osee.parent/tools/osee-application-server.xml3
-rw-r--r--plugins/org.eclipse.osee.support.config/launchConfig/osee.hsql.json3
-rw-r--r--plugins/org.eclipse.osee.support.config/launchConfig/osee.postgresql.json6
-rw-r--r--plugins/org.eclipse.osee.x.server.p2/etc/osee.hsql.json3
-rw-r--r--plugins/org.eclipse.osee.x.server.p2/etc/osee.postgresql.json3
13 files changed, 89 insertions, 94 deletions
diff --git a/plugins/org.eclipse.osee.config.admin/src/org/eclipse/osee/config/admin/internal/ConfigManagerImpl.java b/plugins/org.eclipse.osee.config.admin/src/org/eclipse/osee/config/admin/internal/ConfigManagerImpl.java
index 630d6af499e..5a591d12783 100644
--- a/plugins/org.eclipse.osee.config.admin/src/org/eclipse/osee/config/admin/internal/ConfigManagerImpl.java
+++ b/plugins/org.eclipse.osee.config.admin/src/org/eclipse/osee/config/admin/internal/ConfigManagerImpl.java
@@ -136,6 +136,15 @@ public class ConfigManagerImpl implements UriWatcherListener {
}
private void configureServices(Map<String, Dictionary<String, Object>> newConfigs) {
+ Iterable<String> removed =
+ org.eclipse.osee.framework.jdk.core.util.Collections.setComplement(services.keySet(), newConfigs.keySet());
+ for (String id : removed) {
+ ServiceConfig component = services.remove(id);
+ if (component != null) {
+ component.stop();
+ }
+ }
+
for (Entry<String, Dictionary<String, Object>> entry : newConfigs.entrySet()) {
String serviceId = entry.getKey();
ServiceConfig component = services.get(serviceId);
@@ -145,15 +154,6 @@ public class ConfigManagerImpl implements UriWatcherListener {
}
component.update(entry.getValue());
}
-
- Iterable<String> removed =
- org.eclipse.osee.framework.jdk.core.util.Collections.setComplement(services.keySet(), newConfigs.keySet());
- for (String id : removed) {
- ServiceConfig component = services.remove(id);
- if (component != null) {
- component.stop();
- }
- }
}
private final class ServiceConfig {
diff --git a/plugins/org.eclipse.osee.http.jetty/OSGI-INF/http.service.xml b/plugins/org.eclipse.osee.http.jetty/OSGI-INF/in.memory.http.service.xml
index 779e9ddff31..6b4a84b4cec 100644
--- a/plugins/org.eclipse.osee.http.jetty/OSGI-INF/http.service.xml
+++ b/plugins/org.eclipse.osee.http.jetty/OSGI-INF/in.memory.http.service.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" configuration-policy="require" deactivate="stop" modified="update">
- <implementation class="org.eclipse.osee.http.jetty.internal.osgi.JettyHttpService" />
+ <implementation class="org.eclipse.osee.http.jetty.internal.osgi.InMemoryJettyHttpService" />
<reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.http.jetty/OSGI-INF/jdbc.http.service.xml b/plugins/org.eclipse.osee.http.jetty/OSGI-INF/jdbc.http.service.xml
new file mode 100644
index 00000000000..82f9cf6fc36
--- /dev/null
+++ b/plugins/org.eclipse.osee.http.jetty/OSGI-INF/jdbc.http.service.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" configuration-policy="require" deactivate="stop" modified="update">
+ <implementation class="org.eclipse.osee.http.jetty.internal.osgi.JdbcJettyHttpService" />
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setJdbcService" cardinality="1..1" interface="org.eclipse.osee.jdbc.JdbcService" name="JdbcService" policy="static" target="(osgi.binding=jetty.jdbc.service)"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/JettyConstants.java b/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/JettyConstants.java
index 28475b02345..3aa01244ae1 100644
--- a/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/JettyConstants.java
+++ b/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/JettyConstants.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.http.jetty;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
/**
* @author Roberto E. Escobar
*/
@@ -112,26 +110,4 @@ public final class JettyConstants {
public static final String ORG_OSGI_SERVICE_HTTP_PORT = "org.osgi.service.http.port";
public static final String ORG_OSGI_SERVICE_HTTP_PORT_SECURE = "org.osgi.service.http.port.secure";
- public static final String JETTY_SESSION_MANAGER_FACTORY = qualify("session.manager.factory");
- public static final String DEFAULT_JETTY_SESSION_MANAGER_FACTORY = SessionManagerType.IN_MEMORY.name();
-
- public static enum SessionManagerType {
- IN_MEMORY,
- JDBC,
- UNKNOWN;
-
- public static SessionManagerType fromString(String value) {
- SessionManagerType toReturn = SessionManagerType.UNKNOWN;
- if (Strings.isValid(value)) {
- for (SessionManagerType type : SessionManagerType.values()) {
- if (type.name().equalsIgnoreCase(value)) {
- toReturn = type;
- break;
- }
- }
- }
- return toReturn;
- }
- }
-
}
diff --git a/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/JettyHttpService.java b/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/AbstractJettyHttpService.java
index 70252e4d728..4931fbecde5 100644
--- a/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/JettyHttpService.java
+++ b/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/AbstractJettyHttpService.java
@@ -15,28 +15,21 @@ import static org.eclipse.osee.http.jetty.JettyConstants.JETTY__HTTP_PORT;
import static org.eclipse.osee.http.jetty.JettyConstants.ORG_OSGI_SERVICE_HTTP_PORT;
import static org.eclipse.osee.http.jetty.JettyConstants.ORG_OSGI_SERVICE_HTTP_PORT_SECURE;
import java.io.File;
-import java.util.Collection;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.http.jetty.JettyConstants;
-import org.eclipse.osee.http.jetty.JettyConstants.SessionManagerType;
import org.eclipse.osee.http.jetty.JettyLogger;
import org.eclipse.osee.http.jetty.JettyServer;
import org.eclipse.osee.http.jetty.JettyServer.Builder;
import org.eclipse.osee.http.jetty.internal.JettyUtil;
-import org.eclipse.osee.jdbc.JdbcService;
import org.eclipse.osee.logger.Log;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
/**
* @author Roberto E. Escobar
*/
-public class JettyHttpService {
+public abstract class AbstractJettyHttpService {
private static final String DIR_PREFIX = "pid_";
private final AtomicReference<JettyServer> reference = new AtomicReference<JettyServer>();
@@ -81,22 +74,8 @@ public class JettyHttpService {
contextWorkDir.mkdir();
builder.workingDirectory(contextWorkDir.getAbsolutePath());
- String sessionManager =
- getSessionManager(props, JettyConstants.JETTY_SESSION_MANAGER_FACTORY,
- JettyConstants.DEFAULT_JETTY_SESSION_MANAGER_FACTORY);
- SessionManagerType type = SessionManagerType.fromString(sessionManager);
- switch (type) {
- case JDBC:
- JdbcService jdbcService = getJdbcService(bundleContext, "jetty.jdbc.service");
- builder.jdbcSessionManagerFactory(jdbcService.getClient());
- break;
- case UNKNOWN:
- logger.warn("JettySessionManagerFactory [%s] was %s - defaulting to IN_MEMORY - ", sessionManager, type);
- break;
- default:
- // do nothing - default is in-memory
- break;
- }
+ customizeJettyServer(builder, props);
+
JettyServer newServer = builder.build();
JettyServer server = reference.getAndSet(newServer);
if (server != null) {
@@ -106,28 +85,7 @@ public class JettyHttpService {
newServer.start();
}
- private String getSessionManager(Map<String, Object> props, String key, String defaultValue) {
- String value = JettyUtil.get(props, key, defaultValue);
- return Strings.isValid(value) ? value.toLowerCase() : value;
- }
-
- private JdbcService getJdbcService(BundleContext context, String jdbcServiceBinding) {
- JdbcService toReturn = null;
- try {
- String filter = String.format("(osgi.binding=%s)", jdbcServiceBinding);
- Collection<ServiceReference<JdbcService>> references = context.getServiceReferences(JdbcService.class, filter);
- ServiceReference<JdbcService> reference = null;
- if (!references.isEmpty()) {
- reference = references.iterator().next();
- }
- if (reference != null) {
- toReturn = context.getService(reference);
- }
- } catch (InvalidSyntaxException ex) {
- throw new OseeCoreException(ex, "Error finding JdbcService reference with osgi.binding=%s", jdbcServiceBinding);
- }
- return toReturn;
- }
+ protected abstract void customizeJettyServer(Builder builder, Map<String, Object> props);
private String getWorkingDirectoryPath(Map<String, Object> props) {
return DIR_PREFIX + props.get(Constants.SERVICE_PID).hashCode();
diff --git a/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/InMemoryJettyHttpService.java b/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/InMemoryJettyHttpService.java
new file mode 100644
index 00000000000..fc58fdc63fb
--- /dev/null
+++ b/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/InMemoryJettyHttpService.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.http.jetty.internal.osgi;
+
+import java.util.Map;
+import org.eclipse.osee.http.jetty.JettyServer.Builder;
+import org.eclipse.osee.http.jetty.internal.session.InMemoryJettySessionManagerFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class InMemoryJettyHttpService extends AbstractJettyHttpService {
+
+ @Override
+ protected void customizeJettyServer(Builder builder, Map<String, Object> props) {
+ builder.sessionManagerFactory(new InMemoryJettySessionManagerFactory());
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/JdbcJettyHttpService.java b/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/JdbcJettyHttpService.java
new file mode 100644
index 00000000000..df038fd9c27
--- /dev/null
+++ b/plugins/org.eclipse.osee.http.jetty/src/org/eclipse/osee/http/jetty/internal/osgi/JdbcJettyHttpService.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.http.jetty.internal.osgi;
+
+import java.util.Map;
+import org.eclipse.osee.http.jetty.JettyServer.Builder;
+import org.eclipse.osee.jdbc.JdbcService;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class JdbcJettyHttpService extends AbstractJettyHttpService {
+
+ private JdbcService jdbcService;
+
+ public void setJdbcService(JdbcService jdbcService) {
+ this.jdbcService = jdbcService;
+ }
+
+ @Override
+ protected void customizeJettyServer(Builder builder, Map<String, Object> props) {
+ builder.jdbcSessionManagerFactory(jdbcService.getClient());
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ote.master.product/etc/ote.server.config.json b/plugins/org.eclipse.osee.ote.master.product/etc/ote.server.config.json
index 028ec0c7fef..1272c614558 100644
--- a/plugins/org.eclipse.osee.ote.master.product/etc/ote.server.config.json
+++ b/plugins/org.eclipse.osee.ote.master.product/etc/ote.server.config.json
@@ -1,9 +1,8 @@
{
"config": [
{
- "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JettyHttpService",
- "jetty.server.context.session.inactive.interval": 3600,
- "jetty.server.session.manager.factory": "IN_MEMORY"
+ "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.InMemoryJettyHttpService",
+ "jetty.server.context.session.inactive.interval": 3600
}
]
}
diff --git a/plugins/org.eclipse.osee.parent/tools/osee-application-server.xml b/plugins/org.eclipse.osee.parent/tools/osee-application-server.xml
index 7975dcf6b17..49fe3520861 100644
--- a/plugins/org.eclipse.osee.parent/tools/osee-application-server.xml
+++ b/plugins/org.eclipse.osee.parent/tools/osee-application-server.xml
@@ -158,10 +158,9 @@
]
},
{
- "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JettyHttpService",
+ "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JdbcJettyHttpService",
"jetty.server.http.port": ${xserver-port},
"jetty.server.context.session.inactive.interval": 3600,
- "jetty.server.session.manager.factory": "JDBC",
"jetty.jdbc.cluster.name" : "OSEE",
"jetty.jdbc.save.interval.secs" : 30
}
diff --git a/plugins/org.eclipse.osee.support.config/launchConfig/osee.hsql.json b/plugins/org.eclipse.osee.support.config/launchConfig/osee.hsql.json
index 244075e58ea..edf3c55eb85 100644
--- a/plugins/org.eclipse.osee.support.config/launchConfig/osee.hsql.json
+++ b/plugins/org.eclipse.osee.support.config/launchConfig/osee.hsql.json
@@ -24,9 +24,8 @@
]
},
{
- "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JettyHttpService",
+ "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JdbcJettyHttpService",
"jetty.server.context.session.inactive.interval": 3600,
- "jetty.server.session.manager.factory": "JDBC",
"jetty.jdbc.cluster.name" : "OSEE",
"jetty.jdbc.save.interval.secs" : 30
}
diff --git a/plugins/org.eclipse.osee.support.config/launchConfig/osee.postgresql.json b/plugins/org.eclipse.osee.support.config/launchConfig/osee.postgresql.json
index cbed8580e8b..bec34c34565 100644
--- a/plugins/org.eclipse.osee.support.config/launchConfig/osee.postgresql.json
+++ b/plugins/org.eclipse.osee.support.config/launchConfig/osee.postgresql.json
@@ -17,15 +17,15 @@
"orcs.jdbc.service",
"account.jdbc.service",
"oauth.jdbc.service",
- "app.server.jdbc.service"
+ "app.server.jdbc.service",
+ "jetty.jdbc.service"
]
}
]
},
{
- "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JettyHttpService",
+ "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JdbcJettyHttpService",
"jetty.server.context.session.inactive.interval": 3600,
- "jetty.server.session.manager.factory": "JDBC",
"jetty.jdbc.cluster.name" : "OSEE",
"jetty.jdbc.save.interval.secs" : 30
}
diff --git a/plugins/org.eclipse.osee.x.server.p2/etc/osee.hsql.json b/plugins/org.eclipse.osee.x.server.p2/etc/osee.hsql.json
index 244075e58ea..edf3c55eb85 100644
--- a/plugins/org.eclipse.osee.x.server.p2/etc/osee.hsql.json
+++ b/plugins/org.eclipse.osee.x.server.p2/etc/osee.hsql.json
@@ -24,9 +24,8 @@
]
},
{
- "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JettyHttpService",
+ "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JdbcJettyHttpService",
"jetty.server.context.session.inactive.interval": 3600,
- "jetty.server.session.manager.factory": "JDBC",
"jetty.jdbc.cluster.name" : "OSEE",
"jetty.jdbc.save.interval.secs" : 30
}
diff --git a/plugins/org.eclipse.osee.x.server.p2/etc/osee.postgresql.json b/plugins/org.eclipse.osee.x.server.p2/etc/osee.postgresql.json
index 31420f57c00..24fb1706175 100644
--- a/plugins/org.eclipse.osee.x.server.p2/etc/osee.postgresql.json
+++ b/plugins/org.eclipse.osee.x.server.p2/etc/osee.postgresql.json
@@ -24,9 +24,8 @@
]
},
{
- "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JettyHttpService",
+ "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JdbcJettyHttpService",
"jetty.server.context.session.inactive.interval": 3600,
- "jetty.server.session.manager.factory": "JDBC",
"jetty.jdbc.cluster.name" : "OSEE",
"jetty.jdbc.save.interval.secs" : 30
}

Back to the top