summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Liebig2008-03-05 05:50:27 (EST)
committerStefan Liebig2008-03-05 05:50:27 (EST)
commit0f93685f1746d5b202603fefffacb19364b8e2d5 (patch)
tree25a3c400334eb5681744683c83f5c57615365543
parent8f2fc41ae843505f1d5f0e298359b87830155887 (diff)
downloadorg.eclipse.riena-0f93685f1746d5b202603fefffacb19364b8e2d5.zip
org.eclipse.riena-0f93685f1746d5b202603fefffacb19364b8e2d5.tar.gz
org.eclipse.riena-0f93685f1746d5b202603fefffacb19364b8e2d5.tar.bz2
added ssl configuration
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java33
1 files changed, 28 insertions, 5 deletions
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java
index f2076a8..1a7860a 100644
--- a/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 compeople AG and others.
+ * Copyright (c) 2007 2008 compeople AG and others.
* 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
@@ -13,11 +13,17 @@ package org.eclipse.riena.internal.communication.core;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.communication.core.hooks.CallContext;
import org.eclipse.riena.communication.core.hooks.ICallHook;
+import org.eclipse.riena.communication.core.ssl.ISSLProperties;
+import org.eclipse.riena.communication.core.ssl.SSLConfiguration;
import org.eclipse.riena.core.RienaActivator;
+import org.eclipse.riena.core.extension.util.ExtensionUtility;
+import org.eclipse.riena.core.service.ServiceId;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
/**
@@ -29,6 +35,8 @@ public class Activator extends RienaActivator {
private static Activator plugin;
+ private ServiceReference sslConfigServiceReference;
+
/*
* (non-Javadoc)
*
@@ -42,24 +50,36 @@ public class Activator extends RienaActivator {
context.registerService(ICallHook.ID, new ICallHook() {
public void afterCall(CallContext context) {
- logger.log(LogService.LOG_DEBUG, "after call (in hook) method=" + context.getMethodName());
+ logger.log(LogService.LOG_DEBUG, "after call (in hook) method=" + context.getMethodName()); //$NON-NLS-1$
Map<String, List<String>> headers = context.getMessageContext().listResponseHeaders();
if (headers != null) {
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
- logger.log(LogService.LOG_DEBUG, "header: name:" + entry.getKey() + " value: "
+ logger.log(LogService.LOG_DEBUG, "header: name:" + entry.getKey() + " value: " //$NON-NLS-1$ //$NON-NLS-2$
+ entry.getValue());
}
}
}
public void beforeCall(CallContext context) {
- context.getMessageContext().addRequestHeader("Cookie", "x-scpclient-test-sessionid=222");
- logger.log(LogService.LOG_DEBUG, "before call (in hook) method=" + context.getMethodName());
+ context.getMessageContext().addRequestHeader("Cookie", "x-scpclient-test-sessionid=222"); //$NON-NLS-1$ //$NON-NLS-2$
+ logger.log(LogService.LOG_DEBUG, "before call (in hook) method=" + context.getMethodName()); //$NON-NLS-1$
}
}, null);
// context.registerService(ConfigurationPlugin.class.getName(), new
// SymbolConfigPlugin(), null);
+
+ // SSL configuration
+ context.registerService(SSLConfiguration.class.getName(), new SSLConfiguration(), ServiceId
+ .newDefaultServiceProperties());
+ ISSLProperties[] sslProperties = ExtensionUtility.readExtensions(ISSLProperties.EXTENSION_POINT_ID,
+ ISSLProperties.class);
+ Assert.isTrue(sslProperties.length < 2, "SSL properties either 0 or 1"); //$NON-NLS-1$
+ if (sslProperties.length == 1) {
+ sslConfigServiceReference = context.getServiceReference(SSLConfiguration.class.getName());
+ SSLConfiguration config = (SSLConfiguration) context.getService(sslConfigServiceReference);
+ config.configure(sslProperties[0]);
+ }
}
/*
@@ -68,7 +88,10 @@ public class Activator extends RienaActivator {
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+ if (sslConfigServiceReference != null)
+ context.ungetService(sslConfigServiceReference);
plugin = null;
+
super.stop(context);
}