Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Kapukaranov2012-01-17 00:01:32 -0500
committerBorislav Kapukaranov2012-01-17 00:01:32 -0500
commit3c0a27d3968ed878f355c434604aab5d3b59260f (patch)
treea64be0ad85078ddec1ebf44d4989f90d3695142a
parenta1ff906d2aa012b0bd81a2f18c1d57981c5672ad (diff)
downloadorg.eclipse.virgo.kernel-3c0a27d3968ed878f355c434604aab5d3b59260f.tar.gz
org.eclipse.virgo.kernel-3c0a27d3968ed878f355c434604aab5d3b59260f.tar.xz
org.eclipse.virgo.kernel-3c0a27d3968ed878f355c434604aab5d3b59260f.zip
Cleans up the kernel repository by removing the parts that are already moved to the nano repository
-rw-r--r--build-kernel/build.xml1
-rw-r--r--build.versions4
-rw-r--r--org.eclipse.virgo.kernel.authentication/.classpath10
-rw-r--r--org.eclipse.virgo.kernel.authentication/.project30
-rw-r--r--org.eclipse.virgo.kernel.authentication/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--org.eclipse.virgo.kernel.authentication/.springBeans13
-rw-r--r--org.eclipse.virgo.kernel.authentication/build.xml8
-rw-r--r--org.eclipse.virgo.kernel.authentication/ivy.xml19
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/CredentialStore.java32
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/KernelLoginModule.java137
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/PropertiesFileCredentialStoreFactory.java96
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/Role.java72
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/User.java145
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/main/resources/.gitignore0
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/KernelLoginModuleTests.java142
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/PropertiesFileCredentialStoreFactoryTests.java91
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/RoleTests.java87
-rw-r--r--org.eclipse.virgo.kernel.authentication/src/test/resources/user.properties0
-rw-r--r--org.eclipse.virgo.kernel.authentication/template.mf8
-rw-r--r--org.eclipse.virgo.kernel.core/.classpath51
-rw-r--r--org.eclipse.virgo.kernel.core/.project37
-rw-r--r--org.eclipse.virgo.kernel.core/.settings/com.springsource.server.ide.bundlor.core.prefs3
-rw-r--r--org.eclipse.virgo.kernel.core/.settings/org.eclipse.jdt.core.prefs60
-rw-r--r--org.eclipse.virgo.kernel.core/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--org.eclipse.virgo.kernel.core/.springBeans20
-rw-r--r--org.eclipse.virgo.kernel.core/build.xml9
-rw-r--r--org.eclipse.virgo.kernel.core/findbugs-exclude.xml9
-rw-r--r--org.eclipse.virgo.kernel.core/ivy.xml43
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfo.java67
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminDumpContributor.java97
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminExporter.java133
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInfo.java24
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInitialiser.java95
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisher.java118
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java145
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java63
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/PropertiesSource.java41
-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/config/internal/StandardKernelConfig.java55
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/UserConfigurationPropertiesSource.java135
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/commandline/CommandLinePropertiesSource.java151
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfEnvironmentPropertiesReader.java85
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfParseException.java30
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfPropertiesSource.java167
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java31
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingAbortableSignal.java70
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingSignal.java65
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java60
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleUtils.java54
-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/java/org/eclipse/virgo/kernel/core/FailureSignalledException.java39
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/FatalKernelException.java48
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java31
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelException.java46
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/Shutdown.java37
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/Signal.java38
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/AsyncShutdownDecorator.java61
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java291
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java239
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/KernelStatus.java30
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/KernelStatusMBean.java21
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java80
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ShutdownManager.java136
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java86
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java277
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/ApplicationContextDependencyMonitor.java308
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/StandardTicker.java255
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/Ticker.java52
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java68
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/Assert.java255
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/FatalServerException.java44
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/LogEventDelegate.java40
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/NonNull.java35
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/DumpCoordinator.aj74
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/FFDCExceptionState.java65
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/RegionDigraphDumpContributor.java72
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionDumpContributor.java65
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionStateDumper.java102
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StandardStateWriter.java44
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StandardSystemStateAccessor.java41
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StateWriter.java40
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/SystemStateAccessor.java34
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/enforcement/NonNullAssertionEnforcer.aj83
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/Scope.java61
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/ScopeFactory.java67
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/internal/StandardScopeFactory.java302
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/serviceability/TracingService.java45
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/serviceability/internal/Slf4jTracingService.java30
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties18
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernel_config.xml9
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml17
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/StubConfiguration.java104
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/StubConfigurationAdmin.java60
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfoTests.java101
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminDumpContributorTests.java128
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisherTests.java169
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java47
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java63
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/UserConfigurationPropertiesSourceTests.java68
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/commandline/CommandLinePropertiesSourceTests.java126
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfEnvironmentPropertiesReaderTests.java37
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfPropertiesSourceTests.java84
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/BlockingSignalTests.java124
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java345
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java85
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/ShutdownManagerTests.java103
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/StartupTrackerTests.java191
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/blueprint/ApplicationContextDependencyMonitorTests.java268
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/blueprint/TickerTests.java44
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/AssertTests.java175
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/dump/FFDCExceptionStateTests.java80
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionStateDumperTests.java112
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/enforcement/NonNullAssertionEnforcerTests.java74
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/test/AssertingService.java48
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_badprops/noprops.properties2
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_noprops/noise.config11
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_noprops/noise2.config11
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_props1/dup.properties3
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_props2/dup.properties6
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/factoryOne.properties3
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/factoryTwo.properties3
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/one.properties1
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/two.properties1
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/withServicePid.properties3
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/ovf/environment.xml26
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/ovf/invalid.xml25
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/resources/ovf/valid.xml28
-rw-r--r--org.eclipse.virgo.kernel.core/template.mf23
-rw-r--r--org.eclipse.virgo.kernel.deployer.dm/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties4
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties4
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties4
-rw-r--r--org.eclipse.virgo.kernel.deployer/ivy.xml4
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.osgi/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.services/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.shutdown/.classpath10
-rw-r--r--org.eclipse.virgo.kernel.shutdown/.project23
-rw-r--r--org.eclipse.virgo.kernel.shutdown/build.xml9
-rw-r--r--org.eclipse.virgo.kernel.shutdown/ivy.xml19
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java103
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownClient.java135
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommand.java78
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommandParser.java80
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/main/resources/.gitignore0
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java133
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/Shutdown.java22
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/ShutdownClientTests.java309
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommandParserTests.java107
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/test/resources/test.users.properties10
-rw-r--r--org.eclipse.virgo.kernel.test/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties4
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/ConsoleConfigurationConvertor.java1
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel/ivy.xml1
157 files changed, 25 insertions, 10409 deletions
diff --git a/build-kernel/build.xml b/build-kernel/build.xml
index 025d21f3..b0b79e1c 100644
--- a/build-kernel/build.xml
+++ b/build-kernel/build.xml
@@ -2,7 +2,6 @@
<project name="build-kernel" xmlns:ivy="antlib:org.apache.ivy.ant">
<path id="unit.test.bundles">
- <pathelement location="../org.eclipse.virgo.kernel.core"/>
<pathelement location="../org.eclipse.virgo.kernel.artifact"/>
<pathelement location="../org.eclipse.virgo.kernel.services"/>
<pathelement location="../org.eclipse.virgo.kernel.osgi"/>
diff --git a/build.versions b/build.versions
index 7cec6357..c4fa41e2 100644
--- a/build.versions
+++ b/build.versions
@@ -9,7 +9,7 @@ org.eclipse.equinox.console.supportability=1.0.0.N20110815-2000
org.aspectj=1.6.6.RELEASE
org.eclipse.osgi=3.7.1.R37x_v20110808-1106
ch.qos.logback=0.9.28
-org.eclipse.virgo.medic=3.1.0.D-20111223113430
+org.eclipse.virgo.medic=3.1.0.D-20111222170736
org.eclipse.virgo.osgi=3.1.0.D-20111205151528
org.eclipse.virgo.repository=3.1.0.D-20111223114028
org.eclipse.virgo.util=3.1.0.D-20111205151812
@@ -22,7 +22,7 @@ com.springsource.org.apache.sshd.core=0.5.0
org.apache.felix.gogo.shell=0.8.0.v201107131313
org.apache.felix.gogo.runtime=0.8.0.v201105062003
org.apache.felix.gogo.command=0.8.0.v201105062003
-org.eclipse.virgo.nano=3.1.0.D-20120105232919
+org.eclipse.virgo.nano=3.1.0.BUILD-20120116180246
org.eclipse.virgo.build.tools=1.1.0.RELEASE
org.eclipse.equinox.launcher=1.3.0.v20111003-1644
diff --git a/org.eclipse.virgo.kernel.authentication/.classpath b/org.eclipse.virgo.kernel.authentication/.classpath
deleted file mode 100644
index 3e0738f0..00000000
--- a/org.eclipse.virgo.kernel.authentication/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/org.eclipse.virgo.kernel.authentication/.project b/org.eclipse.virgo.kernel.authentication/.project
deleted file mode 100644
index c9a6e295..00000000
--- a/org.eclipse.virgo.kernel.authentication/.project
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.virgo.kernel.authentication</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.springframework.ide.eclipse.core.springbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.springsource.server.ide.facet.core.bundlenature</nature>
- <nature>org.springframework.ide.eclipse.core.springnature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.virgo.kernel.authentication/.settings/org.eclipse.wst.common.project.facet.core.xml b/org.eclipse.virgo.kernel.authentication/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100644
index 801f856c..00000000
--- a/org.eclipse.virgo.kernel.authentication/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <installed facet="com.springsource.server.bundle" version="1.0"/>
-</faceted-project>
diff --git a/org.eclipse.virgo.kernel.authentication/.springBeans b/org.eclipse.virgo.kernel.authentication/.springBeans
deleted file mode 100644
index 55e47c55..00000000
--- a/org.eclipse.virgo.kernel.authentication/.springBeans
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beansProjectDescription>
- <version>1</version>
- <pluginVersion><![CDATA[2.5.0.201010141000-RC1]]></pluginVersion>
- <configSuffixes>
- <configSuffix><![CDATA[xml]]></configSuffix>
- </configSuffixes>
- <enableImports><![CDATA[false]]></enableImports>
- <configs>
- </configs>
- <configSets>
- </configSets>
-</beansProjectDescription>
diff --git a/org.eclipse.virgo.kernel.authentication/build.xml b/org.eclipse.virgo.kernel.authentication/build.xml
deleted file mode 100644
index 9bf3d653..00000000
--- a/org.eclipse.virgo.kernel.authentication/build.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.virgo.kernel.authentication">
-
- <property file="${basedir}/../build.properties"/>
- <property file="${basedir}/../build.versions"/>
- <import file="${basedir}/../virgo-build/standard/default.xml"/>
-
-</project>
diff --git a/org.eclipse.virgo.kernel.authentication/ivy.xml b/org.eclipse.virgo.kernel.authentication/ivy.xml
deleted file mode 100644
index 3e82e806..00000000
--- a/org.eclipse.virgo.kernel.authentication/ivy.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" version="2.0">
-
- <info module='${ant.project.name}' organisation='org.eclipse.virgo.kernel'/>
-
- <configurations>
- <include file='${virgo.build.dir}/common/default-ivy-configurations.xml'/>
- </configurations>
-
- <publications>
- <artifact name='${ant.project.name}'/>
- <artifact name='${ant.project.name}-sources' ext='jar' type='src'/>
- </publications>
-
- <dependencies>
- <dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
- </dependencies>
-
-</ivy-module>
diff --git a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/CredentialStore.java b/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/CredentialStore.java
deleted file mode 100644
index 46e3d598..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/CredentialStore.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.authentication;
-
-/**
- * A container encapsulating a collection of credentials
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations must be threadsafe
- *
- */
-public interface CredentialStore {
-
- /**
- * Gets a {@link User} based on a given user name
- *
- * @param name The name of the {@link User} to retrieve
- * @return The {@link User} represented by the user name or <code>null</code> if one does not exist
- */
- User getUser(String name);
-}
diff --git a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/KernelLoginModule.java b/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/KernelLoginModule.java
deleted file mode 100644
index dd3beade..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/KernelLoginModule.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.authentication;
-
-import java.io.IOException;
-import java.io.FileReader;
-import java.io.Reader;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.FailedLoginException;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.spi.LoginModule;
-
-/**
- * An implementation of {@link LoginModule} that reads a properties file for authentication information. The location of
- * the properties file is read from the system property <code>org.eclipse.virgo.kernel.authentication.file</code>. If
- * this property is not set, then instantiation of this {@link LoginModule} will fail.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Not threadsafe
- *
- */
-public final class KernelLoginModule implements LoginModule {
-
- public static final String FILE_LOCATION = "org.eclipse.virgo.kernel.authentication.file";
-
- private final CredentialStore credentialStore;
-
- private volatile Subject subject;
-
- private volatile CallbackHandler callbackHandler;
-
- private volatile User user;
-
- private volatile boolean authenticationResult;
-
- public KernelLoginModule() {
- this.credentialStore = PropertiesFileCredentialStoreFactory.create(getProperties());
- }
-
- KernelLoginModule(CredentialStore credentialStore) {
- this.credentialStore = credentialStore;
- }
-
- public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
- this.subject = subject;
- this.callbackHandler = callbackHandler;
- }
-
- public boolean login() throws LoginException {
- // We do not actually care about these prompts but they must be populated
- NameCallback nameCallback = new NameCallback("username");
- PasswordCallback passwordCallback = new PasswordCallback("password", false);
-
- try {
- this.callbackHandler.handle(new Callback[] { nameCallback, passwordCallback });
- } catch (UnsupportedCallbackException e) {
- throw new FailedLoginException("Unable to get username and password");
- } catch (IOException e) {
- throw new FailedLoginException("Unable to get username and password");
- }
-
- this.user = this.credentialStore.getUser(nameCallback.getName());
- this.authenticationResult = this.user.authenticate(new String(passwordCallback.getPassword()));
-
- if (authenticationResult) {
- return true;
- }
- throw new FailedLoginException("Credentials did not match");
- }
-
- public boolean commit() throws LoginException {
- if (!this.authenticationResult) {
- this.user = null;
- return false;
- }
-
- this.user.addPrincipals(this.subject);
- return true;
- }
-
- public boolean abort() throws LoginException {
- this.user = null;
- return true;
- }
-
- public boolean logout() throws LoginException {
- this.user.removePrincipals(this.subject);
- this.subject = null;
- this.user = null;
- return true;
- }
-
- private Properties getProperties() {
- String fileLocation = System.getProperty(FILE_LOCATION);
- if (fileLocation == null) {
- throw new IllegalArgumentException(String.format("System property '%s' must be set to use the %s JAAS Login Module", FILE_LOCATION,
- this.getClass().getCanonicalName()));
- }
-
- Reader reader = null;
- try {
- reader = new FileReader(fileLocation);
- Properties properties = new Properties();
- properties.load(reader);
- return properties;
- } catch (IOException e) {
- throw new IllegalArgumentException(String.format("Unable to load properties file from '%s'", fileLocation), e);
- } finally {
- if(reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- // Nothing to do here
- }
- }
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/PropertiesFileCredentialStoreFactory.java b/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/PropertiesFileCredentialStoreFactory.java
deleted file mode 100644
index 642da7e7..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/PropertiesFileCredentialStoreFactory.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.authentication;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import static java.lang.String.format;
-
-/**
- * A factory for a {@link CredentialStore} that reads a {@link Properties} object for authentication information. The keys of
- * this {@link Properties} object indicate user name and role information. A user name and password are identified with
- * a <code>user.</code> prefix and a role to user mapping is represented with a <code>role.</code> prefix.
- * <p />
- *
- * <pre>
- * user.admin=springsource
- * role.superuser=admin
- * </pre>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe
- *
- */
-final class PropertiesFileCredentialStoreFactory {
-
- private static final String USER_PREFIX = "user.";
-
- private static final String ROLE_PREFIX = "role.";
-
- static CredentialStore create(Properties properties) {
- Map<String, User> credentials = getUsers(properties);
- assignRoles(properties, credentials);
- return new ImmutableCredentialStore(credentials);
- }
-
- private static Map<String, User> getUsers(Properties properties) {
- Map<String, User> users = new HashMap<String, User>();
-
- for(String key : properties.stringPropertyNames()) {
- if (key.startsWith(USER_PREFIX)) {
- String username = key.substring(USER_PREFIX.length()).trim();
- String password = properties.getProperty(key);
- users.put(username, new User(username, password));
- }
- }
-
- return users;
- }
-
- private static void assignRoles(Properties properties, Map<String, User> credentials) {
- for(String key : properties.stringPropertyNames()) {
- if (key.startsWith(ROLE_PREFIX)) {
- String rolename = key.substring(ROLE_PREFIX.length()).trim();
- Role role = new Role(rolename);
- assignRole(role, (String) properties.get(key), credentials);
- }
- }
- }
-
- private static void assignRole(Role role, String usernames, Map<String, User> credentials) {
- for(String username : usernames.split(",")) {
- User user = credentials.get(username);
- if (user != null) {
- user.addRole(role);
- } else {
- throw new IllegalArgumentException(format("Could not assign role '%s' to user '%s', as user does not exist", role.getName(),
- username));
- }
- }
- }
-
- private static class ImmutableCredentialStore implements CredentialStore {
-
- private final Map<String, User> credentials;
-
- public ImmutableCredentialStore(Map<String, User> credentials) {
- this.credentials = credentials;
- }
-
- public User getUser(String name) {
- return this.credentials.get(name);
- }
-
- }
-}
diff --git a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/Role.java b/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/Role.java
deleted file mode 100644
index 9afa0888..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/Role.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.authentication;
-
-import java.security.Principal;
-
-/**
- * An implementation of {@link Principal} that represents a role that a user can have
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe
- *
- */
-public final class Role implements Principal {
-
- private final String name;
-
- public Role(String name) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof Role)) {
- return false;
- }
- Role other = (Role) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return this.name;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/User.java b/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/User.java
deleted file mode 100644
index 3159ce87..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/main/java/org/eclipse/virgo/kernel/authentication/User.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.authentication;
-
-import javax.security.auth.Subject;
-import java.security.Principal;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * An implementation of {@link Principal} that represents a user
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe
- *
- */
-public final class User implements Principal {
-
- private final String name;
-
- private final String credential;
-
- private final Set<Role> roles = new HashSet<Role>();
-
- private final Object roleMonitor = new Object();
-
- public User(String name, String password) {
- this.name = name;
- this.credential = password;
- }
-
- public String getName() {
- return this.name;
- }
-
- /**
- * Checks that a candidate credential is authentic with respect to this {@link User}
- *
- * @param candidateCredential The candidate credential to check
- * @return <code>true</code> if candidate credential matches, <code>false</code> otherwise
- */
- public boolean authenticate(String candidateCredential) {
- return this.credential.equals(candidateCredential);
- }
-
- /**
- * Adds all of the {@link Principal}s represented by this {@link User}
- *
- * @param subject The {@link Subject} to configure
- */
- public void addPrincipals(Subject subject) {
- Set<Principal> principals = subject.getPrincipals();
- synchronized (this.roleMonitor) {
- principals.add(this);
- principals.addAll(this.roles);
- }
- }
-
- /**
- * Removes all of the {@link Principal}s represented by this {@link User}
- *
- * @param subject The {@link Subject} to configure}
- */
- public void removePrincipals(Subject subject) {
- Set<Principal> principals = subject.getPrincipals();
- synchronized (this.roleMonitor) {
- principals.remove(this);
- principals.removeAll(this.roles);
- }
- }
-
- /**
- * Adds a {@link Role} to this {@link User}
- *
- * @param role The {@link Role} this user has
- * @return <tt>true</tt> if this {@link User} did not already contain the specified {@link Role}
- */
- public boolean addRole(Role role) {
- synchronized (this.roleMonitor) {
- return this.roles.add(role);
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((credential == null) ? 0 : credential.hashCode());
- result = prime * result + ((roles == null) ? 0 : roles.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof User)) {
- return false;
- }
- User other = (User) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (credential == null) {
- if (other.credential != null) {
- return false;
- }
- } else if (!credential.equals(other.credential)) {
- return false;
- }
- if (roles == null) {
- if (other.roles != null) {
- return false;
- }
- } else if (!roles.equals(other.roles)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return this.name;
- }
-}
diff --git a/org.eclipse.virgo.kernel.authentication/src/main/resources/.gitignore b/org.eclipse.virgo.kernel.authentication/src/main/resources/.gitignore
deleted file mode 100644
index e69de29b..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/main/resources/.gitignore
+++ /dev/null
diff --git a/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/KernelLoginModuleTests.java b/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/KernelLoginModuleTests.java
deleted file mode 100644
index 73c60370..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/KernelLoginModuleTests.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.authentication;
-
-import org.eclipse.virgo.kernel.authentication.CredentialStore;
-import org.eclipse.virgo.kernel.authentication.KernelLoginModule;
-import org.eclipse.virgo.kernel.authentication.User;
-import org.junit.Test;
-import static org.junit.Assert.assertFalse;
-
-import javax.security.auth.Subject;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.login.FailedLoginException;
-import javax.security.auth.callback.*;
-import java.io.IOException;
-
-import static org.junit.Assert.assertTrue;
-
-public class KernelLoginModuleTests {
-
- private final StubCredentialStore credentialStore = new StubCredentialStore();
-
- private final Subject subject = new Subject();
-
- private final KernelLoginModule loginModule = new KernelLoginModule(credentialStore);
-
- @Test
- public void loginSuccess() throws LoginException {
- this.credentialStore.setUser(new User("username", "password"));
- this.loginModule.initialize(this.subject, new StubCallbackHandler(), null, null);
- assertTrue(this.loginModule.login());
- }
-
- @Test(expected = FailedLoginException.class)
- public void loginFailure() throws LoginException {
- this.credentialStore.setUser(new User("username", "different-password"));
- this.loginModule.initialize(this.subject, new StubCallbackHandler(), null, null);
- this.loginModule.login();
- }
-
- @Test
- public void loginSuccessCommit() throws LoginException {
- this.credentialStore.setUser(new User("username", "password"));
- this.loginModule.initialize(this.subject, new StubCallbackHandler(), null, null);
- assertTrue(this.loginModule.login());
-
- assertTrue(this.loginModule.commit());
- assertTrue(this.subject.getPrincipals().size() != 0);
- }
-
- @Test
- public void loginFailureCommit() throws LoginException {
- this.credentialStore.setUser(new User("username", "different-password"));
- this.loginModule.initialize(this.subject, new StubCallbackHandler(), null, null);
- try {
- this.loginModule.login();
- } catch (LoginException e) {
- }
-
- assertFalse(this.loginModule.commit());
- assertTrue(this.subject.getPrincipals().size() == 0);
- }
-
- @Test
- public void abort() throws LoginException {
- assertTrue(this.loginModule.abort());
- }
-
- @Test
- public void logout() throws LoginException {
- this.credentialStore.setUser(new User("username", "password"));
- this.loginModule.initialize(this.subject, new StubCallbackHandler(), null, null);
- assertTrue(this.loginModule.login());
-
- assertTrue(this.loginModule.commit());
- assertTrue(this.subject.getPrincipals().size() != 0);
-
- assertTrue(this.loginModule.logout());
- assertTrue(this.subject.getPrincipals().size() == 0);
- }
-
- @Test
- public void getProperties() {
- System.setProperty(KernelLoginModule.FILE_LOCATION, "src/test/resources/user.properties");
- new KernelLoginModule();
- System.clearProperty(KernelLoginModule.FILE_LOCATION);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void getPropertiesNoSystemProperty() {
- new KernelLoginModule();
- }
-
- private static class StubCredentialStore implements CredentialStore {
-
- private volatile User user;
-
- public void setUser(User user) {
- this.user = user;
- }
-
- public User getUser(String name) {
- return this.user;
- }
- }
-
- private static class StubCallbackHandler implements CallbackHandler {
-
- private final String username;
-
- private final String password;
-
- public StubCallbackHandler() {
- this("username", "password");
- }
-
- public StubCallbackHandler(String username, String password) {
- this.username = username;
- this.password = password;
- }
-
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- for(Callback callback : callbacks) {
- if(callback instanceof NameCallback) {
- ((NameCallback) callback).setName(this.username);
- } else if (callback instanceof PasswordCallback) {
- ((PasswordCallback) callback).setPassword(this.password.toCharArray());
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/PropertiesFileCredentialStoreFactoryTests.java b/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/PropertiesFileCredentialStoreFactoryTests.java
deleted file mode 100644
index ddae92f3..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/PropertiesFileCredentialStoreFactoryTests.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.authentication;
-
-import static org.junit.Assert.*;
-
-import org.eclipse.virgo.kernel.authentication.CredentialStore;
-import org.eclipse.virgo.kernel.authentication.PropertiesFileCredentialStoreFactory;
-import org.eclipse.virgo.kernel.authentication.Role;
-import org.eclipse.virgo.kernel.authentication.User;
-import org.junit.Test;
-
-import javax.security.auth.Subject;
-import java.security.Principal;
-import java.util.Properties;
-
-public class PropertiesFileCredentialStoreFactoryTests {
-
- @Test
- public void success() {
- Properties properties = new Properties();
- properties.put("user.admin", "springsource");
- properties.put("role.superuser", "admin");
-
- CredentialStore credentialStore = PropertiesFileCredentialStoreFactory.create(properties);
- User user = credentialStore.getUser("admin");
- assertNotNull(user);
- assertTrue(user.authenticate("springsource"));
-
- Subject subject = new Subject();
- user.addPrincipals(subject);
- assertEquals(2, subject.getPrincipals().size());
- assertContainsRole(subject, "superuser");
- }
-
- @Test
- public void twoUsersOneRole() {
- Properties properties = new Properties();
- properties.put("user.admin1", "springsource");
- properties.put("user.admin2", "springsource");
- properties.put("role.superuser", "admin1");
-
- CredentialStore credentialStore = PropertiesFileCredentialStoreFactory.create(properties);
- User user1 = credentialStore.getUser("admin1");
- assertNotNull(user1);
- assertTrue(user1.authenticate("springsource"));
- Subject subject1 = new Subject();
- user1.addPrincipals(subject1);
- assertEquals(2, subject1.getPrincipals().size());
- assertContainsRole(subject1, "superuser");
-
- User user2 = credentialStore.getUser("admin2");
- assertNotNull(user2);
- assertTrue(user2.authenticate("springsource"));
- Subject subject2 = new Subject();
- user2.addPrincipals(subject2);
- assertEquals(1, subject2.getPrincipals().size());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void roleWithIllegalUser() {
- Properties properties = new Properties();
- properties.put("user.admin", "springsource");
- properties.put("role.superuser", "admin1");
-
- PropertiesFileCredentialStoreFactory.create(properties);
- }
-
- private void assertContainsRole(Subject subject, String roleName) {
- boolean foundRole = false;
- for(Principal principal : subject.getPrincipals()) {
- if(principal instanceof Role) {
- if(principal.getName().equals(roleName)) {
- foundRole = true;
- break;
- }
- }
- }
- assertTrue(foundRole);
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/RoleTests.java b/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/RoleTests.java
deleted file mode 100644
index ff54d2b1..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/test/java/org/eclipse/virgo/kernel/authentication/RoleTests.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (c) 2010 Olivier Girardot
- * 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:
- * Olivier Girardot - initial contribution
- */
-
-package org.eclipse.virgo.kernel.authentication;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-
-import java.security.Principal;
-
-import org.junit.Test;
-
-/**
- * This class is for testing {@link Role} class,
- * an implementation of the {@link Principal} interface.
- */
-public class RoleTests {
-
- private static final String ADMINISTRATOR_ROLE = "Administrator";
- private static final String TESTER_ROLE = "Tester";
-
- @Test
- public void testEqualsWithNull() {
- assertFalse(new Role(ADMINISTRATOR_ROLE).equals(null));
- }
-
- @Test
- public void testEqualsWithSameReference() {
- Role adminRole = new Role(ADMINISTRATOR_ROLE);
- assertTrue(adminRole.equals(adminRole));
- }
-
- @Test
- public void testHashCodeWithSameNullParameters() {
- Role nullRole = new Role(null);
- assertEquals((new Role(null)).hashCode(), nullRole.hashCode());
- }
-
- @Test
- public void testHashCodeWithSameNonNullParameters() {
- Role adminRole = new Role(ADMINISTRATOR_ROLE);
- assertEquals((new Role(ADMINISTRATOR_ROLE)).hashCode(), adminRole.hashCode());
- }
-
- @Test
- public void testEqualsWithSameNullParameters() {
- assertTrue(new Role(null).equals(new Role(null)));
- }
-
- @Test
- public void testNotEqualsWithDifferentParameters() {
- assertFalse(new Role(null).equals(new Role(ADMINISTRATOR_ROLE)));
- }
-
- @Test
- public void testMeaningFullEquals() {
- Role adminRole = new Role(ADMINISTRATOR_ROLE);
- Role secAdminRole = new Role(ADMINISTRATOR_ROLE);
- assertTrue(adminRole.equals(secAdminRole));
- }
-
- @Test
- public void testEqualsWithDifferentParameters() {
- Role adminRole = new Role(ADMINISTRATOR_ROLE);
- Role secAdminRole = new Role(TESTER_ROLE);
- assertFalse(adminRole.equals(secAdminRole));
- }
-
- @Test
- public void testEqualsWithWrongType() {
- assertFalse(new Role(null).equals(new Object()));
- }
-
- @Test
- public void testToStringWithNull() {
- assertNull(new Role(null).toString());
- }
-}
diff --git a/org.eclipse.virgo.kernel.authentication/src/test/resources/user.properties b/org.eclipse.virgo.kernel.authentication/src/test/resources/user.properties
deleted file mode 100644
index e69de29b..00000000
--- a/org.eclipse.virgo.kernel.authentication/src/test/resources/user.properties
+++ /dev/null
diff --git a/org.eclipse.virgo.kernel.authentication/template.mf b/org.eclipse.virgo.kernel.authentication/template.mf
deleted file mode 100644
index e2a60f97..00000000
--- a/org.eclipse.virgo.kernel.authentication/template.mf
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Virgo Kernel Authentication
-Bundle-SymbolicName: org.eclipse.virgo.kernel.authentication
-Bundle-Version: ${version}
-Import-Template: javax.security.*;version="0"
-Excluded-Exports: *.internal.*
-
diff --git a/org.eclipse.virgo.kernel.core/.classpath b/org.eclipse.virgo.kernel.core/.classpath
deleted file mode 100644
index 51a08006..00000000
--- a/org.eclipse.virgo.kernel.core/.classpath
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java">
- <attributes>
- <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="src/main/resources">
- <attributes>
- <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="ConfigBundleTests/config_tests_badprops/|ConfigBundleTests/|customConfigDir/" kind="src" output="target/test-classes" path="src/test/resources">
- <attributes>
- <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.1.R37x_v20110808-1106/org.eclipse.osgi-3.7.1.R37x_v20110808-1106.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.1.R37x_v20110808-1106/org.eclipse.osgi-sources-3.7.1.R37x_v20110808-1106.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.1.0.M01/org.eclipse.virgo.util.io-3.1.0.M01.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.1.0.M01/org.eclipse.virgo.util.io-sources-3.1.0.M01.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.5.RELEASE/org.springframework.beans-3.0.5.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.5.RELEASE/org.springframework.beans-sources-3.0.5.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.5.RELEASE/org.springframework.core-3.0.5.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.5.RELEASE/org.springframework.core-sources-3.0.5.RELEASE.jar"/>
- <classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.1.0.M01/org.eclipse.virgo.medic-3.1.0.M01.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.1.0.M01/org.eclipse.virgo.medic-sources-3.1.0.M01.jar">
- <attributes>
- <attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.1.0.M01/org.eclipse.virgo.medic.core-3.1.0.M01.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.1.0.M01/org.eclipse.virgo.medic.core-sources-3.1.0.M01.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.1.0.M01/org.eclipse.virgo.teststubs.osgi-3.1.0.M01.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.1.0.M01/org.eclipse.virgo.teststubs.osgi-sources-3.1.0.M01.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.1.0.M01/org.eclipse.virgo.util.osgi-3.1.0.M01.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.1.0.M01/org.eclipse.virgo.util.osgi-sources-3.1.0.M01.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.1.0.M01/org.eclipse.virgo.util.common-3.1.0.M01.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.1.0.M01/org.eclipse.virgo.util.common-sources-3.1.0.M01.jar"/>
- <classpathentry exported="true" kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110513/org.eclipse.osgi.services-3.3.0.v20110513.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110513/org.eclipse.osgi.services-sources-3.3.0.v20110513.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.1.0.M01/org.eclipse.virgo.medic.test-3.1.0.M01.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.1.0.M01/org.eclipse.virgo.medic.test-sources-3.1.0.M01.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-sources-1.2.1.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.5.RELEASE/org.springframework.context-3.0.5.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.5.RELEASE/org.springframework.context-sources-3.0.5.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.event/1.2.100.v20110110/org.eclipse.equinox.event-1.2.100.v20110110.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.region/1.0.0.v20110503/org.eclipse.equinox.region-1.0.0.v20110503.jar"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/org.eclipse.virgo.kernel.core/.project b/org.eclipse.virgo.kernel.core/.project
deleted file mode 100644
index 0488fa8e..00000000
--- a/org.eclipse.virgo.kernel.core/.project
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.virgo.kernel.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.ajdt.core.ajbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.springframework.ide.eclipse.core.springbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.springsource.server.ide.bundlor.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.ajdt.ui.ajnature</nature>
- <nature>com.springsource.server.ide.facet.core.bundlenature</nature>
- <nature>org.springframework.ide.eclipse.core.springnature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>com.springsource.server.dev.eclipse.serverdevelopmentnature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.virgo.kernel.core/.settings/com.springsource.server.ide.bundlor.core.prefs b/org.eclipse.virgo.kernel.core/.settings/com.springsource.server.ide.bundlor.core.prefs
deleted file mode 100644
index 87d20ca5..00000000
--- a/org.eclipse.virgo.kernel.core/.settings/com.springsource.server.ide.bundlor.core.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon Jul 06 09:08:03 BST 2009
-com.springsource.server.ide.bundlor.core.template.properties.files=../build.properties;../build.versions
-eclipse.preferences.version=1
diff --git a/org.eclipse.virgo.kernel.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.virgo.kernel.core/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 8d98e830..00000000
--- a/org.eclipse.virgo.kernel.core/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,60 +0,0 @@
-#Wed Aug 18 14:35:35 BST 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
diff --git a/org.eclipse.virgo.kernel.core/.settings/org.eclipse.wst.common.project.facet.core.xml b/org.eclipse.virgo.kernel.core/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100644
index 801f856c..00000000
--- a/org.eclipse.virgo.kernel.core/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <installed facet="com.springsource.server.bundle" version="1.0"/>
-</faceted-project>
diff --git a/org.eclipse.virgo.kernel.core/.springBeans b/org.eclipse.virgo.kernel.core/.springBeans
deleted file mode 100644
index a5d06195..00000000
--- a/org.eclipse.virgo.kernel.core/.springBeans
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beansProjectDescription>
- <version>1</version>
- <pluginVersion><![CDATA[2.2.4.RELEASE]]></pluginVersion>
- <configSuffixes>
- <configSuffix><![CDATA[xml]]></configSuffix>
- </configSuffixes>
- <enableImports><![CDATA[false]]></enableImports>
- <configs>
- </configs>
- <configSets>
- <configSet>
- <name><![CDATA[org.eclipse.virgo.kernel.config]]></name>
- <allowBeanDefinitionOverriding>true</allowBeanDefinitionOverriding>
- <incomplete>false</incomplete>
- <configs>
- </configs>
- </configSet>
- </configSets>
-</beansProjectDescription>
diff --git a/org.eclipse.virgo.kernel.core/build.xml b/org.eclipse.virgo.kernel.core/build.xml
deleted file mode 100644
index da67db0c..00000000
--- a/org.eclipse.virgo.kernel.core/build.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.virgo.kernel.core">
-
- <property name="findbugs.exclude.file" value="${basedir}/findbugs-exclude.xml"/>
- <property file="${basedir}/../build.properties"/>
- <property file="${basedir}/../build.versions"/>
- <import file="${basedir}/../virgo-build/aspect/default.xml"/>
-
-</project>
diff --git a/org.eclipse.virgo.kernel.core/findbugs-exclude.xml b/org.eclipse.virgo.kernel.core/findbugs-exclude.xml
deleted file mode 100644
index ceeb784b..00000000
--- a/org.eclipse.virgo.kernel.core/findbugs-exclude.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<FindBugsFilter>
- <!-- Exclusions -->
- <Match>
- <Bug pattern="DM_EXIT"/>
- <Class name="org.eclipse.virgo.kernel.core.internal.ShutdownManager"/>
- <Method name="immediateShutdown"/>
- </Match>
-</FindBugsFilter>
diff --git a/org.eclipse.virgo.kernel.core/ivy.xml b/org.eclipse.virgo.kernel.core/ivy.xml
deleted file mode 100644
index 92e47561..00000000
--- a/org.eclipse.virgo.kernel.core/ivy.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" version="2.0">
-
- <info module='${ant.project.name}' organisation='org.eclipse.virgo.kernel'/>
-
- <configurations>
- <include file='${virgo.build.dir}/common/default-ivy-configurations.xml'/>
- </configurations>
-
- <publications>
- <artifact name='${ant.project.name}'/>
- <artifact name='${ant.project.name}-sources' ext='jar' type='src'/>
- </publications>
-
- <dependencies>
- <dependency name='com.springsource.org.junit' rev='${org.junit}' org='org.junit' conf='test->runtime'/>
- <dependency name='com.springsource.org.easymock' rev='${org.easymock}' org='org.easymock' conf='test->runtime'/>
- <dependency name='org.eclipse.virgo.teststubs.osgi' rev='${org.eclipse.virgo.teststubs}' org='org.eclipse.virgo.teststubs' conf='test->runtime'/>
- <dependency name='org.eclipse.osgi' rev='${org.eclipse.osgi}' org='org.eclipse.osgi' conf='compile->runtime'/>
-
- <dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
- <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
- <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.event" rev="${org.eclipse.equinox.event}" conf="compile->runtime"/>
- <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.region" rev="${org.eclipse.equinox.region}" conf="compile->compile"/>
-
- <dependency name='org.eclipse.virgo.util.io' rev='${org.eclipse.virgo.util}' org='org.eclipse.virgo.util' conf='compile->compile'/>
- <dependency name='org.eclipse.virgo.util.jmx' rev='${org.eclipse.virgo.util}' org='org.eclipse.virgo.util' conf='aspects->runtime'/>
- <dependency name='org.eclipse.virgo.util.osgi' rev='${org.eclipse.virgo.util}' org='org.eclipse.virgo.util' conf='compile->compile'/>
- <dependency name='com.springsource.slf4j.api' rev='${org.slf4j}' org='org.slf4j' conf='compile->runtime'/>
- <dependency name='com.springsource.slf4j.nop' rev='${org.slf4j}' org='org.slf4j' conf='test->runtime'/>
- <dependency name='org.eclipse.virgo.medic' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='aspects, compile->runtime'/>
- <dependency name='org.eclipse.virgo.medic.core' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='runtime->runtime'/>
- <dependency name='org.eclipse.virgo.medic.test' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='test->runtime'/>
- <dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->compile"/>
- <dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->compile"/>
- <override org="org.springframework" rev="${org.springframework}"/>
- <override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
-
- <!-- Allow Equinox to be upgraded point-wise before rippling -->
- <override org="org.eclipse.osgi" module="org.eclipse.osgi" rev="${org.eclipse.osgi}"/>
- </dependencies>
-
-</ivy-module>
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfo.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfo.java
deleted file mode 100644
index 961bce4f..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfo.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.virgo.kernel.serviceability.NonNull;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class ConfigurationAdminConfigurationInfo implements ConfigurationInfo {
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final ConfigurationAdmin configurationAdmin;
-
- private final String pid;
-
- public ConfigurationAdminConfigurationInfo(@NonNull ConfigurationAdmin configurationAdmin, String pid) {
- this.configurationAdmin = configurationAdmin;
- this.pid = pid;
- }
-
- public String getPid() {
- return this.pid;
- }
-
- public Map<String, String> getProperties() {
- try {
- Configuration configuration = configurationAdmin.getConfiguration(this.pid, null);
- Map<String, String> properties = new HashMap<String, String>();
-
- @SuppressWarnings("unchecked")
- Dictionary<String, Object> dictionary = configuration.getProperties();
-
- if (dictionary != null) {
- Enumeration<String> keys = dictionary.keys();
- while (keys.hasMoreElements()) {
- String key = keys.nextElement();
- Object value = dictionary.get(key);
- properties.put(key, value instanceof String ? (String)value : value.toString());
- }
- }
- return properties;
- } catch (IOException e) {
- logger.warn("Unable to get configuration for {}", this.pid);
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminDumpContributor.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminDumpContributor.java
deleted file mode 100644
index f315f007..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminDumpContributor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import static org.eclipse.virgo.util.io.IOUtils.closeQuietly;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Dictionary;
-import java.util.Enumeration;
-
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.eclipse.virgo.medic.dump.Dump;
-import org.eclipse.virgo.medic.dump.DumpContributionFailedException;
-import org.eclipse.virgo.medic.dump.DumpContributor;
-
-public class ConfigurationAdminDumpContributor implements DumpContributor {
-
- private static final String PROPERTY_PATTERN = "%s:\t%s\n";
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final ConfigurationAdmin configurationAdmin;
-
- public ConfigurationAdminDumpContributor(ConfigurationAdmin configurationAdmin) {
- this.configurationAdmin = configurationAdmin;
- }
-
- public void contribute(Dump dump) throws DumpContributionFailedException {
- StringBuilder sb = new StringBuilder();
-
- try {
- for (Configuration configuration : configurationAdmin.listConfigurations(null)) {
- appendHeader(sb, configuration.getPid());
- appendProperties(sb, configuration.getProperties());
- appendFooter(sb);
- }
- } catch (Exception e) {
- logger.warn("Could not enumerate existing configurations");
- }
-
- Writer out = null;
- try {
- out = dump.createFileWriter("configurationAdmin.properties");
- out.write(sb.toString());
- } catch (IOException e) {
- logger.warn("Could not write configurationAdmin dump");
- } finally {
- closeQuietly(out);
- }
- }
-
- public String getName() {
- return "configurationAdmin";
- }
-
- private void appendHeader(StringBuilder sb, String pid) {
- for (int i = 0; i < pid.length() + 4; i++) {
- sb.append("#");
- }
- sb.append("\n# ").append(pid).append(" #\n");
- for (int i = 0; i < pid.length() + 4; i++) {
- sb.append("#");
- }
- sb.append("\n\n");
- }
-
- private void appendProperties(StringBuilder sb, Dictionary properties) {
- Enumeration keys = properties.keys();
- while (keys.hasMoreElements()) {
- Object key = keys.nextElement();
- appendProperty(sb, key, properties.get(key));
- }
- }
-
- private void appendProperty(StringBuilder sb, Object key, Object value) {
- sb.append(String.format(PROPERTY_PATTERN, key, value));
- }
-
- private void appendFooter(StringBuilder sb) {
- sb.append("\n\n");
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminExporter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminExporter.java
deleted file mode 100644
index c2010598..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminExporter.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.cm.ConfigurationEvent;
-import org.osgi.service.cm.ConfigurationListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-// TODO Remove alien calls made while holding this.monitor
-public class ConfigurationAdminExporter implements ConfigurationListener {
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
-
- private static final String OBJECT_NAME_PATTERN = "%s:type=Configuration,name=%s";
-
- private final Map<String, ObjectInstance> configurationInfos = new HashMap<String, ObjectInstance>();
-
- private final Object monitor = new Object();
-
- private final String managementDomain;
-
- private final ConfigurationAdmin configurationAdmin;
-
- public ConfigurationAdminExporter(String managementDomain, ConfigurationAdmin configurationAdmin) {
- this.managementDomain = managementDomain;
- this.configurationAdmin = configurationAdmin;
- }
-
- public void init() {
- synchronized (this.monitor) {
- try {
- for (Configuration configuration : configurationAdmin.listConfigurations(null)) {
- exportConfiguration(configuration.getPid());
- }
- } catch (Exception e) {
- logger.warn("Could not enumerate existing configurations");
- }
- }
- }
-
- public void configurationEvent(ConfigurationEvent configurationEvent) {
- String pid = configurationEvent.getPid();
- if (ConfigurationEvent.CM_UPDATED == configurationEvent.getType()) {
- exportConfiguration(pid);
- } else if (ConfigurationEvent.CM_DELETED == configurationEvent.getType()) {
- unexportConfiguration(pid);
- }
- }
-
- private ObjectName getObjectName(String pid) throws MalformedObjectNameException, NullPointerException {
- return new ObjectName(String.format(OBJECT_NAME_PATTERN, this.managementDomain, pid));
- }
-
- private void exportConfiguration(String pid) {
- synchronized (this.monitor) {
- if (!configurationInfos.containsKey(pid)) {
- try {
- ConfigurationInfo configurationInfo = new ConfigurationAdminConfigurationInfo(this.configurationAdmin, pid);
- ObjectInstance objectInstance = server.registerMBean(configurationInfo, getObjectName(pid));
- this.configurationInfos.put(pid, objectInstance);
- } catch (JMException e) {
- logger.warn("Unable to register MBean for configuration '{}'", pid);
- }
- }
- }
- }
-
- private void unexportConfiguration(String pid) {
- ObjectName objectName;
-
- synchronized (this.monitor) {
- objectName = configurationInfos.remove(pid).getObjectName();
- }
-
- try {
- this.server.unregisterMBean(objectName);
- } catch (JMException e) {
- this.logger.warn("Unable to unregister MBean for configuration '{}'", pid);
- }
- }
-
- /**
- *
- */
- public void stop() {
- List<ObjectName> objectNames = new ArrayList<ObjectName>();
-
- synchronized (this.monitor) {
- Set<Entry<String, ObjectInstance>> entries = this.configurationInfos.entrySet();
- for (Entry<String, ObjectInstance> entry : entries) {
- objectNames.add(entry.getValue().getObjectName());
- }
- this.configurationInfos.clear();
- }
-
- for (ObjectName objectName : objectNames) {
- try {
- this.server.unregisterMBean(objectName);
- } catch (JMException jme) {
- logger.warn("Unable to unregister MBean '{}' during stop", objectName);
- }
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInfo.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInfo.java
deleted file mode 100644
index 142f4576..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInfo.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.util.Map;
-
-import javax.management.MXBean;
-
-@MXBean
-public interface ConfigurationInfo {
-
- String getPid();
-
- Map<String, String> getProperties();
-}
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
deleted file mode 100644
index 5ab2163b..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationInitialiser.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.io.IOException;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.cm.ConfigurationListener;
-
-import org.eclipse.virgo.kernel.config.internal.commandline.CommandLinePropertiesSource;
-import org.eclipse.virgo.kernel.config.internal.ovf.OvfPropertiesSource;
-import org.eclipse.virgo.medic.dump.DumpContributor;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
-
-/**
- * ConfigurationInitialiser
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- * threadsafe
- *
- */
-public final class ConfigurationInitialiser {
-
- private final ServiceRegistrationTracker tracker = new ServiceRegistrationTracker();
-
- private volatile ConfigurationAdminExporter configAdminExporter;
-
- public KernelConfiguration start(BundleContext context, EventLogger eventLogger) throws IOException {
-
- ServiceReference<ConfigurationAdmin> configurationAdminReference = context.getServiceReference(ConfigurationAdmin.class);
-
- ConfigurationAdmin configAdmin = null;
-
- if (configurationAdminReference != null) {
- configAdmin = (ConfigurationAdmin) context.getService(configurationAdminReference);
- }
-
- if (configAdmin == null) {
- throw new IllegalStateException("ConfigurationAdmin service missing");
- }
- KernelConfiguration configuration = new KernelConfiguration(context);
-
- publishConfiguration(context, eventLogger, configuration, configAdmin);
- this.configAdminExporter = initializeConfigAdminExporter(context, configuration, configAdmin);
- initializeDumpContributor(context, configAdmin);
- return configuration;
-
- }
-
- private void publishConfiguration(BundleContext context, EventLogger eventLogger, KernelConfiguration configuration,
- ConfigurationAdmin configAdmin) throws IOException {
- PropertiesSource[] sources = new PropertiesSource[] { new UserConfigurationPropertiesSource(configuration.getConfigDirectories()),
- new OvfPropertiesSource(context, eventLogger), new KernelConfigurationPropertiesSource(configuration),
- new CommandLinePropertiesSource(context, eventLogger) };
- ConfigurationPublisher configPublisher = new ConfigurationPublisher(configAdmin, sources);
- configPublisher.publishConfigurations();
- configPublisher.registerConfigurationExporterService(context);
- }
-
- private void initializeDumpContributor(BundleContext context, ConfigurationAdmin configAdmin) {
- ConfigurationAdminDumpContributor dumpContributor = new ConfigurationAdminDumpContributor(configAdmin);
- this.tracker.track(context.registerService(DumpContributor.class.getName(), dumpContributor, null));
- }
-
- private ConfigurationAdminExporter initializeConfigAdminExporter(BundleContext context, KernelConfiguration configuration, ConfigurationAdmin configAdmin) {
- ConfigurationAdminExporter exporter = new ConfigurationAdminExporter(configuration.getDomain(), configAdmin);
- this.tracker.track(context.registerService(ConfigurationListener.class.getName(), exporter, null));
- exporter.init();
- return exporter;
- }
-
- public void stop() {
- this.tracker.unregisterAll();
-
- ConfigurationAdminExporter local = this.configAdminExporter;
-
- if (local != null) {
- this.configAdminExporter = null;
- local.stop();
- }
- }
-}
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
deleted file mode 100644
index 3f5c8413..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisher.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Hashtable;
-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;
-
-/**
- * <code>ConfigurationPublisher</code>, publishes kernel configuration to {@link ConfigurationAdmin}.
- * <p/>
- * Properties files in {@link KernelConfiguration#getConfigDirectories() config directories} are read in and applied to
- * {@link Configuration Configurations} owned by <code>ConfigurationAdmin</code>. A file called
- * <code><i>name</i>.properties</code> results in a <Code>Configuration</code> with the service pid
- * <code><i>name</i></code>.
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- *
- */
-final class ConfigurationPublisher {
-
- private final ConfigurationAdmin configAdmin;
-
- 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);
- }
-
- void publishConfigurations() throws IOException {
- for (PropertiesSource source : this.sources) {
- Map<String, Properties> configurationProperties = source.getConfigurationProperties();
- if (configurationProperties != null) {
- for (Entry<String, Properties> entry : configurationProperties.entrySet()) {
- populateConfigurationWithProperties(entry.getKey(), entry.getValue());
- }
- }
- }
- }
-
- 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 {
- Configuration config = getConfiguration(pid, properties);
-
- Dictionary configProperties = config.getProperties();
- if (configProperties == null) {
- configProperties = new Hashtable();
- }
-
- for (Object key : new IterableEnumeration(properties.keys())) {
- Object value = properties.get(key);
- configProperties.put(key, value);
- }
-
- config.update(configProperties);
- }
-
- /**
- * @param pid
- * @param properties
- * @return
- * @throws IOException
- */
- private Configuration getConfiguration(String pid, Properties properties) throws IOException {
- Configuration result = null;
- String factoryPid = properties.getProperty(ConfigurationAdmin.SERVICE_FACTORYPID);
- if (StringUtils.hasText(factoryPid)) {
- result = this.configAdmin.createFactoryConfiguration(factoryPid, null);
- } else {
- result = this.configAdmin.getConfiguration(pid, null);
- }
- return result;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java
deleted file mode 100644
index 20cd2eed..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class KernelConfiguration {
-
- private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
-
- static final String PROPERTY_KERNEL_CONFIG = "org.eclipse.virgo.kernel.config";
-
- static final String PROPERTY_KERNEL_HOME = "org.eclipse.virgo.kernel.home";
-
- static final String PROPERTY_KERNEL_DOMAIN = "org.eclipse.virgo.kernel.domain";
-
- static final String PROPERTY_KERNEL_STARTUP_WAIT_LIMIT = "org.eclipse.virgo.kernel.startup.wait.limit";
-
- private static final String DEFAULT_WORK_DIRECTORY_NAME = "work";
-
- private static final String DEFAULT_CONFIG_DIRECTORY_NAME = "config";
-
- private static final String DEFAULT_KERNEL_DOMAIN = "org.eclipse.virgo.kernel";
-
- private static final int DEFAULT_STARTUP_WAIT_LIMIT = 180; // 3 minutes
-
- private final File homeDirectory;
-
- private final File[] configDirectories;
-
- private final File workDirectory;
-
- private final String domain;
-
- private final int startupWaitLimit;
-
- public KernelConfiguration(BundleContext context) {
- this.homeDirectory = readHomeDirectory(context);
- this.configDirectories = readConfigDirectories(context);
- this.workDirectory = new File(this.homeDirectory, DEFAULT_WORK_DIRECTORY_NAME);
- this.domain = readDomain(context);
- this.startupWaitLimit = readBundleStartupWaitLimit(context);
- }
-
- public File getHomeDirectory() {
- return homeDirectory;
- }
-
- public File[] getConfigDirectories() {
- return configDirectories.clone();
- }
-
- public File getWorkDirectory() {
- return workDirectory;
- }
-
- public String getDomain() {
- return domain;
- }
-
- public int getStartupWaitLimit() {
- return startupWaitLimit;
- }
-
- private static File readHomeDirectory(BundleContext context) {
- String kernelHomeProperty = readFrameworkProperty(PROPERTY_KERNEL_HOME, context);
- if (!hasText(kernelHomeProperty)) {
- throw new IllegalStateException(PROPERTY_KERNEL_HOME + " property must be specified, and must not be empty");
- } else {
- return new File(kernelHomeProperty);
- }
- }
-
- private static File[] readConfigDirectories(BundleContext context) {
- String kernelConfigProperty = readFrameworkProperty(PROPERTY_KERNEL_CONFIG, context);
- List<File> configDirectories = new ArrayList<File>();
-
- if (hasText(kernelConfigProperty)) {
- parseKernelConfigProperty(kernelConfigProperty, configDirectories);
- }
-
- if (configDirectories.isEmpty()) {
- configDirectories.add(new File(DEFAULT_CONFIG_DIRECTORY_NAME));
- }
-
- return configDirectories.toArray(new File[configDirectories.size()]);
- }
-
- private static void parseKernelConfigProperty(String kernelConfigProperty, List<File> configDirectories) {
- String[] components = kernelConfigProperty.split(",");
- for (String component : components) {
- File configDir = new File(component.trim());
- if (!configDir.isAbsolute()) {
- configDir = new File(component.trim());
- }
- configDirectories.add(configDir);
- }
- }
-
- private static String readDomain(BundleContext context) {
- String kernelDomainProperty = readFrameworkProperty(PROPERTY_KERNEL_DOMAIN, context);
- if (!hasText(kernelDomainProperty)) {
- kernelDomainProperty = DEFAULT_KERNEL_DOMAIN;
- }
- return kernelDomainProperty;
- }
-
- private int readBundleStartupWaitLimit(BundleContext context) {
- String waitLimitProperty = readFrameworkProperty(PROPERTY_KERNEL_STARTUP_WAIT_LIMIT, context);
- if (!hasText(waitLimitProperty)) {
- return DEFAULT_STARTUP_WAIT_LIMIT;
- }
-
- try {
- return Integer.parseInt(waitLimitProperty);
- } catch (NumberFormatException e) {
- LOGGER.warn("Could not parse property {} with value '{}'. Using default limit {} seconds",
- new Object[]{PROPERTY_KERNEL_STARTUP_WAIT_LIMIT, waitLimitProperty, DEFAULT_STARTUP_WAIT_LIMIT});
- return DEFAULT_STARTUP_WAIT_LIMIT;
- }
- }
-
- private static String readFrameworkProperty(String propertyKey, BundleContext context) {
- return context.getProperty(propertyKey);
- }
-
- private static boolean hasText(String string) {
- return (string != null && !string.trim().isEmpty());
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java
deleted file mode 100644
index da4a3f3b..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Implementation of {@link PropertiesSource} that exposes the {@link KernelConfiguration} as {@link Properties}.
- * <p />
- * Ideally the properties exposed from instances of this object should not be overridden by properties from another
- * source.
- * <p/>
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-final class KernelConfigurationPropertiesSource implements PropertiesSource {
-
- static final String PROPERTY_WORK_DIRECTORY = "work.directory";
-
- static final String PROPERTY_HOME_DIRECTORY = "home.directory";
-
- static final String PROPERTY_DOMAIN = "domain";
-
- static final String KERNEL_CONFIGURATION_PID = "org.eclipse.virgo.kernel";
-
- static final String PROPERTY_KERNEL_STARTUP_WAIT_LIMIT = "org.eclipse.virgo.kernel.startup.wait.limit";
-
- private final KernelConfiguration kernelConfiguration;
-
- public KernelConfigurationPropertiesSource(KernelConfiguration kernelConfiguration) {
- this.kernelConfiguration = kernelConfiguration;
- }
-
- /**
- * {@inheritDoc}
- */
- public Map<String, Properties> getConfigurationProperties() {
- return Collections.singletonMap(KERNEL_CONFIGURATION_PID, createProperties());
- }
-
- private Properties createProperties() {
- Properties properties = new Properties();
- properties.put(PROPERTY_DOMAIN, this.kernelConfiguration.getDomain());
- properties.put(PROPERTY_HOME_DIRECTORY, this.kernelConfiguration.getHomeDirectory().getAbsolutePath());
- properties.put(PROPERTY_WORK_DIRECTORY, this.kernelConfiguration.getWorkDirectory().getAbsolutePath());
- properties.put(PROPERTY_KERNEL_STARTUP_WAIT_LIMIT, Integer.toString(this.kernelConfiguration.getStartupWaitLimit()));
- return properties;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/PropertiesSource.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/PropertiesSource.java
deleted file mode 100644
index 5776157e..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/PropertiesSource.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.util.Map;
-import java.util.Properties;
-
-import org.osgi.service.cm.ConfigurationAdmin;
-
-/**
- * Represents a source for configuration properties. These configuration properties will be exported to
- * {@link ConfigurationAdmin} under the kernel PID.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations must be threadsafe.
- *
- */
-public interface PropertiesSource {
-
- /**
- * Gets all the configuration properties from this source.
- * <p/>
- * Each entry in the map represents one configuration. The entry key is the PID of the configuration, and the entry
- * value is the properties to be exposed under that PID.
- *
- * @return all configuration properties from this source.
- */
- Map<String, Properties> getConfigurationProperties();
-
-}
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
deleted file mode 100644
index 4960654d..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardConfigurationExporter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-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/config/internal/StandardKernelConfig.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardKernelConfig.java
deleted file mode 100644
index 7b71ad64..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardKernelConfig.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 SAP AG
- * 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:
- * SAP AG - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import org.eclipse.virgo.kernel.core.KernelConfig;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * This class is the standard implementation for the KernelConfig interface. It enables access to the configurations provided by the kernel core.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- * Thread safe.
- */
-
-public class StandardKernelConfig implements KernelConfig {
- private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
- ComponentContext context;
-
- protected void activate(ComponentContext context) {
- this.context = context;
- LOGGER.debug("Activating StandardKernelConfig component with properties " + context.getProperties());
- }
-
- protected void deactivate(ComponentContext context) {
- LOGGER.debug("Deactivating StandardKernelConfig component");
- this.context = null;
- }
-
- @Override
- public String getProperty(String name) {
- Object value = this.context.getProperties().get(name);
- LOGGER.debug("KernelConfig.getProperty() is called with name [" + name + "] value is [" + value + "]");
- if (value instanceof String) {
- return (String) value;
- } else if (value instanceof String[] && ((String[]) value).length > 0) {
- return ((String[]) value)[0];
- } else {
- return value.toString();
- }
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/UserConfigurationPropertiesSource.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/UserConfigurationPropertiesSource.java
deleted file mode 100644
index 9745545f..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/UserConfigurationPropertiesSource.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.eclipse.virgo.util.common.StringUtils;
-import org.eclipse.virgo.util.io.FileSystemUtils;
-import org.eclipse.virgo.util.io.IOUtils;
-import org.osgi.framework.Constants;
-import org.osgi.service.cm.ConfigurationAdmin;
-
-/**
- * Implementation of {@link PropertiesSource} that loads all the configuration supplied by the kernel user.
- *
- * <p/>
- *
- * User configuration is loaded from all properties files found in the directories listed in the
- * {@link KernelConfiguration#getConfigDirectories() configuration directories}.
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-final class UserConfigurationPropertiesSource implements PropertiesSource {
-
- private static final String PROPERTIES_FILE_SUFFIX = ".properties";
-
- private static final FilenameFilter PROPERTIES_FILENAME_FILTER = new FilenameFilter() {
-
- public boolean accept(File dir, String name) {
- return name.endsWith(PROPERTIES_FILE_SUFFIX);
- }
- };
-
- private final File[] kernelConfigDirectories;
-
- /**
- * Creates a new <code>UserConfigurationPropertiesSource</code> that loads config files from the supplied user
- * config directories.
- *
- * @param kernelConfigDirectories the directories containing the users kernel config files.
- */
- public UserConfigurationPropertiesSource(File[] kernelConfigDirectories) {
- this.kernelConfigDirectories = kernelConfigDirectories;
- }
-
- /**
- * {@inheritDoc}
- */
- public Map<String, Properties> getConfigurationProperties() {
- Map<String, Properties> result = new TreeMap<String, Properties>();
- for (File dir : this.kernelConfigDirectories) {
- File[] configFiles = getPropertiesFiles(dir);
- for (File file : configFiles) {
- Properties properties = readPropertiesFromFile(file);
-
- String pid = computePid(file, properties, result.keySet());
-
- // Last pid encountered wins; no merging is performed
- result.put(pid, properties);
- }
- }
- return result;
- }
-
- private static File[] getPropertiesFiles(File directory) {
- if (directory.isDirectory()) {
- return FileSystemUtils.listFiles(directory, PROPERTIES_FILENAME_FILTER);
- }
- return new File[0];
- }
-
- private Properties readPropertiesFromFile(File file) {
- if (!file.exists()) {
- return null;
- }
- Properties props = new Properties();
- InputStream is = null;
- try {
- is = new BufferedInputStream(new FileInputStream(file));
- props.load(is);
- } catch (IOException ioe) {
- // silently ignored
- return null;
- } finally {
- IOUtils.closeQuietly(is);
- }
- return props;
- }
-
- private static String createPid(final File file) {
- return trimExtension(file.getName());
- }
-
- private static String trimExtension(final String name) {
- int lpDot = name.lastIndexOf('.');
- return lpDot == -1 ? name : name.substring(0, lpDot);
- }
-
- private String computePid(File file, Properties properties, Set<String> existingPids) {
-
- // check for factory pid in properties
- String pid = properties.getProperty(ConfigurationAdmin.SERVICE_FACTORYPID);
- if (StringUtils.hasText(pid)) {
- // need something unique - so multiple factory pids can be deployed
- return pid + "-" + createPid(file);
- }
- // account for service.pid as a property in the file
- pid = properties.getProperty(Constants.SERVICE_PID);
- if (StringUtils.hasText(pid)) {
- return pid;
- }
- return createPid(file);
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/commandline/CommandLinePropertiesSource.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/commandline/CommandLinePropertiesSource.java
deleted file mode 100644
index eadcec98..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/commandline/CommandLinePropertiesSource.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal.commandline;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.osgi.framework.BundleContext;
-
-
-import org.eclipse.virgo.kernel.config.internal.PropertiesSource;
-import org.eclipse.virgo.kernel.diagnostics.KernelLogEvents;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-
-public final class CommandLinePropertiesSource implements PropertiesSource {
-
- private static final String PROPERTY_USERREGION_COMMANDLINE_ARTIFACTS = "commandLineArtifacts";
-
- private static final String PROPERTY_UNRECOGNIZED_LAUNCHER_ARGUMENTS = "org.eclipse.virgo.osgi.launcher.unrecognizedArguments";
-
- private static final String COMMAND_PREFIX = "-";
-
- private static final String COMMAND_PLAN = "plan";
-
- private static final String PID_KERNEL_REGION = "org.eclipse.virgo.kernel.userregion";
-
- private static final String TEMPLATE_VERSIONED_PLAN_REPOSITORY_URI = "repository:plan/%s/%s";
-
- private static final String TEMPLATE_UNVERSIONED_PLAN_REPOSITORY_URI = "repository:plan/%s";
-
- private final String unrecognizedArguments;
-
- private final EventLogger eventLogger;
-
- public CommandLinePropertiesSource(BundleContext bundleContext, EventLogger eventLogger) {
- this.unrecognizedArguments = bundleContext.getProperty(PROPERTY_UNRECOGNIZED_LAUNCHER_ARGUMENTS);
- this.eventLogger = eventLogger;
- }
-
- public Map<String, Properties> getConfigurationProperties() {
-
- Map<String, Properties> configuration = new HashMap<String, Properties>();
-
- if (this.unrecognizedArguments != null) {
- String[] components = this.unrecognizedArguments.split(",");
-
- List<String> arguments = null;
- String command = null;
-
- for (int i = 0; i < components.length; i++) {
- if (components[i].startsWith(COMMAND_PREFIX)) {
- if (command != null) {
- processCommand(command, arguments, configuration);
- }
- command = components[i].substring(COMMAND_PREFIX.length());
- arguments = new ArrayList<String>();
- } else if (arguments != null) {
- arguments.add(components[i]);
- }
- }
-
- if (command != null) {
- processCommand(command, arguments, configuration);
- }
- }
-
- applyDefaults(configuration);
-
- return configuration;
- }
-
- private void applyDefaults(Map<String, Properties> configuration) {
- Properties properties = getProperties(PID_KERNEL_REGION, configuration);
- String userArtifacts = properties.getProperty(PROPERTY_USERREGION_COMMANDLINE_ARTIFACTS);
- if (userArtifacts == null) {
- properties.put(PROPERTY_USERREGION_COMMANDLINE_ARTIFACTS, "");
- }
- }
-
- private void processCommand(String command, List<String> arguments, Map<String, Properties> configuration) {
- if (COMMAND_PLAN.equals(command)) {
- processPlanCommand(arguments, configuration);
- }
- }
-
- private void processPlanCommand(List<String> arguments, Map<String, Properties> configuration) {
- String repositoryUri = null;
-
- if (arguments.size() == 1) {
- repositoryUri = String.format(TEMPLATE_UNVERSIONED_PLAN_REPOSITORY_URI, arguments.get(0));
- } else if (arguments.size() == 2) {
- repositoryUri = String.format(TEMPLATE_VERSIONED_PLAN_REPOSITORY_URI, arguments.get(0), arguments.get(1));
- } else {
- this.eventLogger.log(KernelLogEvents.KERNEL_PLAN_ARGUMENTS_INCORRECT, arguments.size(), formatArgumentList(arguments));
- }
-
- if (repositoryUri != null) {
- Properties properties = getProperties(PID_KERNEL_REGION, configuration);
- appendProperty(PROPERTY_USERREGION_COMMANDLINE_ARTIFACTS, repositoryUri, properties);
- }
- }
-
- private String formatArgumentList(List<String> arguments) {
- if (arguments.size() == 0) {
- return "";
- }
-
- StringBuilder argumentsBuilder = new StringBuilder();
-
- for (int i = 0; i < arguments.size(); i++) {
- argumentsBuilder.append(arguments.get(i));
- if ((i + 1) < arguments.size()) {
- argumentsBuilder.append(", ");
- }
- }
-
- return argumentsBuilder.toString();
- }
-
- private Properties getProperties(String pid, Map<String, Properties> configuration) {
- Properties properties = configuration.get(pid);
- if (properties == null) {
- properties = new Properties();
- configuration.put(pid, properties);
- }
- return properties;
- }
-
- private void appendProperty(String key, String value, Properties properties) {
- String property = properties.getProperty(key);
- if (property != null) {
- property = property + "," + value;
- } else {
- property = value;
- }
- properties.put(key, property);
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfEnvironmentPropertiesReader.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfEnvironmentPropertiesReader.java
deleted file mode 100644
index 2457605a..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfEnvironmentPropertiesReader.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal.ovf;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Simple reader class that reads all properties contained in the <code>PropertySection</code> of an OVF environment
- * document.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe
- *
- */
-final class OvfEnvironmentPropertiesReader {
-
- private static final String ATTRIBUTE_VALUE = "value";
-
- private static final String ATTRIBUTE_KEY = "key";
-
- private static final String ELEMENT_PROPERTY = "Property";
-
- private static final String NAMESPACE_ENVIRONMENT = "http://schemas.dmtf.org/ovf/environment/1";
-
- /**
- * Reads all the properties from the OVF whose content is accessible using the supplied {@link Reader}.
- *
- * @param documentReader the reader for the OVF document.
- * @return the properties contained in the OVF document.
- */
- public Properties readProperties(Reader documentReader) {
- Properties result = new Properties();
- Document doc = readDocument(documentReader);
- parseProperties(doc, result);
- return result;
- }
-
- private void parseProperties(Document doc, Properties result) {
- NodeList propertyElements = doc.getElementsByTagNameNS(NAMESPACE_ENVIRONMENT, ELEMENT_PROPERTY);
- for (int x = 0; x < propertyElements.getLength(); x++) {
- Element propertyElement = (Element) propertyElements.item(x);
- String key = propertyElement.getAttributeNS(NAMESPACE_ENVIRONMENT, ATTRIBUTE_KEY);
- String value = propertyElement.getAttributeNS(NAMESPACE_ENVIRONMENT, ATTRIBUTE_VALUE);
- result.setProperty(key, value);
- }
- }
-
- private Document readDocument(Reader documentReader) {
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder builder = factory.newDocumentBuilder();
- return builder.parse(new InputSource(documentReader));
- } catch (ParserConfigurationException e) {
- throw new OvfParseException("Error configuring XML parser.", e);
- } catch (SAXException e) {
- throw new OvfParseException("Error parsing OVF XML document.", e);
- } catch (IOException e) {
- throw new OvfParseException("Error reading OVF XML document.", e);
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfParseException.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfParseException.java
deleted file mode 100644
index 19569399..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfParseException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal.ovf;
-
-/**
- * Indicates an exception when parsing an OVF document.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-final class OvfParseException extends RuntimeException {
-
- private static final long serialVersionUID = 8134710938140233L;
-
- public OvfParseException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfPropertiesSource.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfPropertiesSource.java
deleted file mode 100644
index 304d2d57..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfPropertiesSource.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal.ovf;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.osgi.framework.BundleContext;
-
-
-import org.eclipse.virgo.kernel.config.internal.PropertiesSource;
-import org.eclipse.virgo.kernel.diagnostics.KernelLogEvents;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.util.io.IOUtils;
-
-/**
- * Implementation of {@link PropertiesSource} that reads properties from an OVF document.
- * <p />
- * The path to the OVF document is specified using the <code>org.eclipse.virgo.kernel.config.ovf</code> framework
- * property.
- * <p/>
- * In order for a property in the OVF document to be exported to OVF its key should have the following format: <br/>
- *
- * <pre>
- * cm:&lt;pid&gt;:&lt;property-name&gt;
- * </pre>
- *
- * Any property keys not starting with the <code>cm:</code> prefix are not exported to config admin. Further, any
- * <code>cm:</code> properties not having both and PID and and name portion will cause an exception.
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-public final class OvfPropertiesSource implements PropertiesSource {
-
- static final String FRAMEWORK_PROPERTY_OVF = "org.eclipse.virgo.kernel.config.ovf";
-
- private static final String PROPERTY_PREFIX = "cm:";
-
- private static final String PROPERTY_DELIMITER = ":";
-
- private final BundleContext bundleContext;
-
- private final EventLogger eventLogger;
-
- public OvfPropertiesSource(BundleContext bundleContext, EventLogger eventLogger) {
- this.bundleContext = bundleContext;
- this.eventLogger = eventLogger;
- }
-
- /**
- * {@inheritDoc}
- */
- public Map<String, Properties> getConfigurationProperties() {
- Properties sourceProperties = readSourceProperties();
- if (sourceProperties != null) {
- return translateProperties(sourceProperties);
- } else {
- return null;
- }
- }
-
- private Map<String, Properties> translateProperties(Properties sourceProperties) {
- Map<String, Properties> result = new HashMap<String, Properties>();
- Set<String> propertyNames = sourceProperties.stringPropertyNames();
- for (String propertyName : propertyNames) {
- ConfigAdminProperty prop = tryReadConfigAdminProperty(propertyName);
- if(prop != null) {
- Properties p = result.get(prop.pid);
- if(p == null) {
- p = new Properties();
- result.put(prop.pid, p);
- }
- p.setProperty(prop.key, sourceProperties.getProperty(propertyName));
- }
- }
- return result;
- }
-
- /**
- * Attempts to convert a property name into a valid configuration admin property based on the format laid out in
- * {@link OvfPropertiesSource}.
- *
- * @param propertyName the unparsed property name
- * @return a {@link ConfigAdminProperty} or <code>null</code> if the property is not prefixed with <code>cm:</code>
- */
- private ConfigAdminProperty tryReadConfigAdminProperty(String propertyName) {
- ConfigAdminProperty result = null;
- if(propertyName.startsWith(PROPERTY_PREFIX)) {
- String parsed = propertyName.substring(PROPERTY_PREFIX.length());
- String[] components = parsed.split(PROPERTY_DELIMITER);
- if(components.length != 2) {
- throw new IllegalArgumentException("Invalid configuration admin property '" + propertyName + "' found in OVF.");
- } else {
- result = new ConfigAdminProperty();
- result.pid = components[0];
- result.key = components[1];
- }
- }
- return result;
- }
-
- private Properties readSourceProperties() {
- Properties result = null;
- File ovfFile = determineOvfFile();
- if (ovfFile != null) {
- if (!ovfFile.exists()) {
- this.eventLogger.log(KernelLogEvents.OVF_CONFIGURATION_FILE_DOES_NOT_EXIST, ovfFile.getAbsolutePath());
- } else {
- result = readOvfFile(ovfFile);
- }
-
- }
- return result;
- }
-
- private File determineOvfFile() {
- File result = null;
-
- String path = this.bundleContext.getProperty(FRAMEWORK_PROPERTY_OVF);
- if (path != null) {
- result = new File(path);
- }
-
- return result;
- }
-
- private Properties readOvfFile(File ovfFile) {
- Properties result = null;
- Reader reader = null;
- try {
- reader = new FileReader(ovfFile);
- OvfEnvironmentPropertiesReader ovfReader = new OvfEnvironmentPropertiesReader();
- result = ovfReader.readProperties(reader);
- } catch (IOException ex) {
- this.eventLogger.log(KernelLogEvents.OVF_READ_ERROR, ex, ovfFile.getAbsolutePath());
- } finally {
- IOUtils.closeQuietly(reader);
- }
- return result;
- }
-
- private static class ConfigAdminProperty {
-
- String pid;
-
- String key;
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java
deleted file mode 100644
index 7519e5bd..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-/**
- * {@link AbortableSignal} is an interface for signalling successful or unsuccessful completion.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this class must be thread safe.
- *
- */
-public interface AbortableSignal extends Signal {
-
- /**
- * Notifies the abortion of this Signal, there has been no error but the signal will not complete.
- * If signalFailure or signalCompletion has already been called, the behaviour is undefined.
- */
- void signalAborted();
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingAbortableSignal.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingAbortableSignal.java
deleted file mode 100644
index 260ca0e1..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingAbortableSignal.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-package org.eclipse.virgo.kernel.core;
-
-import java.util.concurrent.TimeUnit;
-
-
-/**
- * <p>
- * A <code>Signal</code> implementation that blocks until notified of completion or abortion.
- * </p>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-public final class BlockingAbortableSignal implements AbortableSignal {
-
- private volatile boolean aborted = false;
-
- private final BlockingSignal blockingSignal;
-
- public BlockingAbortableSignal() {
- this.blockingSignal = new BlockingSignal();
- }
-
- /**
- * {@inheritDoc}
- */
- public void signalSuccessfulCompletion() {
- this.blockingSignal.signalSuccessfulCompletion();
- }
-
- /**
- * {@inheritDoc}
- */
- public void signalFailure(final Throwable cause) {
- this.blockingSignal.signalFailure(cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public void signalAborted() {
- this.aborted = true;
- this.blockingSignal.signalSuccessfulCompletion();
- }
-
- public boolean isAborted(){
- return this.aborted;
- }
-
- public boolean awaitCompletion(long period, TimeUnit timeUnit) throws FailureSignalledException {
- boolean complete = this.blockingSignal.awaitCompletion(period, timeUnit);
- if(aborted){
- return false;
- }
- return complete;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingSignal.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingSignal.java
deleted file mode 100644
index 48560a4e..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingSignal.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-
-/**
- * A <code>Signal</code> implementation that blocks until notified of completion.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-public final class BlockingSignal implements Signal {
-
- private final CountDownLatch latch = new CountDownLatch(1);
-
- private final AtomicReference<Throwable> failure = new AtomicReference<Throwable>();
-
- /**
- * {@inheritDoc}
- */
- public void signalFailure(Throwable cause) {
- this.failure.set(cause);
- this.latch.countDown();
- }
-
- /**
- * {@inheritDoc}
- */
- public void signalSuccessfulCompletion() {
- this.latch.countDown();
- }
-
- public boolean awaitCompletion(long period, TimeUnit timeUnit) throws FailureSignalledException {
- try {
- if (!latch.await(period, timeUnit)) {
- return false;
- } else {
- Throwable failure = this.failure.get();
- if (failure != null) {
- throw new FailureSignalledException(failure);
- } else {
- return true;
- }
- }
- } catch (InterruptedException e) {
- throw new FailureSignalledException(e);
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java
deleted file mode 100644
index f02d90b8..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-
-/**
- * Provides a mechanism to start {@link Bundle bundles}, and wait until the <code>Bundle</code> is started, including
- * any asynchronous creation of an application context.
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations <strong>must</strong> be thread safe.
- *
- */
-public interface BundleStarter {
-
- /**
- * Starts the supplied {@link Bundle}, driving the supplied signal upon successful or unsuccessful completion
- * of start processing. If the <code>Bundle</code> constructs an application context, then the
- * signal will not be driven until application context construction has completed.
- *
- * @param bundle the <code>Bundle</code> to start.
- * @param signal the <code>Signal</code> to drive.
- * @throws BundleException if Bundle {@link Bundle#start()} fails
- */
- void start(Bundle bundle, AbortableSignal signal) throws BundleException;
-
- /**
- * Starts the supplied {@link Bundle}, driving the supplied signal upon successful or unsuccessful completion
- * of start processing. If the <code>Bundle</code> constructs an application context, then the
- * signal will not be driven until application context construction has completed. The supplied <code>options</code>
- * are passed to the <code>bundle</code>'s {@link Bundle#start() start} method.
- *
- * @param bundle the <code>Bundle</code> to start.
- * @param options the options to be passed to the bundle's {@link Bundle#start() start} method.
- * @param signal the <code>Signal</code> to drive.
- * @throws BundleException
- */
- void start(Bundle bundle, int options, AbortableSignal signal) throws BundleException;
-
- /**
- * Apply tracking to the given <code>Bundle</code> using the given <code>Signal</code> but don't actually start it.
- *
- * @param bundle the <code>Bundle</code> to track.
- * @param signal the <code>Signal</code> to be notified.
- */
- void trackStart(Bundle bundle, AbortableSignal signal);
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleUtils.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleUtils.java
deleted file mode 100644
index 8f66b75d..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleUtils.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.springframework.osgi.extender.support.ApplicationContextConfiguration;
-
-import org.eclipse.virgo.util.common.StringUtils;
-
-
-/**
- * <code>BundleUtils</code> provides utility methods for interacting with {@link Bundle Bundles}.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- * Thread-safe
- *
- */
-public final class BundleUtils {
-
- /**
- * Queries whether the supplied {@link Bundle} is Spring-DM powered.
- *
- * @param bundle the <code>Bundle</code>.
- * @return <code>true</code> if the <code>Bundle</code> is Spring-DM powered, otherwise <code>false</code>.
- */
- public static boolean isSpringOsgiPoweredBundle(Bundle bundle) {
- return new ApplicationContextConfiguration(bundle).isSpringPoweredBundle();
- }
-
- /**
- * Queries whether the supplied {@link Bundle} is a fragment
- *
- * @param bundle the <code>Bundle</code>.
- * @return <code>true</code> if the <code>Bundle</code> is fragment, otherwise <code>false</code>.
- */
- // TODO Move this method into utils project
- public static boolean isFragmentBundle(Bundle bundle) {
- String fragmentHostHeader = (String) bundle.getHeaders().get(Constants.FRAGMENT_HOST);
- return StringUtils.hasText(fragmentHostHeader);
- }
-
-
-}
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
deleted file mode 100644
index 86673d1c..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/ConfigurationExporter.java
+++ /dev/null
@@ -1,24 +0,0 @@
-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/java/org/eclipse/virgo/kernel/core/FailureSignalledException.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/FailureSignalledException.java
deleted file mode 100644
index d3aa8b34..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/FailureSignalledException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-
-/**
- * A <code>FailureSignalledException</code> is used to indicate that a {@link BlockingSignal}
- * has received a failure signal.
- *
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe
- *
- */
-public final class FailureSignalledException extends Exception {
-
- private static final long serialVersionUID = -8980489442577132319L;
-
- /**
- * Creates a new <code>FailureSignalledException</code> with the supplied failure
- * <code>cause</code>.
- *
- * @param cause the cause of the failure
- */
- public FailureSignalledException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/FatalKernelException.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/FatalKernelException.java
deleted file mode 100644
index 7c9197a1..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/FatalKernelException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-import org.eclipse.virgo.kernel.serviceability.FatalServerException;
-
-//TODO: merge this with FatalServerException
-/**
- * Signals an internal error in the kernel.<p/>
- *
- * <strong>Concurrent Semantics</strong><br/>
- *
- * Threadsafe.
- *
- */
-public class FatalKernelException extends FatalServerException {
-
- private static final long serialVersionUID = 5023385710047479850L;
-
- /**
- * Creates a new <code>FatalKernelException</code>.
- *
- * @param message the error message.
- */
- public FatalKernelException(String message) {
- super(message);
- }
-
- /**
- * Creates a new <code>FatalKernelException</code>.
- *
- * @param message the error message.
- * @param cause the root cause.
- */
- public FatalKernelException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java
deleted file mode 100644
index a69feec8..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 SAP AG
- * 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:
- * SAP AG - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-/**
- *
- * Interface defining a way to access kernel's configuration.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- * The implementations of this interface must be thread safe.
- */
-public interface KernelConfig {
-
- /**
- * Obtains the specified property from the ConfigAdmin's configuration provided by the core bundle.
- * @param name - the name of the wanted property
- * @return the property's value
- */
- public String getProperty(String name);
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelException.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelException.java
deleted file mode 100644
index 880bab8c..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-/**
- * Signals an error detected by the kernel.
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br/>
- *
- * Threadsafe.
- *
- */
-public class KernelException extends Exception {
-
- private static final long serialVersionUID = -8441774467715137666L;
-
- /**
- * Creates a new {@link KernelException}.
- *
- * @param message the error message.
- */
- public KernelException(String message) {
- super(message);
- }
-
- /**
- * Creates a new {@link KernelException}.
- *
- * @param message the error message.
- * @param cause the root cause.
- */
- public KernelException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/Shutdown.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/Shutdown.java
deleted file mode 100644
index a11a1d78..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/Shutdown.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-import javax.management.MXBean;
-
-/**
- * Shutdown control mechanism. Calling {@link #shutdown()} will shut the kernel down gracefully whereas
- * {@link #immediateShutdown()} will kill the kernel immediately without performing any cleanup actions.
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- * Implementations are <strong>required</strong> to be thread-safe.
- *
- */
-@MXBean
-public interface Shutdown {
-
- /**
- * Shuts down the Server immediately.
- */
- void immediateShutdown();
-
- /**
- * Shuts down the server in a graceful manner thereby minimising processing required during a subsequent restart.
- */
- void shutdown();
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/Signal.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/Signal.java
deleted file mode 100644
index ea49b51a..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/Signal.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core;
-
-/**
- * {@link Signal} is an interface for signalling successful or unsuccessful completion.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this class must be thread safe.
- *
- */
-public interface Signal {
-
- /**
- * Notifies successful completion. If signalFailure has already been called, the behaviour is undefined.
- */
- void signalSuccessfulCompletion();
-
- /**
- * Notifies unsuccessful completion with the given {@link Throwable}. If signalCompletion has already been called,
- * the behaviour is undefined.
- *
- * @param cause a <code>Throwable</code> describing the cause of unsuccessful completion
- */
- void signalFailure(Throwable cause);
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/AsyncShutdownDecorator.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/AsyncShutdownDecorator.java
deleted file mode 100644
index 3f253063..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/AsyncShutdownDecorator.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import org.eclipse.virgo.kernel.core.Shutdown;
-
-/**
- * Decorator for a {@link Shutdown} implementation that performs all operations asynchronously.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-final class AsyncShutdownDecorator implements Shutdown {
-
- private static final String THREAD_NAME = "kernel-shutdown";
- private final Shutdown delegate;
-
- public AsyncShutdownDecorator(Shutdown delegate) {
- this.delegate = delegate;
- }
-
- /**
- * {@inheritDoc}
- */
- public void immediateShutdown() {
- new Thread(new Runnable() {
-
- public void run() {
- AsyncShutdownDecorator.this.delegate.immediateShutdown();
- }
-
- }, THREAD_NAME).start();
- }
-
- /**
- * {@inheritDoc}
- */
- public void shutdown() {
- new Thread(new Runnable() {
-
- public void run() {
- AsyncShutdownDecorator.this.delegate.shutdown();
- }
-
- }, THREAD_NAME).start();
-
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java
deleted file mode 100644
index 9c57156d..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.virgo.kernel.core.AbortableSignal;
-import org.eclipse.virgo.kernel.core.BundleUtils;
-import org.eclipse.virgo.kernel.core.Signal;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.SynchronousBundleListener;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.core.task.TaskExecutor;
-import org.springframework.osgi.extender.support.ApplicationContextConfiguration;
-
-
-/**
- * <code>BundleStartTracker</code> tracks the startup of bundles, including any asynchronous portion of the startup,
- * notifying a {@link Signal} upon completion (successful or otherwise).
- *
- * <p/>
- *
- * <strong>Note</strong> if the synchronous portion of startup fails, i.e. {@link Bundle#start()} does not return
- * successfully the <code>Signal</code> is <strong>not</strong> driven and it is the responsibility of the caller of
- * <code>start</code> to handle the failure.
- *
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-final class BundleStartTracker implements EventHandler {
-
- private static final String TOPIC_BLUEPRINT_EVENTS = "org/osgi/service/blueprint/container/";
-
- private static final String EVENT_REGION_STARTING = "org/eclipse/virgo/kernel/region/STARTING";
-
- private static final String EVENT_CREATED = TOPIC_BLUEPRINT_EVENTS + "CREATED";
-
- private static final String EVENT_FAILURE = TOPIC_BLUEPRINT_EVENTS + "FAILURE";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(BundleStartTracker.class);
-
- private final Object monitor = new Object();
-
- private final List<Bundle> bundlesWithCreatedApplicationContexts = new ArrayList<Bundle>();
-
- private final Map<Bundle, Throwable> failureMap = new HashMap<Bundle, Throwable>();
-
- private final Map<Bundle, List<AbortableSignal>> signalMap = new HashMap<Bundle, List<AbortableSignal>>();
-
- private final BundleListener bundleListener = new StartupTrackerBundleListener();
-
- private final TaskExecutor signalExecutor;
-
- BundleStartTracker(TaskExecutor signalExecutor) {
- this.signalExecutor = signalExecutor;
- }
-
- void initialize(BundleContext bundleContext) {
- bundleContext.addBundleListener(this.bundleListener);
- }
-
- private void recordApplicationContextCreation(Bundle bundle) {
- LOGGER.info("Recording created application context for bundle '{}'", bundle);
-
- synchronized (this.monitor) {
- this.bundlesWithCreatedApplicationContexts.add(bundle);
- }
- }
-
- private void driveSignalsIfStartCompleted(Bundle bundle, boolean springDmPowered) {
-
- List<AbortableSignal> signals = null;
- Throwable failure = null;
- boolean isActive = isBundleActive(bundle);
-
- synchronized (this.monitor) {
- if (springDmPowered) {
- boolean created = this.bundlesWithCreatedApplicationContexts.contains(bundle);
- failure = this.failureMap.get(bundle);
-
- if (created && failure != null) {
- throw new IllegalStateException("Spring DM has notified an application context both successfully constructed and failed: " + failure);
- }
-
- if (created) {
- LOGGER.info("Bundle '{}' has started and its application context is available", bundle);
- signals = this.signalMap.remove(bundle);
- } else if (failure != null) {
- LOGGER.info("Bundle '{}' failed to start, the failure was '{}'", bundle, failure);
- signals = this.signalMap.remove(bundle);
- }
- }
- else {
- if (isActive) {
- signals = this.signalMap.remove(bundle);
- }
- }
- }
- // signals to drive
- if (signals != null) {
- if (!springDmPowered && isActive) {
- LOGGER.info("Non-Spring DM powered bundle '{}' has started. Driving signals '{}'.", bundle, signals);
- driveSignals(signals, false, null);
- }
- else {
- driveSignals(signals, false, failure);
- }
- }
- }
-
- private void driveSignals(final List<AbortableSignal> signals, final boolean aborted, final Throwable cause) {
- this.signalExecutor.execute(new Runnable() {
- public void run() {
- for (AbortableSignal signal : signals) {
- LOGGER.info("Driving signal '{}'", signal);
- if (aborted){
- signal.signalAborted();
- } else if (cause == null) {
- signal.signalSuccessfulCompletion();
- } else {
- signal.signalFailure(cause);
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void handleEvent(Event event) {
-
- LOGGER.info("Handling event '{}'", event);
-
- Throwable cause = null;
- List<AbortableSignal> signals = null;
-
- Bundle bundle = (Bundle) event.getProperty("bundle");
- if (EVENT_FAILURE.equals(event.getTopic())) {
- cause = (Throwable) event.getProperty("exception");
- if (cause != null) {
- synchronized (this.monitor) {
- LOGGER.error("Recording application context construction failure '{}' for bundle '{}'", cause, bundle);
- this.failureMap.put(bundle, cause);
- signals = this.signalMap.remove(bundle);
- }
- }
- } else if (EVENT_CREATED.equals(event.getTopic())) {
- synchronized (this.monitor) {
- recordApplicationContextCreation(bundle);
- signals = this.signalMap.remove(bundle);
- }
- } else if (EVENT_REGION_STARTING.equals(event.getTopic())) {
- initialize((BundleContext) event.getProperty("region.bundleContext"));
- }
-
- if (signals != null) {
- driveSignals(signals, false, cause);
- }
- }
-
- public void trackStart(Bundle bundle, AbortableSignal signal) {
- if (BundleUtils.isFragmentBundle(bundle)) {
- throw new IllegalArgumentException("Cannot track the start of a fragment bundle.");
- }
-
- boolean springDmPowered = isSpringDmPoweredBundle(bundle);
-
- boolean bundleActive = isBundleActive(bundle);
-
- if (signal != null) {
- if (springDmPowered || !bundleActive) {
- List<AbortableSignal> queue;
- synchronized (this.monitor) {
- queue = this.signalMap.get(bundle);
- if (queue == null) {
- queue = new ArrayList<AbortableSignal>();
- this.signalMap.put(bundle, queue);
- }
- LOGGER.info("Adding signal '{}' for bundle '{}'", signal, bundle);
- queue.add(signal);
- }
- } else {
- // !springDmPowered && bundleActive
- driveSignals(Arrays.asList(signal), false, null);
- }
- }
- driveSignalsIfStartCompleted(bundle, springDmPowered);
- }
-
- private static boolean isBundleActive(Bundle bundle) {
- if (bundle!=null) {
- return ( bundle.getState() == Bundle.ACTIVE );
- }
- return false;
- }
-
- private static boolean isSpringDmPoweredBundle(Bundle bundle) {
- ApplicationContextConfiguration springDmConfiguration = new ApplicationContextConfiguration(bundle);
- boolean springDmPowered = springDmConfiguration.isSpringPoweredBundle();
- return springDmPowered;
- }
-
- private final class StartupTrackerBundleListener implements SynchronousBundleListener {
-
- private Boolean isLazyBundle = false;
-
- /**
- * {@inheritDoc}
- */
- public void bundleChanged(BundleEvent event) {
- Bundle bundle = event.getBundle();
- if (event.getType() == BundleEvent.STARTED) {
- List<AbortableSignal> signals = null;
- if (!isSpringDmPoweredBundle(bundle)) {
- synchronized (BundleStartTracker.this.monitor) {
- signals = BundleStartTracker.this.signalMap.remove(bundle);
- }
- if (signals != null) {
- LOGGER.info("Non-Spring DM powered bundle '{}' has started. Driving signals '{}'.", bundle, signals);
- driveSignals(signals, false, null);
- }
- }
- }
- if (event.getType() == BundleEvent.LAZY_ACTIVATION) {
- this.isLazyBundle = true;
- LOGGER.info("Bundle '{}' has lazy activation and is in the starting state.", bundle);
- }
- if (event.getType() == BundleEvent.STOPPED) {
- LOGGER.info("Bundle '{}' has stopped. Removing its related tracking state.", bundle);
- BundleStartTracker.this.cleanup(bundle, this.isLazyBundle, this.isLazyBundle ? null : new RuntimeException("Bundle '" + bundle + "' stopped"));
- }
- }
- }
-
- /**
- * Remove tracking state associated with this bundle
- * @param bundle whose tracking state is removed
- * @param cause reason for cleaning up
- */
- public void cleanup(Bundle bundle, boolean aborted, Throwable cause) {
- List<AbortableSignal> danglingSignals = null;
- synchronized (BundleStartTracker.this.monitor) {
- if (bundle != null) {
- BundleStartTracker.this.bundlesWithCreatedApplicationContexts.remove(bundle);
- BundleStartTracker.this.failureMap.remove(bundle);
- danglingSignals = BundleStartTracker.this.signalMap.remove(bundle);
- }
- }
- if (danglingSignals != null) {
- driveSignals(danglingSignals, aborted, cause);
- }
- }
-
- /**
- *
- */
- public void stop() {
- if (this.signalExecutor instanceof DisposableBean) {
- try {
- ((DisposableBean) this.signalExecutor).destroy();
- } catch (Exception e) {
- LOGGER.debug("Failure when attempting to destroy signal executor", e);
- }
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java
deleted file mode 100644
index 833ee2b8..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import java.lang.management.ManagementFactory;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.JMException;
-import javax.management.MBeanRegistrationException;
-import javax.management.MBeanServer;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.eclipse.virgo.kernel.config.internal.ConfigurationInitialiser;
-import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
-import org.eclipse.virgo.kernel.core.BundleStarter;
-import org.eclipse.virgo.kernel.core.Shutdown;
-import org.eclipse.virgo.kernel.core.internal.blueprint.ApplicationContextDependencyMonitor;
-import org.eclipse.virgo.kernel.serviceability.dump.internal.RegionDigraphDumpContributor;
-import org.eclipse.virgo.kernel.serviceability.dump.internal.ResolutionDumpContributor;
-import org.eclipse.virgo.kernel.shim.scope.ScopeFactory;
-import org.eclipse.virgo.kernel.shim.scope.internal.StandardScopeFactory;
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.eclipse.virgo.kernel.shim.serviceability.internal.Slf4jTracingService;
-import org.eclipse.virgo.medic.dump.DumpContributor;
-import org.eclipse.virgo.medic.dump.DumpGenerator;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.launch.Framework;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.event.EventConstants;
-import org.osgi.service.event.EventHandler;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-/**
- * ComponentContext activator that initialises the core of the Kernel.
- *
- * <strong>Concurrent Semantics</strong><br />
- * Threadsafe.
- *
- */
-public class CoreBundleActivator {
-
- private static final String START_SIGNALLING_THREAD_NAME_PREFIX = "start-signalling-";
-
- private static final String PROPERTY_NAME_SERVICE_SCOPE = "org.eclipse.virgo.service.scope";
-
- private static final String SERVICE_SCOPE_GLOBAL = "global";
-
- private static final String EVENT_TOPIC_BLUEPRINT_CONTAINER = "org/osgi/service/blueprint/container/*";
-
- private static final String EVENT_TOPIC_REGION = "org/eclipse/virgo/kernel/region/*";
-
- private static final String MBEAN_VALUE_SHUTDOWN = "Shutdown";
-
- private static final String MBEAN_KEY_TYPE = "type";
-
- private final ServiceRegistrationTracker tracker = new ServiceRegistrationTracker();
-
- private final ConfigurationInitialiser configurationInitialiser = new ConfigurationInitialiser();
-
- private volatile StartupTracker startupTracker;
-
- private volatile ObjectInstance shutdownMBean;
-
- private volatile ApplicationContextDependencyMonitor dependencyMonitor;
-
- private volatile BundleStartTracker bundleStartTracker;
-
- public void activate(ComponentContext componentContext) throws Exception {
- BundleContext context = componentContext.getBundleContext();
-
- EventLogger eventLogger = getRequiredService(context, EventLogger.class);
-
- KernelConfiguration configuration = this.configurationInitialiser.start(context, eventLogger);
- Shutdown shutdown = initializeShutdownManager(context, eventLogger, configuration);
-
- this.bundleStartTracker = createAndRegisterBundleStartTracker(context);
- createAndRegisterBundleStarter(this.bundleStartTracker, context);
-
- this.dependencyMonitor = createAndRegisterApplicationContextDependencyMonitor(context, eventLogger);
-
- DumpGenerator dumpGenerator = getRequiredService(context, DumpGenerator.class);
-
- createAndRegisterStateDumpContributors(context);
-
- this.startupTracker = new StartupTracker(context, configuration, configuration.getStartupWaitLimit(), bundleStartTracker, shutdown, dumpGenerator);
- this.startupTracker.start();
-
- initShimServices(context, eventLogger);
- }
-
- private void createAndRegisterStateDumpContributors(BundleContext context) {
- this.tracker.track(context.registerService(DumpContributor.class, new ResolutionDumpContributor(context), null));
- this.tracker.track(context.registerService(DumpContributor.class, new RegionDigraphDumpContributor(context), null));
- }
-
- private ApplicationContextDependencyMonitor createAndRegisterApplicationContextDependencyMonitor(BundleContext context, EventLogger eventLogger) {
- ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(1, new ThreadFactory() {
- private AtomicLong threadCount = new AtomicLong(1);
-
- public Thread newThread(Runnable r) {
- String name = "service-monitor-thread-" + this.threadCount.getAndIncrement();
- return new Thread(r, name);
- }
- });
-
- ApplicationContextDependencyMonitor dependencyMonitor = new ApplicationContextDependencyMonitor(scheduledExecutor, eventLogger);
-
- Dictionary<String, String> properties = new Hashtable<String, String>();
- properties.put(EventConstants.EVENT_TOPIC, EVENT_TOPIC_BLUEPRINT_CONTAINER);
-
- this.tracker.track(context.registerService(EventHandler.class.getName(), dependencyMonitor, properties));
-
- return dependencyMonitor;
- }
-
- @SuppressWarnings("unchecked")
- private BundleStartTracker createAndRegisterBundleStartTracker(BundleContext context) {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setThreadNamePrefix(START_SIGNALLING_THREAD_NAME_PREFIX);
- executor.setQueueCapacity(0);
- executor.initialize();
-
- BundleStartTracker asynchronousStartTracker = new BundleStartTracker(executor);
- asynchronousStartTracker.initialize(context);
-
- Dictionary properties = new Hashtable();
- properties.put(EventConstants.EVENT_TOPIC, new String[] {EVENT_TOPIC_BLUEPRINT_CONTAINER, EVENT_TOPIC_REGION});
-
- this.tracker.track(context.registerService(new String[] {EventHandler.class.getName()}, asynchronousStartTracker, properties));
-
- return asynchronousStartTracker;
- }
-
- @SuppressWarnings("unchecked")
- private BundleStarter createAndRegisterBundleStarter(BundleStartTracker asynchronousStartTracker, BundleContext bundleContext) {
-
- StandardBundleStarter bundleStarter = new StandardBundleStarter(asynchronousStartTracker);
- Dictionary properties = new Hashtable();
- properties.put(PROPERTY_NAME_SERVICE_SCOPE, SERVICE_SCOPE_GLOBAL);
-
- this.tracker.track(bundleContext.registerService(new String[] {BundleStarter.class.getName()}, bundleStarter, properties));
-
- return bundleStarter;
- }
-
- public void deactivate(ComponentContext context) throws Exception {
- this.tracker.unregisterAll();
- this.startupTracker.stop();
- this.configurationInitialiser.stop();
-
- unregisterShutdownMBean();
-
- ApplicationContextDependencyMonitor dependencyMonitor = this.dependencyMonitor;
- if (dependencyMonitor != null) {
- this.dependencyMonitor = null;
- dependencyMonitor.stop();
- }
-
- BundleStartTracker bundleStartTracker = this.bundleStartTracker;
- if (bundleStartTracker != null) {
- this.bundleStartTracker = null;
- bundleStartTracker.stop();
- }
- }
-
- private Shutdown initializeShutdownManager(BundleContext context, EventLogger eventLogger, KernelConfiguration configuration) {
- Shutdown shutdown = createShutdown(context, eventLogger);
- this.tracker.track(context.registerService(org.eclipse.virgo.kernel.core.Shutdown.class.getName(), shutdown, null));
-
- registerShutdownMBean(configuration, shutdown);
- return shutdown;
- }
-
- private void registerShutdownMBean(KernelConfiguration configuration, Shutdown shutdown) {
- MBeanServer server = ManagementFactory.getPlatformMBeanServer();
-
- try {
- ObjectName shutdownName = ObjectName.getInstance(configuration.getDomain(), MBEAN_KEY_TYPE, MBEAN_VALUE_SHUTDOWN);
- this.shutdownMBean = server.registerMBean(new AsyncShutdownDecorator(shutdown), shutdownName);
- } catch (JMException ex) {
- throw new IllegalStateException("Unable to register Shutdown MBean", ex);
- }
- }
-
- private void unregisterShutdownMBean() throws MBeanRegistrationException, InstanceNotFoundException {
- ObjectInstance localShutdownMBean = this.shutdownMBean;
- if (localShutdownMBean != null) {
- ManagementFactory.getPlatformMBeanServer().unregisterMBean(localShutdownMBean.getObjectName());
- this.shutdownMBean = null;
- }
- }
-
- protected Shutdown createShutdown(BundleContext context, EventLogger eventLogger) {
- Framework framework = (Framework) context.getBundle(0);
-
- ShutdownManager manager = new ShutdownManager(eventLogger, framework);
- return manager;
- }
-
- private void initShimServices(BundleContext context, EventLogger eventLogger) {
- ScopeFactory scopeFactory = new StandardScopeFactory(eventLogger);
- TracingService tracingService = new Slf4jTracingService();
- this.tracker.track(context.registerService(ScopeFactory.class.getName(), scopeFactory, null));
- this.tracker.track(context.registerService(TracingService.class.getName(), tracingService, null));
- }
-
- @SuppressWarnings("unchecked")
- private <T> T getRequiredService(BundleContext context, Class<T> clazz) {
- T result = null;
- ServiceReference ref = context.getServiceReference(clazz.getName());
- if (ref != null) {
- result = (T) context.getService(ref);
- }
- if (result == null) {
- throw new IllegalStateException("Unable to access required service of type '" + clazz.getName() + "' from bundle '"
- + context.getBundle().getSymbolicName() + "'");
- }
- return result;
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/KernelStatus.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/KernelStatus.java
deleted file mode 100644
index 40bdccb8..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/KernelStatus.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-final class KernelStatus implements KernelStatusMBean {
-
- static final String STATUS_STARTING = "STARTING";
-
- static final String STATUS_STARTED = "STARTED";
-
- private volatile String status = STATUS_STARTING;
-
- public String getStatus() {
- return this.status;
- }
-
- public void setStarted() {
- this.status = STATUS_STARTED;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/KernelStatusMBean.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/KernelStatusMBean.java
deleted file mode 100644
index 58647b6a..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/KernelStatusMBean.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-/**
- * MBean for kernel status.
- *
- */
-public interface KernelStatusMBean {
-
- String getStatus();
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java
deleted file mode 100644
index 18f91d77..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * This file is part of the Virgo Web Server.
- *
- * Copyright (c) 2010 VMware Inc.
- * 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:
- * SpringSource, a division of VMware - initial API and implementation and/or initial documentation
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-
-/**
- * Utility class that tracks a set of {@link ServiceReference}s for a bundle and allows them to be safely
- * ungotten.
- * <p/>
- * <code>ServiceReferences</code> are tracked in a thread-safe manner, and are ungotten without
- * holding any locks.
- *
- * @see ServiceReference
- */
-class ServiceReferenceTracker {
-
- private final BundleContext context;
-
- private final Object monitor = new Object();
-
- private Set<ServiceReference> references; // protected by monitor.
-
-
- ServiceReferenceTracker(BundleContext context) {
- this.context = context;
- }
-
- /**
- * Tracks the supplied {@link ServiceReference}. This <code>ServiceReference</code> will be
- * {@link BundleContext#ungetService ungotten} during {@link #ungetAll()}.
- *
- * @param reference the <code>ServiceReference</code> to track.
- * @return the reference itself
- */
- public ServiceReference track(ServiceReference reference) {
- synchronized (this.monitor) {
- if (this.references == null) {
- this.references = new HashSet<ServiceReference>();
- }
- this.references.add(reference);
- }
- return reference;
- }
-
- /**
- * Safely unregisters all the tracked <code>ServiceRegistrations</code>.
- */
- public void ungetAll() {
- Set<ServiceReference> toUnget = null;
- synchronized (this.monitor) {
- toUnget = this.references;
- this.references = null;
- }
- if (toUnget != null) {
- for (ServiceReference serviceReference : toUnget) {
- try {
- this.context.ungetService(serviceReference);
- } catch (IllegalStateException e) {
- }
- }
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ShutdownManager.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ShutdownManager.java
deleted file mode 100644
index cc0bfef7..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ShutdownManager.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.SynchronousBundleListener;
-import org.osgi.framework.launch.Framework;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-import org.eclipse.virgo.kernel.core.Shutdown;
-import org.eclipse.virgo.kernel.diagnostics.KernelLogEvents;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-
-/**
- * Standard implementation of {@link Shutdown} that performs all shutdown actions synchronously.
- * <p />
- * This implementation registers a {@link Runtime#addShutdownHook(Thread) shutdown hook} to perform graceful shutdown
- * when the user kills the VM.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe
- *
- */
-class ShutdownManager implements Shutdown {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ShutdownManager.class);
-
- private static final long SHUTDOWN_TIMEOUT = TimeUnit.SECONDS.toMillis(30);
-
- private static final int STATE_RUNNING = 0;
-
- private static final int STATE_STOPPING = 1;
-
- private final AtomicInteger state = new AtomicInteger(STATE_RUNNING);
-
- private final EventLogger eventLogger;
-
- private final Framework framework;
-
- private final Thread shutdownHook = new Thread(new Runnable() {
-
- public void run() {
- try {
- // set to stopping so we don't try to remove the shutdown hook later
- state.set(STATE_STOPPING);
- ShutdownManager.this.shutdown();
- } catch (Throwable t) {
- t.printStackTrace();
- }
- }
-
- });
-
- public ShutdownManager(EventLogger eventLogger, Framework framework) {
- this.eventLogger = eventLogger;
- this.framework = framework;
- Runtime.getRuntime().addShutdownHook(this.shutdownHook);
- BundleContext bundleContext = framework.getBundleContext();
- bundleContext.addBundleListener(new ShutdownLoggingListener());
- }
-
- /**
- * {@inheritDoc}
- */
- public void shutdown() {
- FrameworkEvent shutdownResponse = null;
- try {
- this.framework.stop();
- shutdownResponse = this.framework.waitForStop(SHUTDOWN_TIMEOUT);
- } catch (BundleException ex) {
- LOGGER.error("Error during shutdown.", ex);
- } catch (InterruptedException ex) {
- LOGGER.error("Interrupted during shutdown.", ex);
- }
-
- if (!isSuccessfulStopResponse(shutdownResponse)) {
- immediateShutdown();
- } else {
- removeShutdownHook();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void immediateShutdown() {
- removeShutdownHook();
- this.eventLogger.log(KernelLogEvents.IMMEDIATE_SHUTDOWN_INITIATED);
- exitVM();
- }
-
- protected void exitVM() {
- System.exit(0);
- }
-
- private boolean isSuccessfulStopResponse(FrameworkEvent shutdownResponse) {
- return shutdownResponse != null && shutdownResponse.getType() == FrameworkEvent.STOPPED;
- }
-
- private void removeShutdownHook() {
- if(this.state.compareAndSet(STATE_RUNNING, STATE_STOPPING)) {
- Runtime.getRuntime().removeShutdownHook(this.shutdownHook);
- }
- }
-
- private final class ShutdownLoggingListener implements SynchronousBundleListener {
-
- public void bundleChanged(BundleEvent event) {
- BundleContext bundleContext = ShutdownManager.this.framework.getBundleContext();
- if (BundleEvent.STOPPING == event.getType() && event.getBundle() == bundleContext.getBundle()) {
- ShutdownManager.this.eventLogger.log(KernelLogEvents.SHUTDOWN_INITIATED);
- removeShutdownHook();
- }
- }
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java
deleted file mode 100644
index a354a9b9..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import org.eclipse.virgo.kernel.core.AbortableSignal;
-import org.eclipse.virgo.kernel.core.BundleStarter;
-import org.eclipse.virgo.kernel.core.BundleUtils;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-
-/**
- * Standard implementation of {@link BundleStarter} that starts the bundle and delegates to a {@link BundleStartTracker}
- * to track any asynchronous portion of the bundle's startup.
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-final class StandardBundleStarter implements BundleStarter {
-
- private final BundleStartTracker bundleStartTracker;
-
- private static final int DEFAULT_START_OPTIONS = 0;
-
- public StandardBundleStarter(BundleStartTracker bundleStartTracker) {
- this.bundleStartTracker = bundleStartTracker;
- }
-
- /**
- * {@inheritDoc}
- */
- public void start(Bundle bundle, AbortableSignal signal) throws BundleException {
- start(bundle, DEFAULT_START_OPTIONS, signal);
- }
-
- /**
- * {@inheritDoc}
- */
- public void start(Bundle bundle, int options, AbortableSignal signal) throws BundleException {
-
- trackStart(bundle, signal);
-
- if (bundleNeedsStarting(bundle)) {
- try {
- bundle.start(options);
- } catch (BundleException be) {
- this.bundleStartTracker.cleanup(bundle, false, be);
- throw be;
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void trackStart(Bundle bundle, AbortableSignal signal) {
- if (BundleUtils.isFragmentBundle(bundle)) {
- throw new IllegalArgumentException("A fragment bundle cannot be started and so start cannot be tracked");
- }
-
- if (signal != null) {
- this.bundleStartTracker.trackStart(bundle, signal);
- }
- }
-
- private static boolean bundleNeedsStarting(Bundle bundle) {
- if (bundle != null) {
- int bundleState = bundle.getState();
- return (bundleState != Bundle.STARTING && bundleState != Bundle.ACTIVE);
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java
deleted file mode 100644
index 9355c202..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import java.lang.management.ManagementFactory;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
-import org.eclipse.virgo.kernel.core.BlockingAbortableSignal;
-import org.eclipse.virgo.kernel.core.BundleUtils;
-import org.eclipse.virgo.kernel.core.FailureSignalledException;
-import org.eclipse.virgo.kernel.core.FatalKernelException;
-import org.eclipse.virgo.kernel.core.Shutdown;
-import org.eclipse.virgo.kernel.diagnostics.KernelLogEvents;
-import org.eclipse.virgo.medic.dump.DumpGenerator;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <code>StartupTracker</code> tracks the startup of the Kernel and produces event log entries, and
- * {@link EventAdmin} events as the kernel starts.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-final class StartupTracker {
-
- private static final String THREAD_NAME_STARTUP_TRACKER = "startup-tracker";
-
- static final String APPLICATION_CONTEXT_FILTER = "(objectClass=org.springframework.context.ApplicationContext)";
-
- private static final String KERNEL_EVENT_TOPIC = "org/eclipse/virgo/kernel/";
-
- private static final String KERNEL_EVENT_STARTING = KERNEL_EVENT_TOPIC + "STARTING";
-
- private static final String KERNEL_EVENT_STARTED = KERNEL_EVENT_TOPIC + "STARTED";
-
- private static final String KERNEL_EVENT_START_TIMED_OUT = KERNEL_EVENT_TOPIC + "START_TIMED_OUT";
-
- private static final String KERNEL_EVENT_START_ABORTED = KERNEL_EVENT_TOPIC + "START_ABORTED";
-
- private static final String KERNEL_EVENT_START_FAILED = KERNEL_EVENT_TOPIC + "START_FAILED";
-
- private static final String KERNEL_BSN_PREFIX = "org.eclipse.virgo.kernel";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(StartupTracker.class);
-
- private final KernelStatus status = new KernelStatus();
-
- private final KernelConfiguration configuration;
-
- private final Thread startupTrackingThread;
-
- private volatile ObjectInstance statusInstance;
-
- StartupTracker(BundleContext context, KernelConfiguration configuration, int startupWaitTime, BundleStartTracker asyncBundleStartTracker, Shutdown shutdown, DumpGenerator dumpGenerator) {
- Runnable startupTrackingRunnable = new StartupTrackingRunnable(context, startupWaitTime, asyncBundleStartTracker, this.status, shutdown, dumpGenerator);
- this.startupTrackingThread = new Thread(startupTrackingRunnable, THREAD_NAME_STARTUP_TRACKER);
- this.configuration = configuration;
- }
-
- void start() {
- registerKernelStatusMBean();
- this.startupTrackingThread.start();
- }
-
- void stop() {
- unregisterKernelStatusMBean();
- }
-
- private void registerKernelStatusMBean() {
- MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- try {
- ObjectName name = ObjectName.getInstance(StartupTracker.this.configuration.getDomain(), "type", "KernelStatus");
- this.statusInstance = server.registerMBean(this.status, name);
- } catch (JMException e) {
- throw new FatalKernelException("Unable to register KernelStatus MBean", e);
- }
- }
-
- private void unregisterKernelStatusMBean() {
- MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- try {
- ObjectInstance instance = this.statusInstance;
- if (instance != null && server.isRegistered(instance.getObjectName())) {
- server.unregisterMBean(this.statusInstance.getObjectName());
- }
- } catch (JMException e) {
- throw new FatalKernelException("Unable to unregister KernelStatus MBean", e);
- }
- }
-
- private final static class StartupTrackingRunnable implements Runnable {
-
- private final BundleContext context;
-
- private final int startupWaitTime;
-
- private final BundleStartTracker asyncBundleStartTracker;
-
- private final KernelStatus kernelStatus;
- private final Shutdown shutdown;
- private final DumpGenerator dumpGenerator;
-
- private final ServiceReferenceTracker serviceReferenceTracker;
-
- private EventLogger eventLogger = null;
- private EventAdmin eventAdmin = null;
-
- private StartupTrackingRunnable(BundleContext context, int startupWaitTime, BundleStartTracker asyncBundleStartTracker, KernelStatus kernelStatus, Shutdown shutdown, DumpGenerator dumpGenerator) {
- this.context = context;
- this.startupWaitTime = startupWaitTime;
- this.asyncBundleStartTracker = asyncBundleStartTracker;
- this.kernelStatus = kernelStatus;
- this.shutdown = shutdown;
- this.dumpGenerator = dumpGenerator;
- this.serviceReferenceTracker = new ServiceReferenceTracker(context);
- }
-
- public void run() {
- this.eventLogger = getEventLoggerService();
- this.eventAdmin = getEventAdminService();
-
- try {
- kernelStarting();
-
- Bundle[] bundles = this.context.getBundles();
-
- try {
- long waitTime = TimeUnit.SECONDS.toMillis(this.startupWaitTime);
-
- for (Bundle bundle : bundles) {
-
- if (!BundleUtils.isFragmentBundle(bundle) && isKernelBundle(bundle)) {
- BlockingAbortableSignal signal = new BlockingAbortableSignal();
-
- this.asyncBundleStartTracker.trackStart(bundle, signal);
-
- LOGGER.debug("Awaiting startup of bundle {} for up to {} milliseconds with signal {}.", new Object[]{bundle, waitTime, signal});
-
- long startTime = System.currentTimeMillis();
- boolean bundleStarted = signal.awaitCompletion(waitTime, TimeUnit.MILLISECONDS);
- waitTime -= System.currentTimeMillis() - startTime;
-
- if (!bundleStarted) {
- if(signal.isAborted()){
- LOGGER.error("Bundle {} aborted before the Kernel timeout of {} seconds with {} seconds remaining.", new Object[]{bundle, this.startupWaitTime, TimeUnit.MILLISECONDS.toSeconds(waitTime)});
- kernelStartAborted(bundle);
- } else if (waitTime <= 0) {
- LOGGER.error("Kernel has failed to start before the timeout of {} seconds.", this.startupWaitTime);
- kernelStartTimedOut();
- } else {
- LOGGER.error("Bundle {} did not start within the Kernel timeout of {} seconds.", bundle, this.startupWaitTime);
- kernelStartTimedOut();
- }
- return;
- }
- }
- }
- } catch (FailureSignalledException fse) {
- kernelStartFailed(fse.getCause());
- return;
- } catch (Exception e) {
- kernelStartFailed(e);
- return;
- }
-
- kernelStarted();
- } finally {
- this.serviceReferenceTracker.ungetAll();
- }
- }
-
- @SuppressWarnings("unchecked")
- private EventLogger getEventLoggerService() {
- EventLogger eventLogger = null;
- ServiceReference<EventLogger> eventLoggerServiceReference = (ServiceReference<EventLogger>) this.context.getServiceReference(EventLogger.class.getName());
- if (eventLoggerServiceReference != null) {
- eventLogger = (EventLogger) this.context.getService(this.serviceReferenceTracker.track(eventLoggerServiceReference));
- }
- return eventLogger;
- }
-
- @SuppressWarnings("unchecked")
- private EventAdmin getEventAdminService() {
- EventAdmin eventAdmin = null;
- ServiceReference<EventAdmin> eventAdminServiceReference = (ServiceReference<EventAdmin>) this.context.getServiceReference(EventAdmin.class.getName());
- if (eventAdminServiceReference != null) {
- eventAdmin = (EventAdmin) this.context.getService(this.serviceReferenceTracker.track(eventAdminServiceReference));
- }
- return eventAdmin;
- }
-
- private boolean isKernelBundle(Bundle bundle) {
- String symbolicName = bundle.getSymbolicName();
- return symbolicName != null && symbolicName.startsWith(KERNEL_BSN_PREFIX);
- }
-
- private void kernelStarting() {
- postEvent(KERNEL_EVENT_STARTING);
- logEvent(KernelLogEvents.KERNEL_STARTING);
- }
-
- private void kernelStarted() {
- this.kernelStatus.setStarted();
- postEvent(KERNEL_EVENT_STARTED);
- logEvent(KernelLogEvents.KERNEL_STARTED);
- }
-
- private void kernelStartAborted(Bundle bundle) {
- postEvent(KERNEL_EVENT_START_ABORTED);
- logEvent(KernelLogEvents.KERNEL_EVENT_START_ABORTED, bundle.getSymbolicName(), bundle.getVersion());
- generateDumpAndShutdown("startupTimedOut", null);
- }
-
- private void kernelStartTimedOut() {
- postEvent(KERNEL_EVENT_START_TIMED_OUT);
- logEvent(KernelLogEvents.KERNEL_START_TIMED_OUT, this.startupWaitTime);
- generateDumpAndShutdown("startupTimedOut", null);
- }
-
- private void kernelStartFailed(Throwable failure) {
- postEvent(KERNEL_EVENT_START_FAILED);
- logEvent(KernelLogEvents.KERNEL_START_FAILED, failure);
- generateDumpAndShutdown("startupFailed", failure);
- }
-
- private void generateDumpAndShutdown(String cause, Throwable failure) {
- if (failure != null) {
- this.dumpGenerator.generateDump(cause, failure);
- } else {
- this.dumpGenerator.generateDump(cause);
- }
- this.shutdown.immediateShutdown();
- }
-
- private void logEvent(KernelLogEvents event, Throwable throwable, Object...args) {
- if (this.eventLogger != null) {
- this.eventLogger.log(event, throwable, args);
- }
- }
-
- private void logEvent(KernelLogEvents event, Object... args) {
- this.logEvent(event, null, args);
- }
-
- private void postEvent(String topic) {
- if (this.eventAdmin != null) {
- this.eventAdmin.postEvent(new Event(topic, (Map<String, ?>)null));
- }
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/ApplicationContextDependencyMonitor.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/ApplicationContextDependencyMonitor.java
deleted file mode 100644
index e3cb0c66..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/ApplicationContextDependencyMonitor.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal.blueprint;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ScheduledExecutorService;
-
-import org.osgi.framework.Bundle;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventConstants;
-import org.osgi.service.event.EventHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.eclipse.virgo.kernel.diagnostics.KernelLogEvents;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-
-/**
- * {@link ApplicationContextDependencyMonitor} is a class that tracks the satisfaction of service dependencies needed
- * during the creation of application contexts and issues log messages for delayed service dependencies.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This class is thread safe.
- *
- */
-public final class ApplicationContextDependencyMonitor implements EventHandler {
-
- private static final String TOPIC_BLUEPRINT_EVENTS = "org/osgi/service/blueprint/container/";
-
- private static final String EVENT_WAITING = TOPIC_BLUEPRINT_EVENTS + "WAITING";
-
- private static final String EVENT_GRACE_PERIOD = TOPIC_BLUEPRINT_EVENTS + "GRACE_PERIOD";
-
- private static final String EVENT_FAILURE = TOPIC_BLUEPRINT_EVENTS + "FAILURE";
-
- private static final String EVENT_CREATED = TOPIC_BLUEPRINT_EVENTS + "CREATED";
-
- private static final int MAXIMUM_WARNING_INTERVAL = 60 * 1000;
-
- private static final int WARNING_INTERVAL_INCREASE_RATE_PERCENT = 200;
-
- private static final int INITIAL_WARNING_INTERVAL = 5 * 1000;
-
- private static final int SLOW_WARNING_INTERVAL = 5 * 60 * 1000;
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final EventLogger eventLogger;
-
- private final ScheduledExecutorService scheduledExecutorService;
-
- private final Map<Bundle, Map<ServiceDependency, Ticker>> tickers = new HashMap<Bundle, Map<ServiceDependency, Ticker>>();
-
- private final Object monitor = new Object();
-
- /**
- * Construct a {@link ApplicationContextDependencyMonitor} which uses the given {@link ScheduledExecutorService} to
- * schedule its warning messages.
- *
- * @param scheduledExecutorService the {@link ScheduledExecutorService} for scheduling warning messages
- * @param eventLogger
- */
- public ApplicationContextDependencyMonitor(ScheduledExecutorService scheduledExecutorService, EventLogger eventLogger) {
- this.scheduledExecutorService = scheduledExecutorService;
- this.eventLogger = eventLogger;
- }
-
- /**
- * {@inheritDoc}
- */
- public void handleEvent(Event event) {
- synchronized (this.monitor) {
- Bundle bundle = (Bundle) event.getProperty(EventConstants.BUNDLE);
-
- if (EVENT_WAITING.equals(event.getTopic())) {
- List<ServiceDependency> serviceDependencies = createServiceDependencies(event);
- for (ServiceDependency serviceDependency : serviceDependencies) {
- addServiceDependencyTicker(serviceDependency, bundle);
- }
- } else if (EVENT_GRACE_PERIOD.equals(event.getTopic())) {
- List<ServiceDependency> remainingUnsatisfiedDependencies = createServiceDependencies(event);
- changeInUnsatisfiedDependencies(remainingUnsatisfiedDependencies, bundle);
-
- } else if (EVENT_FAILURE.equals(event.getTopic())) {
- String[] dependenciesArray = (String[]) event.getProperty("dependencies");
- if (dependenciesArray != null) {
- List<ServiceDependency> serviceDependencies = createServiceDependencies(event);
- serviceDependenciesTimedOut(serviceDependencies, bundle);
- } else {
- containerCreationFailed(bundle);
- }
- } else if (EVENT_CREATED.equals(event.getTopic())) {
- containerCreated(bundle);
- }
- }
- }
-
- private void serviceDependenciesTimedOut(List<ServiceDependency> timedOutDependencies, Bundle bundle) {
- Map<ServiceDependency, Ticker> bundlesTickers = this.tickers.get(bundle);
-
- if (bundlesTickers != null) {
- for (ServiceDependency timedOutDependency : timedOutDependencies) {
- Ticker ticker = bundlesTickers.remove(timedOutDependency);
- if (ticker != null) {
- dependencyTimedOut(timedOutDependency, ticker, bundle);
- }
- }
- }
- }
-
- private void containerCreationFailed(Bundle bundle) {
- Map<ServiceDependency, Ticker> tickers = this.tickers.remove(bundle);
- if (tickers != null) {
- for (Entry<ServiceDependency, Ticker> ticker : tickers.entrySet()) {
- ticker.getValue().cancel();
- }
- }
- }
-
- private void containerCreated(Bundle bundle) {
- Map<ServiceDependency, Ticker> bundlesTickers = this.tickers.remove(bundle);
-
- if (bundlesTickers != null) {
- for (Entry<ServiceDependency, Ticker> entry : bundlesTickers.entrySet()) {
- dependencySatisfied(entry.getKey(), entry.getValue(), bundle);
- }
- }
- }
-
- private void changeInUnsatisfiedDependencies(List<ServiceDependency> remainingUnsatisfiedDependencies, Bundle bundle) {
- Map<ServiceDependency, Ticker> tickers = this.tickers.get(bundle);
-
- if (tickers != null) {
- Iterator<Entry<ServiceDependency, Ticker>> entries = tickers.entrySet().iterator();
-
- while (entries.hasNext()) {
- Entry<ServiceDependency, Ticker> entry = entries.next();
-
- if (!remainingUnsatisfiedDependencies.contains(entry.getKey())) {
- dependencySatisfied(entry.getKey(), entry.getValue(), bundle);
- entries.remove();
- }
- }
- }
- }
-
- private void dependencySatisfied(ServiceDependency serviceDependency, Ticker ticker, Bundle bundle) {
- logger.info("Service dependency '{}' has been satisfied", serviceDependency);
- handleRemovedTicker(ticker, serviceDependency, bundle, true);
- }
-
- private void dependencyTimedOut(ServiceDependency serviceDependency, Ticker ticker, Bundle bundle) {
- logger.info("Service dependency '{}' has timed out", serviceDependency);
- handleRemovedTicker(ticker, serviceDependency, bundle, false);
- }
-
- private void handleRemovedTicker(Ticker ticker, ServiceDependency serviceDependency, Bundle bundle, boolean satisfied) {
- boolean hasTicked = ticker.cancel();
- if (hasTicked) {
- if (satisfied) {
- this.eventLogger.log(KernelLogEvents.APPLICATION_CONTEXT_DEPENDENCY_SATISFIED, serviceDependency.getBeanName(),
- bundle.getSymbolicName(), bundle.getVersion(), serviceDependency.getFilter());
- } else {
- this.eventLogger.log(KernelLogEvents.APPLICATION_CONTEXT_DEPENDENCY_TIMED_OUT, serviceDependency.getBeanName(),
- bundle.getSymbolicName(), bundle.getVersion(), serviceDependency.getFilter());
- }
- }
- }
-
- /**
- * Add a service dependency ticker for the given application context, given associated bundle, and given service
- * dependency.
- *
- * @param applicationContext the partially constructed application context which needs the service dependency
- * @param serviceDependency the service dependency
- * @param bundle the {@link Bundle} associated with the given application context
- */
- private void addServiceDependencyTicker(final ServiceDependency serviceDependency, final Bundle bundle) {
- Map<ServiceDependency, Ticker> serviceDependencyTickers = getServiceDependencyTickers(bundle);
- if (serviceDependencyTickers.containsKey(serviceDependency)) {
- logger.warn("Service dependency '{}' already being waited upon", serviceDependency);
- } else {
- // Services which are flagged as likely to be slow to be published are given a longer initial warning
- // interval.
- boolean slowService = serviceDependency.getFilter().contains("(org.eclipse.virgo.server.slowservice=true)");
- serviceDependencyTickers.put(serviceDependency, StandardTicker.createExponentialTicker(slowService ? SLOW_WARNING_INTERVAL
- : INITIAL_WARNING_INTERVAL, WARNING_INTERVAL_INCREASE_RATE_PERCENT, slowService ? SLOW_WARNING_INTERVAL : MAXIMUM_WARNING_INTERVAL,
- new Callable<Void>() {
-
- public Void call() throws Exception {
- synchronized (ApplicationContextDependencyMonitor.this.monitor) {
- if (bundle.getState() == Bundle.UNINSTALLED) {
- ApplicationContextDependencyMonitor.this.containerCreationFailed(bundle);
- } else {
- eventLogger.log(KernelLogEvents.APPLICATION_CONTEXT_DEPENDENCY_DELAYED, serviceDependency.getBeanName(),
- bundle.getSymbolicName(), bundle.getVersion(), serviceDependency.getFilter());
- }
- return null;
- }
- }
- }, this.scheduledExecutorService));
- }
- }
-
- /**
- * Get the possibly empty map of service dependency tickers for the given <code>Bundle</code>.
- *
- * @param bundle the <code>Bundle</code> whose application context's service dependencies are required
- * @return a map of service dependency tickers
- */
- private Map<ServiceDependency, Ticker> getServiceDependencyTickers(Bundle bundle) {
- Map<ServiceDependency, Ticker> tickers = this.tickers.get(bundle);
- if (tickers == null) {
- tickers = new HashMap<ServiceDependency, Ticker>();
- this.tickers.put(bundle, tickers);
- }
- return tickers;
- }
-
- public void stop() {
- this.scheduledExecutorService.shutdown();
- }
-
- private List<ServiceDependency> createServiceDependencies(Event event) {
- String[] filters = (String[]) event.getProperty("dependencies");
- String[] beanNames = (String[]) event.getProperty("bean.name");
-
- List<ServiceDependency> serviceDependencies = new ArrayList<ServiceDependency>();
-
- if (filters != null && beanNames != null) {
- for (int i = 0; i < filters.length; i++) {
- serviceDependencies.add(new ServiceDependency(filters[i], beanNames[i]));
- }
- }
-
- return serviceDependencies;
- }
-
- private static final class ServiceDependency {
-
- private final String filter;
-
- private final String beanName;
-
- private ServiceDependency(String filter, String beanName) {
- this.filter = filter;
- this.beanName = beanName;
- }
-
- public String getFilter() {
- return filter;
- }
-
- public String getBeanName() {
- return beanName;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + beanName.hashCode();
- result = prime * result + filter.hashCode();
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
-
- ServiceDependency other = (ServiceDependency) obj;
-
- if (!beanName.equals(other.beanName))
- return false;
-
- if (!filter.equals(other.filter))
- return false;
-
- return true;
- }
-
- public String toString() {
- return this.filter + " " + this.beanName;
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/StandardTicker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/StandardTicker.java
deleted file mode 100644
index e5cf63da..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/StandardTicker.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal.blueprint;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.springframework.util.Assert;
-
-
-
-/**
- * {@link StandardTicker} provides a heart-beat for tracking unanticipated delays. The heart-beat is configurable using a
- * policy such as {@link ExponentialHeartBeatPolicy} which lengthens the heart-beat interval exponentially over time
- * until it reaches a fixed upper bound. On each heart-beat until the ticker is cancelled, an action is called.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This class is thread safe.
- *
- * @param <V> the result type of the action taken on each heart-beat
- */
-public final class StandardTicker<V> implements Ticker, Callable<V> {
-
- private static final long OVERDUE = -1;
-
- private final long creationTimeMillis;
-
- private long lastTickMillis;
-
- private final HeartBeatPolicy heartBeatPolicy;
-
- private long heartBeatIntervalMillis;
-
- private boolean tickedAtLeastOnce = false;
-
- private boolean cancelled = false;
-
- private ScheduledFuture<V> scheduledFuture;
-
- private final Callable<V> action;
-
- private final ScheduledExecutorService scheduledExecutorService;
-
- private Object monitor = new Object();
-
- /**
- * Create a {@link Ticker} with the given heart-beat policy, action to be called on each tick, and executor service
- * for scheduling ticks and set it ticking.
- *
- * @param <V> the action's result type
- * @param heartBeatPolicy a policy which determines the possibly variable intervals between heartbeats
- * @param action the thread safe action to be called on each tick
- * @param scheduledExecutorService the executor service for scheduling ticks
- * @return the constructed and ticking ticker
- */
- public static <V> Ticker createTicker(HeartBeatPolicy heartBeatPolicy, Callable<V> action, ScheduledExecutorService scheduledExecutorService) {
- StandardTicker<V> ticker = new StandardTicker<V>(heartBeatPolicy, action, scheduledExecutorService);
- ticker.start();
- return ticker;
- }
-
- /**
- * Create a {@link Ticker} with an exponential heart beat policy and a given action to be called on each tick and an
- * executor service for scheduling ticks and set it ticking. The exponential heart beat policy has the given initial
- * interval which then increases by the given percentage on each tick until the given maximum interval is reached.
- *
- * @param <V> the action's result type
- * @param initialHeartbeatIntervalMillis the initial interval
- * @param heartBeatIncreasePercentage the percentage increase on each tick
- * @param maxHeartBeatIntervalMillis the maximum interval
- * @param action the thread safe action to be called on each tick
- * @param scheduledExecutorService the executor service for scheduling ticks
- * @return the constructed and ticking ticker
- */
- public static <V> Ticker createExponentialTicker(long initialHeartbeatIntervalMillis, long heartBeatIncreasePercentage,
- long maxHeartBeatIntervalMillis, Callable<V> action, ScheduledExecutorService scheduledExecutorService) {
- return createTicker(new ExponentialHeartBeatPolicy(initialHeartbeatIntervalMillis, heartBeatIncreasePercentage, maxHeartBeatIntervalMillis),
- action, scheduledExecutorService);
- }
-
- /**
- * Construct a Ticker with the given heart beat policy, action to be called on each tick, and executor service for
- * scheduling ticks.
- *
- * @param heartBeatPolicy a policy which determines the possibly variable intervals between heartbeats
- * @param action the thread safe action to be called on each tick
- * @param scheduledExecutorService the executor service for scheduling ticks
- */
- private StandardTicker(HeartBeatPolicy heartBeatPolicy, Callable<V> action, ScheduledExecutorService scheduledExecutorService) {
- this.heartBeatPolicy = heartBeatPolicy;
- this.heartBeatIntervalMillis = this.heartBeatPolicy.getNextHeartBeatIntervalMillis();
- this.creationTimeMillis = System.currentTimeMillis();
- this.lastTickMillis = this.creationTimeMillis;
- this.action = action;
- this.scheduledExecutorService = scheduledExecutorService;
- }
-
- /**
- * Start this ticker ticking.
- */
- private void start() {
- if (getIntervalToNextTickMillis() == OVERDUE) {
- try {
- this.call();
- } catch (Exception e) {
- }
- } else {
- scheduleNextTick();
- }
- }
-
- /**
- * Schedule the next tick of this ticker.
- */
- private void scheduleNextTick() {
- synchronized (this.monitor) {
- if (!this.cancelled) {
- this.scheduledFuture = this.scheduledExecutorService.schedule(this, getIntervalToNextTickMillis(), TimeUnit.MILLISECONDS);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public V call() throws Exception {
- boolean ticked = tick();
- scheduleNextTick();
- return ticked ? this.action.call() : null;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean cancel() {
- synchronized (this.monitor) {
- this.cancelled = true;
- this.scheduledFuture.cancel(true);
- return this.tickedAtLeastOnce;
- }
- }
-
- /**
- * Determine whether a tick is due and, if so, update the ticker state to count down to the next tick and return
- * <code>true</code>. If no tick is due, do not update the ticker state and return <code>false</code>.
- *
- * @return <code>true</code> if and only if the ticker tickedAtLeastOnce
- */
- private boolean tick() {
- synchronized (this.monitor) {
- boolean ticked = false;
- if (!cancelled && getIntervalToNextTickMillis() == OVERDUE) {
- ticked = true;
- this.lastTickMillis = getCurrentTimeMillis();
- this.heartBeatIntervalMillis = this.heartBeatPolicy.getNextHeartBeatIntervalMillis();
- }
- this.tickedAtLeastOnce = this.tickedAtLeastOnce || ticked;
- return ticked;
- }
- }
-
- /**
- * Get the current time.
- *
- * Pre-condition: the monitor must be held.
- *
- * Post-condition: result >= this.lastTickMillis.
- *
- * @return the current time in milliseconds
- */
- private long getCurrentTimeMillis() {
- long currentTimeMillis = System.currentTimeMillis();
- Assert.isTrue(currentTimeMillis >= this.lastTickMillis, "Time must not go backwards");
- return currentTimeMillis;
- }
-
- /**
- * Get the time interval until the next tick is due, or OVERDUE if the next tick is overdue.
- *
- * @return the time interval in milliseconds, or OVERDUE if the next tick is overdue
- */
- private long getIntervalToNextTickMillis() {
- synchronized (this.monitor) {
- long intervalSinceLastTickMillis = getCurrentTimeMillis() - this.lastTickMillis;
- return intervalSinceLastTickMillis < this.heartBeatIntervalMillis ? this.heartBeatIntervalMillis - intervalSinceLastTickMillis : OVERDUE;
- }
- }
-
- /**
- * {@link ExponentialHeartBeatPolicy} is a {@link HeartBeatPolicy} which returns intervals starting with a given
- * initial interval and increasing by a given percentage up to a given maximum interval.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This class is thread safe.
- */
- private final static class ExponentialHeartBeatPolicy implements HeartBeatPolicy {
-
- private final long maxHeartBeatIntervalMillis;
-
- private final long heartBeatIncreasePercentage;
-
- private AtomicLong heartBeatIntervalMillis;
-
- /**
- * Construct a {@link Ticker.HeartBeatPolicy HeartBeatPolicy} which the given initial interval which then increases by the given
- * percentage on each tick until the given maximum interval is reached.
- *
- * @param initialHeartbeatIntervalMillis the initial interval
- * @param heartBeatIncreasePercentage the percentage increase on each tick
- * @param maxHeartBeatIntervalMillis the maximum interval
- */
- public ExponentialHeartBeatPolicy(long initialHeartbeatIntervalMillis, long heartBeatIncreasePercentage, long maxHeartBeatIntervalMillis) {
- this.heartBeatIntervalMillis = new AtomicLong(initialHeartbeatIntervalMillis);
- this.heartBeatIncreasePercentage = heartBeatIncreasePercentage;
- this.maxHeartBeatIntervalMillis = maxHeartBeatIntervalMillis;
- }
-
- /**
- * {@inheritDoc}
- */
- public long getNextHeartBeatIntervalMillis() {
- boolean success = false;
- long nextHeartBeatIntervalMillis = 0;
- while (!success) {
- nextHeartBeatIntervalMillis = this.heartBeatIntervalMillis.get();
- if (nextHeartBeatIntervalMillis < maxHeartBeatIntervalMillis) {
- long newHeartBeatIntervalMillis = Math.min((nextHeartBeatIntervalMillis * (100 + heartBeatIncreasePercentage)) / 100,
- maxHeartBeatIntervalMillis);
- success = this.heartBeatIntervalMillis.compareAndSet(nextHeartBeatIntervalMillis, newHeartBeatIntervalMillis);
- } else {
- success = true;
- }
- }
- return nextHeartBeatIntervalMillis;
- }
-
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/Ticker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/Ticker.java
deleted file mode 100644
index 26664a33..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/blueprint/Ticker.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal.blueprint;
-
-
-/**
- * {@link Ticker} provides a heartbeat interface for tracking unanticipated delays. The heartbeat is configurable using
- * a {@link HeartBeatPolicy}.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this interface must be thread safe.
- *
- */
-public interface Ticker {
-
- /**
- * Cancel this Ticker.
- *
- * @return <code>true</code> if and only this Ticker has ticked at least once
- */
- boolean cancel();
-
- /**
- * {@link HeartBeatPolicy} is an interface for configuring heartbeat intervals.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this interface should be thread safe to avoid potential abuse.
- */
- public static interface HeartBeatPolicy {
-
- /**
- * Return the heartbeat interval and update the next interval according to the policy.
- *
- * @return the heartbeat interval in milliseconds
- */
- long getNextHeartBeatIntervalMillis();
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java
deleted file mode 100644
index 67b0fb62..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.diagnostics;
-
-import org.eclipse.virgo.kernel.serviceability.LogEventDelegate;
-import org.eclipse.virgo.medic.eventlog.Level;
-import org.eclipse.virgo.medic.eventlog.LogEvent;
-
-/**
- * Defines all the {@link LogEvent LogEvents} for the kernel subsystem.
- *
- * <strong>Concurrent Semantics</strong><br/>
- *
- * Implementation is immutable.
- *
- */
-public enum KernelLogEvents implements LogEvent {
- KERNEL_STARTING(1, Level.INFO), //
- KERNEL_STARTED(2, Level.INFO), //
- KERNEL_START_FAILED(3, Level.ERROR), //
- KERNEL_START_TIMED_OUT(4, Level.ERROR), //
- KERNEL_PLAN_ARGUMENTS_INCORRECT(5, Level.WARNING), //
- KERNEL_EVENT_START_ABORTED(6, Level.ERROR), //
-
- SHUTDOWN_INITIATED(10, Level.INFO), //
- IMMEDIATE_SHUTDOWN_INITIATED(11, Level.INFO), //
-
- APPLICATION_CONTEXT_DEPENDENCY_DELAYED(100, Level.WARNING), //
- APPLICATION_CONTEXT_DEPENDENCY_SATISFIED(101, Level.INFO), //
- APPLICATION_CONTEXT_DEPENDENCY_TIMED_OUT(102, Level.ERROR), //
-
- OVF_CONFIGURATION_FILE_DOES_NOT_EXIST(200, Level.WARNING), //
- OVF_READ_ERROR(201, Level.ERROR), //
-
- OLD_SCOPING_PROPERTY_USED(300, Level.WARNING);
-
- private static final String PREFIX = "KE";
-
- private final LogEventDelegate delegate;
-
- private KernelLogEvents(int code, Level level) {
- this.delegate = new LogEventDelegate(PREFIX, code, level);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getEventCode() {
- return this.delegate.getEventCode();
- }
-
- /**
- * {@inheritDoc}
- */
- public Level getLevel() {
- return this.delegate.getLevel();
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/Assert.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/Assert.java
deleted file mode 100644
index 53576942..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/Assert.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * A set of useful assertions based on those provided by the Spring Framework's Assert class.
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This class is thread safe.
- *
- * @see org.springframework.util.Assert
- */
-public final class Assert {
-
- /**
- * A <code>FatalAssertionException</code> is thrown when an assertion failure occurs and will result in a dump being
- * generated.
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This class is <strong>thread-safe</strong>.
- *
- */
- final public static class FatalAssertionException extends RuntimeException {
-
- private static final long serialVersionUID = -4633344457818398425L;
-
- /**
- * Creates a new FatalAssertionException with the supplied message
- *
- * @param message The exception message
- */
- public FatalAssertionException(String message) {
- super(message);
- }
- }
-
- /**
- * Assert a boolean expression, throwing a <code>FatalAssertionException</code> if the test result is
- * <code>false</code>.
- *
- * <pre class="code">
- * Assert.isTrue(i &gt; 0, &quot;The value must be greater than zero&quot;);
- * </pre>
- *
- * @param expression a boolean expression
- * @param message the exception message to use if the assertion fails
- * @param inserts any inserts to include if the message is a format string.
- * @throws FatalAssertionException if expression is <code>false</code>
- */
- public static void isTrue(boolean expression, String message, Object... inserts) {
- if (!expression) {
- throw new FatalAssertionException(String.format(message, inserts));
- }
- }
-
- /**
- * Assert a boolean expression, throwing a <code>FatalAssertionException</code> if the test result is
- * <code>true</code>.
- *
- * <pre class="code">
- * Assert.isFalse(state.isBroken(), &quot;The state is broken&quot;);
- * </pre>
- *
- * @param expression a boolean expression
- * @param message the exception message to use if the assertion fails
- * @param inserts any inserts to include if the message is a format string.
- * @throws FatalAssertionException if expression is <code>false</code>
- */
- public static void isFalse(boolean expression, String message, Object... inserts) {
- if (expression) {
- throw new FatalAssertionException(String.format(message, inserts));
- }
- }
-
- /**
- * Assert that an object is <code>null</code>.
- *
- * <pre class="code">
- * Assert.isNull(value, &quot;The value must be null&quot;);
- * </pre>
- *
- * @param object the object to check
- * @param message the exception message to use if the assertion fails
- * @param inserts any inserts to include if the message is a format string.
- * @throws FatalAssertionException if the object is not <code>null</code>
- */
- public static void isNull(Object object, String message, Object... inserts) {
- if (object != null) {
- throw new FatalAssertionException(String.format(message, inserts));
- }
- }
-
- /**
- * Assert that an object is not <code>null</code>.
- *
- * <pre class="code">
- * Assert.notNull(clazz, &quot;The class must not be null&quot;);
- * </pre>
- *
- * @param object the object to check
- * @param message the exception message to use if the assertion fails
- * @param inserts any inserts to include if the message is a format string.
- * @throws FatalAssertionException if the object is <code>null</code>
- */
- public static void notNull(Object object, String message, Object... inserts) {
- if (object == null) {
- throw new FatalAssertionException(String.format(message, inserts));
- }
- }
-
- /**
- * Assert that the given String is not empty; that is, it must not be <code>null</code> and not the empty String.
- *
- * <pre class="code">
- * Assert.hasLength(name, &quot;Name must not be empty&quot;);
- * </pre>
- *
- * @param text the String to check
- * @param message the exception message to use if the assertion fails
- * @param inserts any inserts to include if the message is a format string.
- * @see org.eclipse.virgo.util.common.StringUtils#hasLength(String)
- */
- public static void hasLength(String text, String message, Object... inserts) {
- if (text == null || text.length() == 0) {
- throw new FatalAssertionException(String.format(message, inserts));
- }
- }
-
- /**
- * Assert that an array has elements; that is, it must not be <code>null</code> and must have at least one element.
- *
- * <pre class="code">
- * Assert.notEmpty(array, &quot;The array must have elements&quot;);
- * </pre>
- *
- * @param array the array to check
- * @param message the exception message to use if the assertion fails
- * @param inserts any inserts to include if the message is a format string.
- * @throws IllegalArgumentException if the object array is <code>null</code> or has no elements
- */
- public static void notEmpty(Object[] array, String message, Object... inserts) {
- if (array == null || array.length == 0) {
- throw new FatalAssertionException(String.format(message, inserts));
- }
- }
-
- /**
- * Assert that a collection has elements; that is, it must not be <code>null</code> and must have at least one
- * element.
- *
- * <pre class="code">
- * Assert.notEmpty(collection, &quot;Collection must have elements&quot;);
- * </pre>
- * @param <T> Element type of collection
- *
- * @param collection the collection to check
- * @param message the exception message to use if the assertion fails
- * @param inserts any inserts to include if the message is a format string.
- * @throws FatalAssertionException if the collection is <code>null</code> or has no elements
- */
- public static <T> void notEmpty(Collection<T> collection, String message, Object... inserts) {
- if (collection == null || collection.isEmpty()) {
- throw new FatalAssertionException(String.format(message, inserts));
- }
- }
-
- /**
- * Assert that a Map has entries; that is, it must not be <code>null</code> and must have at least one entry.
- *
- * <pre class="code">
- * Assert.notEmpty(map, &quot;Map must have entries&quot;);
- * </pre>
- * @param <K> Key type of map
- * @param <V> Value type of map
- *
- * @param map the map to check
- * @param message the exception message to use if the assertion fails
- * @param inserts any inserts to include if the message is a format string.
- * @throws FatalAssertionException if the map is <code>null</code> or has no entries
- */
- public static <K, V> void notEmpty(Map<K, V> map, String message, Object... inserts) {
- if (map == null || map.isEmpty()) {
- throw new FatalAssertionException(String.format(message, inserts));
- }
- }
-
- /**
- * Assert that the provided object is a non-null instance of the provided class.
- *
- * <pre class="code">
- * Assert.instanceOf(Foo.class, foo);
- * </pre>
- * @param <T> Type generic
- *
- * @param type the type to check against
- * @param obj the object to check
- * @param message a message which will be prepended to the message produced by the function itself, and which may be
- * used to provide context. It should normally end in a ": " or ". " so that the function generate message
- * looks ok when prepended to it.
- * @param inserts any inserts to include if the message is a format string.
- * @throws FatalAssertionException if the object is not an instance of clazz
- * @see Class#isInstance
- */
- public static <T> void isInstanceOf(Class<T> type, Object obj, String message, Object... inserts) {
- notNull(type, "The type to check against must not be null");
- if (!type.isInstance(obj)) {
- throw new FatalAssertionException(String.format(message, inserts) + "Object of class [" + (obj != null ? obj.getClass().getName() : "null")
- + "] must be an instance of " + type);
- }
- }
-
- /**
- * Assert that <code>superType.isAssignableFrom(subType)</code> is <code>true</code>.
- *
- * <pre class="code">
- * Assert.isAssignable(Number.class, myClass);
- * </pre>
- * @param <T> SuperType
- * @param <U> SubType
- *
- * @param superType the super type to check against
- * @param subType the sub type to check
- * @param message a message which will be prepended to the message produced by the function itself, and which may be
- * used to provide context. It should normally end in a ": " or ". " so that the function generate message
- * looks ok when prepended to it.
- * @param inserts any inserts to include if the message is a format string.
- * @throws FatalAssertionException if the classes are not assignable
- */
- public static <T, U> void isAssignable(Class<T> superType, Class<U> subType, String message, Object... inserts) {
- notNull(superType, "Type to check against must not be null");
- if (subType == null || !superType.isAssignableFrom(subType)) {
- throw new FatalAssertionException(String.format(message, inserts) + subType + " is not assignable to " + superType);
- }
- }
-
- /*
- * Prevent instantiation - Java does not allow final abstract classes.
- */
- private Assert() {
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/FatalServerException.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/FatalServerException.java
deleted file mode 100644
index 3230e409..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/FatalServerException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability;
-
-// TODO This exception doesn't cause a crash
-/**
- * Fatal server exceptions are thrown when a severe error is detected in the
- * Server which requires the Server to crash after generating diagnostics. This
- * class is thread safe.
- *
- * Subsystems should throw their own specific subclasses.
- *
- */
-abstract public class FatalServerException extends RuntimeException {
-
- /**
- * Stable serial UID.
- */
- private static final long serialVersionUID = -4396605664802060768L;
-
- /**
- * An aspect will do FFDC when this exception, or subclasses of this
- * exception, is thrown.
- *
- * @param message an English description of the error
- */
- public FatalServerException(String message) {
- super(message);
- }
-
- public FatalServerException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/LogEventDelegate.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/LogEventDelegate.java
deleted file mode 100644
index 3ed3888a..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/LogEventDelegate.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability;
-
-import org.eclipse.virgo.medic.eventlog.Level;
-import org.eclipse.virgo.medic.eventlog.LogEvent;
-
-public class LogEventDelegate implements LogEvent {
-
- private final String prefix;
-
- private final int code;
-
- private final Level level;
-
- public LogEventDelegate(String prefix, int code, Level level) {
- super();
- this.prefix = prefix;
- this.code = code;
- this.level = level;
- }
-
- public String getEventCode() {
- return String.format("%s%04d%1.1s", this.prefix, this.code, this.level);
- }
-
- public Level getLevel() {
- return this.level;
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/NonNull.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/NonNull.java
deleted file mode 100644
index 15f0be52..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/NonNull.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * NonNull is an annotation to automate the insert of a non-null assertion check on a method parameter. The method
- * taking the annotated parameter(s) is advised by an aspect to inject the assertion check.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This annotation is thread safe.
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.PARAMETER)
-@Documented()
-public @interface NonNull {
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/DumpCoordinator.aj b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/DumpCoordinator.aj
deleted file mode 100644
index 4308ae80..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/DumpCoordinator.aj
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.eclipse.virgo.medic.dump.DumpGenerator;
-
-/**
- * Advises throws of {@link RuntimeException} and triggers {@link DumpGenerator#generateDump(String,Throwable...) a dump}.
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-public final aspect DumpCoordinator {
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private volatile DumpGenerator dumpGenerator;
-
- private final Object monitor = new Object();
-
- pointcut serviceability() : within(org.eclipse.virgo.kernel.serviceability..*);
-
- pointcut dumpCandidate() : (execution(* *(..)) || initialization(*.new(..))) && !serviceability();
-
- after() throwing(RuntimeException e) : dumpCandidate() {
- if (!FFDCExceptionState.seen(e)) {
- FFDCExceptionState.record(e);
-
- synchronized (this.monitor) {
- if (this.dumpGenerator != null) {
- this.dumpGenerator.generateDump("error", e);
- } else {
- logger.warn("No DumpGenerator available");
- }
- }
- }
- }
-
- // TODO Consider using a ServiceTracker
- public void setBundleContext(BundleContext bundleContext) {
- ServiceReference<DumpGenerator> serviceReference = bundleContext.getServiceReference(DumpGenerator.class);
- if (serviceReference != null) {
- DumpGenerator dumpGenerator = bundleContext.getService(serviceReference);
- if (dumpGenerator != null) {
- setDumpGenerator(dumpGenerator);
- } else {
- throw new IllegalStateException("DumpGenerator not available in the ServiceRegistry");
- }
- }
- }
-
- public void setDumpGenerator(DumpGenerator dumpGenerator) {
- synchronized (this.monitor) {
- this.dumpGenerator = dumpGenerator;
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/FFDCExceptionState.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/FFDCExceptionState.java
deleted file mode 100644
index c81d467e..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/FFDCExceptionState.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump;
-
-/**
- * Maintains state about which {@link Throwable} was last seen for the current thread.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * State is thread local.
- *
- */
-final class FFDCExceptionState {
-
- private static final State STATE = new State();
-
- /**
- * Record that the supplied {@link Throwable} has been seen.
- *
- * @param t the <code>Throwable</code>.
- */
- public static void record(Throwable t) {
- STATE.set(t);
- }
-
- /**
- * Query whether the supplied {@link Throwable} or one of its causes has been seen.
- *
- * @param t the <code>Throwable</code>
- * @return <code>true</code> if the <code>Throwable</code> has been seen, otherwise <code>false</code>.
- */
- public static boolean seen(Throwable t) {
- boolean seen = false;
- Throwable s = t;
- do {
- if (s.equals(STATE.get())) {
- seen = true;
- break;
- }
- s = s.getCause();
- } while (s != null);
- return seen;
- }
-
- private static class State extends ThreadLocal<Throwable> {
-
- /**
- * {@inheritDoc}
- */
- @Override public String toString() {
- return String.format("FFDC Exception State [lastSeen = '" + get() + "']");
- }
-
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/RegionDigraphDumpContributor.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/RegionDigraphDumpContributor.java
deleted file mode 100644
index ec5f1179..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/RegionDigraphDumpContributor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump.internal;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-
-import org.eclipse.equinox.region.RegionDigraph;
-import org.eclipse.virgo.kernel.serviceability.NonNull;
-import org.eclipse.virgo.medic.dump.Dump;
-import org.eclipse.virgo.medic.dump.DumpContributionFailedException;
-import org.eclipse.virgo.medic.dump.DumpContributor;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-/**
- * {@link RegionDigraphDumpContributor} dumps the {@link RegionDigraph} to a file.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- * Thread safe.
- */
-public final class RegionDigraphDumpContributor implements DumpContributor {
-
- private final BundleContext bundleContext;
-
- public RegionDigraphDumpContributor(@NonNull BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void contribute(Dump dump) throws DumpContributionFailedException {
- File outputFile = dump.createFile("region.digraph");
- ServiceReference<RegionDigraph> serviceReference = this.bundleContext.getServiceReference(RegionDigraph.class);
- RegionDigraph regionDigraph = this.bundleContext.getService(serviceReference);
- try {
- OutputStream output = new FileOutputStream(outputFile);
- try {
- regionDigraph.getRegionDigraphPersistence().save(regionDigraph, output);
- } finally {
- output.close();
- }
- } catch (Exception e) {
- throw new DumpContributionFailedException("Failed to dump region digraph", e);
- } finally {
- this.bundleContext.ungetService(serviceReference);
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return "region digraph";
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionDumpContributor.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionDumpContributor.java
deleted file mode 100644
index 5ddf5b8a..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionDumpContributor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump.internal;
-
-import java.io.File;
-
-import org.eclipse.osgi.service.resolver.PlatformAdmin;
-import org.eclipse.osgi.service.resolver.State;
-import org.osgi.framework.BundleContext;
-
-import org.eclipse.virgo.medic.dump.Dump;
-import org.eclipse.virgo.medic.dump.DumpContributionFailedException;
-import org.eclipse.virgo.medic.dump.DumpContributor;
-
-/**
- * An implementation of {@link DumpContributor} that generates a resolution state dump.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe
- *
- */
-public class ResolutionDumpContributor implements DumpContributor {
-
- // The following literal must match DependencyCalculator.RESOLUTION_STATE_KEY in the kernel userregion bundle.
- public final static String RESOLUTION_STATE_KEY = "resolution.state";
-
- private final ResolutionStateDumper resolutionStateDumper;
-
- public ResolutionDumpContributor(BundleContext bundleContext) {
- PlatformAdmin platformAdmin = bundleContext.getService(bundleContext.getServiceReference(PlatformAdmin.class));
- //OsgiFrameworkUtils.getService(bundleContext, PlatformAdmin.class).getService();
- this.resolutionStateDumper = new ResolutionStateDumper(new StandardSystemStateAccessor(platformAdmin), new StandardStateWriter(platformAdmin.getFactory()));
- }
-
- /**
- * {@inheritDoc}
- */
- public void contribute(Dump dump) throws DumpContributionFailedException {
- File outputFile = dump.createFile("osgi.zip");
- if (dump.getContext().containsKey(RESOLUTION_STATE_KEY)) {
- resolutionStateDumper.dump(outputFile, (State) dump.getContext().get(RESOLUTION_STATE_KEY));
- } else {
- resolutionStateDumper.dump(outputFile);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return "resolution";
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionStateDumper.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionStateDumper.java
deleted file mode 100644
index e52e303e..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionStateDumper.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump.internal;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.osgi.service.resolver.State;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.eclipse.virgo.util.io.PathReference;
-import org.eclipse.virgo.util.io.ZipUtils;
-
-/**
- * Utility class that writes the current Equinox resolver {@link State} to a ZIP file.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-final class ResolutionStateDumper {
-
- private static final String ENTRY_NAME_STATE = "state/";
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final SystemStateAccessor systemStateAccessor;
-
- private final StateWriter stateWriter;
-
- /**
- * Creates a new <code>ResolutionStateDumper</code>.
- * @param systemStateAccessor to access live system {@link State}
- * @param stateWriter to write a {@link State} to permanent storage
- */
- public ResolutionStateDumper(SystemStateAccessor systemStateAccessor, StateWriter stateWriter) {
- this.systemStateAccessor = systemStateAccessor;
- this.stateWriter = stateWriter;
- }
-
- /**
- * Dump the global resolver {@link State} into a ZIP file at the supplied location.
- *
- * @param outputFile the location to create the ZIP file at.
- */
- public void dump(File outputFile) {
- dump(outputFile, this.systemStateAccessor.getSystemState());
- }
-
- /**
- * Dump a resolver {@link State} into a ZIP file at the supplied location.
- *
- * @param outputFile the location to create the ZIP file at.
- * @param state the state to dump
- */
- public void dump(File outputFile, State state) {
- File outdir = new File(getTmpDir(), "resolve-" + System.currentTimeMillis());
- if (outdir.mkdirs()) {
- try {
- this.stateWriter.writeState(state, outdir);
- } catch (IOException e) {
- this.logger.error("Unable to write resolver state.", e);
- }
- } else {
- throw new RuntimeException("Unable to create temporary directory '" + outdir.getAbsolutePath() + "'.");
- }
-
- try {
- zipStateDirectory(outputFile, outdir);
- } catch (IOException e) {
- this.logger.error("Unable to create ZIP of state dump", e);
- } finally {
- if (!new PathReference(outdir).delete(true)) {
- this.logger.warn("Temporary state directory '%s' was not removed after use.", outdir.getAbsolutePath());
- }
- }
- }
-
- private void zipStateDirectory(File outputFile, File dumpDir) throws IOException {
- PathReference output = new PathReference(outputFile);
- PathReference toZip = new PathReference(dumpDir);
-
- ZipUtils.zipTo(toZip, output, ENTRY_NAME_STATE);
- }
-
- private String getTmpDir() {
- String path = System.getProperty("java.io.tmpdir");
- return path;
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StandardStateWriter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StandardStateWriter.java
deleted file mode 100644
index 221b07c8..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StandardStateWriter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump.internal;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-
-
-/**
- * Standard implementation of {@link StateWriter}.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-class StandardStateWriter implements StateWriter {
-
- private final StateObjectFactory factory;
-
- StandardStateWriter(StateObjectFactory factory) {
- this.factory = factory;
- }
-
- /**
- * {@inheritDoc}
- */
- public void writeState(State state, File output) throws IOException {
- this.factory.writeState(state, output);
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StandardSystemStateAccessor.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StandardSystemStateAccessor.java
deleted file mode 100644
index 9522640d..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StandardSystemStateAccessor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump.internal;
-
-import org.eclipse.osgi.internal.baseadaptor.StateManager;
-import org.eclipse.osgi.service.resolver.PlatformAdmin;
-import org.eclipse.osgi.service.resolver.State;
-
-/**
- * Standard implementation of {@link SystemStateAccessor}.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-final class StandardSystemStateAccessor implements SystemStateAccessor {
-
- private final PlatformAdmin platformAdmin;
-
- StandardSystemStateAccessor(PlatformAdmin platformAdmin) {
- this.platformAdmin = platformAdmin;
- }
-
- /**
- * {@inheritDoc}
- */
- public State getSystemState() {
- return ((StateManager)this.platformAdmin).getSystemState();
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StateWriter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StateWriter.java
deleted file mode 100644
index 3f5502bc..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/StateWriter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump.internal;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.osgi.service.resolver.State;
-
-
-/**
- * A <code>StateWriter</code> is used to write a {@link State} to disk.
- *
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- * Implementations must be thread-safe.
- *
- */
-public interface StateWriter {
-
- /**
- * Writes the given <code>State</code> to the given <code>output</code> location.
- *
- * @param state The <code>State</code> to write
- * @param outputDir The directory to which it should be written.
- *
- * @throws IOException if a failure occurs when writing the state
- */
- void writeState(State state, File outputDir) throws IOException;
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/SystemStateAccessor.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/SystemStateAccessor.java
deleted file mode 100644
index 48209ad1..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/dump/internal/SystemStateAccessor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump.internal;
-
-import org.eclipse.osgi.service.resolver.State;
-
-
-/**
- * A <code>SystemStateAccessor</code> provides access to the live system {@link State}.
- *
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-interface SystemStateAccessor {
-
- /**
- * Returns the {@link State} for the system
- * @return the system <code>State</code>.
- */
- State getSystemState();
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/enforcement/NonNullAssertionEnforcer.aj b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/enforcement/NonNullAssertionEnforcer.aj
deleted file mode 100644
index d1290bce..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/serviceability/enforcement/NonNullAssertionEnforcer.aj
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.enforcement;
-
-import org.aspectj.lang.annotation.SuppressAjWarnings;
-import org.eclipse.virgo.kernel.serviceability.Assert;
-import org.eclipse.virgo.kernel.serviceability.NonNull;
-
-
-/**
- * Aspect that enforces that parameters annotated with {@link NonNull} are, in fact, non null.
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-public final aspect NonNullAssertionEnforcer {
-
- pointcut serviceability() : within(org.eclipse.virgo.kernel.serviceability..*);
-
- pointcut executingOperationWithNonNullFirstParameter(Object obj) :
- !serviceability() &&
- (execution(* *(@NonNull (*), ..)) || preinitialization(*.new(@NonNull (*), ..))) && args(obj, ..) ;
-
- pointcut executingOperationWithNonNullSecondParameter(Object obj) :
- !serviceability() &&
- (execution(* *(*, @NonNull (*), ..)) || preinitialization(*.new(*, @NonNull (*), ..))) && args(*, obj, ..);
-
- pointcut executingOperationWithNonNullThirdParameter(Object obj) :
- !serviceability() &&
- (execution(* *(*, *, @NonNull (*), ..)) || preinitialization(*.new(*, *, @NonNull (*), ..))) && args(*, * , obj, ..);
-
- pointcut executingOperationWithNonNullFourthParameter(Object obj) :
- !serviceability() &&
- (execution(* *(*, *, *, @NonNull (*), ..)) || preinitialization(*.new(*, *, *, @NonNull (*), ..))) && args(*, *, *, obj, ..);
-
- pointcut executingOperationWithNonNullFifthParameter(Object obj) :
- !serviceability() &&
- (execution(* *(*, *, *, *, @NonNull (*), ..)) || preinitialization(*.new(*, *, *, *, @NonNull (*), ..))) && args(*, *, *, *, obj, ..);
-
- pointcut executingOperationWithNonNullSixthParameter(Object obj) :
- !serviceability() &&
- (execution(* *(*, *, *, *, *, @NonNull (*), ..)) || preinitialization(*.new(*, *, *, *, *, @NonNull (*), ..))) && args(*, *, *, *, *, obj, ..);
-
- before(Object argValue) : executingOperationWithNonNullFirstParameter(argValue) {
- Assert.notNull(argValue, "Argument [1] cannot be null");
- }
-
- before(Object argValue) : executingOperationWithNonNullSecondParameter(argValue) {
- Assert.notNull(argValue, "Argument [2] cannot be null");
- }
-
- @SuppressAjWarnings({"adviceDidNotMatch"})
- before(Object argValue) : executingOperationWithNonNullThirdParameter(argValue) {
- Assert.notNull(argValue, "Argument [3] cannot be null");
- }
-
- @SuppressAjWarnings({"adviceDidNotMatch"})
- before(Object argValue) : executingOperationWithNonNullFourthParameter(argValue) {
- Assert.notNull(argValue, "Argument [4] cannot be null");
- }
-
- @SuppressAjWarnings({"adviceDidNotMatch"})
- before(Object argValue) : executingOperationWithNonNullFifthParameter(argValue) {
- Assert.notNull(argValue, "Argument [5] cannot be null");
- }
-
- @SuppressAjWarnings({"adviceDidNotMatch"})
- before(Object argValue) : executingOperationWithNonNullSixthParameter(argValue) {
- Assert.notNull(argValue, "Argument [6] cannot be null");
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/Scope.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/Scope.java
deleted file mode 100644
index 9939295d..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/Scope.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shim.scope;
-
-/**
- * {@link Scope} defines a collection of bundles, packages, and services. There is a global scope as well as more local scopes such as those used to contain
- * multi-bundle applications.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this interface must be thread safe.
- *
- */
-public interface Scope {
-
- public static final String PROPERTY_SERVICE_SCOPE = "org.eclipse.virgo.service.scope";
-
- public static final String SCOPE_ID_GLOBAL = "global";
-
- public static final String SCOPE_ID_APP = "app";
-
- /**
- * Return <code>true</code> if and only if this scope is global.
- *
- * @return <code>true</code> if and only if this scope is global
- */
- boolean isGlobal();
-
- /**
- * Return the name of this scope or <code>null</code> if this scope is global.
- *
- * @return the name of this scope or <code>null</code> if this scope is global
- */
- String getScopeName();
-
- /**
- * Get the value of the scope property with the given name or <code>null</code> if the scope has no such property.
- *
- * @param propertyName the name of the property
- * @return the value of the property or <code>null</code> if the scope has no such property
- */
- Object getProperty(String propertyName);
-
- /**
- * Set the value of the scope property with the given name to the given value.
- *
- * @param propertyName the name of the property
- * @param propertyValue the value of the property
- */
- void setProperty(String propertyName, Object propertyValue);
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/ScopeFactory.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/ScopeFactory.java
deleted file mode 100644
index 867c5a4d..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/ScopeFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shim.scope;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Creates {@link Scope} instances for {@link ServiceReference ServiceReferences} and for lookups. <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this interface must be thread safe.
- *
- */
-public interface ScopeFactory {
-
- /**
- * Get the {@link Scope} containing the given {@link Bundle}.
- *
- * @param bundle the <code>Bundle</code> whose scope is required
- * @return the <code>Scope</code> containing the given bundle
- */
- Scope getBundleScope(Bundle bundle);
-
- /**
- * Get the global {@link Scope}.
- *
- * @return the global <code>Scope</code>
- */
- Scope getGlobalScope();
-
- /**
- * Gets the {@link Scope} under which the referenced service is published.
- * @param ref service reference
- * @return the scope
- */
- Scope getServiceScope(ServiceReference ref);
-
- /**
- * Get the {@link Scope} for the given application scope name.
- *
- * @param applicationScopeName the name of the scope
- * @return the {@link Scope} with the given name
- */
- Scope getApplicationScope(String applicationScopeName);
-
- /**
- * Destroy the given application {@link Scope}. Existing <code>Scope</code> instances equivalent to the given
- * <code>Scope</code> will continue to exist and share properties, but calls to get a <code>Scope</code> with the
- * same application scope name as the given <code>Scope</code> will produce a new <code>Scope</code> with a distinct
- * collection of properties. Effectively, this method delimits a 'generation' of an application scope.
- *
- * @param applicationScope the application <code>Scope</code> to be destroyed.
- */
- void destroyApplicationScope(Scope applicationScope);
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/internal/StandardScopeFactory.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/internal/StandardScopeFactory.java
deleted file mode 100644
index 2086fd11..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/scope/internal/StandardScopeFactory.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shim.scope.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.eclipse.virgo.kernel.diagnostics.KernelLogEvents;
-import org.eclipse.virgo.kernel.shim.scope.Scope;
-import org.eclipse.virgo.kernel.shim.scope.ScopeFactory;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Creates {@link Scope} instances for {@link ServiceReference ServiceReferences} and for lookups.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-public final class StandardScopeFactory implements ScopeFactory {
-
- private static final String PROPERTY_BEAN_NAME = "org.springframework.osgi.bean.name";
-
- private final EventLogger eventLogger;
-
- /*
- * Share application scope properties between equivalent application scope instances
- */
- private final Map<AppScope, ConcurrentHashMap<String, Object>> properties = new HashMap<AppScope, ConcurrentHashMap<String, Object>>();
-
- public StandardScopeFactory(EventLogger eventLogger) {
- this.eventLogger = eventLogger;
- }
-
- /**
- * {@inheritDoc}
- */
- public Scope getBundleScope(Bundle bundle) {
- return isBundleScoped(bundle) ? createApplicationScope(bundle) : GlobalScope.INSTANCE;
-
- }
-
- /**
- * @param bundle
- * @return
- */
- private Scope createApplicationScope(Bundle bundle) {
- return getApplicationScope(getScopeName(bundle));
- }
-
- /**
- * {@inheritDoc}
- */
- public Scope getGlobalScope() {
- return GlobalScope.INSTANCE;
- }
-
- /**
- * {@inheritDoc}
- */
- public Scope getServiceScope(ServiceReference ref) {
- return Scope.SCOPE_ID_APP.equals(getScopeIdentifier(ref)) ? getBundleScope(ref.getBundle()) : getGlobalScope();
- }
-
- /**
- * {@inheritDoc}
- */
- public Scope getApplicationScope(String applicationScopeName) {
- synchronized (this.properties) {
- AppScope appScope = new AppScope(applicationScopeName);
- ConcurrentHashMap<String, Object> props = this.properties.get(appScope);
- if (props == null) {
- props = new ConcurrentHashMap<String, Object>();
- this.properties.put(appScope, props);
- }
- appScope.setProperties(props);
-
- return appScope;
- }
- }
-
- private String getScopeIdentifier(ServiceReference ref) {
- String serviceScope = (String) ref.getProperty(Scope.PROPERTY_SERVICE_SCOPE);
- if (serviceScope == null) {
- /*
- * Tolerate the former property name to avoid breaking dm Server 2.0.x users. Post 2.1.0 the former property
- * name need not be supported. Issue a warning message to prompt users to change the name.
- */
- serviceScope = (String) ref.getProperty("com.springsource.service.scope");
- if (serviceScope == null) {
- String beanName = (String) ref.getProperty(PROPERTY_BEAN_NAME);
- if (beanName == null) {
- serviceScope = Scope.SCOPE_ID_GLOBAL;
- } else {
- if (isBundleScoped(ref.getBundle())) {
- serviceScope = Scope.SCOPE_ID_APP;
- } else {
- serviceScope = Scope.SCOPE_ID_GLOBAL;
- }
- }
- } else {
- this.eventLogger.log(KernelLogEvents.OLD_SCOPING_PROPERTY_USED, ref.getBundle().getSymbolicName(), ref.getBundle().getVersion(),
- ref.getProperty(PROPERTY_BEAN_NAME));
- }
- }
- return serviceScope;
- }
-
- private static boolean isBundleScoped(Bundle bundle) {
- // TODO: reinstate return OsgiFrameworkUtils.getScopeName(bundle) != null;
- return getScopeName(bundle) != null;
- }
-
- private static String getScopeName(Bundle bundle) {
- // TODO: use OFUtils instead when in proper location
- return (String) bundle.getHeaders().get("Module-Scope");
- }
-
- /**
- * {@inheritDoc}
- */
- public void destroyApplicationScope(Scope applicationScope) {
- // TODO: reinstate Assert.isTrue(applicationScope instanceof AppScope, "wrong scope type");
- AppScope appScope = (AppScope) applicationScope;
- synchronized (this.properties) {
- this.properties.remove(appScope);
- }
- }
-
- private abstract static class StandardScope implements Scope {
-
- private volatile ConcurrentHashMap<String, Object> properties;
-
- protected StandardScope() {
- }
-
- final void setProperties(ConcurrentHashMap<String, Object> properties) {
- // TODO: reinstate Assert.isNull(this.properties, "properties can only be set once");
- this.properties = properties;
- }
-
- /**
- * {@inheritDoc}
- */
- public final Object getProperty(String propertyName) {
- // TODO: reinstate Assert.isTrue(this.properties != null, "properties not set");
- return this.properties.get(propertyName);
- }
-
- /**
- * {@inheritDoc}
- */
- public final void setProperty(String propertyName, Object propertyValue) {
- // TODO: reinstate Assert.isTrue(this.properties != null, "properties not set");
- this.properties.put(propertyName, propertyValue);
- }
-
- /**
- * {@inheritDoc}
- */
- public int hashCode() {
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- StandardScope other = (StandardScope) obj;
- /*
- * Instances that have not had their properties set compare equal (unless overridden by subclasses).
- * Instances that have had their properties set must use the same properties object reference to compare
- * equal.
- */
- if (properties == null || other.properties == null) {
- return true;
- } else if (properties != other.properties) {
- return false;
- }
- return true;
- }
-
- }
-
- private static class GlobalScope extends StandardScope {
-
- static GlobalScope INSTANCE = new GlobalScope();
-
- private GlobalScope() {
- setProperties(new ConcurrentHashMap<String, Object>());
- }
-
- /**
- * {@inheritDoc}
- */
- public int hashCode() {
- return 316;
- }
-
- public boolean equals(Object other) {
- return other == this || other instanceof GlobalScope;
- }
-
- public String toString() {
- return Scope.SCOPE_ID_GLOBAL;
- }
-
- public boolean isGlobal() {
- return true;
- }
-
- public String getScopeName() {
- // The global scope does not have a name.
- return null;
- }
- }
-
- private static class AppScope extends StandardScope {
-
- private final String scopeName;
-
- public AppScope(String scopeName) {
- this.scopeName = scopeName;
- }
-
- /**
- * {@inheritDoc}
- */
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((scopeName == null) ? 0 : scopeName.hashCode());
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- AppScope other = (AppScope) obj;
- if (scopeName == null) {
- if (other.scopeName != null) {
- return false;
- }
- } else if (!scopeName.equals(other.scopeName)) {
- return false;
- }
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return Scope.SCOPE_ID_APP + ":" + this.scopeName;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isGlobal() {
- return false;
- }
-
- public String getScopeName() {
- return this.scopeName;
- }
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/serviceability/TracingService.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/serviceability/TracingService.java
deleted file mode 100644
index a987aa62..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/serviceability/TracingService.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shim.serviceability;
-
-/**
- * <p>
- * The Platform's tracing service.
- * <p/>
- * <p>
- * An instance of this interface is available from the OSGi service registry.
- * </p>
- * <p>
- * <strong>Concurrent Semantics</strong><br />
- * Implementations <strong>must</strong> be thread safe.
- * </p>
- *
- */
-public interface TracingService {
-
- /**
- * Informs the tracing service that the calling thread is within the scope of the application identified by
- * <code>applicationName</code>. This setting can be cleared, e.g. because the calling thread is no longer in the
- * scope of an application, by calling this method with <code>null</code>.
- *
- * @param applicationName The name of the application that is in scope on the calling thread.
- */
- void setCurrentApplicationName(String applicationName);
-
- /**
- * Returns the name of the application that is currently associated with the current thread
- *
- * @return The name of the application associated with the thread.
- */
- String getCurrentApplicationName();
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/serviceability/internal/Slf4jTracingService.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/serviceability/internal/Slf4jTracingService.java
deleted file mode 100644
index e4ca11b4..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/shim/serviceability/internal/Slf4jTracingService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shim.serviceability.internal;
-
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.slf4j.MDC;
-
-
-public final class Slf4jTracingService implements TracingService {
-
- public static final String APPLICATION_NAME = "applicationName";
-
- public String getCurrentApplicationName() {
- return MDC.get(APPLICATION_NAME);
- }
-
- public void setCurrentApplicationName(String applicationName) {
- MDC.put(APPLICATION_NAME, applicationName);
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties
deleted file mode 100644
index 3eec2038..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-KE0001I = Kernel starting.
-KE0002I = Kernel started.
-KE0003E = Kernel failed to start.
-KE0004E = Kernel failed to start within {} seconds.
-KE0005W = Option -plan requires one or two arguments but {} were provided: '{}'.
-KE0006E = Kernel failed to start due to the aborted start of '{}' version '{}'.
-
-KE0010I = Shutdown initiated.
-KE0011I = Immediate shutdown initiated.
-
-KE0100W = Reference '{}' in bundle '{}' version '{}' is waiting for service with filter '{}'.
-KE0101I = Reference '{}' in bundle '{}' version '{}' was satisfied by service with filter '{}'.
-KE0102E = Reference '{}' in bundle '{}' version '{}' timed out waiting for service with filter '{}'.
-
-KE0200W = OVF configuration file '{}' does not exist.
-KE0201E = Error reading OVF configuration file '{}'.
-
-KE0300W = Service property in bundle '{}' version '{}' (bean '{}') should be renamed from com.springsource.service.scope to org.eclipse.virgo.service.scope.
diff --git a/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernel_config.xml b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernel_config.xml
deleted file mode 100644
index d07c2ddd..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernel_config.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"
- immediate="true" name="org.eclipse.virgo.kernel" configuration-policy="require">
- <implementation
- class="org.eclipse.virgo.kernel.config.internal.StandardKernelConfig" />
- <service>
- <provide interface="org.eclipse.virgo.kernel.core.KernelConfig" />
- </service>
-</scr:component> \ 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
deleted file mode 100644
index 86d91f70..00000000
--- a/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?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="static"/>
- <reference name="DumpGenerator"
- interface="org.eclipse.virgo.medic.dump.DumpGenerator"
- policy="static"/>
- <reference name="ConfigAdmin"
- interface="org.osgi.service.cm.ConfigurationAdmin"
- policy="static"/>
- <reference name="EventAdmin"
- interface="org.osgi.service.event.EventAdmin"
- policy="static"/>
-</component> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/StubConfiguration.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/StubConfiguration.java
deleted file mode 100644
index e24678ce..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/StubConfiguration.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel;
-
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.cm.Configuration;
-
-public class StubConfiguration implements Configuration {
-
- private Hashtable properties = null;
-
- private final String pid;
-
- private final String factoryPid;
-
- public StubConfiguration() {
- this(null, null);
- }
-
- public StubConfiguration(String pid, String factoryPid) {
- this.pid = pid;
- this.factoryPid = factoryPid;
- }
-
- public void delete() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- public String getBundleLocation() {
- throw new UnsupportedOperationException();
- }
-
- public String getFactoryPid() {
- return factoryPid;
- }
-
- public String getPid() {
- return pid;
- }
-
- @SuppressWarnings("unchecked")
- public Dictionary getProperties() {
- if (this.properties == null)
- return null;
- Hashtable propertiesCopy = new Hashtable();
- propertiesCopy.putAll(this.properties);
- return propertiesCopy;
- }
-
- public void setBundleLocation(String arg0) {
- throw new UnsupportedOperationException();
- }
-
- public void update() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- public void update(Dictionary dictionary) throws IOException {
- this.properties = (Hashtable) dictionary;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((pid == null) ? 0 : pid.hashCode());
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- StubConfiguration other = (StubConfiguration) obj;
- if (pid == null) {
- if (other.pid != null)
- return false;
- } else if (!pid.equals(other.pid))
- return false;
- return true;
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/StubConfigurationAdmin.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/StubConfigurationAdmin.java
deleted file mode 100644
index 93171756..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/StubConfigurationAdmin.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-
-public class StubConfigurationAdmin implements ConfigurationAdmin {
-
- private final AtomicInteger factoryConfigurationCounter = new AtomicInteger(0);
- private final Map<String, Configuration> configurations = new HashMap<String, Configuration>();
-
- public Configuration createFactoryConfiguration(String arg0) throws IOException {
- return createFactoryConfiguration(arg0, null);
- }
-
- public Configuration createFactoryConfiguration(String arg0, String arg1) throws IOException {
- final String pid = arg0 + "-" + System.currentTimeMillis() + "-" + factoryConfigurationCounter.incrementAndGet();
- return getConfiguration(pid, arg1, arg0);
- }
-
- public Configuration getConfiguration(String arg0) throws IOException {
- return getConfiguration(arg0, null);
- }
-
- public Configuration getConfiguration(String pid, String location) throws IOException {
- return getConfiguration(pid, location, null);
- }
-
- public Configuration[] listConfigurations(String arg0) throws IOException, InvalidSyntaxException {
- if (arg0 == null) {
- return configurations.values().toArray(new Configuration[configurations.values().size()]);
- }
- throw new UnsupportedOperationException("only support 'null' filter in stub");
- }
-
- private Configuration getConfiguration(String pid, String location, String factoryPid) {
- Configuration configuration = this.configurations.get(pid);
- if (configuration == null) {
- configuration = new StubConfiguration(pid, factoryPid);
- configurations.put(pid, configuration);
- }
- return configuration;
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfoTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfoTests.java
deleted file mode 100644
index c43b3be1..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminConfigurationInfoTests.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (c) 2010 Olivier Girardot
- * 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:
- * Olivier Girardot - initial contribution
- */
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.virgo.kernel.StubConfigurationAdmin;
-import org.eclipse.virgo.kernel.serviceability.Assert.FatalAssertionException;
-import org.junit.Test;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-
-/**
- * This class is for testing {@link ConfigurationAdminConfigurationInfo} class,
- * an implementation of the {@link ConfigurationInfo} interface.
- */
-public class ConfigurationAdminConfigurationInfoTests {
- private static final String CONFIG_INFO_TEST_PID = "CUSTOM_PID";
-
- @Test
- public void testGetPid() {
- ConfigurationAdmin stubAdmin = new StubConfigurationAdmin();
- ConfigurationInfo configurationInfo = new ConfigurationAdminConfigurationInfo(stubAdmin, CONFIG_INFO_TEST_PID);
- assertEquals(CONFIG_INFO_TEST_PID, configurationInfo.getPid());
- }
-
- @Test
- public void testGetPropertiesFromEmptyConfiguration() {
- ConfigurationAdmin stubAdmin = new StubConfigurationAdmin();
- ConfigurationInfo configurationInfo = new ConfigurationAdminConfigurationInfo(stubAdmin, CONFIG_INFO_TEST_PID);
- assertEquals("Properties map should be empty.", new HashMap<String, String>(), configurationInfo.getProperties());
- }
-
- @Test
- public void testFailingConfigurationAdmin() throws IOException {
- ConfigurationAdmin mockAdmin = createMock(ConfigurationAdmin.class);
- expect(mockAdmin.getConfiguration(CONFIG_INFO_TEST_PID, null)).andThrow(new IOException("Error trying to load configuration"));
- replay(mockAdmin);
-
- ConfigurationInfo configurationInfo = new ConfigurationAdminConfigurationInfo(mockAdmin, CONFIG_INFO_TEST_PID);
- assertNull(configurationInfo.getProperties());
- }
-
- @Test(expected=FatalAssertionException.class)
- public void testFailingConstructorWithNullConfigurationAdmin() throws IOException {
- ConfigurationInfo configurationInfo = new ConfigurationAdminConfigurationInfo(null, CONFIG_INFO_TEST_PID);
- }
-
- @Test
- public void testGetPropertiesWithFilledConfiguration() throws IOException {
- ConfigurationAdmin stubAdmin = new StubConfigurationAdmin();
- Configuration config = stubAdmin.getConfiguration(CONFIG_INFO_TEST_PID, null);
-
- Dictionary<String, String> dict = new Hashtable<String, String>();
- dict.put("key", "value");
-
- config.update(dict);
-
- ConfigurationInfo configurationInfo = new ConfigurationAdminConfigurationInfo(stubAdmin, CONFIG_INFO_TEST_PID);
-
- Map<String, String> expectedMap = new HashMap<String, String>();
- expectedMap.put("key", "value");
- assertEquals(expectedMap, configurationInfo.getProperties());
- }
-
- @Test
- public void testNonStringDictionaryKeys() throws IOException {
- ConfigurationAdmin stubAdmin = new StubConfigurationAdmin();
- Configuration config = stubAdmin.getConfiguration(CONFIG_INFO_TEST_PID, null);
-
- Dictionary<String, Object> dict = new Hashtable<String, Object>();
- dict.put("key", Boolean.TRUE);
-
- config.update(dict);
-
- ConfigurationInfo configurationInfo = new ConfigurationAdminConfigurationInfo(stubAdmin, CONFIG_INFO_TEST_PID);
-
- Map<String, String> expectedMap = new HashMap<String, String>();
- expectedMap.put("key", "true");
- assertEquals(expectedMap, configurationInfo.getProperties());
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminDumpContributorTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminDumpContributorTests.java
deleted file mode 100644
index c6bb548c..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationAdminDumpContributorTests.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright (c) 2010 Olivier Girardot
- * 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:
- * Olivier Girardot - initial contribution
- */
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.eclipse.virgo.util.io.FileSystemUtils.deleteRecursively;
-import static org.eclipse.virgo.util.io.IOUtils.closeQuietly;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-
-import org.eclipse.virgo.medic.dump.Dump;
-import org.eclipse.virgo.medic.dump.DumpContributionFailedException;
-import org.eclipse.virgo.medic.dump.DumpContributor;
-import org.eclipse.virgo.teststubs.osgi.service.cm.StubConfiguration;
-import org.eclipse.virgo.teststubs.osgi.service.cm.StubConfigurationAdmin;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-
-/**
- * This class is for testing {@link ConfigurationAdminDumpContributor} class,
- * an implementation of the {@link DumpContributor} interface.
- */
-public class ConfigurationAdminDumpContributorTests {
-
- private static final String TEST_OUTPUT_FILE_NAME = "Test-dump.out";
- private static final String NORMAL_OUTPUT_FILE_NAME = "configurationAdmin.properties";
- private static final String DC_NAME = "configurationAdmin";
-
- private final File testDumpOutputDir = new File(new File("target"), "ConfigurationAdminDumpTests");
- private File testDumpOutputFile;
-
- @Before
- public void setupTestDir() {
- deleteRecursively(this.testDumpOutputDir);
- this.testDumpOutputDir.mkdir();
- this.testDumpOutputFile = new File(new File("target"), TEST_OUTPUT_FILE_NAME);
- }
-
- @After
- public void deleteTestDir() {
- deleteRecursively(this.testDumpOutputDir);
- }
-
- @Test
- public void testGetName() {
- DumpContributor configAdminDC = new ConfigurationAdminDumpContributor(
- new StubConfigurationAdmin());
- assertEquals(DC_NAME, configAdminDC.getName());
- }
-
- @Test
- public void testContribute() throws DumpContributionFailedException, IOException, InvalidSyntaxException {
- Dump mockDump = createMock(Dump.class);
-
- StubConfiguration testConfig = new StubConfiguration("test");
- testConfig.addProperty("service.key", "value");
-
- FileWriter dumpFileWriter = new FileWriter(testDumpOutputFile);
- expect(mockDump.createFileWriter(NORMAL_OUTPUT_FILE_NAME)).andReturn(dumpFileWriter);
-
- ConfigurationAdmin mockAdmin = createMock(ConfigurationAdmin.class);
- expect(mockAdmin.listConfigurations(null)).andReturn(new Configuration[]{testConfig});
-
- replay(mockDump, mockAdmin);
-
- DumpContributor configAdminDC = new ConfigurationAdminDumpContributor(mockAdmin);
- configAdminDC.contribute(mockDump);
-
- verify(mockAdmin, mockDump);
-
- assertWriterClosed(dumpFileWriter);
- assertCorrectContribution(this.testDumpOutputFile);
- }
-
- private static void assertCorrectContribution(File dumpFile) throws IOException {
- String sb = getFileAsString(dumpFile);
-
- assertTrue("Unexpected dump contribution output.",
- sb.equals("########\n# test #\n########\n\nservice.pid:\ttest\nservice.key:\tvalue\n\n\n")
- || sb.equals("########\n# test #\n########\n\nservice.key:\tvalue\nservice.pid:\ttest\n\n\n")
- );
- }
-
- private static String getFileAsString(File dumpFile) throws IOException {
- StringBuilder sb = new StringBuilder();
- BufferedReader in = null;
- try {
- in = new BufferedReader(new FileReader(dumpFile));
- while (in.ready())
- sb.append(in.readLine()).append("\n");
- } finally {
- closeQuietly(in);
- }
- return sb.toString();
- }
-
- private static void assertWriterClosed(Writer writer) {
- try {
- writer.flush();
- fail("Writer not already flushed, therefore not already closed.");
- } catch (IOException _) {
- // expected and ignored
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisherTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisherTests.java
deleted file mode 100644
index 5b77b952..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ConfigurationPublisherTests.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-
-import org.eclipse.virgo.kernel.StubConfigurationAdmin;
-import org.eclipse.virgo.kernel.config.internal.ConfigurationPublisher;
-import org.eclipse.virgo.kernel.config.internal.PropertiesSource;
-import org.junit.Test;
-import org.osgi.service.cm.Configuration;
-
-/**
- */
-public class ConfigurationPublisherTests {
-
- @Test
- public void testSingleSource() throws IOException {
- StubPropertiesSource source = new StubPropertiesSource();
-
- String pid = "single";
-
- Properties p = new Properties();
- p.setProperty("foo", "bar");
-
- source.configurationProperties.put(pid, p);
-
- StubConfigurationAdmin configAdmin = new StubConfigurationAdmin();
-
- ConfigurationPublisher publisher = new ConfigurationPublisher(configAdmin, source);
- publisher.publishConfigurations();
-
- Configuration configuration = configAdmin.getConfiguration(pid, null);
- assertConfigurationEquals(configuration, p);
-
- }
-
- @Test
- public void testTwoSources() throws Exception {
- StubPropertiesSource one = new StubPropertiesSource();
- StubPropertiesSource two = new StubPropertiesSource();
-
- // setup one
- String pidOne = "one";
-
- Properties propertiesOne = new Properties();
- propertiesOne.setProperty("foo", "bar");
-
- one.configurationProperties.put(pidOne, propertiesOne);
-
- // setup two
- String pidTwo = "two";
-
- Properties propertiesTwo = new Properties();
- propertiesTwo.setProperty("bar", "baz");
-
- two.configurationProperties.put(pidTwo, propertiesTwo);
-
- StubConfigurationAdmin configAdmin = new StubConfigurationAdmin();
-
- ConfigurationPublisher publisher = new ConfigurationPublisher(configAdmin, one, two);
- publisher.publishConfigurations();
-
- Configuration configuration = configAdmin.getConfiguration(pidOne, null);
- assertConfigurationEquals(configuration, propertiesOne);
-
- configuration = configAdmin.getConfiguration(pidTwo, null);
- assertConfigurationEquals(configuration, propertiesTwo);
-
- }
-
- @Test
- public void testMultiSourceMerge() throws Exception {
- StubPropertiesSource one = new StubPropertiesSource();
- StubPropertiesSource two = new StubPropertiesSource();
-
- // setup one
- String pidOne = "one";
-
- Properties propertiesOne = new Properties();
- propertiesOne.setProperty("foo", "bar");
- propertiesOne.setProperty("bar", "baz");
-
- one.configurationProperties.put(pidOne, propertiesOne);
-
- // setup two
- String pidTwo = pidOne;
-
- Properties propertiesTwo = new Properties();
- propertiesTwo.setProperty("bar", "boo");
- propertiesTwo.setProperty("boo", "bof");
-
- two.configurationProperties.put(pidTwo, propertiesTwo);
-
- StubConfigurationAdmin configAdmin = new StubConfigurationAdmin();
-
- ConfigurationPublisher publisher = new ConfigurationPublisher(configAdmin, one, two);
- publisher.publishConfigurations();
-
- Configuration configuration = configAdmin.getConfiguration(pidOne, null);
-
- assertEquals("bar", configuration.getProperties().get("foo"));
- assertEquals("boo", configuration.getProperties().get("bar"));
- assertEquals("bof", configuration.getProperties().get("boo"));
- }
-
- @Test
- public void testPublicationIncludingFactoryConfigurations() throws Exception {
- File[] dirs = new File[] { new File("src/test/resources/UserConfigurationPropertiesSourceTests")};
-
- UserConfigurationPropertiesSource source = new UserConfigurationPropertiesSource(dirs);
-
- StubConfigurationAdmin configAdmin = new StubConfigurationAdmin();
-
- ConfigurationPublisher publisher = new ConfigurationPublisher(configAdmin, source);
- publisher.publishConfigurations();
-
- // make sure nothing broke on the way here and file name based pids still work
- Configuration three = configAdmin.getConfiguration("three", null);
- assertConfigurationEquals(three, source.getConfigurationProperties().get("three"));
-
- // check on factories
- List<Configuration> factories = new ArrayList<Configuration>();
- Configuration[] all = configAdmin.listConfigurations(null);
- for (Configuration c : all) {
- if ("factory.pid".equals(c.getFactoryPid())) {
- factories.add(c);
- }
- }
-
- assertEquals(2, factories.size());
- }
-
- private void assertConfigurationEquals(Configuration configuration, Properties properties) {
- for (String s : properties.stringPropertyNames()) {
- assertEquals(properties.getProperty(s), configuration.getProperties().get(s));
- }
- }
-
- private static class StubPropertiesSource implements PropertiesSource {
-
- private final Map<String, Properties> configurationProperties = new TreeMap<String, Properties>();
-
- /**
- * {@inheritDoc}
- */
- public Map<String, Properties> getConfigurationProperties() {
- return this.configurationProperties;
- }
-
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java
deleted file mode 100644
index ed6e2dbb..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Map;
-import java.util.Properties;
-
-import org.junit.Test;
-
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-
-
-
-/**
- */
-public class KernelConfigurationPropertiesSourceTests {
-
- @Test
- public void testGetProperties() {
- StubBundleContext context = new StubBundleContext();
- context.addProperty(KernelConfiguration.PROPERTY_KERNEL_HOME, "target/home");
-
- KernelConfiguration configuration = new KernelConfiguration(context);
-
- KernelConfigurationPropertiesSource source = new KernelConfigurationPropertiesSource(configuration);
-
- Map<String, Properties> configurationProperties = source.getConfigurationProperties();
- Properties properties = configurationProperties.get(KernelConfigurationPropertiesSource.KERNEL_CONFIGURATION_PID);
- assertNotNull(properties);
- assertEquals(configuration.getDomain(), properties.getProperty(KernelConfigurationPropertiesSource.PROPERTY_DOMAIN));
- assertEquals(configuration.getHomeDirectory().getAbsolutePath(), properties.getProperty(KernelConfigurationPropertiesSource.PROPERTY_HOME_DIRECTORY));
- assertEquals(configuration.getWorkDirectory().getAbsolutePath(), properties.getProperty(KernelConfigurationPropertiesSource.PROPERTY_WORK_DIRECTORY));
- assertEquals(Integer.toString(configuration.getStartupWaitLimit()), properties.getProperty(KernelConfigurationPropertiesSource.PROPERTY_KERNEL_STARTUP_WAIT_LIMIT));
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java
deleted file mode 100644
index b801a541..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-
-import org.junit.Test;
-
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-
-
-/**
- */
-public class KernelConfigurationTests {
-
- @Test
- public void testCreateMinimalKernelConfiguration() {
- StubBundleContext context = new StubBundleContext();
- context.addProperty(KernelConfiguration.PROPERTY_KERNEL_HOME, "target");
-
- KernelConfiguration configuration = new KernelConfiguration(context);
- assertEquals(new File("target"), configuration.getHomeDirectory());
- assertNotNull(configuration.getWorkDirectory());
- assertNotNull(configuration.getConfigDirectories());
- assertEquals(1, configuration.getConfigDirectories().length);
- assertNotNull(configuration.getDomain());
- assertNotNull(configuration.getStartupWaitLimit());
- }
-
- @Test
- public void testCustomConfiguration() {
- StubBundleContext context = new StubBundleContext();
- context.addProperty(KernelConfiguration.PROPERTY_KERNEL_HOME, "target");
- context.addProperty(KernelConfiguration.PROPERTY_KERNEL_DOMAIN, "my.domain");
- context.addProperty(KernelConfiguration.PROPERTY_KERNEL_CONFIG, "foo,bar");
- context.addProperty(KernelConfiguration.PROPERTY_KERNEL_STARTUP_WAIT_LIMIT, "60");
-
- KernelConfiguration configuration = new KernelConfiguration(context);
- assertEquals(new File("target"), configuration.getHomeDirectory());
- assertNotNull(configuration.getWorkDirectory());
- assertNotNull(configuration.getConfigDirectories());
- assertEquals(2, configuration.getConfigDirectories().length);
- assertEquals("my.domain", configuration.getDomain());
- assertEquals(60, configuration.getStartupWaitLimit());
- }
-
- @Test(expected=IllegalStateException.class)
- public void testMissingKernelHomeProperty() {
- new KernelConfiguration(new StubBundleContext());
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/UserConfigurationPropertiesSourceTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/UserConfigurationPropertiesSourceTests.java
deleted file mode 100644
index 916b9c4f..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/UserConfigurationPropertiesSourceTests.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal;
-
-import java.io.File;
-import java.util.Map;
-import java.util.Properties;
-
-import org.eclipse.virgo.kernel.config.internal.UserConfigurationPropertiesSource;
-import org.junit.Test;
-
-
-import static org.junit.Assert.*;
-
-
-/**
- */
-public class UserConfigurationPropertiesSourceTests {
-
- @Test
- public void testReadUserConfiguration() {
- File[] dirs = new File[]{
- new File("src/test/resources/" + getClass().getSimpleName())
- };
-
- UserConfigurationPropertiesSource source = new UserConfigurationPropertiesSource(dirs);
- Map<String, Properties> properties = source.getConfigurationProperties();
-
- Properties one = properties.get("one");
- Properties two = properties.get("two");
- Properties three = properties.get("three");
- assertNotNull(one);
- assertNotNull(two);
- assertNotNull(three);
- assertEquals("bar", one.getProperty("foo"));
- assertEquals("baz", two.getProperty("bar"));
- assertEquals("three", three.getProperty("foo"));
- }
-
- @Test
- public void testReadFactoryUserConfiguration() {
- File[] dirs = new File[]{
- new File("src/test/resources/" + getClass().getSimpleName())
- };
-
- UserConfigurationPropertiesSource source = new UserConfigurationPropertiesSource(dirs);
- Map<String, Properties> properties = source.getConfigurationProperties();
-
- assertEquals(5, properties.size());
-
- Properties one = properties.get("factory.pid-factoryOne");
- Properties two = properties.get("factory.pid-factoryTwo");
-
- assertNotNull(one);
- assertNotNull(two);
- assertEquals("one", one.getProperty("foo"));
- assertEquals("two", two.getProperty("foo"));
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/commandline/CommandLinePropertiesSourceTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/commandline/CommandLinePropertiesSourceTests.java
deleted file mode 100644
index c59e73f0..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/commandline/CommandLinePropertiesSourceTests.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal.commandline;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.junit.Test;
-
-
-import org.eclipse.virgo.kernel.config.internal.PropertiesSource;
-import org.eclipse.virgo.kernel.config.internal.commandline.CommandLinePropertiesSource;
-import org.eclipse.virgo.medic.test.eventlog.LoggedEvent;
-import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-
-public class CommandLinePropertiesSourceTests {
-
- private StubBundleContext bundleContext = new StubBundleContext();
-
- private MockEventLogger eventLogger = new MockEventLogger();
-
- @Test
- public void defaults() {
- PropertiesSource propertiesSource = new CommandLinePropertiesSource(this.bundleContext, this.eventLogger);
- Map<String, Properties> configurationProperties = propertiesSource.getConfigurationProperties();
-
- Properties properties = configurationProperties.get("org.eclipse.virgo.kernel.userregion");
- assertNotNull(properties);
-
- assertEquals("", properties.get("commandLineArtifacts"));
-
- assertEquals(0, this.eventLogger.getLoggedEvents().size());
- }
-
- @Test
- public void singlePlanWithVersion() {
- this.bundleContext.addProperty("org.eclipse.virgo.osgi.launcher.unrecognizedArguments", "-plan,foo,1");
- PropertiesSource propertiesSource = new CommandLinePropertiesSource(this.bundleContext, this.eventLogger);
- Map<String, Properties> configurationProperties = propertiesSource.getConfigurationProperties();
-
- Properties properties = configurationProperties.get("org.eclipse.virgo.kernel.userregion");
- assertNotNull(properties);
-
- assertEquals("repository:plan/foo/1", properties.get("commandLineArtifacts"));
-
- assertEquals(0, this.eventLogger.getLoggedEvents().size());
- }
-
- @Test
- public void singlePlanWithoutVersion() {
- this.bundleContext.addProperty("org.eclipse.virgo.osgi.launcher.unrecognizedArguments", "-plan,foo");
- PropertiesSource propertiesSource = new CommandLinePropertiesSource(this.bundleContext, this.eventLogger);
- Map<String, Properties> configurationProperties = propertiesSource.getConfigurationProperties();
-
- Properties properties = configurationProperties.get("org.eclipse.virgo.kernel.userregion");
- assertNotNull(properties);
-
- assertEquals("repository:plan/foo", properties.get("commandLineArtifacts"));
-
- assertEquals(0, this.eventLogger.getLoggedEvents().size());
- }
-
- @Test
- public void multiplePlans() {
- this.bundleContext.addProperty("org.eclipse.virgo.osgi.launcher.unrecognizedArguments", "-plan,foo,-plan,bar,1.2.3");
- PropertiesSource propertiesSource = new CommandLinePropertiesSource(this.bundleContext, this.eventLogger);
- Map<String, Properties> configurationProperties = propertiesSource.getConfigurationProperties();
-
- Properties properties = configurationProperties.get("org.eclipse.virgo.kernel.userregion");
- assertNotNull(properties);
-
- assertEquals("repository:plan/foo,repository:plan/bar/1.2.3", properties.get("commandLineArtifacts"));
-
- assertEquals(0, this.eventLogger.getLoggedEvents().size());
- }
-
- @Test
- public void planWithMissingArguments() {
- this.bundleContext.addProperty("org.eclipse.virgo.osgi.launcher.unrecognizedArguments", "-plan");
- PropertiesSource propertiesSource = new CommandLinePropertiesSource(this.bundleContext, this.eventLogger);
- Map<String, Properties> configurationProperties = propertiesSource.getConfigurationProperties();
-
- Properties properties = configurationProperties.get("org.eclipse.virgo.kernel.userregion");
- assertNotNull(properties);
-
- assertEquals("", properties.get("commandLineArtifacts"));
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(1, loggedEvents.size());
-
- assertArrayEquals(new Object[] {0, ""}, loggedEvents.get(0).getInserts());
- }
-
- @Test
- public void planWithSurplusArguments() {
- this.bundleContext.addProperty("org.eclipse.virgo.osgi.launcher.unrecognizedArguments", "-plan,foo,bar,1.2.3");
- PropertiesSource propertiesSource = new CommandLinePropertiesSource(this.bundleContext, this.eventLogger);
- Map<String, Properties> configurationProperties = propertiesSource.getConfigurationProperties();
-
- Properties properties = configurationProperties.get("org.eclipse.virgo.kernel.userregion");
- assertNotNull(properties);
-
- assertEquals("", properties.get("commandLineArtifacts"));
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(1, loggedEvents.size());
-
- assertArrayEquals(new Object[] {3, "foo, bar, 1.2.3"}, loggedEvents.get(0).getInserts());
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfEnvironmentPropertiesReaderTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfEnvironmentPropertiesReaderTests.java
deleted file mode 100644
index 8604b3b0..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfEnvironmentPropertiesReaderTests.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal.ovf;
-
-import java.io.FileReader;
-import java.util.Properties;
-
-import org.eclipse.virgo.kernel.config.internal.ovf.OvfEnvironmentPropertiesReader;
-import org.junit.Test;
-
-
-import static org.junit.Assert.*;
-
-
-/**
- */
-public class OvfEnvironmentPropertiesReaderTests {
-
- @Test
- public void testReadProperties() throws Exception {
-
- OvfEnvironmentPropertiesReader reader = new OvfEnvironmentPropertiesReader();
- Properties props = reader.readProperties(new FileReader("src/test/resources/ovf/environment.xml"));
- assertEquals("bar", props.getProperty("com.myapp.foo"));
- assertEquals("baz", props.getProperty("com.myapp.bar"));
-
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfPropertiesSourceTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfPropertiesSourceTests.java
deleted file mode 100644
index f6e3243c..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/ovf/OvfPropertiesSourceTests.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.config.internal.ovf;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.junit.Test;
-
-
-import org.eclipse.virgo.kernel.config.internal.ovf.OvfPropertiesSource;
-import org.eclipse.virgo.kernel.diagnostics.KernelLogEvents;
-import org.eclipse.virgo.medic.test.eventlog.LoggedEvent;
-import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-
-
-/**
- */
-public class OvfPropertiesSourceTests {
-
- @Test
- public void testReadValidFile() {
- MockEventLogger logger = new MockEventLogger();
-
- StubBundleContext context = new StubBundleContext();
- context.addProperty(OvfPropertiesSource.FRAMEWORK_PROPERTY_OVF, "src/test/resources/ovf/valid.xml");
-
- OvfPropertiesSource source = new OvfPropertiesSource(context, logger);
- Map<String, Properties> properties = source.getConfigurationProperties();
- assertNotNull(properties);
-
- Properties one = properties.get("one");
- assertNotNull(one);
- assertEquals("bar", one.getProperty("foo"));
- assertEquals("baz", one.getProperty("bar"));
-
- Properties two = properties.get("two");
- assertNotNull(two);
- assertEquals("quux", two.getProperty("baz"));
-
- }
-
- @Test(expected=IllegalArgumentException.class)
- public void testReadFileWithInvalidProperty() {
- MockEventLogger logger = new MockEventLogger();
-
- StubBundleContext context = new StubBundleContext();
- context.addProperty(OvfPropertiesSource.FRAMEWORK_PROPERTY_OVF, "src/test/resources/ovf/invalid.xml");
-
- OvfPropertiesSource source = new OvfPropertiesSource(context, logger);
- source.getConfigurationProperties();
- }
-
- @Test
- public void testReadNonExistentFile() {
- MockEventLogger logger = new MockEventLogger();
-
- StubBundleContext context = new StubBundleContext();
- context.addProperty(OvfPropertiesSource.FRAMEWORK_PROPERTY_OVF, "src/test/resources/ovf/nonexistent.xml");
-
- OvfPropertiesSource source = new OvfPropertiesSource(context, logger);
- Map<String, Properties> properties = source.getConfigurationProperties();
-
- List<LoggedEvent> loggedEvents = logger.getLoggedEvents();
- assertEquals(1, loggedEvents.size());
-
- LoggedEvent loggedEvent = loggedEvents.get(0);
- assertEquals(KernelLogEvents.OVF_CONFIGURATION_FILE_DOES_NOT_EXIST.getEventCode(), loggedEvent.getCode());
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/BlockingSignalTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/BlockingSignalTests.java
deleted file mode 100644
index 362a9244..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/BlockingSignalTests.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2010 Olivier Girardot
- * 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:
- * Olivier Girardot - initial contribution
- */
-
-package org.eclipse.virgo.kernel.core;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.Vector;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Test;
-
-/**
- * This class is for testing the {@link Signal} implementation {@link BlockingSignal}.
- *
- */
-public final class BlockingSignalTests {
-
- @Test
- public void signalCompletionAfterNoFailure() throws Throwable {
- final BlockingSignal signal = new BlockingSignal();
- ExceptionCatcherThread testThread = new ExceptionCatcherThread(new Runnable(){
- public void run() {
- try {
- // awaiting for signal completion flag
- boolean returnSignal =
- signal.awaitCompletion(1000, TimeUnit.SECONDS);
- assertTrue(returnSignal);
- } catch (FailureSignalledException e) {
- // this code should not be reached
- fail();
- }
- }
- });
- testThread.start();
- signal.signalSuccessfulCompletion();
- testThread.join(10);
- assertFalse("Test thread still alive after delay.", testThread.isAlive());
- testThread.rethrowUncaughtExceptions();
- }
-
- @Test
- public void signalCompletionFailsAfterWaitingExceeded() throws Throwable {
- final BlockingSignal signal = new BlockingSignal();
- ExceptionCatcherThread testThread = new ExceptionCatcherThread(new Runnable(){
- public void run() {
- try {
- // awaiting for signal completion flag
- boolean returnSignal =
- signal.awaitCompletion(1, TimeUnit.MILLISECONDS);
- assertFalse(returnSignal);
- } catch (FailureSignalledException e) {
- // this code should not be reached
- fail();
- }
- }
- });
- testThread.start();
- Thread.sleep(100);
- signal.signalSuccessfulCompletion();
- testThread.join(10);
- assertFalse("Test thread still alive after delay.", testThread.isAlive());
- testThread.rethrowUncaughtExceptions();
- }
-
- @Test
- public void signalCompletionFailsAfterFailureNotifiedToSignal() throws Throwable {
- final BlockingSignal signal = new BlockingSignal();
- final Throwable dummyEx = new Exception("Dummy cause");
- ExceptionCatcherThread testThread = new ExceptionCatcherThread(new Runnable(){
- public void run() {
- try {
- // awaiting for signal completion flag (not storing result, as the code should fail)
- signal.awaitCompletion(1, TimeUnit.SECONDS);
-
- // this code should not be reached
- // an exception being sent before
- fail();
- } catch (FailureSignalledException e) {
- // We'll check that we actually refer to the correct cause
- assertSame("Signal failure has incorrect cause.", dummyEx, e.getCause());
- }
- }
- });
- testThread.start();
- signal.signalFailure(dummyEx);
- testThread.join(10);
- assertFalse("Test thread still alive after delay.", testThread.isAlive());
- testThread.rethrowUncaughtExceptions();
- }
-
- /**
- * Special thread designed to record uncaught exceptions
- * and re-throw the first of them on demand.
- */
- private class ExceptionCatcherThread extends Thread{
- private final Vector<Throwable> uncaughtExceptions = new Vector<Throwable>();
-
- public ExceptionCatcherThread(Runnable r) {
- super(r);
- this.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
- public void uncaughtException(Thread t, Throwable e) {
- uncaughtExceptions.add(e);
- }
- });
- }
-
- public void rethrowUncaughtExceptions() throws Throwable {
- if (!uncaughtExceptions.isEmpty())
- throw uncaughtExceptions.firstElement();
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java
deleted file mode 100644
index 46b121cd..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.BundleListener;
-import org.osgi.service.event.Event;
-import org.springframework.core.task.SyncTaskExecutor;
-
-import org.eclipse.virgo.kernel.core.AbortableSignal;
-import org.eclipse.virgo.kernel.core.internal.BundleStartTracker;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-
-
-/**
- */
-public class BundleStartTrackerTests {
-
- @Test
- public void startOfBundleThatIsNotPoweredBySpringDm() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.setBundleContext(bundleContext);
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
- bundle.start();
-
- assertEquals(1, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
-
- assertEquals(Bundle.ACTIVE, bundle.getState());
- }
-
- @Test
- public void startOfBundleThatIsPoweredBySpringDm() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.addHeader("Spring-Context", "foo");
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.failures.size());
-
- bundle.start();
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
-
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
-
- assertEquals(1, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
- }
-
- @Test
- public void startOfLazyActivationBundle() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.addHeader("Bundle-ActivationPolicy", "lazy");
- bundle.setBundleContext(bundleContext);
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- UnitTestSignal signal = new UnitTestSignal();
- bundleStartTracker.trackStart(bundle, signal);
-
- List<BundleListener> bundleListeners = bundleContext.getBundleListeners();
- for(BundleListener listener : bundleListeners){
- listener.bundleChanged(new BundleEvent(BundleEvent.LAZY_ACTIVATION, bundle));
- }
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
-
- for(BundleListener listener : bundleListeners){
- listener.bundleChanged(new BundleEvent(BundleEvent.STOPPED, bundle));
- }
-
- assertEquals(0, signal.successCount);
- assertEquals(1, signal.abortCount);
- assertEquals(0, signal.failures.size());
- }
-
- @Test
- public void applicationContextCreationFailureOfBundleThatIsPoweredBySpringDm() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.addHeader("Spring-Context", "foo");
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
-
- bundle.start();
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
- Exception failure = new Exception();
- properties.put("exception", failure);
-
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(1, signal.failures.size());
-
- assertTrue(signal.failures.contains(failure));
- }
-
- @Test
- public void trackingOfSpringDmPoweredBundleThatAlreadyCreatedItsContainer() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.addHeader("Spring-Context", "foo");
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
-
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
-
- assertEquals(1, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
- }
-
- @Test
- public void trackingOfSpringDmPoweredBundleThatHasAlreadyFailedToCreateItsApplicationContext() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.addHeader("Spring-Context", "foo");
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
- Exception failure = new Exception();
- properties.put("exception", failure);
-
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(1, signal.failures.size());
- assertTrue(signal.failures.contains(failure));
- }
-
- @Test
- public void signalIsOnlyDrivenOnceEvenWithMultipleEventsForStartOfBundleThatIsPoweredBySpringDm() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.addHeader("Spring-Context", "foo");
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
-
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
-
- assertEquals(1, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
- }
-
- @Test
- public void signalIsOnlyDrivenOnceEvenWithMultipleEventsForApplicationContextCreationFailureOfBundleThatIsPoweredBySpringDm() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.addHeader("Spring-Context", "foo");
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
- Exception failure = new Exception();
- properties.put("exception", failure);
-
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(1, signal.failures.size());
-
- assertTrue(signal.failures.contains(failure));
- }
-
- @Test
- public void createdStateIsCleanedUpWhenBundleIsStopped() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.setBundleContext(bundleContext);
- bundle.addHeader("Spring-Context", "foo");
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
-
- bundle.start();
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
- bundle.stop();
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
- }
-
- @Test
- public void failureStateIsCleanedUpWhenBundleIsStopped() throws BundleException {
- StubBundleContext bundleContext = new StubBundleContext();
- StubBundle bundle = new StubBundle();
- bundle.setBundleContext(bundleContext);
- bundle.addHeader("Spring-Context", "foo");
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(bundleContext);
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
- properties.put("exception", new Exception());
-
- bundle.start();
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
- bundle.stop();
-
- UnitTestSignal signal = new UnitTestSignal();
-
- bundleStartTracker.trackStart(bundle, signal);
-
- assertEquals(0, signal.successCount);
- assertEquals(0, signal.abortCount);
- assertEquals(0, signal.failures.size());
- }
-
- private static final class UnitTestSignal implements AbortableSignal {
-
- private final List<Throwable> failures = new ArrayList<Throwable>();
-
- private int successCount = 0;
- private int abortCount = 0;
-
- /**
- * {@inheritDoc}
- */
- public void signalFailure(Throwable cause) {
- this.failures.add(cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public void signalSuccessfulCompletion() {
- successCount++;
- }
-
- /**
- * {@inheritDoc}
- */
- public void signalAborted() {
- abortCount++;
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java
deleted file mode 100644
index 20e351da..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import static org.easymock.EasyMock.createNiceMock;
-
-import java.io.File;
-
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.event.EventAdmin;
-
-
-import org.eclipse.osgi.service.resolver.PlatformAdmin;
-import org.eclipse.virgo.kernel.StubConfigurationAdmin;
-import org.eclipse.virgo.kernel.core.Shutdown;
-import org.eclipse.virgo.kernel.core.internal.CoreBundleActivator;
-import org.eclipse.virgo.kernel.core.internal.StartupTracker;
-import org.eclipse.virgo.medic.dump.DumpGenerator;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-import org.eclipse.virgo.teststubs.osgi.service.component.StubComponentContext;
-import org.eclipse.virgo.teststubs.osgi.service.event.StubEventAdmin;
-
-/**
- * Test the logic of {@link CoreBundleActivator}
- *
- */
-public class CoreBundleActivatorTests {
-
- @Test(expected = IllegalStateException.class)
- public void noConfigService() throws Exception {
- StubBundleContext bundleContext = new StubBundleContext();
- StubComponentContext componentContext = new StubComponentContext(bundleContext);
- bundleContext.addFilter(StartupTracker.APPLICATION_CONTEXT_FILTER, FrameworkUtil.createFilter(StartupTracker.APPLICATION_CONTEXT_FILTER));
- CoreBundleActivator activator = new TestCoreBundleActivator();
- activator.activate(componentContext);
- }
-
- @Test
- public void startAndStop() throws Exception {
- StubBundleContext bundleContext = new StubBundleContext();
- StubComponentContext componentContext = new StubComponentContext(bundleContext);
- DumpGenerator dumpGenerator = createNiceMock(DumpGenerator.class);
- PlatformAdmin platformAdmin = createNiceMock(PlatformAdmin.class);
- bundleContext.addFilter(StartupTracker.APPLICATION_CONTEXT_FILTER, FrameworkUtil.createFilter(StartupTracker.APPLICATION_CONTEXT_FILTER));
- bundleContext.registerService(ConfigurationAdmin.class, new StubConfigurationAdmin(), null);
- bundleContext.registerService(EventLogger.class, new MockEventLogger(), null);
- bundleContext.registerService(EventAdmin.class, new StubEventAdmin(), null);
- bundleContext.registerService(DumpGenerator.class, dumpGenerator, null);
- bundleContext.registerService(PlatformAdmin.class, platformAdmin, null);
- bundleContext.addProperty("org.eclipse.virgo.kernel.domain", "test");
- bundleContext.addProperty("org.eclipse.virgo.kernel.home", new File(".").getAbsolutePath());
-
- CoreBundleActivator activator = new TestCoreBundleActivator();
- activator.activate(componentContext);
- activator.deactivate(componentContext);
- }
-
- private static final class TestCoreBundleActivator extends CoreBundleActivator {
- @Override
- protected Shutdown createShutdown(BundleContext context, EventLogger eventLogger) {
- return new Shutdown() {
- public void immediateShutdown() {
- }
-
- public void shutdown() {
- }
- };
- }
-
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/ShutdownManagerTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/ShutdownManagerTests.java
deleted file mode 100644
index e07fee7c..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/ShutdownManagerTests.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.junit.Test;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.launch.Framework;
-
-import org.eclipse.virgo.kernel.core.internal.ShutdownManager;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-
-public class ShutdownManagerTests {
-
- private final Framework framework = createMock(Framework.class);
-
- private final MockEventLogger eventLogger = new MockEventLogger();
-
- private final StubBundle bundle = new StubBundle();
-
- private final StubBundleContext bundleContext = new StubBundleContext(bundle);
-
- @Test
- public void shutdown() throws BundleException, InterruptedException {
-
- expect(this.framework.getBundleContext()).andReturn(this.bundleContext).anyTimes();
- this.framework.stop();
- expect(this.framework.waitForStop(30000)).andReturn(new FrameworkEvent(FrameworkEvent.STOPPED, this.bundle, null));
-
- replay(this.framework);
-
- ShutdownManager shutdownManager = new ShutdownManager(this.eventLogger, this.framework);
- shutdownManager.shutdown();
-
- verify(this.framework);
- }
-
- @Test
- public void failedShutdownDrivesImmediateShutdown() throws Exception {
- expect(this.framework.getBundleContext()).andReturn(this.bundleContext).anyTimes();
- this.framework.stop();
- expect(this.framework.waitForStop(30000)).andReturn(new FrameworkEvent(FrameworkEvent.WAIT_TIMEDOUT, this.bundle, null));
-
- replay(this.framework);
-
- UnitTestShutdownManager shutdownManager = new UnitTestShutdownManager(this.eventLogger, this.framework);
- shutdownManager.shutdown();
-
- verify(this.framework);
-
- this.eventLogger.isLogged("KE0011I");
- }
-
- @Test
- public void shutdownMessageLogged() {
- expect(this.framework.getBundleContext()).andReturn(this.bundleContext).anyTimes();
-
- replay(this.framework);
- ShutdownManager shutdownManager = new ShutdownManager(this.eventLogger, this.framework);
- verify(this.framework);
-
- List<BundleListener> bundleListeners = this.bundleContext.getBundleListeners();
-
- assertEquals(1, bundleListeners.size());
- bundleListeners.get(0).bundleChanged(new BundleEvent(BundleEvent.STOPPING, this.bundle));
-
- assertTrue(this.eventLogger.isLogged("KE0010I"));
- }
-
- private static final class UnitTestShutdownManager extends ShutdownManager {
-
- public UnitTestShutdownManager(EventLogger eventLogger, Framework framework) {
- super(eventLogger, framework);
- }
-
- @Override
- public void exitVM() {
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/StartupTrackerTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/StartupTrackerTests.java
deleted file mode 100644
index b3642c14..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/StartupTrackerTests.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.lang.management.ManagementFactory;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Version;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.springframework.core.task.SyncTaskExecutor;
-
-
-import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
-import org.eclipse.virgo.kernel.core.Shutdown;
-import org.eclipse.virgo.kernel.core.internal.BundleStartTracker;
-import org.eclipse.virgo.kernel.core.internal.StartupTracker;
-import org.eclipse.virgo.medic.dump.DumpGenerator;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
-import org.eclipse.virgo.teststubs.osgi.service.event.StubEventAdmin;
-import org.eclipse.virgo.teststubs.osgi.support.ObjectClassFilter;
-
-public class StartupTrackerTests {
-
- private final StubBundleContext bundleContext = new StubBundleContext();
-
- private final StubEventAdmin eventAdmin = new StubEventAdmin();
-
- private final StubBundle bundle = new StubBundle("org.eclipse.virgo.kernel.startuptest", new Version(1,0,0));
-
- private final Shutdown shutdown = createMock(Shutdown.class);
-
- private final DumpGenerator dumpGenerator = createMock(DumpGenerator.class);
-
- @Before
- public void setup() {
- this.bundleContext.addInstalledBundle(bundle);
-
- this.bundleContext.addProperty("org.eclipse.virgo.kernel.home", "target");
- this.bundleContext.addProperty("org.eclipse.virgo.kernel.domain", "the-domain");
- this.bundleContext.addFilter(new ObjectClassFilter("org.springframework.context.ApplicationContext"));
- this.bundleContext.registerService(EventAdmin.class.getName(), this.eventAdmin, null);
-
- this.bundle.setBundleContext(bundleContext);
- }
-
- @Test
- public void successfulStartup() throws Exception {
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(this.bundleContext);
-
- StartupTracker tracker = new StartupTracker(this.bundleContext, new KernelConfiguration(this.bundleContext), 30, bundleStartTracker, this.shutdown, this.dumpGenerator);
- tracker.start();
-
- assertTrue(this.eventAdmin.awaitPostingOfEvent(new Event("org/eclipse/virgo/kernel/STARTING", (Map<String, ?>)null), 10000));
-
- this.bundle.start();
-
- assertTrue(this.eventAdmin.awaitPostingOfEvent(new Event("org/eclipse/virgo/kernel/STARTED", (Map<String, ?>)null), 10000));
-
- tracker.stop();
- }
-
- @Test
- public void startupTimeout() {
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(this.bundleContext);
-
- this.bundle.addHeader("Spring-Context", "foo");
-
- this.shutdown.immediateShutdown();
- this.dumpGenerator.generateDump("startupTimedOut");
-
- replay(this.shutdown, this.dumpGenerator);
-
- StartupTracker tracker = new StartupTracker(this.bundleContext, new KernelConfiguration(this.bundleContext), 1, bundleStartTracker, this.shutdown, this.dumpGenerator);
- tracker.start();
-
- assertTrue(this.eventAdmin.awaitPostingOfEvent(new Event("org/eclipse/virgo/kernel/STARTING", (Map<String, ?>)null), 10000));
- assertTrue(this.eventAdmin.awaitPostingOfEvent(new Event("org/eclipse/virgo/kernel/START_TIMED_OUT", (Map<String, ?>)null), 10000));
-
- waitForABit(500);
-
- tracker.stop();
-
- verify(this.shutdown);
- verify(this.dumpGenerator);
- }
-
- /**
- * This method is used to allow actions taken after the events are posted to complete
- * before making test verification checks. This is an artifact of the testing environment, and the waits
- * should be no more than about 500 ms.
- * @param milliSeconds time to wait
- */
- private void waitForABit(long milliSeconds) {
- try {
- Thread.sleep(milliSeconds);
- } catch (InterruptedException _) {
- }
- }
-
- @Test
- public void startupFailed() throws InterruptedException {
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(this.bundleContext);
-
- this.bundle.addHeader("Spring-Context", "foo");
-
- this.shutdown.immediateShutdown();
-
- Exception failure = new Exception();
- this.dumpGenerator.generateDump("startupFailed", failure);
-
- replay(this.shutdown, this.dumpGenerator);
-
- StartupTracker tracker = new StartupTracker(this.bundleContext, new KernelConfiguration(this.bundleContext), 1, bundleStartTracker, this.shutdown, this.dumpGenerator);
- tracker.start();
-
- assertTrue(this.eventAdmin.awaitPostingOfEvent(new Event("org/eclipse/virgo/kernel/STARTING", (Map<String, ?>)null), 10000));
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put("bundle", bundle);
- properties.put("exception", failure);
-
- bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
-
- assertTrue(this.eventAdmin.awaitPostingOfEvent(new Event("org/eclipse/virgo/kernel/START_FAILED", (Map<String, ?>)null), 10000));
-
- waitForABit(500);
-
- tracker.stop();
-
- verify(this.shutdown, this.dumpGenerator);
- }
-
-
- @Test
- public void statusMBeanRegistration() throws Exception {
- assertMBeanNotRegistered();
-
- BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
- bundleStartTracker.initialize(this.bundleContext);
-
- StartupTracker tracker = new StartupTracker(this.bundleContext, new KernelConfiguration(this.bundleContext), 1, bundleStartTracker, this.shutdown, this.dumpGenerator);
- tracker.start();
-
- assertMBeanRegistered();
-
- tracker.stop();
-
- assertMBeanNotRegistered();
- }
-
- private void assertMBeanRegistered() throws Exception {
- assertTrue(isMBeanRegistered());
- }
-
- private void assertMBeanNotRegistered() throws Exception {
- assertFalse(isMBeanRegistered());
- }
-
- private boolean isMBeanRegistered() throws Exception {
- MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
- return mBeanServer.isRegistered(new ObjectName("the-domain", "type", "KernelStatus"));
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/blueprint/ApplicationContextDependencyMonitorTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/blueprint/ApplicationContextDependencyMonitorTests.java
deleted file mode 100644
index 9659ad5d..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/blueprint/ApplicationContextDependencyMonitorTests.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal.blueprint;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
-import org.junit.Test;
-import org.osgi.framework.Version;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventConstants;
-
-import org.eclipse.virgo.kernel.core.internal.blueprint.ApplicationContextDependencyMonitor;
-import org.eclipse.virgo.medic.test.eventlog.LoggedEvent;
-import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
-import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
-
-/**
- */
-public class ApplicationContextDependencyMonitorTests {
-
- private final MockEventLogger eventLogger = new MockEventLogger();
-
- private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
-
- private final ApplicationContextDependencyMonitor dependencyMonitor = new ApplicationContextDependencyMonitor(executor, eventLogger);
-
- private final StubBundle bundle = new StubBundle("the.bundle", new Version(1, 2, 3));
-
- @Test
- public void loggingOfWaitingEventForMandatoryService() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("filter", "theBean", true));
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(6000);
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(1, loggedEvents.size());
-
- LoggedEvent loggedEvent = loggedEvents.get(0);
-
- assertEquals("KE0100W", loggedEvent.getCode());
- Object[] inserts = loggedEvent.getInserts();
- assertEquals(4, inserts.length);
-
- assertEquals("theBean", inserts[0]);
- assertEquals(this.bundle.getSymbolicName(), inserts[1]);
- assertEquals(this.bundle.getVersion(), inserts[2]);
- assertEquals("filter", inserts[3]);
- }
-
- @Test
- public void loggingOfWaitingEventForOptionalService() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("filter", "theBean", false));
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(6000);
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(1, loggedEvents.size());
-
- LoggedEvent loggedEvent = loggedEvents.get(0);
-
- assertEquals("KE0100W", loggedEvent.getCode());
- Object[] inserts = loggedEvent.getInserts();
- assertEquals(4, inserts.length);
-
- assertEquals("theBean", inserts[0]);
- assertEquals(this.bundle.getSymbolicName(), inserts[1]);
- assertEquals(this.bundle.getVersion(), inserts[2]);
- assertEquals("filter", inserts[3]);
- }
-
- @Test
- public void loggingOfDependencySatisfied() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("filter", "theBean", true));
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(6000);
-
- event = new Event("org/osgi/service/blueprint/container/GRACE_PERIOD", createProperties());
- this.dependencyMonitor.handleEvent(event);
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(2, loggedEvents.size());
-
- LoggedEvent loggedEvent = loggedEvents.get(1);
-
- assertEquals("KE0101I", loggedEvent.getCode());
- Object[] inserts = loggedEvent.getInserts();
- assertEquals(4, inserts.length);
-
- assertEquals("theBean", inserts[0]);
- assertEquals(this.bundle.getSymbolicName(), inserts[1]);
- assertEquals(this.bundle.getVersion(), inserts[2]);
- assertEquals("filter", inserts[3]);
- }
-
- @Test
- public void loggingOfMandatoryDependencyTimedOut() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("filter", "theBean", true));
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(6000);
-
- event = new Event("org/osgi/service/blueprint/container/FAILURE", createProperties("filter", "theBean", true));
- this.dependencyMonitor.handleEvent(event);
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(2, loggedEvents.size());
-
- LoggedEvent loggedEvent = loggedEvents.get(1);
-
- assertEquals("KE0102E", loggedEvent.getCode());
- Object[] inserts = loggedEvent.getInserts();
- assertEquals(4, inserts.length);
-
- assertEquals("theBean", inserts[0]);
- assertEquals(this.bundle.getSymbolicName(), inserts[1]);
- assertEquals(this.bundle.getVersion(), inserts[2]);
- assertEquals("filter", inserts[3]);
- }
-
- @Test
- public void loggingOfOptionalDependencyTimedOut() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("filter", "theBean", false));
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(6000);
-
- event = new Event("org/osgi/service/blueprint/container/FAILURE", createProperties("filter", "theBean", false));
- this.dependencyMonitor.handleEvent(event);
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(2, loggedEvents.size());
-
- LoggedEvent loggedEvent = loggedEvents.get(1);
-
- assertEquals("KE0102E", loggedEvent.getCode());
- Object[] inserts = loggedEvent.getInserts();
- assertEquals(4, inserts.length);
-
- assertEquals("theBean", inserts[0]);
- assertEquals(this.bundle.getSymbolicName(), inserts[1]);
- assertEquals(this.bundle.getVersion(), inserts[2]);
- assertEquals("filter", inserts[3]);
- }
-
- @Test
- public void containerCreationFailureRemovesTickers() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("filter", "theBean", true));
- this.dependencyMonitor.handleEvent(event);
-
- event = new Event("org/osgi/service/blueprint/container/FAILURE", createProperties());
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(3000);
-
- assertFalse(this.eventLogger.getCalled());
- }
-
- @Test
- public void containerCreationDrivesOutstandingTickers() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("filter", "theBean", true));
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(6000);
-
- event = new Event("org/osgi/service/blueprint/container/CREATED", createProperties());
- this.dependencyMonitor.handleEvent(event);
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(2, loggedEvents.size());
-
- LoggedEvent loggedEvent = loggedEvents.get(1);
-
- assertEquals("KE0101I", loggedEvent.getCode());
- Object[] inserts = loggedEvent.getInserts();
- assertEquals(4, inserts.length);
-
- assertEquals("theBean", inserts[0]);
- assertEquals(this.bundle.getSymbolicName(), inserts[1]);
- assertEquals(this.bundle.getVersion(), inserts[2]);
- assertEquals("filter", inserts[3]);
- }
-
- @Test
- public void dependencyThatIsSatisfiedQuicklyLogsNothing() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("filter", "theBean", true));
- this.dependencyMonitor.handleEvent(event);
-
- event = new Event("org/osgi/service/blueprint/container/GRACE_PERIOD", createProperties());
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(3000);
-
- List<LoggedEvent> loggedEvents = this.eventLogger.getLoggedEvents();
- assertEquals(0, loggedEvents.size());
- }
-
- @Test
- public void slowServicesAreGivenLongerToBecomeAvailable() throws InterruptedException {
- Event event = new Event("org/osgi/service/blueprint/container/WAITING", createProperties("(org.eclipse.virgo.server.slowservice=true)",
- "theBean", true));
- this.dependencyMonitor.handleEvent(event);
-
- Thread.sleep(3000);
-
- assertFalse(this.eventLogger.getCalled());
- }
-
- @Test
- public void containerCreatedNotWaiting() {
- Event event = new Event("org/osgi/service/blueprint/container/CREATED", createProperties());
- this.dependencyMonitor.handleEvent(event);
- }
-
- @Test
- public void changeInUnsatisfiedDependenciesNotWaiting() {
- Event event = new Event("org/osgi/service/blueprint/container/GRACE_PERIOD", createProperties());
- this.dependencyMonitor.handleEvent(event);
- }
-
- @Test
- public void serviceDependenciesTimedOutNotWaiting() {
- Event event = new Event("org/osgi/service/blueprint/container/FAILURE", createProperties("filter", "theBean", false));
- this.dependencyMonitor.handleEvent(event);
- }
-
- @Test
- public void containerCreationFailedNotWaiting() {
- Event event = new Event("org/osgi/service/blueprint/container/FAILURE", createProperties());
- this.dependencyMonitor.handleEvent(event);
- }
-
- @SuppressWarnings("unchecked")
- private Dictionary<String, ?> createProperties(String filter, String beanName, boolean mandatory) {
- Dictionary properties = createProperties();
-
- properties.put("dependencies", new String[] { filter });
- properties.put("bean.name", new String[] { beanName });
- properties.put("mandatory", new boolean[] { mandatory });
-
- return properties;
- }
-
- @SuppressWarnings("unchecked")
- private Dictionary<String, ?> createProperties() {
- Dictionary properties = new Hashtable();
- properties.put(EventConstants.BUNDLE, this.bundle);
- return properties;
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/blueprint/TickerTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/blueprint/TickerTests.java
deleted file mode 100644
index 3ea4606b..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/blueprint/TickerTests.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.core.internal.blueprint;
-
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-
-import org.eclipse.virgo.kernel.core.internal.blueprint.StandardTicker;
-import org.eclipse.virgo.kernel.core.internal.blueprint.Ticker;
-import org.junit.Assert;
-import org.junit.Test;
-
-
-/**
- */
-public class TickerTests {
-
- private volatile int ticks;
-
- @Test public void testTicker() throws InterruptedException {
- this.ticks = 0;
- Ticker ticker = StandardTicker.createExponentialTicker(20, 100, 60 * 1000, new Callable<Void>() {
-
- public Void call() throws Exception {
- TickerTests.this.ticks++;
- return null;
- }}, new ScheduledThreadPoolExecutor(1));
-
- Thread.sleep(2000);
- ticker.cancel();
-
- Assert.assertEquals(6, ticks);
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/AssertTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/AssertTests.java
deleted file mode 100644
index 431d75cd..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/AssertTests.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.virgo.kernel.serviceability.Assert;
-import org.eclipse.virgo.kernel.serviceability.Assert.FatalAssertionException;
-import org.junit.Test;
-
-
-/**
- */
-public class AssertTests {
-
- @Test
- public void testHasLength() {
- try {
- Assert.hasLength(null, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- try {
- Assert.hasLength("", "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Assert.hasLength("x", "blah");
- }
-
- @Test
- public void testIsAssignable() {
- try {
- Assert.isAssignable(String.class, Object.class, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- try {
- Assert.isAssignable(null, Object.class, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- try {
- Assert.isAssignable(Object.class, null, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Assert.isAssignable(Object.class, Object.class, "blah");
- Assert.isAssignable(Object.class, String.class, "blah");
- }
-
- @Test
- public void testIsInstanceOf() {
- try {
- Assert.isInstanceOf(Integer.class, "", "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- try {
- Assert.isInstanceOf(null, "", "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- try {
- Assert.isInstanceOf(Integer.class, null, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Assert.isInstanceOf(String.class, "", "blah");
- }
-
- @Test
- public void testIsNull() {
- try {
- Assert.isNull("", "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Assert.isNull(null, "blah");
- }
-
- @Test
- public void testIsTrue() {
- try {
- Assert.isTrue(false, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Assert.isTrue(true, "blah");
- }
-
- @Test
- public void testIsFalse() {
- try {
- Assert.isFalse(true, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Assert.isFalse(false, "blah");
- }
-
- @Test
- public void testNotEmptyCollection() {
- try {
- Assert.notEmpty(new HashSet<String>(), "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- try {
- Assert.notEmpty((Collection<String>)null, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Set<String> a = new HashSet<String>();
- a.add("x");
- Assert.notEmpty(a, "blah");
- }
-
- @Test
- public void testNotEmptyMap() {
- try {
- Assert.notEmpty(new HashMap<String, String>(), "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- try {
- Assert.notEmpty((Map<String, String>)null, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Map<String, String> a = new HashMap<String, String>();
- a.put("k", "v");
- Assert.notEmpty(a, "blah");
- }
-
- @Test
- public void testNotEmptyArray() {
- try {
- Object[] a = {};
- Assert.notEmpty(a, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- try {
- Assert.notEmpty((Object[])null, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Object[] a = {"x"};
- Assert.notEmpty(a, "blah");
- }
-
- @Test
- public void testNotNull() {
- try {
- Assert.notNull(null, "blah");
- org.junit.Assert.assertTrue(false);
- } catch (FatalAssertionException e) {
- }
- Assert.notNull("x", "blah");
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/dump/FFDCExceptionStateTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/dump/FFDCExceptionStateTests.java
deleted file mode 100644
index d67bbeff..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/dump/FFDCExceptionStateTests.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.CountDownLatch;
-
-import org.eclipse.virgo.kernel.serviceability.dump.FFDCExceptionState;
-import org.junit.Test;
-
-
-public class FFDCExceptionStateTests {
-
- @Test
- public void seen() {
- Throwable throwable = new Throwable();
- assertFalse(FFDCExceptionState.seen(throwable));
- FFDCExceptionState.record(throwable);
- assertTrue(FFDCExceptionState.seen(throwable));
- }
-
- @Test
- public void multithreadedSeen() {
- final Throwable throwable = new Throwable();
- FFDCExceptionState.record(throwable);
- assertTrue(FFDCExceptionState.seen(throwable));
- SeenChecker checker = new SeenChecker(throwable);
- checker.start();
- assertFalse(checker.seen());
- }
-
- @Test
- public void seenAsNestedCause() {
- Throwable nested = new Throwable();
- FFDCExceptionState.record(nested);
- Throwable root = new Throwable(nested);
- assertTrue(FFDCExceptionState.seen(root));
- }
-
- private class SeenChecker extends Thread {
-
- private final Throwable throwable;
- private volatile boolean seen;
- private final CountDownLatch latch;
-
- public SeenChecker(Throwable throwable) {
- this.throwable = throwable;
- this.latch = new CountDownLatch(1);
- }
-
- public boolean seen() {
- boolean awaiting = true;
- while (awaiting) {
- try {
- this.latch.await();
- awaiting = false;
- } catch (InterruptedException ie) {
-
- }
- }
- return this.seen;
- }
-
- public void run() {
- seen = FFDCExceptionState.seen(throwable);
- latch.countDown();
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionStateDumperTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionStateDumperTests.java
deleted file mode 100644
index fc94b28d..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/dump/internal/ResolutionStateDumperTests.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.dump.internal;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.virgo.util.io.PathReference;
-import org.eclipse.virgo.util.io.ZipUtils;
-import org.junit.Test;
-
-/**
- */
-public class ResolutionStateDumperTests {
-
- @Test
- public void createDump() throws Exception {
-
- State state = createNiceMock(State.class);
- StubStateWriter writer = new StubStateWriter();
-
- byte[] bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- writer.addBytes(state, bytes);
-
- ResolutionStateDumper dumper = new ResolutionStateDumper(new StubSystemStateAccessor(state), writer);
-
- File outputFile = new File("./target/dump.zip");
- if (outputFile.exists()) {
- assertTrue(outputFile.delete());
- }
-
- dumper.dump(outputFile);
-
- assertTrue(outputFile.exists());
-
- PathReference unzipLocation = new PathReference("target/dump");
- if (unzipLocation.exists()) {
- assertTrue(unzipLocation.delete(true));
- }
-
- ZipUtils.unzipTo(new PathReference(outputFile), unzipLocation);
- File stateFile = new File("target/dump/state/state");
-
- assertTrue(stateFile.exists());
- assertEquals(10, stateFile.length());
-
- byte[] actualBytes = new byte[10];
-
- new FileInputStream(stateFile).read(actualBytes);
-
- assertArrayEquals(bytes, actualBytes);
- }
-
- private static final class StubSystemStateAccessor implements SystemStateAccessor {
-
- private final State systemState;
-
- private StubSystemStateAccessor(State systemState) {
- this.systemState = systemState;
- }
-
- public State getSystemState() {
- return this.systemState;
- }
- }
-
- private static final class StubStateWriter implements StateWriter {
-
- private final Map<State, byte[]> stateBytes = new HashMap<State, byte[]>();
-
- private void addBytes(State state, byte[] bytes) {
- this.stateBytes.put(state, bytes);
- }
-
- public void writeState(State state, File outputDir) throws IOException {
- byte[] bytes = this.stateBytes.get(state);
- if (bytes == null) {
- throw new IOException();
- } else {
- FileOutputStream fos = null;
-
- try {
- fos = new FileOutputStream(new File(outputDir, "state"));
- fos.write(bytes);
- } finally {
- if (fos != null) {
- fos.close();
- }
- }
- }
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/enforcement/NonNullAssertionEnforcerTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/enforcement/NonNullAssertionEnforcerTests.java
deleted file mode 100644
index 413359b4..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/serviceability/enforcement/NonNullAssertionEnforcerTests.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.serviceability.enforcement;
-
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import test.AssertingService;
-
-import org.eclipse.virgo.kernel.serviceability.Assert;
-import org.eclipse.virgo.kernel.serviceability.dump.DumpCoordinator;
-import org.eclipse.virgo.medic.dump.DumpGenerator;
-
-public class NonNullAssertionEnforcerTests {
-
- @Before
- public void injectDumpGenerator() {
- DumpCoordinator.aspectOf().setDumpGenerator(new StubDumpGenerator());
- }
-
- @Test(expected = Assert.FatalAssertionException.class)
- public void firstMethodArg() {
- AssertingService service = new AssertingService();
- service.test(null);
- }
-
- @Test(expected = Assert.FatalAssertionException.class)
- public void secondMethodArg() {
- AssertingService service = new AssertingService();
- service.test("foo", null);
- }
-
- @Test(expected = Assert.FatalAssertionException.class)
- public void thirdMethodArg() {
- AssertingService service = new AssertingService();
- service.test("foo", 1, null);
- }
-
- @Test(expected = Assert.FatalAssertionException.class)
- public void firstConstructorArg() {
- new AssertingService(null);
- }
-
- @Test(expected = Assert.FatalAssertionException.class)
- public void secondConstructorArg() {
- new AssertingService("foo", null);
- }
-
- @Test(expected = Assert.FatalAssertionException.class)
- public void thirdConstructorArg() {
- new AssertingService("foo", 1, null);
- }
-
- private static class StubDumpGenerator implements DumpGenerator {
-
- public void generateDump(String cause, Throwable... throwables) {
- }
-
- public void generateDump(String cause, Map<String, Object> context, Throwable... throwables) {
- }
-
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/test/AssertingService.java b/org.eclipse.virgo.kernel.core/src/test/java/test/AssertingService.java
deleted file mode 100644
index 006c96b2..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/java/test/AssertingService.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package test;
-
-import org.eclipse.virgo.kernel.serviceability.NonNull;
-
-
-/**
- */
-@SuppressWarnings("unused")
-public class AssertingService {
-
- public AssertingService() {
-
- }
-
- public AssertingService( @NonNull String a) {
-
- }
-
- public AssertingService(String a, @NonNull Integer b) {
-
- }
-
- public AssertingService(String a, Integer b, @NonNull Double c) {
-
- }
-
- public void test(@NonNull String a) {
- }
-
- public void test(@NonNull String a, @NonNull Integer b) {
-
- }
-
- public void test(String a, Integer b, @NonNull Double d) {
-
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_badprops/noprops.properties b/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_badprops/noprops.properties
deleted file mode 100644
index b419c60e..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_badprops/noprops.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-
-!@£$%^&*()_
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_noprops/noise.config b/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_noprops/noise.config
deleted file mode 100644
index f13418ca..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_noprops/noise.config
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "types": {
- "int" : 123,
- "string": "foo",
- "boolean": true,
- "path1": "foo/bar",
- "path2": "/foo/bar",
- "path3": "../../foo/bar",
- "path4": "/foo/../bar"
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_noprops/noise2.config b/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_noprops/noise2.config
deleted file mode 100644
index f13418ca..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_noprops/noise2.config
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "types": {
- "int" : 123,
- "string": "foo",
- "boolean": true,
- "path1": "foo/bar",
- "path2": "/foo/bar",
- "path3": "../../foo/bar",
- "path4": "/foo/../bar"
- }
-}
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_props1/dup.properties b/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_props1/dup.properties
deleted file mode 100644
index 30aee8b2..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_props1/dup.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-# Properties file for Config Admin service configuration properties.
-test=This is a test string
-dup_prop=Duplicate property one
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_props2/dup.properties b/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_props2/dup.properties
deleted file mode 100644
index f700caf3..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/ConfigBundleTests/config_tests_props2/dup.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-# Properties file for Config Admin service configuration properties.
-test=This is a test string as well
-dup_prop=Duplicate property two
-hidden=Hidden property
-boolean=false
-integer=1024
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/factoryOne.properties b/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/factoryOne.properties
deleted file mode 100644
index 114554ce..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/factoryOne.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-service.factoryPid = factory.pid
-
-foo=one \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/factoryTwo.properties b/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/factoryTwo.properties
deleted file mode 100644
index 96288204..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/factoryTwo.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-service.factoryPid = factory.pid
-
-foo = two \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/one.properties b/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/one.properties
deleted file mode 100644
index 74d0a43f..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/one.properties
+++ /dev/null
@@ -1 +0,0 @@
-foo=bar
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/two.properties b/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/two.properties
deleted file mode 100644
index eacf225c..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/two.properties
+++ /dev/null
@@ -1 +0,0 @@
-bar=baz
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/withServicePid.properties b/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/withServicePid.properties
deleted file mode 100644
index 636ac8c4..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/UserConfigurationPropertiesSourceTests/withServicePid.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-service.pid = three
-
-foo=three \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/ovf/environment.xml b/org.eclipse.virgo.kernel.core/src/test/resources/ovf/environment.xml
deleted file mode 100644
index 9c16f830..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/ovf/environment.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Environment xmlns="http://schemas.dmtf.org/ovf/environment/1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1"
- xsi:schemaLocation="http://schemas.dmtf.org/ovf/environment/1 http://schemas.dmtf.org/ovf/environment/1/dsp8027.xsd"
- ovfenv:id="DB1">
-
- <!-- This example reference a local schema file, to validate against online schema use:
- xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8027_1.0.0.xsd"
- -->
-
- <!-- Information about hypervisor platform -->
- <PlatformSection>
- <Kind>ESX Server</Kind>
- <Version>3.0.1</Version>
- <Vendor>VMware, Inc.</Vendor>
- <Locale>en_US</Locale>
- </PlatformSection>
-
- <!--- Properties defined for this virtual machine -->
- <PropertySection>
- <Property ovfenv:key="com.myapp.foo" ovfenv:value="bar"/>
- <Property ovfenv:key="com.myapp.bar" ovfenv:value="baz"/>
- </PropertySection>
-
-</Environment>
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/ovf/invalid.xml b/org.eclipse.virgo.kernel.core/src/test/resources/ovf/invalid.xml
deleted file mode 100644
index ee406ee4..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/ovf/invalid.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Environment xmlns="http://schemas.dmtf.org/ovf/environment/1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1"
- xsi:schemaLocation="http://schemas.dmtf.org/ovf/environment/1 http://schemas.dmtf.org/ovf/environment/1/dsp8027.xsd"
- ovfenv:id="DB1">
-
- <!-- This example reference a local schema file, to validate against online schema use:
- xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8027_1.0.0.xsd"
- -->
-
- <!-- Information about hypervisor platform -->
- <PlatformSection>
- <Kind>ESX Server</Kind>
- <Version>3.0.1</Version>
- <Vendor>VMware, Inc.</Vendor>
- <Locale>en_US</Locale>
- </PlatformSection>
-
- <!--- Properties defined for this virtual machine -->
- <PropertySection>
- <Property ovfenv:key="cm:invalid" ovfenv:value="bar"/>
- </PropertySection>
-
-</Environment>
diff --git a/org.eclipse.virgo.kernel.core/src/test/resources/ovf/valid.xml b/org.eclipse.virgo.kernel.core/src/test/resources/ovf/valid.xml
deleted file mode 100644
index aff0fc60..00000000
--- a/org.eclipse.virgo.kernel.core/src/test/resources/ovf/valid.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Environment xmlns="http://schemas.dmtf.org/ovf/environment/1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1"
- xsi:schemaLocation="http://schemas.dmtf.org/ovf/environment/1 http://schemas.dmtf.org/ovf/environment/1/dsp8027.xsd"
- ovfenv:id="DB1">
-
- <!-- This example reference a local schema file, to validate against online schema use:
- xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8027_1.0.0.xsd"
- -->
-
- <!-- Information about hypervisor platform -->
- <PlatformSection>
- <Kind>ESX Server</Kind>
- <Version>3.0.1</Version>
- <Vendor>VMware, Inc.</Vendor>
- <Locale>en_US</Locale>
- </PlatformSection>
-
- <!--- Properties defined for this virtual machine -->
- <PropertySection>
- <Property ovfenv:key="cm:one:foo" ovfenv:value="bar"/>
- <Property ovfenv:key="cm:one:bar" ovfenv:value="baz"/>
- <Property ovfenv:key="cm:two:baz" ovfenv:value="quux"/>
- <Property ovfenv:key="some.random.property" ovfenv:value="value"/>
- </PropertySection>
-
-</Environment>
diff --git a/org.eclipse.virgo.kernel.core/template.mf b/org.eclipse.virgo.kernel.core/template.mf
deleted file mode 100644
index f8293025..00000000
--- a/org.eclipse.virgo.kernel.core/template.mf
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Virgo Kernel Core
-Bundle-SymbolicName: org.eclipse.virgo.kernel.core
-Bundle-Version: ${version}
-Service-Component: OSGI-INF/kernel_config.xml,OSGI-INF/kernelcore.xml
-Import-Template:
- org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
- org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
- org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
- org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
- javax.management.*;version="0",
- javax.xml.parsers;version="0",
- org.osgi.*;version="0",
- org.springframework.*;version="${org.springframework:[2.5.6, +1)}",
- org.springframework.osgi.*;version="${org.springframework.osgi:[=.=.=, +1)}",
- org.eclipse.osgi.*;version="0",
- org.eclipse.equinox.region.*;version="${org.eclipse.equinox.region:[=.=.=, =.+1)}",
- org.w3c.dom;version="0",
- org.xml.sax;version="0"
-Excluded-Exports:
- *.internal.*
-Excluded-Imports: org.eclipse.virgo.osgi.extensions.*
diff --git a/org.eclipse.virgo.kernel.deployer.dm/ivy.xml b/org.eclipse.virgo.kernel.deployer.dm/ivy.xml
index 219408dc..c569e04d 100644
--- a/org.eclipse.virgo.kernel.deployer.dm/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer.dm/ivy.xml
@@ -21,7 +21,7 @@
<dependency org="org.springframework" name="org.springframework.beans" rev="${org.springframework}" conf="compile->runtime"/>
<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->runtime"/>
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="compile->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.kernel.core" rev="${org.eclipse.virgo.nano}" conf="compile->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration" conf="compile->compile"/>
<dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic" rev="${org.eclipse.virgo.medic}" conf="aspects, compile->runtime"/>
<dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic.core" rev="${org.eclipse.virgo.medic}" conf="runtime->runtime"/>
diff --git a/org.eclipse.virgo.kernel.deployer.test/ivy.xml b/org.eclipse.virgo.kernel.deployer.test/ivy.xml
index 7571b4a1..2899561d 100644
--- a/org.eclipse.virgo.kernel.deployer.test/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer.test/ivy.xml
@@ -21,7 +21,7 @@
<dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.common" rev="${org.eclipse.virgo.util}" conf="test->compile"/>
<dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.io" rev="${org.eclipse.virgo.util}" conf="test->compile"/>
<dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.math" rev="${org.eclipse.virgo.util}" conf="test->compile"/>
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="test->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.kernel.core" rev="${org.eclipse.virgo.nano}" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.model" rev="latest.integration" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration" conf="test->compile"/>
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
index 885209a7..0f561185 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
@@ -31,7 +31,9 @@ launcher.bundles =\
file:../ivy-cache/repository/org.springframework/org.springframework.beans/3.0.5.RELEASE/org.springframework.beans-3.0.5.RELEASE.jar,\
file:../ivy-cache/repository/org.springframework/org.springframework.core/3.0.5.RELEASE/org.springframework.core-3.0.5.RELEASE.jar,\
file:../ivy-cache/repository/org.springframework/org.springframework.context/3.0.5.RELEASE/org.springframework.context-3.0.5.RELEASE.jar,\
- file:../org.eclipse.virgo.kernel.core/target/classes@start,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.kernel.core/3.1.0.BUILD-20120116180246/org.eclipse.virgo.kernel.core-3.1.0.BUILD-20120116180246.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.deployer.api/3.1.0.BUILD-20120116180246/org.eclipse.virgo.deployer.api-3.1.0.BUILD-20120116180246.jar,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.deployer.hot/3.1.0.BUILD-20120116180246/org.eclipse.virgo.deployer.hot-3.1.0.BUILD-20120116180246.jar,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar@start,\
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
index b99af7bc..afc6bf0f 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
@@ -31,7 +31,9 @@ launcher.bundles =\
file:../ivy-cache/repository/org.springframework/org.springframework.beans/3.0.5.RELEASE/org.springframework.beans-3.0.5.RELEASE.jar,\
file:../ivy-cache/repository/org.springframework/org.springframework.core/3.0.5.RELEASE/org.springframework.core-3.0.5.RELEASE.jar,\
file:../ivy-cache/repository/org.springframework/org.springframework.context/3.0.5.RELEASE/org.springframework.context-3.0.5.RELEASE.jar,\
- file:../org.eclipse.virgo.kernel.core/target/classes@start,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.kernel.core/3.1.0.BUILD-20120116180246/org.eclipse.virgo.kernel.core-3.1.0.BUILD-20120116180246.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.deployer.api/3.1.0.BUILD-20120116180246/org.eclipse.virgo.deployer.api-3.1.0.BUILD-20120116180246.jar,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.deployer.hot/3.1.0.BUILD-20120116180246/org.eclipse.virgo.deployer.hot-3.1.0.BUILD-20120116180246.jar,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar@start,\
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
index b9cd3956..77cd06ec 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
@@ -31,7 +31,9 @@ launcher.bundles =\
file:../ivy-cache/repository/org.springframework/org.springframework.beans/3.0.5.RELEASE/org.springframework.beans-3.0.5.RELEASE.jar,\
file:../ivy-cache/repository/org.springframework/org.springframework.core/3.0.5.RELEASE/org.springframework.core-3.0.5.RELEASE.jar,\
file:../ivy-cache/repository/org.springframework/org.springframework.context/3.0.5.RELEASE/org.springframework.context-3.0.5.RELEASE.jar,\
- file:../org.eclipse.virgo.kernel.core/target/classes@start,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.kernel.core/3.1.0.BUILD-20120116180246/org.eclipse.virgo.kernel.core-3.1.0.BUILD-20120116180246.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.deployer.api/3.1.0.BUILD-20120116180246/org.eclipse.virgo.deployer.api-3.1.0.BUILD-20120116180246.jar,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.deployer.hot/3.1.0.BUILD-20120116180246/org.eclipse.virgo.deployer.hot-3.1.0.BUILD-20120116180246.jar,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar@start,\
diff --git a/org.eclipse.virgo.kernel.deployer/ivy.xml b/org.eclipse.virgo.kernel.deployer/ivy.xml
index 6a9b161d..4fa0a658 100644
--- a/org.eclipse.virgo.kernel.deployer/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer/ivy.xml
@@ -32,7 +32,9 @@
<dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->runtime"/>
<dependency org="org.springframework.osgi" name="org.springframework.osgi.io" rev="${org.springframework.osgi}" conf="compile->runtime"/>
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="aspects->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.kernel.core" rev="${org.eclipse.virgo.nano}" conf="aspects->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.deployer.api" rev="${org.eclipse.virgo.nano}" conf="aspects->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.deployer.hot" rev="${org.eclipse.virgo.nano}" conf="aspects->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="aspects->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.services" rev="latest.integration" conf="aspects->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.artifact" rev="latest.integration" conf="compile->compile"/>
diff --git a/org.eclipse.virgo.kernel.dmfragment/ivy.xml b/org.eclipse.virgo.kernel.dmfragment/ivy.xml
index 31776994..c09f6c07 100644
--- a/org.eclipse.virgo.kernel.dmfragment/ivy.xml
+++ b/org.eclipse.virgo.kernel.dmfragment/ivy.xml
@@ -21,7 +21,7 @@
<dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->runtime"/>
<dependency org="org.springframework.osgi" name="org.springframework.osgi.io" rev="${org.springframework.osgi}" conf="compile->runtime"/>
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="compile->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.kernel.core" rev="${org.eclipse.virgo.nano}" conf="compile->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="compile->compile"/>
<dependency org="org.slf4j" name="com.springsource.slf4j.api" rev="${org.slf4j}" conf="compile->runtime"/>
diff --git a/org.eclipse.virgo.kernel.osgi/ivy.xml b/org.eclipse.virgo.kernel.osgi/ivy.xml
index ad1b688f..f3a9d3b9 100644
--- a/org.eclipse.virgo.kernel.osgi/ivy.xml
+++ b/org.eclipse.virgo.kernel.osgi/ivy.xml
@@ -21,7 +21,7 @@
<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.region" rev="${org.eclipse.equinox.region}" conf="compile->compile"/>
<dependency org='org.slf4j' name='com.springsource.slf4j.api' rev='${org.slf4j}' conf='compile->runtime'/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.services" rev="latest.integration" conf="compile->compile"/>
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="aspects, compile->runtime"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.kernel.core" rev="${org.eclipse.virgo.nano}" conf="aspects, compile->runtime"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.artifact" rev="latest.integration" conf="compile->compile"/>
<dependency org='org.slf4j' name='com.springsource.slf4j.nop' rev='${org.slf4j}' conf='test->runtime' />
<dependency org='org.eclipse.virgo.repository' name='org.eclipse.virgo.repository' rev='${org.eclipse.virgo.repository}' conf='compile->compile' />
diff --git a/org.eclipse.virgo.kernel.services/ivy.xml b/org.eclipse.virgo.kernel.services/ivy.xml
index ff53a013..8b385b23 100644
--- a/org.eclipse.virgo.kernel.services/ivy.xml
+++ b/org.eclipse.virgo.kernel.services/ivy.xml
@@ -14,7 +14,7 @@
<dependencies>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.artifact" rev="latest.integration" conf="compile->compile"/>
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev='latest.integration' conf='compile->compile'/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.kernel.core" rev='${org.eclipse.virgo.nano}' conf='compile->compile'/>
<dependency org="org.easymock" name="com.springsource.org.easymock" rev='${org.easymock}' conf='test->runtime'/>
<dependency org="org.junit" name="com.springsource.org.junit" rev='${org.junit}' conf='test->runtime'/>
<dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic" rev='${org.eclipse.virgo.medic}' conf='aspects, compile->runtime'/>
diff --git a/org.eclipse.virgo.kernel.shutdown/.classpath b/org.eclipse.virgo.kernel.shutdown/.classpath
deleted file mode 100644
index 3e0738f0..00000000
--- a/org.eclipse.virgo.kernel.shutdown/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/org.eclipse.virgo.kernel.shutdown/.project b/org.eclipse.virgo.kernel.shutdown/.project
deleted file mode 100644
index a3d51104..00000000
--- a/org.eclipse.virgo.kernel.shutdown/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.virgo.kernel.shutdown</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.virgo.kernel.shutdown/build.xml b/org.eclipse.virgo.kernel.shutdown/build.xml
deleted file mode 100644
index 619e29a2..00000000
--- a/org.eclipse.virgo.kernel.shutdown/build.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.virgo.kernel.shutdown">
-
- <property name="disable.bundlor" value="true" />
- <property file="${basedir}/../build.properties"/>
- <property file="${basedir}/../build.versions"/>
- <import file="${basedir}/../virgo-build/standard/default.xml"/>
-
-</project>
diff --git a/org.eclipse.virgo.kernel.shutdown/ivy.xml b/org.eclipse.virgo.kernel.shutdown/ivy.xml
deleted file mode 100644
index ce36c073..00000000
--- a/org.eclipse.virgo.kernel.shutdown/ivy.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" version="2.0">
-
- <info organisation='org.eclipse.virgo.kernel' module='${ant.project.name}'/>
-
- <configurations>
- <include file='${virgo.build.dir}/common/default-ivy-configurations.xml'/>
- </configurations>
-
- <publications>
- <artifact name='${ant.project.name}'/>
- <artifact name='${ant.project.name}-sources' ext='jar' type='src'/>
- </publications>
-
- <dependencies>
- <dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
- </dependencies>
-
-</ivy-module>
diff --git a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java b/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java
deleted file mode 100644
index 7f30af01..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * This file is part of the Virgo Web Server.
- *
- * Copyright (c) 2010 VMware Inc.
- * 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:
- * SpringSource, a division of VMware - initial API and implementation and/or initial documentation
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shutdown;
-
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Properties;
-
-/**
- * {@link KernelAuthenticationConfiguration} encapsulates reading the kernel user properties from the file with path in
- * the system property named by constant FILE_LOCATION.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread safe.
- *
- */
-final class KernelAuthenticationConfiguration {
-
- public static final String FILE_LOCATION_PROPERTY = "org.eclipse.virgo.kernel.authentication.file";
-
- public static final String DEFAULT_USERNAME = "admin";
-
- public static final String DEFAULT_PASSWORD = "springsource";
-
- private static final String USER_PREFIX = "user.";
-
- private static final String ADMIN_ROLE = "role.admin";
-
- private final String password;
-
- private final String userName;
-
- public KernelAuthenticationConfiguration() {
- this(getProperties(FILE_LOCATION_PROPERTY));
- }
-
- KernelAuthenticationConfiguration(Properties props) {
- String userName = DEFAULT_USERNAME;
- String password = DEFAULT_PASSWORD;
-
- if (props != null) {
- String adminUserName = props.getProperty(ADMIN_ROLE);
- if (adminUserName != null) {
- String adminPassword = props.getProperty(USER_PREFIX + adminUserName);
- if (adminPassword != null) {
- userName = adminUserName;
- password = adminPassword;
- }
- }
- }
-
- this.userName = userName;
- this.password = password;
- }
-
- String getPassword() {
- return password;
- }
-
- String getUserName() {
- return userName;
- }
-
- private static Properties getProperties(String fileLocationProperty) {
- String fileLocation = System.getProperty(fileLocationProperty);
- if (fileLocation == null) {
- return null;
- }
-
- Reader reader = null;
- try {
- reader = new FileReader(fileLocation);
- Properties properties = new Properties();
- properties.load(reader);
- return properties;
- } catch (IOException e) {
- return null;
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- // Nothing to do here
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownClient.java b/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownClient.java
deleted file mode 100644
index 4dd4a632..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownClient.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shutdown;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-import javax.naming.ServiceUnavailableException;
-
-/**
- * A stand-alone client for shutdown of the kernel.
- * <p />
- *
- * <strong>Concurrent Semantics</strong> <br />
- * Thread-safe.
- *
- */
-public class ShutdownClient {
-
- private static final String OPERATION_IMMEDIATE_SHUTDOWN = "immediateShutdown";
-
- private static final String OPERATION_SHUTDOWN = "shutdown";
-
- private static final String PROPERTY_JMX_REMOTE_CREDENTIALS = "jmx.remote.credentials";
-
- private static final String JMX_SERVICE_URL_TEMPLATE = "service:jmx:rmi:///jndi/rmi://127.0.0.1:%d/jmxrmi";
-
- public static void main(String[] args) {
- new ShutdownClient().performShutdown(args);
- }
-
- final void performShutdown(String... args) {
- ShutdownCommand command = ShutdownCommandParser.parse(args);
-
- if (command != null) {
- doShutdown(command);
- } else {
- displayUsageAndExit();
- }
- }
-
- protected final void doShutdown(ShutdownCommand command) {
- try {
- JMXServiceURL jmxServiceURL = new JMXServiceURL(String.format(JMX_SERVICE_URL_TEMPLATE, command.getPort()));
-
- Map<String, Object> jmxEnvironment = new HashMap<String, Object>();
-
- setRemoteCredentials(command, jmxEnvironment);
-
- JMXConnector connector = JMXConnectorFactory.connect(jmxServiceURL, jmxEnvironment);
- MBeanServerConnection connection = connector.getMBeanServerConnection();
-
- ObjectName shutdownMBeanName = new ObjectName(command.getDomain(), "type", "Shutdown");
-
- if (command.isImmediate()) {
- connection.invoke(shutdownMBeanName, OPERATION_IMMEDIATE_SHUTDOWN, null, null);
- } else {
- connection.invoke(shutdownMBeanName, OPERATION_SHUTDOWN, null, null);
- }
-
- connector.close();
- } catch (IOException ioe) {
- Throwable cause = ioe.getCause();
- if (cause instanceof ServiceUnavailableException) {
- reportServerUnreachable();
- } else {
- reportShutdownFailure(ioe);
- }
- } catch (Exception e) {
- reportShutdownFailure(e);
- }
- }
-
- private void setRemoteCredentials(ShutdownCommand command, Map<String, Object> jmxEnvironment) {
- KernelAuthenticationConfiguration kac = null;
-
- String userName = command.getUsername();
- if (userName == null) {
- kac = new KernelAuthenticationConfiguration();
- userName = kac.getUserName();
- }
-
- String password = command.getPassword();
- if (password == null) {
- if (kac == null) {
- kac = new KernelAuthenticationConfiguration();
- }
- password = kac.getPassword();
- }
-
- jmxEnvironment.put(PROPERTY_JMX_REMOTE_CREDENTIALS, new String[] { userName, password });
- }
-
- protected void reportServerUnreachable() {
- System.out.println("The Server could not be reached, it may already be stopped.");
- }
-
- protected void reportShutdownFailure(Exception failure) {
- failure.printStackTrace();
- }
-
- private void displayUsageAndExit() {
- System.out.println("Usage: shutdown [-options]");
- System.out.println("Available options:");
- System.out.println(" -jmxport nnnn Specifies the management port of the kernel");
- System.out.println(" instance which is to be shutdown.");
- System.out.println(" -immediate Specifies that the kernel should be shutdown");
- System.out.println(" immediately.");
- System.out.println(" -username Specifies the username to use for the");
- System.out.println(" connection to the kernel.");
- System.out.println(" -password Specifies the password to use for the");
- System.out.println(" connection to the kernel.");
- System.out.println(" -domain Specifies the JMX management domain for the");
- System.out.println(" kernel.");
- exit();
- }
-
- protected void exit() {
- System.exit(1);
- }
-}
diff --git a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommand.java b/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommand.java
deleted file mode 100644
index 4d4bc1be..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommand.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shutdown;
-
-/**
- * A <code>ShutdownCommand</code> is created by a {@link ShutdownCommandParser} to encapsulate
- * the parsed shutdown configuration.
- * <p />
- *
- * <strong>Concurrent Semantics</strong> <br />
- * <strong>Not</strong> thread-safe.
- *
- */
-final class ShutdownCommand {
-
- private static final String DEFAULT_DOMAIN = "org.eclipse.virgo.kernel";
-
- private static final int DEFAULT_PORT = 9875;
-
- private String password;
-
- private String username;
-
- private String domain = DEFAULT_DOMAIN;
-
- private int port = DEFAULT_PORT;
-
- private boolean immediate = false;
-
- String getPassword() {
- return password;
- }
-
- void setPassword(String password) {
- this.password = password;
- }
-
- String getUsername() {
- return username;
- }
-
- void setUsername(String username) {
- this.username = username;
- }
-
- String getDomain() {
- return domain;
- }
-
- void setDomain(String domain) {
- this.domain = domain;
- }
-
- int getPort() {
- return port;
- }
-
- void setPort(int port) {
- this.port = port;
- }
-
- boolean isImmediate() {
- return immediate;
- }
-
- void setImmediate(boolean immediate) {
- this.immediate = immediate;
- }
-}
diff --git a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommandParser.java b/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommandParser.java
deleted file mode 100644
index 713f3df6..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommandParser.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shutdown;
-
-/**
- * A <code>ShutdownCommandParser</code> is used to parse a series of arguments
- * into a {@link ShutdownCommand}.
- *
- * <p />
- *
- * <strong>Concurrent Semantics</strong> <br />
- * Thread-safe.
- *
- */
-final class ShutdownCommandParser {
-
- private static final String OPTION_DOMAIN = "-domain";
-
- private static final String OPTION_IMMEDIATE = "-immediate";
-
- private static final String OPTION_JMXPORT = "-jmxport";
-
- private static final String OPTION_PASSWORD = "-password";
-
- private static final String OPTION_USERNAME = "-username";
-
- static ShutdownCommand parse(String... args) {
-
- ShutdownCommand command = new ShutdownCommand();
-
- if (args.length > 0) {
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals(OPTION_USERNAME)) {
- if (i < args.length - 1) {
- command.setUsername(args[++i]);
- } else {
- return null;
- }
- } else if (args[i].equals(OPTION_PASSWORD)) {
- if (i < args.length - 1) {
- command.setPassword(args[++i]);
- } else {
- return null;
- }
- } else if (args[i].equals(OPTION_JMXPORT)) {
- if (i < args.length - 1) {
- try {
- command.setPort(Integer.parseInt(args[++i]));
- } catch (NumberFormatException nfe) {
- return null;
- }
- } else {
- return null;
- }
- } else if (args[i].equals(OPTION_IMMEDIATE)) {
- command.setImmediate(true);
- } else if (args[i].equals(OPTION_DOMAIN)) {
- if (i < args.length - 1) {
- command.setDomain(args[++i]);
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
- }
-
- return command;
- }
-}
diff --git a/org.eclipse.virgo.kernel.shutdown/src/main/resources/.gitignore b/org.eclipse.virgo.kernel.shutdown/src/main/resources/.gitignore
deleted file mode 100644
index e69de29b..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/main/resources/.gitignore
+++ /dev/null
diff --git a/org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF
deleted file mode 100644
index bf9e5ef0..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Version: 3.0.0
-Bundle-Name: Virgo Kernel Shutdown Client
-Bundle-SymbolicName: org.eclipse.virgo.kernel.shutdown
diff --git a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java b/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java
deleted file mode 100644
index 5d29d43b..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * This file is part of the Virgo Web Server.
- *
- * Copyright (c) 2010 VMware Inc.
- * 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:
- * SpringSource, a division of VMware - initial API and implementation and/or initial documentation
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shutdown;
-
-import java.util.Properties;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-
-public class KernelAuthenticationConfigurationTests {
-
- @Test
- public void testSystemProperty() {
- try {
- System.setProperty(KernelAuthenticationConfiguration.FILE_LOCATION_PROPERTY, "src/test/resources/test.users.properties");
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration();
-
- Assert.assertEquals("testuser", kac.getUserName());
- Assert.assertEquals("testpw", kac.getPassword());
- } finally {
- System.clearProperty(KernelAuthenticationConfiguration.FILE_LOCATION_PROPERTY);
- }
- }
-
- @Test
- public void testBadFile() {
- try {
- System.setProperty(KernelAuthenticationConfiguration.FILE_LOCATION_PROPERTY, "src/test/resources/users.nosuch.properties");
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration();
- assertDefaults(kac);
- } finally {
- System.clearProperty(KernelAuthenticationConfiguration.FILE_LOCATION_PROPERTY);
- }
- }
-
- private void assertDefaults(KernelAuthenticationConfiguration kac) {
- Assert.assertEquals(KernelAuthenticationConfiguration.DEFAULT_USERNAME, kac.getUserName());
- Assert.assertEquals(KernelAuthenticationConfiguration.DEFAULT_PASSWORD, kac.getPassword());
- }
-
- @Test
- public void testMissingProperty() {
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration();
- assertDefaults(kac);
- }
-
- @Test
- public void testMissingProperties() {
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration(null);
- assertDefaults(kac);
- }
-
- @Test
- public void testValidProperties() {
- Properties props = new Properties();
- props.put("user.u", "p");
- props.put("role.admin", "u");
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration(props);
- Assert.assertEquals("u", kac.getUserName());
- Assert.assertEquals("p", kac.getPassword());
- }
-
- @Test
- public void testMissingRole() {
- Properties props = new Properties();
- props.put("user.u", "p");
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration(props);
- assertDefaults(kac);
- }
-
- @Test
- public void testMissingAdmin() {
- Properties props = new Properties();
- props.put("user.u", "p");
- props.put("role.admin", "v");
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration(props);
- assertDefaults(kac);
- }
-
- @Test
- public void testEmptyUsername() {
- Properties props = new Properties();
- props.put("user.", "pw");
- props.put("role.admin", "");
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration(props);
- Assert.assertEquals("", kac.getUserName());
- Assert.assertEquals("pw", kac.getPassword());
-
- }
-
- @Test
- public void testEmptyPassword() {
- Properties props = new Properties();
- props.put("user.u", "");
- props.put("role.admin", "u");
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration(props);
- Assert.assertEquals("u", kac.getUserName());
- Assert.assertEquals("", kac.getPassword());
- }
-
- @Test
- public void testNonStringKey() {
- Properties props = new Properties();
- props.put(new Object(), "");
- props.put("user." + KernelAuthenticationConfiguration.DEFAULT_USERNAME, KernelAuthenticationConfiguration.DEFAULT_PASSWORD);
- props.put("role.admin", KernelAuthenticationConfiguration.DEFAULT_USERNAME);
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration(props);
- assertDefaults(kac);
- }
-
- @Test
- public void testNonStringValue() {
- Properties props = new Properties();
- props.put("user.u", new Object());
- KernelAuthenticationConfiguration kac = new KernelAuthenticationConfiguration(props);
- assertDefaults(kac);
- }
-
-
-
-}
diff --git a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/Shutdown.java b/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/Shutdown.java
deleted file mode 100644
index 70ed946e..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/Shutdown.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shutdown;
-
-import javax.management.MXBean;
-
-@MXBean
-public interface Shutdown {
-
- void shutdown();
-
- void immediateShutdown();
-}
diff --git a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/ShutdownClientTests.java b/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/ShutdownClientTests.java
deleted file mode 100644
index de9d42db..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/ShutdownClientTests.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shutdown;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.management.ManagementFactory;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.server.RMIClientSocketFactory;
-import java.rmi.server.RMIServerSocketFactory;
-import java.security.Permission;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnectorServer;
-import javax.management.remote.JMXConnectorServerFactory;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.rmi.RMIConnectorServer;
-
-import org.eclipse.virgo.kernel.shutdown.ShutdownClient;
-import org.eclipse.virgo.kernel.shutdown.ShutdownCommand;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class ShutdownClientTests {
-
-
- private static SecurityManager securityManager = System.getSecurityManager();
-
- @BeforeClass
- public static void installSecurityManager() {
- System.setSecurityManager(new UnitTestSecurityManager());
- }
-
- @AfterClass
- public static void reinstateSecurityManager() {
- System.setSecurityManager(securityManager);
- }
-
- @Test(expected=RuntimeException.class)
- public void malformedCommandCausesExit() {
- UnitTestShutdownClient client = new UnitTestShutdownClient();
- client.performShutdown("-alpha");
- }
-
- @Test
- public void unreachableMBeanServerReportsServerUnreachable() throws Exception {
- UnitTestShutdownClient client = new UnitTestShutdownClient();
-
- ShutdownCommand command = new ShutdownCommand();
- command.setPort(9999);
-
- JMXConnectorServer server = bootstrapMBeanServer(9875);
-
- try {
- client.doShutdown(command);
-
- assertTrue(client.serverUnreachable);
- assertFalse(client.exited);
- assertFalse(client.shutdownFailureReported);
- } finally {
- server.stop();
- }
- }
-
- @Test
- public void missingShutdownMBeanReportsShutdownFailure() throws Exception {
- UnitTestShutdownClient client = new UnitTestShutdownClient();
-
- ShutdownCommand command = new ShutdownCommand();
-
- JMXConnectorServer server = bootstrapMBeanServer(9875);
-
- try {
- client.doShutdown(command);
-
- assertFalse(client.serverUnreachable);
- assertFalse(client.exited);
- assertTrue(client.shutdownFailureReported);
- } finally {
- server.stop();
- }
- }
-
- @Test
- public void immediateShutdownInvokesImmediateShutdownOperation() throws Exception {
- UnitTestShutdownClient client = new UnitTestShutdownClient();
-
- ShutdownCommand command = new ShutdownCommand();
- command.setImmediate(true);
-
- JMXConnectorServer server = bootstrapMBeanServer(9875);
-
- UnitTestShutdown shutdown = new UnitTestShutdown();
-
- ObjectInstance shutdownMBean = registerShutdownMBean(shutdown, "org.eclipse.virgo.kernel");
-
- try {
- client.doShutdown(command);
-
- assertFalse(client.serverUnreachable);
- assertFalse(client.exited);
- assertFalse(client.shutdownFailureReported);
-
- assertTrue(shutdown.immediateShutdown);
- assertFalse(shutdown.shutdown);
- } finally {
- server.stop();
- ManagementFactory.getPlatformMBeanServer().unregisterMBean(shutdownMBean.getObjectName());
- }
- }
-
- @Test
- public void shutdownInvokesShutdownOperation() throws Exception {
- UnitTestShutdownClient client = new UnitTestShutdownClient();
-
- ShutdownCommand command = new ShutdownCommand();
-
- JMXConnectorServer server = bootstrapMBeanServer(9875);
-
- UnitTestShutdown shutdown = new UnitTestShutdown();
-
- ObjectInstance shutdownMBean = registerShutdownMBean(shutdown, "org.eclipse.virgo.kernel");
-
- try {
- client.doShutdown(command);
-
- assertFalse(client.serverUnreachable);
- assertFalse(client.exited);
- assertFalse(client.shutdownFailureReported);
-
- assertFalse(shutdown.immediateShutdown);
- assertTrue(shutdown.shutdown);
- } finally {
- server.stop();
- ManagementFactory.getPlatformMBeanServer().unregisterMBean(shutdownMBean.getObjectName());
- }
- }
-
- @Test
- public void clientUsesDomainSpecifiedInCommand() throws Exception {
- UnitTestShutdownClient client = new UnitTestShutdownClient();
-
- ShutdownCommand command = new ShutdownCommand();
- command.setDomain("the.domain");
-
- JMXConnectorServer server = bootstrapMBeanServer(9875);
-
- UnitTestShutdown shutdown = new UnitTestShutdown();
-
- ObjectInstance shutdownMBean = registerShutdownMBean(shutdown, "the.domain");
-
- try {
- client.doShutdown(command);
-
- assertFalse(client.serverUnreachable);
- assertFalse(client.exited);
- assertFalse(client.shutdownFailureReported);
- } finally {
- server.stop();
- ManagementFactory.getPlatformMBeanServer().unregisterMBean(shutdownMBean.getObjectName());
- }
- }
-
- @Test
- public void clientUsesPortSpecifiedInCommand() throws Exception {
- UnitTestShutdownClient client = new UnitTestShutdownClient();
-
- ShutdownCommand command = new ShutdownCommand();
- command.setPort(9999);
-
- UnitTestShutdown shutdown = new UnitTestShutdown();
-
- ObjectInstance shutdownMBean = registerShutdownMBean(shutdown, "the.domain");
-
- client = new UnitTestShutdownClient();
-
- JMXConnectorServer server = bootstrapMBeanServer(9999);
-
- try {
- assertFalse(client.serverUnreachable);
- assertFalse(client.exited);
- assertFalse(client.shutdownFailureReported);
- } finally {
- server.stop();
- ManagementFactory.getPlatformMBeanServer().unregisterMBean(shutdownMBean.getObjectName());
- }
- }
-
- private JMXConnectorServer bootstrapMBeanServer(int port) throws Exception {
-
- createRegistry(port);
-
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-
- Map<String,Object> env = new HashMap<String,Object>();
-
- env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, new UnitTestClientSocketFactory());
-
- env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, new UnitTestServerSocketFactory());
-
- JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/jmxrmi");
- JMXConnectorServer server = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
- server.start();
-
- return server;
- }
-
- private void createRegistry(int port) {
- try {
- LocateRegistry.createRegistry(port);
- } catch (RemoteException _) {
-
- }
- }
-
- private static final class UnitTestClientSocketFactory implements RMIClientSocketFactory, Serializable {
-
- private static final long serialVersionUID = 4445230934659082311L;
-
- public Socket createSocket(String host, int port) throws IOException {
- return new Socket(host, port);
- }
- }
-
- private static final class UnitTestServerSocketFactory implements RMIServerSocketFactory, Serializable {
-
- private static final long serialVersionUID = 5261406192116261111L;
-
- public ServerSocket createServerSocket(int port) throws IOException {
- return new ServerSocket(port);
- }
- }
-
- private ObjectInstance registerShutdownMBean(Shutdown shutdown, String domain) throws Exception {
- MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- return server.registerMBean(shutdown, new ObjectName(domain + ":type=Shutdown"));
- }
-
- private final class UnitTestShutdownClient extends ShutdownClient {
-
- private boolean serverUnreachable = false;
-
- private boolean exited = false;
-
- private boolean shutdownFailureReported = false;
-
- @Override
- protected void exit() {
- throw new RuntimeException();
- }
-
- @Override
- protected void reportServerUnreachable() {
- super.reportServerUnreachable();
- this.serverUnreachable = true;
- }
-
- @Override
- protected void reportShutdownFailure(Exception failure) {
- super.reportShutdownFailure(failure);
- this.shutdownFailureReported = true;
- }
- }
-
- private final class UnitTestShutdown implements Shutdown {
-
- private boolean immediateShutdown;
-
- private boolean shutdown;
-
- public void immediateShutdown() {
- this.immediateShutdown = true;
- }
-
- public void shutdown() {
- this.shutdown = true;
- }
- }
-
- private static final class UnitTestSecurityManager extends SecurityManager {
- @Override
- public void checkPermission(Permission perm, Object context) {
- }
-
- @Override
- public void checkPermission(Permission perm) {
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommandParserTests.java b/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommandParserTests.java
deleted file mode 100644
index c057d7d4..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/ShutdownCommandParserTests.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.shutdown;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.virgo.kernel.shutdown.ShutdownCommand;
-import org.eclipse.virgo.kernel.shutdown.ShutdownCommandParser;
-import org.junit.Test;
-
-public class ShutdownCommandParserTests {
-
- @Test
- public void nullReturnedForUnrecognisedArgument() {
- assertNull(ShutdownCommandParser.parse("-foo"));
- }
-
- @Test
- public void nullReturnedForMissingUsername() {
- assertNull(ShutdownCommandParser.parse("-username"));
- }
-
- @Test
- public void nullReturnedForMissingPassword() {
- assertNull(ShutdownCommandParser.parse("-password"));
- }
-
- @Test
- public void nullReturnedForJmxPort() {
- assertNull(ShutdownCommandParser.parse("-jmxport"));
- }
-
- @Test
- public void nullReturnedForMissingDomain() {
- assertNull(ShutdownCommandParser.parse("-domain"));
- }
-
- @Test
- public void nullReturnedForNonIntegerPort() {
- assertNull(ShutdownCommandParser.parse("-jmxport", "1alpha345"));
- }
-
- @Test
- public void defaultValuesWhenNoOptionsAreSpecified() {
- ShutdownCommand command = ShutdownCommandParser.parse();
- assertNotNull(command);
-
- assertEquals("org.eclipse.virgo.kernel", command.getDomain());
- assertNull(command.getPassword());
- assertEquals(9875, command.getPort());
- assertNull(command.getUsername());
- assertFalse(command.isImmediate());
- }
-
- @Test
- public void specificUsername() {
- ShutdownCommand command = ShutdownCommandParser.parse("-username", "user");
- assertNotNull(command);
-
- assertEquals("user", command.getUsername());
- }
-
- @Test
- public void specificPassword() {
- ShutdownCommand command = ShutdownCommandParser.parse("-password", "secret");
- assertNotNull(command);
-
- assertEquals("secret", command.getPassword());
- }
-
- @Test
- public void specificDomain() {
- ShutdownCommand command = ShutdownCommandParser.parse("-domain", "the.jmx.domain");
- assertNotNull(command);
-
- assertEquals("the.jmx.domain", command.getDomain());
- }
-
- @Test
- public void specificPort() {
- ShutdownCommand command = ShutdownCommandParser.parse("-jmxport", "1234");
- assertNotNull(command);
-
- assertEquals(1234, command.getPort());
- }
-
- @Test
- public void immediate() {
- ShutdownCommand command = ShutdownCommandParser.parse("-immediate");
- assertNotNull(command);
-
- assertTrue(command.isImmediate());
- }
-}
diff --git a/org.eclipse.virgo.kernel.shutdown/src/test/resources/test.users.properties b/org.eclipse.virgo.kernel.shutdown/src/test/resources/test.users.properties
deleted file mode 100644
index 754ee2bf..00000000
--- a/org.eclipse.virgo.kernel.shutdown/src/test/resources/test.users.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-##################
-# User definitions
-##################
-user.testuser=testpw
-
-
-##################
-# Role definitions
-##################
-role.admin=testuser \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.test/ivy.xml b/org.eclipse.virgo.kernel.test/ivy.xml
index 7545c22f..dc887625 100644
--- a/org.eclipse.virgo.kernel.test/ivy.xml
+++ b/org.eclipse.virgo.kernel.test/ivy.xml
@@ -34,7 +34,7 @@
<dependency org="org.eclipse.osgi" name='org.eclipse.equinox.region' rev='${org.eclipse.equinox.region}' conf='test->runtime' />
<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.console.supportability" rev="${org.eclipse.equinox.console.supportability}" conf="test->runtime" />
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="test->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.kernel.core" rev="${org.eclipse.virgo.nano}" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.shell" rev="latest.integration" conf="test->runtime"/>
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties b/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
index 5932d687..9ddb8aa4 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
@@ -29,7 +29,9 @@ launcher.bundles =\
file:../ivy-cache/repository/org.springframework/org.springframework.beans/3.0.5.RELEASE/org.springframework.beans-3.0.5.RELEASE.jar,\
file:../ivy-cache/repository/org.springframework/org.springframework.core/3.0.5.RELEASE/org.springframework.core-3.0.5.RELEASE.jar,\
file:../ivy-cache/repository/org.springframework/org.springframework.context/3.0.5.RELEASE/org.springframework.context-3.0.5.RELEASE.jar,\
- file:../org.eclipse.virgo.kernel.core/target/classes@start,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.kernel.core/3.1.0.BUILD-20120116180246/org.eclipse.virgo.kernel.core-3.1.0.BUILD-20120116180246.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.deployer.api/3.1.0.BUILD-20120116180246/org.eclipse.virgo.deployer.api-3.1.0.BUILD-20120116180246.jar,\
+ file:../ivy-cache/repository/org.eclipse.virgo.nano/org.eclipse.virgo.deployer.hot/3.1.0.BUILD-20120116180246/org.eclipse.virgo.deployer.hot-3.1.0.BUILD-20120116180246.jar,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar@start,\
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/ConsoleConfigurationConvertor.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/ConsoleConfigurationConvertor.java
index 3c6fe595..df79dbf7 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/ConsoleConfigurationConvertor.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/ConsoleConfigurationConvertor.java
@@ -6,6 +6,7 @@ import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Properties;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
diff --git a/org.eclipse.virgo.kernel.userregionfactory/ivy.xml b/org.eclipse.virgo.kernel.userregionfactory/ivy.xml
index 049348d9..5cc42ba1 100644
--- a/org.eclipse.virgo.kernel.userregionfactory/ivy.xml
+++ b/org.eclipse.virgo.kernel.userregionfactory/ivy.xml
@@ -17,7 +17,7 @@
<dependency org="org.eclipse.osgi" name='org.eclipse.equinox.region' rev='${org.eclipse.equinox.region}' conf='compile->compile' />
<dependency org='org.eclipse.virgo.medic' name='org.eclipse.virgo.medic' rev='${org.eclipse.virgo.medic}' conf='aspects, compile->runtime'/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="compile->compile"/>
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="compile->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.kernel.core" rev="${org.eclipse.virgo.nano}" conf="compile->compile"/>
<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.launcher" rev="${org.eclipse.virgo.osgi}" conf="compile->compile"/>
<dependency org='org.eclipse.virgo.util' name='org.eclipse.virgo.util.osgi' rev='${org.eclipse.virgo.util}' conf='compile->compile' />
<dependency org='org.eclipse.virgo.util' name='org.eclipse.virgo.util.osgi.manifest' rev='${org.eclipse.virgo.util}' conf='compile->compile' />
diff --git a/org.eclipse.virgo.kernel/ivy.xml b/org.eclipse.virgo.kernel/ivy.xml
index 35cb36ed..9c04258a 100644
--- a/org.eclipse.virgo.kernel/ivy.xml
+++ b/org.eclipse.virgo.kernel/ivy.xml
@@ -11,7 +11,6 @@
<dependencies>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.agent.dm" rev="latest.integration"/>
- <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer.dm" rev="latest.integration"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.dmfragment" rev="latest.integration"/>

Back to the top