Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Kapukaranov2011-06-30 04:47:20 -0400
committerBorislav Kapukaranov2011-06-30 07:38:22 -0400
commitb5de3887053f116edaadfb5a25617c32b0aa0306 (patch)
treef2b80e56a14cc3917cc786076e96f829994d7779
parenta7f71ea7eb9910cb5b36b8159368cbbfd7a7dd49 (diff)
downloadorg.eclipse.virgo.kernel-bug347904-new-shell.tar.gz
org.eclipse.virgo.kernel-bug347904-new-shell.tar.xz
org.eclipse.virgo.kernel-bug347904-new-shell.zip
bug347904 - Consume new shell from Equinox in Virgo, shell per region supportbug347904-new-shell
-rwxr-xr-xbuild-kernel/bin/dmk.bat3
-rwxr-xr-xbuild-kernel/bin/dmk.sh3
-rw-r--r--build-kernel/build.xml8
-rw-r--r--build-kernel/config/org.eclipse.virgo.kernel.authentication.config3
-rw-r--r--build-kernel/config/org.eclipse.virgo.kernel.userregion.properties22
-rw-r--r--build-kernel/config/osgi.console.ssh.properties2
-rw-r--r--build-kernel/config/osgi.console.telnet.properties2
-rw-r--r--build-kernel/kernel-ivy.xml5
-rw-r--r--build-kernel/lib-ivy.xml1
-rw-r--r--build-kernel/lib/org.eclipse.virgo.kernel.launch.properties14
-rw-r--r--build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan3
-rw-r--r--build-kernel/repository/ext/osgi.console.ssh.properties2
-rw-r--r--build-kernel/repository/ext/osgi.console.telnet.properties2
-rw-r--r--build.versions4
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInitialiser.java1
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisher.java20
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardConfigurationExporter.java42
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/ConfigurationExporter.java24
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml9
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties8
-rw-r--r--org.eclipse.virgo.kernel.deployer/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/config/ConfigurationDeployer.java29
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java6
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigLifecycleEngine.java32
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml1
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties8
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java36
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/UserRegionConfigurationDeployer.java50
-rw-r--r--org.eclipse.virgo.kernel.userregion/template.mf1
29 files changed, 300 insertions, 43 deletions
diff --git a/build-kernel/bin/dmk.bat b/build-kernel/bin/dmk.bat
index eabefdd8..0ac7bb7d 100755
--- a/build-kernel/bin/dmk.bat
+++ b/build-kernel/bin/dmk.bat
@@ -178,6 +178,9 @@ rem ------------------------------
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.virgo.kernel.authentication.file="%CONFIG_DIR%\org.eclipse.virgo.kernel.users.properties"
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Djava.io.tmpdir="%TMP_DIR%"
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.virgo.kernel.home="%KERNEL_HOME%"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.equinox.console.jaas.file="%CONFIG_DIR%/store"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dssh.server.keystore="%CONFIG_DIR%/hostkey.ser"
+ set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dgosh.args="--nointeractive"
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -classpath "%CLASSPATH%"
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% org.eclipse.virgo.osgi.launcher.Launcher
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -config "%KERNEL_HOME%\lib\org.eclipse.virgo.kernel.launch.properties"
diff --git a/build-kernel/bin/dmk.sh b/build-kernel/bin/dmk.sh
index 5f8112b1..b0de63f0 100755
--- a/build-kernel/bin/dmk.sh
+++ b/build-kernel/bin/dmk.sh
@@ -176,6 +176,9 @@ then
-Dorg.eclipse.virgo.kernel.authentication.file=$CONFIG_DIR/org.eclipse.virgo.kernel.users.properties \
-Djava.io.tmpdir=$TMP_DIR \
-Dorg.eclipse.virgo.kernel.home=$KERNEL_HOME \
+ -Dorg.eclipse.equinox.console.jaas.file="$CONFIG_DIR/store" \
+ -Dssh.server.keystore="$CONFIG_DIR/hostkey.ser" \
+ -Dgosh.args="--nointeractive" \
-classpath $CLASSPATH \
org.eclipse.virgo.osgi.launcher.Launcher \
-config $KERNEL_HOME/lib/org.eclipse.virgo.kernel.launch.properties \
diff --git a/build-kernel/build.xml b/build-kernel/build.xml
index f1e14ad4..1fab0548 100644
--- a/build-kernel/build.xml
+++ b/build-kernel/build.xml
@@ -91,6 +91,10 @@
<filter token="SPRING.VERSION" value="${org.springframework}"/>
<filter token="UTIL.VERSION" value="${org.eclipse.virgo.util}"/>
<filter token="OSGI.EXTENSIONS.VERSION" value="${org.eclipse.virgo.osgi}"/>
+ <filter token="FELIX.GOGO.VERSION" value="${org.apache.felix.gogo}"/>
+ <filter token="MINA.CORE.VERSION" value="${com.springsource.org.apache.mina.core}"/>
+ <filter token="SSHD.CORE.VERSION" value="${com.springsource.org.apache.sshd.core}"/>
+ <filter token="EQUINOX.CONSOLE.VERSION" value="${org.eclipse.equinox.console.supportability}"/>
</filterset>
</copy>
@@ -110,6 +114,10 @@
<filter token="SPRING.DM.VERSION" value="${org.springframework.osgi}"/>
<filter token="SPRING.VERSION" value="${org.springframework}"/>
<filter token="UTIL.VERSION" value="${org.eclipse.virgo.util}"/>
+ <filter token="FELIX.GOGO.VERSION" value="${org.apache.felix.gogo}"/>
+ <filter token="MINA.CORE.VERSION" value="${com.springsource.org.apache.mina.core}"/>
+ <filter token="SSHD.CORE.VERSION" value="${com.springsource.org.apache.sshd.core}"/>
+ <filter token="EQUINOX.CONSOLE.VERSION" value="${org.eclipse.equinox.console.supportability}"/>
</filterset>
</copy>
diff --git a/build-kernel/config/org.eclipse.virgo.kernel.authentication.config b/build-kernel/config/org.eclipse.virgo.kernel.authentication.config
index 5adc6b85..be90e61f 100644
--- a/build-kernel/config/org.eclipse.virgo.kernel.authentication.config
+++ b/build-kernel/config/org.eclipse.virgo.kernel.authentication.config
@@ -1,3 +1,6 @@
virgo-kernel {
org.eclipse.virgo.kernel.authentication.KernelLoginModule REQUIRED;
};
+equinox_console {
+ org.eclipse.equinox.console.jaas.SecureStorageLoginModule REQUIRED;
+};
diff --git a/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties b/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
index 53bb86a1..16c8aa0f 100644
--- a/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
@@ -1,6 +1,14 @@
baseBundles = \
+ file:lib/kernel/org.eclipse.equinox.cm-@EQUINOX.CONFIGADMIN.VERSION@.jar@start,\
file:lib/kernel/org.eclipse.virgo.kernel.userregion-@KERNEL.VERSION@.jar@start,\
- file:lib/kernel/org.eclipse.virgo.kernel.osgicommand-@KERNEL.VERSION@.jar@start
+ file:lib/kernel/org.eclipse.virgo.kernel.osgicommand-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.osgi.services-@OSGI.SERVICES.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.org.apache.mina.core-@MINA.CORE.VERSION@.jar@start,\
+ file:lib/kernel/org.apache.felix.gogo.command-@FELIX.GOGO.VERSION@.jar@start,\
+ file:lib/kernel/org.apache.felix.gogo.runtime-@FELIX.GOGO.VERSION@.jar@start,\
+ file:lib/kernel/org.apache.felix.gogo.shell-@FELIX.GOGO.VERSION@.jar@start,\
+ file:lib/org.eclipse.equinox.console.supportability-@EQUINOX.CONSOLE.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.org.apache.sshd.core-@SSHD.CORE.VERSION@.jar@start
bundleImports = org.eclipse.osgi;bundle-version="0"
@@ -9,6 +17,7 @@ packageImports =\
org.eclipse.virgo.kernel.core;version="0",\
org.eclipse.virgo.kernel.deployer.core;version="0",\
org.eclipse.virgo.kernel.deployer.core.event;version="0",\
+ org.eclipse.virgo.kernel.deployer.config;version="0",\
org.eclipse.virgo.kernel.install.*;version="0",\
org.eclipse.virgo.kernel.osgi.*;version="0",\
org.eclipse.virgo.kernel.model;version="0",\
@@ -27,7 +36,6 @@ packageImports =\
org.apache.commons.logging;version="[1.0.0,2.0.0)",\
org.apache.commons.logging.impl;version="[1.0.0,2.0.0)",\
org.aspectj.*;version="[1.6.5.RELEASE,2.0.0)",\
- org.osgi.service.cm;version="0",\
org.osgi.service.event;version="0",\
org.osgi.service.log;version="0",\
org.eclipse.equinox.region;version="1",\
@@ -52,7 +60,6 @@ serviceImports =\
org.eclipse.virgo.medic.eventlog.EventLoggerFactory,\
org.eclipse.virgo.repository.Repository,\
org.eclipse.virgo.kernel.core.Shutdown,\
- org.osgi.service.cm.ConfigurationAdmin,\
org.osgi.service.event.EventAdmin,\
org.osgi.service.log.LogService,\
org.eclipse.virgo.medic.eventlog.EventLogger,\
@@ -61,7 +68,8 @@ serviceImports =\
org.eclipse.virgo.kernel.shim.serviceability.TracingService,\
org.eclipse.virgo.kernel.model.RuntimeArtifactRepository,\
org.eclipse.osgi.service.resolver.PlatformAdmin,\
- org.osgi.service.packageadmin.PackageAdmin
+ org.osgi.service.packageadmin.PackageAdmin,\
+ org.eclipse.virgo.kernel.core.ConfigurationExporter
serviceExports =\
org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener,\
@@ -75,10 +83,8 @@ serviceExports =\
org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil,\
org.eclipse.equinox.region.Region,\
org.osgi.service.event.EventHandler,\
- org.osgi.service.cm.ConfigurationListener,\
- org.osgi.service.cm.ManagedService,\
- org.osgi.service.cm.ManagedServiceFactory,\
- org.osgi.framework.BundleContext
+ org.osgi.framework.BundleContext,\
+ org.eclipse.virgo.kernel.deployer.config.ConfigurationDeployer
# the next line must not be broken with back-slashes
initialArtifacts = repository:plan/org.eclipse.virgo.kernel.userregion.springdm
diff --git a/build-kernel/config/osgi.console.ssh.properties b/build-kernel/config/osgi.console.ssh.properties
new file mode 100644
index 00000000..24c060a5
--- /dev/null
+++ b/build-kernel/config/osgi.console.ssh.properties
@@ -0,0 +1,2 @@
+port=2402
+host=localhost \ No newline at end of file
diff --git a/build-kernel/config/osgi.console.telnet.properties b/build-kernel/config/osgi.console.telnet.properties
new file mode 100644
index 00000000..8c6787d4
--- /dev/null
+++ b/build-kernel/config/osgi.console.telnet.properties
@@ -0,0 +1,2 @@
+port=2401
+host=localhost \ No newline at end of file
diff --git a/build-kernel/kernel-ivy.xml b/build-kernel/kernel-ivy.xml
index 558022d7..0292ac2d 100644
--- a/build-kernel/kernel-ivy.xml
+++ b/build-kernel/kernel-ivy.xml
@@ -22,6 +22,11 @@
<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.ds" rev="${org.eclipse.equinox.ds}" conf="lib-kernel->runtime"/>
<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.util" rev="${org.eclipse.equinox.util}" conf="lib-kernel->runtime"/>
<dependency org="org.eclipse.osgi" name='org.eclipse.equinox.region' rev='${org.eclipse.equinox.region}' conf='lib-kernel->runtime' />
+ <dependency org="org.apache.felix" name="org.apache.felix.gogo.command" rev="${org.apache.felix.gogo}" conf="lib-kernel->runtime" />
+ <dependency org="org.apache.felix" name="org.apache.felix.gogo.runtime" rev="${org.apache.felix.gogo}" conf="lib-kernel->runtime" />
+ <dependency org="org.apache.felix" name="org.apache.felix.gogo.shell" rev="${org.apache.felix.gogo}" conf="lib-kernel->runtime" />
+ <dependency org="org.apache.mina" name="com.springsource.org.apache.mina.core" rev="${com.springsource.org.apache.mina.core}" conf="lib-kernel->runtime" />
+ <dependency org="org.apache.mina" name="com.springsource.org.apache.sshd.core" rev="${com.springsource.org.apache.sshd.core}" conf="lib-kernel->runtime" />
<!-- repository-ext -->
<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="repository-ext->runtime"/>
diff --git a/build-kernel/lib-ivy.xml b/build-kernel/lib-ivy.xml
index 896e0c3e..94f2e35a 100644
--- a/build-kernel/lib-ivy.xml
+++ b/build-kernel/lib-ivy.xml
@@ -17,6 +17,7 @@
<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.extensions.equinox" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.console" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
<dependency org="javax.transaction" name="com.springsource.javax.transaction" rev="${javax.transaction}" conf="lib->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.console.supportability" rev="${org.eclipse.equinox.console.supportability}" conf="lib->runtime" />
</dependencies>
</ivy-module>
diff --git a/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties b/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties
index 6ced8fdb..10d37183 100644
--- a/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties
+++ b/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties
@@ -39,7 +39,13 @@ launcher.bundles =\
file:lib/kernel/org.eclipse.virgo.kernel.shell-@KERNEL.VERSION@.jar@start,\
file:lib/kernel/org.eclipse.virgo.kernel.osgi-@KERNEL.VERSION@.jar@start,\
file:lib/kernel/org.eclipse.virgo.kernel.core-@KERNEL.VERSION@.jar@start,\
- file:lib/kernel/org.eclipse.virgo.kernel.userregionfactory-@KERNEL.VERSION@.jar@start
+ file:lib/kernel/org.eclipse.virgo.kernel.userregionfactory-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.org.apache.mina.core-@MINA.CORE.VERSION@.jar@start,\
+ file:lib/kernel/org.apache.felix.gogo.command-@FELIX.GOGO.VERSION@.jar@start,\
+ file:lib/kernel/org.apache.felix.gogo.runtime-@FELIX.GOGO.VERSION@.jar@start,\
+ file:lib/kernel/org.apache.felix.gogo.shell-@FELIX.GOGO.VERSION@.jar@start,\
+ file:lib/org.eclipse.equinox.console.supportability-@EQUINOX.CONSOLE.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.org.apache.sshd.core-@SSHD.CORE.VERSION@.jar@start
#Equinox Configuration
osgi.parentClassloader=fwk
@@ -51,12 +57,14 @@ org.osgi.framework.bsnversion=multiple
# osgi console support
# osgi.console=2401
+osgi.console.enable.builtin=false
+osgi.console.ssh.useDefaultSecureStorage=true
+osgi.console.useConfigAdmin=true
osgi.java.profile=file:lib/java6-server.profile
osgi.java.profile.bootdelegation=override
osgi.hook.configurators.include=\
- org.eclipse.virgo.osgi.extensions.equinox.hooks.ExtensionsHookConfigurator,\
- org.eclipse.virgo.osgi.console.telnet.hook.TelnetHookConfigurator
+ org.eclipse.virgo.osgi.extensions.equinox.hooks.ExtensionsHookConfigurator
org.eclipse.virgo.medic.log.config.path=config/serviceability.xml
org.eclipse.virgo.suppress.heap.dumps=false
diff --git a/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan b/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
index d6d6b190..93938dfb 100644
--- a/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
+++ b/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
@@ -12,5 +12,6 @@
<artifact type="bundle" name="org.eclipse.virgo.kernel.deployer.dm" version="[3.0, 4.0)"/>
<artifact type="bundle" name="org.eclipse.equinox.ds" version="0.0.0"/>
<artifact type="bundle" name="org.eclipse.equinox.util" version="0.0.0"/>
- <artifact type="bundle" name="org.eclipse.osgi.services" version="0.0.0"/>
+ <artifact type="configuration" name="osgi.console.telnet" version="0"/>
+ <artifact type="configuration" name="osgi.console.ssh" version="0"/>
</plan>
diff --git a/build-kernel/repository/ext/osgi.console.ssh.properties b/build-kernel/repository/ext/osgi.console.ssh.properties
new file mode 100644
index 00000000..cf1f3a4a
--- /dev/null
+++ b/build-kernel/repository/ext/osgi.console.ssh.properties
@@ -0,0 +1,2 @@
+port=2502
+host=localhost \ No newline at end of file
diff --git a/build-kernel/repository/ext/osgi.console.telnet.properties b/build-kernel/repository/ext/osgi.console.telnet.properties
new file mode 100644
index 00000000..78295777
--- /dev/null
+++ b/build-kernel/repository/ext/osgi.console.telnet.properties
@@ -0,0 +1,2 @@
+port=2501
+host=localhost \ No newline at end of file
diff --git a/build.versions b/build.versions
index ddfbd1af..b9b4b443 100644
--- a/build.versions
+++ b/build.versions
@@ -5,6 +5,7 @@ org.eclipse.equinox.util=1.0.200.v20100503
org.eclipse.equinox.ds=1.3.0.v20110124-0830
org.eclipse.equinox.cm=1.0.300.v20101204
org.eclipse.equinox.region=1.0.0.v20110503
+org.eclipse.equinox.console.supportability=1.0.0.N20110626-2000
org.aspectj=1.6.6.RELEASE
org.eclipse.osgi=3.7.0.v20110224
org.eclipse.virgo.medic=3.0.0.D-20110617120547
@@ -15,6 +16,9 @@ org.slf4j=1.6.1
org.slf4j.spi=1.6.1
org.springframework.osgi=1.2.1
org.springframework=3.0.5.RELEASE
+org.apache.felix.gogo=0.8.0.v201105062003
+com.springsource.org.apache.mina.core=2.0.2
+com.springsource.org.apache.sshd.core=0.5.0
# Test
org.springframework.old=2.5.6.SEC01
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInitialiser.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInitialiser.java
index 8962142a..5ab2163b 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInitialiser.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInitialiser.java
@@ -67,6 +67,7 @@ public final class ConfigurationInitialiser {
new CommandLinePropertiesSource(context, eventLogger) };
ConfigurationPublisher configPublisher = new ConfigurationPublisher(configAdmin, sources);
configPublisher.publishConfigurations();
+ configPublisher.registerConfigurationExporterService(context);
}
private void initializeDumpContributor(BundleContext context, ConfigurationAdmin configAdmin) {
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisher.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisher.java
index 859826e9..3f5c8413 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisher.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisher.java
@@ -18,9 +18,11 @@ import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
+import org.osgi.framework.BundleContext;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
+import org.eclipse.virgo.kernel.core.ConfigurationExporter;
import org.eclipse.virgo.kernel.serviceability.NonNull;
import org.eclipse.virgo.util.common.IterableEnumeration;
import org.eclipse.virgo.util.common.StringUtils;
@@ -46,6 +48,10 @@ final class ConfigurationPublisher {
private final PropertiesSource[] sources;
+ private final static String KERNEL_REGION_CONFIGURATION_PID = KernelConfigurationPropertiesSource.KERNEL_CONFIGURATION_PID;
+
+ private final static String USER_REGION_CONFIGURATION_PID = "org.eclipse.virgo.kernel.userregion";
+
ConfigurationPublisher(ConfigurationAdmin configAdmin, PropertiesSource... sources) {
this.configAdmin = configAdmin;
this.sources = (sources == null ? new PropertiesSource[0] : sources);
@@ -60,8 +66,20 @@ final class ConfigurationPublisher {
}
}
}
-
}
+
+ void registerConfigurationExporterService(@NonNull BundleContext context) throws IOException {
+ ConfigurationExporter configurationExporter = createConfigurationExporterService();
+ context.registerService(ConfigurationExporter.class, configurationExporter, null);
+ }
+
+ private ConfigurationExporter createConfigurationExporterService() throws IOException {
+ Configuration kernelregionConfiguration = this.configAdmin.getConfiguration(KERNEL_REGION_CONFIGURATION_PID);
+ Configuration userregionConfiguration = this.configAdmin.getConfiguration(USER_REGION_CONFIGURATION_PID);
+
+ ConfigurationExporter configurationExporter = new StandardConfigurationExporter(userregionConfiguration, kernelregionConfiguration);
+ return configurationExporter;
+ }
@SuppressWarnings("unchecked")
private void populateConfigurationWithProperties(@NonNull String pid, @NonNull Properties properties) throws IOException {
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardConfigurationExporter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardConfigurationExporter.java
new file mode 100644
index 00000000..4960654d
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardConfigurationExporter.java
@@ -0,0 +1,42 @@
+package org.eclipse.virgo.kernel.config.internal;
+
+import java.util.Dictionary;
+
+import org.eclipse.virgo.kernel.core.ConfigurationExporter;
+import org.osgi.service.cm.Configuration;
+
+/**
+ * ConfigurationExporter
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * threadsafe
+ *
+ */
+public class StandardConfigurationExporter implements ConfigurationExporter {
+
+ private Configuration userregionConfiguration;
+
+ private Configuration kernelregionConfiguration;
+
+ public StandardConfigurationExporter (Configuration userregionConfiguration, Configuration kernelregionConfiguraion) {
+ this.userregionConfiguration = userregionConfiguration;
+ this.kernelregionConfiguration = kernelregionConfiguraion;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.virgo.kernel.config.internal.ConfigurationExporter#getUserregionConfiguration()
+ */
+ @Override
+ public Dictionary getUserRegionConfigurationProperties() {
+ return userregionConfiguration.getProperties();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.virgo.kernel.config.internal.ConfigurationExporter#getKernelregionConfiguration()
+ */
+ @Override
+ public Dictionary getKernelRegionConfigurationProperties() {
+ return kernelregionConfiguration.getProperties();
+ }
+}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/ConfigurationExporter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/ConfigurationExporter.java
new file mode 100644
index 00000000..86673d1c
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/ConfigurationExporter.java
@@ -0,0 +1,24 @@
+package org.eclipse.virgo.kernel.core;
+
+import java.util.Dictionary;
+
+/**
+ * This Service exports the user region and kernel region configurations, so that
+ * they are available to bundles in the user region.
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * Implementations should be threadsafe.
+ */
+public interface ConfigurationExporter {
+
+ /**
+ * Retrieve user region configuration properties
+ */
+ Dictionary getUserRegionConfigurationProperties();
+
+ /**
+ * Retrieve kernel region configuration properties
+ */
+ Dictionary getKernelRegionConfigurationProperties();
+
+} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml
index e08d39ab..86d91f70 100644
--- a/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml
+++ b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml
@@ -1,16 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="kernelcore" immediate="true" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">
<implementation class="org.eclipse.virgo.kernel.core.internal.CoreBundleActivator"/>
+
<reference name="EventLogger"
interface="org.eclipse.virgo.medic.eventlog.EventLogger"
- policy="dynamic"/>
+ policy="static"/>
<reference name="DumpGenerator"
interface="org.eclipse.virgo.medic.dump.DumpGenerator"
- policy="dynamic"/>
+ policy="static"/>
<reference name="ConfigAdmin"
interface="org.osgi.service.cm.ConfigurationAdmin"
- policy="dynamic"/>
+ policy="static"/>
<reference name="EventAdmin"
interface="org.osgi.service.event.EventAdmin"
- policy="dynamic"/>
+ policy="static"/>
</component> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index 9e5b3a8c..63ef42da 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -12,6 +12,7 @@ baseBundles =\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/1.0.300.v20101204/org.eclipse.equinox.cm-1.0.300.v20101204.jar,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:../org.eclipse.virgo.kernel.deployer.dm/target/classes@start,\
file:../org.eclipse.virgo.kernel.dmfragment/target/classes,\
@@ -30,6 +31,7 @@ packageImports =\
org.eclipse.virgo.kernel.core;version="0",\
org.eclipse.virgo.kernel.deployer.core;version="0",\
org.eclipse.virgo.kernel.deployer.core.event;version="0",\
+ org.eclipse.virgo.kernel.deployer.config;version="0",\
org.eclipse.virgo.kernel.install.*;version="0",\
org.eclipse.virgo.kernel.osgi.*;version="0",\
org.eclipse.virgo.kernel.model;version="0",\
@@ -79,7 +81,8 @@ serviceImports =\
org.eclipse.virgo.kernel.shim.serviceability.TracingService,\
org.eclipse.virgo.kernel.model.RuntimeArtifactRepository,\
org.eclipse.osgi.service.resolver.PlatformAdmin,\
- org.osgi.service.packageadmin.PackageAdmin
+ org.osgi.service.packageadmin.PackageAdmin,\
+ org.eclipse.virgo.kernel.core.ConfigurationExporter
serviceExports =\
org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener,\
@@ -96,4 +99,5 @@ serviceExports =\
org.osgi.service.cm.ConfigurationListener,\
org.osgi.service.cm.ManagedService,\
org.osgi.service.cm.ManagedServiceFactory,\
- org.osgi.framework.BundleContext
+ org.osgi.framework.BundleContext,\
+ org.eclipse.virgo.kernel.deployer.config.ConfigurationDeployer
diff --git a/org.eclipse.virgo.kernel.deployer/ivy.xml b/org.eclipse.virgo.kernel.deployer/ivy.xml
index 193766df..e6a96781 100644
--- a/org.eclipse.virgo.kernel.deployer/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer/ivy.xml
@@ -56,6 +56,8 @@
<dependency name='org.eclipse.virgo.repository' rev='${org.eclipse.virgo.repository}' conf='compile->compile' org='org.eclipse.virgo.repository'/>
+ <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.userregion" rev="latest.integration" conf="compile->compile"/>
+
<override org="org.springframework" rev="${org.springframework}"/>
<override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/config/ConfigurationDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/config/ConfigurationDeployer.java
new file mode 100644
index 00000000..130f4bb5
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/config/ConfigurationDeployer.java
@@ -0,0 +1,29 @@
+package org.eclipse.virgo.kernel.deployer.config;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.eclipse.virgo.kernel.serviceability.NonNull;
+
+/**
+ * Publishes and Deletes configurations from the config admin that is present in the implementor's region
+ *
+ *
+ */
+public interface ConfigurationDeployer {
+
+ /**
+ * Publishes configuration with the specified pid and configuration properties in the implementor's config admin
+ * @param pid - the pid of the published configuration
+ * @param configurationProperties
+ * @throws IOException - if the operation isn't successful
+ */
+ void publishConfiguration(@NonNull String pid, @NonNull Properties configurationProperties) throws IOException;
+
+ /**
+ * Deletes the configuration with the specified pid in the implementor's config admin
+ * @param pid - the pid of the configuration to delete
+ * @throws IOException - if the operation isn't successful
+ */
+ void deleteConfiguration(@NonNull String pid) throws IOException;
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
index dcea020d..475e3595 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
@@ -14,8 +14,6 @@ package org.eclipse.virgo.kernel.install.artifact.internal;
import java.util.Map;
import org.osgi.framework.BundleContext;
-import org.osgi.service.cm.ConfigurationAdmin;
-
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
@@ -47,9 +45,9 @@ final class ConfigInstallArtifactTreeFactory implements InstallArtifactTreeFacto
private final EventLogger eventLogger;
- ConfigInstallArtifactTreeFactory(BundleContext bundleContext, ConfigurationAdmin configurationAdmin, EventLogger eventLogger) {
+ ConfigInstallArtifactTreeFactory(BundleContext bundleContext, EventLogger eventLogger) {
this.bundleContext = bundleContext;
- this.lifecycleEngine = new ConfigLifecycleEngine(configurationAdmin);
+ this.lifecycleEngine = new ConfigLifecycleEngine(bundleContext);
this.eventLogger = eventLogger;
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigLifecycleEngine.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigLifecycleEngine.java
index 9935c1cc..525d1742 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigLifecycleEngine.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigLifecycleEngine.java
@@ -15,13 +15,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
+import org.eclipse.virgo.kernel.deployer.config.ConfigurationDeployer;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
import org.eclipse.virgo.util.io.IOUtils;
@@ -29,13 +29,17 @@ public final class ConfigLifecycleEngine implements StartEngine, RefreshEngine,
private final Logger logger = LoggerFactory.getLogger(this.getClass());
- private final ConfigurationAdmin configurationAdmin;
+ private BundleContext context;
+ private ConfigurationDeployer configurationDeployer;
- public ConfigLifecycleEngine(ConfigurationAdmin configurationAdmin) {
- this.configurationAdmin = configurationAdmin;
+ public ConfigLifecycleEngine(BundleContext context) {
+ this.context = context;
}
public void start(ArtifactIdentity artifactIdentity, ArtifactFS artifactFS) throws StartException {
+
+ initialiseConfigurationDeployer();
+
try {
updateConfiguration(artifactIdentity, artifactFS);
} catch (IOException e) {
@@ -45,6 +49,11 @@ public final class ConfigLifecycleEngine implements StartEngine, RefreshEngine,
}
}
+ private void initialiseConfigurationDeployer() {
+ ServiceReference<ConfigurationDeployer> configurationImporterRef = context.getServiceReference(ConfigurationDeployer.class);
+ this.configurationDeployer = context.getService(configurationImporterRef);
+ }
+
public void refresh(ArtifactIdentity artifactIdentity, ArtifactFS artifactFS) throws RefreshException {
try {
updateConfiguration(artifactIdentity, artifactFS);
@@ -59,9 +68,7 @@ public final class ConfigLifecycleEngine implements StartEngine, RefreshEngine,
InputStream inputStream = null;
try {
inputStream = artifactFS.getEntry("").getInputStream();
-
- Configuration configuration = getConfiguration(artifactIdentity);
- configuration.update(getProperties(inputStream));
+ configurationDeployer.publishConfiguration(artifactIdentity.getName(), getProperties(inputStream));
} finally {
IOUtils.closeQuietly(inputStream);
}
@@ -75,8 +82,7 @@ public final class ConfigLifecycleEngine implements StartEngine, RefreshEngine,
public void stop(ArtifactIdentity artifactIdentity, ArtifactFS artifactFS) throws StopException {
try {
- Configuration configuration = getConfiguration(artifactIdentity);
- configuration.delete();
+ configurationDeployer.deleteConfiguration(artifactIdentity.getName());
} catch (IOException e) {
String message = String.format("Unable to stop configuration '%s'", artifactIdentity.getName());
logger.error(message);
@@ -84,8 +90,4 @@ public final class ConfigLifecycleEngine implements StartEngine, RefreshEngine,
}
}
- private Configuration getConfiguration(ArtifactIdentity artifactIdentity) throws IOException {
- return this.configurationAdmin.getConfiguration(artifactIdentity.getName(), null);
- }
-
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
index 64cdbac7..72cd262e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
@@ -275,7 +275,6 @@
<beans:bean id="configInstallArtifactTreeFactory"
class="org.eclipse.virgo.kernel.install.artifact.internal.ConfigInstallArtifactTreeFactory">
<beans:constructor-arg ref="bundleContext" />
- <beans:constructor-arg ref="configAdmin" />
<beans:constructor-arg ref="eventLogger" />
</beans:bean>
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index 4328b6d2..3d0ffa2f 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -12,6 +12,7 @@ baseBundles =\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/1.0.300.v20101204/org.eclipse.equinox.cm-1.0.300.v20101204.jar,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:../org.eclipse.virgo.kernel.deployer.dm/target/classes@start,\
file:../org.eclipse.virgo.kernel.dmfragment/target/classes,\
@@ -25,6 +26,7 @@ packageImports =\
org.eclipse.virgo.kernel.core;version="0",\
org.eclipse.virgo.kernel.deployer.core;version="0",\
org.eclipse.virgo.kernel.deployer.core.event;version="0",\
+ org.eclipse.virgo.kernel.deployer.config;version="0",\
org.eclipse.virgo.kernel.install.*;version="0",\
org.eclipse.virgo.kernel.osgi.*;version="0",\
org.eclipse.virgo.kernel.module;version="0",\
@@ -74,7 +76,8 @@ serviceImports =\
org.eclipse.virgo.kernel.shim.scope.ScopeFactory,\
org.eclipse.virgo.kernel.shim.serviceability.TracingService,\
org.eclipse.osgi.service.resolver.PlatformAdmin,\
- org.osgi.service.packageadmin.PackageAdmin
+ org.osgi.service.packageadmin.PackageAdmin,\
+ org.eclipse.virgo.kernel.core.ConfigurationExporter
serviceExports =\
org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener,\
@@ -91,4 +94,5 @@ serviceExports =\
org.osgi.service.cm.ConfigurationListener,\
org.osgi.service.cm.ManagedService,\
org.osgi.service.cm.ManagedServiceFactory,\
- org.osgi.framework.BundleContext
+ org.osgi.framework.BundleContext,\
+ org.eclipse.virgo.kernel.deployer.config.ConfigurationDeployer
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java
index 78691465..325df736 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java
@@ -15,13 +15,16 @@ import java.io.IOException;
import java.util.Dictionary;
import java.util.HashSet;
import java.util.Hashtable;
+import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.eclipse.equinox.region.RegionDigraph;
import org.eclipse.osgi.service.resolver.PlatformAdmin;
+import org.eclipse.virgo.kernel.core.ConfigurationExporter;
import org.eclipse.virgo.kernel.core.Shutdown;
+import org.eclipse.virgo.kernel.deployer.config.ConfigurationDeployer;
import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
import org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser;
import org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository;
@@ -80,6 +83,10 @@ public class Activator implements BundleActivator {
private static final String PROPERTY_USER_REGION_ARTIFACTS = "initialArtifacts";
private static final String PROPERTY_USER_REGION_COMMANDLINE_ARTIFACTS = "commandLineArtifacts";
+
+ private static final String USER_REGION_CONFIGURATION_PID = "org.eclipse.virgo.kernel.userregion";
+
+ private static final String KERNEL_REGION_CONFIGURATION_PID = "org.eclipse.virgo.kernel";
private final ServiceRegistrationTracker registrationTracker = new ServiceRegistrationTracker();
@@ -89,6 +96,7 @@ public class Activator implements BundleActivator {
* {@inheritDoc}
*/
public void start(BundleContext context) throws Exception {
+ publishConfigurations(context);
ResolutionFailureDetective rfd = createResolutionFailureDetective(context);
Repository repository = getPotentiallyDelayedService(context, Repository.class);
PackageAdmin packageAdmin = getPotentiallyDelayedService(context, PackageAdmin.class);
@@ -125,8 +133,32 @@ public class Activator implements BundleActivator {
this.registrationTracker.track(context.registerService(ModuleContextAccessor.class.getName(), new EmptyModuleContextAccessor(), properties));
scheduleInitialArtifactDeployerCreation(context, eventLogger);
+
+ context.registerService(ConfigurationDeployer.class, new UserRegionConfigurationDeployer(context), null);
+ }
+
+ /**
+ * This method gets the kernel and user regions configurations from the kernel region and publishes them in the
+ * configuration admin in the user region.
+ * @throws Exception
+ */
+ private void publishConfigurations(BundleContext context) throws Exception {
+ ConfigurationExporter configurationExporter = getPotentiallyDelayedService(context, ConfigurationExporter.class);
+ ConfigurationAdmin admin = getPotentiallyDelayedService(context, ConfigurationAdmin.class);
+
+ try {
+ publishConfigurationFromKernelRegion(configurationExporter.getUserRegionConfigurationProperties(), admin.getConfiguration(USER_REGION_CONFIGURATION_PID));
+ publishConfigurationFromKernelRegion(configurationExporter.getKernelRegionConfigurationProperties(), admin.getConfiguration(KERNEL_REGION_CONFIGURATION_PID));
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to publish required configurations. Startup sequence can't continue", e);
+ }
}
+ @SuppressWarnings("rawtypes")
+ private void publishConfigurationFromKernelRegion(Dictionary configurationProperties, Configuration config) throws IOException {
+ config.update(configurationProperties);
+ }
+
private ResolutionFailureDetective createResolutionFailureDetective(BundleContext context) {
PlatformAdmin platformAdmin = OsgiFrameworkUtils.getService(context, PlatformAdmin.class).getService();
return new StandardResolutionFailureDetective(platformAdmin);
@@ -241,8 +273,6 @@ public class Activator implements BundleActivator {
private static final class InitialArtifactDeployerCreatingRunnable implements Runnable {
- private static final String USER_REGION_CONFIGURATION_PID = "org.eclipse.virgo.kernel.userregion";
-
private final BundleContext context;
private final EventLogger eventLogger;
@@ -300,6 +330,7 @@ public class Activator implements BundleActivator {
throw new RuntimeException("Failed to read region artifact configuration", ioe);
}
}
+
}
private static <T> T getPotentiallyDelayedService(BundleContext context, Class<T> serviceClass) throws TimeoutException, InterruptedException {
@@ -328,4 +359,5 @@ public class Activator implements BundleActivator {
Thread.sleep(100);
return (System.currentTimeMillis() - before);
}
+
}
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/UserRegionConfigurationDeployer.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/UserRegionConfigurationDeployer.java
new file mode 100644
index 00000000..96e8f6c7
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/UserRegionConfigurationDeployer.java
@@ -0,0 +1,50 @@
+package org.eclipse.virgo.kernel.userregion.internal;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.eclipse.virgo.kernel.deployer.config.ConfigurationDeployer;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+/**
+ * This service is registered in the user region so that it has access to the configuration admin in the
+ * user region. The kernel region can use it as a proxy to access the configuration admin in the user region.
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread-safe.
+ */
+public class UserRegionConfigurationDeployer implements ConfigurationDeployer {
+
+ private ConfigurationAdmin configurationAdmin;
+ private Object monitor = new Object();
+
+ public UserRegionConfigurationDeployer(BundleContext context) {
+ this.configurationAdmin = OsgiFrameworkUtils.getService(context, ConfigurationAdmin.class).getService();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void publishConfiguration(String pid, Properties configurationProperties) throws IOException {
+ synchronized (monitor) {
+ Configuration configuration = this.configurationAdmin.getConfiguration(pid, null);
+ configuration.update(configurationProperties);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void deleteConfiguration(String pid) throws IOException {
+ synchronized (monitor) {
+ Configuration configuration = this.configurationAdmin.getConfiguration(pid, null);
+ configuration.delete();
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.userregion/template.mf b/org.eclipse.virgo.kernel.userregion/template.mf
index 19f9721c..fcd0eec5 100644
--- a/org.eclipse.virgo.kernel.userregion/template.mf
+++ b/org.eclipse.virgo.kernel.userregion/template.mf
@@ -15,6 +15,7 @@ Import-Template:
org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
org.eclipse.virgo.repository.*;version="${org.eclipse.virgo.repository:[=.=.=, =.+1)}",
org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
+ org.eclipse.virgo.kernel.deployer.config.*;version="0",
org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
org.eclipse.osgi.*;version="0",
org.eclipse.equinox.region.*;version="${org.eclipse.equinox.region:[=.=.=, =.+1)}",

Back to the top