Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHristo Iliev2011-03-12 01:30:08 -0500
committerHristo Iliev2011-03-12 01:30:08 -0500
commit8ae5c50a1d1b961c9c80fd5d761a17616dbeebb3 (patch)
tree21312c0f62c433aabf613b52f7fef3abd6574ff3
parent1b3920702923fadd4990ddd63543a5391e0b5a0d (diff)
parent8f662da298766ba663140514fcd177af1c2098a5 (diff)
downloadorg.eclipse.virgo.kernel-bug324991-eclipse-structure.tar.gz
org.eclipse.virgo.kernel-bug324991-eclipse-structure.tar.xz
org.eclipse.virgo.kernel-bug324991-eclipse-structure.zip
Merge branch 'master' into bug324991-eclipse-structurebug324991-eclipse-structure
Conflicts: build-kernel/bin/dmk.bat build-kernel/build.xml build-kernel/lib/org.eclipse.virgo.kernel.launch.properties build.versions org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
-rw-r--r--.gitignore1
-rwxr-xr-xbuild-kernel/bin/dmk.bat12
-rwxr-xr-xbuild-kernel/bin/dmk.sh11
-rw-r--r--build-kernel/build.xml22
-rw-r--r--build-kernel/config/org.eclipse.virgo.kernel.userregion.properties30
-rw-r--r--build-kernel/kernel-ivy.xml12
-rw-r--r--build-kernel/lib-ivy.xml2
-rw-r--r--build-kernel/lib/org.eclipse.virgo.kernel.launch.properties63
-rw-r--r--build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan9
-rw-r--r--build.properties4
-rw-r--r--build.versions26
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/.classpath11
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/ivy.xml4
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/AgentDMStartTracker.java24
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/StandardAgentDMStartTracker.java25
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java38
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java32
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/agentdm_start_tracker.xml7
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml10
-rw-r--r--org.eclipse.virgo.kernel.agent.dm/template.mf34
-rw-r--r--org.eclipse.virgo.kernel.artifact/.classpath18
-rw-r--r--org.eclipse.virgo.kernel.artifact/ivy.xml3
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java46
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java40
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java62
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java36
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java43
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java77
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-manifest.jarbin0 -> 452 bytes
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-symbolic-name.jarbin0 -> 774 bytes
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties6
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties6
-rw-r--r--org.eclipse.virgo.kernel.artifact/template.mf3
-rw-r--r--org.eclipse.virgo.kernel.authentication/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.core/.classpath20
-rw-r--r--org.eclipse.virgo.kernel.core/ivy.xml4
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java31
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java3
-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/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/BundleStarter.java12
-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/internal/BundleStartTracker.java47
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java22
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java2
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java30
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java65
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java1
-rw-r--r--org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties1
-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.xml16
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java3
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java4
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java61
-rw-r--r--org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java9
-rw-r--r--org.eclipse.virgo.kernel.core/template.mf5
-rw-r--r--org.eclipse.virgo.kernel.deployer.dm/.classpath6
-rw-r--r--org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml3
-rw-r--r--org.eclipse.virgo.kernel.deployer.dm/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/.classpath17
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/.project5
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java20
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java58
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java123
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java372
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java4
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java6
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java197
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java173
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java6
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactLifecycleEvent.java60
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactListener.java157
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/TestLifecycleEvent.java16
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties13
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties13
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties13
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug330506.parbin0 -> 1194 bytes
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug336200.plan11
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties31
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties6
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/plan-deployment/lazyBundle.jarbin0 -> 1429 bytes
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.deployer.testbundle/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.deployer/.classpath26
-rw-r--r--org.eclipse.virgo.kernel.deployer/ivy.xml5
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java109
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java1
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptions.java112
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java64
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java47
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunction.java (renamed from org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunction.java)83
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/BlockingAbortableSignal.java74
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java23
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/RegionAwarePackageAdminAccessor.java26
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java10
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java8
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java6
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java58
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java302
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java15
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java7
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java100
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactStateMonitor.java387
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java6
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java18
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java7
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java4
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java3
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java24
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java42
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java5
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java9
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties1
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/configuration-context.xml16
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml615
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml30
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml52
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java1
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java15
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunctionTests.java229
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java5
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployerTests.java121
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunctionTests.java164
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java13
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java134
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java4
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java11
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java130
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubAbortableSignal.java58
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java11
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactStateMonitor.java164
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java3
-rw-r--r--org.eclipse.virgo.kernel.deployer/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/.classpath86
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/.project74
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs6
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml8
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs6
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/.springBeans28
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/build.xml16
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/ivy.xml80
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java52
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java116
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java62
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java138
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java78
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java98
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java194
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java80
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java100
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/LoadTimeWeaverPostProcessor.java76
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/MBeanExporterPostProcessor.java122
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ServiceProxyRetryDisablingBundleListener.java126
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml78
-rw-r--r--org.eclipse.virgo.kernel.dmfragment/template.mf42
-rw-r--r--org.eclipse.virgo.kernel.kerneldmfragment/.classpath4
-rw-r--r--org.eclipse.virgo.kernel.kerneldmfragment/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.model/.classpath10
-rw-r--r--org.eclipse.virgo.kernel.model/ivy.xml2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java12
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java19
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifact.java211
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java15
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml152
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/osgi-context.xml94
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java14
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializerTests.java12
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifactTests.java170
-rw-r--r--org.eclipse.virgo.kernel.model/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.osgi/.classpath28
-rw-r--r--org.eclipse.virgo.kernel.osgi/ivy.xml1
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/quasi/QuasiFramework.java8
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/IndeterminateRegionException.java38
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java166
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionDigraph.java145
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionDigraphVisitor.java50
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionFilter.java149
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionLifecycleListener.java38
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java344
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionPackageImportPolicy.java40
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionSpanningException.java51
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/StandardRegionFilter.java102
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/eventlog/RegionAwareEventLoggerServiceFactory.java56
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleEventHook.java116
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java92
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionDigraphVisitorBase.java141
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java198
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookFactory.java45
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceEventHook.java70
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java90
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java282
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionDigraph.java309
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/SubgraphTraverser.java63
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/ManageableRegion.java49
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/ManageableRegionDigraph.java43
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/RegionObjectNameCreator.java43
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/StandardManageableRegion.java83
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/StandardManageableRegionDigraph.java164
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/resources/EventLogMessages.properties8
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/resources/META-INF/spring/osgi-framework-context.xml13
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java69
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleEventHookTests.java93
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHookTests.java258
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java549
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceEventHookTests.java91
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHookTests.java308
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegionTests.java304
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionDigraphTests.java192
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionFilterTests.java84
-rw-r--r--org.eclipse.virgo.kernel.osgi/template.mf6
-rw-r--r--org.eclipse.virgo.kernel.osgicommand/.classpath4
-rw-r--r--org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/Activator.java2
-rw-r--r--org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/internal/OsgiKernelShellCommand.java2
-rw-r--r--org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/ClassLoadingHelperTests.java4
-rw-r--r--org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/internal/commands/classloading/ClassLoadingCommandProviderTests.java2
-rw-r--r--org.eclipse.virgo.kernel.osgicommand/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.services/.classpath22
-rw-r--r--org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java14
-rw-r--r--org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/concurrent-context.xml68
-rw-r--r--org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/configuration-context.xml16
-rw-r--r--org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/io-context.xml43
-rw-r--r--org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml129
-rw-r--r--org.eclipse.virgo.kernel.services/template.mf3
-rw-r--r--org.eclipse.virgo.kernel.shell/.classpath21
-rw-r--r--org.eclipse.virgo.kernel.shell/ivy.xml3
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/CommandExecutor.java2
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/LinePrinter.java2
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SessionCommandExecutor.java2
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SingleSessionCommandExecutor.java2
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java28
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java15
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateService.java45
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/module-context.xml3
-rw-r--r--org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/osgi-context.xml4
-rw-r--r--org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java6
-rw-r--r--org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java66
-rw-r--r--org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/stubs/StubQuasiFramework.java4
-rw-r--r--org.eclipse.virgo.kernel.shell/template.mf4
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java2
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java2
-rw-r--r--org.eclipse.virgo.kernel.smoketest/.classpath2
-rw-r--r--org.eclipse.virgo.kernel.stubs/.classpath6
-rw-r--r--org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubInstallArtifact.java10
-rw-r--r--org.eclipse.virgo.kernel.stubs/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.test/.classpath15
-rw-r--r--org.eclipse.virgo.kernel.test/.project5
-rw-r--r--org.eclipse.virgo.kernel.test/ivy.xml7
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/concurrent/test/ApplicationContextDependencyMonitorIntegrationTests.java20
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/QuasiFrameworkIntegrationTests.java6
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/RegionTests.java1
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/test/ClassLoadingHelperIntegrationTests.java20
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/AbstractKernelIntegrationTest.java17
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/StandardBundleStarterSignallingTests.java41
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/TestSignal.java17
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/META-INF/MANIFEST.MF38
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties12
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties25
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/initial-artifact-plan/com.springsource.kernel.test.userregion.springdm.plan6
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/monitor/lazy/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/monitor/lazy/META-INF/spring/context.xml11
-rw-r--r--org.eclipse.virgo.kernel.test/template.mf2
-rw-r--r--org.eclipse.virgo.kernel.userregion/.classpath26
-rw-r--r--org.eclipse.virgo.kernel.userregion/ivy.xml1
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java12
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployer.java2
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/equinox/UsesAnalyser.java2
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/importexpansion/AbstractTrackedPackageImports.java11
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/DependencyCalculator.java144
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFramework.java192
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFrameworkFactory.java19
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardResolutionFailureDetective.java3
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployerTests.java2
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java53
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java29
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java14
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java41
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java8
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java6
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java6
-rw-r--r--org.eclipse.virgo.kernel.userregion/template.mf4
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/.classpath23
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/.project35
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/.settings/com.springsource.server.ide.bundlor.core.prefs5
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/.springBeans13
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/build.xml8
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/ivy.xml34
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/.gitignore (renamed from org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore)0
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java333
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java (renamed from org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/PackageImportWildcardExpander.java)34
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryLogEvents.java54
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java (renamed from org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerParserLogger.java)11
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java128
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/resources/.gitignore0
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/resources/EventLogMessages.properties16
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/test/java/.gitignore0
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java (renamed from org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/PackageImportWildcardExpanderTests.java)8
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java115
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/test/resources/.gitignore0
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/template.mf19
-rw-r--r--org.eclipse.virgo.kernel/ivy.xml1
-rw-r--r--test-apps/bundle-update/class.load.after.update/but.C/.classpath2
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.a/.classpath2
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.b/.classpath2
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.same1/.classpath2
-rw-r--r--test-apps/quartz-scheduler/quartz.bundle.same2/.classpath2
-rw-r--r--test-apps/service-scoping/scoping.service.module.b/.classpath2
331 files changed, 11593 insertions, 3960 deletions
diff --git a/.gitignore b/.gitignore
index 2f4a727d..671b0cd9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ integration-repo
ivy-cache
derby.log
.ant-targets-build.xml
+com.cenqua.clover.core.prefs \ No newline at end of file
diff --git a/build-kernel/bin/dmk.bat b/build-kernel/bin/dmk.bat
index 96a6e3e0..1862ff38 100755
--- a/build-kernel/bin/dmk.bat
+++ b/build-kernel/bin/dmk.bat
@@ -204,6 +204,7 @@ rem ------------------------------
set CONFIG_DIR=%KERNEL_HOME%\config
if not defined TRUSTSTORE_PATH set TRUSTSTORE_PATH=%KERNEL_HOME%\config\keystore
if not defined TRUSTSTORE_PASSWORD set TRUSTSTORE_PASSWORD=changeit
+ if not defined JMX_PORT set JMX_PORT=9875
set OTHER_ARGS=
rem Loop through options
@@ -212,8 +213,9 @@ rem ------------------------------
if "%~1"=="" goto endStopOptionLoop
if "%~1"=="-truststore" goto truststoreStop
if "%~1"=="-truststorePassword" goto truststorePasswordStop
- if "%~1"=="-configDir" goto configDirStop
-
+ if "%~1"=="-configDir" goto configDirStop
+ if "%~1"=="-jmxport" goto jmxportStop
+
set OTHER_ARGS=%OTHER_ARGS% "%~1"
:continueStopOptionLoop
@@ -240,6 +242,11 @@ rem ------------------------------
shift
goto continueStopOptionLoop
+ :jmxportStop
+ set JMX_PORT=%~2
+ shift
+ goto continueStopOptionLoop
+
:endStopOptionLoop
rem Call shutdown client
@@ -247,6 +254,7 @@ rem ------------------------------
rem Extend JMX options
set JMX_OPTS=%JMX_OPTS% -Djavax.net.ssl.trustStore="%TRUSTSTORE_PATH%"
set JMX_OPTS=%JMX_OPTS% -Djavax.net.ssl.trustStorePassword=%TRUSTSTORE_PASSWORD%
+ set OTHER_ARGS=%OTHER_ARGS% -jmxport %JMX_PORT%
rem Marshall parameters
set SHUTDOWN_PARMS= %JAVA_OPTS% %JMX_OPTS%
diff --git a/build-kernel/bin/dmk.sh b/build-kernel/bin/dmk.sh
index 277cfbeb..4651ac0f 100755
--- a/build-kernel/bin/dmk.sh
+++ b/build-kernel/bin/dmk.sh
@@ -198,6 +198,11 @@ then
TRUSTSTORE_PASSWORD=changeit
fi
+ if [ -z "$JMX_PORT" ]
+ then
+ JMX_PORT=9875
+ fi
+
shopt -s extglob
while (($# > 0))
@@ -215,6 +220,10 @@ then
CONFIG_DIR=$2
shift;
;;
+ -jmxport)
+ JMX_PORT=$2
+ shift;
+ ;;
*)
OTHER_ARGS+=" $1"
;;
@@ -227,6 +236,8 @@ then
-Djavax.net.ssl.trustStore=${TRUSTSTORE_PATH} \
-Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}"
+ OTHER_ARGS+=" -jmxport $JMX_PORT"
+
$JAVA_HOME/bin/java $JAVA_OPTS $JMX_OPTS \
-classpath $CLASSPATH \
-Dorg.eclipse.virgo.kernel.home=$KERNEL_HOME \
diff --git a/build-kernel/build.xml b/build-kernel/build.xml
index 6981e8a2..7389f91c 100644
--- a/build-kernel/build.xml
+++ b/build-kernel/build.xml
@@ -9,6 +9,7 @@
<pathelement location="../org.eclipse.virgo.kernel.services"/>
<pathelement location="../org.eclipse.virgo.kernel.osgi"/>
<pathelement location="../org.eclipse.virgo.kernel.deployer"/>
+ <pathelement location="../org.eclipse.virgo.kernel.userregionfactory"/>
<pathelement location="../org.eclipse.virgo.kernel.userregion"/>
<pathelement location="../org.eclipse.virgo.kernel.agent.dm"/>
<pathelement location="../org.eclipse.virgo.kernel.kerneldmfragment"/>
@@ -74,6 +75,22 @@
<copy todir="${package.output.dir}/lib" failonerror="false">
<fileset dir="${basedir}/lib"/>
+ <filterset>
+ <filter token="ASPECTJ.VERSION" value="${org.aspectj}"/>
+ <filter token="OSGI.SERVICES.VERSION" value="${org.eclipse.osgi.services}"/>
+ <filter token="EQUINOX.EVENT.VERSION" value="${org.eclipse.equinox.event}"/>
+ <filter token="EQUINOX.CONFIGADMIN.VERSION" value="${org.eclipse.equinox.cm}"/>
+ <filter token="EQUINOX.DS.VERSION" value="${org.eclipse.equinox.ds}"/>
+ <filter token="EQUINOX.UTIL.VERSION" value="${org.eclipse.equinox.util}"/>
+ <filter token="KERNEL.VERSION" value="${bundle.version}"/>
+ <filter token="MEDIC.VERSION" value="${org.eclipse.virgo.medic}"/>
+ <filter token="REPOSITORY.VERSION" value="${org.eclipse.virgo.repository}"/>
+ <filter token="SLF4J.VERSION" value="${org.slf4j}"/>
+ <filter token="SPRING.DM.VERSION" value="${org.springframework.osgi}"/>
+ <filter token="SPRING.VERSION" value="${org.springframework}"/>
+ <filter token="UTIL.VERSION" value="${org.eclipse.virgo.util}"/>
+ <filter token="OSGI.EXTENSIONS.VERSION" value="${org.eclipse.virgo.osgi}"/>
+ </filterset>
</copy>
<copy todir="${package.output.dir}/config" failonerror="false">
@@ -83,9 +100,10 @@
<filter token="ASPECTJ.VERSION" value="${org.aspectj}"/>
<filter token="OSGI.FRAMEWORK.VERSION" value="${org.eclipse.osgi}"/>
<filter token="OSGI.SERVICES.VERSION" value="${org.eclipse.osgi.services}"/>
+ <filter token="EQUINOX.EVENT.VERSION" value="${org.eclipse.equinox.event}"/>
<filter token="EQUINOX.CONFIGADMIN.VERSION" value="${org.eclipse.equinox.cm}"/>
- <filter token="EQUINOX.SIMPLECONFIGURATOR.VERSION" value="${org.eclipse.equinox.simpleconfigurator}"/>
- <filter token="FELIX.EVENTADMIN.VERSION" value="${org.apache.felix.eventadmin}"/>
+ <filter token="EQUINOX.DS.VERSION" value="${org.eclipse.equinox.ds}"/>
+ <filter token="EQUINOX.UTIL.VERSION" value="${org.eclipse.equinox.util}"/>
<filter token="KERNEL.VERSION" value="${bundle.version}"/>
<filter token="MEDIC.VERSION" value="${org.eclipse.virgo.medic}"/>
<filter token="REPOSITORY.VERSION" value="${org.eclipse.virgo.repository}"/>
diff --git a/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties b/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
index 52de1dc1..5ac31502 100644
--- a/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
@@ -4,6 +4,8 @@ baseBundles = \
file:org.eclipse.virgo.kernel.userregion-@KERNEL.VERSION@.jar@start,\
file:org.eclipse.virgo.kernel.osgicommand-@KERNEL.VERSION@.jar@start
+bundleImports = org.eclipse.osgi;bundle-version="0"
+
packageImports =\
org.eclipse.virgo.kernel.artifact.*;version="0",\
org.eclipse.virgo.kernel.core;version="0",\
@@ -11,6 +13,7 @@ packageImports =\
org.eclipse.virgo.kernel.deployer.core.event;version="0",\
org.eclipse.virgo.kernel.install.*;version="0",\
org.eclipse.virgo.kernel.osgi.*;version="0",\
+ org.eclipse.virgo.kernel.model;version="0",\
org.eclipse.virgo.kernel.model.management;version="0",\
org.eclipse.virgo.kernel.module;version="0",\
org.eclipse.virgo.kernel.serviceability;version="0",\
@@ -32,6 +35,9 @@ packageImports =\
org.slf4j.spi;version="[1.6.1,2)"
serviceImports =\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
+ org.eclipse.virgo.kernel.osgi.region.RegionDigraph,\
+ org.osgi.framework.hooks.resolver.ResolverHookFactory,\
org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer,\
org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser,\
org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository,\
@@ -46,9 +52,13 @@ serviceImports =\
org.eclipse.virgo.kernel.core.Shutdown,\
org.osgi.service.cm.ConfigurationAdmin,\
org.osgi.service.event.EventAdmin,\
+ org.eclipse.virgo.medic.eventlog.EventLogger,\
org.eclipse.virgo.medic.dump.DumpGenerator,\
org.eclipse.virgo.kernel.shim.scope.ScopeFactory,\
- org.eclipse.virgo.kernel.shim.serviceability.TracingService
+ org.eclipse.virgo.kernel.shim.serviceability.TracingService,\
+ org.eclipse.virgo.kernel.model.RuntimeArtifactRepository,\
+ org.eclipse.osgi.service.resolver.PlatformAdmin,\
+ org.osgi.service.packageadmin.PackageAdmin
serviceExports =\
org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener,\
@@ -60,24 +70,12 @@ serviceExports =\
org.eclipse.virgo.kernel.osgi.framework.OsgiFramework,\
org.eclipse.virgo.kernel.osgi.framework.ImportExpander,\
org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil,\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
org.osgi.service.event.EventHandler,\
org.osgi.service.cm.ConfigurationListener,\
org.osgi.service.cm.ManagedService,\
- org.osgi.service.cm.ManagedServiceFactory
-
-inheritedFrameworkProperties =\
- eclipse.bundle.setTCCL,\
- eclipse.enableStateSaver,\
- org.eclipse.virgo.suppress.heap.dumps,\
- osgi.java.profile,\
- osgi.parentClassloader,\
- osgi.context.bootdelegation,\
- osgi.compatibility.bootdelegation,\
- osgi.java.profile.bootdelegation,\
- osgi.hook.configurators.include
-
-# osgi console support
-# osgi.console=2401
+ org.osgi.service.cm.ManagedServiceFactory,\
+ org.osgi.framework.BundleContext
# the next line must not be broken with back-slashes
initialArtifacts = repository:plan/org.eclipse.virgo.kernel.userregion.springdm
diff --git a/build-kernel/kernel-ivy.xml b/build-kernel/kernel-ivy.xml
index d034558f..11ddf2df 100644
--- a/build-kernel/kernel-ivy.xml
+++ b/build-kernel/kernel-ivy.xml
@@ -14,16 +14,22 @@
<!-- lib/kernel -->
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel" rev="latest.integration" conf="lib-kernel->runtime"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgicommand" rev="latest.integration" conf="lib-kernel->runtime"/>
+ <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.userregionfactory" rev="latest.integration" conf="lib-kernel->runtime"/>
<dependency org="org.slf4j" name="com.springsource.slf4j.org.apache.commons.logging" rev="${org.slf4j}" conf="lib-kernel->runtime"/>
- <dependency org="org.aspectj" name="com.springsource.org.aspectj.weaver" rev="${org.aspectj}" conf="lib-kernel->runtime"/>
+ <dependency org="org.aspectj" name="com.springsource.org.aspectj.weaver" rev="${org.aspectj}" conf="lib-kernel->runtime"/>
<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="lib-kernel->runtime"/>
- <dependency org="org.eclipse.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="lib-kernel->runtime"/>
-
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="lib-kernel->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.ds" rev="${org.eclipse.equinox.ds}" conf="lib-kernel->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.util" rev="${org.eclipse.equinox.util}" conf="lib-kernel->runtime"/>
<!-- repository-ext -->
<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="repository-ext->runtime"/>
<dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="repository-ext->runtime"/>
<dependency org="org.springframework.osgi" name="org.springframework.osgi.io" rev="${org.springframework.osgi}" conf="repository-ext->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.ds" rev="${org.eclipse.equinox.ds}" conf="repository-ext->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.util" rev="${org.eclipse.equinox.util}" conf="repository-ext->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="repository-ext->runtime"/>
+
<exclude org="org.eclipse.osgi" module="org.eclipse.osgi"/>
<exclude org="org.eclipse.virgo.util" conf="repository-ext"/>
diff --git a/build-kernel/lib-ivy.xml b/build-kernel/lib-ivy.xml
index 6b4e7aaa..896e0c3e 100644
--- a/build-kernel/lib-ivy.xml
+++ b/build-kernel/lib-ivy.xml
@@ -15,6 +15,8 @@
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.authentication" rev="latest.integration" conf="lib->runtime"/>
<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.launcher" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.extensions.equinox" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
+ <dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.console" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
+ <dependency org="javax.transaction" name="com.springsource.javax.transaction" rev="${javax.transaction}" conf="lib->runtime"/>
</dependencies>
</ivy-module>
diff --git a/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties b/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties
new file mode 100644
index 00000000..63bc1db5
--- /dev/null
+++ b/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties
@@ -0,0 +1,63 @@
+launcher.bundles =\
+ file:lib/kernel/com.springsource.slf4j.api-@SLF4J.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.slf4j.org.apache.commons.logging-@SLF4J.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.org.aspectj.weaver-@ASPECTJ.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.deployer-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.medic-@MEDIC.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.osgi.services-@OSGI.SERVICES.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.equinox.cm-@EQUINOX.CONFIGADMIN.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.medic.core-@MEDIC.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.osgi-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.equinox.event-@EQUINOX.EVENT.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.common-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.io-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.jmx-@UTIL.VERSION@.jar,\
+ file:lib/kernel/org.eclipse.virgo.util.math-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.parser.manifest-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.org.apache.commons.codec-1.3.0.jar@start,\
+ file:lib/kernel/com.springsource.org.apache.commons.httpclient-3.1.0.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.repository-@REPOSITORY.VERSION@.jar@start,\
+ file:lib/kernel/org.springframework.aop-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.asm-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.expression-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.beans-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.core-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.context-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.eclipse.virgo.kernel.core-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.agent.dm-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.springframework.osgi.core-@SPRING.DM.VERSION@.jar,\
+ file:lib/kernel/org.springframework.osgi.extender-@SPRING.DM.VERSION@.jar@start,\
+ file:lib/kernel/org.springframework.osgi.io-@SPRING.DM.VERSION@.jar,\
+ file:lib/kernel/com.springsource.org.aopalliance-1.0.0.jar,\
+ file:lib/kernel/org.eclipse.equinox.ds-@EQUINOX.DS.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.equinox.util-@EQUINOX.UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.artifact-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.services-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.model-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.kerneldmfragment-@KERNEL.VERSION@.jar,\
+ file:lib/kernel/org.eclipse.virgo.kernel.shell-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.osgi-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.core-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.userregionfactory-@KERNEL.VERSION@.jar@start
+
+#Equinox Configuration
+osgi.parentClassloader=fwk
+osgi.context.bootdelegation=false
+osgi.compatibility.bootdelegation=false
+osgi.clean=true
+org.osgi.framework.bsnversion=multiple
+
+# osgi console support
+# osgi.console=2401
+
+osgi.java.profile=file:lib/java6-server.profile
+osgi.java.profile.bootdelegation=override
+osgi.hook.configurators.include=\
+ org.eclipse.virgo.osgi.extensions.equinox.hooks.ExtensionsHookConfigurator,\
+ org.eclipse.virgo.osgi.console.telnet.hook.TelnetHookConfigurator
+
+org.eclipse.virgo.medic.log.config.path=config/serviceability.xml
+org.eclipse.virgo.suppress.heap.dumps=false
+
+eclipse.bundle.setTCCL=false
+eclipse.enableStateSaver=false
diff --git a/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan b/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
index f9f9d9b3..d6d6b190 100644
--- a/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
+++ b/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
@@ -1,4 +1,4 @@
-<plan name="org.eclipse.virgo.kernel.userregion.springdm" version="2.2.0" scoped="false" atomic="false"
+<plan name="org.eclipse.virgo.kernel.userregion.springdm" version="3.0.0" scoped="false" atomic="false"
xmlns="http://www.eclipse.org/virgo/schema/plan"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
@@ -8,6 +8,9 @@
<artifact type="bundle" name="org.springframework.osgi.core" version="[1.2.1, 1.3.0)"/>
<artifact type="bundle" name="org.springframework.osgi.extender" version="[1.2.1, 1.3.0)"/>
<artifact type="bundle" name="org.springframework.osgi.io" version="[1.2.1, 1.3.0)"/>
- <artifact type="bundle" name="org.eclipse.virgo.kernel.agent.dm" version="[2.1.0, 3.0)"/>
- <artifact type="bundle" name="org.eclipse.virgo.kernel.deployer.dm" version="[2.1.0, 3.0)"/>
+ <artifact type="bundle" name="org.eclipse.virgo.kernel.agent.dm" version="[3.0, 4.0)"/>
+ <artifact type="bundle" name="org.eclipse.virgo.kernel.deployer.dm" version="[3.0, 4.0)"/>
+ <artifact type="bundle" name="org.eclipse.equinox.ds" version="0.0.0"/>
+ <artifact type="bundle" name="org.eclipse.equinox.util" version="0.0.0"/>
+ <artifact type="bundle" name="org.eclipse.osgi.services" version="0.0.0"/>
</plan>
diff --git a/build.properties b/build.properties
index 694f389e..1463e3ae 100644
--- a/build.properties
+++ b/build.properties
@@ -1,5 +1,5 @@
-version=2.2.0
-release.type=integration
+version=3.0.0
+release.type=integration
javadoc.exclude.package.names=**/internal/**,**/internal
ivy.cache.dir=${basedir}/../ivy-cache
integration.repo.dir=${basedir}/../integration-repo
diff --git a/build.versions b/build.versions
index c9baee4e..59f654fa 100644
--- a/build.versions
+++ b/build.versions
@@ -1,15 +1,17 @@
# Compile
-org.apache.felix.eventadmin=1.0.0
-org.eclipse.osgi.services=3.3.0.v20101018
-org.eclipse.equinox.cm=1.0.200.v20100520
-org.eclipse.equinox.launcher=1.1.0.v20100507
-org.eclipse.equinox.simpleconfigurator=1.0.200.v20100503
+org.eclipse.osgi.services=3.3.0.v20110110
+org.eclipse.equinox.event=1.2.100.v20110110
+org.eclipse.equinox.util=1.0.200.v20100503
+org.eclipse.equinox.ds=1.3.0.v20110124-0830
+org.eclipse.equinox.cm=1.0.300.v20101204
+org.eclipse.equinox.launcher=1.2.0.v20110124-0830
+org.eclipse.equinox.simpleconfigurator=1.0.200.v20110228
org.aspectj=1.6.6.RELEASE
-org.eclipse.osgi=3.7.0.v20101022
-org.eclipse.virgo.medic=2.2.0.D-20101207150849
-org.eclipse.virgo.osgi=2.2.0.D-20101207145732
-org.eclipse.virgo.repository=2.2.0.D-20101207151510
-org.eclipse.virgo.util=2.2.0.D-20101207150035
+org.eclipse.osgi=3.7.0.v20110224
+org.eclipse.virgo.medic=3.0.0.M02
+org.eclipse.virgo.osgi=3.0.0.M02
+org.eclipse.virgo.repository=3.0.0.D-20110309170144
+org.eclipse.virgo.util=3.0.0.M02
org.slf4j=1.6.1
org.slf4j.spi=1.6.1
org.springframework.osgi=1.2.1
@@ -30,7 +32,7 @@ javax.portlet=2.0.0
javax.servlet=2.5.0
javax.transaction=1.1.0
org.easymock=2.3.0
-org.eclipse.virgo.test=2.2.0.D-20101207150629
-org.eclipse.virgo.teststubs=2.2.0.D-20101207145338
+org.eclipse.virgo.test=3.0.0.M02
+org.eclipse.virgo.teststubs=3.0.0.M02
org.hsqldb=1.8.0.9
org.junit=4.7.0
diff --git a/org.eclipse.virgo.kernel.agent.dm/.classpath b/org.eclipse.virgo.kernel.agent.dm/.classpath
index 7b32f1c8..580ce918 100644
--- a/org.eclipse.virgo.kernel.agent.dm/.classpath
+++ b/org.eclipse.virgo.kernel.agent.dm/.classpath
@@ -22,24 +22,25 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<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/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar">
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar">
<attributes>
<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
</attributes>
</classpathentry>
<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.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.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.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.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-1.0.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-sources-1.0.0.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.jar"/>
<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.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.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
<classpathentry kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
<classpathentry kind="src" path="/org.eclipse.virgo.kernel.core"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
+ <classpathentry kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
+ <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="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.virgo.kernel.agent.dm/ivy.xml b/org.eclipse.virgo.kernel.agent.dm/ivy.xml
index 52391a06..98824436 100644
--- a/org.eclipse.virgo.kernel.agent.dm/ivy.xml
+++ b/org.eclipse.virgo.kernel.agent.dm/ivy.xml
@@ -20,7 +20,8 @@
<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.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" 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.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration" conf='compile->compile'/>
<dependency name='org.eclipse.virgo.util.io' rev='${org.eclipse.virgo.util}' org='org.eclipse.virgo.util' conf='compile->compile'/>
@@ -30,7 +31,6 @@
<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 name='org.apache.felix.eventadmin' rev='${org.apache.felix.eventadmin}' conf='compile->compile' org='org.apache.felix'/>
<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}"/>
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/AgentDMStartTracker.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/AgentDMStartTracker.java
new file mode 100644
index 00000000..013fd9d8
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/AgentDMStartTracker.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.agent.dm;
+
+/**
+ *
+ * This interface is registered as a service that is enabled only when the agent.DM is started successfully
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * Implementations of this interface must be thread safe.
+ */
+public interface AgentDMStartTracker {
+
+}
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/StandardAgentDMStartTracker.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/StandardAgentDMStartTracker.java
new file mode 100644
index 00000000..faefba17
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/StandardAgentDMStartTracker.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.agent.dm;
+
+/**
+ *
+ * This class is the standard implementation for the AgentDMStartTracker
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+
+public class StandardAgentDMStartTracker implements AgentDMStartTracker {
+
+}
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
index 242acf95..35ed7163 100644
--- a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
@@ -14,20 +14,19 @@ package org.eclipse.virgo.kernel.agent.dm.internal;
import java.util.Dictionary;
import java.util.Hashtable;
-import org.osgi.framework.BundleActivator;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
+import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
import org.osgi.service.event.EventAdmin;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import org.springframework.osgi.context.event.OsgiBundleApplicationContextListener;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
-import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
-
/**
- * {@link BundleActivator} for the Kernel's Agent bundle
+ * ComponentContext activator for the Kernel's Agent bundle
*
* <p />
*
@@ -36,15 +35,14 @@ import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
* Thread-safe.
*
*/
-public final class AgentActivator implements BundleActivator {
+public final class AgentActivator {
+ private static final String AGENT_DM_START_TRACKER = "agentDMStartTracker";
private final ServiceRegistrationTracker registrationTracker = new ServiceRegistrationTracker();
- /**
- * {@inheritDoc}
- */
- public void start(BundleContext context) {
- registerSpringDmToBlueprintEventAdapter(context);
+ public void activate(ComponentContext context) {
+ registerSpringDmToBlueprintEventAdapter(context.getBundleContext());
+ context.enableComponent(AGENT_DM_START_TRACKER);
}
private void registerSpringDmToBlueprintEventAdapter(BundleContext context) {
@@ -66,11 +64,8 @@ public final class AgentActivator implements BundleActivator {
props.put(EventConstants.EVENT_TOPIC, new String[] { "org/osgi/service/blueprint/container/*" });
this.registrationTracker.track(context.registerService(EventHandler.class.getName(), failureListener, props));
}
-
- /**
- * {@inheritDoc}
- */
- public void stop(BundleContext context) throws Exception {
+
+ public void deactivate(ComponentContext context) throws Exception {
this.registrationTracker.unregisterAll();
}
@@ -82,10 +77,11 @@ public final class AgentActivator implements BundleActivator {
result = (T) context.getService(ref);
}
if (result == null) {
-//TODO: is consuming service references reasonable if failures are retried many times? May need the following code.
-// if (ref != null) {
-// context.ungetService(ref);
-// }
+ // TODO: is consuming service references reasonable if failures are retried many times? May need the
+ // following code.
+ // if (ref != null) {
+ // context.ungetService(ref);
+ // }
throw new IllegalStateException("Unable to access required service of type '" + clazz.getName() + "' from bundle '"
+ context.getBundle().getSymbolicName() + "'");
}
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
index cca255c7..afd39bb9 100644
--- a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
@@ -11,13 +11,16 @@
package org.eclipse.virgo.kernel.agent.dm.internal;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-
/**
* A {@link EventHandler} implementation that listens for and handles Blueprint container failure events.
* <p />
@@ -37,6 +40,10 @@ final class DeployerFailureListener implements EventHandler {
private final EventLogger eventLogger;
+ private volatile RegionDigraph regionDigraph;
+
+ private volatile Region agentRegion;
+
public DeployerFailureListener(EventLogger eventLogger) {
this.eventLogger = eventLogger;
}
@@ -55,8 +62,25 @@ final class DeployerFailureListener implements EventHandler {
}
private boolean inThisRegion(Bundle bundle) {
- Bundle agentBundle = FrameworkUtil.getBundle(getClass());
- return agentBundle.getBundleContext().getBundle(bundle.getBundleId()) == bundle;
+ if (regionDigraph == null) {
+ Bundle agentBundle = FrameworkUtil.getBundle(getClass());
+ BundleContext bundleContext = agentBundle.getBundleContext();
+ ServiceReference<RegionDigraph> regionMembershipServiceReference = bundleContext.getServiceReference(RegionDigraph.class);
+ if (regionMembershipServiceReference != null) {
+ this.regionDigraph = bundleContext.getService(regionMembershipServiceReference);
+ this.agentRegion = getRegion(agentBundle);
+ }
+ }
+ return this.regionDigraph != null ? getRegion(bundle).equals(this.agentRegion) : true;
+ }
+
+ private Region getRegion(Bundle bundle) {
+ for (Region region : this.regionDigraph) {
+ if (region.contains(bundle)) {
+ return region;
+ }
+ }
+ return null;
}
}
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/agentdm_start_tracker.xml b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/agentdm_start_tracker.xml
new file mode 100644
index 00000000..2e7d9f5c
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/agentdm_start_tracker.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component name="agentDMStartTracker" enabled="false" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">
+ <implementation class="org.eclipse.virgo.kernel.agent.dm.StandardAgentDMStartTracker"/>
+ <service>
+ <provide interface="org.eclipse.virgo.kernel.agent.dm.AgentDMStartTracker"/>
+ </service>
+</component> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml
new file mode 100644
index 00000000..1b52c6bb
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component name="agentDM" immediate="true" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">
+ <implementation class="org.eclipse.virgo.kernel.agent.dm.internal.AgentActivator"/>
+ <reference name="EventLogger"
+ interface="org.eclipse.virgo.medic.eventlog.EventLoggerFactory"
+ policy="dynamic"/>
+ <reference name="EventAdmin"
+ interface="org.osgi.service.event.EventAdmin"
+ policy="dynamic"/>
+</component> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.agent.dm/template.mf b/org.eclipse.virgo.kernel.agent.dm/template.mf
index baa0fc15..b1b6ce28 100644
--- a/org.eclipse.virgo.kernel.agent.dm/template.mf
+++ b/org.eclipse.virgo.kernel.agent.dm/template.mf
@@ -1,17 +1,19 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Virgo Kernel Agent Spring DM integration
-Bundle-SymbolicName: org.eclipse.virgo.kernel.agent.dm
-Bundle-Version: 2.2.0
-Bundle-Activator: org.eclipse.virgo.kernel.agent.dm.internal.AgentActivator
-Excluded-Exports:
- *.internal.*
-Import-Template:
- org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
- org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
- org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
- org.osgi.*;version="0",
- org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
- org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Virgo Kernel Agent Spring DM integration
+Bundle-SymbolicName: org.eclipse.virgo.kernel.agent.dm
+Bundle-Version: 3.0.0
+Excluded-Exports:
+ *.internal.*
+Import-Template:
+ org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
+ org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
+ org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
+ org.osgi.*;version="0",
+ org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
+ org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
- org.springframework.osgi.*;version="${org.springframework.osgi:[=.=.=, +1)}"
+ org.springframework.osgi.*;version="${org.springframework.osgi:[=.=.=, +1)}",
+ org.osgi.*;version="0",
+ org.eclipse.osgi.*;version="0"
+Service-Component: OSGI-INF/dm_agent.xml, OSGI-INF/agentdm_start_tracker.xml
diff --git a/org.eclipse.virgo.kernel.artifact/.classpath b/org.eclipse.virgo.kernel.artifact/.classpath
index 20f009cc..84a7dce8 100644
--- a/org.eclipse.virgo.kernel.artifact/.classpath
+++ b/org.eclipse.virgo.kernel.artifact/.classpath
@@ -22,16 +22,18 @@
</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.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.0019103807.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-2.0019103807.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.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.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-sources-2.2.0.D-20101207150849.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.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="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.virgo.kernel.artifact/ivy.xml b/org.eclipse.virgo.kernel.artifact/ivy.xml
index 4b96c7e7..4090f3f5 100644
--- a/org.eclipse.virgo.kernel.artifact/ivy.xml
+++ b/org.eclipse.virgo.kernel.artifact/ivy.xml
@@ -17,11 +17,14 @@
<dependency org="org.eclipse.virgo.repository" name="org.eclipse.virgo.repository" rev="${org.eclipse.virgo.repository}" conf="compile->compile" />
<dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
+ <dependency org="org.easymock" name="com.springsource.org.easymock" rev="${org.easymock}" conf="test->runtime"/>
<dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="test->runtime"/>
<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="${javax.servlet}" conf="test->runtime"/>
<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.dbcp" rev="${commons.dbcp}" conf="test->runtime" />
<dependency org="org.aopalliance" name="com.springsource.org.aopalliance" rev="${org.aopalliance}" conf="test->runtime" />
+
+ <dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
<override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
</dependencies>
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
index d7298b8d..9106e42d 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
@@ -40,9 +40,9 @@ import org.eclipse.virgo.util.osgi.manifest.FragmentHost.Extension;
* either as a JAR file, or a directory.
* <p />
* <strong>Concurrent Semantics</strong><br />
- *
+ *
* This class is thread-safe
- *
+ *
*/
public final class BundleBridge implements ArtifactBridge {
@@ -53,9 +53,9 @@ public final class BundleBridge implements ArtifactBridge {
public static final String RAW_HEADER_PREFIX = "RAW_HEADER:";
public static final String BRIDGE_TYPE = "bundle";
-
+
private final HashGenerator hashGenerator;
-
+
public BundleBridge(HashGenerator hashGenerator) {
this.hashGenerator = hashGenerator;
}
@@ -72,17 +72,47 @@ public final class BundleBridge implements ArtifactBridge {
BundleManifest bundleManifest;
try {
- bundleManifest = BundleManifestUtils.readBundleManifest(artifactFile, JAR_SUFFIX, WAR_SUFFIX);
+ bundleManifest = BundleManifestUtils.readBundleManifest(artifactFile, JAR_SUFFIX, WAR_SUFFIX);
} catch (RuntimeException re) {
throw new RuntimeException(String.format("Error occurred while parsing the manifest of file '%s'.", artifactFile.getPath()), re);
} catch (Exception e) {
throw new ArtifactGenerationException("Error occurred while parsing the manifest.", BRIDGE_TYPE, e);
}
-
- if (bundleManifest == null) {
- return null;
+
+ ArtifactDescriptor descriptor = null;
+
+ if (bundleManifest != null) {
+ descriptor = createArtifactDescriptorFromManifest(artifactFile, bundleManifest);
}
+ if (descriptor == null) {
+ descriptor = createArtifactDescriptorFromFile(artifactFile);
+ }
+
+ return descriptor;
+ }
+
+ private ArtifactDescriptor createArtifactDescriptorFromFile(File artifactFile) {
+ String fileName = artifactFile.getName();
+
+ if (fileName.endsWith(JAR_SUFFIX) || fileName.endsWith(WAR_SUFFIX)) {
+ String name = fileName.substring(0, fileName.length() - JAR_SUFFIX.length());
+
+ ArtifactDescriptorBuilder artifactDescriptorBuilder = new ArtifactDescriptorBuilder();
+ artifactDescriptorBuilder.setUri(artifactFile.toURI());
+ artifactDescriptorBuilder.setName(name);
+ artifactDescriptorBuilder.setType(BRIDGE_TYPE);
+ artifactDescriptorBuilder.setVersion(Version.emptyVersion);
+
+ this.hashGenerator.generateHash(artifactDescriptorBuilder, artifactFile);
+
+ return artifactDescriptorBuilder.build();
+ }
+
+ return null;
+ }
+
+ private ArtifactDescriptor createArtifactDescriptorFromManifest(File artifactFile, BundleManifest bundleManifest) throws ArtifactGenerationException {
try {
ArtifactDescriptorBuilder artifactDescriptorBuilder = new ArtifactDescriptorBuilder();
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
index 0219e9cc..d3f145a0 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
@@ -14,8 +14,6 @@ package org.eclipse.virgo.kernel.artifact.par;
import java.io.File;
import java.io.IOException;
-import org.osgi.framework.Version;
-
import org.eclipse.virgo.kernel.artifact.internal.BundleManifestUtils;
import org.eclipse.virgo.repository.ArtifactBridge;
import org.eclipse.virgo.repository.ArtifactDescriptor;
@@ -25,16 +23,17 @@ import org.eclipse.virgo.repository.builder.ArtifactDescriptorBuilder;
import org.eclipse.virgo.repository.builder.AttributeBuilder;
import org.eclipse.virgo.util.common.StringUtils;
import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
+import org.osgi.framework.Version;
/**
* An <code>ArtifactBridge</code> for PAR files.
- *
+ *
* <p />
- *
+ *
* <strong>Concurrent Semantics</strong><br />
- *
+ *
* Thread-safe.
- *
+ *
*/
public final class ParBridge implements ArtifactBridge {
@@ -50,6 +49,8 @@ public final class ParBridge implements ArtifactBridge {
public static final String BRIDGE_TYPE = "par";
+ public static final String PAR_SUFFIX = ".par";
+
private final HashGenerator hashGenerator;
public ParBridge(HashGenerator hashGenerator) {
@@ -61,7 +62,7 @@ public final class ParBridge implements ArtifactBridge {
BundleManifest manifest;
try {
- manifest = BundleManifestUtils.readBundleManifest(artifactFile, ".par");
+ manifest = BundleManifestUtils.readBundleManifest(artifactFile, PAR_SUFFIX);
} catch (IOException ioe) {
throw new ArtifactGenerationException("Failed to read manifest from " + artifactFile, ioe);
}
@@ -69,10 +70,27 @@ public final class ParBridge implements ArtifactBridge {
if (manifest != null) {
return createDescriptorFromManifest(manifest, artifactFile);
} else {
- return null;
+ return createDescriptorFromFile(artifactFile);
}
}
+ private ArtifactDescriptor createDescriptorFromFile(File artifactFile) throws ArtifactGenerationException {
+ String fileName = artifactFile.getName();
+
+ if (fileName.endsWith(PAR_SUFFIX)) {
+ String symbolicName = fileName.substring(0, fileName.length() - PAR_SUFFIX.length());
+
+ ArtifactDescriptorBuilder builder = new ArtifactDescriptorBuilder();
+ builder.setType(BRIDGE_TYPE).setName(symbolicName).setVersion(Version.emptyVersion).setUri(artifactFile.toURI());
+
+ this.hashGenerator.generateHash(builder, artifactFile);
+
+ return builder.build();
+ }
+
+ return null;
+ }
+
private ArtifactDescriptor createDescriptorFromManifest(BundleManifest manifest, File artifactFile) throws ArtifactGenerationException {
String symbolicName = getApplicationSymbolicName(manifest);
@@ -88,7 +106,7 @@ public final class ParBridge implements ArtifactBridge {
applyAttributeIfPresent(HEADER_APPLICATION_NAME, manifest, builder);
applyAttributeIfPresent(HEADER_APPLICATION_DESCRIPTION, manifest, builder);
-
+
this.hashGenerator.generateHash(builder, artifactFile);
return builder.build();
@@ -102,7 +120,7 @@ public final class ParBridge implements ArtifactBridge {
}
}
- private Version getApplicationVersion(BundleManifest manifest) throws ArtifactGenerationException {
+ private Version getApplicationVersion(BundleManifest manifest) {
String versionString = manifest.getHeader(HEADER_APPLICATION_VERSION);
Version version;
@@ -112,7 +130,7 @@ public final class ParBridge implements ArtifactBridge {
try {
version = new Version(versionString);
} catch (IllegalArgumentException iae) {
- throw new ArtifactGenerationException("Version '" + versionString + "' is ill-formed", iae);
+ throw new IllegalArgumentException("Version '" + versionString + "' is ill-formed", iae);
}
}
return version;
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
index a1963ff6..cd62c9ba 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
@@ -16,14 +16,17 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
-import org.osgi.framework.Version;
-
import org.eclipse.virgo.repository.ArtifactBridge;
import org.eclipse.virgo.repository.ArtifactDescriptor;
import org.eclipse.virgo.repository.ArtifactGenerationException;
import org.eclipse.virgo.repository.HashGenerator;
import org.eclipse.virgo.repository.builder.ArtifactDescriptorBuilder;
+import org.eclipse.virgo.repository.builder.AttributeBuilder;
+import org.eclipse.virgo.util.common.StringUtils;
import org.eclipse.virgo.util.io.IOUtils;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+import org.osgi.service.cm.ConfigurationAdmin;
/**
* An {@link ArtifactBridge} that creates {@link ArtifactDescriptor ArtifactDescriptors} for .properties files.
@@ -42,8 +45,11 @@ public final class PropertiesBridge implements ArtifactBridge {
private final HashGenerator hashGenerator;
- public PropertiesBridge(HashGenerator hashGenerator) {
+ private final ConfigurationAdmin configAdmin;
+
+ public PropertiesBridge(HashGenerator hashGenerator, ConfigurationAdmin configAdmin) {
this.hashGenerator = hashGenerator;
+ this.configAdmin = configAdmin;
}
public ArtifactDescriptor generateArtifactDescriptor(File artifactFile) throws ArtifactGenerationException {
@@ -51,10 +57,11 @@ public final class PropertiesBridge implements ArtifactBridge {
FileReader reader = null;
try {
reader = new FileReader(artifactFile);
- new Properties().load(reader);
- return createArtifactDescriptor(artifactFile);
+ Properties properties = new Properties();
+ properties.load(reader);
+ return createArtifactDescriptor(artifactFile, properties);
} catch (IOException e) {
- throw new ArtifactGenerationException("Failed to read properties file", ARTIFACT_TYPE, e);
+ throw new ArtifactGenerationException("Failed processing properties file", ARTIFACT_TYPE, e);
} finally {
IOUtils.closeQuietly(reader);
}
@@ -62,10 +69,43 @@ public final class PropertiesBridge implements ArtifactBridge {
return null;
}
- private ArtifactDescriptor createArtifactDescriptor(File propertiesFile) {
- String fileName = propertiesFile.getName();
- String name = fileName.substring(0, fileName.length() - PROPERTIES_SUFFIX.length());
+ private ArtifactDescriptor createArtifactDescriptor(File propertiesFile, Properties properties) throws IOException {
+
+ String name = properties.getProperty(ConfigurationAdmin.SERVICE_FACTORYPID);
+ if (StringUtils.hasText(name)) {
+ // this is a factory configuration - need to generate actual PID for a new configuration
+ return buildForManagedServiceFactoryConfiguration(propertiesFile, name, properties);
+ }
+
+ name = properties.getProperty(Constants.SERVICE_PID);
+ if (!StringUtils.hasText(name)) {
+ String fileName = propertiesFile.getName();
+ name = fileName.substring(0, fileName.length() - PROPERTIES_SUFFIX.length());
+ }
+
+ return buildAtrifactDescriptor(propertiesFile, name).build();
+ }
+
+ /**
+ * @param propertiesFile
+ * @param name
+ * @param properties
+ * @return
+ * @throws IOException
+ */
+ private ArtifactDescriptor buildForManagedServiceFactoryConfiguration(File propertiesFile, String factoryPid, Properties properties)
+ throws IOException {
+
+ // generated service.pid - will use as a name for artifactId
+ String pid = configAdmin.createFactoryConfiguration(factoryPid, null).getPid();
+ ArtifactDescriptorBuilder builder = buildAtrifactDescriptor(propertiesFile, pid);
+ builder.addAttribute(new AttributeBuilder().setName(ConfigurationAdmin.SERVICE_FACTORYPID).setValue(factoryPid).build());
+
+ return builder.build();
+ }
+
+ private ArtifactDescriptorBuilder buildAtrifactDescriptor(File propertiesFile, String name) {
ArtifactDescriptorBuilder artifactDescriptorBuilder = new ArtifactDescriptorBuilder();
artifactDescriptorBuilder //
@@ -73,9 +113,9 @@ public final class PropertiesBridge implements ArtifactBridge {
.setType(ARTIFACT_TYPE) //
.setName(name) //
.setVersion(Version.emptyVersion);
-
+
this.hashGenerator.generateHash(artifactDescriptorBuilder, propertiesFile);
- return artifactDescriptorBuilder.build();
+ return artifactDescriptorBuilder;
}
}
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java
index 8d606dba..ef06b0a2 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java
@@ -37,21 +37,21 @@ import org.osgi.framework.Version;
* Unit tests for {@link org.eclipse.virgo.kernel.artifact.bundle.BundleBridge BundleBridge}. Uses a combination of real bundle files and
* static test data.
* </p>
- *
+ *
* <strong>Concurrent Semantics</strong><br />
- *
+ *
* Threadsafe test case
- *
+ *
*/
public class BundleBridgeTests {
-
+
//Test Data
-
+
private final static String ARTEFACT_ATTRIBUTE_NAME = "name";
private final static String ARTEFACT_ATTRIBUTE_VERSION = "version";
//End Test Data
-
+
private static BundleBridge BUNDLE_BRIDGE;
private static final StubBundleArtefactBridge STUB_ARTEFACT_DEFINITION = new StubBundleArtefactBridge();
@@ -162,7 +162,7 @@ public class BundleBridgeTests {
public void webBundleWar() throws ArtifactGenerationException {
ArtifactDescriptor descriptor = BUNDLE_BRIDGE.generateArtifactDescriptor(new File("src/test/resources/wars/test.war"));
assertNotNull(descriptor);
- assertEquals("bundle", descriptor.getType());
+ assertEquals(BundleBridge.BRIDGE_TYPE, descriptor.getType());
assertEquals("com.springsource.server.admin.web", descriptor.getName());
assertEquals(new Version(2, 0, 0), descriptor.getVersion());
}
@@ -171,14 +171,32 @@ public class BundleBridgeTests {
public void explodedBundle() throws ArtifactGenerationException {
ArtifactDescriptor descriptor = BUNDLE_BRIDGE.generateArtifactDescriptor(new File("src/test/resources/bundle.jar"));
assertNotNull(descriptor);
- assertEquals("bundle", descriptor.getType());
+ assertEquals(BundleBridge.BRIDGE_TYPE, descriptor.getType());
assertEquals("exploded.bundle", descriptor.getName());
assertEquals(new Version(1, 0, 0), descriptor.getVersion());
}
+ @Test
+ public void noSymbolicName() throws ArtifactGenerationException {
+ ArtifactDescriptor descriptor = BUNDLE_BRIDGE.generateArtifactDescriptor(new File("src/test/resources/jars/no-symbolic-name.jar"));
+ assertNotNull(descriptor);
+ assertEquals(BundleBridge.BRIDGE_TYPE, descriptor.getType());
+ assertEquals("no-symbolic-name", descriptor.getName());
+ assertEquals(new Version(0, 0, 0), descriptor.getVersion());
+ }
+
+ @Test
+ public void noManifest() throws ArtifactGenerationException {
+ ArtifactDescriptor descriptor = BUNDLE_BRIDGE.generateArtifactDescriptor(new File("src/test/resources/jars/no-manifest.jar"));
+ assertNotNull(descriptor);
+ assertEquals(BundleBridge.BRIDGE_TYPE, descriptor.getType());
+ assertEquals("no-manifest", descriptor.getName());
+ assertEquals(Version.emptyVersion, descriptor.getVersion());
+ }
+
private Set<ArtifactDescriptor> generateArtefacts(File directory) throws ArtifactGenerationException {
Set<ArtifactDescriptor> artefacts = new HashSet<ArtifactDescriptor>();
-
+
for (File fileInDir : directory.listFiles()) {
if(!fileInDir.getName().endsWith(".jar") && !fileInDir.getName().contains("sources")){
ArtifactDescriptor artefact = BUNDLE_BRIDGE.generateArtifactDescriptor(fileInDir);
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java
index 459889f3..8a47a352 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java
@@ -22,56 +22,51 @@ import java.io.File;
import org.junit.Test;
import org.osgi.framework.Version;
-
import org.eclipse.virgo.kernel.artifact.StubHashGenerator;
import org.eclipse.virgo.kernel.artifact.par.ParBridge;
import org.eclipse.virgo.repository.ArtifactDescriptor;
import org.eclipse.virgo.repository.ArtifactGenerationException;
-
-/**
- *
- */
public class ParBridgeTests {
-
+
private final ParBridge parBridge = new ParBridge(new StubHashGenerator());
-
+
@Test
public void descriptorGeneration() throws ArtifactGenerationException {
ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/basic.par"));
assertDescriptor(descriptor, "par", "basic", new Version(1,2,3), "Basic Par", "A basic PAR file for the unit tests");
}
-
+
@Test
public void generationWithNoManifest() throws ArtifactGenerationException {
ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-manifest.par"));
- assertNull(descriptor);
+ assertDescriptor(descriptor, "par", "no-manifest", Version.emptyVersion, null, null);
}
-
+
@Test
public void generationWithNoApplicationSymbolicName() throws ArtifactGenerationException {
ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-asn.par"));
assertNull(descriptor);
}
-
+
@Test
public void generationWithNoApplicationVersion() throws ArtifactGenerationException {
ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-version.par"));
assertDescriptor(descriptor, "par", "basic", Version.emptyVersion, "Basic Par", "A basic PAR file for the unit tests");
}
-
+
@Test
public void generationWithNoName() throws ArtifactGenerationException {
ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-name.par"));
assertDescriptor(descriptor, "par", "basic", new Version(1,2,3), null, "A basic PAR file for the unit tests");
}
-
+
@Test
public void generationWithNoDescription() throws ArtifactGenerationException {
ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-description.par"));
assertDescriptor(descriptor, "par", "basic", new Version(1,2,3), "Basic Par", null);
}
-
+
@Test
public void generationWithIllegalApplicationSymbolicName() throws Exception {
try {
@@ -79,24 +74,24 @@ public class ParBridgeTests {
fail("Illegal Application-SymbolicName did not throw an ArtifactGenerationException");
} catch (ArtifactGenerationException age) {
assertEquals("Application-SymbolicName '.@$%' contains illegal characters", age.getMessage());
- }
+ }
}
-
+
@Test
public void generationWithIllegalApplicationVersion() throws Exception {
try {
this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/illegal-version.par"));
- fail("Illegal Application-Version did not throw an ArtifactGenerationException");
- } catch (ArtifactGenerationException age) {
- assertEquals("Version 'alpha' is ill-formed", age.getMessage());
- }
+ fail("Illegal Application-Version did not throw an IllegalArgumentException");
+ } catch (IllegalArgumentException iae) {
+ assertEquals("Version 'alpha' is ill-formed", iae.getMessage());
+ }
}
-
+
@Test(expected=ArtifactGenerationException.class)
public void generationWithMissingPar() throws ArtifactGenerationException {
- this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/not-there.par"));
+ this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/not-there.par"));
}
-
+
private void assertDescriptor(ArtifactDescriptor descriptor, String type, String symbolicName, Version version, String name, String description) {
assertNotNull(descriptor);
assertEquals(type, descriptor.getType());
@@ -107,7 +102,7 @@ public class ParBridgeTests {
} else {
assertTrue(descriptor.getAttribute("Application-Name").isEmpty());
}
-
+
if (description != null) {
assertEquals(description, descriptor.getAttribute("Application-Description").iterator().next().getValue());
} else {
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
index 4f046b2b..d0aa49f4 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
@@ -11,18 +11,23 @@
package org.eclipse.virgo.kernel.artifact.properties;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.*;
+import static org.easymock.EasyMock.*;
import java.io.File;
+import java.io.IOException;
+import java.util.Set;
import org.junit.Test;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
-
+import org.easymock.EasyMock;
import org.eclipse.virgo.kernel.artifact.StubHashGenerator;
import org.eclipse.virgo.kernel.artifact.properties.PropertiesBridge;
import org.eclipse.virgo.repository.ArtifactDescriptor;
import org.eclipse.virgo.repository.ArtifactGenerationException;
+import org.eclipse.virgo.repository.Attribute;
/**
*/
@@ -30,14 +35,14 @@ public class PropertiesBridgeTests {
@Test
public void testGeneratePropertiesFile() throws ArtifactGenerationException {
- PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
ArtifactDescriptor result = bridge.generateArtifactDescriptor(new File("src/test/resources/properties/foo.properties"));
assertNotNull(result);
}
@Test(expected = ArtifactGenerationException.class)
public void testFileDoesNotExist() throws ArtifactGenerationException {
- PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
File file = new File("src/test/resources/properties/not.exist.properties");
bridge.generateArtifactDescriptor(file);
@@ -45,8 +50,68 @@ public class PropertiesBridgeTests {
@Test
public void testGenerateNotPropertiesFile() throws ArtifactGenerationException {
- PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), createMock(ConfigurationAdmin.class));
ArtifactDescriptor descriptor = bridge.generateArtifactDescriptor(new File("src/test/resources/bar.noterties"));
assertNull(descriptor);
}
+
+ @Test
+ public void testGenerateWithFactoryPid() throws ArtifactGenerationException {
+ final String factoryPid = "test.factory.pid";
+ final String propertiesFile = "src/test/resources/properties/factoryPid.properties";
+
+ ConfigurationAdmin mockConfigAdmin = createMock(ConfigurationAdmin.class);
+ Configuration mockConfiguration = createMock(Configuration.class);
+
+ try {
+ expect(mockConfigAdmin.createFactoryConfiguration(factoryPid, null)).andReturn(mockConfiguration);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ expect(mockConfiguration.getPid()).andReturn("1");
+
+ replay(mockConfigAdmin, mockConfiguration);
+
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), mockConfigAdmin);
+ ArtifactDescriptor descriptor = bridge.generateArtifactDescriptor(new File(propertiesFile));
+
+ verify(mockConfigAdmin, mockConfiguration);
+
+ // asserts
+ assertNotNull(descriptor);
+ assertEquals("1", descriptor.getName());
+ // only expect one attribute
+ Set<Attribute> attrSet = descriptor.getAttribute(ConfigurationAdmin.SERVICE_FACTORYPID);
+ assertEquals(1, attrSet.size());
+ Attribute attr = attrSet.iterator().next();
+ assertNotNull(factoryPid, attr.getValue());
+ }
+
+ @Test(expected = ArtifactGenerationException.class)
+ public void testGenerateWithFactoryPidAndIoExceptionFromConfigAdmin() throws ArtifactGenerationException {
+ final String factoryPid = "test.factory.pid";
+ final String propertiesFile = "src/test/resources/properties/factoryPid.properties";
+
+ ConfigurationAdmin mockConfigAdmin = createMock(ConfigurationAdmin.class);
+
+ try {
+ expect(mockConfigAdmin.createFactoryConfiguration(factoryPid, null)).andThrow(new IOException("exception from configadmin"));
+ } catch (IOException e) {
+ // I really hate checked exceptions.
+ }
+
+ replay(mockConfigAdmin);
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), mockConfigAdmin);
+ bridge.generateArtifactDescriptor(new File(propertiesFile));
+ verify(mockConfigAdmin);
+ }
+
+ @Test
+ public void makeSureThatServicePidIsTakenFromTheFileProvidedProperties() throws ArtifactGenerationException {
+ final String name = "service.pid.in.the.file";
+ PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
+ ArtifactDescriptor result = bridge.generateArtifactDescriptor(new File("src/test/resources/properties/with-service-pid.properties"));
+ assertNotNull(result);
+ assertEquals(name, result.getName());
+ }
}
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-manifest.jar b/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-manifest.jar
new file mode 100644
index 00000000..f63054be
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-manifest.jar
Binary files differ
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-symbolic-name.jar b/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-symbolic-name.jar
new file mode 100644
index 00000000..7ab5fb31
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-symbolic-name.jar
Binary files differ
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties
new file mode 100644
index 00000000..f8d8d915
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties
@@ -0,0 +1,6 @@
+# factory pid for config admin service
+service.factoryPid = test.factory.pid
+
+# properties for the managed service
+prop1 = prop1
+prop2 = 2 \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties
new file mode 100644
index 00000000..e008c6c3
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties
@@ -0,0 +1,6 @@
+#config admin properties config with service.pid specified in the file vs. filename
+service.pid = service.pid.in.the.file
+
+# properties
+prop1 = prop1
+prop2 = 2 \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/template.mf b/org.eclipse.virgo.kernel.artifact/template.mf
index bda0fdae..14c55078 100644
--- a/org.eclipse.virgo.kernel.artifact/template.mf
+++ b/org.eclipse.virgo.kernel.artifact/template.mf
@@ -2,13 +2,14 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Virgo Kernel Artifact Integration
Bundle-SymbolicName: org.eclipse.virgo.kernel.artifact
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
Import-Template:
org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
org.eclipse.virgo.repository.*;version="${org.eclipse.virgo.repository:[=.=.=, =.+1)}",
org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
org.osgi.framework.*;version="0",
+ org.osgi.service.cm.*;version="0",
org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
javax.xml.*;version="0",
org.xml.*;version="0",
diff --git a/org.eclipse.virgo.kernel.authentication/template.mf b/org.eclipse.virgo.kernel.authentication/template.mf
index 87742645..e98744b7 100644
--- a/org.eclipse.virgo.kernel.authentication/template.mf
+++ b/org.eclipse.virgo.kernel.authentication/template.mf
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Virgo Kernel Authentication
Bundle-SymbolicName: org.eclipse.virgo.kernel.authentication
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
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
index a987399c..1461101b 100644
--- a/org.eclipse.virgo.kernel.core/.classpath
+++ b/org.eclipse.virgo.kernel.core/.classpath
@@ -22,29 +22,29 @@
</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.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.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/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.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/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-sources-2.2.0.D-20101207150849.jar">
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-sources-3.0.0.M02.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/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-sources-2.2.0.D-20101207150849.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-sources-3.0.0.M02.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/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.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/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry exported="true" kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-3.3.0.v20101018.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-1.0.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-sources-2.2.0.D-20101207150849.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
+ <classpathentry exported="true" kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.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.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.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="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.virgo.kernel.core/ivy.xml b/org.eclipse.virgo.kernel.core/ivy.xml
index 05a0a684..c828c5fd 100644
--- a/org.eclipse.virgo.kernel.core/ivy.xml
+++ b/org.eclipse.virgo.kernel.core/ivy.xml
@@ -20,7 +20,8 @@
<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.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" 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 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'/>
@@ -30,7 +31,6 @@
<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 name='org.apache.felix.eventadmin' rev='${org.apache.felix.eventadmin}' conf='compile->compile' org='org.apache.felix'/>
<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}"/>
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
index 88fc00f5..20cd2eed 100644
--- 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
@@ -16,21 +16,29 @@ 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;
@@ -39,11 +47,14 @@ public final class KernelConfiguration {
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() {
@@ -62,6 +73,10 @@ public final class KernelConfiguration {
return domain;
}
+ public int getStartupWaitLimit() {
+ return startupWaitLimit;
+ }
+
private static File readHomeDirectory(BundleContext context) {
String kernelHomeProperty = readFrameworkProperty(PROPERTY_KERNEL_HOME, context);
if (!hasText(kernelHomeProperty)) {
@@ -105,6 +120,21 @@ public final class KernelConfiguration {
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);
}
@@ -112,5 +142,4 @@ public final class KernelConfiguration {
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
index 56433920..da4a3f3b 100644
--- 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
@@ -36,6 +36,8 @@ final class KernelConfigurationPropertiesSource implements PropertiesSource {
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) {
@@ -54,6 +56,7 @@ final class KernelConfigurationPropertiesSource implements PropertiesSource {
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/StandardKernelConfig.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardKernelConfig.java
new file mode 100644
index 00000000..7b71ad64
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardKernelConfig.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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/core/AbortableSignal.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java
new file mode 100644
index 00000000..7519e5bd
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 00000000..260ca0e1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingAbortableSignal.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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/BundleStarter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java
index bce3ec9a..f02d90b8 100644
--- 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
@@ -35,7 +35,7 @@ public interface BundleStarter {
* @param signal the <code>Signal</code> to drive.
* @throws BundleException if Bundle {@link Bundle#start()} fails
*/
- void start(Bundle bundle, Signal signal) throws BundleException;
+ void start(Bundle bundle, AbortableSignal signal) throws BundleException;
/**
* Starts the supplied {@link Bundle}, driving the supplied signal upon successful or unsuccessful completion
@@ -48,7 +48,13 @@ public interface BundleStarter {
* @param signal the <code>Signal</code> to drive.
* @throws BundleException
*/
- void start(Bundle bundle, int options, Signal signal) throws BundleException;
+ void start(Bundle bundle, int options, AbortableSignal signal) throws BundleException;
- void trackStart(Bundle bundle, Signal signal);
+ /**
+ * 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/KernelConfig.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java
new file mode 100644
index 00000000..a69feec8
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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/internal/BundleStartTracker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java
index a20e51ee..9c57156d 100644
--- 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
@@ -17,6 +17,7 @@ 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;
@@ -68,7 +69,7 @@ final class BundleStartTracker implements EventHandler {
private final Map<Bundle, Throwable> failureMap = new HashMap<Bundle, Throwable>();
- private final Map<Bundle, List<Signal>> signalMap = new HashMap<Bundle, List<Signal>>();
+ private final Map<Bundle, List<AbortableSignal>> signalMap = new HashMap<Bundle, List<AbortableSignal>>();
private final BundleListener bundleListener = new StartupTrackerBundleListener();
@@ -92,7 +93,7 @@ final class BundleStartTracker implements EventHandler {
private void driveSignalsIfStartCompleted(Bundle bundle, boolean springDmPowered) {
- List<Signal> signals = null;
+ List<AbortableSignal> signals = null;
Throwable failure = null;
boolean isActive = isBundleActive(bundle);
@@ -123,20 +124,22 @@ final class BundleStartTracker implements EventHandler {
if (signals != null) {
if (!springDmPowered && isActive) {
LOGGER.info("Non-Spring DM powered bundle '{}' has started. Driving signals '{}'.", bundle, signals);
- driveSignals(signals, null);
+ driveSignals(signals, false, null);
}
else {
- driveSignals(signals, failure);
+ driveSignals(signals, false, failure);
}
}
}
- private void driveSignals(final List<Signal> signals, final Throwable cause) {
+ private void driveSignals(final List<AbortableSignal> signals, final boolean aborted, final Throwable cause) {
this.signalExecutor.execute(new Runnable() {
public void run() {
- for (Signal signal : signals) {
+ for (AbortableSignal signal : signals) {
LOGGER.info("Driving signal '{}'", signal);
- if (cause == null) {
+ if (aborted){
+ signal.signalAborted();
+ } else if (cause == null) {
signal.signalSuccessfulCompletion();
} else {
signal.signalFailure(cause);
@@ -154,7 +157,7 @@ final class BundleStartTracker implements EventHandler {
LOGGER.info("Handling event '{}'", event);
Throwable cause = null;
- List<Signal> signals = null;
+ List<AbortableSignal> signals = null;
Bundle bundle = (Bundle) event.getProperty("bundle");
if (EVENT_FAILURE.equals(event.getTopic())) {
@@ -176,11 +179,11 @@ final class BundleStartTracker implements EventHandler {
}
if (signals != null) {
- driveSignals(signals, cause);
+ driveSignals(signals, false, cause);
}
}
- public void trackStart(Bundle bundle, Signal signal) {
+ public void trackStart(Bundle bundle, AbortableSignal signal) {
if (BundleUtils.isFragmentBundle(bundle)) {
throw new IllegalArgumentException("Cannot track the start of a fragment bundle.");
}
@@ -191,11 +194,11 @@ final class BundleStartTracker implements EventHandler {
if (signal != null) {
if (springDmPowered || !bundleActive) {
- List<Signal> queue;
+ List<AbortableSignal> queue;
synchronized (this.monitor) {
queue = this.signalMap.get(bundle);
if (queue == null) {
- queue = new ArrayList<Signal>();
+ queue = new ArrayList<AbortableSignal>();
this.signalMap.put(bundle, queue);
}
LOGGER.info("Adding signal '{}' for bundle '{}'", signal, bundle);
@@ -203,7 +206,7 @@ final class BundleStartTracker implements EventHandler {
}
} else {
// !springDmPowered && bundleActive
- driveSignals(Arrays.asList(signal), null);
+ driveSignals(Arrays.asList(signal), false, null);
}
}
driveSignalsIfStartCompleted(bundle, springDmPowered);
@@ -224,26 +227,32 @@ final class BundleStartTracker implements EventHandler {
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<Signal> signals = null;
+ 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, null);
+ 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, new RuntimeException("bundle stopped"));
+ BundleStartTracker.this.cleanup(bundle, this.isLazyBundle, this.isLazyBundle ? null : new RuntimeException("Bundle '" + bundle + "' stopped"));
}
}
}
@@ -253,8 +262,8 @@ final class BundleStartTracker implements EventHandler {
* @param bundle whose tracking state is removed
* @param cause reason for cleaning up
*/
- public void cleanup(Bundle bundle, Throwable cause) {
- List<Signal> danglingSignals = null;
+ 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);
@@ -263,7 +272,7 @@ final class BundleStartTracker implements EventHandler {
}
}
if (danglingSignals != null) {
- driveSignals(danglingSignals, cause);
+ driveSignals(danglingSignals, aborted, cause);
}
}
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
index f318b36f..e4503438 100644
--- 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
@@ -38,22 +38,22 @@ import org.eclipse.virgo.kernel.shim.serviceability.internal.Slf4jTracingService
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.BundleActivator;
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;
/**
- * {@link BundleActivator} that initialises the core of the Kernel.
+ * ComponentContext activator that initialises the core of the Kernel.
*
* <strong>Concurrent Semantics</strong><br />
* Threadsafe.
*
*/
-public class CoreBundleActivator implements BundleActivator {
+public class CoreBundleActivator {
private static final String START_SIGNALLING_THREAD_NAME_PREFIX = "start-signalling-";
@@ -69,8 +69,6 @@ public class CoreBundleActivator implements BundleActivator {
private static final String MBEAN_KEY_TYPE = "type";
- private static final int STARTUP_WAIT_LIMIT = 3600; // one hour
-
private final ServiceRegistrationTracker tracker = new ServiceRegistrationTracker();
private final ConfigurationInitialiser configurationInitialiser = new ConfigurationInitialiser();
@@ -83,10 +81,9 @@ public class CoreBundleActivator implements BundleActivator {
private volatile BundleStartTracker bundleStartTracker;
- /**
- * {@inheritDoc}
- */
- public void start(BundleContext context) throws Exception {
+ public void activate(ComponentContext componentContext) throws Exception {
+ BundleContext context = componentContext.getBundleContext();
+
EventLogger eventLogger = getRequiredService(context, EventLogger.class);
KernelConfiguration configuration = this.configurationInitialiser.start(context, eventLogger);
@@ -99,7 +96,7 @@ public class CoreBundleActivator implements BundleActivator {
DumpGenerator dumpGenerator = getRequiredService(context, DumpGenerator.class);
- this.startupTracker = new StartupTracker(context, configuration, STARTUP_WAIT_LIMIT, bundleStartTracker, shutdown, dumpGenerator);
+ this.startupTracker = new StartupTracker(context, configuration, configuration.getStartupWaitLimit(), bundleStartTracker, shutdown, dumpGenerator);
this.startupTracker.start();
initShimServices(context, eventLogger);
@@ -155,10 +152,7 @@ public class CoreBundleActivator implements BundleActivator {
return bundleStarter;
}
- /**
- * {@inheritDoc}
- */
- public void stop(BundleContext context) throws Exception {
+ public void deactivate(ComponentContext context) throws Exception {
this.tracker.unregisterAll();
this.startupTracker.stop();
this.configurationInitialiser.stop();
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
index 4c3cd787..18f91d77 100644
--- 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
@@ -1,7 +1,7 @@
/*******************************************************************************
* This file is part of the Virgo Web Server.
*
- * Copyright (c) 2010 Eclipse Foundation.
+ * 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
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
index 7eca0d0e..a354a9b9 100644
--- 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
@@ -11,9 +11,9 @@
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.eclipse.virgo.kernel.core.Signal;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -41,14 +41,14 @@ final class StandardBundleStarter implements BundleStarter {
/**
* {@inheritDoc}
*/
- public void start(Bundle bundle, Signal signal) throws BundleException {
+ public void start(Bundle bundle, AbortableSignal signal) throws BundleException {
start(bundle, DEFAULT_START_OPTIONS, signal);
}
/**
* {@inheritDoc}
*/
- public void start(Bundle bundle, int options, Signal signal) throws BundleException {
+ public void start(Bundle bundle, int options, AbortableSignal signal) throws BundleException {
trackStart(bundle, signal);
@@ -56,21 +56,16 @@ final class StandardBundleStarter implements BundleStarter {
try {
bundle.start(options);
} catch (BundleException be) {
- this.bundleStartTracker.cleanup(bundle, be);
+ this.bundleStartTracker.cleanup(bundle, false, be);
throw be;
}
}
}
- private static boolean bundleNeedsStarting(Bundle bundle) {
- if (bundle != null) {
- int bundleState = bundle.getState();
- return (bundleState != Bundle.STARTING && bundleState != Bundle.ACTIVE);
- }
- return false;
- }
-
- public void trackStart(Bundle bundle, Signal signal) {
+ /**
+ * {@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");
}
@@ -79,4 +74,13 @@ final class StandardBundleStarter implements BundleStarter {
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
index b334d17a..9355c202 100644
--- 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
@@ -12,25 +12,16 @@
package org.eclipse.virgo.kernel.core.internal;
import java.lang.management.ManagementFactory;
-import java.util.concurrent.TimeUnit;
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.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;
-
-
import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
-import org.eclipse.virgo.kernel.core.BlockingSignal;
+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;
@@ -38,6 +29,13 @@ 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
@@ -60,9 +58,11 @@ final class StartupTracker {
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";
@@ -151,20 +151,35 @@ final class StartupTracker {
Bundle[] bundles = this.context.getBundles();
try {
+ long waitTime = TimeUnit.SECONDS.toMillis(this.startupWaitTime);
+
for (Bundle bundle : bundles) {
- if (!BundleUtils.isFragmentBundle(bundle) && isKernelBundle(bundle)) {
- BlockingSignal signal = new BlockingSignal();
-
+
+ if (!BundleUtils.isFragmentBundle(bundle) && isKernelBundle(bundle)) {
+ BlockingAbortableSignal signal = new BlockingAbortableSignal();
+
this.asyncBundleStartTracker.trackStart(bundle, signal);
-
- LOGGER.debug("Awaiting signal {} for up to {} seconds", signal, this.startupWaitTime);
-
- if (!signal.awaitCompletion(this.startupWaitTime, TimeUnit.SECONDS)) {
- LOGGER.error("Bundle {} did not start within {} seconds.", bundle, this.startupWaitTime);
- kernelStartTimedOut();
+
+ 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());
@@ -216,6 +231,12 @@ final class StartupTracker {
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);
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
index e2d5088d..67b0fb62 100644
--- 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
@@ -29,6 +29,7 @@ public enum KernelLogEvents implements LogEvent {
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), //
diff --git a/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties
index bac92102..3eec2038 100644
--- a/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties
+++ b/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties
@@ -3,6 +3,7 @@ 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.
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
new file mode 100644
index 00000000..d07c2ddd
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernel_config.xml
@@ -0,0 +1,9 @@
+<?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
new file mode 100644
index 00000000..e08d39ab
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component name="kernelcore" immediate="true" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">
+ <implementation class="org.eclipse.virgo.kernel.core.internal.CoreBundleActivator"/>
+ <reference name="EventLogger"
+ interface="org.eclipse.virgo.medic.eventlog.EventLogger"
+ policy="dynamic"/>
+ <reference name="DumpGenerator"
+ interface="org.eclipse.virgo.medic.dump.DumpGenerator"
+ policy="dynamic"/>
+ <reference name="ConfigAdmin"
+ interface="org.osgi.service.cm.ConfigurationAdmin"
+ policy="dynamic"/>
+ <reference name="EventAdmin"
+ interface="org.osgi.service.event.EventAdmin"
+ policy="dynamic"/>
+</component> \ No newline at end of file
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
index 5b361493..ed6e2dbb 100644
--- 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
@@ -19,8 +19,6 @@ import java.util.Properties;
import org.junit.Test;
-import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
-import org.eclipse.virgo.kernel.config.internal.KernelConfigurationPropertiesSource;
import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
@@ -44,5 +42,6 @@ public class KernelConfigurationPropertiesSourceTests {
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
index cbc667cf..b801a541 100644
--- 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
@@ -18,7 +18,6 @@ import java.io.File;
import org.junit.Test;
-import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
@@ -37,6 +36,7 @@ public class KernelConfigurationTests {
assertNotNull(configuration.getConfigDirectories());
assertEquals(1, configuration.getConfigDirectories().length);
assertNotNull(configuration.getDomain());
+ assertNotNull(configuration.getStartupWaitLimit());
}
@Test
@@ -45,6 +45,7 @@ public class KernelConfigurationTests {
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());
@@ -52,6 +53,7 @@ public class KernelConfigurationTests {
assertNotNull(configuration.getConfigDirectories());
assertEquals(2, configuration.getConfigDirectories().length);
assertEquals("my.domain", configuration.getDomain());
+ assertEquals(60, configuration.getStartupWaitLimit());
}
@Test(expected=IllegalStateException.class)
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
index 0398a61d..46b121cd 100644
--- 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
@@ -21,11 +21,13 @@ 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.Signal;
+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;
@@ -50,6 +52,7 @@ public class BundleStartTrackerTests {
bundle.start();
assertEquals(1, signal.successCount);
+ assertEquals(0, signal.abortCount);
assertEquals(0, signal.failures.size());
assertEquals(Bundle.ACTIVE, bundle.getState());
@@ -79,6 +82,38 @@ public class BundleStartTrackerTests {
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());
}
@@ -96,6 +131,7 @@ public class BundleStartTrackerTests {
bundleStartTracker.trackStart(bundle, signal);
assertEquals(0, signal.successCount);
+ assertEquals(0, signal.abortCount);
assertEquals(0, signal.failures.size());
bundle.start();
@@ -108,6 +144,7 @@ public class BundleStartTrackerTests {
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));
@@ -132,6 +169,7 @@ public class BundleStartTrackerTests {
bundleStartTracker.trackStart(bundle, signal);
assertEquals(1, signal.successCount);
+ assertEquals(0, signal.abortCount);
assertEquals(0, signal.failures.size());
}
@@ -156,6 +194,7 @@ public class BundleStartTrackerTests {
bundleStartTracker.trackStart(bundle, signal);
assertEquals(0, signal.successCount);
+ assertEquals(0, signal.abortCount);
assertEquals(1, signal.failures.size());
assertTrue(signal.failures.contains(failure));
}
@@ -174,6 +213,7 @@ public class BundleStartTrackerTests {
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>();
@@ -184,6 +224,7 @@ public class BundleStartTrackerTests {
bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
assertEquals(1, signal.successCount);
+ assertEquals(0, signal.abortCount);
assertEquals(0, signal.failures.size());
}
@@ -201,6 +242,7 @@ public class BundleStartTrackerTests {
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>();
@@ -213,6 +255,7 @@ public class BundleStartTrackerTests {
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));
@@ -240,6 +283,7 @@ public class BundleStartTrackerTests {
bundleStartTracker.trackStart(bundle, signal);
assertEquals(0, signal.successCount);
+ assertEquals(0, signal.abortCount);
assertEquals(0, signal.failures.size());
}
@@ -266,14 +310,16 @@ public class BundleStartTrackerTests {
bundleStartTracker.trackStart(bundle, signal);
assertEquals(0, signal.successCount);
+ assertEquals(0, signal.abortCount);
assertEquals(0, signal.failures.size());
}
- private static final class UnitTestSignal implements Signal {
+ private static final class UnitTestSignal implements AbortableSignal {
private final List<Throwable> failures = new ArrayList<Throwable>();
-
+
private int successCount = 0;
+ private int abortCount = 0;
/**
* {@inheritDoc}
@@ -287,6 +333,13 @@ public class BundleStartTrackerTests {
*/
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
index 23e73c22..c3cbe70a 100644
--- 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
@@ -30,6 +30,7 @@ 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;
/**
@@ -41,14 +42,16 @@ 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.start(bundleContext);
+ activator.activate(componentContext);
}
@Test
public void startAndStop() throws Exception {
StubBundleContext bundleContext = new StubBundleContext();
+ StubComponentContext componentContext = new StubComponentContext(bundleContext);
DumpGenerator dumpGenerator = createNiceMock(DumpGenerator.class);
bundleContext.addFilter(StartupTracker.APPLICATION_CONTEXT_FILTER, FrameworkUtil.createFilter(StartupTracker.APPLICATION_CONTEXT_FILTER));
bundleContext.registerService(ConfigurationAdmin.class.getName(), new StubConfigurationAdmin(), null);
@@ -59,8 +62,8 @@ public class CoreBundleActivatorTests {
bundleContext.addProperty("org.eclipse.virgo.kernel.home", new File(".").getAbsolutePath());
CoreBundleActivator activator = new TestCoreBundleActivator();
- activator.start(bundleContext);
- activator.stop(bundleContext);
+ activator.activate(componentContext);
+ activator.deactivate(componentContext);
}
private static final class TestCoreBundleActivator extends CoreBundleActivator {
diff --git a/org.eclipse.virgo.kernel.core/template.mf b/org.eclipse.virgo.kernel.core/template.mf
index 30876aa9..8681c79d 100644
--- a/org.eclipse.virgo.kernel.core/template.mf
+++ b/org.eclipse.virgo.kernel.core/template.mf
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Virgo Kernel Core
-Bundle-Activator: org.eclipse.virgo.kernel.core.internal.CoreBundleActivator
Bundle-SymbolicName: org.eclipse.virgo.kernel.core
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
+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)}",
@@ -14,6 +14,7 @@ Import-Template:
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.w3c.dom;version="0",
org.xml.sax;version="0"
Excluded-Exports:
diff --git a/org.eclipse.virgo.kernel.deployer.dm/.classpath b/org.eclipse.virgo.kernel.deployer.dm/.classpath
index 724d32e1..ac62c64c 100644
--- a/org.eclipse.virgo.kernel.deployer.dm/.classpath
+++ b/org.eclipse.virgo.kernel.deployer.dm/.classpath
@@ -25,19 +25,19 @@
<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.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-sources-3.0.0.RELEASE.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.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-sources-1.2.1.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
<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/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar">
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.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.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.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.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar"/>
<classpathentry kind="src" path="/org.eclipse.virgo.kernel.core"/>
diff --git a/org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml b/org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml
index b6f267c8..b7e22799 100644
--- a/org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml
+++ b/org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml
@@ -12,5 +12,8 @@
<osgi:service ref="moduleContextAccessor"
interface="org.eclipse.virgo.kernel.module.ModuleContextAccessor" />
+
+ <osgi:reference id="agentDMStartTracker"
+ interface="org.eclipse.virgo.kernel.agent.dm.AgentDMStartTracker" />
</beans:beans>
diff --git a/org.eclipse.virgo.kernel.deployer.dm/template.mf b/org.eclipse.virgo.kernel.deployer.dm/template.mf
index 29657ae9..b7e5c736 100644
--- a/org.eclipse.virgo.kernel.deployer.dm/template.mf
+++ b/org.eclipse.virgo.kernel.deployer.dm/template.mf
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Virgo Kernel Deployer Spring DM Integration
Bundle-SymbolicName: org.eclipse.virgo.kernel.deployer.dm
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
Import-Template:
org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
diff --git a/org.eclipse.virgo.kernel.deployer.test/.classpath b/org.eclipse.virgo.kernel.deployer.test/.classpath
index fa8976bc..638548c6 100644
--- a/org.eclipse.virgo.kernel.deployer.test/.classpath
+++ b/org.eclipse.virgo.kernel.deployer.test/.classpath
@@ -28,18 +28,17 @@
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.orm/3.0.0.RELEASE/org.springframework.orm-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.orm/3.0.0.RELEASE/org.springframework.orm-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.transaction/3.0.0.RELEASE/org.springframework.transaction-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.transaction/3.0.0.RELEASE/org.springframework.transaction-sources-3.0.0.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.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/javax.transaction/com.springsource.javax.transaction/1.1.0/com.springsource.javax.transaction-1.1.0.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.0.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.launcher-2.2.0.D-20101207145732.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.launcher-sources-2.2.0.D-20101207145732.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/2.2.0.D-20101207150629/org.eclipse.virgo.test.framework-2.2.0.D-20101207150629.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/2.2.0.D-20101207150629/org.eclipse.virgo.test.framework-sources-2.2.0.D-20101207150629.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/3.0.0.M02/org.eclipse.virgo.osgi.launcher-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/3.0.0.M02/org.eclipse.virgo.osgi.launcher-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/3.0.0.M02/org.eclipse.virgo.test.framework-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/3.0.0.M02/org.eclipse.virgo.test.framework-sources-3.0.0.M02.jar"/>
<classpathentry kind="src" path="/org.eclipse.virgo.kernel.model"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-3.3.0.v20101018.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.virgo.kernel.deployer.test/.project b/org.eclipse.virgo.kernel.deployer.test/.project
index f79f9158..11a008c8 100644
--- a/org.eclipse.virgo.kernel.deployer.test/.project
+++ b/org.eclipse.virgo.kernel.deployer.test/.project
@@ -20,11 +20,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>com.springsource.server.ide.bundlor.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>com.springsource.server.ide.facet.core.bundlenature</nature>
diff --git a/org.eclipse.virgo.kernel.deployer.test/ivy.xml b/org.eclipse.virgo.kernel.deployer.test/ivy.xml
index 6d4080a7..e25cb4c6 100644
--- a/org.eclipse.virgo.kernel.deployer.test/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer.test/ivy.xml
@@ -36,6 +36,8 @@
<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.dbcp" rev="${commons.dbcp}" conf="test->runtime"/>
<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.pool" rev="${commons.pool}" conf="test->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.ds" rev="${org.eclipse.equinox.ds}" conf="test->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.util" rev="${org.eclipse.equinox.util}" conf="test->runtime"/>
<dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
<dependency org="org.springframework" name="org.springframework.spring-library" rev="${org.springframework}" conf="test->runtime"/>
<dependency org="org.springframework" name="org.springframework.core" rev="${org.springframework}" conf="test->runtime"/>
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
index c49e7c13..081628b5 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
+++ b/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ClassPath: .,org.springframework.beans-2.5.6.A.jar,org.springfr
amework.core-2.5.6.A.jar
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
Tool: Bundlor 1.0.0.RELEASE
Bundle-Name: Virgo Kernel Deployer Test
Bundle-ManifestVersion: 2
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java
index 7c326acd..497bdab5 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java
@@ -20,6 +20,10 @@ import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
+import org.eclipse.virgo.test.framework.dmkernel.DmKernelTestRunner;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -31,15 +35,8 @@ import org.osgi.framework.ServiceReference;
import org.osgi.framework.Version;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.framework.SurrogateBundle;
import org.osgi.service.packageadmin.PackageAdmin;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
-
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
-import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.test.framework.dmkernel.DmKernelTestRunner;
-
@RunWith(DmKernelTestRunner.class)
@SuppressWarnings("deprecation")
public abstract class AbstractDeployerIntegrationTest {
@@ -66,16 +63,17 @@ public abstract class AbstractDeployerIntegrationTest {
this.deployer = this.context.getService(applicationDeployerServiceReference);
}
- Bundle bundle = this.context.getBundle(1);
- if (bundle instanceof SurrogateBundle) {
- this.kernelContext = ((SurrogateBundle) bundle).getCompositeBundleContext();
- }
+ this.kernelContext = getKernelContext();
ServiceReference<PackageAdmin> packageAdminServiceReference = context.getServiceReference(PackageAdmin.class);
if (packageAdminServiceReference != null) {
this.packageAdmin = context.getService(packageAdminServiceReference);
}
}
+
+ private BundleContext getKernelContext() {
+ return this.context.getBundle(0L).getBundleContext();
+ }
@BeforeClass
public static void awaitKernelStartup() throws Exception {
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
index effd2b9b..3f49789e 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
@@ -160,27 +160,11 @@ public class ConfigurationDeploymentTests extends AbstractDeployerIntegrationTes
}
private void pollUntilInDeploymentIdentities(String type, String name, String version) throws InterruptedException {
- long start = System.currentTimeMillis();
-
- while (!isInDeploymentIdentities(type, name, version)) {
- long delta = System.currentTimeMillis() - start;
- if (delta > 60000) {
- fail("Deployment identity was not available within 60 seconds");
- }
- Thread.sleep(100);
- }
+ ConfigurationTestUtils.pollUntilInDeploymentIdentities(appDeployer, type, name, version);
}
private void pollUntilNotInDeploymentIdentities(String type, String name, String version) throws InterruptedException {
- long start = System.currentTimeMillis();
-
- while (isInDeploymentIdentities(type, name, version)) {
- long delta = System.currentTimeMillis() - start;
- if (delta > 60000) {
- fail("Deployment identity was still available after 60 seconds");
- }
- Thread.sleep(100);
- }
+ ConfigurationTestUtils.pollUntilNotInDeploymentIdentities(appDeployer, type, name, version);
}
@SuppressWarnings("unchecked")
@@ -206,40 +190,18 @@ public class ConfigurationDeploymentTests extends AbstractDeployerIntegrationTes
}
private boolean isInDeploymentIdentities(DeploymentIdentity deploymentIdentity) {
- boolean found = false;
- for (DeploymentIdentity id : this.appDeployer.getDeploymentIdentities()) {
- if (deploymentIdentity.equals(id)) {
- found = true;
- }
- }
- return found;
- }
-
- private boolean isInDeploymentIdentities(String type, String name, String version) {
- for (DeploymentIdentity id : this.appDeployer.getDeploymentIdentities()) {
- if (id.getType().equals(type) && id.getSymbolicName().equals(name) && id.getVersion().equals(version)) {
- return true;
- }
- }
- return false;
+ return ConfigurationTestUtils.isInDeploymentIdentities(appDeployer, deploymentIdentity);
}
private boolean isInConfigurationAdmin() throws IOException, InvalidSyntaxException {
- Configuration[] configurations = this.configAdmin.listConfigurations(null);
- for (Configuration configuration : configurations) {
- if ("t".equals(configuration.getPid())) {
- return true;
- }
- }
-
- return false;
+ return ConfigurationTestUtils.isInConfigurationAdmin(configAdmin, "t");
}
@SuppressWarnings("unchecked")
private void checkConfigAvailable() throws IOException, InvalidSyntaxException, InterruptedException {
- // Allow asynchronous delivery of configuration events to complete
- Thread.sleep(100);
-
+ // Allow asynchronous delivery of configuration events to complete
+ Thread.sleep(100);
+
long start = System.currentTimeMillis();
while (!isInConfigurationAdmin()) {
@@ -257,9 +219,9 @@ public class ConfigurationDeploymentTests extends AbstractDeployerIntegrationTes
}
private void checkConfigUnavailable() throws IOException, InvalidSyntaxException, InterruptedException {
- // Allow asynchronous delivery of configuration events to complete
- Thread.sleep(100);
-
+ // Allow asynchronous delivery of configuration events to complete
+ Thread.sleep(100);
+
assertFalse(isInConfigurationAdmin());
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java
new file mode 100644
index 00000000..935a70d1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java
@@ -0,0 +1,123 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 Chariot Solutions LLC
+ * 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:
+ * dsklyut - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.deployer.test;
+
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+/**
+ * Utilities to share between configuration and factory configuration tests.
+ * <p />
+ *
+ */
+final class ConfigurationTestUtils {
+
+ static void pollUntilInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version)
+ throws InterruptedException {
+ long start = System.currentTimeMillis();
+
+ while (!isInDeploymentIdentities(appDeployer, type, name, version)) {
+ long delta = System.currentTimeMillis() - start;
+ if (delta > 60000) {
+ fail("Deployment identity was not available within 60 seconds");
+ }
+ Thread.sleep(100);
+ }
+ }
+
+ static void pollUntilNotInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version)
+ throws InterruptedException {
+ long start = System.currentTimeMillis();
+
+ while (isInDeploymentIdentities(appDeployer, type, name, version)) {
+ long delta = System.currentTimeMillis() - start;
+ if (delta > 60000) {
+ fail("Deployment identity was still available after 60 seconds");
+ }
+ Thread.sleep(100);
+ }
+ }
+
+ static boolean isInDeploymentIdentities(ApplicationDeployer appDeployer, DeploymentIdentity deploymentIdentity) {
+ for (DeploymentIdentity id : appDeployer.getDeploymentIdentities()) {
+ if (deploymentIdentity.equals(id)) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ static boolean isInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version) {
+ for (DeploymentIdentity id : appDeployer.getDeploymentIdentities()) {
+ if (id.getType().equals(type) && id.getSymbolicName().equals(name) && id.getVersion().equals(version)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static boolean isInConfigurationAdmin(ConfigurationAdmin configAdmin, String pid) throws IOException, InvalidSyntaxException {
+ Configuration[] configurations = configAdmin.listConfigurations(null);
+ for (Configuration configuration : configurations) {
+ if (pid.equals(configuration.getPid())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static boolean isFactoryInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws IOException, InvalidSyntaxException {
+ Configuration[] configurations = configAdmin.listConfigurations(null);
+ for (Configuration configuration : configurations) {
+ if (factoryPid.equals(configuration.getFactoryPid())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static void pollUntilFactoryInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws Exception {
+ long start = System.currentTimeMillis();
+
+ while (!isFactoryInConfigurationAdmin(configAdmin, factoryPid)) {
+ long delta = System.currentTimeMillis() - start;
+ if (delta > 60000) {
+ fail("Deployment identity was not available within 60 seconds");
+ }
+ Thread.sleep(100);
+ }
+ }
+
+ static void pollUntilFactoryNotInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws Exception {
+ long start = System.currentTimeMillis();
+
+ while (isFactoryInConfigurationAdmin(configAdmin, factoryPid)) {
+ long delta = System.currentTimeMillis() - start;
+ if (delta > 60000) {
+ fail("Deployment identity was still available after 60 seconds");
+ }
+ Thread.sleep(100);
+ }
+ }
+}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java
new file mode 100644
index 00000000..59379102
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java
@@ -0,0 +1,372 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 Chariot Solutions, LLC
+ * 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:
+ * dsklyut - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.deployer.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+/**
+ * Tests for Configuration artifacts that support ManagedServiceFactory
+ *
+ */
+public class FactoryConfigurationDeploymentTests extends AbstractDeployerIntegrationTest {
+
+ private ServiceReference<ApplicationDeployer> appDeployerServiceReference;
+
+ private ApplicationDeployer appDeployer;
+
+ private ServiceReference<ConfigurationAdmin> configAdminServiceReference;
+
+ private ConfigurationAdmin configAdmin;
+
+ @Before
+ public void setUp() throws Exception {
+ this.appDeployerServiceReference = this.context.getServiceReference(ApplicationDeployer.class);
+ this.appDeployer = this.context.getService(this.appDeployerServiceReference);
+ this.configAdminServiceReference = this.context.getServiceReference(ConfigurationAdmin.class);
+ this.configAdmin = this.context.getService(this.configAdminServiceReference);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (this.appDeployerServiceReference != null) {
+ this.context.ungetService(this.appDeployerServiceReference);
+ }
+ if (this.configAdminServiceReference != null) {
+ this.context.ungetService(this.configAdminServiceReference);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static class TestManagedServiceFactory implements ManagedServiceFactory {
+
+ private volatile Dictionary properties;
+
+ private final AtomicInteger updateCallCount = new AtomicInteger(0);
+
+ private final AtomicInteger deleteCallCount = new AtomicInteger(0);
+
+ @Override
+ public String getName() {
+ return "Test Managed Service Factory";
+ }
+
+ @Override
+ public void updated(String pid, Dictionary properties) throws ConfigurationException {
+ this.updateCallCount.incrementAndGet();
+ this.properties = properties;
+ }
+
+ @Override
+ public void deleted(String pid) {
+ this.deleteCallCount.incrementAndGet();
+ }
+
+ Dictionary getProperties() {
+ return this.properties;
+ }
+
+ int updateCount() {
+ return this.updateCallCount.get();
+ }
+
+ int deleteCount() {
+ return this.deleteCallCount.get();
+ }
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void testSimpleDeployUndeployOfFactoryConfig() throws Exception {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(Constants.SERVICE_PID, "test.factory.pid.a");
+ TestManagedServiceFactory service = new TestManagedServiceFactory();
+ this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+ // make sure that we are starting off with a clean slate
+ assertEquals(0, countFactoryConfigurations("test.factory.pid.a"));
+
+ File configurationFile = new File("src/test/resources/configuration.deployment/factory-config-a.properties");
+
+ DeploymentIdentity deploymentIdentity = this.appDeployer.deploy(configurationFile.toURI());
+ assertNotNull(deploymentIdentity);
+
+ // let it deploy
+ Thread.sleep(1000);
+
+ assertEquals(1, countFactoryConfigurations("test.factory.pid.a"));
+ assertEquals(1, service.updateCount());
+ assertEquals(0, service.deleteCount());
+ Dictionary propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("2", propertiesFromService.get("prop2"));
+
+ this.appDeployer.undeploy(deploymentIdentity);
+
+ // give time for events to percolate
+ Thread.sleep(1000);
+
+ assertEquals(0, countFactoryConfigurations("test.factory.pid.a"));
+ assertEquals(1, service.updateCount());
+ assertEquals(1, service.deleteCount());
+
+ // now lets make sure that we can deploy it again
+ deploymentIdentity = this.appDeployer.deploy(configurationFile.toURI());
+ Thread.sleep(1000);
+ assertEquals(1, countFactoryConfigurations("test.factory.pid.a"));
+ assertEquals(2, service.updateCount());
+ assertEquals(1, service.deleteCount());
+
+ this.appDeployer.undeploy(deploymentIdentity);
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void testHotDeployFactoryConfiguration() throws Exception {
+
+ final String factoryPid = "test.factory.pid.hot";
+ final Properties hotDeployConfiguration = new Properties();
+ hotDeployConfiguration.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+ hotDeployConfiguration.setProperty("prop1", "prop1");
+ hotDeployConfiguration.setProperty("prop2", "2");
+
+ File target = new File("target/pickup/factory-config-a-hot.properties");
+
+ if (target.exists()) {
+ assertTrue(target.delete());
+ }
+
+ try {
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(Constants.SERVICE_PID, factoryPid);
+ TestManagedServiceFactory service = new TestManagedServiceFactory();
+ this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+ // make sure that we are starting off with a clean slate
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+
+ // copy file to hot deploy location
+ hotDeployConfiguration.store(new FileOutputStream(target), "no comment");
+
+ ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(this.configAdmin, factoryPid);
+ assertEquals(1, countFactoryConfigurations(factoryPid));
+ assertEquals(1, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ Dictionary propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("2", propertiesFromService.get("prop2"));
+
+ // remove the file and let it be removed
+ target.delete();
+ ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(this.configAdmin, factoryPid);
+
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+ assertEquals(1, service.updateCount());
+ assertEquals(1, service.deleteCount());
+ } finally {
+ if (target.exists()) {
+ target.delete();
+ }
+ }
+
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void testHotDeployWithUpdateFactoryConfiguration() throws Exception {
+
+ final String factoryPid = "test.factory.pid.hot.update";
+ final Properties hotDeployConfiguration = new Properties();
+ hotDeployConfiguration.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+ hotDeployConfiguration.setProperty("prop1", "prop1");
+ hotDeployConfiguration.setProperty("prop2", "2");
+
+ File target = new File("target/pickup/factory-config-a-hot-update.properties");
+
+ if (target.exists()) {
+ assertTrue(target.delete());
+ }
+
+ try {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(Constants.SERVICE_PID, factoryPid);
+ TestManagedServiceFactory service = new TestManagedServiceFactory();
+ this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+ // make sure that we are starting off with a clean slate
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+
+ // copy file to hot deploy location
+ hotDeployConfiguration.store(new FileOutputStream(target), "initial");
+
+ ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(this.configAdmin, factoryPid);
+ // let events propagate
+ Thread.sleep(100);
+ assertEquals(1, countFactoryConfigurations(factoryPid));
+ assertEquals(1, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ Dictionary propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("2", propertiesFromService.get("prop2"));
+
+ // update configuration
+ hotDeployConfiguration.setProperty("prop2", "22");
+ // save updated configuration
+ hotDeployConfiguration.store(new FileOutputStream(target), "updated");
+
+ // let events propagate and update happen
+ Thread.sleep(3000);
+ assertEquals(1, countFactoryConfigurations(factoryPid));
+ assertEquals(2, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("22", propertiesFromService.get("prop2"));
+
+ // remove the file and let it be removed
+ target.delete();
+ ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(this.configAdmin, factoryPid);
+
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+ assertEquals(2, service.updateCount());
+ assertEquals(1, service.deleteCount());
+ } finally {
+ if (target.exists()) {
+ target.delete();
+ }
+ }
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void testHotDeployMultipleFactoryConfiguration() throws Exception {
+
+ final String factoryPid = "test.factory.pid.hot.multiple";
+
+ final Properties configOne = new Properties();
+ configOne.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+ configOne.setProperty("prop1", "prop1");
+ configOne.setProperty("prop2", "1");
+
+ final Properties configTwo = new Properties();
+ configTwo.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+ configTwo.setProperty("prop1", "prop2");
+ configTwo.setProperty("prop2", "2");
+
+ final File targetOne = new File("target/pickup/factory-config-a-hot-update-1.properties");
+ final File targetTwo = new File("target/pickup/factory-config-a-hot-update-2.properties");
+
+ if (targetOne.exists()) {
+ assertTrue(targetOne.delete());
+ }
+ if (targetTwo.exists()) {
+ assertTrue(targetTwo.delete());
+ }
+
+ try {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(Constants.SERVICE_PID, factoryPid);
+ TestManagedServiceFactory service = new TestManagedServiceFactory();
+ this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+ // make sure that we are starting off with a clean slate
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+
+ // copy file to hot deploy location
+ configOne.store(new FileOutputStream(targetOne), "initial");
+
+ ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(this.configAdmin, factoryPid);
+ // let events propagate
+ Thread.sleep(100);
+ assertEquals(1, countFactoryConfigurations(factoryPid));
+ assertEquals(1, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ // validate first configuration
+ Dictionary propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop1", propertiesFromService.get("prop1"));
+ assertEquals("1", propertiesFromService.get("prop2"));
+
+ configTwo.store(new FileOutputStream(targetTwo), "initial");
+ Thread.sleep(3000);
+ assertEquals(2, countFactoryConfigurations(factoryPid));
+ assertEquals(2, service.updateCount());
+ assertEquals(0, service.deleteCount());
+
+ propertiesFromService = service.getProperties();
+ assertNotNull(propertiesFromService);
+ assertEquals("prop2", propertiesFromService.get("prop1"));
+ assertEquals("2", propertiesFromService.get("prop2"));
+
+ assertTrue(targetOne.delete());
+ assertTrue(targetTwo.delete());
+
+ // let events propagate and update happen
+ ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(this.configAdmin, factoryPid);
+ assertEquals(0, countFactoryConfigurations(factoryPid));
+ assertEquals(2, service.updateCount());
+ assertEquals(2, service.deleteCount());
+
+ } finally {
+ if (targetOne.exists()) {
+ targetOne.delete();
+ }
+ if (targetTwo.exists()) {
+ targetTwo.delete();
+ }
+ }
+ }
+
+ private int countFactoryConfigurations(String factoryPid) throws Exception {
+ Configuration[] configurations = this.configAdmin.listConfigurations(null);
+ int counter = 0;
+ for (Configuration c : configurations) {
+ if (factoryPid.equals(c.getFactoryPid())) {
+ counter++;
+ }
+ }
+ return counter;
+ }
+}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java
index 8bb533c1..6e64d014 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
@@ -276,7 +277,8 @@ public class NestedPlanIntegrationTests extends AbstractDeployerIntegrationTest
private void checkPlanScoping(TestPlanArtifactInfo parent, Model model) {
if (parent.isScoped()) {
Artifact parentPlan = getPlan(parent);
- for (Artifact child : parentPlan.getDependents()) {
+ Set<Artifact> children = parentPlan.getDependents();
+ for (Artifact child : children) {
if (PLAN_TYPE.equals(child.getType())) {
String childPlanName = child.getName();
String unscopedChildPlanName = parent.getChildPlan().getName();
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
index 82229325..078324d5 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
@@ -34,6 +34,7 @@ public class ParDeploymentTests extends AbstractDeployerIntegrationTest {
private static final File PAR_FILE = new File("src/test/resources/BundlesAndConfig.par");
private static final File PAR_FOR_BUG331767 = new File("src/test/resources/bug331767.par");
+ private static final File PAR_FOR_BUG330506 = new File("src/test/resources/bug330506.par");
private static final String BUNDLE_SYMBOLIC_NAME = "appA-1-bundleA";
private static final String BUNDLE_SYMBOLIC_NAME_BUG331767 = "PARbug331767-1-BUNDLEbug331767";
@@ -65,6 +66,11 @@ public class ParDeploymentTests extends AbstractDeployerIntegrationTest {
this.deployer.undeploy(deploymentIdentity);
assertBundleNotPresent(BUNDLE_SYMBOLIC_NAME_BUG331767, BUNDLE_VERSION);
}
+
+ @Test(expected=DeploymentException.class)
+ public void deployParContainingFragmentOfSystemBundle() throws DeploymentException {
+ this.deployer.deploy(PAR_FOR_BUG330506.toURI());
+ }
private void assertBundlePresent(String symbolicName, Version version) {
Bundle[] bundles = this.context.getBundles();
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java
index 3b392247..72f1fe56 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java
@@ -15,24 +15,21 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.File;
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.test.util.ArtifactLifecycleEvent;
+import org.eclipse.virgo.kernel.deployer.test.util.ArtifactListener;
+import org.eclipse.virgo.kernel.deployer.test.util.TestLifecycleEvent;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
+import org.eclipse.virgo.util.math.Sets;
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListenerSupport;
-
-import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.util.math.Sets;
-
/**
* Test refresh of artifacts in a Par
*
@@ -180,184 +177,4 @@ public class ParRefreshTests extends AbstractDeployerIntegrationTest {
}
}
- private static enum TestLifecycleEvent {
- INSTALLED, INSTALLING, RESOLVED, RESOLVING, STARTED, STARTING, STOPPED, STOPPING, UNINSTALLED, UNINSTALLING, UNRESOLVED
- }
-
- private static class ArtifactLifecycleEvent {
- public ArtifactLifecycleEvent(TestLifecycleEvent lifecycleEvent, String type, String name, Version version) {
- this.lifeCycleEvent = lifecycleEvent;
- this.type = type;
- this.name = name;
- this.version = version;
- }
- public boolean equals(Object obj) {
- if (obj instanceof ArtifactLifecycleEvent) {
- ArtifactLifecycleEvent other = (ArtifactLifecycleEvent) obj;
- return (this.lifeCycleEvent.equals(other.lifeCycleEvent)
- && this.type.equals(other.type)
- && this.name.equals(other.name)
- && this.version.equals(other.version));
- }
- return false;
- }
- public int hashCode() {
- final int prime = 17;
- int result = this.lifeCycleEvent.hashCode() + prime
- * (this.name.hashCode() + prime * (this.type.hashCode() + prime * (this.version.hashCode())));
- return result;
- }
- public String toString() {
- StringBuilder sb = new StringBuilder("[");
- sb.append(this.lifeCycleEvent).append(", ");
- sb.append(this.type).append(", ");
- sb.append(this.name).append(", ");
- sb.append(this.version).append("]");
- return sb.toString();
- }
-
- private final TestLifecycleEvent lifeCycleEvent;
- private final String type;
- private final String name;
- private final Version version;
- }
-
- private static class ArtifactListener extends InstallArtifactLifecycleListenerSupport {
-
- private final Object monitor = new Object();
-
- List<ArtifactLifecycleEvent> eventList = new ArrayList<ArtifactLifecycleEvent>();
-
- public void clear() {
- synchronized (this.monitor) {
- this.eventList.clear();
- }
- }
-
- public boolean waitForEvents(final Set<ArtifactLifecycleEvent> expectedEventSet, long timeout) {
- boolean allReceived = eventsReceived(expectedEventSet);
- while (!allReceived && timeout>0) {
- timeout -= 50L;
- try {
- Thread.sleep(50L);
- } catch (InterruptedException _) {
- // do nothing
- }
- allReceived = eventsReceived(expectedEventSet);
- }
- return allReceived;
- }
-
- private boolean eventsReceived(Set<ArtifactLifecycleEvent> eventSet) {
- synchronized (this.monitor) {
- for (ArtifactLifecycleEvent event : eventSet) {
- if (!this.eventList.contains(event)) {
- return false;
- }
- }
- return true;
- }
- }
-
- public List<ArtifactLifecycleEvent> extract() {
- synchronized (this.monitor) {
- return new ArrayList<ArtifactLifecycleEvent>(this.eventList);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onInstalled(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.INSTALLED, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onInstalling(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.INSTALLING, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onResolved(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.RESOLVED, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onResolving(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.RESOLVING, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onStarted(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.STARTED, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onStarting(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.STARTING, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onStopped(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.STOPPED, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onStopping(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.STOPPING, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onUninstalled(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.UNINSTALLED, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onUninstalling(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.UNINSTALLING, installArtifact);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onUnresolved(InstallArtifact installArtifact) {
- addEvent(TestLifecycleEvent.UNRESOLVED, installArtifact);
- }
-
- private void addEvent(TestLifecycleEvent event, InstallArtifact installArtifact) {
- synchronized (this.monitor) {
- this.eventList.add(new ArtifactLifecycleEvent(event, installArtifact.getType(), installArtifact.getName(),
- installArtifact.getVersion()));
- }
- }
- }
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java
index 8a0a6ac5..03de2e6f 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java
@@ -29,7 +29,7 @@ import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListene
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.util.io.FileCopyUtils;
import org.eclipse.virgo.util.io.FileSystemUtils;
import org.eclipse.virgo.util.io.PathReference;
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java
index 031e2036..29fb7476 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java
@@ -20,34 +20,50 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Dictionary;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
-import java.util.Map.Entry;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.test.util.ArtifactLifecycleEvent;
+import org.eclipse.virgo.kernel.deployer.test.util.ArtifactListener;
+import org.eclipse.virgo.kernel.deployer.test.util.TestLifecycleEvent;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
+import org.eclipse.virgo.util.math.Sets;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
-
public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
- private ServiceReference<ConfigurationAdmin> configAdminServiceReference;
+ private ServiceReference<ConfigurationAdmin> configAdminServiceReference;
+
+ private ConfigurationAdmin configAdmin;
+
+ private static final String PLAN_SYMBOLIC_NAME_BUG336200 = "bug336200.plan";
+
+ private static final String BUG336200_LAZY_BSN = "lazyBundle";
+
+ private static final Version VERSION_BUG336200 = new Version(1, 0, 0);
+
+ private final ArtifactListener artifactListener = new ArtifactListener();
+
+ @Test
+ public void planReferencingAPar() throws Exception {
+ testPlanDeployment(new File("src/test/resources/test-with-par.plan"), null, "par-deployed-by-plan-1-one");
+ }
- private ConfigurationAdmin configAdmin;
-
- @Test
- public void planReferencingAPar() throws Exception {
- testPlanDeployment(new File("src/test/resources/test-with-par.plan"), null, "par-deployed-by-plan-1-one");
- }
-
- @Test(expected=DeploymentException.class)
+ @Test(expected = DeploymentException.class)
public void scopedPlanReferencingAPar() throws Exception {
testPlanDeployment(new File("src/test/resources/scoped-test-with-par.plan"), null);
}
@@ -57,9 +73,10 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
String oneBsn = "simple.bundle.one";
String twoBsn = "simple.bundle.two";
- testPlanDeployment(new File("src/test/resources/test.plan"), new File("src/test/resources/plan-deployment/com.foo.bar.properties"), oneBsn, twoBsn);
+ testPlanDeployment(new File("src/test/resources/test.plan"), new File("src/test/resources/plan-deployment/com.foo.bar.properties"), oneBsn,
+ twoBsn);
}
-
+
@Test
public void testSimpleBundleWithFragment() throws Exception {
String oneBsn = "simple.bundle.one";
@@ -67,13 +84,14 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
testPlanDeployment(new File("src/test/resources/fragment.plan"), null, oneBsn, twoBsn);
}
-
+
@Test
public void testUnscopedNonAtomicPlan() throws Exception {
String oneBsn = "simple.bundle.one";
String twoBsn = "simple.bundle.two";
- testPlanDeployment(new File("src/test/resources/testunscopednonatomic.plan"), new File("src/test/resources/plan-deployment/com.foo.bar.properties"), oneBsn, twoBsn);
+ testPlanDeployment(new File("src/test/resources/testunscopednonatomic.plan"), new File(
+ "src/test/resources/plan-deployment/com.foo.bar.properties"), oneBsn, twoBsn);
}
@Test
@@ -82,18 +100,24 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
Bundle[] bundles = this.context.getBundles();
boolean found = false;
for (Bundle bundle : bundles) {
- if("bundle.properties".equals(bundle.getSymbolicName())) {
+ if ("bundle.properties".equals(bundle.getSymbolicName())) {
found = true;
assertEquals("foo", bundle.getHeaders().get("Test-Header"));
}
}
assertTrue(found);
}
-
+
+ @Test
+ public void testUnscopedAtomicPlanStartingEventsDuringDeployment() throws Exception {
+ testPlanDeploymentStartingEvents(new File("src/test/resources/bug336200.plan"), BUG336200_LAZY_BSN);
+ }
+
@Before
- public void setUp() throws Exception {
+ public void setUp() throws Exception {
this.configAdminServiceReference = this.context.getServiceReference(ConfigurationAdmin.class);
this.configAdmin = this.context.getService(this.configAdminServiceReference);
+ this.context.registerService(InstallArtifactLifecycleListener.class.getName(), artifactListener, null);
}
private void testPlanDeployment(File plan, File propertiesFile, String... candidateBsns) throws Exception {
@@ -103,23 +127,107 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
DeploymentIdentity deploymentIdentity = this.deployer.deploy(plan.toURI());
Bundle[] afterDeployBundles = this.context.getBundles();
assertBundlesInstalled(afterDeployBundles, candidateBsns);
-
+
String pid = null;
-
+
if (propertiesFile != null) {
- pid = propertiesFile.getName().substring(0, propertiesFile.getName().length() - ".properties".length());
- checkConfigAvailable(pid, propertiesFile);
+ pid = propertiesFile.getName().substring(0, propertiesFile.getName().length() - ".properties".length());
+ checkConfigAvailable(pid, propertiesFile);
}
this.deployer.undeploy(deploymentIdentity);
Bundle[] afterUndeployBundles = this.context.getBundles();
assertBundlesNotInstalled(afterUndeployBundles, candidateBsns);
-
+
if (propertiesFile != null) {
- checkConfigUnavailable(pid);
+ checkConfigUnavailable(pid);
}
}
+ private void testPlanDeploymentStartingEvents(File plan, String... candidateBsns) throws Exception {
+
+ this.artifactListener.clear();
+
+ Set<ArtifactLifecycleEvent> expectedEventSet = new HashSet<ArtifactLifecycleEvent>();
+ // events expected due to explicit refresh;
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.RESOLVING, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.RESOLVED, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.INSTALLING, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.INSTALLED, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.STARTING, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.STARTED, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.RESOLVING, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.RESOLVED, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.INSTALLING, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.INSTALLED, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.STARTING, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+ expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.STARTED, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+
+ Bundle[] beforeDeployBundles = this.context.getBundles();
+ assertBundlesNotInstalled(beforeDeployBundles, candidateBsns);
+ Thread startBundleThread = new Thread(new StartBundleRunnable(this.context));
+ startBundleThread.start();
+
+ DeploymentIdentity deploymentIdentity = this.deployer.deploy(plan.toURI());
+ waitForAndCheckEventsReceived(expectedEventSet, 10000L);
+
+ Bundle[] afterDeployBundles = this.context.getBundles();
+ assertBundlesInstalled(afterDeployBundles, candidateBsns);
+
+ this.deployer.undeploy(deploymentIdentity);
+ Bundle[] afterUndeployBundles = this.context.getBundles();
+ assertBundlesNotInstalled(afterUndeployBundles, candidateBsns);
+ }
+
+ private class StartBundleRunnable implements Runnable {
+
+ BundleContext context = null;
+
+ public StartBundleRunnable(BundleContext bundleContext) {
+ this.context = bundleContext;
+ }
+
+ @Override
+ public void run() {
+ try {
+ waitAndStartLazyBundle();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (BundleException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ private void waitAndStartLazyBundle() throws InterruptedException, BundleException {
+ Thread.sleep(2500);
+
+ for (Bundle bundle : this.context.getBundles()) {
+ if (bundle.getSymbolicName().equals(BUG336200_LAZY_BSN)) {
+ bundle.start();
+ }
+ }
+ }
+
+ }
+
+ private void waitForAndCheckEventsReceived(Set<ArtifactLifecycleEvent> expectedEventSet, long timeout) {
+ this.artifactListener.waitForEvents(expectedEventSet, timeout);
+
+ Set<ArtifactLifecycleEvent> actualEventSet = new HashSet<ArtifactLifecycleEvent>(this.artifactListener.extract());
+
+ Set<ArtifactLifecycleEvent> extraEvents = Sets.difference(actualEventSet, expectedEventSet);
+ Set<ArtifactLifecycleEvent> missingEvents = Sets.difference(expectedEventSet, actualEventSet);
+
+ assertTrue("More events were received than expected: " + extraEvents, extraEvents.isEmpty());
+ assertTrue("There were missing events: " + missingEvents, missingEvents.isEmpty());
+
+ List<ArtifactLifecycleEvent> actualEventSetList = this.artifactListener.extract();
+ ArtifactLifecycleEvent planStartingEvent = new ArtifactLifecycleEvent(TestLifecycleEvent.STARTING, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200);
+ assertTrue("More than one STARTING event received for the atomic plan.", actualEventSetList.indexOf(planStartingEvent) == actualEventSetList.lastIndexOf(planStartingEvent));
+ }
+
private void assertBundlesNotInstalled(Bundle[] bundles, String... candidateBsns) {
List<String> installedBsns = getInstalledBsns(bundles);
for (String candidateBsn : candidateBsns) {
@@ -130,21 +238,21 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
}
}
}
-
+
@SuppressWarnings("unchecked")
private void checkConfigAvailable(String pid, File propertiesFile) throws IOException {
Configuration configuration = this.configAdmin.getConfiguration(pid, null);
Dictionary<Object, Object> dictionary = configuration.getProperties();
-
+
Properties properties = new Properties();
properties.load(new FileReader(propertiesFile));
-
+
Set<Entry<Object, Object>> entrySet = properties.entrySet();
-
+
for (Entry<Object, Object> entry : entrySet) {
- Assert.assertEquals(entry.getValue(), dictionary.get(entry.getKey()));
- }
-
+ Assert.assertEquals(entry.getValue(), dictionary.get(entry.getKey()));
+ }
+
Assert.assertEquals(pid, dictionary.get("service.pid"));
}
@@ -174,6 +282,5 @@ public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
return installedBsns;
}
-
-
+
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java
index 4c3399c8..bec672a5 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java
@@ -23,7 +23,7 @@ import org.osgi.framework.ServiceReference;
import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.util.io.PathReference;
/**
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java
index 9d33b135..4baefa8d 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java
@@ -92,6 +92,12 @@ final class StubInstallArtifactLifecycleListener implements InstallArtifactLifec
/**
* {@inheritDoc}
*/
+ public void onStartAborted(InstallArtifact installArtifact) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void onStarted(InstallArtifact installArtifact) {
this.startedCount.incrementAndGet();
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactLifecycleEvent.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactLifecycleEvent.java
new file mode 100644
index 00000000..18f20303
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactLifecycleEvent.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 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.deployer.test.util;
+
+import org.osgi.framework.Version;
+
+public class ArtifactLifecycleEvent {
+
+ public ArtifactLifecycleEvent(TestLifecycleEvent lifecycleEvent, String type, String name, Version version) {
+ this.lifeCycleEvent = lifecycleEvent;
+ this.type = type;
+ this.name = name;
+ this.version = version;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof ArtifactLifecycleEvent) {
+ ArtifactLifecycleEvent other = (ArtifactLifecycleEvent) obj;
+ return this.lifeCycleEvent.equals(other.lifeCycleEvent) && this.type.equals(other.type) && this.name.equals(other.name)
+ && this.version.equals(other.version);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 17;
+ int result = this.lifeCycleEvent.hashCode() + prime
+ * (this.name.hashCode() + prime * (this.type.hashCode() + prime * this.version.hashCode()));
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("[");
+ sb.append(this.lifeCycleEvent).append(", ");
+ sb.append(this.type).append(", ");
+ sb.append(this.name).append(", ");
+ sb.append(this.version).append("]");
+ return sb.toString();
+ }
+
+ private final TestLifecycleEvent lifeCycleEvent;
+
+ private final String type;
+
+ private final String name;
+
+ private final Version version;
+} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactListener.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactListener.java
new file mode 100644
index 00000000..ad3b4dc3
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactListener.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 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.deployer.test.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListenerSupport;
+
+public class ArtifactListener extends InstallArtifactLifecycleListenerSupport {
+
+ private final Object monitor = new Object();
+
+ List<ArtifactLifecycleEvent> eventList = new ArrayList<ArtifactLifecycleEvent>();
+
+ public void clear() {
+ synchronized (this.monitor) {
+ this.eventList.clear();
+ }
+ }
+
+ public boolean waitForEvents(final Set<ArtifactLifecycleEvent> expectedEventSet, long timeout) {
+ boolean allReceived = eventsReceived(expectedEventSet);
+ while (!allReceived && timeout > 0) {
+ timeout -= 50L;
+ try {
+ Thread.sleep(50L);
+ } catch (InterruptedException _) {
+ // do nothing
+ }
+ allReceived = eventsReceived(expectedEventSet);
+ }
+ return allReceived;
+ }
+
+ private boolean eventsReceived(Set<ArtifactLifecycleEvent> eventSet) {
+ synchronized (this.monitor) {
+ for (ArtifactLifecycleEvent event : eventSet) {
+ if (!this.eventList.contains(event)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ public List<ArtifactLifecycleEvent> extract() {
+ synchronized (this.monitor) {
+ return new ArrayList<ArtifactLifecycleEvent>(this.eventList);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onInstalled(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.INSTALLED, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onInstalling(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.INSTALLING, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onResolved(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.RESOLVED, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onResolving(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.RESOLVING, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onStarted(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.STARTED, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onStarting(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.STARTING, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onStopped(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.STOPPED, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onStopping(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.STOPPING, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onUninstalled(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.UNINSTALLED, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onUninstalling(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.UNINSTALLING, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onUnresolved(InstallArtifact installArtifact) {
+ addEvent(TestLifecycleEvent.UNRESOLVED, installArtifact);
+ }
+
+ private void addEvent(TestLifecycleEvent event, InstallArtifact installArtifact) {
+ synchronized (this.monitor) {
+ this.eventList.add(new ArtifactLifecycleEvent(event, installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion()));
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/TestLifecycleEvent.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/TestLifecycleEvent.java
new file mode 100644
index 00000000..fa86ee80
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/TestLifecycleEvent.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 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.deployer.test.util;
+
+public enum TestLifecycleEvent {
+ INSTALLED, INSTALLING, RESOLVED, RESOLVING, STARTED, STARTING, STOPPED, STOPPING, UNINSTALLED, UNINSTALLING, UNRESOLVED
+}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF
index 1274b8a2..326a811f 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@ Import-Package: org.eclipse.virgo.kernel.core,
org.eclipse.virgo.kernel.module,
org.eclipse.virgo.kernel.osgi.common,
org.eclipse.virgo.kernel.osgi.framework,
+ org.eclipse.virgo.kernel.osgi.region,
org.eclipse.virgo.kernel.services.work,
org.eclipse.virgo.util.io,
org.eclipse.virgo.util.math,
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 6e30a455..6d10a2b2 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
@@ -1,13 +1,15 @@
launcher.bundles =\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.api/${org.slf4j}/com.springsource.slf4j.api-${org.slf4j}.jar@start,\
file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.org.apache.commons.logging/${org.slf4j}/com.springsource.slf4j.org.apache.commons.logging-${org.slf4j}.jar@start,\
file:../ivy-cache/repository/org.aspectj/com.springsource.org.aspectj.weaver/${org.aspectj}/com.springsource.org.aspectj.weaver-${org.aspectj}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic-${org.eclipse.virgo.medic}.jar@start,\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/${org.eclipse.osgi.services}/org.eclipse.osgi.services-${org.eclipse.osgi.services}.jar,\
- file:../ivy-cache/repository/org.eclipse.equinox/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic.core-${org.eclipse.virgo.medic}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/${org.eclipse.virgo.util}/org.eclipse.virgo.util.osgi-${org.eclipse.virgo.util}.jar@start,\
- file:../ivy-cache/repository/org.apache.felix/org.apache.felix.eventadmin/${org.apache.felix.eventadmin}/org.apache.felix.eventadmin-${org.apache.felix.eventadmin}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.event/${org.eclipse.equinox.event}/org.eclipse.equinox.event-${org.eclipse.equinox.event}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.common/${org.eclipse.virgo.util}/org.eclipse.virgo.util.common-${org.eclipse.virgo.util}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.io/${org.eclipse.virgo.util}/org.eclipse.virgo.util.io-${org.eclipse.virgo.util}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.jmx/${org.eclipse.virgo.util}/org.eclipse.virgo.util.jmx-${org.eclipse.virgo.util}.jar,\
@@ -30,10 +32,12 @@ launcher.bundles =\
file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
file:../org.eclipse.virgo.kernel.artifact/target/classes@start,\
file:../org.eclipse.virgo.kernel.services/target/classes@start,\
- file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
file:../org.eclipse.virgo.kernel.deployer/target/classes@start,\
file:../org.eclipse.virgo.kernel.model/target/classes@start,\
- file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes
+ file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes,\
+ file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
+ file:../org.eclipse.virgo.kernel.userregionfactory/target/classes@start
+
org.eclipse.virgo.test.properties.include=file:../build.versions,file:../build.properties
@@ -43,6 +47,7 @@ osgi.context.bootdelegation=false
osgi.compatibility.bootdelegation=false
osgi.clean=true
osgi.configuration.area=target
+org.osgi.framework.bsnversion=multiple
#osgi.console=2401
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 94132913..63e1ff2f 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
@@ -1,13 +1,15 @@
launcher.bundles =\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.api/${org.slf4j}/com.springsource.slf4j.api-${org.slf4j}.jar@start,\
file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.org.apache.commons.logging/${org.slf4j}/com.springsource.slf4j.org.apache.commons.logging-${org.slf4j}.jar@start,\
file:../ivy-cache/repository/org.aspectj/com.springsource.org.aspectj.weaver/${org.aspectj}/com.springsource.org.aspectj.weaver-${org.aspectj}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic-${org.eclipse.virgo.medic}.jar@start,\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/${org.eclipse.osgi.services}/org.eclipse.osgi.services-${org.eclipse.osgi.services}.jar,\
- file:../ivy-cache/repository/org.eclipse.equinox/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic.core-${org.eclipse.virgo.medic}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/${org.eclipse.virgo.util}/org.eclipse.virgo.util.osgi-${org.eclipse.virgo.util}.jar@start,\
- file:../ivy-cache/repository/org.apache.felix/org.apache.felix.eventadmin/${org.apache.felix.eventadmin}/org.apache.felix.eventadmin-${org.apache.felix.eventadmin}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.event/${org.eclipse.equinox.event}/org.eclipse.equinox.event-${org.eclipse.equinox.event}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.common/${org.eclipse.virgo.util}/org.eclipse.virgo.util.common-${org.eclipse.virgo.util}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.io/${org.eclipse.virgo.util}/org.eclipse.virgo.util.io-${org.eclipse.virgo.util}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.jmx/${org.eclipse.virgo.util}/org.eclipse.virgo.util.jmx-${org.eclipse.virgo.util}.jar@start,\
@@ -30,10 +32,12 @@ launcher.bundles =\
file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
file:../org.eclipse.virgo.kernel.artifact/target/classes@start,\
file:../org.eclipse.virgo.kernel.services/target/classes@start,\
- file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
file:../org.eclipse.virgo.kernel.deployer/target/classes@start,\
file:../org.eclipse.virgo.kernel.model/target/classes@start,\
- file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes
+ file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes,\
+ file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
+ file:../org.eclipse.virgo.kernel.userregionfactory/target/classes@start
+
org.eclipse.virgo.test.properties.include=file:../build.versions,file:../build.properties
@@ -43,6 +47,7 @@ osgi.context.bootdelegation=false
osgi.compatibility.bootdelegation=false
osgi.clean=true
osgi.configuration.area=target
+org.osgi.framework.bsnversion=multiple
#osgi.console=2401
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 4d7a5d19..b2182b1d 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
@@ -1,13 +1,15 @@
launcher.bundles =\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.api/${org.slf4j}/com.springsource.slf4j.api-${org.slf4j}.jar@start,\
file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.org.apache.commons.logging/${org.slf4j}/com.springsource.slf4j.org.apache.commons.logging-${org.slf4j}.jar@start,\
file:../ivy-cache/repository/org.aspectj/com.springsource.org.aspectj.weaver/${org.aspectj}/com.springsource.org.aspectj.weaver-${org.aspectj}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic-${org.eclipse.virgo.medic}.jar@start,\
file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/${org.eclipse.osgi.services}/org.eclipse.osgi.services-${org.eclipse.osgi.services}.jar,\
- file:../ivy-cache/repository/org.eclipse.equinox/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic.core-${org.eclipse.virgo.medic}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/${org.eclipse.virgo.util}/org.eclipse.virgo.util.osgi-${org.eclipse.virgo.util}.jar@start,\
- file:../ivy-cache/repository/org.apache.felix/org.apache.felix.eventadmin/${org.apache.felix.eventadmin}/org.apache.felix.eventadmin-${org.apache.felix.eventadmin}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.event/${org.eclipse.equinox.event}/org.eclipse.equinox.event-${org.eclipse.equinox.event}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.common/${org.eclipse.virgo.util}/org.eclipse.virgo.util.common-${org.eclipse.virgo.util}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.io/${org.eclipse.virgo.util}/org.eclipse.virgo.util.io-${org.eclipse.virgo.util}.jar@start,\
file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.jmx/${org.eclipse.virgo.util}/org.eclipse.virgo.util.jmx-${org.eclipse.virgo.util}.jar,\
@@ -30,10 +32,12 @@ launcher.bundles =\
file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
file:../org.eclipse.virgo.kernel.artifact/target/classes@start,\
file:../org.eclipse.virgo.kernel.services/target/classes@start,\
- file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
file:../org.eclipse.virgo.kernel.deployer/target/classes@start,\
file:../org.eclipse.virgo.kernel.model/target/classes@start,\
- file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes
+ file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes,\
+ file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
+ file:../org.eclipse.virgo.kernel.userregionfactory/target/classes@start
+
org.eclipse.virgo.test.properties.include=file:../build.versions,file:../build.properties
@@ -43,6 +47,7 @@ osgi.context.bootdelegation=false
osgi.compatibility.bootdelegation=false
osgi.clean=true
osgi.configuration.area=target
+org.osgi.framework.bsnversion=multiple
#osgi.console=2401
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug330506.par b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug330506.par
new file mode 100644
index 00000000..84cceab2
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug330506.par
Binary files differ
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug336200.plan b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug336200.plan
new file mode 100644
index 00000000..f64ea0a1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug336200.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="bug336200.plan" version="1.0.0" scoped="false" atomic="true"
+ xmlns="http://www.eclipse.org/virgo/schema/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.eclipse.org/virgo/schema/plan
+ http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">
+
+ <artifact type="bundle" name="lazyBundle" version="0.0.0"/>
+
+</plan> \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index 1c501c97..127b5625 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -9,6 +9,9 @@ baseBundles =\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar@start,\
file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar,\
file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:../org.eclipse.virgo.kernel.deployer.dm/target/classes@start,\
file:../org.eclipse.virgo.kernel.dmfragment/target/classes,\
@@ -20,6 +23,8 @@ baseBundles =\
file:../ivy-cache/repository/javax.persistence/com.springsource.javax.persistence/1.0.0/com.springsource.javax.persistence-1.0.0.jar,\
file:../ivy-cache/repository/com.oracle.toplink.essentials/com.springsource.oracle.toplink.essentials/2.0.0.b41-beta2/com.springsource.oracle.toplink.essentials-2.0.0.b41-beta2.jar
+bundleImports = org.eclipse.osgi;bundle-version="0"
+
packageImports =\
org.eclipse.virgo.kernel.artifact.*;version="0",\
org.eclipse.virgo.kernel.core;version="0",\
@@ -47,6 +52,8 @@ packageImports =\
org.slf4j;version="[1.6.1,2)"
serviceImports =\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
+ org.eclipse.virgo.kernel.osgi.region.RegionDigraph,\
org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer,\
org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser,\
org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository,\
@@ -57,36 +64,30 @@ serviceImports =\
org.eclipse.virgo.medic.eventlog.EventLoggerFactory,\
org.eclipse.virgo.repository.Repository,\
org.eclipse.virgo.kernel.core.Shutdown,\
+ org.osgi.framework.hooks.resolver.ResolverHookFactory,\
org.osgi.service.cm.ConfigurationAdmin,\
org.osgi.service.event.EventAdmin,\
+ org.eclipse.virgo.medic.eventlog.EventLogger,\
org.eclipse.virgo.medic.dump.DumpGenerator,\
org.eclipse.virgo.kernel.shim.scope.ScopeFactory,\
org.eclipse.virgo.kernel.shim.serviceability.TracingService,\
- org.eclipse.virgo.kernel.model.RuntimeArtifactRepository
+ org.eclipse.virgo.kernel.model.RuntimeArtifactRepository,\
+ org.eclipse.osgi.service.resolver.PlatformAdmin,\
+ org.osgi.service.packageadmin.PackageAdmin
serviceExports =\
org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener,\
org.eclipse.virgo.kernel.install.artifact.ArtifactTypeDeterminer,\
org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer,\
+ org.eclipse.virgo.kernel.module.ModuleContextAccessor,\
org.eclipse.virgo.medic.dump.DumpContributor,\
org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory,\
org.eclipse.virgo.kernel.osgi.framework.OsgiFramework,\
org.eclipse.virgo.kernel.osgi.framework.ImportExpander,\
org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil,\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
org.osgi.service.event.EventHandler,\
org.osgi.service.cm.ConfigurationListener,\
org.osgi.service.cm.ManagedService,\
- org.osgi.service.cm.ManagedServiceFactory
-
-inheritedFrameworkProperties =\
- eclipse.bundle.setTCCL,\
- eclipse.enableStateSaver,\
- org.eclipse.virgo.suppress.heap.dumps,\
- osgi.java.profile,\
- osgi.parentClassloader,\
- osgi.context.bootdelegation,\
- osgi.compatibility.bootdelegation,\
- osgi.java.profile.bootdelegation,\
- osgi.hook.configurators.include
-
-# osgi.console=2401
+ org.osgi.service.cm.ManagedServiceFactory,\
+ org.osgi.framework.BundleContext
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties
new file mode 100644
index 00000000..6313f1a1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties
@@ -0,0 +1,6 @@
+# factory pid for config admin service
+service.factoryPid = test.factory.pid.a
+
+# properties for the managed service
+prop1 = prop1
+prop2 = 2 \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/plan-deployment/lazyBundle.jar b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/plan-deployment/lazyBundle.jar
new file mode 100644
index 00000000..5ec5d329
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/plan-deployment/lazyBundle.jar
Binary files differ
diff --git a/org.eclipse.virgo.kernel.deployer.test/template.mf b/org.eclipse.virgo.kernel.deployer.test/template.mf
index 017e8b93..e2f8f06e 100644
--- a/org.eclipse.virgo.kernel.deployer.test/template.mf
+++ b/org.eclipse.virgo.kernel.deployer.test/template.mf
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Virgo Kernel Deployer Test
Bundle-SymbolicName: org.eclipse.virgo.kernel.deployer.test.loadable
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
Excluded-Exports:
*
Excluded-Imports:
diff --git a/org.eclipse.virgo.kernel.deployer.testbundle/template.mf b/org.eclipse.virgo.kernel.deployer.testbundle/template.mf
index de90477a..d01b58b0 100644
--- a/org.eclipse.virgo.kernel.deployer.testbundle/template.mf
+++ b/org.eclipse.virgo.kernel.deployer.testbundle/template.mf
@@ -2,4 +2,4 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Virgo Kernel Deployer Test Bundle
Bundle-SymbolicName: org.eclipse.virgo.kernel.deployer.testbundle
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
diff --git a/org.eclipse.virgo.kernel.deployer/.classpath b/org.eclipse.virgo.kernel.deployer/.classpath
index 1be4ebe5..b66d1af6 100644
--- a/org.eclipse.virgo.kernel.deployer/.classpath
+++ b/org.eclipse.virgo.kernel.deployer/.classpath
@@ -24,35 +24,35 @@
<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.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.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.extensions.equinox-2.2.0.D-20101207145732.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.extensions.equinox-sources-2.2.0.D-20101207145732.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/3.0.0.M02/org.eclipse.virgo.osgi.extensions.equinox-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/3.0.0.M02/org.eclipse.virgo.osgi.extensions.equinox-sources-3.0.0.M02.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.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="/DEV_DIR/external-artifacts/non-spring-build/org.springframework.osgi/org.springframework.osgi.extender/1.2.1.RC1-SFW3/org.springframework.osgi.extender-sources.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.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.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/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-sources-2.2.0.D-20101207150849.jar">
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-sources-3.0.0.M02.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/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-sources-2.2.0.D-20101207150849.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-sources-3.0.0.M02.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.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 combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.services"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-sources-2.2.0.D-20101207150849.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-1.0.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-sources-1.0.0.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/1.0.0.CI-B39/org.eclipse.virgo.teststubs.osgi-sources-1.0.0.CI-B39.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/1.0.0.CI-B39/org.eclipse.virgo.teststubs.osgi-sources-1.0.0.CI-B39.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
+ <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="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.virgo.kernel.deployer/ivy.xml b/org.eclipse.virgo.kernel.deployer/ivy.xml
index 83502659..193766df 100644
--- a/org.eclipse.virgo.kernel.deployer/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer/ivy.xml
@@ -22,6 +22,7 @@
<dependency org="org.eclipse.virgo.teststubs" name="org.eclipse.virgo.teststubs.osgi" rev="${org.eclipse.virgo.teststubs}" conf="test->runtime"/>
<dependency org="org.eclipse.osgi" name="org.eclipse.osgi" rev="${org.eclipse.osgi}" conf="compile->runtime"/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.event" rev="${org.eclipse.equinox.event}" conf="compile->runtime"/>
<dependency org="org.springframework" name="org.springframework.core" rev="${org.springframework}" conf="compile->runtime"/>
<dependency org="org.springframework" name="org.springframework.context" rev="${org.springframework}" conf="compile->runtime"/>
@@ -29,9 +30,7 @@
<dependency org="org.springframework" name="org.springframework.beans" rev="${org.springframework}" 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.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
-
- <dependency name='org.apache.felix.eventadmin' rev='${org.apache.felix.eventadmin}' conf='compile->compile' org='org.apache.felix'/>
+ <dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->runtime"/>
<dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->runtime"/>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java
index 29f25561..936433c7 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java
@@ -28,115 +28,6 @@ import org.osgi.framework.Version;
public interface ApplicationDeployer {
/**
- * {@link DeploymentOptions} provides a collection of deployment options.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This class is immutable and therefore thread safe.
- */
- public class DeploymentOptions {
-
- public static final DeploymentOptions DEFAULT_DEPLOYMENT_OPTIONS = new DeploymentOptions();
-
- private final boolean recoverable;
-
- private final boolean deployerOwned;
-
- private final boolean synchronous;
-
- /**
- * Create default deployment options.
- */
- public DeploymentOptions() {
- this.recoverable = true;
- this.deployerOwned = false;
- this.synchronous = true;
- }
-
- /**
- * Create deployment options with the given recoverability, ownership, and synchronisation.
- *
- * @param recoverable <code>true</code> if and only if the application is to persist across Server restarts
- * @param deployerOwned <code>true</code> if and only if the application at the location specified on deployment
- * is to be deleted when the application is undeployed
- * @param synchronous <code>true</code> if and only if the application should be deployed synchronously
- */
- public DeploymentOptions(boolean recoverable, boolean deployerOwned, boolean synchronous) {
- this.recoverable = recoverable;
- this.deployerOwned = deployerOwned;
- this.synchronous = synchronous;
- }
-
- /**
- * Get the recoverability option.
- *
- * @return <code>true</code> if and only if the application is to persist across Server restarts
- */
- public boolean getRecoverable() {
- return this.recoverable;
- }
-
- /**
- * Get the ownership option.
- *
- * @return <code>true</code> if and only if the application at the location specified on deployment is to be
- * deleted when the application is undeployed
- */
- public boolean getDeployerOwned() {
- return this.deployerOwned;
- }
-
- /**
- * Get the synchronisation option which is <code>true</code> if and only if the application should be deployed
- * synchronously.
- * <p/>
- * Deploying synchronously means that control does not return to the caller of the
- * {@link org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer#deploy(URI, DeploymentOptions) deploy}
- * method until any application contexts for the application have been built and published in the service
- * registry or deployment fails or times out.
- * <p/>
- * Deploying asynchronously means that control returns to the caller of the
- * {@link org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer#deploy(URI, DeploymentOptions) deploy}
- * method once the application has been started, but not necessarily before any application contexts have been
- * built and published.
- *
- * @return <code>true</code> if and only if the application should be deployed synchronously
- */
- public boolean getSynchronous() {
- return this.synchronous;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (deployerOwned ? 1231 : 1237);
- result = prime * result + (recoverable ? 1231 : 1237);
- result = prime * result + (synchronous ? 1231 : 1237);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- DeploymentOptions other = (DeploymentOptions) obj;
- if (deployerOwned != other.deployerOwned)
- return false;
- if (recoverable != other.recoverable)
- return false;
- if (synchronous != other.synchronous)
- return false;
- return true;
- }
- }
-
- /**
* Deploys the artifact are the supplied <code>location</code>. The supplied <code>options</code> govern how the
* installed artifact is handled by the deployed, e.g. if it is recovered and re-installed upon warm restart.
*
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java
index 230040c3..e5f21e36 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java
@@ -69,6 +69,7 @@ public enum DeployerLogEvents implements LogEvent {
REFRESH_REQUEST_FAILED(505, Level.ERROR), //
UNDEPLOY_ARTEFACT_NOT_FOUND(506, Level.ERROR), //
REFRESH_ARTEFACT_NOT_FOUND(507, Level.ERROR), //
+ START_ABORTED(508, Level.INFO), //
JAR_UNPACK_ERROR(600, Level.ERROR), //
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptions.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptions.java
new file mode 100644
index 00000000..4f243dc8
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptions.java
@@ -0,0 +1,112 @@
+package org.eclipse.virgo.kernel.deployer.core;
+
+import java.net.URI;
+
+/**
+ * {@link DeploymentOptions} provides a collection of deployment options.
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * This class is immutable and therefore thread safe.
+ */
+public class DeploymentOptions {
+
+ public static final DeploymentOptions DEFAULT_DEPLOYMENT_OPTIONS = new DeploymentOptions();
+
+ private final boolean recoverable;
+
+ private final boolean deployerOwned;
+
+ private final boolean synchronous;
+
+ /**
+ * Create default deployment options.
+ */
+ public DeploymentOptions() {
+ this.recoverable = true;
+ this.deployerOwned = false;
+ this.synchronous = true;
+ }
+
+ /**
+ * Create deployment options with the given recoverability, ownership, and synchronisation.
+ *
+ * @param recoverable <code>true</code> if and only if the application is to persist across Server restarts
+ * @param deployerOwned <code>true</code> if and only if the application at the location specified on deployment
+ * is to be deleted when the application is undeployed
+ * @param synchronous <code>true</code> if and only if the application should be deployed synchronously
+ */
+ public DeploymentOptions(boolean recoverable, boolean deployerOwned, boolean synchronous) {
+ this.recoverable = recoverable;
+ this.deployerOwned = deployerOwned;
+ this.synchronous = synchronous;
+ }
+
+ /**
+ * Get the recoverability option.
+ *
+ * @return <code>true</code> if and only if the application is to persist across Server restarts
+ */
+ public boolean getRecoverable() {
+ return this.recoverable;
+ }
+
+ /**
+ * Get the ownership option.
+ *
+ * @return <code>true</code> if and only if the application at the location specified on deployment is to be
+ * deleted when the application is undeployed
+ */
+ public boolean getDeployerOwned() {
+ return this.deployerOwned;
+ }
+
+ /**
+ * Get the synchronisation option which is <code>true</code> if and only if the application should be deployed
+ * synchronously.
+ * <p/>
+ * Deploying synchronously means that control does not return to the caller of the
+ * {@link org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer#deploy(URI, DeploymentOptions) deploy}
+ * method until any application contexts for the application have been built and published in the service
+ * registry or deployment fails or times out.
+ * <p/>
+ * Deploying asynchronously means that control returns to the caller of the
+ * {@link org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer#deploy(URI, DeploymentOptions) deploy}
+ * method once the application has been started, but not necessarily before any application contexts have been
+ * built and published.
+ *
+ * @return <code>true</code> if and only if the application should be deployed synchronously
+ */
+ public boolean getSynchronous() {
+ return this.synchronous;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (deployerOwned ? 1231 : 1237);
+ result = prime * result + (recoverable ? 1231 : 1237);
+ result = prime * result + (synchronous ? 1231 : 1237);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DeploymentOptions other = (DeploymentOptions) obj;
+ if (deployerOwned != other.deployerOwned)
+ return false;
+ if (recoverable != other.recoverable)
+ return false;
+ if (synchronous != other.synchronous)
+ return false;
+ return true;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java
deleted file mode 100644
index 6ad893d3..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java
+++ /dev/null
@@ -1,64 +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.deployer.core;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * <p>
- * Used to expose management information about a deployed application, and it's
- * constituent modules/deployed bundles. See {@link ServerModuleInfo ServerModuleInfo}
- * </p>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this interface must be Thread Safe
- *
- */
-public interface ServerApplicationInfo {
-
- /**
- * @return The name of the application as specified in the manifest, otherwise something sensible
- */
- String getName();
-
- /**
- * @return The specified version of the application or '0' if unknown
- */
- String getVersion();
-
- /**
- * @return The number of milliseconds since midnight, January 1, 1970 UTC, when this application was deployed
- */
- Date getDeployTime();
-
- /**
- * @return The type of the application, OSGi/non-OSGi etc...
- */
- String getType();
-
- /**
- * Get the {@link ServerModuleInfo ServerModuleInfos} of all the modules of this application.
- *
- * @return this application's {@link ServerModuleInfo ServerModuleInfos}
- */
- List<ServerModuleInfo> getServerModuleInfo();
-
- /**
- * Get the URI used to deploy this application.
- *
- * @return the string form of the URI
- */
- String getURI();
-
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java
deleted file mode 100644
index d9859f73..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.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.deployer.core;
-
-/**
- * {@link ServerModuleInfo} provides management information for a deployed module of an application.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations of this interface must be thread safe.
- *
- */
-public interface ServerModuleInfo extends Comparable<ServerModuleInfo>{
-
- /**
- * Get the personality of this module.
- *
- * @return the personality of this module or <code>null</code> if this module is devoid of personality
- */
- String getPersonality();
-
- /**
- * Get an identifier of this module which uniquely identifies the module among all modules of the same personality.
- *
- * @return the personality identifier of this module or <code>null</code> if this module is devoid of personality
- */
- String getPersonalityIdentifier();
-
- /**
- * Get the symbolic name that this bundle is based on.
- * @return the symbolic bundle name as specified in the manifest header
- */
- String getBundleSymbolicName();
-
-}
-
-
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunction.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunction.java
index 2dbda4fc..d98c8960 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunction.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunction.java
@@ -18,13 +18,13 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * {@link SignalJunction} provides a collection of signals of a given size that join to drive a given signal. The given
+ * {@link AbortableSignalJunction} provides a collection of signals of a given size that join to drive a given signal. The given
* signal is driven for completion when any of the signals in the collection is driven for failure or all the signals in
* the collection are driven for successful completion. The given signal is driven at most once.
* <p />
@@ -34,27 +34,29 @@ import org.slf4j.LoggerFactory;
* This class is thread safe.
*
*/
-public final class SignalJunction {
+public final class AbortableSignalJunction {
- private static final Logger LOGGER = LoggerFactory.getLogger(SignalJunction.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(AbortableSignalJunction.class);
- private final Signal signal;
+ private final AbortableSignal signal;
- private final List<Signal> subSignals;
+ private final List<AbortableSignal> subSignals;
private final AtomicInteger incompleteCount;
-
+
private final AtomicBoolean failureSignalled = new AtomicBoolean(false);
+
+ private final AtomicBoolean abortionSignalled = new AtomicBoolean(false);
/**
- * Constructs a {@link SignalJunction} of the given size for the given signal.
+ * Constructs a {@link AbortableSignalJunction} of the given size for the given signal.
*
* @param signal the signal to be controlled
* @param size the number of signals in the collection
*/
- public SignalJunction(Signal signal, int size) {
+ public AbortableSignalJunction(AbortableSignal signal, int size) {
this.signal = signal;
- List<Signal> s = new ArrayList<Signal>();
+ List<AbortableSignal> s = new ArrayList<AbortableSignal>();
for (int i = 0; i < size; i++) {
s.add(new SubSignal());
}
@@ -72,54 +74,78 @@ public final class SignalJunction {
*
* @return an unmodifiable {@link Set} of signals in the collection
*/
- public List<Signal> getSignals() {
+ public List<AbortableSignal> getSignals() {
return this.subSignals;
}
-
+
+ public boolean failed() {
+ return this.failureSignalled.get();
+ }
+
+ public boolean aborted() {
+ return this.abortionSignalled.get();
+ }
+
private void subSignalFailed(Throwable cause) {
// Ensure the incomplete count is zero.
- int i = SignalJunction.this.incompleteCount.get();
+ int i = AbortableSignalJunction.this.incompleteCount.get();
LOGGER.debug("SubSignal failed. {} has {} incomplete signals", this, i);
- while (i > 0 && !SignalJunction.this.incompleteCount.compareAndSet(i, 0)) {
- i = SignalJunction.this.incompleteCount.get();
+ while (i > 0 && !AbortableSignalJunction.this.incompleteCount.compareAndSet(i, 0)) {
+ i = AbortableSignalJunction.this.incompleteCount.get();
}
// If this invocation took the count to zero, drive failure.
if (i > 0) {
- if (SignalJunction.this.signal != null) {
+ if (AbortableSignalJunction.this.signal != null) {
LOGGER.debug("{} signalling failure", this);
- SignalJunction.this.signal.signalFailure(cause);
+ AbortableSignalJunction.this.signal.signalFailure(cause);
this.failureSignalled.set(true);
}
}
}
-
- public boolean failed() {
- return this.failureSignalled.get();
+
+ private void subSignalAborted() {
+ // Ensure the incomplete count is zero.
+ int i = AbortableSignalJunction.this.incompleteCount.get();
+
+ LOGGER.debug("SubSignal aborted. {} has {} incomplete signals", this, i);
+
+ while (i > 0 && !AbortableSignalJunction.this.incompleteCount.compareAndSet(i, 0)) {
+ i = AbortableSignalJunction.this.incompleteCount.get();
+ }
+
+ // If this invocation took the count to zero, drive failure.
+ if (i > 0) {
+ if (AbortableSignalJunction.this.signal != null) {
+ LOGGER.debug("{} signalling aborted", this);
+ AbortableSignalJunction.this.signal.signalAborted();
+ this.abortionSignalled.set(true);
+ }
+ }
}
private void subSignalSucceeded() {
// Decrement the incomplete count.
- int incomplete = SignalJunction.this.incompleteCount.decrementAndGet();
+ int incomplete = AbortableSignalJunction.this.incompleteCount.decrementAndGet();
LOGGER.debug("SubSignal succeeded. {} now has {} incomplete signals", this, incomplete);
if (incomplete == 0) {
// If this invocation took the count to zero, drive successful completion.
- if (SignalJunction.this.signal != null) {
+ if (AbortableSignalJunction.this.signal != null) {
LOGGER.debug("{} has no incomplete signals. Signalling success", this);
- SignalJunction.this.signal.signalSuccessfulCompletion();
+ AbortableSignalJunction.this.signal.signalSuccessfulCompletion();
}
}
}
/**
- * {@link SubSignal} is a signal that reports completion to its {@link SignalJunction} once and only once.
+ * {@link SubSignal} is a signal that reports completion to its {@link AbortableSignalJunction} once and only once.
*
*/
- private class SubSignal implements Signal {
+ private class SubSignal implements AbortableSignal {
private final AtomicBoolean complete = new AtomicBoolean(false);
@@ -136,5 +162,12 @@ public final class SignalJunction {
subSignalSucceeded();
}
}
+
+ public void signalAborted() {
+ if (this.complete.compareAndSet(false, true)) {
+ LOGGER.debug("SubSignal {} signalling abortion", this);
+ subSignalAborted();
+ }
+ }
}
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java
index ec0bea2b..22391c00 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java
@@ -14,7 +14,7 @@ package org.eclipse.virgo.kernel.deployer.core.internal;
import java.net.URI;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
/**
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/BlockingAbortableSignal.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/BlockingAbortableSignal.java
new file mode 100644
index 00000000..2701883a
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/BlockingAbortableSignal.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.deployer.core.internal;
+
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+
+
+/**
+ * <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 final BlockingSignal blockingSignal;
+
+ private boolean aborted = false;
+
+ public BlockingAbortableSignal(boolean synchronous) {
+ this.blockingSignal = new BlockingSignal(synchronous);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void signalSuccessfulCompletion() {
+ this.blockingSignal.signalSuccessfulCompletion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void signalFailure(Throwable cause) {
+ this.blockingSignal.signalFailure(cause);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void signalAborted() {
+ this.aborted = true;
+ }
+
+ public boolean isAborted(){
+ return this.aborted;
+ }
+
+ public boolean awaitCompletion(long timeInSeconds) throws DeploymentException {
+ return this.blockingSignal.awaitCompletion(timeInSeconds);
+ }
+
+ public boolean checkComplete() throws DeploymentException {
+ boolean complete = this.blockingSignal.checkComplete();
+ if(this.aborted){
+ return false;
+ }
+ return complete;
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
index dd4cf3bb..b3498220 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
@@ -28,6 +28,7 @@ import org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration;
import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.core.internal.event.DeploymentListener;
import org.eclipse.virgo.kernel.deployer.model.DuplicateDeploymentIdentityException;
import org.eclipse.virgo.kernel.deployer.model.DuplicateFileNameException;
@@ -79,9 +80,14 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
private final int deployerConfiguredTimeoutInSeconds;
- public PipelinedApplicationDeployer(Pipeline pipeline, InstallArtifactTreeInclosure installArtifactTreeInclosure,
- InstallEnvironmentFactory installEnvironmentFactory, RuntimeArtifactModel ram, DeploymentListener deploymentListener,
- EventLogger eventLogger, DeployUriNormaliser normaliser, DeployerConfiguration deployerConfiguration) {
+ public PipelinedApplicationDeployer(Pipeline pipeline,
+ InstallArtifactTreeInclosure installArtifactTreeInclosure,
+ InstallEnvironmentFactory installEnvironmentFactory,
+ RuntimeArtifactModel ram,
+ DeploymentListener deploymentListener,
+ EventLogger eventLogger,
+ DeployUriNormaliser normaliser,
+ DeployerConfiguration deployerConfiguration) {
this.eventLogger = eventLogger;
this.installArtifactTreeInclosure = installArtifactTreeInclosure;
this.installEnvironmentFactory = installEnvironmentFactory;
@@ -272,6 +278,8 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
} catch (UnableToSatisfyBundleDependenciesException utsbde) {
logDependencySatisfactionException(uri, utsbde);
throw new DeploymentException("Dependency satisfaction failed", utsbde);
+ } finally {
+ installEnvironment.destroy();
}
}
@@ -281,13 +289,14 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
}
private void start(InstallArtifact installArtifact, boolean synchronous) throws DeploymentException {
- BlockingSignal blockingSignal = new BlockingSignal(synchronous);
+ BlockingAbortableSignal blockingSignal = new BlockingAbortableSignal(synchronous);
installArtifact.start(blockingSignal);
if (synchronous && this.deployerConfiguredTimeoutInSeconds > 0) {
boolean complete = blockingSignal.awaitCompletion(this.deployerConfiguredTimeoutInSeconds);
- if (!complete) {
- this.eventLogger.log(DeployerLogEvents.START_TIMED_OUT, installArtifact.getType(), installArtifact.getName(),
- installArtifact.getVersion(), this.deployerConfiguredTimeoutInSeconds);
+ if(blockingSignal.isAborted()){
+ this.eventLogger.log(DeployerLogEvents.START_ABORTED, installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), this.deployerConfiguredTimeoutInSeconds);
+ } else if (!complete) {
+ this.eventLogger.log(DeployerLogEvents.START_TIMED_OUT, installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion());
}
} else {
// Completion messages will have been issued if complete, so ignore return value.
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/RegionAwarePackageAdminAccessor.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/RegionAwarePackageAdminAccessor.java
deleted file mode 100644
index 05adc0d7..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/RegionAwarePackageAdminAccessor.java
+++ /dev/null
@@ -1,26 +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.deployer.core.internal;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
-import org.eclipse.virgo.kernel.osgi.region.Region;
-
-@SuppressWarnings("deprecation")
-final class RegionAwarePackageAdminAccessor {
- public static PackageAdmin getPackageAdmin(Region region) {
- BundleContext bundleContext = region.getBundleContext();
- return OsgiFrameworkUtils.getService(bundleContext, PackageAdmin.class).getService();
- }
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java
index 38e4ca42..513bc0e0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java
@@ -13,7 +13,7 @@ package org.eclipse.virgo.kernel.deployer.core.internal.event;
import java.net.URI;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java
index 0135cc6b..cb6376ef 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java
@@ -28,8 +28,8 @@ import java.util.Map.Entry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.core.FatalDeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
import org.eclipse.virgo.util.io.PathReference;
/**
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java
index 048cce7c..b020d94b 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java
@@ -13,7 +13,7 @@ package org.eclipse.virgo.kernel.deployer.core.internal.recovery;
import java.net.URI;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.core.internal.event.DeploymentListener;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java
index ebc5c641..7344db28 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java
@@ -22,8 +22,8 @@ import org.osgi.service.event.EventHandler;
import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.core.FatalDeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.core.internal.ApplicationRecoverer;
import org.eclipse.virgo.medic.eventlog.EventLogger;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java
index 03c8299c..0df6f88b 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java
@@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.core.FatalDeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
import org.eclipse.virgo.kernel.serviceability.NonNull;
import org.eclipse.virgo.medic.eventlog.EventLogger;
import org.eclipse.virgo.medic.eventlog.LogEvent;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java
index 54a1aa81..7492bd8e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java
@@ -20,7 +20,7 @@ import org.eclipse.virgo.kernel.deployer.Deployer;
import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
/**
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java
index efd31909..543c533f 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java
@@ -17,7 +17,7 @@ import org.osgi.framework.Version;
import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.serviceability.NonNull;
import org.eclipse.virgo.util.common.Tree;
@@ -79,14 +79,14 @@ public interface InstallArtifact {
/**
* Starts this {@link InstallArtifact}. Returns before any asynchronous processing has necessarily completed.
* <p/>
- * Equivalent to calling {@link InstallArtifact#start(Signal) start(null)}.
+ * Equivalent to calling {@link InstallArtifact#start(AbortableSignal) start(null)}.
*
* @throws DeploymentException
*/
void start() throws DeploymentException;
/**
- * Starts this {@link InstallArtifact} and drives the given {@link Signal} when the start, including any
+ * Starts this {@link InstallArtifact} and drives the given {@link AbortableSignal} when the start, including any
* asynchronous processing, completes either successfully or unsuccessfully.
* <p/>
* If the start does not involve asynchronous processing, drives the given <code>Signal</code> before returning.
@@ -100,10 +100,10 @@ public interface InstallArtifact {
* Note: this method behaves as specified above when called multiple times on the same <code>InstallArtifact</code>
* with any combination of the same or distinct or <code>null</code> <code>Signals</code>.
*
- * @param signal a <code>Signal</code> that is ready to be driven or <code>null</code> if signalling is not required
+ * @param signal a <code>AbortableSignal</code> that is ready to be driven or <code>null</code> if signalling is not required
* @throws DeploymentException
*/
- void start(Signal signal) throws DeploymentException;
+ void start(AbortableSignal signal) throws DeploymentException;
/**
* Stops this {@link InstallArtifact}. If the <code>InstallArtifact</code> is already stopped, do nothing.
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java
index 129a466a..eb49c9d7 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java
@@ -111,6 +111,14 @@ public interface InstallArtifactLifecycleListener {
void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException;
/**
+ * Notification that the given {@link InstallArtifact} aborted while starting.
+ *
+ * @param installArtifact the <code>InstallArtifact</code> that aborted
+ * @throws DeploymentException if the listener failed to handle the event
+ */
+ void onStartAborted(InstallArtifact installArtifact) throws DeploymentException;
+
+ /**
* Notification that the given {@link InstallArtifact} has started.
*
* <p/>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java
index 52b1593d..cdb959e0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java
@@ -70,6 +70,12 @@ public abstract class InstallArtifactLifecycleListenerSupport implements Install
/**
* {@inheritDoc}
*/
+ public void onStartAborted(InstallArtifact installArtifact) throws DeploymentException {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void onStarted(InstallArtifact installArtifact) throws DeploymentException {
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java
index 4eb1314d..34aa7bdc 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java
@@ -16,7 +16,7 @@ import java.io.File;
import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.util.common.Tree;
/**
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
index 1ee9d2f1..ffd7c9c1 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
@@ -18,6 +18,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.core.Signal;
import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
@@ -76,8 +77,7 @@ public abstract class AbstractInstallArtifact implements InstallArtifact {
* @param repositoryName the name of the source repository, or <code>null</code> if the artifact is not from a
* repository
*/
- protected AbstractInstallArtifact(@NonNull ArtifactIdentity identity, @NonNull ArtifactStorage artifactStorage,
- @NonNull ArtifactStateMonitor artifactStateMonitor, String repositoryName, EventLogger eventLogger) {
+ protected AbstractInstallArtifact(@NonNull ArtifactIdentity identity, @NonNull ArtifactStorage artifactStorage, @NonNull ArtifactStateMonitor artifactStateMonitor, String repositoryName, EventLogger eventLogger) {
this.identity = identity;
this.artifactStorage = artifactStorage;
this.artifactStateMonitor = artifactStateMonitor;
@@ -184,7 +184,7 @@ public abstract class AbstractInstallArtifact implements InstallArtifact {
/**
* {@inheritDoc}
*/
- public void start(Signal signal) throws DeploymentException {
+ public void start(AbortableSignal signal) throws DeploymentException {
// If ACTIVE, signal successful completion immediately, otherwise proceed with start processing.
if (getState().equals(State.ACTIVE)) {
if (signal != null) {
@@ -203,20 +203,20 @@ public abstract class AbstractInstallArtifact implements InstallArtifact {
}
}
- protected final void driveDoStart(Signal signal) throws DeploymentException {
- Signal stateMonitorSignal = createStateMonitorSignal(signal);
+ protected final void driveDoStart(AbortableSignal signal) throws DeploymentException {
+ AbortableSignal stateMonitorSignal = createStateMonitorSignal(signal);
doStart(stateMonitorSignal);
}
- protected Signal createStateMonitorSignal(Signal signal) {
- return new StateMonitorSignal(signal);
+ protected final AbortableSignal createStateMonitorSignal(AbortableSignal signal){
+ return new StateMonitorSignal(signal);
}
+
+ private final class StateMonitorSignal implements AbortableSignal {
- private final class StateMonitorSignal implements Signal {
+ private final AbortableSignal signal;
- private final Signal signal;
-
- public StateMonitorSignal(Signal signal) {
+ public StateMonitorSignal(AbortableSignal signal) {
this.signal = signal;
}
@@ -237,10 +237,6 @@ public abstract class AbstractInstallArtifact implements InstallArtifact {
*/
public void signalFailure(Throwable cause) {
asyncStartFailed(cause);
- handleFailure(cause);
- }
-
- private void handleFailure(Throwable cause) {
try {
stop();
} catch (DeploymentException de) {
@@ -249,6 +245,19 @@ public abstract class AbstractInstallArtifact implements InstallArtifact {
AbstractInstallArtifact.signalFailure(this.signal, cause);
}
+ /**
+ * {@inheritDoc}
+ */
+ public void signalAborted() {
+ asyncStartAborted();
+ try {
+ stop();
+ } catch (DeploymentException de) {
+ AbstractInstallArtifact.this.logger.error("Stop aborted", de);
+ }
+ AbstractInstallArtifact.signalAbortion(this.signal);
+ }
+
}
protected static void signalSuccessfulCompletion(Signal signal) {
@@ -263,6 +272,12 @@ public abstract class AbstractInstallArtifact implements InstallArtifact {
}
}
+ protected static void signalAbortion(AbortableSignal signal) {
+ if (signal != null) {
+ signal.signalAborted();
+ }
+ }
+
/**
* Perform the actual start of this {@link InstallArtifact} and drive the given {@link Signal} on successful or
* unsuccessful completion.
@@ -270,7 +285,7 @@ public abstract class AbstractInstallArtifact implements InstallArtifact {
* @param signal the <code>Signal</code> to be driven
* @throws DeploymentException if the start fails synchronously
*/
- protected abstract void doStart(Signal signal) throws DeploymentException;
+ protected abstract void doStart(AbortableSignal signal) throws DeploymentException;
private final void asyncStartSucceeded() throws DeploymentException {
pushThreadContext();
@@ -292,6 +307,17 @@ public abstract class AbstractInstallArtifact implements InstallArtifact {
}
}
+ private final void asyncStartAborted() {
+ pushThreadContext();
+ try {
+ this.artifactStateMonitor.onStartAborted(this);
+ } catch (DeploymentException e) {
+ logger.error(String.format("listener for %s threw DeploymentException", this), e);
+ } finally {
+ popThreadContext();
+ }
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java
index 446fad91..84737ea0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java
@@ -11,314 +11,58 @@
package org.eclipse.virgo.kernel.install.artifact.internal;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.install.artifact.ArtifactState;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
-import org.osgi.framework.BundleContext;
-
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
/**
- * {@link ArtifactStateMonitor} logs {@link InstallArtifact} state changes and notifies
- * {@link InstallArtifactLifecycleListener InstallArtifactLifecycleListeners}.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
*
- * This class is thread safe.
+ * Implementations must be thread safe
*
*/
-public class ArtifactStateMonitor {
-
- private final BundleContext bundleContext;
-
- private final ArtifactState artifactState;
-
- private ArtifactStateMonitor(BundleContext bundleContext, ArtifactState artifactState) {
- this.bundleContext = bundleContext;
- this.artifactState = artifactState;
- }
-
- public ArtifactStateMonitor(BundleContext bundleContext) {
- this(bundleContext, new ArtifactState());
- }
+public interface ArtifactStateMonitor {
/**
* Returns the current state of the install artifact according to the events which have occurred.
*
- * @return the {@link State} of this {@link ArtifactStateMonitor}
+ * @return the {@link State} of this {@link StandardArtifactStateMonitor}
*/
- public State getState() {
- return this.artifactState.getState();
- }
-
- public void setState(State state) {
- switch (state) {
- case ACTIVE:
- this.artifactState.setActive();
- break;
- case INITIAL:
- this.artifactState.setInitial();
- break;
- case INSTALLED:
- this.artifactState.setInstalled();
- break;
- case INSTALLING:
- this.artifactState.setInstalling();
- break;
- case RESOLVED:
- this.artifactState.setResolved();
- break;
- case RESOLVING:
- this.artifactState.setResolving();
- break;
- case STARTING:
- this.artifactState.setStarting();
- break;
- case STOPPING:
- this.artifactState.setStopping();
- break;
- case UNINSTALLED:
- this.artifactState.setUninstalled();
- break;
- case UNINSTALLING:
- this.artifactState.setUninstalling();
- break;
- }
- }
-
- public void onInstalling(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setInstalling()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onInstalling(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public State getState();
- public void onInstallFailed(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setInitial()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onInstallFailed(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void setState(State state);
- public void onInstalled(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setInstalled()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onInstalled(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onInstalling(InstallArtifact installArtifact) throws DeploymentException;
- public void onResolving(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setResolving()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onResolving(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onInstallFailed(InstallArtifact installArtifact) throws DeploymentException;
- public void onResolveFailed(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setInstalled()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onResolveFailed(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onInstalled(InstallArtifact installArtifact) throws DeploymentException;
- public void onResolved(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setResolved()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onResolved(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onResolving(InstallArtifact installArtifact) throws DeploymentException;
- public boolean onStarting(InstallArtifact installArtifact) throws DeploymentException {
- boolean stateChanged = this.artifactState.setStarting();
- if (stateChanged) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onStarting(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- return stateChanged;
- }
+ public void onResolveFailed(InstallArtifact installArtifact) throws DeploymentException;
- public void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onStartFailed(installArtifact, cause);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
+ public void onResolved(InstallArtifact installArtifact) throws DeploymentException;
- public void onStarted(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setActive()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onStarted(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public boolean onStarting(InstallArtifact installArtifact) throws DeploymentException;
- public void onStopping(InstallArtifact installArtifact) {
- if (this.artifactState.setStopping()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onStopping(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException;
- public void onStopFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
- if (this.artifactState.setActive()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onStopFailed(installArtifact, cause);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onStartAborted(InstallArtifact installArtifact) throws DeploymentException;
- public void onStopped(InstallArtifact installArtifact) {
- if (this.artifactState.setResolved()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onStopped(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onStarted(InstallArtifact installArtifact) throws DeploymentException;
- public void onUnresolved(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setInstalled()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onUnresolved(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
-
- public void onUninstalling(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setUninstalling()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onUninstalling(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onStopping(InstallArtifact installArtifact);
- public void onUninstallFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
- if (this.artifactState.setResolved()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onUninstallFailed(installArtifact, cause);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onStopFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException;
- public void onUninstalled(InstallArtifact installArtifact) throws DeploymentException {
- if (this.artifactState.setUninstalled()) {
- List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
- try {
- for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
- listener.onUninstalled(installArtifact);
- }
- } finally {
- ungetListeners(listenerHolders);
- }
- }
- }
+ public void onStopped(InstallArtifact installArtifact);
- private List<OsgiServiceHolder<InstallArtifactLifecycleListener>> getListenerHolders() {
- return OsgiFrameworkUtils.getServices(this.bundleContext, InstallArtifactLifecycleListener.class);
- }
+ public void onUnresolved(InstallArtifact installArtifact) throws DeploymentException;
- private List<InstallArtifactLifecycleListener> getListeners(List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders) {
- List<InstallArtifactLifecycleListener> listeners;
- listeners = new ArrayList<InstallArtifactLifecycleListener>(listenerHolders.size());
+ public void onUninstalling(InstallArtifact installArtifact) throws DeploymentException;
- for (OsgiServiceHolder<InstallArtifactLifecycleListener> listenerHolder : listenerHolders) {
- listeners.add(listenerHolder.getService());
- }
- return listeners;
- }
+ public void onUninstallFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException;
- private void ungetListeners(List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders) {
- for (OsgiServiceHolder<InstallArtifactLifecycleListener> listenerHolder : listenerHolders) {
- this.bundleContext.ungetService(listenerHolder.getServiceReference());
- }
- }
+ public void onUninstalled(InstallArtifact installArtifact) throws DeploymentException;
-}
+} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java
index 9e92345e..f382de5d 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java
@@ -12,7 +12,7 @@
package org.eclipse.virgo.kernel.install.artifact.internal;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
@@ -40,9 +40,14 @@ final class ConfigInstallArtifact extends AbstractInstallArtifact {
/**
* @throws DeploymentException
*/
- ConfigInstallArtifact(@NonNull ArtifactIdentity identity, @NonNull ArtifactStorage artifactStorage, @NonNull StartEngine startEngine,
- @NonNull RefreshEngine refreshEngine, @NonNull StopEngine stopEngine, @NonNull ArtifactStateMonitor artifactStateMonitor,
- String repositoryName, EventLogger eventLogger) throws DeploymentException {
+ ConfigInstallArtifact(@NonNull ArtifactIdentity identity,
+ @NonNull ArtifactStorage artifactStorage,
+ @NonNull StartEngine startEngine,
+ @NonNull RefreshEngine refreshEngine,
+ @NonNull StopEngine stopEngine,
+ @NonNull ArtifactStateMonitor artifactStateMonitor,
+ String repositoryName,
+ EventLogger eventLogger) throws DeploymentException {
super(identity, artifactStorage, artifactStateMonitor, repositoryName, eventLogger);
this.startEngine = startEngine;
@@ -78,7 +83,7 @@ final class ConfigInstallArtifact extends AbstractInstallArtifact {
* {@inheritDoc}
*/
@Override
- protected final void doStart(Signal signal) throws DeploymentException {
+ protected final void doStart(AbortableSignal signal) throws DeploymentException {
try {
this.startEngine.start(getIdentity(), getArtifactFS());
signalSuccessfulCompletion(signal);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
index 99d5d95f..dcea020d 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
@@ -59,7 +59,7 @@ final class ConfigInstallArtifactTreeFactory implements InstallArtifactTreeFacto
public Tree<InstallArtifact> constructInstallArtifactTree(ArtifactIdentity artifactIdentity, ArtifactStorage artifactStorage,
Map<String, String> deploymentProperties, String repositoryName) throws DeploymentException {
if (PROPERTIES_TYPE.equalsIgnoreCase(artifactIdentity.getType())) {
- ArtifactStateMonitor artifactStateMonitor = new ArtifactStateMonitor(this.bundleContext);
+ ArtifactStateMonitor artifactStateMonitor = new StandardArtifactStateMonitor(this.bundleContext);
InstallArtifact configInstallArtifact = new ConfigInstallArtifact(artifactIdentity, artifactStorage, this.lifecycleEngine,
this.lifecycleEngine, this.lifecycleEngine, artifactStateMonitor, repositoryName, eventLogger);
return constructInstallTree(configInstallArtifact);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java
index b2f24bd7..6048f3dc 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java
@@ -87,6 +87,13 @@ final class LoggingInstallArtifactLifecycleListener implements InstallArtifactLi
/**
* {@inheritDoc}
*/
+ public void onStartAborted(InstallArtifact installArtifact) {
+ logEvent(DeployerLogEvents.START_ABORTED, installArtifact);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void onStarted(InstallArtifact installArtifact) {
logEvent(DeployerLogEvents.STARTED, installArtifact);
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java
index 947a1a5a..88ff847e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java
@@ -71,7 +71,7 @@ final class ParPlanInstallArtifactFactory {
}
ParPlanInstallArtifact createParPlanInstallArtifact(@NonNull ArtifactIdentity artifactIdentity, @NonNull ArtifactStorage artifactStorage, String repositoryName) throws DeploymentException {
- ArtifactStateMonitor artifactStateMonitor = new ArtifactStateMonitor(this.bundleContext);
+ ArtifactStateMonitor artifactStateMonitor = new StandardArtifactStateMonitor(this.bundleContext);
return new ParPlanInstallArtifact(artifactIdentity, artifactStorage, artifactStateMonitor, scopeServiceRepository, scopeFactory, eventLogger,
bundleInstallArtifactTreeFactory, refreshHandler, repositoryName, this.configInstallArtifactTreeFactory,
this.artifactStorageFactory, this.artifactIdentityDeterminer);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java
index db8833df..d120b1f0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java
@@ -120,7 +120,7 @@ final class PlanInstallArtifactTreeFactory implements InstallArtifactTreeFactory
StandardPlanInstallArtifact planInstallArtifact;
planInstallArtifact = new StandardPlanInstallArtifact(artifactIdentity, planDescriptor.getAtomic(), planDescriptor.getScoped(),
- artifactStorage, new ArtifactStateMonitor(this.bundleContext), this.scopeServiceRepository, this.scopeFactory,
+ artifactStorage, new StandardArtifactStateMonitor(this.bundleContext), this.scopeServiceRepository, this.scopeFactory,
this.eventLogger, this.refreshHandler, repositoryName, planDescriptor.getArtifactSpecifications());
Tree<InstallArtifact> tree = constructInstallTree(planInstallArtifact);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java
index 2603feeb..91b1612f 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java
@@ -1,20 +1,19 @@
/*******************************************************************************
- * 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
- *******************************************************************************/
+* 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.install.artifact.internal;
import java.io.File;
import java.util.Set;
-import org.osgi.framework.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -25,95 +24,44 @@ import org.eclipse.virgo.repository.ArtifactDescriptor;
import org.eclipse.virgo.repository.ArtifactGenerationException;
/**
- * {@link StandardArtifactIdentityDeterminer} is a {@link ArtifactIdentityDeterminer} that can determine basic kernel artifact
- * identities.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This class is thread safe.
- *
- */
+* {@link StandardArtifactIdentityDeterminer} is a {@link ArtifactIdentityDeterminer} that can determine basic kernel artifact
+* identities.
+* <p />
+*
+* <strong>Concurrent Semantics</strong><br />
+*
+* This class is thread safe.
+*
+*/
final class StandardArtifactIdentityDeterminer implements ArtifactIdentityDeterminer {
private static final Logger LOGGER = LoggerFactory.getLogger(StandardArtifactIdentityDeterminer.class);
- private static final String JAR_EXTENSION = ".jar";
-
- private static final String PLAN_EXTENSION = ".plan";
-
- private static final String PROPERTIES_EXTENSION = ".properties";
-
- private static final String PAR_EXTENSION = ".par";
-
private final Set<ArtifactBridge> bridges;
public StandardArtifactIdentityDeterminer(Set<ArtifactBridge> bridges) {
this.bridges = bridges;
}
- private ArtifactIdentity determineIdentityFromFile(File file, String scopeName) {
- String type = null;
- String name = null;
-
- String filename = file.getName();
-
- name = trimExtension(file);
-
- if (filename.endsWith(JAR_EXTENSION)) {
- type = BUNDLE_TYPE;
- } else if (filename.endsWith(PLAN_EXTENSION)) {
- type = PLAN_TYPE;
- } else if (filename.endsWith(PROPERTIES_EXTENSION)) {
- type = CONFIGURATION_TYPE;
- } else if (filename.endsWith(PAR_EXTENSION)) {
- type = PAR_TYPE;
- }
-
-
- if (type != null && name != null) {
- return new ArtifactIdentity(type, name, Version.emptyVersion, scopeName);
- } else {
- return null;
- }
- }
-
- private String trimExtension(File file) {
- String filename = file.getName();
-
- int lastIndexOf = filename.lastIndexOf('.');
-
- if (lastIndexOf > 0) {
- return filename.substring(0, lastIndexOf);
- } else {
- return filename;
- }
- }
-
public ArtifactIdentity determineIdentity(File file, String scopeName) {
ArtifactDescriptor artifactDescriptor = null;
for (ArtifactBridge artifactBridge : this.bridges) {
try {
artifactDescriptor = artifactBridge.generateArtifactDescriptor(file);
} catch (ArtifactGenerationException e) {
- LOGGER.warn(String.format("Error occurred while determining the type of an Artifact '%s' with the bridge '%s'.", file,
+ LOGGER.error(String.format("Error occurred while determining the identity of an Artifact '%s' with the bridge '%s'.", file,
artifactBridge.getClass().getSimpleName()), e);
+ return null;
}
if (artifactDescriptor != null) {
break;
}
}
+
if (artifactDescriptor == null) {
- return this.determineIdentityFromFile(file, scopeName);
- } else {
- String type = artifactDescriptor.getType();
- String name = artifactDescriptor.getName();
- Version version = artifactDescriptor.getVersion();
-
- name = name == null ? trimExtension(file) : name;
- version = version == null ? Version.emptyVersion : version;
-
- return new ArtifactIdentity(type, name, version, scopeName);
+ return null;
}
+
+ return new ArtifactIdentity(artifactDescriptor.getType(), artifactDescriptor.getName(), artifactDescriptor.getVersion(), scopeName);
}
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactStateMonitor.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactStateMonitor.java
new file mode 100644
index 00000000..b2eb797e
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactStateMonitor.java
@@ -0,0 +1,387 @@
+/*******************************************************************************
+ * 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.install.artifact.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.install.artifact.ArtifactState;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
+import org.osgi.framework.BundleContext;
+
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
+
+/**
+ * {@link StandardArtifactStateMonitor} logs {@link InstallArtifact} state changes and notifies
+ * {@link InstallArtifactLifecycleListener InstallArtifactLifecycleListeners}.
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * This class is thread safe.
+ *
+ */
+public class StandardArtifactStateMonitor implements ArtifactStateMonitor {
+
+ private final BundleContext bundleContext;
+
+ private final ArtifactState artifactState;
+
+ private StandardArtifactStateMonitor(BundleContext bundleContext, ArtifactState artifactState) {
+ this.bundleContext = bundleContext;
+ this.artifactState = artifactState;
+ }
+
+ public StandardArtifactStateMonitor(BundleContext bundleContext) {
+ this(bundleContext, new ArtifactState());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public State getState() {
+ return this.artifactState.getState();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setState(State state) {
+ switch (state) {
+ case ACTIVE:
+ this.artifactState.setActive();
+ break;
+ case INITIAL:
+ this.artifactState.setInitial();
+ break;
+ case INSTALLED:
+ this.artifactState.setInstalled();
+ break;
+ case INSTALLING:
+ this.artifactState.setInstalling();
+ break;
+ case RESOLVED:
+ this.artifactState.setResolved();
+ break;
+ case RESOLVING:
+ this.artifactState.setResolving();
+ break;
+ case STARTING:
+ this.artifactState.setStarting();
+ break;
+ case STOPPING:
+ this.artifactState.setStopping();
+ break;
+ case UNINSTALLED:
+ this.artifactState.setUninstalled();
+ break;
+ case UNINSTALLING:
+ this.artifactState.setUninstalling();
+ break;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onInstalling(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setInstalling()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onInstalling(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onInstallFailed(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setInitial()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onInstallFailed(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onInstalled(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setInstalled()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onInstalled(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onResolving(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setResolving()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onResolving(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onResolveFailed(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setInstalled()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onResolveFailed(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onResolved(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setResolved()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onResolved(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean onStarting(InstallArtifact installArtifact) throws DeploymentException {
+ boolean stateChanged = this.artifactState.setStarting();
+ if (stateChanged) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onStarting(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ return stateChanged;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onStartFailed(installArtifact, cause);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStartAborted(InstallArtifact installArtifact) throws DeploymentException {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onStartAborted(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStarted(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setActive()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onStarted(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStopping(InstallArtifact installArtifact) {
+ if (this.artifactState.setStopping()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onStopping(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStopFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+ if (this.artifactState.setActive()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onStopFailed(installArtifact, cause);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStopped(InstallArtifact installArtifact) {
+ if (this.artifactState.setResolved()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onStopped(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onUnresolved(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setInstalled()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onUnresolved(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onUninstalling(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setUninstalling()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onUninstalling(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onUninstallFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+ if (this.artifactState.setResolved()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onUninstallFailed(installArtifact, cause);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onUninstalled(InstallArtifact installArtifact) throws DeploymentException {
+ if (this.artifactState.setUninstalled()) {
+ List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+ try {
+ for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+ listener.onUninstalled(installArtifact);
+ }
+ } finally {
+ ungetListeners(listenerHolders);
+ }
+ }
+ }
+
+ private List<OsgiServiceHolder<InstallArtifactLifecycleListener>> getListenerHolders() {
+ return OsgiFrameworkUtils.getServices(this.bundleContext, InstallArtifactLifecycleListener.class);
+ }
+
+ private List<InstallArtifactLifecycleListener> getListeners(List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders) {
+ List<InstallArtifactLifecycleListener> listeners;
+ listeners = new ArrayList<InstallArtifactLifecycleListener>(listenerHolders.size());
+
+ for (OsgiServiceHolder<InstallArtifactLifecycleListener> listenerHolder : listenerHolders) {
+ listeners.add(listenerHolder.getService());
+ }
+ return listeners;
+ }
+
+ private void ungetListeners(List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders) {
+ for (OsgiServiceHolder<InstallArtifactLifecycleListener> listenerHolder : listenerHolders) {
+ this.bundleContext.ungetService(listenerHolder.getServiceReference());
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java
index d53def9e..24f7c03e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java
@@ -15,6 +15,7 @@ import org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependencies
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.environment.InstallEnvironment;
import org.eclipse.virgo.kernel.install.environment.InstallEnvironmentFactory;
import org.eclipse.virgo.kernel.install.pipeline.Pipeline;
import org.eclipse.virgo.util.common.Tree;
@@ -46,12 +47,15 @@ final class StandardInstallArtifactRefreshHandler implements InstallArtifactRefr
Tree<InstallArtifact> tree = installArtifact.getTree();
boolean refreshed = true;
+ InstallEnvironment installEnvironment = this.installEnvironmentFactory.createInstallEnvironment(installArtifact);
try {
- this.refreshPipeline.process(tree, this.installEnvironmentFactory.createInstallEnvironment(installArtifact));
+ this.refreshPipeline.process(tree, installEnvironment);
} catch (UnableToSatisfyBundleDependenciesException _) {
refreshed = false;
} catch (DeploymentException _) {
refreshed = false;
+ } finally {
+ installEnvironment.destroy();
}
return refreshed;
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java
index 814dbb07..99e8c9d2 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java
@@ -26,7 +26,7 @@ import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer;
import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
index aee0157f..e244a213 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
@@ -14,15 +14,11 @@ package org.eclipse.virgo.kernel.install.artifact.internal;
import java.util.ArrayList;
import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.internal.SignalJunction;
+import org.eclipse.virgo.kernel.deployer.core.internal.AbortableSignalJunction;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
@@ -34,6 +30,8 @@ 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.eclipse.virgo.util.common.Tree;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* {@link StandardPlanInstallArtifact} is the standard implementation of {@link PlanInstallArtifact}.
@@ -102,20 +100,20 @@ public class StandardPlanInstallArtifact extends AbstractInstallArtifact impleme
* {@inheritDoc}
*/
@Override
- protected final void doStart(Signal signal) throws DeploymentException {
+ protected final void doStart(AbortableSignal signal) throws DeploymentException {
List<Tree<InstallArtifact>> children = getChildrenSnapshot();
int numChildren = children.size();
// The SignalJunction constructor will drive the signal if numChildren == 0.
- SignalJunction signalJunction = new SignalJunction(signal, numChildren);
+ AbortableSignalJunction signalJunction = new AbortableSignalJunction(signal, numChildren);
LOGGER.debug("Created {} that will notify {} to track start of {}", new Object[] {signalJunction, signal, this});
- List<Signal> subSignals = signalJunction.getSignals();
+ List<AbortableSignal> subSignals = signalJunction.getSignals();
for (int childIndex = 0; childIndex < numChildren && !signalJunction.failed(); childIndex++) {
InstallArtifact childArtifact = children.get(childIndex).getValue();
- Signal subSignal = subSignals.get(childIndex);
+ AbortableSignal subSignal = subSignals.get(childIndex);
LOGGER.debug("Starting {} with signal {} from {}", new Object[] {childArtifact, subSignal, signalJunction});
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java
index 8a669a19..3b87f8a0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java
@@ -14,6 +14,7 @@ package org.eclipse.virgo.kernel.install.artifact.internal.bundle;
import org.osgi.framework.Bundle;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.core.Signal;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.install.artifact.ArtifactState;
@@ -52,10 +53,10 @@ public interface BundleDriver {
* Note: this method behaves as specified above when called multiple times on the same <code>InstallArtifact</code>
* with any combination of the same or distinct or <code>null</code> <code>Signals</code>.
*
- * @param signal a <code>Signal</code> that is ready to be driven or <code>null</code> if no signalling is required
+ * @param signal an <code>AbortableSignal</code> that is ready to be driven or <code>null</code> if no signalling is required
* @throws DeploymentException
*/
- void start(Signal signal) throws DeploymentException;
+ void start(AbortableSignal signal) throws DeploymentException;
/**
* Updates the bundle associated with this {@link BundleDriver} using the given {@link BundleManifest} which
@@ -100,6 +101,6 @@ public interface BundleDriver {
*/
void popThreadContext();
- void trackStart(Signal signal);
+ void trackStart(AbortableSignal signal);
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java
index a2f599fa..5ce1670e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java
@@ -22,11 +22,12 @@ import org.slf4j.LoggerFactory;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
+import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor;
import org.eclipse.virgo.kernel.serviceability.NonNull;
import org.eclipse.virgo.util.math.ConcurrentHashSet;
/**
- * {@link BundleDriverBundleListener} listens for bundle events and notifies the bundle's {@link ArtifactStateMonitor}.
+ * {@link BundleDriverBundleListener} listens for bundle events and notifies the bundle's {@link StandardArtifactStateMonitor}.
* <p />
*
* <strong>Concurrent Semantics</strong><br />
@@ -72,6 +73,7 @@ final class BundleDriverBundleListener implements SynchronousBundleListener {
artifactStateMonitor.onResolved(this.installArtifact);
break;
case BundleEvent.LAZY_ACTIVATION:
+ break;
case BundleEvent.STARTING:
artifactStateMonitor.onStarting(this.installArtifact);
break;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java
index 110d0dae..c1a1155a 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java
@@ -28,6 +28,7 @@ import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer;
import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
import org.eclipse.virgo.kernel.install.artifact.BundleInstallArtifact;
import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
+import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor;
import org.eclipse.virgo.kernel.install.artifact.internal.InstallArtifactRefreshHandler;
import org.eclipse.virgo.medic.eventlog.EventLogger;
import org.eclipse.virgo.util.io.IOUtils;
@@ -69,7 +70,7 @@ final class BundleInstallArtifactFactory {
BundleInstallArtifact createBundleInstallArtifact(ArtifactIdentity identity, ArtifactStorage artifactStorage, String repositoryName) throws DeploymentException {
- ArtifactStateMonitor artifactStateMonitor = new ArtifactStateMonitor(this.kernelBundleContext);
+ ArtifactStateMonitor artifactStateMonitor = new StandardArtifactStateMonitor(this.kernelBundleContext);
StandardBundleDriver bundleDriver = this.bundleDriverFactory.createBundleDriver(identity, artifactStateMonitor);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java
index 2de961df..dfb5fe14 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java
@@ -19,6 +19,7 @@ import org.osgi.framework.BundleListener;
import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.core.BundleStarter;
import org.eclipse.virgo.kernel.core.BundleUtils;
import org.eclipse.virgo.kernel.core.KernelException;
@@ -140,7 +141,7 @@ final class StandardBundleDriver implements BundleDriver {
/**
* {@inheritDoc}
*/
- public void start(Signal signal) throws DeploymentException {
+ public void start(AbortableSignal signal) throws DeploymentException {
Bundle bundle = obtainLocalBundle();
if (!BundleUtils.isFragmentBundle(bundle)) {
@@ -162,7 +163,7 @@ final class StandardBundleDriver implements BundleDriver {
}
- private void startBundle(Bundle bundle, Signal signal) throws DeploymentException {
+ private void startBundle(Bundle bundle, AbortableSignal signal) throws DeploymentException {
this.bundleListener.addSolicitedStart(bundle);
try {
this.bundleStarter.start(bundle, signal);
@@ -200,23 +201,6 @@ final class StandardBundleDriver implements BundleDriver {
}
}
- public boolean asyncStart(Signal signal) {
- Bundle bundle = obtainLocalBundle();
-
- if (!BundleUtils.isFragmentBundle(bundle)) {
- pushThreadContext();
- try {
- this.bundleStarter.start(obtainLocalBundle(), signal);
- } catch (BundleException be) {
- // ignore - the bundle starter will have already notified the signal
- } finally {
- popThreadContext();
- }
- } else
- signalSuccessfulCompletion(signal);
- return true;
- }
-
private Bundle obtainLocalBundle() {
synchronized (this.monitor) {
if (this.bundle == null) {
@@ -302,7 +286,7 @@ final class StandardBundleDriver implements BundleDriver {
/**
* {@inheritDoc}
*/
- public void trackStart(Signal signal) {
+ public void trackStart(AbortableSignal signal) {
this.bundleStarter.trackStart(obtainLocalBundle(), signal);
}
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java
index 263eb14f..1a57c902 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java
@@ -23,17 +23,11 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.osgi.framework.Bundle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
-
import org.eclipse.virgo.kernel.artifact.fs.ArtifactFSEntry;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.internal.BlockingSignal;
+import org.eclipse.virgo.kernel.deployer.core.internal.BlockingAbortableSignal;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer;
import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
@@ -44,6 +38,7 @@ import org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifac
import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
import org.eclipse.virgo.kernel.install.artifact.internal.InstallArtifactRefreshHandler;
import org.eclipse.virgo.kernel.install.artifact.internal.scoping.ArtifactIdentityScoper;
+import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
import org.eclipse.virgo.kernel.serviceability.NonNull;
import org.eclipse.virgo.medic.eventlog.EventLogger;
import org.eclipse.virgo.util.common.Tree;
@@ -53,6 +48,9 @@ import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
import org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory;
import org.eclipse.virgo.util.osgi.manifest.BundleSymbolicName;
import org.eclipse.virgo.util.osgi.manifest.ExportedPackage;
+import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* {@link StandardBundleInstallArtifact} is the default implementation of {@link BundleInstallArtifact}.
@@ -68,6 +66,8 @@ final class StandardBundleInstallArtifact extends AbstractInstallArtifact implem
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private static final String MANIFEST_ENTRY_NAME = "/META-INF/MANIFEST.MF";
+
+ private static final String EQUINOX_SYSTEM_BUNDLE_NAME = "org.eclipse.osgi";
private static final long REFRESH_RESTART_WAIT_PERIOD = 60;
@@ -224,15 +224,31 @@ final class StandardBundleInstallArtifact extends AbstractInstallArtifact implem
* Track the start of the bundle.
*/
void trackStart() {
- Signal signal = createStateMonitorSignal(null);
+ AbortableSignal signal = createStateMonitorSignal(null);
this.bundleDriver.trackStart(signal);
}
+ @Override
+ public void beginInstall() throws DeploymentException {
+ if (isFragmentOnSystemBundle()) {
+ throw new DeploymentException("Deploying fragments of the system bundle is not supported");
+ }
+ super.beginInstall();
+ }
+
+ private boolean isFragmentOnSystemBundle() {
+ String fragmentHost = this.bundleManifest.getFragmentHost().getBundleSymbolicName();
+ if (fragmentHost != null) {
+ return fragmentHost.equals(EQUINOX_SYSTEM_BUNDLE_NAME);
+ }
+ return false;
+ }
+
/**
* {@inheritDoc}
*/
@Override
- public void start(Signal signal) throws DeploymentException {
+ public void start(AbortableSignal signal) throws DeploymentException {
/*
* Do not call super.start(signal) as it is essential that the starting event is driven under the bundle
* lifecycle event so the listeners see a suitable bundle state.
@@ -249,7 +265,7 @@ final class StandardBundleInstallArtifact extends AbstractInstallArtifact implem
* {@inheritDoc}
*/
@Override
- protected void doStart(Signal signal) throws DeploymentException {
+ protected void doStart(AbortableSignal signal) throws DeploymentException {
this.bundleDriver.start(signal);
}
@@ -316,7 +332,7 @@ final class StandardBundleInstallArtifact extends AbstractInstallArtifact implem
boolean refreshed = this.bundleDriver.update(bundleManifest);
if (refreshed) {
if (startRequired) {
- BlockingSignal blockingSignal = new BlockingSignal(true);
+ BlockingAbortableSignal blockingSignal = new BlockingAbortableSignal(true);
start(blockingSignal);
try {
refreshed = blockingSignal.checkComplete();
@@ -403,7 +419,7 @@ final class StandardBundleInstallArtifact extends AbstractInstallArtifact implem
private void startIfNecessary(boolean bundleStopped) throws DeploymentException {
if (bundleStopped) {
- BlockingSignal signal = new BlockingSignal(true);
+ BlockingAbortableSignal signal = new BlockingAbortableSignal(true);
start(signal);
signal.awaitCompletion(REFRESH_RESTART_WAIT_PERIOD);
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java
index 60fc7951..15b35a77 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java
@@ -48,4 +48,9 @@ public interface InstallEnvironment {
* @return an OSGi state or <code>null</code>
*/
QuasiFramework getQuasiFramework();
+
+ /**
+ * Delete any resources associated with this {@link InstallEnvironment}.
+ */
+ void destroy();
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java
index 6d6cdbb3..b4aa90f2 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java
@@ -61,4 +61,13 @@ final class StandardInstallEnvironment implements InstallEnvironment {
public QuasiFramework getQuasiFramework() {
return this.quasiFramework;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void destroy() {
+ this.quasiFramework.destroy();
+ }
+
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties
index aef753b1..cfde7036 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties
@@ -43,6 +43,7 @@ DE0504I = Refresh of artifact '{}' of {} '{}' version '{}' completed.
DE0505E = Refresh of artifact '{}' of {} '{}' version '{}' failed.
DE0506E = Cannot undeploy {} '{}' version '{}'. Artifact not found.
DE0507E = Cannot refresh {} '{}' version '{}'. Artifact not found.
+DE0508I = Aborted start of {} '{}' version '{}'.
DE0600E = File '{}' cannot be unpacked as a JAR.
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/configuration-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/configuration-context.xml
deleted file mode 100644
index b368be7f..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/configuration-context.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
- http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd">
-
- <osgi-compendium:cm-properties id="kernelConfig" persistent-id="org.eclipse.virgo.kernel"/>
-
- <context:property-placeholder properties-ref="kernelConfig"/>
-
-</beans>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
index 0a41f09b..b8fbd6c7 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
@@ -1,309 +1,306 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <service
- interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener">
- <beans:bean
- class="org.eclipse.virgo.kernel.install.artifact.internal.TreeRestrictingInstallArtifactLifecycleListener">
- <beans:constructor-arg ref="eventLogger" />
- </beans:bean>
- </service>
-
- <service id="applicationDeployer" ref="pipelinedApplicationDeployer"
- interface="org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer" />
-
- <beans:bean id="recoveryLog"
- class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLog">
- <beans:constructor-arg value="#{workArea.workDirectory}" />
- </beans:bean>
-
- <beans:bean id="deploymentListener"
- class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLogDeploymentListener">
- <beans:constructor-arg ref="recoveryLog" />
- </beans:bean>
-
- <beans:bean id="artifactStorageFactory"
- class="org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStorageFactory">
- <beans:constructor-arg value="#{workArea.workDirectory}" />
- <beans:constructor-arg>
- <beans:bean
- class="org.eclipse.virgo.kernel.artifact.fs.StandardArtifactFSFactory" />
- </beans:constructor-arg>
- <beans:constructor-arg ref="eventLogger" />
- </beans:bean>
-
- <beans:bean id="syntheticContextCreatingTransformer"
- class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.SyntheticContextBundleCreatingTransformer">
- <beans:constructor-arg ref="bundleInstallArtifactTreeFactory" />
- <beans:constructor-arg ref="artifactStorageFactory" />
- </beans:bean>
-
- <beans:bean id="scopingTransformer"
- class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.ScopingTransformer" />
-
- <beans:bean id="bundleManifestVersionUpgrader"
- class="org.eclipse.virgo.kernel.deployer.core.internal.ManifestUpgrader" />
-
- <beans:bean id="planResolver"
- class="org.eclipse.virgo.kernel.deployer.core.internal.PlanResolver">
- <beans:constructor-arg ref="installArtifactTreeInclosure" />
- </beans:bean>
-
- <beans:bean id="importExpandingTransformer"
- class="org.eclipse.virgo.kernel.deployer.core.internal.ImportExpandingTransformer">
- <beans:constructor-arg ref="importExpander" />
- </beans:bean>
-
- <beans:bean id="bundleDeploymentProperties"
- class="org.eclipse.virgo.kernel.deployer.core.internal.BundleDeploymentPropertiesTransformer" />
-
- <beans:bean id="userInstalledTaggingTransformer"
- class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.UserInstalledTaggingTransformer" />
-
- <service
- interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
- ref="planResolver" ranking="1000" />
- <service
- interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
- ref="bundleManifestVersionUpgrader" ranking="2000" />
- <service
- interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
- ref="bundleDeploymentProperties" ranking="2500" />
- <service
- interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
- ref="userInstalledTaggingTransformer" ranking="2750" />
- <service
- interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
- ref="syntheticContextCreatingTransformer" ranking="3000" />
- <service
- interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
- ref="scopingTransformer" ranking="4000" />
- <service
- interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
- ref="importExpandingTransformer" ranking="5000" />
-
- <service id="recoveryMonitorService" ref="recoveryMonitor"
- interface="org.osgi.service.event.EventHandler">
- <service-properties>
- <beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />
- </service-properties>
- </service>
-
- <beans:bean id="recoveryMonitor"
- class="org.eclipse.virgo.kernel.deployer.management.StandardRecoveryMonitor" />
-
- <service id="recoveryAgent" interface="org.osgi.service.event.EventHandler">
- <service-properties>
- <beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />
- </service-properties>
- <beans:bean
- class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.RecoveryAgent">
- <beans:constructor-arg ref="pipelinedApplicationDeployer" />
- <beans:constructor-arg ref="recoveryLog" />
- <beans:constructor-arg ref="eventLogger" />
- <beans:constructor-arg ref="eventAdmin" />
- </beans:bean>
- </service>
-
- <beans:bean id="mainPipeline" factory-bean="plumber"
- factory-method="getMainPipeline" />
- <beans:bean id="refreshSubpipeline" factory-bean="plumber"
- factory-method="getRefreshSubpipeline" />
-
- <beans:bean id="pipelinedApplicationDeployer"
- class="org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer">
- <beans:constructor-arg ref="mainPipeline" />
- <beans:constructor-arg ref="installArtifactTreeInclosure" />
- <beans:constructor-arg ref="installEnvironmentFactory" />
- <beans:constructor-arg ref="runtimeArtifactModel" />
- <beans:constructor-arg ref="deploymentListener" />
- <beans:constructor-arg ref="eventLogger" />
- <beans:constructor-arg ref="uriNormaliser" />
- <beans:constructor-arg ref="deployerConfig" />
- </beans:bean>
-
- <beans:bean id="stateCleanupListener"
- class="org.eclipse.virgo.kernel.deployer.core.internal.StateCleanupInstallArtifactLifecycleListener">
- <beans:constructor-arg ref="deploymentListener" />
- <beans:constructor-arg ref="runtimeArtifactModel" />
- </beans:bean>
-
- <service ref="stateCleanupListener"
- interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener" />
-
- <service ref="uriNormaliser"
- interface="org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser" />
-
- <beans:bean id="uriNormaliser"
- class="org.eclipse.virgo.kernel.deployer.core.internal.uri.CompoundDeployUriNormaliser">
- <beans:constructor-arg>
- <beans:list>
- <beans:bean
- class="org.eclipse.virgo.kernel.deployer.core.internal.uri.RepositoryDeployUriNormaliser">
- <beans:constructor-arg ref="repository" />
- <beans:constructor-arg ref="eventLogger" />
- </beans:bean>
- <beans:bean
- class="org.eclipse.virgo.kernel.deployer.core.internal.uri.FileDeployUriNormaliser" />
- </beans:list>
- </beans:constructor-arg>
- </beans:bean>
-
- <beans:bean id="plumber"
- class="org.eclipse.virgo.kernel.deployer.core.internal.Plumber">
- <beans:constructor-arg>
- <beans:bean factory-method="getPackageAdmin"
- class="org.eclipse.virgo.kernel.deployer.core.internal.RegionAwarePackageAdminAccessor">
- <beans:constructor-arg>
- <reference interface="org.eclipse.virgo.kernel.osgi.region.Region" />
- </beans:constructor-arg>
- </beans:bean>
- </beans:constructor-arg>
- <beans:constructor-arg ref="bundleContext" />
- <beans:constructor-arg ref="pipelineFactory" />
- <beans:constructor-arg ref="quasiFrameworkFactory" />
- </beans:bean>
-
- <beans:bean id="pipelineFactory"
- class="org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipelineFactory" />
-
- <beans:bean id="installArtifactTreeInclosure"
- class="org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactTreeInclosure">
- <beans:constructor-arg ref="artifactStorageFactory" />
- <beans:constructor-arg ref="bundleContext" />
- <beans:constructor-arg ref="repository" />
- <beans:constructor-arg ref="eventLogger" />
- <beans:constructor-arg ref="artifactIdentityDeterminer" />
- </beans:bean>
-
- <beans:bean id="installEnvironmentFactory"
- class="org.eclipse.virgo.kernel.install.environment.internal.StandardInstallEnvironmentFactory">
- <beans:constructor-arg ref="quasiFrameworkFactory" />
- <beans:constructor-arg ref="eventLogger" />
- </beans:bean>
-
- <beans:bean id="runtimeArtifactModel"
- class="org.eclipse.virgo.kernel.deployer.model.internal.StandardRuntimeArtifactModel">
- <beans:constructor-arg ref="uriNormaliser" />
- </beans:bean>
-
- <service ref="runtimeArtifactModel"
- interface="org.eclipse.virgo.kernel.deployer.model.RuntimeArtifactModel" />
-
- <service ref="loggingListener"
- interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener" />
-
- <beans:bean id="loggingListener"
- class="org.eclipse.virgo.kernel.install.artifact.internal.LoggingInstallArtifactLifecycleListener">
- <beans:constructor-arg ref="eventLogger" />
- </beans:bean>
-
- <beans:bean id="deployerConfig"
- class="org.eclipse.virgo.kernel.deployer.core.internal.StandardDeployerConfiguration">
- <beans:constructor-arg value="${deployer.timeout}" />
- <beans:constructor-arg value="${deployer.pickupDirectory}" />
- </beans:bean>
-
- <service ref="deployerConfig"
- interface="org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration" />
-
- <beans:bean id="applicationDeploymentEventNotifier"
- class="org.eclipse.virgo.kernel.deployer.core.event.ApplicationDeploymentEventNotifier">
- <beans:constructor-arg ref="deploymentListeners" />
- </beans:bean>
-
- <set id="deploymentListeners"
- interface="org.eclipse.virgo.kernel.deployer.core.event.DeploymentListener"
- cardinality="0..N" />
-
- <reference id="packageAdminUtil"
- interface="org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil" />
-
- <!-- scoping -->
- <reference id="scopeFactory"
- interface="org.eclipse.virgo.kernel.shim.scope.ScopeFactory" />
-
- <beans:bean id="scopeServiceRepository"
- class="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository" />
-
- <service ref="scopeServiceRepository"
- interface="org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository" />
-
- <!-- basic artifact identity determination -->
- <service
- interface="org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer">
- <beans:bean
- class="org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactIdentityDeterminer">
- <beans:constructor-arg>
- <set id="artifactBridges" interface="org.eclipse.virgo.repository.ArtifactBridge" />
- </beans:constructor-arg>
- </beans:bean>
- </service>
-
- <beans:bean id="artifactIdentityDeterminer"
- class="org.eclipse.virgo.kernel.install.artifact.internal.DelegatingServiceRegistryBackedArtifactIdentityDeterminer"
- init-method="init" destroy-method="destroy">
- <beans:constructor-arg ref="bundleContext" />
- </beans:bean>
-
- <beans:bean id="refreshHandler"
- class="org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactRefreshHandler">
- <beans:constructor-arg ref="installEnvironmentFactory" />
- <beans:constructor-arg ref="refreshSubpipeline" />
- </beans:bean>
-
- <!-- basic artifact type factories -->
- <beans:bean id="bundleInstallArtifactTreeFactory"
- class="org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleInstallArtifactTreeFactory">
- <beans:constructor-arg ref="osgiFramework" />
- <beans:constructor-arg ref="bundleContext" />
- <beans:constructor-arg ref="refreshHandler" />
- <beans:constructor-arg ref="bundleStarter" />
- <beans:constructor-arg ref="tracingService" />
- <beans:constructor-arg ref="packageAdminUtil" />
- <beans:constructor-arg value="#{region.getBundleContext()}" />
- <beans:constructor-arg ref="eventLogger" />
- <beans:constructor-arg ref="artifactIdentityDeterminer" />
- </beans:bean>
-
- <service ref="bundleInstallArtifactTreeFactory"
- interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory" />
-
- <beans:bean id="configInstallArtifactTreeFactory"
- class="org.eclipse.virgo.kernel.install.artifact.internal.ConfigInstallArtifactTreeFactory">
- <beans:constructor-arg ref="bundleContext" />
- <beans:constructor-arg ref="configAdmin" />
- <beans:constructor-arg ref="eventLogger" />
- </beans:bean>
-
- <service ref="configInstallArtifactTreeFactory"
- interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory" />
-
- <service
- interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory">
- <beans:bean
- class="org.eclipse.virgo.kernel.install.artifact.internal.PlanInstallArtifactTreeFactory">
- <beans:constructor-arg ref="bundleContext" />
- <beans:constructor-arg ref="scopeServiceRepository" />
- <beans:constructor-arg ref="scopeFactory" />
- <beans:constructor-arg ref="eventLogger" />
- <beans:constructor-arg ref="bundleInstallArtifactTreeFactory" />
- <beans:constructor-arg ref="refreshHandler" />
- <beans:constructor-arg ref="configInstallArtifactTreeFactory" />
- <beans:constructor-arg ref="artifactStorageFactory" />
- <beans:constructor-arg ref="artifactIdentityDeterminer" />
- </beans:bean>
- </service>
-
- <service
- interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener">
- <beans:bean
- class="org.eclipse.virgo.kernel.install.artifact.internal.AtomicInstallArtifactLifecycleListener" />
- </service>
-
-</beans:beans>
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <service
+ interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener">
+ <beans:bean
+ class="org.eclipse.virgo.kernel.install.artifact.internal.TreeRestrictingInstallArtifactLifecycleListener">
+ <beans:constructor-arg ref="eventLogger" />
+ </beans:bean>
+ </service>
+
+ <service id="applicationDeployer" ref="pipelinedApplicationDeployer"
+ interface="org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer" />
+
+ <beans:bean id="recoveryLog"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLog">
+ <beans:constructor-arg value="#{workArea.workDirectory}" />
+ </beans:bean>
+
+ <beans:bean id="deploymentListener"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLogDeploymentListener">
+ <beans:constructor-arg ref="recoveryLog" />
+ </beans:bean>
+
+ <beans:bean id="artifactStorageFactory"
+ class="org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStorageFactory">
+ <beans:constructor-arg value="#{workArea.workDirectory}" />
+ <beans:constructor-arg>
+ <beans:bean
+ class="org.eclipse.virgo.kernel.artifact.fs.StandardArtifactFSFactory" />
+ </beans:constructor-arg>
+ <beans:constructor-arg ref="eventLogger" />
+ </beans:bean>
+
+ <beans:bean id="syntheticContextCreatingTransformer"
+ class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.SyntheticContextBundleCreatingTransformer">
+ <beans:constructor-arg ref="bundleInstallArtifactTreeFactory" />
+ <beans:constructor-arg ref="artifactStorageFactory" />
+ </beans:bean>
+
+ <beans:bean id="scopingTransformer"
+ class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.ScopingTransformer" />
+
+ <beans:bean id="bundleManifestVersionUpgrader"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.ManifestUpgrader" />
+
+ <beans:bean id="planResolver"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.PlanResolver">
+ <beans:constructor-arg ref="installArtifactTreeInclosure" />
+ </beans:bean>
+
+ <beans:bean id="importExpandingTransformer"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.ImportExpandingTransformer">
+ <beans:constructor-arg ref="importExpander" />
+ </beans:bean>
+
+ <beans:bean id="bundleDeploymentProperties"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.BundleDeploymentPropertiesTransformer" />
+
+ <beans:bean id="userInstalledTaggingTransformer"
+ class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.UserInstalledTaggingTransformer" />
+
+ <service
+ interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
+ ref="planResolver" ranking="1000" />
+ <service
+ interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
+ ref="bundleManifestVersionUpgrader" ranking="2000" />
+ <service
+ interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
+ ref="bundleDeploymentProperties" ranking="2500" />
+ <service
+ interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
+ ref="userInstalledTaggingTransformer" ranking="2750" />
+ <service
+ interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
+ ref="syntheticContextCreatingTransformer" ranking="3000" />
+ <service
+ interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
+ ref="scopingTransformer" ranking="4000" />
+ <service
+ interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
+ ref="importExpandingTransformer" ranking="5000" />
+
+ <service id="recoveryMonitorService" ref="recoveryMonitor"
+ interface="org.osgi.service.event.EventHandler">
+ <service-properties>
+ <beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />
+ </service-properties>
+ </service>
+
+ <beans:bean id="recoveryMonitor"
+ class="org.eclipse.virgo.kernel.deployer.management.StandardRecoveryMonitor" />
+
+ <service id="recoveryAgent" interface="org.osgi.service.event.EventHandler">
+ <service-properties>
+ <beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />
+ </service-properties>
+ <beans:bean
+ class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.RecoveryAgent">
+ <beans:constructor-arg ref="pipelinedApplicationDeployer" />
+ <beans:constructor-arg ref="recoveryLog" />
+ <beans:constructor-arg ref="eventLogger" />
+ <beans:constructor-arg ref="eventAdmin" />
+ </beans:bean>
+ </service>
+
+ <beans:bean id="mainPipeline" factory-bean="plumber"
+ factory-method="getMainPipeline" />
+ <beans:bean id="refreshSubpipeline" factory-bean="plumber"
+ factory-method="getRefreshSubpipeline" />
+
+ <beans:bean id="pipelinedApplicationDeployer"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer">
+ <beans:constructor-arg ref="mainPipeline" />
+ <beans:constructor-arg ref="installArtifactTreeInclosure" />
+ <beans:constructor-arg ref="installEnvironmentFactory" />
+ <beans:constructor-arg ref="runtimeArtifactModel" />
+ <beans:constructor-arg ref="deploymentListener" />
+ <beans:constructor-arg ref="eventLogger" />
+ <beans:constructor-arg ref="uriNormaliser" />
+ <beans:constructor-arg ref="deployerConfig" />
+ </beans:bean>
+
+ <beans:bean id="stateCleanupListener"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.StateCleanupInstallArtifactLifecycleListener">
+ <beans:constructor-arg ref="deploymentListener" />
+ <beans:constructor-arg ref="runtimeArtifactModel" />
+ </beans:bean>
+
+ <service ref="stateCleanupListener"
+ interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener" />
+
+ <service ref="uriNormaliser"
+ interface="org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser" />
+
+ <beans:bean id="uriNormaliser"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.uri.CompoundDeployUriNormaliser">
+ <beans:constructor-arg>
+ <beans:list>
+ <beans:bean
+ class="org.eclipse.virgo.kernel.deployer.core.internal.uri.RepositoryDeployUriNormaliser">
+ <beans:constructor-arg ref="repository" />
+ <beans:constructor-arg ref="eventLogger" />
+ </beans:bean>
+ <beans:bean
+ class="org.eclipse.virgo.kernel.deployer.core.internal.uri.FileDeployUriNormaliser" />
+ </beans:list>
+ </beans:constructor-arg>
+ </beans:bean>
+
+ <beans:bean id="plumber"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.Plumber">
+ <beans:constructor-arg ref="packageAdmin" />
+ <beans:constructor-arg ref="bundleContext" />
+ <beans:constructor-arg ref="pipelineFactory" />
+ <beans:constructor-arg ref="quasiFrameworkFactory" />
+ </beans:bean>
+
+ <beans:bean id="pipelineFactory"
+ class="org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipelineFactory" />
+
+ <beans:bean id="installArtifactTreeInclosure"
+ class="org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactTreeInclosure">
+ <beans:constructor-arg ref="artifactStorageFactory" />
+ <beans:constructor-arg ref="bundleContext" />
+ <beans:constructor-arg ref="repository" />
+ <beans:constructor-arg ref="eventLogger" />
+ <beans:constructor-arg ref="artifactIdentityDeterminer" />
+ </beans:bean>
+
+ <beans:bean id="installEnvironmentFactory"
+ class="org.eclipse.virgo.kernel.install.environment.internal.StandardInstallEnvironmentFactory">
+ <beans:constructor-arg ref="quasiFrameworkFactory" />
+ <beans:constructor-arg ref="eventLogger" />
+ </beans:bean>
+
+ <beans:bean id="runtimeArtifactModel"
+ class="org.eclipse.virgo.kernel.deployer.model.internal.StandardRuntimeArtifactModel">
+ <beans:constructor-arg ref="uriNormaliser" />
+ </beans:bean>
+
+ <service ref="runtimeArtifactModel"
+ interface="org.eclipse.virgo.kernel.deployer.model.RuntimeArtifactModel" />
+
+ <service ref="loggingListener"
+ interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener" />
+
+ <beans:bean id="loggingListener"
+ class="org.eclipse.virgo.kernel.install.artifact.internal.LoggingInstallArtifactLifecycleListener">
+ <beans:constructor-arg ref="eventLogger" />
+ </beans:bean>
+
+ <reference id="kernelConfig" interface="org.eclipse.virgo.kernel.core.KernelConfig"/>
+
+ <beans:bean id="deployerConfig"
+ class="org.eclipse.virgo.kernel.deployer.core.internal.StandardDeployerConfiguration">
+ <beans:constructor-arg value="#{kernelConfig.getProperty('deployer.timeout')}" />
+ <beans:constructor-arg value="#{kernelConfig.getProperty('deployer.pickupDirectory')}" />
+ </beans:bean>
+
+ <service ref="deployerConfig"
+ interface="org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration" />
+
+ <beans:bean id="applicationDeploymentEventNotifier"
+ class="org.eclipse.virgo.kernel.deployer.core.event.ApplicationDeploymentEventNotifier">
+ <beans:constructor-arg ref="deploymentListeners" />
+ </beans:bean>
+
+ <set id="deploymentListeners"
+ interface="org.eclipse.virgo.kernel.deployer.core.event.DeploymentListener"
+ cardinality="0..N" />
+
+ <reference id="packageAdminUtil"
+ interface="org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil" />
+
+ <!-- scoping -->
+ <reference id="scopeFactory"
+ interface="org.eclipse.virgo.kernel.shim.scope.ScopeFactory" />
+
+ <beans:bean id="scopeServiceRepository"
+ class="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository" />
+
+ <service ref="scopeServiceRepository"
+ interface="org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository" />
+
+ <!-- basic artifact identity determination -->
+ <service
+ interface="org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer">
+ <beans:bean
+ class="org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactIdentityDeterminer">
+ <beans:constructor-arg>
+ <set id="artifactBridges" interface="org.eclipse.virgo.repository.ArtifactBridge" />
+ </beans:constructor-arg>
+ </beans:bean>
+ </service>
+
+ <beans:bean id="artifactIdentityDeterminer"
+ class="org.eclipse.virgo.kernel.install.artifact.internal.DelegatingServiceRegistryBackedArtifactIdentityDeterminer"
+ init-method="init" destroy-method="destroy">
+ <beans:constructor-arg ref="bundleContext" />
+ </beans:bean>
+
+ <beans:bean id="refreshHandler"
+ class="org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactRefreshHandler">
+ <beans:constructor-arg ref="installEnvironmentFactory" />
+ <beans:constructor-arg ref="refreshSubpipeline" />
+ </beans:bean>
+
+ <!-- basic artifact type factories -->
+ <beans:bean id="bundleInstallArtifactTreeFactory"
+ class="org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleInstallArtifactTreeFactory">
+ <beans:constructor-arg ref="osgiFramework" />
+ <beans:constructor-arg ref="bundleContext" />
+ <beans:constructor-arg ref="refreshHandler" />
+ <beans:constructor-arg ref="bundleStarter" />
+ <beans:constructor-arg ref="tracingService" />
+ <beans:constructor-arg ref="packageAdminUtil" />
+ <beans:constructor-arg ref="userBundleContext" />
+ <beans:constructor-arg ref="eventLogger" />
+ <beans:constructor-arg ref="artifactIdentityDeterminer" />
+ </beans:bean>
+
+ <reference id="userBundleContext" interface="org.osgi.framework.BundleContext" filter="(org.eclipse.virgo.kernel.regionContext=true)"/>
+
+ <service ref="bundleInstallArtifactTreeFactory"
+ interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory" />
+
+ <beans:bean id="configInstallArtifactTreeFactory"
+ class="org.eclipse.virgo.kernel.install.artifact.internal.ConfigInstallArtifactTreeFactory">
+ <beans:constructor-arg ref="bundleContext" />
+ <beans:constructor-arg ref="configAdmin" />
+ <beans:constructor-arg ref="eventLogger" />
+ </beans:bean>
+
+ <service ref="configInstallArtifactTreeFactory"
+ interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory" />
+
+ <service
+ interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory">
+ <beans:bean
+ class="org.eclipse.virgo.kernel.install.artifact.internal.PlanInstallArtifactTreeFactory">
+ <beans:constructor-arg ref="bundleContext" />
+ <beans:constructor-arg ref="scopeServiceRepository" />
+ <beans:constructor-arg ref="scopeFactory" />
+ <beans:constructor-arg ref="eventLogger" />
+ <beans:constructor-arg ref="bundleInstallArtifactTreeFactory" />
+ <beans:constructor-arg ref="refreshHandler" />
+ <beans:constructor-arg ref="configInstallArtifactTreeFactory" />
+ <beans:constructor-arg ref="artifactStorageFactory" />
+ <beans:constructor-arg ref="artifactIdentityDeterminer" />
+ </beans:bean>
+ </service>
+
+ <service
+ interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener">
+ <beans:bean
+ class="org.eclipse.virgo.kernel.install.artifact.internal.AtomicInstallArtifactLifecycleListener" />
+ </service>
+
+</beans:beans>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml
index 6c7f7ef0..d5347295 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml
@@ -4,18 +4,15 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd">
- <!--
- Configuration for OSGi services that the kernel depends on and
- provides to the framework. These services are not considered part of
- the kernel API.
- -->
+ <!-- Configuration for OSGi services that the kernel depends on and provides
+ to the framework. These services are not considered part of the kernel API. -->
<osgi:reference id="configAdmin"
interface="org.osgi.service.cm.ConfigurationAdmin" />
<osgi:reference id="eventLogger"
interface="org.eclipse.virgo.medic.eventlog.EventLogger" />
-
+
<osgi:reference id="dumpGenerator"
interface="org.eclipse.virgo.medic.dump.DumpGenerator" />
@@ -42,16 +39,21 @@
<osgi:reference id="quasiFrameworkFactory"
interface="org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory" />
-
+
<osgi:reference id="eventAdmin" interface="org.osgi.service.event.EventAdmin" />
- <osgi:reference id="bundleStarter" interface="org.eclipse.virgo.kernel.core.BundleStarter" context-class-loader="unmanaged"/>
-
- <osgi:reference id="importExpander" interface="org.eclipse.virgo.kernel.osgi.framework.ImportExpander"/>
-
- <osgi:reference id="region" interface="org.eclipse.virgo.kernel.osgi.region.Region"/>
-
- <!-- services -->
+ <osgi:reference id="bundleStarter"
+ interface="org.eclipse.virgo.kernel.core.BundleStarter"
+ context-class-loader="unmanaged" />
+
+ <osgi:reference id="importExpander"
+ interface="org.eclipse.virgo.kernel.osgi.framework.ImportExpander" />
+
+ <osgi:reference id="region"
+ interface="org.eclipse.virgo.kernel.osgi.region.Region"
+ filter="(org.eclipse.virgo.kernel.region.name=org.eclipse.virgo.region.user)" />
+
+ <!-- services -->
<osgi:service ref="moduleContextEventPublisher"
interface="org.eclipse.virgo.kernel.module.ModuleContextEventPublisher" />
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
index e80bd4e7..6badf422 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
@@ -1,25 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <!-- Deployer -->
- <bean class="org.eclipse.virgo.kernel.management.ManagementExporter">
- <constructor-arg>
- <bean class="org.eclipse.virgo.kernel.deployer.management.StandardDeployer">
- <constructor-arg ref="pipelinedApplicationDeployer" />
- </bean>
- </constructor-arg>
- <constructor-arg
- value="${domain}:category=Control,type=Deployer" />
- </bean>
-
- <!-- RecoveryMonitor -->
- <bean class="org.eclipse.virgo.kernel.management.ManagementExporter">
- <constructor-arg ref="recoveryMonitor" />
- <constructor-arg
- value="${domain}:category=Control,type=RecoveryMonitor" />
- </bean>
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <!-- Deployer -->
+ <bean class="org.eclipse.virgo.kernel.management.ManagementExporter">
+ <constructor-arg>
+ <bean class="org.eclipse.virgo.kernel.deployer.management.StandardDeployer">
+ <constructor-arg ref="pipelinedApplicationDeployer" />
+ </bean>
+ </constructor-arg>
+ <constructor-arg
+ value="#{kernelConfig.getProperty('domain')}:category=Control,type=Deployer" />
+ </bean>
+
+ <!-- RecoveryMonitor -->
+ <bean class="org.eclipse.virgo.kernel.management.ManagementExporter">
+ <constructor-arg ref="recoveryMonitor" />
+ <constructor-arg
+ value="#{kernelConfig.getProperty('domain')}:category=Control,type=RecoveryMonitor" />
+ </bean>
+
+ <osgi:reference id="kernelConfig" interface="org.eclipse.virgo.kernel.core.KernelConfig"/>
+</beans>
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java
index f93d26a0..0883f37e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java
@@ -13,7 +13,6 @@ package org.eclipse.virgo.kernel.deployer.core;
import static org.junit.Assert.assertEquals;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
import org.junit.Test;
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java
index dd403d20..71574cf0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java
@@ -36,7 +36,9 @@ public final class StubInstallArtifactLifecycleListener implements InstallArtifa
private final AtomicInteger startingCount = new AtomicInteger();
private final AtomicInteger startFailedCount = new AtomicInteger();
-
+
+ private final AtomicInteger startAbortedCount = new AtomicInteger();
+
private final AtomicInteger startedCount = new AtomicInteger();
private final AtomicInteger stoppingCount = new AtomicInteger();
@@ -115,6 +117,10 @@ public final class StubInstallArtifactLifecycleListener implements InstallArtifa
assertEquals("Incorrect start failed count", startFailed, this.startFailedCount.get());
}
+ public void assertStartAbortedCount(int startAborted) {
+ assertEquals("Incorrect start abortion count", startAborted, this.startAbortedCount.get());
+ }
+
public void assertStartedCount(int started) {
assertEquals("Incorrect started count", started, this.startedCount.get());
}
@@ -206,6 +212,13 @@ public final class StubInstallArtifactLifecycleListener implements InstallArtifa
/**
* {@inheritDoc}
*/
+ public void onStartAborted(InstallArtifact installArtifact) {
+ this.startAbortedCount.incrementAndGet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void onStarted(InstallArtifact installArtifact) {
this.startedCount.incrementAndGet();
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunctionTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunctionTests.java
new file mode 100644
index 00000000..e6751184
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunctionTests.java
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * 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.deployer.core.internal;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ */
+public class AbortableSignalJunctionTests {
+
+ private AbortableSignal signal;
+
+ private boolean signalCompleted;
+
+ private boolean signalFailed;
+
+ private boolean signalAborted;
+
+ @Before
+ public void setUp() {
+ this.signalCompleted = false;
+ this.signalFailed = false;
+
+ this.signal = new AbortableSignal(){
+
+ public void signalFailure(Throwable cause) {
+ signalFailed = true;
+ }
+
+ public void signalSuccessfulCompletion() {
+ signalCompleted = true;
+ }
+
+ public void signalAborted() {
+ signalAborted = true;
+ }
+
+ };
+ }
+
+ @Test
+ public void testEmptyJunction() {
+ new AbortableSignalJunction(this.signal, 0);
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testUnaryJunction() {
+ AbortableSignalJunction sj = new AbortableSignalJunction(this.signal, 1);
+ sj.getSignals().get(0).signalSuccessfulCompletion();
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testBinaryJunction() {
+ AbortableSignalJunction sj = new AbortableSignalJunction(this.signal, 2);
+ sj.getSignals().get(0).signalSuccessfulCompletion();
+ sj.getSignals().get(1).signalSuccessfulCompletion();
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testBinaryJunctionFail() {
+ AbortableSignalJunction sj = new AbortableSignalJunction(this.signal, 2);
+ sj.getSignals().get(0).signalFailure(new RuntimeException());
+ assertFalse(this.signalCompleted);
+ assertTrue(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testBinaryJunctionAbort() {
+ AbortableSignalJunction sj = new AbortableSignalJunction(this.signal, 2);
+ sj.getSignals().get(0).signalAborted();
+ assertFalse(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertTrue(this.signalAborted);
+ }
+
+ @Test
+ public void testNestedBinaryJunctionOrder1() {
+ AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+ AbortableSignal top1 = top.getSignals().get(0);
+ AbortableSignal top2 = top.getSignals().get(1);
+ AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+ AbortableSignal bottom1 = bottom.getSignals().get(0);
+ AbortableSignal bottom2 = bottom.getSignals().get(1);
+ top1.signalSuccessfulCompletion();
+ bottom1.signalSuccessfulCompletion();
+ bottom2.signalSuccessfulCompletion();
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testNestedBinaryJunctionOrder2() {
+ AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+ AbortableSignal top1 = top.getSignals().get(0);
+ AbortableSignal top2 = top.getSignals().get(1);
+ AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+ AbortableSignal bottom1 = bottom.getSignals().get(0);
+ AbortableSignal bottom2 = bottom.getSignals().get(1);
+ bottom1.signalSuccessfulCompletion();
+ top1.signalSuccessfulCompletion();
+ bottom2.signalSuccessfulCompletion();
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testNestedBinaryJunctionOrder3() {
+ AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+ AbortableSignal top1 = top.getSignals().get(0);
+ AbortableSignal top2 = top.getSignals().get(1);
+ AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+ AbortableSignal bottom1 = bottom.getSignals().get(0);
+ AbortableSignal bottom2 = bottom.getSignals().get(1);
+ bottom1.signalSuccessfulCompletion();
+ bottom2.signalSuccessfulCompletion();
+ top1.signalSuccessfulCompletion();
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testNestedBinaryJunctionOrder4() {
+ AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+ AbortableSignal top1 = top.getSignals().get(0);
+ AbortableSignal top2 = top.getSignals().get(1);
+ AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+ AbortableSignal bottom1 = bottom.getSignals().get(0);
+ AbortableSignal bottom2 = bottom.getSignals().get(1);
+ top1.signalSuccessfulCompletion();
+ bottom2.signalSuccessfulCompletion();
+ bottom1.signalSuccessfulCompletion();
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testNestedBinaryJunctionOrder5() {
+ AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+ AbortableSignal top1 = top.getSignals().get(0);
+ AbortableSignal top2 = top.getSignals().get(1);
+ AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+ AbortableSignal bottom1 = bottom.getSignals().get(0);
+ AbortableSignal bottom2 = bottom.getSignals().get(1);
+ bottom2.signalSuccessfulCompletion();
+ top1.signalSuccessfulCompletion();
+ bottom1.signalSuccessfulCompletion();
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testNestedBinaryJunctionOrder6() {
+ AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+ AbortableSignal top1 = top.getSignals().get(0);
+ AbortableSignal top2 = top.getSignals().get(1);
+ AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+ AbortableSignal bottom1 = bottom.getSignals().get(0);
+ AbortableSignal bottom2 = bottom.getSignals().get(1);
+ bottom2.signalSuccessfulCompletion();
+ bottom1.signalSuccessfulCompletion();
+ top1.signalSuccessfulCompletion();
+ assertTrue(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testNestedBinaryJunctionOrderFail() {
+ AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+ AbortableSignal top1 = top.getSignals().get(0);
+ AbortableSignal top2 = top.getSignals().get(1);
+ AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+ AbortableSignal bottom1 = bottom.getSignals().get(0);
+ AbortableSignal bottom2 = bottom.getSignals().get(1);
+ top1.signalSuccessfulCompletion();
+ bottom1.signalFailure(new RuntimeException());
+ bottom2.signalSuccessfulCompletion();
+ assertFalse(this.signalCompleted);
+ assertTrue(this.signalFailed);
+ assertFalse(this.signalAborted);
+ }
+
+ @Test
+ public void testNestedBinaryJunctionOrderAbort() {
+ AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+ AbortableSignal top1 = top.getSignals().get(0);
+ AbortableSignal top2 = top.getSignals().get(1);
+ AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+ AbortableSignal bottom1 = bottom.getSignals().get(0);
+ AbortableSignal bottom2 = bottom.getSignals().get(1);
+ top1.signalSuccessfulCompletion();
+ bottom1.signalAborted();
+ bottom2.signalSuccessfulCompletion();
+ assertFalse(this.signalCompleted);
+ assertFalse(this.signalFailed);
+ assertTrue(this.signalAborted);
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java
index 0f7821e5..9a8bc4fd 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java
@@ -162,5 +162,10 @@ public class ManifestUpgraderTests {
throw new UnsupportedOperationException();
}
+ @Override
+ public void destroy() {
+ throw new UnsupportedOperationException();
+ }
+
}
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployerTests.java
new file mode 100644
index 00000000..d2c3d23d
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployerTests.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * 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.deployer.core.internal;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser;
+import org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.deployer.core.internal.event.DeploymentListener;
+import org.eclipse.virgo.kernel.deployer.model.RuntimeArtifactModel;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeInclosure;
+import org.eclipse.virgo.kernel.install.environment.InstallEnvironmentFactory;
+import org.eclipse.virgo.kernel.install.pipeline.Pipeline;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+public class PipelinedApplicationDeployerTests {
+
+ private PipelinedApplicationDeployer pipelinedApplicationDeployer;
+ private Pipeline pipeline;
+ private InstallArtifactTreeInclosure installArtifactTreeInclosure;
+ private InstallEnvironmentFactory installEnvironmentFactory;
+ private RuntimeArtifactModel ram;
+ private DeploymentListener deploymentListener;
+ private EventLogger eventLogger;
+ private DeployUriNormaliser normaliser;
+ private DeployerConfiguration deployerConfiguration;
+ private InstallArtifact installArtifact;
+
+ @Before
+ public void setup() {
+ pipeline = createMock(Pipeline.class);
+ installArtifactTreeInclosure = createMock(InstallArtifactTreeInclosure.class);
+ installEnvironmentFactory = createMock(InstallEnvironmentFactory.class);
+ ram = createMock(RuntimeArtifactModel.class);
+ deploymentListener = createMock(DeploymentListener.class);
+ eventLogger = createNiceMock(EventLogger.class);
+ normaliser = createMock(DeployUriNormaliser.class);
+ deployerConfiguration = createMock(DeployerConfiguration.class);
+ installArtifact = createMock(InstallArtifact.class);
+
+ expect(this.deployerConfiguration.getDeploymentTimeoutSeconds()).andReturn(5);
+ }
+
+ @After
+ public void tearDown() {
+ resetMocks();
+ }
+
+ private void startTests() {
+ replay(this.pipeline, this.installArtifactTreeInclosure, this.installEnvironmentFactory, this.ram, this.deploymentListener, this.eventLogger, this.normaliser, this.deployerConfiguration, this.installArtifact);
+ this.pipelinedApplicationDeployer = new PipelinedApplicationDeployer(pipeline, installArtifactTreeInclosure, installEnvironmentFactory, ram, deploymentListener, eventLogger, normaliser, deployerConfiguration);
+ }
+
+ private void verifyMocks() {
+ verify(this.pipeline, this.installArtifactTreeInclosure, this.installEnvironmentFactory, this.ram, this.deploymentListener, this.eventLogger, this.normaliser, this.deployerConfiguration, this.installArtifact);
+ }
+
+ private void resetMocks() {
+ reset(this.pipeline, this.installArtifactTreeInclosure, this.installEnvironmentFactory, this.ram, this.deploymentListener, this.eventLogger, this.normaliser, this.deployerConfiguration, this.installArtifact);
+ }
+
+ @Test
+ public void testIsdeployedFalse() throws URISyntaxException, DeploymentException {
+ URI testURI = new URI("foo");
+ expect(this.normaliser.normalise(testURI)).andReturn(null);
+ this.startTests();
+ boolean result = this.pipelinedApplicationDeployer.isDeployed(testURI);
+ this.verifyMocks();
+ assertFalse(result);
+ }
+
+ @Test
+ public void testIsdeployedFalse2() throws URISyntaxException, DeploymentException {
+ URI testURI = new URI("foo");
+ expect(this.normaliser.normalise(testURI)).andReturn(testURI);
+ expect(this.ram.get(testURI)).andReturn(null);
+ this.startTests();
+ boolean result = this.pipelinedApplicationDeployer.isDeployed(testURI);
+ this.verifyMocks();
+ assertFalse(result);
+ }
+
+ @Test
+ public void testIsdeployedSucsess() throws URISyntaxException, DeploymentException {
+ URI testURI = new URI("foo");
+ expect(this.normaliser.normalise(testURI)).andReturn(testURI);
+ expect(this.ram.get(testURI)).andReturn(this.installArtifact);
+ this.startTests();
+ boolean result = this.pipelinedApplicationDeployer.isDeployed(testURI);
+ this.verifyMocks();
+ assertTrue(result);
+ }
+
+ @Test
+ public void testIsdeployedFail() throws URISyntaxException, DeploymentException {
+ URI testURI = new URI("foo");
+ expect(this.normaliser.normalise(testURI)).andThrow(new DeploymentException("fail"));
+ this.startTests();
+ boolean result = this.pipelinedApplicationDeployer.isDeployed(testURI);
+ this.verifyMocks();
+ assertFalse(result);
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunctionTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunctionTests.java
deleted file mode 100644
index d8b3fd8e..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunctionTests.java
+++ /dev/null
@@ -1,164 +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.deployer.core.internal;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.virgo.kernel.core.Signal;
-import org.eclipse.virgo.kernel.deployer.core.internal.SignalJunction;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- */
-public class SignalJunctionTests {
-
- private Signal signal;
-
- private boolean signalCompleted;
-
- private boolean signalFailed;
-
- @Before
- public void setUp() {
- this.signalCompleted = false;
- this.signalFailed = false;
- this.signal = new Signal() {
-
- public void signalFailure(Throwable cause) {
- signalFailed = true;
- }
-
- public void signalSuccessfulCompletion() {
- signalCompleted = true;
- }
-
- };
- }
-
- @Test
- public void testEmptyJunction() {
- new SignalJunction(this.signal, 0);
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
- @Test
- public void testUnaryJunction() {
- SignalJunction sj = new SignalJunction(this.signal, 1);
- sj.getSignals().get(0).signalSuccessfulCompletion();
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
- @Test
- public void testBinaryJunction() {
- SignalJunction sj = new SignalJunction(this.signal, 2);
- sj.getSignals().get(0).signalSuccessfulCompletion();
- sj.getSignals().get(1).signalSuccessfulCompletion();
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
- @Test
- public void testNestedBinaryJunctionOrder1() {
- SignalJunction top = new SignalJunction(this.signal, 2);
- Signal top1 = top.getSignals().get(0);
- Signal top2 = top.getSignals().get(1);
- SignalJunction bottom = new SignalJunction(top2, 2);
- Signal bottom1 = bottom.getSignals().get(0);
- Signal bottom2 = bottom.getSignals().get(1);
- top1.signalSuccessfulCompletion();
- bottom1.signalSuccessfulCompletion();
- bottom2.signalSuccessfulCompletion();
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
- @Test
- public void testNestedBinaryJunctionOrder2() {
- SignalJunction top = new SignalJunction(this.signal, 2);
- Signal top1 = top.getSignals().get(0);
- Signal top2 = top.getSignals().get(1);
- SignalJunction bottom = new SignalJunction(top2, 2);
- Signal bottom1 = bottom.getSignals().get(0);
- Signal bottom2 = bottom.getSignals().get(1);
- bottom1.signalSuccessfulCompletion();
- top1.signalSuccessfulCompletion();
- bottom2.signalSuccessfulCompletion();
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
- @Test
- public void testNestedBinaryJunctionOrder3() {
- SignalJunction top = new SignalJunction(this.signal, 2);
- Signal top1 = top.getSignals().get(0);
- Signal top2 = top.getSignals().get(1);
- SignalJunction bottom = new SignalJunction(top2, 2);
- Signal bottom1 = bottom.getSignals().get(0);
- Signal bottom2 = bottom.getSignals().get(1);
- bottom1.signalSuccessfulCompletion();
- bottom2.signalSuccessfulCompletion();
- top1.signalSuccessfulCompletion();
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
- @Test
- public void testNestedBinaryJunctionOrder4() {
- SignalJunction top = new SignalJunction(this.signal, 2);
- Signal top1 = top.getSignals().get(0);
- Signal top2 = top.getSignals().get(1);
- SignalJunction bottom = new SignalJunction(top2, 2);
- Signal bottom1 = bottom.getSignals().get(0);
- Signal bottom2 = bottom.getSignals().get(1);
- top1.signalSuccessfulCompletion();
- bottom2.signalSuccessfulCompletion();
- bottom1.signalSuccessfulCompletion();
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
- @Test
- public void testNestedBinaryJunctionOrder5() {
- SignalJunction top = new SignalJunction(this.signal, 2);
- Signal top1 = top.getSignals().get(0);
- Signal top2 = top.getSignals().get(1);
- SignalJunction bottom = new SignalJunction(top2, 2);
- Signal bottom1 = bottom.getSignals().get(0);
- Signal bottom2 = bottom.getSignals().get(1);
- bottom2.signalSuccessfulCompletion();
- top1.signalSuccessfulCompletion();
- bottom1.signalSuccessfulCompletion();
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
- @Test
- public void testNestedBinaryJunctionOrder6() {
- SignalJunction top = new SignalJunction(this.signal, 2);
- Signal top1 = top.getSignals().get(0);
- Signal top2 = top.getSignals().get(1);
- SignalJunction bottom = new SignalJunction(top2, 2);
- Signal bottom1 = bottom.getSignals().get(0);
- Signal bottom2 = bottom.getSignals().get(1);
- bottom2.signalSuccessfulCompletion();
- bottom1.signalSuccessfulCompletion();
- top1.signalSuccessfulCompletion();
- assertTrue(this.signalCompleted);
- assertFalse(this.signalFailed);
- }
-
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java
index 5a61bbc3..a766fefc 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java
@@ -23,8 +23,7 @@ import java.util.Map;
import org.junit.Before;
import org.junit.Test;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLog;
import org.eclipse.virgo.util.io.PathReference;
@@ -50,17 +49,17 @@ public class DeployerRecoveryLogTests {
// all true
URI app1 = new File("app/one").toURI();
- log.add(app1, new ApplicationDeployer.DeploymentOptions(true, true, true));
+ log.add(app1, new DeploymentOptions(true, true, true));
// all false
URI app2 = new File("app/two").toURI();
- log.add(app2, new ApplicationDeployer.DeploymentOptions(false, false, false));
+ log.add(app2, new DeploymentOptions(false, false, false));
URI app3 = new File("app/three").toURI();
- log.add(app3, new ApplicationDeployer.DeploymentOptions(false, false, true));
+ log.add(app3, new DeploymentOptions(false, false, true));
URI app4 = new File("app/four").toURI();
- log.add(app4, new ApplicationDeployer.DeploymentOptions(false, true, true));
+ log.add(app4, new DeploymentOptions(false, true, true));
log = new DeployerRecoveryLog(deployArea);
@@ -100,7 +99,7 @@ public class DeployerRecoveryLogTests {
DeployerRecoveryLog log = new DeployerRecoveryLog(deployArea);
URI app1 = new File("app/one").toURI();
for (int i = 0; i < 100; i++) {
- log.add(app1, new ApplicationDeployer.DeploymentOptions(true, true, true));
+ log.add(app1, new DeploymentOptions(true, true, true));
if (i < 99) {
log.remove(app1);
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java
index d2617d58..9de4975f 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java
@@ -25,7 +25,7 @@ import org.junit.Test;
import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener;
import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
import org.eclipse.virgo.util.io.FileSystemEvent;
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java
index c655585b..bc6b5285 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java
@@ -23,9 +23,9 @@ import java.net.URI;
import java.util.Map;
import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
import org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
import org.eclipse.virgo.util.io.PathReference;
import org.junit.After;
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java
index 0c4d992b..d2f879e5 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java
@@ -13,24 +13,23 @@ package org.eclipse.virgo.kernel.install.artifact.internal;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.net.URI;
import java.util.HashSet;
import java.util.Set;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Version;
-
-
import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
-import org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Version;
/**
*/
@@ -42,11 +41,14 @@ public class AbstractInstallArtifactTests {
private static final String PROPERTY_VALUE_2 = "value2";
- private TestInstallArtifact installArtifact;
+ private StubInstallArtifact installArtifact;
+
+ private StubArtifactStateMonitor artifactStateMonitor;
@Before
public void setUp() throws Exception {
- installArtifact = new TestInstallArtifact();
+ this.artifactStateMonitor = new StubArtifactStateMonitor();
+ this.installArtifact = new StubInstallArtifact(artifactStateMonitor);
}
@After
@@ -77,34 +79,126 @@ public class AbstractInstallArtifactTests {
assertEquals(PROPERTY_VALUE, this.installArtifact.setProperty(PROPERTY_NAME, PROPERTY_VALUE_2));
}
- public static final class TestInstallArtifact extends AbstractInstallArtifact {
+ @Test
+ public void testStart() throws DeploymentException {
+ this.artifactStateMonitor.setState(State.RESOLVED);
+ this.installArtifact.start(new StubAbortableSignal());
+
+ assertEquals(0, this.installArtifact.doRefreshCount);
+ assertEquals(1, this.installArtifact.doStartCount);
+ assertEquals(0, this.installArtifact.doStopCount);
+ assertEquals(0, this.installArtifact.doUninstallCount);
+ }
+
+ @Test
+ public void testStartWhenAlreadyStarted() throws DeploymentException {
+ this.artifactStateMonitor.setState(State.ACTIVE);
+ this.installArtifact.start(new StubAbortableSignal());
+
+ assertEquals(0, this.installArtifact.doRefreshCount);
+ assertEquals(0, this.installArtifact.doStartCount);
+ assertEquals(0, this.installArtifact.doStopCount);
+ assertEquals(0, this.installArtifact.doUninstallCount);
+ }
- public TestInstallArtifact() {
- super(new ArtifactIdentity("type", "name", Version.emptyVersion, null), new StubArtifactStorage(), null, null, new MockEventLogger());
+ @Test
+ public void testStop() throws DeploymentException {
+ this.artifactStateMonitor.setState(State.ACTIVE);
+ this.installArtifact.stop();
+
+ assertEquals(0, this.installArtifact.doRefreshCount);
+ assertEquals(0, this.installArtifact.doStartCount);
+ assertEquals(1, this.installArtifact.doStopCount);
+ assertEquals(0, this.installArtifact.doUninstallCount);
+ }
+
+ @Test
+ public void testStopWhenNotStarted() throws DeploymentException {
+ this.artifactStateMonitor.setState(State.INSTALLED);
+ this.installArtifact.stop();
+
+ assertEquals(0, this.installArtifact.doRefreshCount);
+ assertEquals(0, this.installArtifact.doStartCount);
+ assertEquals(0, this.installArtifact.doStopCount);
+ assertEquals(0, this.installArtifact.doUninstallCount);
+ }
+
+ @Test
+ public void testRefresh() throws DeploymentException {
+ this.artifactStateMonitor.setState(State.ACTIVE);
+ assertTrue(this.installArtifact.refresh());
+
+ assertEquals(1, this.installArtifact.doRefreshCount);
+ assertEquals(0, this.installArtifact.doStartCount);
+ assertEquals(0, this.installArtifact.doStopCount);
+ assertEquals(0, this.installArtifact.doUninstallCount);
+ }
+
+ @Test
+ public void testUninstall() throws DeploymentException {
+ this.artifactStateMonitor.setState(State.ACTIVE);
+ this.installArtifact.uninstall();
+
+ assertEquals(0, this.installArtifact.doRefreshCount);
+ assertEquals(0, this.installArtifact.doStartCount);
+ assertEquals(1, this.installArtifact.doStopCount);
+ assertEquals(1, this.installArtifact.doUninstallCount);
+ }
+
+ private final class StubInstallArtifact extends AbstractInstallArtifact {
+
+ public StubInstallArtifact(ArtifactStateMonitor artifactStateMonitor) {
+ super(new ArtifactIdentity("type", "name", Version.emptyVersion, null), new StubArtifactStorage(), artifactStateMonitor, null, new MockEventLogger());
}
+ private int doStopCount = 0;
+
+ private int doStartCount = 0;
+
+ private int doUninstallCount = 0;
+
+ private int doRefreshCount = 0;
+
+ /**
+ * {@inheritDoc}
+ */
@Override
protected void doStop() throws DeploymentException {
- throw new UnsupportedOperationException();
+ this.doStopCount++;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
protected void doUninstall() throws DeploymentException {
- throw new UnsupportedOperationException();
+ this.doUninstallCount++;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- protected void doStart(Signal signal) throws DeploymentException {
- throw new UnsupportedOperationException();
+ protected void doStart(AbortableSignal signal) throws DeploymentException {
+ this.doStartCount++;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
protected boolean doRefresh() throws DeploymentException {
- return false;
+ this.doRefreshCount++;
+ return true;
}
- }
- private static class StubArtifactStorage implements ArtifactStorage {
+ }
+
+
+
+
+
+ static class StubArtifactStorage implements ArtifactStorage {
public void delete() {
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java
index 189221d5..45cc52ef 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java
@@ -19,7 +19,7 @@ import org.osgi.framework.BundleContext;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.deployer.core.StubInstallArtifactLifecycleListener;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
-import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
+import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor;
import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
/**
@@ -35,7 +35,7 @@ public class ArtifactStateMonitorTests {
@Before
public void setUp() {
this.bundleContext = new StubBundleContext();
- this.asm = new ArtifactStateMonitor(this.bundleContext);
+ this.asm = new StandardArtifactStateMonitor(this.bundleContext);
this.listener = new StubInstallArtifactLifecycleListener();
this.bundleContext.registerService(InstallArtifactLifecycleListener.class.getName(), this.listener, null);
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java
index cf4a2f6c..d0110f63 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java
@@ -18,19 +18,16 @@ import java.util.Arrays;
import java.util.List;
import java.util.Set;
-import org.junit.Test;
-import org.osgi.framework.Version;
-
-
import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
import org.eclipse.virgo.kernel.install.artifact.PlanInstallArtifact;
-import org.eclipse.virgo.kernel.install.artifact.internal.AtomicInstallArtifactLifecycleListener;
import org.eclipse.virgo.util.common.ThreadSafeArrayListTree;
import org.eclipse.virgo.util.common.Tree;
+import org.junit.Test;
+import org.osgi.framework.Version;
public class AtomicInstallArtifactLifecycleListenerTests {
@@ -305,7 +302,7 @@ public class AtomicInstallArtifactLifecycleListenerTests {
start(null);
}
- public void start(Signal signal) throws DeploymentException {
+ public void start(AbortableSignal signal) throws DeploymentException {
this.startCalled = true;
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java
index e1681e27..f5011a04 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java
@@ -11,99 +11,97 @@
package org.eclipse.virgo.kernel.install.artifact.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.assertNull;
+import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
+import org.eclipse.virgo.repository.ArtifactBridge;
+import org.eclipse.virgo.repository.ArtifactDescriptor;
+import org.eclipse.virgo.repository.ArtifactGenerationException;
+import org.junit.Test;
+import org.osgi.framework.Version;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Version;
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
-import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
-import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer;
-import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactIdentityDeterminer;
-import org.eclipse.virgo.repository.ArtifactBridge;
-import org.eclipse.virgo.repository.ArtifactDescriptor;
-import org.eclipse.virgo.repository.ArtifactGenerationException;
-
-/**
- */
public class StandardArtifactIdentityDeterminerTests {
- private ArtifactIdentityDeterminer artifactIdentityDeterminer;
-
- @Before
- public void setUp() {
- this.artifactIdentityDeterminer = new StandardArtifactIdentityDeterminer(Collections.<ArtifactBridge>emptySet());
- }
+ private static final File TEST_FILE = new File("test");
@Test
- public void testJarFileType() {
- ArtifactIdentity identity = this.artifactIdentityDeterminer.determineIdentity(new File("test.jar"), null);
- assertEquals(ArtifactIdentityDeterminer.BUNDLE_TYPE, identity.getType());
- assertEquals("test", identity.getName());
- assertEquals(Version.emptyVersion, identity.getVersion());
+ public void identityWithoutBridge() {
+ ArtifactIdentity identity = new StandardArtifactIdentityDeterminer(Collections.<ArtifactBridge>emptySet()).determineIdentity(TEST_FILE, null);
+ assertNull(identity);
}
@Test
- public void testPlanFileType() {
- ArtifactIdentity identity = this.artifactIdentityDeterminer.determineIdentity(new File("test.plan"), null);
- assertEquals(ArtifactIdentityDeterminer.PLAN_TYPE, identity.getType());
- assertEquals("test", identity.getName());
- assertEquals(Version.emptyVersion, identity.getVersion());
- }
+ public void identityFromBridge() throws ArtifactGenerationException {
+ ArtifactDescriptor artifactDescriptor = createArtifactDescriptorMock();
+ ArtifactBridge bridge = createArtifactBridgeMock(artifactDescriptor);
- @Test
- public void testPropertiesFileType() {
- ArtifactIdentity identity = this.artifactIdentityDeterminer.determineIdentity(new File("test.properties"), null);
- assertEquals(ArtifactIdentityDeterminer.CONFIGURATION_TYPE, identity.getType());
- assertEquals("test", identity.getName());
- assertEquals(Version.emptyVersion, identity.getVersion());
- }
+ checkIdentityDeterminer(bridge);
- @Test
- public void testParFileType() {
- ArtifactIdentity identity = this.artifactIdentityDeterminer.determineIdentity(new File("test.par"), null);
- assertEquals(ArtifactIdentityDeterminer.PAR_TYPE, identity.getType());
- assertEquals("test", identity.getName());
- assertEquals(Version.emptyVersion, identity.getVersion());
+ verify(artifactDescriptor, bridge);
}
@Test
- public void testWarFileType() {
- assertNull(this.artifactIdentityDeterminer.determineIdentity(new File("test.war"), null));
+ public void identityFromBridgeThrowingException() throws ArtifactGenerationException {
+ ArtifactDescriptor artifactDescriptor = createArtifactDescriptorMock();
+ ArtifactBridge interestedBridge = createArtifactBridgeMock(artifactDescriptor);
+
+ ArtifactBridge throwingBridge = createMock(ArtifactBridge.class);
+ expect(throwingBridge.generateArtifactDescriptor(new File("test"))).andThrow(new ArtifactGenerationException("Illegal argument"));
+
+ replay(throwingBridge);
+
+ assertNull(new StandardArtifactIdentityDeterminer(new LinkedHashSet<ArtifactBridge>(Arrays.asList(throwingBridge, interestedBridge))).determineIdentity(new File("test"), null));
}
@Test
- public void testNoFileType() {
- assertNull(this.artifactIdentityDeterminer.determineIdentity(new File("test"), null));
+ public void identityFromSeveralBridges() throws ArtifactGenerationException {
+ ArtifactDescriptor artifactDescriptor = createArtifactDescriptorMock();
+ ArtifactBridge interestedBridge = createArtifactBridgeMock(artifactDescriptor);
+
+ ArtifactBridge throwingBridge = createMock(ArtifactBridge.class);
+
+ ArtifactBridge uninterestedBridge = createMock(ArtifactBridge.class);
+ expect(uninterestedBridge.generateArtifactDescriptor(TEST_FILE)).andReturn(null);
+
+ replay(throwingBridge, uninterestedBridge);
+
+ checkIdentityDeterminer(uninterestedBridge, interestedBridge, throwingBridge);
+
+ verify(artifactDescriptor, throwingBridge, interestedBridge, uninterestedBridge);
}
-
- @Test
- public void identityFromBridge() throws ArtifactGenerationException {
+
+ private ArtifactDescriptor createArtifactDescriptorMock() throws ArtifactGenerationException {
ArtifactDescriptor artifactDescriptor = createMock(ArtifactDescriptor.class);
expect(artifactDescriptor.getType()).andReturn("foo");
expect(artifactDescriptor.getName()).andReturn("bar");
- expect(artifactDescriptor.getVersion()).andReturn(new Version(1,2,3));
-
+ expect(artifactDescriptor.getVersion()).andReturn(new Version(1, 2, 3));
+
+ replay(artifactDescriptor);
+
+ return artifactDescriptor;
+ }
+
+ private ArtifactBridge createArtifactBridgeMock(ArtifactDescriptor descriptor) throws ArtifactGenerationException {
ArtifactBridge bridge = createMock(ArtifactBridge.class);
- expect(bridge.generateArtifactDescriptor(new File("test"))).andReturn(artifactDescriptor);
-
- replay(artifactDescriptor, bridge);
-
- ArtifactIdentity artifactIdentity = new StandardArtifactIdentityDeterminer(new HashSet<ArtifactBridge>(Arrays.asList(bridge))).determineIdentity(new File("test"), null);
+ expect(bridge.generateArtifactDescriptor(new File("test"))).andReturn(descriptor);
+
+ replay(bridge);
+
+ return bridge;
+ }
+
+ private void checkIdentityDeterminer(ArtifactBridge... bridges) {
+ ArtifactIdentity artifactIdentity = new StandardArtifactIdentityDeterminer(new LinkedHashSet<ArtifactBridge>(Arrays.asList(bridges))).determineIdentity(TEST_FILE, null);
+ assertNotNull(artifactIdentity);
assertEquals("foo", artifactIdentity.getType());
assertEquals("bar", artifactIdentity.getName());
- assertEquals(new Version(1,2,3), artifactIdentity.getVersion());
-
- verify(artifactDescriptor, bridge);
+ assertEquals(new Version(1, 2, 3), artifactIdentity.getVersion());
}
+
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java
index 42eb1459..d9db9601 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java
@@ -38,7 +38,7 @@ import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
import org.eclipse.virgo.kernel.artifact.fs.StandardArtifactFSFactory;
import org.eclipse.virgo.kernel.core.BundleStarter;
import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
import org.eclipse.virgo.kernel.install.artifact.BundleInstallArtifact;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory;
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubAbortableSignal.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubAbortableSignal.java
new file mode 100644
index 00000000..a1a86e0d
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubAbortableSignal.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.install.artifact.internal;
+
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+
+class StubAbortableSignal implements AbortableSignal {
+
+ private volatile boolean complete = false;
+
+ private volatile boolean aborted = false;
+
+ private volatile Throwable cause = null;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void signalSuccessfulCompletion() {
+ this.complete = true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void signalFailure(Throwable t) {
+ this.complete = true;
+ this.cause = t;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void signalAborted() {
+ this.complete = true;
+ this.aborted = true;
+ }
+
+ public boolean isComplete() {
+ return this.complete;
+ }
+
+ public boolean isAborted() {
+ return this.aborted;
+ }
+
+ public Throwable getCause() {
+ return this.cause;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java
index c3994058..48308a5b 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java
@@ -49,9 +49,12 @@ public class StubArtifactBridge implements ArtifactBridge {
*/
public ArtifactDescriptor generateArtifactDescriptor(File artifactFile) throws ArtifactGenerationException {
boolean matched = false;
+ final String fileName = artifactFile.getName();
+
for(String ending : this.matchs){
- if(artifactFile.getName().endsWith(ending)){
+ if(fileName.endsWith(ending)){
matched = true;
+ break;
}
}
@@ -59,7 +62,7 @@ public class StubArtifactBridge implements ArtifactBridge {
return new ArtifactDescriptor() {
public Version getVersion() {
- return null;
+ return Version.emptyVersion;
}
public URI getUri() {
@@ -71,11 +74,11 @@ public class StubArtifactBridge implements ArtifactBridge {
}
public String getName() {
- return null;
+ return fileName.substring(0, fileName.lastIndexOf('.'));
}
public String getFilename() {
- return null;
+ return fileName;
}
public Set<Attribute> getAttributes() {
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactStateMonitor.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactStateMonitor.java
new file mode 100644
index 00000000..aeba2105
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactStateMonitor.java
@@ -0,0 +1,164 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 copyright_holder
+ * 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:
+ * cgfrost - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.install.artifact.internal;
+
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
+
+/**
+ * TODO Document StubArtifactStateMonitor
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * TODO Document concurrent semantics of StubArtifactStateMonitor
+ */
+public class StubArtifactStateMonitor implements ArtifactStateMonitor {
+
+ private State myState = State.RESOLVED;
+
+ /**
+ * {@inheritDoc}
+ */
+ public State getState() {
+ return this.myState;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setState(State state) {
+ this.myState = state;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onInstalling(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onInstallFailed(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onInstalled(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onResolving(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onResolveFailed(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onResolved(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean onStarting(InstallArtifact installArtifact) throws DeploymentException {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStartAborted(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStarted(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStopping(InstallArtifact installArtifact) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStopFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onStopped(InstallArtifact installArtifact) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onUnresolved(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onUninstalling(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onUninstallFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onUninstalled(InstallArtifact installArtifact) throws DeploymentException {
+
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java
index 93021072..8716c3e9 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java
@@ -39,6 +39,7 @@ import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
import org.eclipse.virgo.kernel.install.artifact.BundleInstallArtifact;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
+import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor;
import org.eclipse.virgo.kernel.install.artifact.internal.StubInstallArtifactRefreshHandler;
import org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleDriver;
import org.eclipse.virgo.kernel.install.artifact.internal.bundle.StandardBundleInstallArtifact;
@@ -65,7 +66,7 @@ public class StandardBundleInstallArtifactTests {
private final BundleContext bundleContext = new StubBundleContext();
- private final ArtifactStateMonitor artifactStateMonitor = new ArtifactStateMonitor(this.bundleContext);
+ private final ArtifactStateMonitor artifactStateMonitor = new StandardArtifactStateMonitor(this.bundleContext);
private BundleInstallArtifact createInstallArtifact(ArtifactStorage artifactStorage, ArtifactStateMonitor artifactStateMonitor)
throws IOException {
diff --git a/org.eclipse.virgo.kernel.deployer/template.mf b/org.eclipse.virgo.kernel.deployer/template.mf
index 877fabb1..1706cb73 100644
--- a/org.eclipse.virgo.kernel.deployer/template.mf
+++ b/org.eclipse.virgo.kernel.deployer/template.mf
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Virgo Kernel Deployer
Bundle-SymbolicName: org.eclipse.virgo.kernel.deployer
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
Import-Template:
org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
diff --git a/org.eclipse.virgo.kernel.dmfragment/.classpath b/org.eclipse.virgo.kernel.dmfragment/.classpath
index 543c7046..a736de03 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.classpath
+++ b/org.eclipse.virgo.kernel.dmfragment/.classpath
@@ -1,43 +1,43 @@
-<?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 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.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/2.5.6/org.springframework.context-sources-2.5.6.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/2.5.6/org.springframework.beans-sources-2.5.6.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.aop/3.0.0.RELEASE/org.springframework.aop-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.aop/2.5.6/org.springframework.aop-2.5.6.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.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.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-sources-1.2.1.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.0.200809221524/org.eclipse.osgi-3.5.0.200809221524.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/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar">
- <attributes>
- <attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
- </attributes>
- </classpathentry>
- <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 combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.agent.dm"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?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 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.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/2.5.6/org.springframework.context-sources-2.5.6.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/2.5.6/org.springframework.beans-sources-2.5.6.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.aop/3.0.0.RELEASE/org.springframework.aop-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.aop/2.5.6/org.springframework.aop-2.5.6.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.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.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-sources-1.2.1.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.0.200809221524/org.eclipse.osgi-3.5.0.200809221524.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.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar">
+ <attributes>
+ <attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
+ </attributes>
+ </classpathentry>
+ <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 combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.agent.dm"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.virgo.kernel.dmfragment/.project b/org.eclipse.virgo.kernel.dmfragment/.project
index db961688..6b117569 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.project
+++ b/org.eclipse.virgo.kernel.dmfragment/.project
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.virgo.kernel.dmfragment</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>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.virgo.kernel.dmfragment</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.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs b/org.eclipse.virgo.kernel.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs
index 61ee8a9b..d4dd06e4 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs
+++ b/org.eclipse.virgo.kernel.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 06 09:06:52 BST 2009
-com.springsource.server.ide.bundlor.core.template.properties.files=../build.properties;../build.versions
-eclipse.preferences.version=1
+#Mon Jul 06 09:06:52 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.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml b/org.eclipse.virgo.kernel.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml
index 801f856c..c9a337a6 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/org.eclipse.virgo.kernel.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <installed facet="com.springsource.server.bundle" version="1.0"/>
-</faceted-project>
+<?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.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs b/org.eclipse.virgo.kernel.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs
index e68da314..b8bf5a67 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs
+++ b/org.eclipse.virgo.kernel.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 06 16:49:15 BST 2009
-eclipse.preferences.version=1
-org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false
+#Mon Jul 06 16:49:15 BST 2009
+eclipse.preferences.version=1
+org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false
diff --git a/org.eclipse.virgo.kernel.dmfragment/.springBeans b/org.eclipse.virgo.kernel.dmfragment/.springBeans
index a151801d..9b08bae9 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.springBeans
+++ b/org.eclipse.virgo.kernel.dmfragment/.springBeans
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beansProjectDescription>
- <version>1</version>
- <pluginVersion><![CDATA[2.2.5.200906231226-RC1]]></pluginVersion>
- <configSuffixes>
- <configSuffix><![CDATA[xml]]></configSuffix>
- </configSuffixes>
- <enableImports><![CDATA[false]]></enableImports>
- <configs>
- <config>src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml</config>
- </configs>
- <configSets>
- </configSets>
-</beansProjectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<beansProjectDescription>
+ <version>1</version>
+ <pluginVersion><![CDATA[2.2.5.200906231226-RC1]]></pluginVersion>
+ <configSuffixes>
+ <configSuffix><![CDATA[xml]]></configSuffix>
+ </configSuffixes>
+ <enableImports><![CDATA[false]]></enableImports>
+ <configs>
+ <config>src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml</config>
+ </configs>
+ <configSets>
+ </configSets>
+</beansProjectDescription>
diff --git a/org.eclipse.virgo.kernel.dmfragment/build.xml b/org.eclipse.virgo.kernel.dmfragment/build.xml
index 70d6c23f..7ee9d516 100644
--- a/org.eclipse.virgo.kernel.dmfragment/build.xml
+++ b/org.eclipse.virgo.kernel.dmfragment/build.xml
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.virgo.kernel.dmfragment">
-
- <property file="${basedir}/../build.properties"/>
- <property file="${basedir}/../build.versions"/>
- <import file="${basedir}/../virgo-build/weaving/default.xml"/>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="org.eclipse.virgo.kernel.dmfragment">
+
+ <property file="${basedir}/../build.properties"/>
+ <property file="${basedir}/../build.versions"/>
+ <import file="${basedir}/../virgo-build/weaving/default.xml"/>
+
+</project>
diff --git a/org.eclipse.virgo.kernel.dmfragment/ivy.xml b/org.eclipse.virgo.kernel.dmfragment/ivy.xml
index 670982dc..7c5cab03 100644
--- a/org.eclipse.virgo.kernel.dmfragment/ivy.xml
+++ b/org.eclipse.virgo.kernel.dmfragment/ivy.xml
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
-<ivy-module
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"
- version="1.3">
-
- <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" type="src" ext="jar"/>
- </publications>
-
- <dependencies>
- <dependency org="org.springframework" name="org.springframework.beans" rev="${org.springframework}" conf="compile->runtime"/>
- <dependency org="org.springframework" name="org.springframework.context" rev="${org.springframework}" conf="compile->runtime"/>
- <dependency org="org.springframework" name="org.springframework.context.support" rev="${org.springframework}" conf="compile->runtime"/>
- <dependency org="org.springframework" name="org.springframework.core" 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.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.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"/>
- <dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="test->runtime"/>
-
- <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"/>
-
- <override org="org.springframework" rev="${org.springframework}"/>
- <override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
- </dependencies>
-</ivy-module>
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
+<ivy-module
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"
+ version="1.3">
+
+ <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" type="src" ext="jar"/>
+ </publications>
+
+ <dependencies>
+ <dependency org="org.springframework" name="org.springframework.beans" rev="${org.springframework}" conf="compile->runtime"/>
+ <dependency org="org.springframework" name="org.springframework.context" rev="${org.springframework}" conf="compile->runtime"/>
+ <dependency org="org.springframework" name="org.springframework.context.support" rev="${org.springframework}" conf="compile->runtime"/>
+ <dependency org="org.springframework" name="org.springframework.core" 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.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.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"/>
+ <dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="test->runtime"/>
+
+ <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"/>
+
+ <override org="org.springframework" rev="${org.springframework}"/>
+ <override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
+ </dependencies>
+</ivy-module>
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java
index 8c252b11..18c74410 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * 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.dmfragment;
-
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-
-/**
- * <strong>Concurrent Semantics</strong><br />
- *
- * Implementations must be thread-safe.
- *
- */
-public interface ModuleBeanFactoryPostProcessor {
-
- void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory);
-}
+/*******************************************************************************
+ * 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.dmfragment;
+
+import org.osgi.framework.BundleContext;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+
+/**
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * Implementations must be thread-safe.
+ *
+ */
+public interface ModuleBeanFactoryPostProcessor {
+
+ void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory);
+}
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java
index 579c69ff..c9c992e6 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * 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.dmfragment.internal;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.BeanFactoryUtils;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.ApplicationContextEvent;
-import org.springframework.context.event.ContextClosedEvent;
-import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
-
-/**
- * {@link ApplicationContextShutdownBean} manages the shutting down of application contexts in the dm Server. In
- * particular it is responsible for ensuring that Spring DM service proxies do not hold up application context shutdown.
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * This class is thread safe.
- *
- */
-// Note that this class must not implement ApplicationListener<ContextClosedEvent> since it needs to work with Spring
-// 2.5.x as well as Spring 3 and beyond.
-final class ApplicationContextShutdownBean implements ApplicationListener<ApplicationEvent> {
-
- private static final Logger logger = LoggerFactory.getLogger(ApplicationContextShutdownBean.class);
-
- /**
- * {@inheritDoc}
- */
- public void onApplicationEvent(ApplicationEvent event) {
- if (event instanceof ContextClosedEvent) {
- logger.info("Processing ContextClosedEvent '{}'", event);
- ApplicationContext applicationContext = ((ApplicationContextEvent) event).getApplicationContext();
- disableServiceProxyRetry(applicationContext);
- }
- }
-
- static void disableServiceProxyRetry(ApplicationContext applicationContext) {
- for (OsgiServiceProxyFactoryBean proxyBean : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext,
- OsgiServiceProxyFactoryBean.class, true, false).values()) {
- logger.info("Setting timeout to 0 for proxy '{}' of application context '{}'", proxyBean, applicationContext);
- proxyBean.setTimeout(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.dmfragment.internal;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.BeanFactoryUtils;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ApplicationContextEvent;
+import org.springframework.context.event.ContextClosedEvent;
+import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
+
+/**
+ * {@link ApplicationContextShutdownBean} manages the shutting down of application contexts in the dm Server. In
+ * particular it is responsible for ensuring that Spring DM service proxies do not hold up application context shutdown.
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * This class is thread safe.
+ *
+ */
+// Note that this class must not implement ApplicationListener<ContextClosedEvent> since it needs to work with Spring
+// 2.5.x as well as Spring 3 and beyond.
+final class ApplicationContextShutdownBean implements ApplicationListener<ApplicationEvent> {
+
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationContextShutdownBean.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onApplicationEvent(ApplicationEvent event) {
+ if (event instanceof ContextClosedEvent) {
+ logger.info("Processing ContextClosedEvent '{}'", event);
+ ApplicationContext applicationContext = ((ApplicationContextEvent) event).getApplicationContext();
+ disableServiceProxyRetry(applicationContext);
+ }
+ }
+
+ static void disableServiceProxyRetry(ApplicationContext applicationContext) {
+ for (OsgiServiceProxyFactoryBean proxyBean : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext,
+ OsgiServiceProxyFactoryBean.class, true, false).values()) {
+ logger.info("Setting timeout to 0 for proxy '{}' of application context '{}'", proxyBean, applicationContext);
+ proxyBean.setTimeout(0);
+ }
+ }
+}
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java
index cb9e6b77..28c148e9 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * 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.dmfragment.internal;
-
-import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-
-
-
-final class ApplicationContextShutdownBeanPostProcessor implements ModuleBeanFactoryPostProcessor{
-
- private static final String APPLICATION_CONTEXT_SHUTDOWN_BEAN_NAME = "org.eclipse.virgo.server.applicationContextShutdownBean";
-
- /**
- * {@inheritDoc}
- */
- public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
- beanFactory.registerSingleton(APPLICATION_CONTEXT_SHUTDOWN_BEAN_NAME, new ApplicationContextShutdownBean());
- }
-
-}
+/*******************************************************************************
+ * 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.dmfragment.internal;
+
+import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
+import org.osgi.framework.BundleContext;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+
+
+
+final class ApplicationContextShutdownBeanPostProcessor implements ModuleBeanFactoryPostProcessor{
+
+ private static final String APPLICATION_CONTEXT_SHUTDOWN_BEAN_NAME = "org.eclipse.virgo.server.applicationContextShutdownBean";
+
+ /**
+ * {@inheritDoc}
+ */
+ public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
+ beanFactory.registerSingleton(APPLICATION_CONTEXT_SHUTDOWN_BEAN_NAME, new ApplicationContextShutdownBean());
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java
index 1fc41bf8..dcc4f095 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * 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.dmfragment.internal;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor;
-import org.springframework.osgi.service.importer.support.ImportContextClassLoader;
-import org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean;
-import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
-
-
-/**
- * {@link OsgiBeanFactoryPostProcessor} that ensures that all service references are in unmanaged mode for thread
- * context class loader propagation.<p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-final class ContextClassLoaderPostProcessor implements ModuleBeanFactoryPostProcessor {
-
- private static final String PROPERTY_CONTEXT_CLASS_LOADER = "contextClassLoader";
-
- private static final Set<String> IMPORTER_CLASS_NAMES = createImportClassNames();
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("deprecation")
- public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
- String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
- for (String name : beanDefinitionNames) {
- BeanDefinition beanDefinition = beanFactory.getBeanDefinition(name);
- if (isServiceImportDefinition(beanDefinition)) {
- MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
- propertyValues.addPropertyValue(PROPERTY_CONTEXT_CLASS_LOADER, ImportContextClassLoader.UNMANAGED.getLabel());
- }
- }
- }
-
- private static Set<String> createImportClassNames() {
- Set<String> names = new HashSet<String>();
- names.add(OsgiServiceProxyFactoryBean.class.getName());
- names.add(OsgiServiceCollectionProxyFactoryBean.class.getName());
- return names;
- }
-
- private boolean isServiceImportDefinition(BeanDefinition beanDefinition) {
- return IMPORTER_CLASS_NAMES.contains(beanDefinition.getBeanClassName());
- }
-
-}
+/*******************************************************************************
+ * 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.dmfragment.internal;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
+import org.osgi.framework.BundleContext;
+import org.springframework.beans.MutablePropertyValues;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor;
+import org.springframework.osgi.service.importer.support.ImportContextClassLoader;
+import org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean;
+import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
+
+
+/**
+ * {@link OsgiBeanFactoryPostProcessor} that ensures that all service references are in unmanaged mode for thread
+ * context class loader propagation.<p/>
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * Threadsafe.
+ *
+ */
+final class ContextClassLoaderPostProcessor implements ModuleBeanFactoryPostProcessor {
+
+ private static final String PROPERTY_CONTEXT_CLASS_LOADER = "contextClassLoader";
+
+ private static final Set<String> IMPORTER_CLASS_NAMES = createImportClassNames();
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("deprecation")
+ public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
+ String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
+ for (String name : beanDefinitionNames) {
+ BeanDefinition beanDefinition = beanFactory.getBeanDefinition(name);
+ if (isServiceImportDefinition(beanDefinition)) {
+ MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
+ propertyValues.addPropertyValue(PROPERTY_CONTEXT_CLASS_LOADER, ImportContextClassLoader.UNMANAGED.getLabel());
+ }
+ }
+ }
+
+ private static Set<String> createImportClassNames() {
+ Set<String> names = new HashSet<String>();
+ names.add(OsgiServiceProxyFactoryBean.class.getName());
+ names.add(OsgiServiceCollectionProxyFactoryBean.class.getName());
+ return names;
+ }
+
+ private boolean isServiceImportDefinition(BeanDefinition beanDefinition) {
+ return IMPORTER_CLASS_NAMES.contains(beanDefinition.getBeanClassName());
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java
index 111b288f..f8a0b663 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * 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.dmfragment.internal;
-
-import javax.management.MBeanException;
-import javax.management.modelmbean.ModelMBean;
-
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.springframework.jmx.export.annotation.AnnotationMBeanExporter;
-
-
-/**
- * An extension of {@link AnnotationMBeanExporter} that exports Kernel-specific MBeans.
- *
- * <strong>Concurrent Semantics</strong><br />
- * As thread-safe as <code>MBeanExporter</code>.
- */
-final class KernelAnnotationMBeanExporter extends AnnotationMBeanExporter {
-
- private final TracingService tracingService;
-
- KernelAnnotationMBeanExporter(TracingService tracingService) {
- this.tracingService = tracingService;
- }
-
- @Override
- protected ModelMBean createModelMBean() throws MBeanException {
- return new KernelModelMBean(this.tracingService, this.tracingService.getCurrentApplicationName());
- }
-}
+/*******************************************************************************
+ * 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.dmfragment.internal;
+
+import javax.management.MBeanException;
+import javax.management.modelmbean.ModelMBean;
+
+import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
+import org.springframework.jmx.export.annotation.AnnotationMBeanExporter;
+
+
+/**
+ * An extension of {@link AnnotationMBeanExporter} that exports Kernel-specific MBeans.
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * As thread-safe as <code>MBeanExporter</code>.
+ */
+final class KernelAnnotationMBeanExporter extends AnnotationMBeanExporter {
+
+ private final TracingService tracingService;
+
+ KernelAnnotationMBeanExporter(TracingService tracingService) {
+ this.tracingService = tracingService;
+ }
+
+ @Override
+ protected ModelMBean createModelMBean() throws MBeanException {
+ return new KernelModelMBean(this.tracingService, this.tracingService.getCurrentApplicationName());
+ }
+}
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java
index f20252ac..0fc7c1db 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * 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.dmfragment.internal;
-
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor;
-
-
-/**
- * {@link OsgiBeanFactoryPostProcessor} implementation that plugs in Server extensions implementation when needed.<p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-final class KernelExtensionConfiguringOsgiPostProcessor implements OsgiBeanFactoryPostProcessor {
-
- private final List<ModuleBeanFactoryPostProcessor> postProcessors = new CopyOnWriteArrayList<ModuleBeanFactoryPostProcessor>();
-
- KernelExtensionConfiguringOsgiPostProcessor(List<ModuleBeanFactoryPostProcessor> defaultPostProcessors) {
- this.postProcessors.addAll(defaultPostProcessors);
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void postProcessBeanFactory(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
- for (ModuleBeanFactoryPostProcessor postProcessor : this.postProcessors) {
- postProcessor.postProcess(bundleContext, beanFactory);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.dmfragment.internal;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
+import org.osgi.framework.BundleContext;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor;
+
+
+/**
+ * {@link OsgiBeanFactoryPostProcessor} implementation that plugs in Server extensions implementation when needed.<p/>
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * Threadsafe.
+ *
+ */
+final class KernelExtensionConfiguringOsgiPostProcessor implements OsgiBeanFactoryPostProcessor {
+
+ private final List<ModuleBeanFactoryPostProcessor> postProcessors = new CopyOnWriteArrayList<ModuleBeanFactoryPostProcessor>();
+
+ KernelExtensionConfiguringOsgiPostProcessor(List<ModuleBeanFactoryPostProcessor> defaultPostProcessors) {
+ this.postProcessors.addAll(defaultPostProcessors);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void postProcessBeanFactory(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
+ for (ModuleBeanFactoryPostProcessor postProcessor : this.postProcessors) {
+ postProcessor.postProcess(bundleContext, beanFactory);
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java
index 0c044396..af0b804d 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * 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.dmfragment.internal;
-
-import java.lang.instrument.ClassFileTransformer;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.springframework.beans.factory.BeanClassLoaderAware;
-import org.springframework.instrument.classloading.LoadTimeWeaver;
-import org.springframework.osgi.util.BundleDelegatingClassLoader;
-
-import org.eclipse.virgo.kernel.osgi.framework.InstrumentableClassLoader;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
-
-/**
- * {@link LoadTimeWeaver} implementation that plugs into the {@link InstrumentableClassLoader
- * InstrumentableClassLoaders} created for all installed bundles.<p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-final class KernelLoadTimeWeaver implements LoadTimeWeaver, BeanClassLoaderAware {
-
- private volatile InstrumentableClassLoader instrumentableClassLoader;
-
- /**
- * {@inheritDoc}
- */
- public void addTransformer(ClassFileTransformer transformer) {
- this.instrumentableClassLoader.addClassFileTransformer(transformer);
- }
-
- /**
- * {@inheritDoc}
- */
- public ClassLoader getInstrumentableClassLoader() {
- return (ClassLoader) this.instrumentableClassLoader;
- }
-
- /**
- * {@inheritDoc}
- */
- public ClassLoader getThrowawayClassLoader() {
- return this.instrumentableClassLoader.createThrowAway();
- }
-
- /**
- * {@inheritDoc}
- */
- public void setBeanClassLoader(ClassLoader classLoader) {
- InstrumentableClassLoader instrumentableClassLoader = null;
- if (classLoader instanceof InstrumentableClassLoader) {
- instrumentableClassLoader = (InstrumentableClassLoader) classLoader;
- } else if (classLoader instanceof BundleDelegatingClassLoader) {
- Bundle bundle = ((BundleDelegatingClassLoader) classLoader).getBundle();
- ClassLoader bundleClassLoader = getBundleClassLoader(bundle);
- if (bundleClassLoader instanceof InstrumentableClassLoader) {
- instrumentableClassLoader = (InstrumentableClassLoader) bundleClassLoader;
- }
- }
- if (instrumentableClassLoader == null) {
- throw new IllegalStateException("ClassLoader '" + classLoader + "' is not instrumentable.");
- }
- this.instrumentableClassLoader = instrumentableClassLoader;
- }
-
- /**
- * Gets the {@link ClassLoader} for the supplied {@link Bundle}.
- *
- * @param bundle the <code>Bundle</code>.
- * @return the <code>Bundles</code> <code>ClassLoader</code>.
- */
- private ClassLoader getBundleClassLoader(Bundle bundle) {
- BundleContext bundleContext = bundle.getBundleContext();
- ServiceReference<OsgiFramework> serviceReference = bundleContext.getServiceReference(OsgiFramework.class);
- try {
- OsgiFramework framework = bundleContext.getService(serviceReference);
- return framework.getBundleClassLoader(bundle);
- } finally {
- bundleContext.ungetService(serviceReference);
- }
- }
-
-}
+/*******************************************************************************
+ * 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.dmfragment.internal;
+
+import java.lang.instrument.ClassFileTransformer;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.springframework.beans.factory.BeanClassLoaderAware;
+import org.springframework.instrument.classloading.LoadTimeWeaver;
+import org.springframework.osgi.util.BundleDelegatingClassLoader;
+
+import org.eclipse.virgo.kernel.osgi.framework.InstrumentableClassLoader;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
+
+/**
+ * {@link LoadTimeWeaver} implementation that plugs into the {@link InstrumentableClassLoader
+ * InstrumentableClassLoaders} created for all installed bundles.<p/>
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * Threadsafe.
+ *
+ */
+final class KernelLoadTimeWeaver implements LoadTimeWeaver, BeanClassLoaderAware {
+
+ private volatile InstrumentableClassLoader instrumentableClassLoader;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addTransformer(ClassFileTransformer transformer) {
+ this.instrumentableClassLoader.addClassFileTransformer(transformer);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ClassLoader getInstrumentableClassLoader() {
+ return (ClassLoader) this.instrumentableClassLoader;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ClassLoader getThrowawayClassLoader() {
+ return this.instrumentableClassLoader.createThrowAway();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setBeanClassLoader(ClassLoader classLoader) {
+ InstrumentableClassLoader instrumentableClassLoader = null;
+ if (classLoader instanceof InstrumentableClassLoader) {
+ instrumentableClassLoader = (InstrumentableClassLoader) classLoader;
+ } else if (classLoader instanceof BundleDelegatingClassLoader) {
+ Bundle bundle = ((BundleDelegatingClassLoader) classLoader).getBundle();
+ ClassLoader bundleClassLoader = getBundleClassLoader(bundle);
+ if (bundleClassLoader instanceof InstrumentableClassLoader) {
+ instrumentableClassLoader = (InstrumentableClassLoader) bundleClassLoader;
+ }
+ }
+ if (instrumentableClassLoader == null) {
+ throw new IllegalStateException("ClassLoader '" + classLoader + "' is not instrumentable.");
+ }
+ this.instrumentableClassLoader = instrumentableClassLoader;
+ }
+
+ /**
+ * Gets the {@link ClassLoader} for the supplied {@link Bundle}.
+ *
+ * @param bundle the <code>Bundle</code>.
+ * @return the <code>Bundles</code> <code>ClassLoader</code>.
+ */
+ private ClassLoader getBundleClassLoader(Bundle bundle) {
+ BundleContext bundleContext = bundle.getBundleContext();
+ ServiceReference<OsgiFramework> serviceReference = bundleContext.getServiceReference(OsgiFramework.class);
+ try {
+ OsgiFramework framework = bundleContext.getService(serviceReference);
+ return framework.getBundleClassLoader(bundle);
+ } finally {
+ bundleContext.ungetService(serviceReference);
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java
index d6cb410b..96a9ba02 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * 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.dmfragment.internal;
-
-import javax.management.MBeanException;
-import javax.management.modelmbean.ModelMBean;
-
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.springframework.jmx.export.MBeanExporter;
-
-
-/**
- * An extension of {@link MBeanExporter} that exports Server-specific MBeans.
- *
- * <strong>Concurrent Semantics</strong><br />
- * As thread-safe as <code>MBeanExporter</code>.
- *
- */
-final class KernelMBeanExporter extends MBeanExporter {
-
- private final TracingService tracingService;
-
- KernelMBeanExporter(TracingService tracingService) {
- this.tracingService = tracingService;
- }
-
- @Override
- protected ModelMBean createModelMBean() throws MBeanException {
- return new KernelModelMBean(this.tracingService, this.tracingService.getCurrentApplicationName());
- }
-}
+/*******************************************************************************
+ * 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.dmfragment.internal;
+
+import javax.management.MBeanException;
+import javax.management.modelmbean.ModelMBean;
+
+import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
+import org.springframework.jmx.export.MBeanExporter;
+
+
+/**
+ * An extension of {@link MBeanExporter} that exports Server-specific MBeans.
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * As thread-safe as <code>MBeanExporter</code>.
+ *
+ */
+final class KernelMBeanExporter extends MBeanExporter {
+
+ private final TracingService tracingService;
+
+ KernelMBeanExporter(TracingService tracingService) {
+ this.tracingService = tracingService;
+ }
+
+ @Override
+ protected ModelMBean createModelMBean() throws MBeanException {
+ return new KernelModelMBean(this.tracingService, this.tracingService.getCurrentApplicationName());
+ }
+}
diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java
index 3f357741..faae0f06 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * 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.dmfragment.internal;
-
-import javax.management.MBeanException;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.springframework.jmx.export.SpringModelMBean;
-
-
-/**
- * An extension of {@link SpringModelMBean} that acts as a Server-specific MBeans.
- *
- * <strong>Concurrent Semantics</strong><br />
- * As thread-safe as <code>SpringModelMBean</code>.
- */
-final class KernelModelMBean extends SpringModelMBean {
-
- private final TracingService tracingService;
-
- private final String applicationName;
-
- public KernelModelMBean(TracingService tracingService, String applicationName) throws RuntimeOperationsException, MBeanException {
- this.tracingService = tracingService;
- this.applicationName = applicationName;
- }
-
- @Override
- public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException {
- String originalApplicationName = this.tracingService.getCurrentApplicationName();
-
- try {
- this.tracingService.setCurrentApplicationName(this.applicationName);
- return super.invoke(opName, opArgs, sig);
- } finally {
- this.tracingService.setCurrentApplicationName(originalApplicationName);
- }
- }
-}
+/*******************************************************************************
+ * 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.dmfragment.internal;
+
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.RuntimeOperationsException;
+
+import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
+import org.springframework.jmx.export.SpringModelMBean;
+
+
+/**
+ * An extension of {@link SpringModelMBean} that acts as a Server-specific MBeans.
+ *